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

Copyright © 1997-2005 Jeroen van der Zijp