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,2006 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.33 2006/01/22 17:58: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 FXString tip; 00055 FXIcon *icon; 00056 FXFont *font; 00057 FXint hotoff; 00058 FXHotKey hotkey; 00059 FXColor textColor; 00060 FXColor selbackColor; 00061 FXColor seltextColor; 00062 FXColor hiliteColor; 00063 FXColor shadowColor; 00064 protected: 00065 FXMenuCaption(); 00066 private: 00067 FXMenuCaption(const FXMenuCaption&); 00068 FXMenuCaption &operator=(const FXMenuCaption&); 00069 public: 00070 long onPaint(FXObject*,FXSelector,void*); 00071 long onUpdate(FXObject*,FXSelector,void*); 00072 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00073 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00074 long onCmdSetIconValue(FXObject*,FXSelector,void*); 00075 long onCmdGetIconValue(FXObject*,FXSelector,void*); 00076 long onCmdSetHelp(FXObject*,FXSelector,void*); 00077 long onCmdGetHelp(FXObject*,FXSelector,void*); 00078 long onCmdSetTip(FXObject*,FXSelector,void*); 00079 long onCmdGetTip(FXObject*,FXSelector,void*); 00080 long onQueryHelp(FXObject*,FXSelector,void*); 00081 long onQueryTip(FXObject*,FXSelector,void*); 00082 public: 00083 00084 /// Construct a menu caption 00085 FXMenuCaption(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXuint opts=0); 00086 00087 /// Create server-side resources 00088 virtual void create(); 00089 00090 /// Detach server-side resources 00091 virtual void detach(); 00092 00093 /// Enable the menu 00094 virtual void enable(); 00095 00096 /// Disable the menu 00097 virtual void disable(); 00098 00099 /// Return default width 00100 virtual FXint getDefaultWidth(); 00101 00102 /// Return default height 00103 virtual FXint getDefaultHeight(); 00104 00105 /// Set the text for this menu 00106 void setText(const FXString& text); 00107 00108 /// Get the text for this menu 00109 FXString getText() const { return label; } 00110 00111 /// Set the icon for this menu 00112 void setIcon(FXIcon* ic); 00113 00114 /// Get the icon for this menu 00115 FXIcon* getIcon() const { return icon; } 00116 00117 /// Set the text font 00118 void setFont(FXFont* fnt); 00119 00120 /// Return the text font 00121 FXFont* getFont() const { return font; } 00122 00123 /// Set menu caption style 00124 void setMenuStyle(FXuint style); 00125 00126 /// Get menu caption style 00127 FXuint getMenuStyle() const; 00128 00129 /// Return the current text color 00130 void setTextColor(FXColor clr); 00131 00132 /// Get the current text color 00133 FXColor getTextColor() const { return textColor; } 00134 00135 /// Return the selection background color 00136 void setSelBackColor(FXColor clr); 00137 00138 /// Return the selection background color 00139 FXColor getSelBackColor() const { return selbackColor; } 00140 00141 /// Return the selection text color 00142 void setSelTextColor(FXColor clr); 00143 00144 /// Return the selection text color 00145 FXColor getSelTextColor() const { return seltextColor; } 00146 00147 /// Change highlight color 00148 void setHiliteColor(FXColor clr); 00149 00150 /// Get highlight color 00151 FXColor getHiliteColor() const { return hiliteColor; } 00152 00153 /// Change shadow color 00154 void setShadowColor(FXColor clr); 00155 00156 /// Get shadow color 00157 FXColor getShadowColor() const { return shadowColor; } 00158 00159 /// Set the status line help text for this menu 00160 void setHelpText(const FXString& text); 00161 00162 /// Get the status line help text for this menu 00163 const FXString& getHelpText() const { return help; } 00164 00165 /// Set the tool tip message for this menu 00166 void setTipText(const FXString& text){ tip=text; } 00167 00168 /// Get the tool tip message for this menu 00169 const FXString& getTipText() const { return tip; } 00170 00171 /// Save menu to a stream 00172 virtual void save(FXStream& store) const; 00173 00174 /// Load menu from a stream 00175 virtual void load(FXStream& store); 00176 00177 /// Destructor 00178 virtual ~FXMenuCaption(); 00179 }; 00180 00181 } 00182 00183 #endif
Copyright © 1997-2005 Jeroen van der Zijp |