00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: VMDFltkMenu.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.36 $ $Date: 2019年01月17日 21:21:02 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * Class to manage FLTK menus within VMD. 00019 ***************************************************************************/ 00020 00021 #ifndef VMDFLTKMENU_H 00022 #define VMDFLTKMENU_H 00023 00024 #include <FL/Fl_Window.H> 00025 #include "VMDMenu.h" 00026 00027 // 00028 // VMD Window color scheme macros 00029 // 00030 00031 #define VMDMENU_NEW_COLORSCHEME 1 00032 00033 // new color scheme 00034 #if defined(VMDMENU_NEW_COLORSCHEME) 00035 #if (FL_MAJOR_VERSION >= 1) && (((FL_MINOR_VERSION >= 1) && (FL_PATCH_VERSION >= 8)) || ((FL_MINOR_VERSION >= 3) && (FL_PATCH_VERSION >= 0))) 00036 // Since FLTK 1.1.8 behavior differently wrt/ chooser background colors, 00037 // it no longer makes much sense to use the grayed color for the chooser 00038 // backgrounds, since all of the other colors are gone now. 00039 // alternate window background/menu/button colors 00040 #define VMDMENU_BROWSER_BG FL_WHITE 00041 #define VMDMENU_WINDOW fl_gray_ramp(223 * (FL_NUM_GRAY - 1) / 255) 00042 #define VMDMENU_BROWSER_SEL fl_rgb_color(210, 225, 210) 00043 //#define VMDMENU_BROWSER_SEL fl_gray_ramp(207 * (FL_NUM_GRAY - 1) / 255) 00044 //#define VMDMENU_BROWSER_SEL fl_gray_ramp(215 * (FL_NUM_GRAY - 1) / 255) 00045 #else 00046 #define VMDMENU_BROWSER_BG fl_gray_ramp(243 * (FL_NUM_GRAY - 1) / 255) 00047 #define VMDMENU_BROWSER_SEL fl_rgb_color(210, 225, 210) 00048 #endif 00049 00050 00051 // Text colors with FLTK's "@Cxxx" color encoding: 00052 // http://www.fltk.org/documentation.php/doc-1.1/Fl_Browser.html#Fl_Browser.format_char 00053 00054 // A/D/F text/color strings for VMD main menu 00055 #define VMDMENU_MOL_ACTIVE "A" 00056 #define VMDMENU_MOL_INACTIVE "@C88A" 00057 #define VMDMENU_MOL_DISPLAYED "D" 00058 #define VMDMENU_MOL_NONDISPLAYED "@C88D" 00059 #define VMDMENU_MOL_FIXED "F" 00060 #define VMDMENU_MOL_NONFIXED "@C88F" 00061 00062 // graphics menu displayed/nondisplayed text color codes 00063 #define VMDMENU_REP_ACTIVE "" 00064 //#define VMDMENU_REP_INACTIVE "@C47" 00065 #define VMDMENU_REP_INACTIVE "@C88" 00066 00067 // label menu active/inactive text color codes 00068 #define VMDMENU_GEOM_ACTIVE "" 00069 #define VMDMENU_GEOM_INACTIVE "@C88" 00070 00071 #else 00072 00073 // 00074 // original VMD color scheme 00075 // 00076 #define VMDMENU_BROWSER_BG FL_DARKCYAN 00077 #define VMDMENU_BROWSER_SEL FL_YELLOW 00078 #define VMDMENU_MOLBROWSER_INACTIVE "@C203A" 00079 00080 // Text colors with FLTK's "@Cxxx" color encoding: 00081 // http://www.fltk.org/documentation.php/doc-1.1/Fl_Browser.html#Fl_Browser.format_char 00082 00083 // A/D/F text/color strings for VMD main menu 00084 #define VMDMENU_MOL_ACTIVE "A" 00085 #define VMDMENU_MOL_INACTIVE "@C203A" 00086 #define VMDMENU_MOL_DISPLAYED "D" 00087 #define VMDMENU_MOL_NONDISPLAYED "@C203D" 00088 #define VMDMENU_MOL_FIXED "F" 00089 #define VMDMENU_MOL_NONFIXED "@C203F" 00090 00091 // graphics menu displayed/nondisplayed text color codes 00092 #define VMDMENU_REP_ACTIVE "" 00093 #define VMDMENU_REP_INACTIVE "@C203" 00094 00095 // label menu active/inactive text color codes 00096 #define VMDMENU_GEOM_ACTIVE "" 00097 #define VMDMENU_GEOM_INACTIVE "@C203" 00098 #endif 00099 00100 // general VMD color scheme macros 00101 #if (FL_MAJOR_VERSION >= 1) && (((FL_MINOR_VERSION >= 1) && (FL_PATCH_VERSION >= 8)) || ((FL_MINOR_VERSION >= 3) && (FL_PATCH_VERSION >= 0))) 00102 // FLTK version >= 1.1.8 (and maybe other recent versions) don't apply 00103 // background colors on Fl_Choice objects in the same way older versions 00104 // (e.g. FLTK 1.1.4) did, so we revert to gray. The new behavior only 00105 // colors the chooser pulldown arrow widget, with text background unaffected. 00106 #define VMDMENU_CHOOSER_BG FL_GRAY 00107 #else 00108 #define VMDMENU_CHOOSER_BG FL_PALEGREEN 00109 #endif 00110 #define VMDMENU_CHOOSER_SEL FL_BLACK 00111 #define VMDMENU_SLIDER_BG FL_WHITE 00112 #define VMDMENU_SLIDER_FG FL_BLACK 00113 #define VMDMENU_SLIDER_SEL FL_YELLOW 00114 #define VMDMENU_MENU_SEL FL_BLACK 00115 #define VMDMENU_CHECKBOX_BG FL_BLACK 00116 #define VMDMENU_CHECKBOX_FG FL_RED 00117 00118 // selection highlight color for text value input controls 00119 #define VMDMENU_VALUE_BG FL_WHITE 00120 #define VMDMENU_VALUE_SEL FL_YELLOW 00121 00122 // used for frame control in main VMD window 00123 #define VMDMENU_VALUE_SEL2 FL_BLACK 00124 00125 // used by "zoom" checkbox in main VMD window 00126 #define VMDMENU_CHECKBOX_BG FL_BLACK 00127 #define VMDMENU_CHECKBOX_FG FL_RED 00128 00129 // color menu RGB sliders 00130 #define VMDMENU_COLOR_RSLIDER fl_rgb_color(255, 0, 0) 00131 #define VMDMENU_COLOR_GSLIDER fl_rgb_color(0, 255, 0) 00132 #define VMDMENU_COLOR_BSLIDER fl_rgb_color(0, 0, 255) 00133 00134 // material menu sliders 00135 #define VMDMENU_MATSLIDER_BG FL_WHITE 00136 #define VMDMENU_MATSLIDER_FG FL_GRAY 00137 00138 // label menu positioner 00139 #define VMDMENU_POSITIONER_BG VMDMENU_BROWSER_BG 00140 #define VMDMENU_POSITIONER_SEL VMDMENU_BROWSER_SEL 00141 00142 #if (FL_MAJOR_VERSION >= 1) && (FL_MINOR_VERSION >= 1) 00143 #define VMDFLTKTOOLTIP(obj, string) (obj)->tooltip(string); 00144 #else 00145 #define VMDFLTKTOOLTIP(obj, string) 00146 #endif 00147 00148 class Fl_Choice; 00149 00151 class VMDFltkMenu : public VMDMenu, public Fl_Window { 00152 private: 00153 char *_title; 00154 static void window_cb(Fl_Widget *, void *); 00155 00156 protected: 00157 virtual void do_on(); 00158 virtual void do_off(); 00159 00160 public: 00161 VMDFltkMenu(const char *menuname, const char *title, VMDApp *); 00162 ~VMDFltkMenu(); 00163 00164 virtual void move(int, int); 00165 virtual void where(int &, int &); 00166 }; 00167 00169 void fill_fltk_molchooser(Fl_Choice *, VMDApp *, const char *); 00170 00172 char * escape_fltk_menustring(const char *); 00173 00177 void set_chooser_from_string(const char *namestr, class Fl_Choice *chooser); 00178 00179 #endif 00180