Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXTriStateButton.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * T r i - S t a t e B u t t o n W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2002,2006 by Charles Warren. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXTriStateButton.h,v 1.6 2006/01/22 17:58:11 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXTRISTATEBUTTON_H
25 #define FXTRISTATEBUTTON_H
26 
27 #ifndef FXTOGGLEBUTTON_H
28 #include "FXToggleButton.h"
29 #endif
30 
31 
32 namespace FX {
33 
34 /**
35 * The tri-state button provides a three-state button, which toggles between the
36 * on and the off state each time it is pressed; programmatically, it may also be
37 * switched into the MAYBE state. The MAYBE state is useful to signify an unknown
38 * state in the application data.
39 * Like the toggle button, it sends a SEL_COMMAND to its target, with the
40 * message data set to the current state of the toggle button, of the type FXbool.
41 */
44 protected:
45  FXString maybelabel;
46  FXIcon *maybeicon;
47  FXString maybetip;
48  FXString maybehelp;
49 protected:
51 private:
53  FXTriStateButton& operator=(const FXTriStateButton&);
54 public:
55  long onPaint(FXObject*,FXSelector,void*);
56  long onUnknown(FXObject*,FXSelector,void*);
57  long onQueryHelp(FXObject*,FXSelector,void*);
58  long onQueryTip(FXObject*,FXSelector,void*);
59 public:
60 
61  /// Construct tri-state toggle button with three text labels, and three icons, one for each state
62  FXTriStateButton(FXComposite* p,const FXString& text1,const FXString& text2,const FXString& text3,FXIcon* icon1=NULL,FXIcon* icon2=NULL,FXIcon* icon3=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=TOGGLEBUTTON_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
63 
64  /// Create server-side resources
65  virtual void create();
66 
67  /// Detach server-side resources
68  virtual void detach();
69 
70  /// Get default width
71  virtual FXint getDefaultWidth();
72 
73  /// Get default height
74  virtual FXint getDefaultHeight();
75 
76  /// Change maybe text shown when toggled
77  void setMaybeText(const FXString& text);
78 
79  /// Return maybe text
80  FXString getMaybeText() const { return maybelabel; }
81 
82  /// Change maybe icon shown when toggled
83  void setMaybeIcon(FXIcon* ic);
84 
85  /// Return maybe icon
86  FXIcon* getMaybeIcon() const { return maybeicon; }
87 
88  /// Change maybe help text shown when toggled
89  void setMaybeHelpText(const FXString& text);
90 
91  /// Return maybe help text
92  FXString getMaybeHelpText() const { return maybehelp; }
93 
94  /// Change maybe tip text shown when toggled
95  void setMaybeTipText(const FXString& text);
96 
97  /// Return maybe tip text
98  FXString getMaybeTipText() const { return maybetip; }
99 
100  /// Save toggle button to a stream
101  virtual void save(FXStream& store) const;
102 
103  /// Load toggle button from a stream
104  virtual void load(FXStream& store);
105 
106  /// Destructor
107  virtual ~FXTriStateButton();
108  };
109 
110 }
111 
112 #endif
The tri-state button provides a three-state button, which toggles between the on and the off state ea...
Definition: FXTriStateButton.h:42
unsigned int FXuint
Definition: fxdefs.h:396
Definition: FXFrame.h:56
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Base composite.
Definition: FXComposite.h:35
#define NULL
Definition: fxdefs.h:41
The toggle button provides a two-state button, which toggles between the on and the off state each ti...
Definition: FXToggleButton.h:58
int FXint
Definition: fxdefs.h:397
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Definition: FXToggleButton.h:43
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp