#include "wx/imaglist.h"
#include "proplist.h"
+#include "symbtabl.h"
+#include "winstyle.h"
#define RESED_DELETE 1
#define RESED_RECREATE 3
*/
class wxResourceEditorFrame;
-class EditorToolPalette;
class EditorToolBar;
class wxWindowPropertyInfo;
class wxResourceEditorProjectTree;
class wxResourceEditorControlList;
-#ifdef __WINDOWS__
+#ifdef __WXMSW__
#define wxHelpController wxWinHelpController
#else
#define wxHelpController wxXLPHelpController;
public:
wxResourceTableWithSaving():wxResourceTable()
{
+ // Add all known window styles
+ m_styleTable.Init();
}
virtual bool Save(const wxString& filename);
virtual bool SaveResource(ostream& stream, wxItemResource *item);
- 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);
void GenerateButtonStyleString(long windowStyle, char *buf);
void GenerateCheckBoxStyleString(long windowStyle, char *buf);
+ void GenerateRadioButtonStyleString(long windowStyle, char *buf);
void GenerateListBoxStyleString(long windowStyle, char *buf);
void GenerateSliderStyleString(long windowStyle, char *buf);
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, wxFont *font);
wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource);
+
+protected:
+ wxWindowStyleTable m_styleTable;
};
class wxResourceEditorScrolledWindow;
virtual wxFrame *OnCreateEditorFrame(const char *title);
virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
- virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent);
- virtual EditorToolPalette *OnCreatePalette(wxFrame *parent);
+ virtual wxToolBar *OnCreateToolBar(wxFrame *parent);
// Create a window information object for the give window
wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
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
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.
// Accessors
inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
- inline void SetEditorPalette(EditorToolPalette *pal) { m_editorPalette = pal; }
inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; }
inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; }
- inline EditorToolPalette *GetEditorPalette() const { return m_editorPalette; }
inline wxList& GetSelections() { return m_selections; }
inline wxMenu *GetPopupMenu() const { return m_popupMenu; }
inline wxHelpController *GetHelpController() const { return m_helpController; }
inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
- inline wxString& GetCurrentFilename() { return m_currentFilename; }
+ 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
protected:
wxHelpController* m_helpController;
wxMenu* m_popupMenu;
wxResourceEditorProjectTree* m_editorResourceTree;
wxResourceEditorControlList* m_editorControlList;
- EditorToolPalette* m_editorPalette;
EditorToolBar* m_editorToolBar;
int m_nameCounter;
+ int m_symbolIdCounter; // For generating window ids
bool m_modified;
wxHashTable m_resourceAssociations;
wxList m_selections;
wxRect m_propertyWindowSize;
wxRect m_resourceEditorWindowSize;
static wxResourceManager* sm_currentResourceManager;
+
+ // Symbol table with identifiers for controls
+ wxResourceSymbolTable m_symbolTable;
+ // Filename for include file, e.g. resource.h
+ wxString m_symbolFilename;
};
{
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);