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

FXMenuRadio.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         M e n u R a d i o   W i d g e t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2002,2009 by Jeroen van der Zijp.   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: FXMenuRadio.h,v 1.18 2009/01/06 13:07:26 fox Exp $                       *
00022 ********************************************************************************/
00023 #ifndef FXMENURADIO_H
00024 #define FXMENURADIO_H
00025 
00026 #ifndef FXMENUCOMMAND_H
00027 #include "FXMenuCommand.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /**
00034 * The menu radio widget is used to invoke a command in the
00035 * application from a menu.  Menu commands may reflect
00036 * the state of the application by graying out, becoming hidden,
00037 * or by a bullit.
00038 * When activated, a menu radio sends a SEL_COMMAND to its target;
00039 * the void* argument of the message contains the new state.
00040 * A collection of menu radio widgets which belong to each other
00041 * is supposed to be updated by a common SEL_UPDATE handler to
00042 * properly maintain the state between them.
00043 */
00044 class FXAPI FXMenuRadio : public FXMenuCommand {
00045   FXDECLARE(FXMenuRadio)
00046 protected:
00047   FXColor radioColor;   // Color of the radio
00048   FXuchar check;        // State of menu
00049 protected:
00050   FXMenuRadio();
00051 private:
00052   FXMenuRadio(const FXMenuRadio&);
00053   FXMenuRadio &operator=(const FXMenuRadio&);
00054 public:
00055   long onPaint(FXObject*,FXSelector,void*);
00056   long onButtonPress(FXObject*,FXSelector,void*);
00057   long onButtonRelease(FXObject*,FXSelector,void*);
00058   long onKeyPress(FXObject*,FXSelector,void*);
00059   long onKeyRelease(FXObject*,FXSelector,void*);
00060   long onHotKeyPress(FXObject*,FXSelector,void*);
00061   long onHotKeyRelease(FXObject*,FXSelector,void*);
00062   long onCheck(FXObject*,FXSelector,void*);
00063   long onUncheck(FXObject*,FXSelector,void*);
00064   long onUnknown(FXObject*,FXSelector,void*);
00065   long onCmdSetValue(FXObject*,FXSelector,void*);
00066   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00067   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00068   long onCmdAccel(FXObject*,FXSelector,void*);
00069 public:
00070 
00071   /// Construct a menu radio
00072   FXMenuRadio(FXComposite* p,const FXString& text,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0);
00073 
00074   /// Return default width
00075   virtual FXint getDefaultWidth();
00076 
00077   /// Return default height
00078   virtual FXint getDefaultHeight();
00079 
00080   /// Set radio button state (TRUE, FALSE or MAYBE)
00081   void setCheck(FXuchar s=TRUE);
00082 
00083   /// Get radio button state (TRUE, FALSE or MAYBE)
00084   FXuchar getCheck() const { return check; }
00085 
00086   /// Get the radio background color
00087   FXColor getRadioColor() const { return radioColor; }
00088 
00089   /// Set the radio background color
00090   void setRadioColor(FXColor clr);
00091 
00092   /// Save menu to a stream
00093   virtual void save(FXStream& store) const;
00094 
00095   /// Load menu from a stream
00096   virtual void load(FXStream& store);
00097   };
00098 
00099 }
00100 
00101 #endif

Copyright © 1997-2009 Jeroen van der Zijp