![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
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,2002 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.23 2002/09/30 13:06:56 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 onQueryHelp(FXObject*,FXSelector,void*); 00071 long onUpdate(FXObject*,FXSelector,void*); 00072 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00073 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00074 public: 00075 00076 /// Construct a menu caption 00077 FXMenuCaption(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXuint opts=0); 00078 00079 /// Create server-side resources 00080 virtual void create(); 00081 00082 /// Detach server-side resources 00083 virtual void detach(); 00084 00085 /// Enable the menu 00086 virtual void enable(); 00087 00088 /// Disable the menu 00089 virtual void disable(); 00090 00091 /// Return default width 00092 virtual FXint getDefaultWidth(); 00093 00094 /// Return default height 00095 virtual FXint getDefaultHeight(); 00096 00097 /// Set the text for this menu 00098 void setText(const FXString& text); 00099 00100 /// Get the text for this menu 00101 FXString getText() const { return label; } 00102 00103 /// Set the icon for this menu 00104 void setIcon(FXIcon* ic); 00105 00106 /// Get the icon for this menu 00107 FXIcon* getIcon() const { return icon; } 00108 00109 /// Set the text font 00110 void setFont(FXFont* fnt); 00111 00112 /// Return the text font 00113 FXFont* getFont() const { return font; } 00114 00115 /// Set menu caption style 00116 void setMenuStyle(FXuint style); 00117 00118 /// Get menu caption style 00119 FXuint getMenuStyle() const; 00120 00121 /// Get the current text color 00122 FXColor getTextColor() const { return textColor; } 00123 00124 /// Return the current text color 00125 void setTextColor(FXColor clr); 00126 00127 /// Return the selection background color 00128 FXColor getSelBackColor() const { return selbackColor; } 00129 00130 /// Return the selection background color 00131 void setSelBackColor(FXColor clr); 00132 00133 /// Return the selection text color 00134 FXColor getSelTextColor() const { return seltextColor; } 00135 00136 /// Return the selection text color 00137 void setSelTextColor(FXColor clr); 00138 00139 /// Change highlight color 00140 void setHiliteColor(FXColor clr); 00141 00142 /// Get highlight color 00143 FXColor getHiliteColor() const { return hiliteColor; } 00144 00145 /// Change shadow color 00146 void setShadowColor(FXColor clr); 00147 00148 /// Get shadow color 00149 FXColor getShadowColor() const { return shadowColor; } 00150 00151 /// Set the status line help text for this menu 00152 void setHelpText(const FXString& text); 00153 00154 /// Get the status line help text for this menu 00155 const FXString& getHelpText() const { return help; } 00156 00157 /// Save menu to a stream 00158 virtual void save(FXStream& store) const; 00159 00160 /// Load menu from a stream 00161 virtual void load(FXStream& store); 00162 00163 /// Destructor 00164 virtual ~FXMenuCaption(); 00165 }; 00166 00167 } 00168 00169 #endif