1 /******************************************************************************** 2 * * 3 * M e n u R a d i o W i d g e t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 2002,2005 by Jeroen van der Zijp. 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: FXMenuRadio.h,v 1.11 2005/01/16 16:06:06 fox Exp $ * 23 ********************************************************************************/ 24 #ifndef FXMENURADIO_H 25 #define FXMENURADIO_H 26 27 #ifndef FXMENUCOMMAND_H 28 #include "FXMenuCommand.h" 29 #endif 30 31 namespace FX { 32 33 34 /** 35 * The menu radio widget is used to invoke a command in the 36 * application from a menu. Menu commands may reflect 37 * the state of the application by graying out, becoming hidden, 38 * or by a bullit. 39 */ 40 class FXAPI FXMenuRadio : public FXMenuCommand { 41 FXDECLARE(FXMenuRadio) 42 protected: 43 FXuchar check; // State of menu 44 FXColor radioColor; // Color of the radio 45 protected: 46 FXMenuRadio(); 47 private: 48 FXMenuRadio(const FXMenuRadio&); 49 FXMenuRadio &operator=(const FXMenuRadio&); 50 public: 51 long onPaint(FXObject*,FXSelector,void*); 52 long onButtonPress(FXObject*,FXSelector,void*); 53 long onButtonRelease(FXObject*,FXSelector,void*); 54 long onKeyPress(FXObject*,FXSelector,void*); 55 long onKeyRelease(FXObject*,FXSelector,void*); 56 long onHotKeyPress(FXObject*,FXSelector,void*); 57 long onHotKeyRelease(FXObject*,FXSelector,void*); 58 long onCheck(FXObject*,FXSelector,void*); 59 long onUncheck(FXObject*,FXSelector,void*); 60 long onUnknown(FXObject*,FXSelector,void*); 61 long onCmdSetValue(FXObject*,FXSelector,void*); 62 long onCmdSetIntValue(FXObject*,FXSelector,void*); 63 long onCmdGetIntValue(FXObject*,FXSelector,void*); 64 long onCmdAccel(FXObject*,FXSelector,void*); 65 public: 66 67 /// Construct a menu radio 68 FXMenuRadio(FXComposite* p,const FXString& text,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0); 69 70 /// Return default width 71 virtual FXint getDefaultWidth(); 72 73 /// Return default height 74 virtual FXint getDefaultHeight(); 75 76 /// Set radio button state (TRUE, FALSE or MAYBE) 77 void setCheck(FXbool s=TRUE); 78 79 /// Get radio button state (TRUE, FALSE or MAYBE) getCheck()80 FXbool getCheck() const { return check; } 81 82 /// Get the radio background color getRadioColor()83 FXColor getRadioColor() const { return radioColor; } 84 85 /// Set the radio background color 86 void setRadioColor(FXColor clr); 87 88 /// Save menu to a stream 89 virtual void save(FXStream& store) const; 90 91 /// Load menu from a stream 92 virtual void load(FXStream& store); 93 }; 94 95 } 96 97 #endif 98