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,2006 by Charles Warren.   All Rights Reserved.             *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXTriStateButton.h,v 1.6 2006/01/22 17:58:11 fox Exp $                   *
00023 ********************************************************************************/
00024 #ifndef FXTRISTATEBUTTON_H
00025 #define FXTRISTATEBUTTON_H
00026 
00027 #ifndef FXTOGGLEBUTTON_H
00028 #include "FXToggleButton.h"
00029 #endif
00030 
00031 
00032 namespace FX {
00033 
00034 /**
00035 * The tri-state button provides a three-state button, which toggles between the
00036 * on and the off state each time it is pressed; programmatically, it may also be
00037 * switched into the MAYBE state.  The MAYBE state is useful to signify an unknown
00038 * state in the application data.
00039 * Like the toggle button, it sends a SEL_COMMAND to its target, with the
00040 * message data set to the current state of the toggle button, of the type FXbool.
00041 */
00042 class FXAPI FXTriStateButton : public FXToggleButton {
00043   FXDECLARE(FXTriStateButton)
00044 protected:
00045   FXString  maybelabel;
00046   FXIcon   *maybeicon;
00047   FXString  maybetip;
00048   FXString  maybehelp;
00049 protected:
00050   FXTriStateButton();
00051 private:
00052   FXTriStateButton(const FXTriStateButton&);
00053   FXTriStateButton& operator=(const FXTriStateButton&);
00054 public:
00055   long onPaint(FXObject*,FXSelector,void*);
00056   long onUnknown(FXObject*,FXSelector,void*);
00057   long onQueryHelp(FXObject*,FXSelector,void*);
00058   long onQueryTip(FXObject*,FXSelector,void*);
00059 public:
00060 
00061   /// Construct tri-state toggle button with three text labels, and three icons, one for each state
00062   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);
00063 
00064   /// Create server-side resources
00065   virtual void create();
00066 
00067   /// Detach server-side resources
00068   virtual void detach();
00069 
00070   /// Get default width
00071   virtual FXint getDefaultWidth();
00072 
00073   /// Get default height
00074   virtual FXint getDefaultHeight();
00075 
00076   /// Change maybe text shown when toggled
00077   void setMaybeText(const FXString& text);
00078 
00079   /// Return maybe text
00080   FXString getMaybeText() const { return maybelabel; }
00081 
00082   /// Change maybe icon shown when toggled
00083   void setMaybeIcon(FXIcon* ic);
00084 
00085   /// Return maybe icon
00086   FXIcon* getMaybeIcon() const { return maybeicon; }
00087 
00088   /// Change maybe help text shown when toggled
00089   void setMaybeHelpText(const FXString& text);
00090 
00091   /// Return maybe help text
00092   FXString getMaybeHelpText() const { return maybehelp; }
00093 
00094   /// Change maybe tip text shown when toggled
00095   void setMaybeTipText(const FXString& text);
00096 
00097   /// Return maybe tip text
00098   FXString getMaybeTipText() const { return maybetip; }
00099 
00100   /// Save toggle button to a stream
00101   virtual void save(FXStream& store) const;
00102 
00103   /// Load toggle button from a stream
00104   virtual void load(FXStream& store);
00105 
00106   /// Destructor
00107   virtual ~FXTriStateButton();
00108   };
00109 
00110 }
00111 
00112 #endif

Copyright © 1997-2005 Jeroen van der Zijp