Laxkit  0.0.7.1
sliderpopup.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2006,2010 by Tom Lechner
22 //
23 #ifndef _LAX_SLIDERPOPUP_H
24 #define _LAX_SLIDERPOPUP_H
25 
26 #include <lax/itemslider.h>
27 #include <lax/menuinfo.h>
28 
29 namespace Laxkit {
30 
31 #define SLIDER_ICON_ONLY (0<<21)
32 #define SLIDER_TEXT_ONLY (1<<21)
33 #define SLIDER_TEXT_ICON (2<<21)
34 #define SLIDER_ICON_TEXT (3<<21)
35 #define SLIDER_WHAT_MASK (3<<21)
36 #define SLIDER_ALLOW_EDIT (1<<23)
37 #define SLIDER_SEND_STRING (1<<24)
38 #define SLIDER_LEFT (1<<25)
39 #define SLIDER_RIGHT (1<<26)
40 #define SLIDER_CENTER (1<<27)
41 #define SLIDER_SKIP_TOGGLES (1<<28)
42 
43  //used as a menuitem state, show in menu, but not prev/next
44  //note to programmer: this define must cooperate with MENU_* defines in menuinfo.h
45 #define SLIDER_IGNORE_ON_BROWSE (1<<19)
46 
47 class SliderPopup : public ItemSlider
48 {
49  protected:
50  MenuInfo *items;
51  int itemsislocal;
52  virtual void drawarrow();
53  virtual int send();
54  virtual int getid(int i);
55  virtual int numitems() { return items->menuitems.n; }
56  virtual void makePopup(int mouseid);
57  public:
58  int arrowwidth,pad,gap;
59  SliderPopup(anXWindow *parnt,const char *nname,const char *ntitle,
60  unsigned long nstyle, int xx,int yy,int ww,int hh,int brder,
61  anXWindow *prev,unsigned long nowner,const char *nsendthis,
62  MenuInfo *nitems=NULL,int ilocal=1);
63  virtual ~SliderPopup();
64  virtual void Refresh();
65  virtual int Event(const EventData *e,const char *mes);
66  virtual int CharInput(unsigned int ch,const char *buffer,int len,unsigned int state,const LaxKeyboard *d);
67  virtual int RBDown(int x,int y,unsigned int state,int count,const LaxMouse *d);
68  virtual int LBDown(int x,int y,unsigned int state,int count,const LaxMouse *d);
69 
70  virtual int SelectPrevious();
71  virtual int SelectNext();
72  virtual const char *GetCurrentItem();
73  virtual int GetCurrentItemIndex();
74  virtual int DeleteItem(int id);
75  virtual int AddSep(const char *name=NULL,int where=-1);
76  virtual int AddItem(const char *newitem,int nid);
77  virtual int AddItem(const char *newitem,LaxImage *icon,int nid);
78  virtual int AddItems(const char **newitems,int n,int startid);
79  virtual int SetState(int which, int extrastate, int on);
80  virtual int GetState(int which, int extrastate);
81  virtual int GetItemIndex(int fromid);
82  virtual int Flush(int completely=0);
83  virtual void WrapToExtent();
84 
85  //virtual int MoveResize(int nx,int ny,int nw,int nh);
86  //virtual int Resize(int nw,int nh);
87 };
88 
89 } // namespace Laxkit
90 
91 #endif
92 

Mon Feb 17 2014 11:52:57, Laxkit