X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03f68f123bc79f23ff77821cfe80bfa76b0e68c4..f3033278722328d37b98406b45060a2a3b8b1877:/utils/dialoged/src/reseditr.h diff --git a/utils/dialoged/src/reseditr.h b/utils/dialoged/src/reseditr.h index 3839f94ee8..5a87b10d06 100644 --- a/utils/dialoged/src/reseditr.h +++ b/utils/dialoged/src/reseditr.h @@ -24,9 +24,10 @@ #include "wx/resource.h" #include "wx/toolbar.h" #include "wx/imaglist.h" - -#include "proplist.h" +#include "wx/treectrl.h" +#include "wx/proplist.h" #include "symbtabl.h" +#include "winstyle.h" #define RESED_DELETE 1 #define RESED_RECREATE 3 @@ -75,7 +76,7 @@ class wxResourceEditorControlList; #ifdef __WXMSW__ #define wxHelpController wxWinHelpController #else -#define wxHelpController wxXLPHelpController; +#define wxHelpController wxHTMLHelpController; #endif class wxHelpController; @@ -112,14 +113,16 @@ class wxResourceTableWithSaving: public wxResourceTable public: wxResourceTableWithSaving():wxResourceTable() { + // Add all known window styles + m_styleTable.Init(); } virtual bool Save(const wxString& filename); - virtual bool SaveResource(ostream& stream, wxItemResource *item); + virtual bool SaveResource(ostream& stream, wxItemResource* item, wxItemResource* parentItem); - void GenerateWindowStyleString(long windowStyle, char *buf); void GeneratePanelStyleString(long windowStyle, char *buf); void GenerateDialogStyleString(long windowStyle, char *buf); +/* void GenerateRadioBoxStyleString(long windowStyle, char *buf); void GenerateMessageStyleString(long windowStyle, char *buf); void GenerateTextStyleString(long windowStyle, char *buf); @@ -131,13 +134,21 @@ class wxResourceTableWithSaving: public wxResourceTable void GenerateGroupBoxStyleString(long windowStyle, char *buf); void GenerateGaugeStyleString(long windowStyle, char *buf); void GenerateChoiceStyleString(long windowStyle, char *buf); + void GenerateComboBoxStyleString(long windowStyle, char *buf); void GenerateScrollBarStyleString(long windowStyle, char *buf); - void GenerateItemStyleString(long windowStyle, char *buf); - +*/ + + void GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf); + +/* bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle); +*/ + + void OutputFont(ostream& stream, const wxFont& font); + wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource); - void OutputFont(ostream& stream, wxFont *font); - wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource); +protected: + wxWindowStyleTable m_styleTable; }; class wxResourceEditorScrolledWindow; @@ -180,7 +191,7 @@ public: virtual wxFrame *OnCreateEditorFrame(const char *title); virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent); virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent); - virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent); + virtual wxToolBar *OnCreateToolBar(wxFrame *parent); // Create a window information object for the give window wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win); @@ -208,17 +219,34 @@ public: virtual bool DeleteResource(wxWindow *win); // Add bitmap resource if there isn't already one with this filename. - virtual char *AddBitmapResource(char *filename); + virtual wxString AddBitmapResource(const wxString& filename); // Delete the bitmap resource if it isn't being used by another resource. - virtual void PossiblyDeleteBitmapResource(char *resourceName); + virtual void PossiblyDeleteBitmapResource(const wxString& resourceName); // Helper function for above - virtual bool IsBitmapResourceUsed(char *resourceName); + virtual bool IsBitmapResourceUsed(const wxString& resourceName); + + wxItemResource *FindBitmapResourceByFilename(const wxString& filename); - wxItemResource *FindBitmapResourceByFilename(char *filename); + wxString FindBitmapFilenameForResource(wxItemResource *resource); - 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 @@ -258,7 +286,9 @@ public: 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; } @@ -275,9 +305,16 @@ public: 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 protected: +#ifdef __WXMSW__ wxHelpController* m_helpController; +#endif wxResourceTableWithSaving m_resourceTable; wxFrame* m_editorFrame; wxResourceEditorScrolledWindow* m_editorPanel; @@ -286,6 +323,7 @@ public: wxResourceEditorControlList* m_editorControlList; EditorToolBar* m_editorToolBar; int m_nameCounter; + int m_symbolIdCounter; // For generating window ids bool m_modified; wxHashTable m_resourceAssociations; wxList m_selections; @@ -319,7 +357,7 @@ class wxResourceEditorFrame: public wxFrame long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); ~wxResourceEditorFrame(); - bool OnClose(); + void OnCloseWindow(wxCloseEvent& event); void OnNew(wxCommandEvent& event); void OnOpen(wxCommandEvent& event); @@ -373,10 +411,9 @@ class EditorToolBar: public wxToolBar { public: EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0), - long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2); + long style = wxTB_HORIZONTAL); bool OnLeftClick(int toolIndex, bool toggled); void OnMouseEnter(int toolIndex); - void OnPaint(wxPaintEvent& event); DECLARE_EVENT_TABLE() }; @@ -400,5 +437,19 @@ DECLARE_EVENT_TABLE() #define TOOLBAR_TO_BACK 17 #define TOOLBAR_COPY_SIZE 18 +/* + * this class is used to store data associated with a tree item + */ +class wxResourceTreeData : public wxTreeItemData +{ +public: + wxResourceTreeData(wxItemResource *resource) { m_resource = resource; } + + wxItemResource *GetResource() const { return m_resource; } + +private: + wxItemResource *m_resource; +}; + #endif