Laxkit  0.0.7.1
colorbox.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-2007,2010-2012 by Tom Lechner
22 //
23 #ifndef _LAX_COLORBOX_H
24 #define _LAX_COLORBOX_H
25 
26 #include <lax/anxapp.h>
27 #include <lax/colorbase.h>
28 #include <lax/buttondowninfo.h>
29 #include <lax/newwindowobject.h>
30 
31 namespace Laxkit {
32 
33 
34 #define COLORBOX_DRAW_NUMBER (1<<16)
35 #define COLORBOX_CMYK (1<<17)
36 #define COLORBOX_RGB (1<<18)
37 #define COLORBOX_GRAY (1<<19)
38 
39 #define COLORBOX_FG (1<<20)
40 #define COLORBOX_FGBG (1<<21)
41 #define COLORBOX_STROKEFILL (1<<22)
42 
43 
44 //------------------------------- ColorBox ------------------------------
45 class ColorBox : public anXWindow, virtual public ColorBase
46 {
47  protected:
48  int colormap[9];
49  ButtonDownInfo buttondown;
50  NewWindowObject *colorselector;
51 
52  virtual int send();
53 
54  public:
55  int *topcolor;
56  int currentid;
57  int step;
58 
59  ColorBox(anXWindow *parnt,const char *nname,const char *ntitle,unsigned long nstyle,
60  int nx,int ny,int nw,int nh,int brder,
61  anXWindow *prev,unsigned long owner,const char *mes,
62  int ctype, int nmax, int nstep,
63  int c0,int c1,int c2,int c3=-1,int c4=-1,
64  NewWindowObject *newcolorselector=NULL);
65  virtual ~ColorBox();
66  virtual const char *whattype() { return "ColorBox"; }
67  virtual const char *tooltip(const char *newtip) { return anXWindow::tooltip(newtip); }
68  virtual const char *tooltip(int mouseid=0);
69  virtual int init();
70  virtual void Refresh();
71  virtual int LBDown(int x,int y,unsigned int state,int count, const LaxMouse *d);
72  virtual int LBUp(int x,int y,unsigned int state, const LaxMouse *d);
73  virtual int MBDown(int x,int y,unsigned int state,int count, const LaxMouse *d);
74  virtual int MBUp(int x,int y,unsigned int state, const LaxMouse *d);
75  virtual int RBDown(int x,int y,unsigned int state,int count, const LaxMouse *d);
76  virtual int RBUp(int x,int y,unsigned int state, const LaxMouse *d);
77  virtual int MouseMove(int mx,int my, unsigned int state, const LaxMouse *d);
78  virtual int CharInput(unsigned int ch,const char *buffer,int len,unsigned int state, const LaxKeyboard *d);
79  virtual int Event(const EventData *e,const char *mes);
80 
81  virtual int PopupColorSelector();
82  virtual void Updated();
83 };
84 
85 } // namespace Laxkit
86 
87 #endif
88 

Mon Feb 17 2014 11:52:56, Laxkit