1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: steopts.h 3 // Purpose: wxSTEditorOptions 4 // Author: John Labenski, parts taken from wxGuide by Otto Wyss 5 // Modified by: 6 // Created: 11/05/2002 7 // Copyright: (c) John Labenski, Otto Wyss 8 // Licence: wxWidgets licence 9 /////////////////////////////////////////////////////////////////////////////// 10 11 /// @file steopts.h 12 /// @brief wxSTEditorOptions, options for creation and behavior of wxSTEditor* classes. 13 14 #ifndef _STEOPTS_H_ 15 #define _STEOPTS_H_ 16 17 #include "wx/stedit/stedefs.h" 18 19 class WXDLLIMPEXP_FWD_CORE wxFileHistory; 20 class WXDLLIMPEXP_FWD_BASE wxConfigBase; 21 class WXDLLIMPEXP_FWD_CORE wxStatusBar; 22 class WXDLLIMPEXP_FWD_CORE wxMenuBar; 23 class WXDLLIMPEXP_FWD_CORE wxToolBar; 24 25 //----------------------------------------------------------------------------- 26 // Editor and window options for wxSTEditor and friends 27 //----------------------------------------------------------------------------- 28 29 /// wxSTEditorOptions types. 30 enum STE_OptionType 31 { 32 STE_OPTION_EDITOR, ///< STE_EditorOptionsType 33 STE_OPTION_SPLITTER, ///< STE_SplitterOptionsType 34 STE_OPTION_NOTEBOOK, ///< STE_NotebookOptionsType 35 STE_OPTION_FRAME, ///< STE_FrameOptionsType 36 STE_OPTION_CONFIG, ///< STE_ConfigOptionsType 37 STE_OPTION_FINDREPLACE, ///< STE_FindReplaceOptionsType 38 39 STE_OPTION_DEFAULT_FILENAME, ///< default filename to use for new editor 40 STE_OPTION_DEFAULT_FILEPATH, ///< default filepath to start with in filedlg 41 STE_OPTION_DEFAULT_FILEEXTS, ///< default file extensions to show in filedlg 42 43 /// These are the paths to save the config data to. These are used if 44 /// STE_ConfigOptionsType are set to save and the user has opted to 45 /// save the preferences (eg. ID_STE_SAVE_PREFERENCES). 46 /// 47 /// The base path (note leading '/' to specify from root) is prepended to 48 /// the other paths unless they have a leading '/' to denote that 49 /// they're absolute paths. 50 /// Use wxSTEditorOptions::GetConfigPath(size_t path_n) to get the 51 /// full "base + other" path, else just GetOption() to retrieve the 52 /// actual value. 53 STE_OPTION_CFGPATH_BASE, ///< "/wxSTEditor" 54 STE_OPTION_CFGPATH_PREFS, ///< "Preferences" 55 STE_OPTION_CFGPATH_STYLES, ///< "Styles" 56 STE_OPTION_CFGPATH_LANGS, ///< "Languages" 57 STE_OPTION_CFGPATH_FRAME, ///< "Frame" 58 STE_OPTION_CFGPATH_FILEHISTORY, ///< "RecentFiles" 59 STE_OPTION_CFGPATH_FINDREPLACE, ///< "FindReplace" 60 61 STE_OPTION__MAX, 62 }; 63 64 /// Options for the wxSTEditor 65 enum STE_EditorOptionsType 66 { 67 STE_CREATE_POPUPMENU = 0x0001, ///< Create a rightclick popupmenu at startup 68 ///< uses items in wxSTEditorMenuManager 69 ///< only creates if one is not previously assigned. 70 STE_QUERY_SAVE_MODIFIED = 0x0002, ///< Popup dialog to ask to save if modified. 71 STE_CREATE_ACCELTABLE = 0x0004, ///< Create and assign a wxAcceleratorTable 72 ///< for the editor from the popup menu items 73 ///< and any items in the wxMenubar that the 74 ///< editor can handle. 75 ///< NOTE: this has problems so it's not enabled 76 ///< by default. 77 78 STE_DEFAULT_OPTIONS = STE_CREATE_POPUPMENU|STE_QUERY_SAVE_MODIFIED 79 }; 80 81 /// Options for the wxSTEditorSplitter 82 enum STE_SplitterOptionsType 83 { 84 STS_CREATE_POPUPMENU = 0x0001, ///< Right-click menu for setting splitting 85 ///< only creates if one is not previously assigned. 86 STS_NO_EDITOR = 0x0002, ///< Don't initialize with an editor (you'll need to create one). 87 ///< The code assumes that GetEditor() for the splitter returns a valid editor. 88 STS_SPLITBUTTONS = 0x0004, ///< When there is a single editor, show splitter buttons 89 ///< above and to the side of the scrollbars. 90 STS_DO_DRAG_AND_DROP = 0x0008, ///< Create a wxSTEditorFileDropTarget for the splitter. 91 ///< For read-only editors you probably don't want this. 92 93 STS_DEFAULT_OPTIONS = STS_CREATE_POPUPMENU|STS_SPLITBUTTONS|STS_DO_DRAG_AND_DROP 94 }; 95 96 /// Options for the wxSTEditorNotebook 97 enum STE_NotebookOptionsType 98 { 99 STN_CREATE_POPUPMENU = 0x0001, ///< Have a right-click tab menu 100 ///< only creates if one is not previously assigned. 101 STN_ALPHABETICAL_TABS = 0x0002, ///< Always sort tabs alphabetically. 102 STN_UPDATE_TITLES = 0x0004, ///< Update the titles of the pages. 103 STN_ALLOW_NO_PAGES = 0x0008, ///< Allow having no pages. 104 STN_DO_DRAG_AND_DROP = 0x0010, ///< Create a wxSTEditorFileDropTarget for the notebook. 105 106 STN_DEFAULT_OPTIONS = STN_CREATE_POPUPMENU|STN_ALPHABETICAL_TABS|STN_UPDATE_TITLES|STN_DO_DRAG_AND_DROP 107 }; 108 109 /// Options for the wxSTEditorFrame. 110 /// If neither STF_CREATE_SINGLEPAGE|STF_CREATE_NOTEBOOK then don't create an editor, don't have both. 111 enum STE_FrameOptionsType 112 { 113 STF_CREATE_SINGLEPAGE = 0x0001, ///< Create a single text editor. 114 STF_CREATE_NOTEBOOK = 0x0002, ///< Create a wxSTEditorNotebook for editors. 115 STF_CREATE_SIDEBAR = 0x0004, ///< Create a wxNotebook side panel. 116 ///< First page is a wxSTEditorTreeCtrl for listing files, 117 ///< you can add other pages in any order. 118 STF_CREATE_RESULT_NOTEBOOK = 0x0008, ///< Create a wxNotebook bottom panel for results. 119 ///< First page is a wxSTEditorFindResultsEditor for find results, 120 ///< you can add other pages in any order. 121 STF_CREATE_TOOLBAR = 0x0010, ///< Create and maintain a toolbar. 122 STF_CREATE_MENUBAR = 0x0020, ///< Create and maintain a menubar. 123 STF_CREATE_STATUSBAR = 0x0040, ///< Create and maintain a statusbar. 124 STF_CREATE_FILEHISTORY = 0x0080, ///< Create and maintain a wxFileHistory 125 ///< if one doesn't already exist and you have wxID_OPEN. 126 STF_DO_DRAG_AND_DROP = 0x0100, ///< Create a wxSTEditorFileDropTarget for the frame. 127 128 STF_DEFAULT_OPTIONS = STF_CREATE_NOTEBOOK|STF_CREATE_TOOLBAR|STF_CREATE_MENUBAR|STF_CREATE_STATUSBAR|STF_CREATE_FILEHISTORY|STF_DO_DRAG_AND_DROP 129 }; 130 131 /// Options for using wxConfig to save preferences. 132 /// wxConfigBase::Get(false) is called to to save prefs, if a wxConfig isn't 133 /// already created one will NOT be created and these options are ignored. 134 enum STE_ConfigOptionsType 135 { 136 STF_CONFIG = 0x0002, ///< wxSTEditorFrame will save its prefs if any 137 ///< prefs saved only for menu item ID_STE_SAVE_PREFERENCES 138 139 STE_CONFIG_FILEHISTORY = 0x0004, ///< wxSTEditorOption's wxFileHistory should be saved 140 STE_CONFIG_FINDREPLACE = 0x0008, ///< wxSTEditorFindReplaceData should be saved 141 142 STE_CONFIG_PREFS = 0x0010, ///< wxSTEditorPrefs will save their prefs 143 STE_CONFIG_STYLES = 0x0020, ///< wxSTEditorStyles will save their prefs 144 STE_CONFIG_LANGS = 0x0040, ///< wxSTEditorLangs will save their prefs 145 146 STE_CONFIG_SAVE_DIFFS = 0x0100, ///< Only save modified from default values 147 ///< removing ones that are default. 148 149 STE_CONFIG_SAVE_ALWAYS = 0x0200, ///< Always save the config 150 ///< on pref dialog close, frame close... 151 ///< You may want to remove the menu item 152 ///< ID_STE_SAVE_PREFERENCES. 153 154 STE_CONFIG_DEFAULT_OPTIONS = STF_CONFIG|STE_CONFIG_FILEHISTORY|STE_CONFIG_FINDREPLACE|STE_CONFIG_PREFS|STE_CONFIG_STYLES|STE_CONFIG_LANGS 155 }; 156 157 /// Same as STEFindReplaceDialogStyles 158 enum STE_FindReplaceOptionsType 159 { 160 //STE_FR_REPLACEDIALOG = 0x001, // makes no sense as an option here 161 162 //STE_FR_NOUPDOWN = 0x002, //wxFR_NOUPDOWN = 2, don't allow changing the search direction 163 //STE_FR_NOMATCHCASE = 0x004, //wxFR_NOMATCHCASE = 4, don't allow case sensitive searching 164 //STE_FR_NOWHOLEWORD = 0x008, //wxFR_NOWHOLEWORD = 8, don't allow whole word searching 165 //STE_FR_NOWORDSTART = 0x010, // don't allow word start searching 166 //STE_FR_NOWRAPAROUND = 0x020, // don't allow wrapping around 167 //STE_FR_NOREGEX = 0x040, // don't allow regex searching 168 //STE_FR_NOALLDOCS = 0x080 // don't allow search all docs option 169 // (for not having editor notebook) 170 171 STE_FR_DEFAULT_OPTIONS = 0 172 }; 173 174 //----------------------------------------------------------------------------- 175 /// @class wxSTEditorOptions 176 /// @brief Ref counted options for the wxSTEditor/Splitter/Notebook/Frame. 177 /// 178 /// These options are passed and refed from parent to child. For example if you 179 /// start with a frame and notebook the notebook->splitter->editor(s) share them. 180 /// If you start with a splitter then the splitter shares them with editor(s). 181 /// 182 /// This is done so that you set one of these up and pass it to the frame/notebook 183 /// splitter/editor and it tries to do as much as possible for you. 184 /// 185 /// For a wxSTEditorFrame you set the options with wxSTEditorFrame::CreateOptions() 186 /// just after creation. 187 /// 188 /// The default filenames/paths are updated so that when you load/save a file 189 /// the next time you load/save you'll go back to the same dir. 190 /// 191 /// If you don't want an Option - set it to 0, don't want prefs/styles/langs 192 /// set with wxSTEditorPrefs/Styles/Langs(false) for an uncreated version, 193 /// and for no menu manager set it to NULL. Remember that this class is refed so 194 /// that if you change it for one editor it changes for all the others too. To 195 /// "detach" an editor use SetOptions(some other options). 196 /// 197 /// The styles can be accessed using enum STE_OptionType for the predefined 198 /// options or you can use named options. 199 /// 200 /// Note: The prefs/styles/langs are ref counted so this class is not very big. 201 //----------------------------------------------------------------------------- 202 203 /// A default filename to use, wxT("untitled.txt"), change this if you want. 204 WXDLLIMPEXP_DATA_STEDIT(extern wxString) STE_DefaultFileName; 205 /// A default set of file extensions to use - change this if you want. 206 /// wxT("Any file (*)|*|") wxT("Text file (*.txt)|*.txt|") 207 /// wxT("C/C++ file (*.c;*.cpp;*.cxx)|*.c;*.cpp;*.cxx|") 208 /// wxT("H file (*.h)|*.h|") wxT("Html file (*.htm;*.html)|*.htm;*.html|") 209 /// wxT("Lua file (*.lua)|*.lua|") wxT("Python file (*.py)|*.py")) 210 WXDLLIMPEXP_DATA_STEDIT(extern wxString) STE_DefaultFileExtensions; 211 212 /// wxSTEditorRefData run-time class information. 213 WXDLLIMPEXP_DATA_STEDIT(extern const wxClassInfo*) STE_GlobalRefDataClassInfo; 214 215 class WXDLLIMPEXP_STEDIT wxSTEditorOptions : public wxObject 216 { 217 public: 218 /// Default with nothing set at all. 219 wxSTEditorOptions(); 220 221 /// Everything setup, new menu manager and global prefs/styles/langs. 222 /// Globals refed from wxSTEditor::GetGlobalEditorPrefs/Styles/Langs() 223 /// Ueses the static global wxSTEditorFindReplaceData. 224 wxSTEditorOptions( long editor_opt, // = STE_DEFAULT_OPTIONS, 225 long splitter_opt = STS_DEFAULT_OPTIONS, 226 long notebook_opt = STN_DEFAULT_OPTIONS, 227 long frame_opt = STF_DEFAULT_OPTIONS, 228 long config_opt = STE_CONFIG_DEFAULT_OPTIONS, 229 const wxString& defaultFileName = GetGlobalDefaultFileName(), 230 const wxString& defaultFilePath = wxEmptyString, 231 const wxString& defaultFileExt = GetGlobalDefaultExtensions() ); 232 233 // ----------------------------------------------------------------------- 234 /// @name Get/Set/Has option values (option is enum STE_OptionType) 235 /// @{ 236 237 size_t GetOptionCount() const; 238 239 wxString GetOption(size_t option_n) const; GetOptionInt(size_t option_n)240 int GetOptionInt(size_t option_n) const { long n = 0; GetOption(option_n).ToLong(&n); return int(n); } HasOptionIntFlag(size_t option_n,int flag)241 bool HasOptionIntFlag(size_t option_n, int flag) const { return STE_HASBIT(GetOptionInt(option_n), flag); } GetOptionBool(size_t option_n)242 bool GetOptionBool(size_t option_n) const { return GetOptionInt(option_n) != 0; } 243 244 void SetOption(size_t option_n, const wxString& value); SetOptionInt(size_t option_n,int value)245 void SetOptionInt(size_t option_n, int value) { SetOption(option_n, wxString::Format(wxT("%d"), value)); } SetOptionIntFlag(size_t option_n,int flag,bool set)246 void SetOptionIntFlag(size_t option_n, int flag, bool set) { SetOptionInt(option_n, STE_SETBIT(GetOptionInt(option_n), flag, set)); } SetOptionBool(size_t option_n,bool value)247 void SetOptionBool(size_t option_n, bool value) { SetOptionInt(option_n, value ? 1 : 0); } 248 249 /// @} 250 // ----------------------------------------------------------------------- 251 /// @name Get/Set/Has option values (option is enum STE_OptionType) 252 /// @{ 253 254 /// The options can also be accessed using named values. 255 /// The original values are the names of the enum STE_OptionType names. 256 wxString GetOptionName(size_t option_n) const; 257 void SetOptionName(size_t option_n, const wxString& name); 258 int FindOptionByName(const wxString& name) const; HasNamedOption(const wxString & name)259 bool HasNamedOption(const wxString& name) const { return FindOptionByName(name) != wxNOT_FOUND; } 260 261 /// Add a new option with a given name, returning the index. 262 /// The name is useful when your derived class wants to store values, 263 /// but you cannot be sure if the option may be set or what index it'll have. 264 size_t AddOption(const wxString& name, const wxString& value); 265 266 /// @} 267 // ----------------------------------------------------------------------- 268 /// @name Get/Set/Has integer option flags. 269 /// @{ 270 GetEditorOptions()271 int GetEditorOptions() const { return GetOptionInt(STE_OPTION_EDITOR); } ///< STE_EditorOptionsType GetSplitterOptions()272 int GetSplitterOptions() const { return GetOptionInt(STE_OPTION_SPLITTER); } ///< STE_SplitterOptionsType GetNotebookOptions()273 int GetNotebookOptions() const { return GetOptionInt(STE_OPTION_NOTEBOOK); } ///< STE_NotebookOptionsType GetFrameOptions()274 int GetFrameOptions() const { return GetOptionInt(STE_OPTION_FRAME); } ///< STE_FrameOptionsType GetConfigOptions()275 int GetConfigOptions() const { return GetOptionInt(STE_OPTION_CONFIG); } ///< STE_ConfigOptionsType 276 HasEditorOption(int opt)277 bool HasEditorOption( int opt) const { return STE_HASBIT(opt, GetEditorOptions()); } HasSplitterOption(int opt)278 bool HasSplitterOption(int opt) const { return STE_HASBIT(opt, GetSplitterOptions()); } HasNotebookOption(int opt)279 bool HasNotebookOption(int opt) const { return STE_HASBIT(opt, GetNotebookOptions()); } HasFrameOption(int opt)280 bool HasFrameOption( int opt) const { return STE_HASBIT(opt, GetFrameOptions()); } HasConfigOption(int opt)281 bool HasConfigOption( int opt) const { return STE_HASBIT(opt, GetConfigOptions()); } 282 SetEditorOption(int opt,bool val)283 void SetEditorOption( int opt, bool val ) { SetEditorOptions(STE_SETBIT(GetEditorOptions(), opt, val)); } SetSplitterOption(int opt,bool val)284 void SetSplitterOption( int opt, bool val ) { SetSplitterOptions(STE_SETBIT(GetSplitterOptions(), opt, val)); } SetNotebookOption(int opt,bool val)285 void SetNotebookOption( int opt, bool val ) { SetNotebookOptions(STE_SETBIT(GetNotebookOptions(), opt, val)); } SetFrameOption(int opt,bool val)286 void SetFrameOption( int opt, bool val ) { SetFrameOptions(STE_SETBIT(GetFrameOptions(), opt, val)); } SetConfigOption(int opt,bool val)287 void SetConfigOption( int opt, bool val ) { SetConfigOptions(STE_SETBIT(GetConfigOptions(), opt, val)); } 288 SetEditorOptions(int editOptions)289 void SetEditorOptions( int editOptions ) { SetOptionInt(STE_OPTION_EDITOR, editOptions); } ///< STE_EditorOptionsType SetSplitterOptions(int splitterOptions)290 void SetSplitterOptions( int splitterOptions ) { SetOptionInt(STE_OPTION_SPLITTER, splitterOptions); } ///< STE_SplitterOptionsType SetNotebookOptions(int notebookOptions)291 void SetNotebookOptions( int notebookOptions ) { SetOptionInt(STE_OPTION_NOTEBOOK, notebookOptions); } ///< STE_NotebookOptionsType SetFrameOptions(int frameOptions)292 void SetFrameOptions( int frameOptions ) { SetOptionInt(STE_OPTION_FRAME, frameOptions); } ///< STE_FrameOptionsType SetConfigOptions(int configOptions)293 void SetConfigOptions( int configOptions ) { SetOptionInt(STE_OPTION_CONFIG, configOptions); } ///< STE_ConfigOptionsType 294 295 /// @} 296 // ----------------------------------------------------------------------- 297 /// @name Default filenames. 298 /// @{ 299 300 /// The default filename to use when creating a new editor. GetDefaultFileName()301 wxString GetDefaultFileName() const { return GetOption(STE_OPTION_DEFAULT_FILENAME); } 302 /// The default and (updated by filedialog) last path for the the load/save dialog. GetDefaultFilePath()303 wxString GetDefaultFilePath() const { return GetOption(STE_OPTION_DEFAULT_FILEPATH); } 304 /// The default extensions to use in the load/save dialog. GetDefaultFileExtensions()305 wxString GetDefaultFileExtensions() const { return GetOption(STE_OPTION_DEFAULT_FILEEXTS); } 306 SetDefaultFileName(const wxString & fileName)307 void SetDefaultFileName( const wxString& fileName ) { SetOption(STE_OPTION_DEFAULT_FILENAME, fileName); } SetDefaultFilePath(const wxString & filePath)308 void SetDefaultFilePath( const wxString& filePath ) { SetOption(STE_OPTION_DEFAULT_FILEPATH, filePath); } SetDefaultFileExtensions(const wxString & fileExt)309 void SetDefaultFileExtensions( const wxString& fileExt ) { SetOption(STE_OPTION_DEFAULT_FILEEXTS, fileExt); } 310 311 /// @} 312 313 /// Optional slash/backslash 314 wxPathFormat GetDisplayPathSeparator() const; 315 void SetDisplayPathSeparator(wxPathFormat); 316 317 // ----------------------------------------------------------------------- 318 /// @name Get the prefs/styles/langs to use in the editors (may be !IsOk()). 319 /// @{ 320 wxSTEditorPrefs& GetEditorPrefs() const; 321 wxSTEditorStyles& GetEditorStyles() const; 322 wxSTEditorLangs& GetEditorLangs() const; 323 /// @} 324 325 /// @name Set the prefs/styles/langs to use in the editors (may be !IsOk()). 326 /// @{ 327 void SetEditorPrefs( const wxSTEditorPrefs& prefs); 328 void SetEditorStyles(const wxSTEditorStyles& styles); 329 void SetEditorLangs( const wxSTEditorLangs& langs); 330 /// @} 331 332 /// Ref the global prefs/styles/langs see wxSTEditor::GetGlobalEditorXXX() 333 void SetUseGlobalPrefsStylesLangs(); 334 335 // ----------------------------------------------------------------------- 336 /// Get the find/replace data to use, by default use the global version. 337 wxSTEditorFindReplaceData* GetFindReplaceData() const; 338 /// Set a "new" find/replace data to use, if !is_static it'll be deleted, NULL for none. 339 void SetFindReplaceData(wxSTEditorFindReplaceData* frData, bool is_static); 340 341 // ----------------------------------------------------------------------- 342 /// Get the menu manager used to create the menu's (may be NULL). 343 wxSTEditorMenuManager* GetMenuManager() const; 344 /// Set a "new" menu manager to use, if !is_static it'll be deleted, NULL for none. 345 void SetMenuManager(wxSTEditorMenuManager* steMM, bool is_static); 346 347 // ----------------------------------------------------------------------- 348 /// Get the wxFileHistory that stores recently opened files (may be NULL). 349 wxFileHistory* GetFileHistory() const; 350 /// Set a "new" wxFileHistory to use, if !is_static it'll be deleted, NULL for none. 351 void SetFileHistory(wxFileHistory* fileHistory, bool is_static); 352 353 // ----------------------------------------------------------------------- 354 /// Get the wxMenuBar to be updated (or NULL for none) 355 wxMenuBar* GetMenuBar() const; 356 /// Get the toolbar to be updated (or NULL for none) 357 wxToolBar* GetToolBar() const; 358 /// Get the statusbar to be updated (or NULL for none) 359 wxStatusBar* GetStatusBar() const; 360 /// Get the menu to popup in the editor(s), may be null for none 361 wxMenu* GetEditorPopupMenu() const; 362 /// Get the menu to popup on the splitter(s) sash, may be null for none 363 wxMenu* GetSplitterPopupMenu() const; 364 /// Get the menu to popup on the notebook tabs, maybe be null for none 365 wxMenu* GetNotebookPopupMenu() const; 366 367 /// Set a menubar and toolbar to be updated as necessary (won't be deleted) 368 void SetMenuBar( wxMenuBar* menuBar); 369 void SetToolBar( wxToolBar* toolBar); 370 void SetStatusBar(wxStatusBar* statusBar); 371 /// Set a "new" wxMenu to use as a popup menu, it'll be deleted if !is_static 372 void SetEditorPopupMenu( wxMenu* menu, bool is_static); 373 void SetSplitterPopupMenu(wxMenu* menu, bool is_static); 374 void SetNotebookPopupMenu(wxMenu* menu, bool is_static); 375 376 //------------------------------------------------------------------------- 377 /// @name Get/Set the ClientData in the ref data - see wxClientDataContainer. 378 /// You can store any extra info here, don't forget to delete void data. 379 /// @{ 380 381 void SetClientObject( wxClientData *data ); 382 wxClientData *GetClientObject() const; 383 384 void SetClientData( void *data ); 385 void *GetClientData() const; 386 387 /// @} 388 // ----------------------------------------------------------------------- 389 /// @name Global settings, these are values that this class will be initialized with 390 /// @{ 391 392 static wxString GetGlobalDefaultFileName(); 393 static void SetGlobalDefaultFileName(const wxString& fileName); 394 395 static wxString GetGlobalDefaultExtensions(); 396 static void SetGlobalDefaultFileExtensions(const wxString& fileExt); 397 398 /// @} 399 // ----------------------------------------------------------------------- 400 /// Register wxStEdits menu id's so that they do not collide with the id's of the calling app. 401 /// Calls wxRegisterId(ID_STE__LAST) to make the wxNewId() counter start at ID_STE__LAST + 1. 402 static void RegisterIds(); 403 404 // ----------------------------------------------------------------------- 405 /// @name Load/Save the config for the prefs/styles/langs, see CFGPATH options 406 /// @{ 407 408 /// Get the full path of the path_option_n STE_OPTION_CFGPATH_XXX where the 409 /// full path is the basePath + optionPath. 410 wxString GetConfigPath(size_t path_option_n) const; 411 412 /// Add or remove the trailing '/' use this liberally since sometimes you 413 /// will want the trailing '/' sometimes not, just run this to be sure. 414 static wxString FixConfigPath(const wxString& path, bool add_sep); 415 416 void LoadConfig(wxConfigBase &config); 417 void SaveConfig(wxConfigBase &config); 418 419 /// Load the wxFileHistory files (recently opened files) 420 void LoadFileConfig(wxConfigBase &config); 421 /// Save the wxFileHistory files (recently opened files) 422 void SaveFileConfig(wxConfigBase &config); 423 424 /// @} 425 // ----------------------------------------------------------------------- 426 /// @name Operators 427 /// @{ 428 wxSTEditorOptions& operator = (const wxSTEditorOptions& steOpts) 429 { 430 if ( (*this) != steOpts ) 431 Ref(steOpts); 432 return *this; 433 } 434 435 bool operator == (const wxSTEditorOptions& steOpts) const 436 { return m_refData == steOpts.m_refData; } 437 bool operator != (const wxSTEditorOptions& steOpts) const 438 { return m_refData != steOpts.m_refData; } 439 /// @} 440 }; 441 442 #endif // _STEOPTS_H_ 443