- wxResourceManager();
- ~wxResourceManager();
-
-// Operations
-
- // Initializes the resource manager
- bool Initialize();
-
- // Load/save window size etc.
- bool LoadOptions();
- bool SaveOptions();
-
- // Show or hide the resource editor frame, which displays a list
- // of resources with ability to edit them.
- virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor");
-
- virtual bool Save();
- virtual bool SaveAs();
- virtual bool Save(const wxString& filename);
- virtual bool Load(const wxString& filename);
- virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
- virtual void SetFrameTitle(const wxString& filename);
- virtual void ClearCurrentDialog();
- virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
- virtual bool SaveIfModified();
- virtual void AlignItems(int flag);
- virtual void CopySize();
- virtual void ToBackOrFront(bool toBack);
- virtual wxWindow *FindParentOfSelection();
-
- virtual wxFrame *OnCreateEditorFrame(const char *title);
- virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
- virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
- virtual wxToolBar *OnCreateToolBar(wxFrame *parent);
-
- // Create a window information object for the give window
- wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
- // Edit the given window
- void EditWindow(wxWindow *win);
-
- virtual void UpdateResourceList();
- virtual void AddItemsRecursively(long parent, wxItemResource *resource);
- virtual bool EditSelectedResource();
- virtual bool Edit(wxItemResource *res);
- virtual bool CreateNewPanel();
- virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
- virtual bool DeleteSelection();
- virtual bool TestCurrentDialog(wxWindow* parent);
-
- // Saves the window info into the resource, and deletes the
- // handler. Doesn't actually disassociate the window from
- // the resources. Replaces OnClose.
- virtual bool SaveInfoAndDeleteHandler(wxWindow* win);
-
- // Destroys the window. If this is the 'current' panel, NULLs the
- // variable.
- virtual bool DeleteWindow(wxWindow* win);
- virtual bool DeleteResource(wxItemResource *res);
- virtual bool DeleteResource(wxWindow *win);
-
- // Add bitmap resource if there isn't already one with this filename.
- virtual char *AddBitmapResource(char *filename);
-
- // Delete the bitmap resource if it isn't being used by another resource.
- virtual void PossiblyDeleteBitmapResource(char *resourceName);
-
- // Helper function for above
- virtual bool IsBitmapResourceUsed(char *resourceName);
-
- wxItemResource *FindBitmapResourceByFilename(char *filename);
-
- char *FindBitmapFilenameForResource(wxItemResource *resource);
-
- // Is this window identifier in use?
- bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;
-
- // Is this window identifier compatible with the given name? (i.e.
- // does it already exist under a different name)
- bool IsIdentifierOK(const wxString& name, wxWindowID id);
-
- // Change all integer ids that match oldId, to newId.
- // This is necessary if an id is changed for one resource - all resources
- // must be changed.
- void ChangeIds(int oldId, int newId);
-
- // If any resource ids were missing (or their symbol was missing),
- // repair them i.e. give them new ids. Returns TRUE if any resource
- // needed repairing.
- bool RepairResourceIds();
-
- // Deletes 'win' and creates a new window from the resource that
- // was associated with it. E.g. if you can't change properties on the
- // fly, you'll need to delete the window and create it again.
- virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL);
-
- virtual bool RecreateSelection();
-
- // Need to search through resource table removing this from
- // any resource which has this as a parent.
- virtual bool RemoveResourceFromParent(wxItemResource *res);
-
- virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
-
- void AddSelection(wxWindow *win);
- void RemoveSelection(wxWindow *win);
-
- virtual void MakeUniqueName(char *prefix, char *buf);
-
- // (Dis)associate resource<->physical window
- // Doesn't delete any windows.
- virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
- virtual bool DisassociateResource(wxItemResource *resource);
- virtual bool DisassociateResource(wxWindow *win);
- virtual bool DisassociateWindows();
- virtual wxItemResource *FindResourceForWindow(wxWindow *win);
- virtual wxWindow *FindWindowForResource(wxItemResource *resource);
-
- virtual bool InstantiateAllResourcesFromWindows();
- virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
-
-// Accessors
- inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
- inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
- inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
- inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; }
- inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; }
- inline wxList& GetSelections() { return m_selections; }
- inline wxMenu *GetPopupMenu() const { return m_popupMenu; }
- inline wxHelpController *GetHelpController() const { return m_helpController; }
-
- inline void Modify(bool mod = TRUE) { m_modified = mod; }
- inline bool Modified() const { return m_modified; }
-
- inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
- inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
-
- inline wxString GetCurrentFilename() const { return m_currentFilename; }
- static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
-
- inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; }
- inline wxString GetSymbolFilename() const { return m_symbolFilename; }
-
- inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
- inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
-
- wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; }
-
- // Generate a window id and a first stab at a name
- int GenerateWindowId(const wxString& prefix, wxString& idName) ;
-
-// Member variables
+ wxResourceManager();
+ ~wxResourceManager();
+
+ // Operations
+
+ // Initializes the resource manager
+ bool Initialize();
+
+ // Load/save window size etc.
+ bool LoadOptions();
+ bool SaveOptions();
+
+ // Show or hide the resource editor frame, which displays a list
+ // of resources with ability to edit them.
+ virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor");
+
+ // Convert old WXRs to new
+ virtual bool ConvertWXRs();
+ bool DoConvertWXR(const wxString& oldPath, const wxString& newPath);
+ bool ChangeOldToNewResource(wxItemResource* parent, wxItemResource* res);
+ bool InsertLabelResource(wxItemResource* parent, wxItemResource* res);
+
+ virtual bool Save();
+ virtual bool SaveAs();
+ virtual bool Save(const wxString& filename);
+ virtual bool Load(const wxString& filename);
+ virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
+ virtual void SetFrameTitle(const wxString& filename);
+ virtual void ClearCurrentDialog();
+ virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
+ virtual bool SaveIfModified();
+ virtual void AlignItems(int flag);
+ virtual void CopySize(int command); // Copy width, height or both from first control
+ virtual void ToBackOrFront(bool toBack);
+ virtual void DistributePositions(int command); // Distribute controls evenly between first and last
+ virtual wxWindow *FindParentOfSelection();
+
+ virtual wxFrame *OnCreateEditorFrame(const char *title);
+ virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
+ virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
+ virtual wxToolBar *OnCreateToolBar(wxFrame *parent);
+
+ // Create a window information object for the given window
+ wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
+ // Edit the given window
+ void EditWindow(wxWindow *win);
+
+ virtual void UpdateResourceList();
+ virtual void AddItemsRecursively(long parent, wxItemResource *resource);
+ virtual bool EditSelectedResource();
+ virtual bool Edit(wxItemResource *res);
+ virtual bool CreateNewPanel();
+ virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
+ virtual bool DeleteSelection();
+ virtual bool TestCurrentDialog(wxWindow* parent);
+
+ // Saves the window info into the resource, and deletes the
+ // handler. Doesn't actually disassociate the window from
+ // the resources. Replaces OnClose.
+ virtual bool SaveInfoAndDeleteHandler(wxWindow* win);
+
+ // Destroys the window. If this is the 'current' panel, NULLs the
+ // variable.
+ virtual bool DeleteWindow(wxWindow* win);
+ virtual bool DeleteResource(wxItemResource *res);
+ virtual bool DeleteResource(wxWindow *win);
+
+ // Add bitmap resource if there isn't already one with this filename.
+ virtual wxString AddBitmapResource(const wxString& filename);
+
+ // Delete the bitmap resource if it isn't being used by another resource.
+ virtual void PossiblyDeleteBitmapResource(const wxString& resourceName);
+
+ // Helper function for above
+ virtual bool IsBitmapResourceUsed(const wxString& resourceName);
+
+ wxItemResource *FindBitmapResourceByFilename(const wxString& filename);
+
+ wxString FindBitmapFilenameForResource(wxItemResource *resource);
+
+ // Is this window identifier in use?
+ bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;
+
+ // Is this window identifier compatible with the given name? (i.e.
+ // does it already exist under a different name)
+ bool IsIdentifierOK(const wxString& name, wxWindowID id);
+
+ // Change all integer ids that match oldId, to newId.
+ // This is necessary if an id is changed for one resource - all resources
+ // must be changed.
+ void ChangeIds(int oldId, int newId);
+
+ // If any resource ids were missing (or their symbol was missing),
+ // repair them i.e. give them new ids. Returns TRUE if any resource
+ // needed repairing.
+ bool RepairResourceIds();
+
+ // Deletes 'win' and creates a new window from the resource that
+ // was associated with it. E.g. if you can't change properties on the
+ // fly, you'll need to delete the window and create it again.
+ virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE);
+
+ virtual bool RecreateSelection();
+
+ // Remove selection handles if this control is selected
+ void DeselectItemIfNecessary(wxWindow *win);
+
+ // Need to search through resource table removing this from
+ // any resource which has this as a parent.
+ virtual bool RemoveResourceFromParent(wxItemResource *res);
+
+ virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
+
+ void AddSelection(wxWindow *win);
+ void RemoveSelection(wxWindow *win);
+
+ virtual void MakeUniqueName(char *prefix, char *buf);
+
+ // (Dis)associate resource<->physical window
+ // Doesn't delete any windows.
+ virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
+ virtual bool DisassociateResource(wxItemResource *resource);
+ virtual bool DisassociateResource(wxWindow *win);
+ virtual bool DisassociateWindows();
+ virtual wxItemResource *FindResourceForWindow(wxWindow *win);
+ virtual wxWindow *FindWindowForResource(wxItemResource *resource);
+
+ virtual bool InstantiateAllResourcesFromWindows();
+ virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
+
+ // Accessors
+ inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
+ inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
+ inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
+ inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; }
+ inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; }
+ inline wxList& GetSelections() { return m_selections; }
+ inline wxMenu *GetPopupMenu() const { return m_popupMenu; }
+#ifdef __WXMSW__
+ inline wxHelpController *GetHelpController() const { return m_helpController; }
+#endif
+
+ inline void Modify(bool mod = TRUE) { m_modified = mod; }
+ inline bool Modified() const { return m_modified; }
+
+ inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
+ inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
+
+ inline wxString GetCurrentFilename() const { return m_currentFilename; }
+ static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
+
+ inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; }
+ inline wxString GetSymbolFilename() const { return m_symbolFilename; }
+
+ inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
+ inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
+
+ wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; }
+
+ // Generate a window id and a first stab at a name
+ int GenerateWindowId(const wxString& prefix, wxString& idName) ;
+
+ // Member variables