1 /* solidbutton.h
2  * This file belongs to Worker, a file manager for UN*X/X11.
3  * Copyright (C) 2001-2014 Ralf Hoffmann.
4  * You can contact me at: ralf@boomerangsworld.de
5  *   or http://www.boomerangsworld.de/worker
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program 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
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #ifndef SOLIDBUTTON_H
23 #define SOLIDBUTTON_H
24 
25 #include "aguixdefs.h"
26 #include "guielement.h"
27 
28 class SolidButton:public GUIElement {
29 public:
30   SolidButton(class AGUIX *aguix,int x,int y,
31          const char *text,int fg,int bg,bool state);
32   SolidButton(class AGUIX *aguix,int x,int y,int width,
33          const char *text,int fg,int bg,bool state);
34   SolidButton(class AGUIX *aguix,int x,int y,int width,int height,
35          const char *text,int fg,int bg,bool state);
36 
37   SolidButton(class AGUIX *aguix,int x,int y,
38          const char *text,bool state);
39   SolidButton(class AGUIX *aguix,int x,int y,int width,
40          const char *text,bool state);
41   SolidButton(class AGUIX *aguix,int x,int y,int width,int height,
42          const char *text,bool state);
43   SolidButton( AGUIX *aguix, int x, int y, int width,
44                const char *text,
45                const std::string &fg_name,
46                const std::string &bg_name,
47                bool state );
48   SolidButton( AGUIX *aguix, int x, int y,
49                const char *text,
50                const std::string &fg_name,
51                const std::string &bg_name,
52                bool state );
53 
54   virtual ~SolidButton();
55   SolidButton( const SolidButton &other );
56   SolidButton &operator=( const SolidButton &other );
57   const char *getText() const;
58   void setText(const char *);
59   void setFG(int);
60   int getFG() const;
61   void setBG(int);
62   int getBG() const;
63   bool getState() const;
64   void setState(bool);
65   virtual void redraw();
66   virtual void flush();
67   virtual bool handleMessage(XEvent *E,Message *msg);
68   int setFont( const char * );
69   virtual const char *getType() const;
70   virtual bool isType(const char *type) const;
71 private:
72   char *text;
73   int fg;
74   int bg;
75   bool state;
76   class AGUIXFont *font;
77   static const char *type;
78 
79   void prepareBG( bool force = false );
80   void applyFaces();
81 
82   void init( AGUIX *aguix, int x, int y,
83              int width, int height,
84              const char *text,
85              int fg, int bg,
86              bool state );
87   void init( AGUIX *aguix, int x, int y,
88              int width,
89              const char *text,
90              int fg, int bg,
91              bool state );
92   void init( AGUIX *aguix, int x, int y,
93              const char *text,
94              int fg, int bg,
95              bool state );
96 };
97 
98 #endif
99