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