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

FXMenuCheck.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                          M e n u C h e c k   W i d g e t                      *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2002,2004 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: FXMenuCheck.h,v 1.9 2004/02/08 17:17:33 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXMENUCHECK_H
00025 #define FXMENUCHECK_H
00026 
00027 #ifndef FXMENUCOMMAND_H
00028 #include "FXMenuCommand.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 /**
00035 * The menu check widget is used to change a state in the
00036 * application from a menu.  Menu checks may reflect
00037 * the state of the application by graying out, becoming hidden,
00038 * or by a check mark.
00039 */
00040 class FXAPI FXMenuCheck : public FXMenuCommand {
00041   FXDECLARE(FXMenuCheck)
00042 protected:
00043   FXuchar check;        // State of menu
00044   FXColor boxColor;     // Box color
00045 protected:
00046   FXMenuCheck();
00047 private:
00048   FXMenuCheck(const FXMenuCheck&);
00049   FXMenuCheck &operator=(const FXMenuCheck&);
00050 public:
00051   long onPaint(FXObject*,FXSelector,void*);
00052   long onButtonPress(FXObject*,FXSelector,void*);
00053   long onButtonRelease(FXObject*,FXSelector,void*);
00054   long onKeyPress(FXObject*,FXSelector,void*);
00055   long onKeyRelease(FXObject*,FXSelector,void*);
00056   long onHotKeyPress(FXObject*,FXSelector,void*);
00057   long onHotKeyRelease(FXObject*,FXSelector,void*);
00058   long onCheck(FXObject*,FXSelector,void*);
00059   long onUncheck(FXObject*,FXSelector,void*);
00060   long onUnknown(FXObject*,FXSelector,void*);
00061   long onCmdSetValue(FXObject*,FXSelector,void*);
00062   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00063   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00064   long onCmdAccel(FXObject*,FXSelector,void*);
00065 public:
00066 
00067   /// Construct a menu check
00068   FXMenuCheck(FXComposite* p,const FXString& text,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0);
00069 
00070   /// Return default width
00071   virtual FXint getDefaultWidth();
00072 
00073   /// Return default height
00074   virtual FXint getDefaultHeight();
00075 
00076   /// Set check state (TRUE, FALSE or MAYBE)
00077   void setCheck(FXbool s=TRUE);
00078 
00079   /// Get check state (TRUE, FALSE or MAYBE)
00080   FXbool getCheck() const { return check; }
00081 
00082   /// Get the box background color
00083   FXColor getBoxColor() const { return boxColor; }
00084 
00085   /// Set the box background color
00086   void setBoxColor(FXColor clr);
00087 
00088   /// Save menu to a stream
00089   virtual void save(FXStream& store) const;
00090 
00091   /// Load menu from a stream
00092   virtual void load(FXStream& store);
00093   };
00094 
00095 }
00096 
00097 #endif

Copyright © 1997-2004 Jeroen van der Zijp