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

FXTriStateButton.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *               T r i - S t a t e    B u t t o n    W i d g e t                 *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2002,2009 by Charles Warren.   All Rights Reserved.             *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXTriStateButton.h,v 1.10 2009/01/06 13:07:29 fox Exp $                   *
00022 ********************************************************************************/
00023 #ifndef FXTRISTATEBUTTON_H
00024 #define FXTRISTATEBUTTON_H
00025 
00026 #ifndef FXTOGGLEBUTTON_H
00027 #include "FXToggleButton.h"
00028 #endif
00029 
00030 
00031 namespace FX {
00032 
00033 /**
00034 * The tri-state button provides a three-state button, which toggles between the
00035 * on and the off state each time it is pressed; programmatically, it may also be
00036 * switched into the MAYBE state.  The MAYBE state is useful to signify an unknown
00037 * state in the application data.
00038 * Like the toggle button, it sends a SEL_COMMAND to its target, with the
00039 * message data set to the current state of the toggle button, of the type FXbool.
00040 */
00041 class FXAPI FXTriStateButton : public FXToggleButton {
00042   FXDECLARE(FXTriStateButton)
00043 protected:
00044   FXString  maybelabel;
00045   FXIcon   *maybeicon;
00046   FXString  maybetip;
00047   FXString  maybehelp;
00048 protected:
00049   FXTriStateButton();
00050 private:
00051   FXTriStateButton(const FXTriStateButton&);
00052   FXTriStateButton& operator=(const FXTriStateButton&);
00053 public:
00054   long onPaint(FXObject*,FXSelector,void*);
00055   long onUnknown(FXObject*,FXSelector,void*);
00056   long onQueryHelp(FXObject*,FXSelector,void*);
00057   long onQueryTip(FXObject*,FXSelector,void*);
00058 public:
00059 
00060   /// Construct tri-state toggle button with three text labels, and three icons, one for each state
00061   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);
00062 
00063   /// Create server-side resources
00064   virtual void create();
00065 
00066   /// Detach server-side resources
00067   virtual void detach();
00068 
00069   /// Get default width
00070   virtual FXint getDefaultWidth();
00071 
00072   /// Get default height
00073   virtual FXint getDefaultHeight();
00074 
00075   /// Change maybe text shown when toggled
00076   void setMaybeText(const FXString& text);
00077 
00078   /// Return maybe text
00079   FXString getMaybeText() const { return maybelabel; }
00080 
00081   /// Change maybe icon shown when toggled
00082   void setMaybeIcon(FXIcon* ic);
00083 
00084   /// Return maybe icon
00085   FXIcon* getMaybeIcon() const { return maybeicon; }
00086 
00087   /// Change maybe help text shown when toggled
00088   void setMaybeHelpText(const FXString& text);
00089 
00090   /// Return maybe help text
00091   FXString getMaybeHelpText() const { return maybehelp; }
00092 
00093   /// Change maybe tip text shown when toggled
00094   void setMaybeTipText(const FXString& text);
00095 
00096   /// Return maybe tip text
00097   FXString getMaybeTipText() const { return maybetip; }
00098 
00099   /// Save toggle button to a stream
00100   virtual void save(FXStream& store) const;
00101 
00102   /// Load toggle button from a stream
00103   virtual void load(FXStream& store);
00104 
00105   /// Destructor
00106   virtual ~FXTriStateButton();
00107   };
00108 
00109 }
00110 
00111 #endif

Copyright © 1997-2009 Jeroen van der Zijp