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

FXMenuCaption.h

00001 /******************************************************************************** 00002 * * 00003 * M e n u C a p t i o n W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2005 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: FXMenuCaption.h,v 1.30 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXMENUCAPTION_H 00025 #define FXMENUCAPTION_H 00026 00027 #ifndef FXWINDOW_H 00028 #include "FXWindow.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /// Menu Caption options 00035 enum { 00036 MENU_AUTOGRAY = 0x00008000, /// Automatically gray out when not updated 00037 MENU_AUTOHIDE = 0x00010000 /// Automatically hide button when not updated 00038 }; 00039 00040 00041 class FXIcon; 00042 class FXFont; 00043 00044 00045 /** 00046 * The menu caption is a widget which can be used as a caption 00047 * above a number of menu commands in a menu. 00048 */ 00049 class FXAPI FXMenuCaption : public FXWindow { 00050 FXDECLARE(FXMenuCaption) 00051 protected: 00052 FXString label; 00053 FXString help; 00054 FXIcon *icon; 00055 FXFont *font; 00056 FXint hotoff; 00057 FXHotKey hotkey; 00058 FXColor textColor; 00059 FXColor selbackColor; 00060 FXColor seltextColor; 00061 FXColor hiliteColor; 00062 FXColor shadowColor; 00063 protected: 00064 FXMenuCaption(); 00065 private: 00066 FXMenuCaption(const FXMenuCaption&); 00067 FXMenuCaption &operator=(const FXMenuCaption&); 00068 public: 00069 long onPaint(FXObject*,FXSelector,void*); 00070 long onUpdate(FXObject*,FXSelector,void*); 00071 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00072 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00073 long onCmdSetIconValue(FXObject*,FXSelector,void*); 00074 long onCmdGetIconValue(FXObject*,FXSelector,void*); 00075 long onCmdSetHelp(FXObject*,FXSelector,void*); 00076 long onCmdGetHelp(FXObject*,FXSelector,void*); 00077 long onQueryHelp(FXObject*,FXSelector,void*); 00078 public: 00079 00080 /// Construct a menu caption 00081 FXMenuCaption(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXuint opts=0); 00082 00083 /// Create server-side resources 00084 virtual void create(); 00085 00086 /// Detach server-side resources 00087 virtual void detach(); 00088 00089 /// Enable the menu 00090 virtual void enable(); 00091 00092 /// Disable the menu 00093 virtual void disable(); 00094 00095 /// Return default width 00096 virtual FXint getDefaultWidth(); 00097 00098 /// Return default height 00099 virtual FXint getDefaultHeight(); 00100 00101 /// Set the text for this menu 00102 void setText(const FXString& text); 00103 00104 /// Get the text for this menu 00105 FXString getText() const { return label; } 00106 00107 /// Set the icon for this menu 00108 void setIcon(FXIcon* ic); 00109 00110 /// Get the icon for this menu 00111 FXIcon* getIcon() const { return icon; } 00112 00113 /// Set the text font 00114 void setFont(FXFont* fnt); 00115 00116 /// Return the text font 00117 FXFont* getFont() const { return font; } 00118 00119 /// Set menu caption style 00120 void setMenuStyle(FXuint style); 00121 00122 /// Get menu caption style 00123 FXuint getMenuStyle() const; 00124 00125 /// Get the current text color 00126 FXColor getTextColor() const { return textColor; } 00127 00128 /// Return the current text color 00129 void setTextColor(FXColor clr); 00130 00131 /// Return the selection background color 00132 FXColor getSelBackColor() const { return selbackColor; } 00133 00134 /// Return the selection background color 00135 void setSelBackColor(FXColor clr); 00136 00137 /// Return the selection text color 00138 FXColor getSelTextColor() const { return seltextColor; } 00139 00140 /// Return the selection text color 00141 void setSelTextColor(FXColor clr); 00142 00143 /// Change highlight color 00144 void setHiliteColor(FXColor clr); 00145 00146 /// Get highlight color 00147 FXColor getHiliteColor() const { return hiliteColor; } 00148 00149 /// Change shadow color 00150 void setShadowColor(FXColor clr); 00151 00152 /// Get shadow color 00153 FXColor getShadowColor() const { return shadowColor; } 00154 00155 /// Set the status line help text for this menu 00156 void setHelpText(const FXString& text); 00157 00158 /// Get the status line help text for this menu 00159 const FXString& getHelpText() const { return help; } 00160 00161 /// Save menu to a stream 00162 virtual void save(FXStream& store) const; 00163 00164 /// Load menu from a stream 00165 virtual void load(FXStream& store); 00166 00167 /// Destructor 00168 virtual ~FXMenuCaption(); 00169 }; 00170 00171 } 00172 00173 #endif

Copyright © 1997-2005 Jeroen van der Zijp