Dialog unit mods; wxProp tidying

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-10-09 12:01:58 +00:00
parent c39d4bcf2b
commit fd71308fc8
57 changed files with 2060 additions and 1850 deletions

View File

@@ -849,6 +849,9 @@ enum {
#define wxID_HIGHEST 5999 #define wxID_HIGHEST 5999
// Shortcut for easier dialog-unit-to-pixel conversion
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixel(pt)
#ifdef __WXMSW__ #ifdef __WXMSW__
// Stand-ins for Windows types, to avoid // Stand-ins for Windows types, to avoid
// #including all of windows.h // #including all of windows.h

View File

@@ -82,7 +82,7 @@ public:
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName, virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
virtual wxControl *CreateItem( const wxItemResource *childResource, virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
bool Close( bool force = FALSE ); bool Close( bool force = FALSE );
@@ -105,6 +105,14 @@ public:
virtual void SetSizeHints( int minW, int minH, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1 ); virtual void SetSizeHints( int minW, int minH, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1 );
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
inline wxSize ConvertPixelsToDialog(const wxSize& sz)
{ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
inline wxSize ConvertDialogToPixels(const wxSize& sz)
{ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );
void OnIdle( wxIdleEvent& event ); void OnIdle( wxIdleEvent& event );
@@ -167,15 +175,6 @@ public:
int *externalLeading = (int *) NULL, int *externalLeading = (int *) NULL,
const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const;
virtual void SetDefaultBackgroundColour( const wxColour& col )
{ m_defaultBackgroundColour = col; }
virtual wxColour GetDefaultBackgroundColour() const
{ return m_defaultBackgroundColour; }
virtual void SetDefaultForegroundColour( const wxColour& col )
{ m_defaultForegroundColour = col; }
virtual wxColour GetDefaultForegroundColour() const
{ return m_defaultForegroundColour; }
virtual void SetFont( const wxFont &font ); virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont(); virtual wxFont *GetFont();
// For backward compatibility // For backward compatibility
@@ -259,9 +258,7 @@ public:
wxCursor *m_cursor; wxCursor *m_cursor;
wxFont m_font; wxFont m_font;
wxColour m_backgroundColour; wxColour m_backgroundColour;
wxColour m_defaultBackgroundColour;
wxColour m_foregroundColour ; wxColour m_foregroundColour ;
wxColour m_defaultForegroundColour;
wxRegion m_updateRegion; wxRegion m_updateRegion;
long m_windowStyle; long m_windowStyle;
bool m_isShown; bool m_isShown;

View File

@@ -82,7 +82,7 @@ public:
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName, virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
virtual wxControl *CreateItem( const wxItemResource *childResource, virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
bool Close( bool force = FALSE ); bool Close( bool force = FALSE );
@@ -105,6 +105,14 @@ public:
virtual void SetSizeHints( int minW, int minH, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1 ); virtual void SetSizeHints( int minW, int minH, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1 );
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
inline wxSize ConvertPixelsToDialog(const wxSize& sz)
{ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
inline wxSize ConvertDialogToPixels(const wxSize& sz)
{ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );
void OnIdle( wxIdleEvent& event ); void OnIdle( wxIdleEvent& event );
@@ -167,15 +175,6 @@ public:
int *externalLeading = (int *) NULL, int *externalLeading = (int *) NULL,
const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const;
virtual void SetDefaultBackgroundColour( const wxColour& col )
{ m_defaultBackgroundColour = col; }
virtual wxColour GetDefaultBackgroundColour() const
{ return m_defaultBackgroundColour; }
virtual void SetDefaultForegroundColour( const wxColour& col )
{ m_defaultForegroundColour = col; }
virtual wxColour GetDefaultForegroundColour() const
{ return m_defaultForegroundColour; }
virtual void SetFont( const wxFont &font ); virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont(); virtual wxFont *GetFont();
// For backward compatibility // For backward compatibility
@@ -259,9 +258,7 @@ public:
wxCursor *m_cursor; wxCursor *m_cursor;
wxFont m_font; wxFont m_font;
wxColour m_backgroundColour; wxColour m_backgroundColour;
wxColour m_defaultBackgroundColour;
wxColour m_foregroundColour ; wxColour m_foregroundColour ;
wxColour m_defaultForegroundColour;
wxRegion m_updateRegion; wxRegion m_updateRegion;
long m_windowStyle; long m_windowStyle;
bool m_isShown; bool m_isShown;

View File

@@ -318,15 +318,6 @@ public:
inline virtual void SetForegroundColour(const wxColour& col); inline virtual void SetForegroundColour(const wxColour& col);
inline virtual wxColour GetForegroundColour() const; inline virtual wxColour GetForegroundColour() const;
// Set/get window default background colour (for children to inherit).
// NOTE: these may be removed in later revisions.
inline virtual void SetDefaultBackgroundColour(const wxColour& col);
inline virtual wxColour GetDefaultBackgroundColour(void) const;
// Set/get window default foreground colour (for children to inherit)
inline virtual void SetDefaultForegroundColour(const wxColour& col);
inline virtual wxColour GetDefaultForegroundColour(void) const;
// Get the default button, if there is one // Get the default button, if there is one
inline virtual wxButton *GetDefaultItem() const; inline virtual wxButton *GetDefaultItem() const;
inline virtual void SetDefaultItem(wxButton *but); inline virtual void SetDefaultItem(wxButton *but);
@@ -338,7 +329,8 @@ public:
// Resource loading // Resource loading
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES
virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL); virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL); virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL);
#endif #endif
virtual void GetTextExtent(const wxString& string, int *x, int *y, virtual void GetTextExtent(const wxString& string, int *x, int *y,
@@ -436,6 +428,14 @@ public:
virtual void GetClientSizeConstraint(int *w, int *h) const ; virtual void GetClientSizeConstraint(int *w, int *h) const ;
virtual void GetPositionConstraint(int *x, int *y) const ; virtual void GetPositionConstraint(int *x, int *y) const ;
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
inline wxSize ConvertPixelsToDialog(const wxSize& sz)
{ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
inline wxSize ConvertDialogToPixels(const wxSize& sz)
{ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
wxObject *GetChild(int number) const ; wxObject *GetChild(int number) const ;
// Generates a new id for controls // Generates a new id for controls
@@ -528,8 +528,6 @@ protected:
wxColour m_backgroundColour ; wxColour m_backgroundColour ;
wxColour m_foregroundColour ; wxColour m_foregroundColour ;
wxColour m_defaultBackgroundColour;
wxColour m_defaultForegroundColour;
wxAcceleratorTable m_acceleratorTable; wxAcceleratorTable m_acceleratorTable;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
@@ -598,10 +596,6 @@ inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundCol
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; }; inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; }; inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; }; inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
inline void wxWindow::SetDefaultForegroundColour(const wxColour& col) { m_defaultForegroundColour = col; };
inline wxColour wxWindow::GetDefaultForegroundColour(void) const { return m_defaultForegroundColour; };
inline void wxWindow::SetDefaultBackgroundColour(const wxColour& col) { m_defaultBackgroundColour = col; };
inline wxColour wxWindow::GetDefaultBackgroundColour(void) const { return m_defaultBackgroundColour; };
inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; } inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }
inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; } inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }

View File

@@ -330,15 +330,6 @@ public:
inline virtual void SetForegroundColour(const wxColour& col); inline virtual void SetForegroundColour(const wxColour& col);
inline virtual wxColour GetForegroundColour(void) const; inline virtual wxColour GetForegroundColour(void) const;
// TODO: are these really necessary???
// Set/get window default background colour (for children to inherit)
inline virtual void SetDefaultBackgroundColour(const wxColour& col);
inline virtual wxColour GetDefaultBackgroundColour(void) const;
// Set/get window default foreground colour (for children to inherit)
inline virtual void SetDefaultForegroundColour(const wxColour& col);
inline virtual wxColour GetDefaultForegroundColour(void) const;
// For backward compatibility // For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
@@ -359,7 +350,7 @@ public:
// Resource loading // Resource loading
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES
virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL); virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL); virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, const wxResourceTable *table = NULL);
#endif #endif
// Native resource loading // Native resource loading
@@ -474,6 +465,14 @@ public:
virtual void GetClientSizeConstraint(int *w, int *h) const ; virtual void GetClientSizeConstraint(int *w, int *h) const ;
virtual void GetPositionConstraint(int *x, int *y) const ; virtual void GetPositionConstraint(int *x, int *y) const ;
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
inline wxSize ConvertPixelsToDialog(const wxSize& sz)
{ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
inline wxSize ConvertDialogToPixels(const wxSize& sz)
{ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
wxObject *GetChild(int number) const ; wxObject *GetChild(int number) const ;
void MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title, void MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
@@ -638,13 +637,8 @@ protected:
#endif #endif
wxButton * m_defaultItem; wxButton * m_defaultItem;
wxColour m_backgroundColour ; wxColour m_backgroundColour ;
wxColour m_defaultBackgroundColour;
wxColour m_foregroundColour ; wxColour m_foregroundColour ;
wxColour m_defaultForegroundColour;
bool m_backgroundTransparent; bool m_backgroundTransparent;
int m_xThumbSize; int m_xThumbSize;
@@ -710,10 +704,6 @@ inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundCol
inline wxColour wxWindow::GetBackgroundColour(void) const { return m_backgroundColour; }; inline wxColour wxWindow::GetBackgroundColour(void) const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; }; inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
inline wxColour wxWindow::GetForegroundColour(void) const { return m_foregroundColour; }; inline wxColour wxWindow::GetForegroundColour(void) const { return m_foregroundColour; };
inline void wxWindow::SetDefaultForegroundColour(const wxColour& col) { m_defaultForegroundColour = col; };
inline wxColour wxWindow::GetDefaultForegroundColour(void) const { return m_defaultForegroundColour; };
inline void wxWindow::SetDefaultBackgroundColour(const wxColour& col) { m_defaultBackgroundColour = col; };
inline wxColour wxWindow::GetDefaultBackgroundColour(void) const { return m_defaultBackgroundColour; };
inline wxButton *wxWindow::GetDefaultItem(void) const { return m_defaultItem; } inline wxButton *wxWindow::GetDefaultItem(void) const { return m_defaultItem; }
inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; } inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }

View File

@@ -31,6 +31,17 @@
#define RESOURCE_PLATFORM_MAC 3 #define RESOURCE_PLATFORM_MAC 3
#define RESOURCE_PLATFORM_ANY 4 #define RESOURCE_PLATFORM_ANY 4
// Extended styles: for resource usage only
// Use dialog units instead of pixels
#define wxRESOURCE_DIALOG_UNITS 1
// Use default system colour and font
#define wxRESOURCE_USE_DEFAULTS 2
// Macros to help use dialog units
#define wxDLG_POINT(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxPoint(x, y)) : wxPoint(x, y))
#define wxDLG_SIZE(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxSize(x, y)) : wxSize(x, y))
/* /*
* Internal format for control/panel item * Internal format for control/panel item
*/ */
@@ -39,71 +50,76 @@ class WXDLLEXPORT wxItemResource: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxItemResource) DECLARE_DYNAMIC_CLASS(wxItemResource)
protected:
wxList children;
char *itemType;
int x, y, width, height;
char *title;
char *name;
long windowStyle;
long value1, value2, value3, value5;
char *value4;
int m_windowId;
wxStringList *stringValues; // Optional string values
wxBitmap *bitmap;
wxColour *backgroundColour;
wxColour *labelColour;
wxColour *buttonColour;
wxFont *windowFont;
public: public:
wxItemResource(void); wxItemResource();
~wxItemResource(void); ~wxItemResource();
void SetType(char *typ); inline void SetType(const wxString& type) { m_itemType = type; }
inline void SetStyle(long styl) { windowStyle = styl; } inline void SetStyle(long styl) { m_windowStyle = styl; }
inline void SetId(int id) { m_windowId = id; } inline void SetId(int id) { m_windowId = id; }
inline void SetBitmap(wxBitmap *bm) { bitmap = bm; } inline void SetBitmap(const wxBitmap& bm) { m_bitmap = bm; }
inline wxBitmap *GetBitmap(void) { return bitmap; } inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
inline void SetFont(wxFont *font) { windowFont = font; } inline void SetFont(const wxFont& font) { m_windowFont = font; }
inline wxFont *GetFont(void) { return windowFont; } inline wxFont& GetFont() const { return (wxFont&) m_windowFont; }
inline void SetSize(int xx, int yy, int ww, int hh) inline void SetSize(int xx, int yy, int ww, int hh)
{ x = xx; y = yy; width = ww; height = hh; } { m_x = xx; m_y = yy; m_width = ww; m_height = hh; }
void SetTitle(char *t); inline void SetTitle(const wxString& title) { m_title = title; }
void SetName(char *n); inline void SetName(const wxString& name) { m_name = name; }
inline void SetValue1(long v) { value1 = v; } inline void SetValue1(long v) { m_value1 = v; }
inline void SetValue2(long v) { value2 = v; } inline void SetValue2(long v) { m_value2 = v; }
inline void SetValue3(long v) { value3 = v; } inline void SetValue3(long v) { m_value3 = v; }
inline void SetValue5(long v) { value5 = v; } inline void SetValue5(long v) { m_value5 = v; }
void SetValue4(char *v); inline void SetValue4(const wxString& v) { m_value4 = v; }
void SetStringValues(wxStringList *svalues); inline void SetStringValues(const wxStringList& svalues) { m_stringValues = svalues; }
inline char *GetType(void) { return itemType; } inline wxString GetType() const { return m_itemType; }
inline int GetX(void) { return x; } inline int GetX() const { return m_x; }
inline int GetY(void) { return y; } inline int GetY() const { return m_y; }
inline int GetWidth(void) { return width; } inline int GetWidth() const { return m_width; }
inline int GetHeight(void) { return height; } inline int GetHeight() const { return m_height; }
inline char *GetTitle(void) { return title; } inline wxString GetTitle() const { return m_title; }
inline char *GetName(void) { return name; } inline wxString GetName() const { return m_name; }
inline long GetStyle(void) { return windowStyle; } inline long GetStyle() const { return m_windowStyle; }
inline int GetId(void) { return m_windowId; } inline int GetId() const { return m_windowId; }
inline long GetValue1(void) { return value1; } inline long GetValue1() const { return m_value1; }
inline long GetValue2(void) { return value2; } inline long GetValue2() const { return m_value2; }
inline long GetValue3(void) { return value3; } inline long GetValue3() const { return m_value3; }
inline long GetValue5(void) { return value5; } inline long GetValue5() const { return m_value5; }
inline char *GetValue4(void) { return value4; } inline wxString GetValue4() const { return m_value4; }
inline wxList& GetChildren(void) { return children; } inline wxList& GetChildren() const { return (wxList&) m_children; }
inline wxStringList *GetStringValues(void) { return stringValues; } inline wxStringList& GetStringValues() const { return (wxStringList&) m_stringValues; }
inline void SetBackgroundColour(wxColour *col) { if (backgroundColour) delete backgroundColour; backgroundColour = col; } inline void SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; }
inline void SetLabelColour(wxColour *col) { if (labelColour) delete labelColour; labelColour = col; } inline void SetLabelColour(const wxColour& col) { m_labelColour = col; }
inline void SetButtonColour(wxColour *col) { if (buttonColour) delete buttonColour; buttonColour = col; } inline void SetButtonColour(const wxColour& col) { m_buttonColour = col; }
inline wxColour *GetBackgroundColour(void) { return backgroundColour; } inline wxColour& GetBackgroundColour() const { return (wxColour&) m_backgroundColour; }
inline wxColour *GetLabelColour(void) { return labelColour; } inline wxColour& GetLabelColour() const { return (wxColour&) m_labelColour; }
inline wxColour *GetButtonColour(void) { return buttonColour; } inline wxColour& GetButtonColour() const { return (wxColour&) m_buttonColour; }
inline void SetResourceStyle(long style) { m_exStyle = style; }
inline long GetResourceStyle() const { return m_exStyle; }
protected:
wxList m_children;
wxString m_itemType;
int m_x, m_y, m_width, m_height;
wxString m_title;
wxString m_name;
long m_windowStyle;
long m_value1, m_value2, m_value3, m_value5;
wxString m_value4;
int m_windowId;
wxStringList m_stringValues; // Optional string values
wxBitmap m_bitmap;
wxColour m_backgroundColour;
wxColour m_labelColour;
wxColour m_buttonColour;
wxFont m_windowFont;
long m_exStyle; // Extended, resource-specific styles
}; };
/* /*
@@ -119,55 +135,55 @@ class WXDLLEXPORT wxResourceTable: public wxHashTable
public: public:
wxHashTable identifiers; wxHashTable identifiers;
wxResourceTable(void); wxResourceTable();
~wxResourceTable(void); ~wxResourceTable();
virtual wxItemResource *FindResource(const wxString& name) const; virtual wxItemResource *FindResource(const wxString& name) const;
virtual void AddResource(wxItemResource *item); virtual void AddResource(wxItemResource *item);
virtual bool DeleteResource(const wxString& name); virtual bool DeleteResource(const wxString& name);
virtual bool ParseResourceFile(char *filename); virtual bool ParseResourceFile(const wxString& filename);
virtual bool ParseResourceData(char *data); virtual bool ParseResourceData(const wxString& data);
virtual bool SaveResource(char *filename); virtual bool SaveResource(const wxString& filename);
// Register XBM/XPM data // Register XBM/XPM data
virtual bool RegisterResourceBitmapData(char *name, char bits[], int width, int height); virtual bool RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height);
virtual bool RegisterResourceBitmapData(char *name, char **data); virtual bool RegisterResourceBitmapData(const wxString& name, char **data);
virtual wxControl *CreateItem(wxWindow *panel, wxItemResource *childResource) const; virtual wxControl *CreateItem(wxWindow *panel, const wxItemResource* childResource, const wxItemResource* parentResource) const;
virtual void ClearTable(void); virtual void ClearTable();
}; };
extern void WXDLLEXPORT wxInitializeResourceSystem(void); extern void WXDLLEXPORT wxInitializeResourceSystem();
extern void WXDLLEXPORT wxCleanUpResourceSystem(void); extern void WXDLLEXPORT wxCleanUpResourceSystem();
WXDLLEXPORT_DATA(extern wxResourceTable*) wxDefaultResourceTable; WXDLLEXPORT_DATA(extern wxResourceTable*) wxDefaultResourceTable;
extern long WXDLLEXPORT wxParseWindowStyle(char *style); extern long WXDLLEXPORT wxParseWindowStyle(const wxString& style);
class WXDLLEXPORT wxMenuBar; class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxMenu; class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxBitmap; class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxIcon; class WXDLLEXPORT wxIcon;
extern wxBitmap* WXDLLEXPORT wxResourceCreateBitmap(char *resource, wxResourceTable *table = (wxResourceTable *) NULL); extern wxBitmap WXDLLEXPORT wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
extern wxIcon* WXDLLEXPORT wxResourceCreateIcon(char *resource, wxResourceTable *table = (wxResourceTable *) NULL); extern wxIcon WXDLLEXPORT wxResourceCreateIcon(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
extern wxMenuBar* WXDLLEXPORT wxResourceCreateMenuBar(char *resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL); extern wxMenuBar* WXDLLEXPORT wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL);
extern wxMenu* WXDLLEXPORT wxResourceCreateMenu(char *resource, wxResourceTable *table = (wxResourceTable *) NULL); extern wxMenu* WXDLLEXPORT wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
extern bool WXDLLEXPORT wxResourceParseData(char *resource, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
extern bool WXDLLEXPORT wxResourceParseFile(char *filename, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL);
extern bool WXDLLEXPORT wxResourceParseString(char *s, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceParseString(const wxString& s, wxResourceTable *table = (wxResourceTable *) NULL);
extern void WXDLLEXPORT wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL); extern void WXDLLEXPORT wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL);
// Register XBM/XPM data // Register XBM/XPM data
extern bool WXDLLEXPORT wxResourceRegisterBitmapData(char *name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL);
extern bool WXDLLEXPORT wxResourceRegisterBitmapData(char *name, char **data, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table = (wxResourceTable *) NULL);
#define wxResourceRegisterIconData wxResourceRegisterBitmapData #define wxResourceRegisterIconData wxResourceRegisterBitmapData
/* /*
* Resource identifer code: #define storage * Resource identifer code: #define storage
*/ */
extern bool WXDLLEXPORT wxResourceAddIdentifier(char *name, int value, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table = (wxResourceTable *) NULL);
extern int WXDLLEXPORT wxResourceGetIdentifier(char *name, wxResourceTable *table = (wxResourceTable *) NULL); extern int WXDLLEXPORT wxResourceGetIdentifier(const wxString& name, wxResourceTable *table = (wxResourceTable *) NULL);
#endif #endif
#endif #endif

View File

@@ -318,15 +318,6 @@ public:
inline virtual void SetForegroundColour(const wxColour& col); inline virtual void SetForegroundColour(const wxColour& col);
inline virtual wxColour GetForegroundColour() const; inline virtual wxColour GetForegroundColour() const;
// Set/get window default background colour (for children to inherit).
// NOTE: these may be removed in later revisions.
inline virtual void SetDefaultBackgroundColour(const wxColour& col);
inline virtual wxColour GetDefaultBackgroundColour(void) const;
// Set/get window default foreground colour (for children to inherit)
inline virtual void SetDefaultForegroundColour(const wxColour& col);
inline virtual wxColour GetDefaultForegroundColour(void) const;
// Get the default button, if there is one // Get the default button, if there is one
inline virtual wxButton *GetDefaultItem() const; inline virtual wxButton *GetDefaultItem() const;
inline virtual void SetDefaultItem(wxButton *but); inline virtual void SetDefaultItem(wxButton *but);
@@ -338,7 +329,8 @@ public:
// Resource loading // Resource loading
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES
virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL); virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL); virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL);
#endif #endif
virtual void GetTextExtent(const wxString& string, int *x, int *y, virtual void GetTextExtent(const wxString& string, int *x, int *y,
@@ -436,6 +428,14 @@ public:
virtual void GetClientSizeConstraint(int *w, int *h) const ; virtual void GetClientSizeConstraint(int *w, int *h) const ;
virtual void GetPositionConstraint(int *x, int *y) const ; virtual void GetPositionConstraint(int *x, int *y) const ;
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
inline wxSize ConvertPixelsToDialog(const wxSize& sz)
{ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
inline wxSize ConvertDialogToPixels(const wxSize& sz)
{ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
wxObject *GetChild(int number) const ; wxObject *GetChild(int number) const ;
// Generates a new id for controls // Generates a new id for controls
@@ -482,8 +482,6 @@ protected:
wxColour m_backgroundColour ; wxColour m_backgroundColour ;
wxColour m_foregroundColour ; wxColour m_foregroundColour ;
wxColour m_defaultBackgroundColour;
wxColour m_defaultForegroundColour;
wxAcceleratorTable m_acceleratorTable; wxAcceleratorTable m_acceleratorTable;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
@@ -522,10 +520,6 @@ inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundCol
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; }; inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; }; inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; }; inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
inline void wxWindow::SetDefaultForegroundColour(const wxColour& col) { m_defaultForegroundColour = col; };
inline wxColour wxWindow::GetDefaultForegroundColour(void) const { return m_defaultForegroundColour; };
inline void wxWindow::SetDefaultBackgroundColour(const wxColour& col) { m_defaultBackgroundColour = col; };
inline wxColour wxWindow::GetDefaultBackgroundColour(void) const { return m_defaultBackgroundColour; };
inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; } inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }
inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; } inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }

View File

@@ -91,10 +91,11 @@ bool WXDLLEXPORT StringMatch(char *one, char *two, bool subString = TRUE, bool e
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0)) #define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
// Convert 2-digit hex number to decimal // Convert 2-digit hex number to decimal
int WXDLLEXPORT wxHexToDec(char *buf); int WXDLLEXPORT wxHexToDec(const wxString& buf);
// Convert decimal integer to 2-character hex string // Convert decimal integer to 2-character hex string
void WXDLLEXPORT wxDecToHex(int dec, char *buf); void WXDLLEXPORT wxDecToHex(int dec, char *buf);
wxString WXDLLEXPORT wxDecToHex(int dec);
// Execute another program. Returns 0 if there was an error, a PID otherwise. // Execute another program. Returns 0 if there was an error, a PID otherwise.
long WXDLLEXPORT wxExecute(char **argv, bool sync = FALSE, long WXDLLEXPORT wxExecute(char **argv, bool sync = FALSE,

File diff suppressed because it is too large Load Diff

View File

@@ -55,7 +55,6 @@ bool wxToolBarSimple::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos
// Set it to grey (or other 3D face colour) // Set it to grey (or other 3D face colour)
wxSystemSettings settings; wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_3DFACE));
SetDefaultBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_3DFACE));
if ( GetWindowStyleFlag() & wxTB_VERTICAL ) if ( GetWindowStyleFlag() & wxTB_VERTICAL )
{ m_lastX = 7; m_lastY = 3; } { m_lastX = 7; m_lastY = 3; }

View File

@@ -240,19 +240,19 @@ static char hexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A'
'C', 'D', 'E', 'F' }; 'C', 'D', 'E', 'F' };
// Convert 2-digit hex number to decimal // Convert 2-digit hex number to decimal
int wxHexToDec(char *buf) int wxHexToDec(const wxString& buf)
{ {
int firstDigit, secondDigit; int firstDigit, secondDigit;
if (buf[0] >= 'A') if (buf.GetChar(0) >= 'A')
firstDigit = buf[0] - 'A' + 10; firstDigit = buf.GetChar(0) - 'A' + 10;
else else
firstDigit = buf[0] - '0'; firstDigit = buf.GetChar(0) - '0';
if (buf[1] >= 'A') if (buf.GetChar(1) >= 'A')
secondDigit = buf[1] - 'A' + 10; secondDigit = buf.GetChar(1) - 'A' + 10;
else else
secondDigit = buf[1] - '0'; secondDigit = buf.GetChar(1) - '0';
return firstDigit * 16 + secondDigit; return firstDigit * 16 + secondDigit;
} }
@@ -267,6 +267,14 @@ void wxDecToHex(int dec, char *buf)
buf[2] = 0; buf[2] = 0;
} }
// Convert decimal integer to 2-character hex string
wxString wxDecToHex(int dec)
{
char buf[3];
wxDecToHex(dec, buf);
return wxString(buf);
}
// Match a string INDEPENDENT OF CASE // Match a string INDEPENDENT OF CASE
bool bool
StringMatch (char *str1, char *str2, bool subString, bool exact) StringMatch (char *str1, char *str2, bool subString, bool exact)

View File

@@ -64,3 +64,27 @@ void wxWindow::UpdateWindowUI()
} }
} }
} }
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint wxWindow::ConvertPixelsToDialog(const wxPoint& pt)
{
int charWidth = GetCharWidth();
int charHeight = GetCharHeight();
wxPoint pt2;
pt2.x = (int) ((pt.x * 4) / charWidth) ;
pt2.y = (int) ((pt.y * 8) / charHeight) ;
return pt2;
}
wxPoint wxWindow::ConvertDialogToPixels(const wxPoint& pt)
{
int charWidth = GetCharWidth();
int charHeight = GetCharHeight();
wxPoint pt2;
pt2.x = (int) ((pt.x * charWidth) / 4) ;
pt2.y = (int) ((pt.y * charHeight) / 8) ;
return pt2;
}

View File

@@ -50,7 +50,6 @@ bool wxPanel::Create(wxWindow *parent, wxWindowID id,
if ( ret ) { if ( ret ) {
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
} }
@@ -73,7 +72,6 @@ void wxPanel::SetFocus()
void wxPanel::OnSysColourChanged(wxSysColourChangedEvent& event) void wxPanel::OnSysColourChanged(wxSysColourChangedEvent& event)
{ {
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
Refresh(); Refresh();
// Propagate the event to the non-top-level children // Propagate the event to the non-top-level children

View File

@@ -127,7 +127,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
wxSystemSettings settings; wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(parent->GetDefaultForegroundColour()); SetForegroundColour(parent->GetForegroundColour());
SetName(name); SetName(name);
SetValidator(validator); SetValidator(validator);

View File

@@ -127,7 +127,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
wxSystemSettings settings; wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(parent->GetDefaultForegroundColour()); SetForegroundColour(parent->GetForegroundColour());
SetName(name); SetName(name);
SetValidator(validator); SetValidator(validator);

View File

@@ -99,10 +99,9 @@ wxWindow::wxWindow()
m_caretWidth = 0; m_caretHeight = 0; m_caretWidth = 0; m_caretHeight = 0;
m_caretEnabled = FALSE; m_caretEnabled = FALSE;
m_caretShown = FALSE; m_caretShown = FALSE;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; // m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL; m_pDropTarget = NULL;
@@ -320,10 +319,10 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
else else
m_windowId = id; m_windowId = id;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; // m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_defaultForegroundColour = *wxBLACK ; m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_windowStyle = style; m_windowStyle = style;

View File

@@ -44,8 +44,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
parent->AddChild(this); parent->AddChild(this);
m_backgroundColour = parent->GetDefaultBackgroundColour() ; m_backgroundColour = parent->GetBackgroundColour() ;
m_foregroundColour = parent->GetDefaultForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = style; m_windowStyle = style;
m_marginX = 0; m_marginX = 0;
m_marginY = 0; m_marginY = 0;

View File

@@ -56,8 +56,8 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
SetValidator(validator); SetValidator(validator);
parent->AddChild((wxButton *)this); parent->AddChild((wxButton *)this);
m_backgroundColour = parent->GetDefaultBackgroundColour() ; m_backgroundColour = parent->GetBackgroundColour() ;
m_foregroundColour = parent->GetDefaultForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = (long&)style; m_windowStyle = (long&)style;

View File

@@ -51,8 +51,8 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
SetValidator(validator); SetValidator(validator);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style; m_windowStyle = style;
@@ -221,8 +221,8 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l
SetValidator(validator); SetValidator(validator);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style; m_windowStyle = style;
if ( id == -1 ) if ( id == -1 )

View File

@@ -56,8 +56,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
SetName(name); SetName(name);
SetValidator(validator); SetValidator(validator);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_noStrings = n; m_noStrings = n;
m_windowStyle = style; m_windowStyle = style;

View File

@@ -70,8 +70,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SetName(name); SetName(name);
SetValidator(validator); SetValidator(validator);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_noStrings = n; m_noStrings = n;
m_windowStyle = style; m_windowStyle = style;

View File

@@ -78,7 +78,6 @@ wxDialog::wxDialog(void)
m_modalShowing = FALSE; m_modalShowing = FALSE;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
} }
bool wxDialog::Create(wxWindow *parent, wxWindowID id, bool wxDialog::Create(wxWindow *parent, wxWindowID id,
@@ -89,7 +88,6 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
const wxString& name) const wxString& name)
{ {
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetName(name); SetName(name);
if (!parent) if (!parent)
@@ -592,7 +590,6 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
Ctl3dColorChange(); Ctl3dColorChange();
#else #else
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
Refresh(); Refresh();
#endif #endif
} }

View File

@@ -52,8 +52,8 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
m_rangeMax = range; m_rangeMax = range;
m_gaugePos = 0; m_gaugePos = 0;
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style; m_windowStyle = style;

View File

@@ -87,8 +87,8 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
m_rangeMax = range; m_rangeMax = range;
m_gaugePos = 0; m_gaugePos = 0;
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style; m_windowStyle = style;

View File

@@ -160,7 +160,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
wxSystemSettings settings; wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(parent->GetDefaultForegroundColour()); SetForegroundColour(parent->GetForegroundColour());
m_windowId = ( id == -1 ) ? (int)NewControlId() : id; m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
@@ -266,7 +266,7 @@ wxListBox::~wxListBox(void)
void wxListBox::SetupColours(void) void wxListBox::SetupColours(void)
{ {
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(GetParent()->GetDefaultForegroundColour()); SetForegroundColour(GetParent()->GetForegroundColour());
} }
void wxListBox::SetFirstItem(int N) void wxListBox::SetFirstItem(int N)

View File

@@ -126,7 +126,7 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
wxSystemSettings settings; wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(parent->GetDefaultForegroundColour()); SetForegroundColour(parent->GetForegroundColour());
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);

View File

@@ -130,9 +130,6 @@ bool wxNotebook::Create(wxWindow *parent,
m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE)); m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
m_foregroundColour = *wxBLACK ; m_foregroundColour = *wxBLACK ;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
// style // style
m_windowStyle = style | wxTAB_TRAVERSAL; m_windowStyle = style | wxTAB_TRAVERSAL;

View File

@@ -98,8 +98,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
SetValidator(val); SetValidator(val);
parent->AddChild(this); parent->AddChild(this);
m_backgroundColour = parent->GetDefaultBackgroundColour() ; m_backgroundColour = parent->GetBackgroundColour() ;
m_foregroundColour = parent->GetDefaultForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = (long&)style; m_windowStyle = (long&)style;
@@ -207,8 +207,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
SetValidator(val); SetValidator(val);
parent->AddChild(this); parent->AddChild(this);
m_backgroundColour = parent->GetDefaultBackgroundColour() ; m_backgroundColour = parent->GetBackgroundColour() ;
m_foregroundColour = parent->GetDefaultForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = (long&)style; m_windowStyle = (long&)style;

View File

@@ -45,8 +45,8 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()); SetBackgroundColour(parent->GetBackgroundColour());
SetForegroundColour(parent->GetDefaultForegroundColour()); SetForegroundColour(parent->GetForegroundColour());
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();
@@ -187,8 +187,8 @@ bool wxBitmapRadioButton::Create(wxWindow *parent, wxWindowID id,
SetValidator(validator); SetValidator(validator);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()); SetBackgroundColour(parent->GetBackgroundColour());
SetForegroundColour(parent->GetDefaultForegroundColour()); SetForegroundColour(parent->GetForegroundColour());
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();

View File

@@ -55,8 +55,8 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
SetName(name); SetName(name);
SetValidator(validator); SetValidator(validator);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style; m_windowStyle = style;
if ( id == -1 ) if ( id == -1 )

View File

@@ -68,8 +68,8 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
SetValidator(validator); SetValidator(validator);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_staticValue = 0; m_staticValue = 0;
m_staticMin = 0; m_staticMin = 0;

View File

@@ -62,8 +62,8 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
SetValidator(validator); SetValidator(validator);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
m_staticValue = 0; m_staticValue = 0;
m_staticMin = 0; m_staticMin = 0;

View File

@@ -47,8 +47,8 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
long style, const wxString& name) long style, const wxString& name)
{ {
wxSystemSettings settings; wxSystemSettings settings;
m_backgroundColour = parent->GetDefaultBackgroundColour() ; m_backgroundColour = parent->GetBackgroundColour() ;
m_foregroundColour = parent->GetDefaultForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
SetName(name); SetName(name);

View File

@@ -46,8 +46,8 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
SetName(name); SetName(name);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
m_backgroundColour = parent->GetDefaultBackgroundColour() ; m_backgroundColour = parent->GetBackgroundColour() ;
m_foregroundColour = parent->GetDefaultForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();

View File

@@ -52,8 +52,8 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();

View File

@@ -42,8 +42,8 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
SetName(name); SetName(name);
if (parent) parent->AddChild(this); if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();

View File

@@ -72,10 +72,6 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
m_foregroundColour = *wxBLACK ; m_foregroundColour = *wxBLACK ;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
SetName(name); SetName(name);
int x = pos.x; int x = pos.x;
@@ -196,8 +192,6 @@ void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event)
{ {
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
// Remap the buttons // Remap the buttons
// CreateTools(); // CreateTools();

View File

@@ -100,10 +100,6 @@ bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, co
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
m_foregroundColour = *wxBLACK ; m_foregroundColour = *wxBLACK ;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
if (style & wxTB_VERTICAL) if (style & wxTB_VERTICAL)
wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports horizontal orientation.", "wxToolBar95 usage", wxOK); wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports horizontal orientation.", "wxToolBar95 usage", wxOK);
m_maxWidth = -1; m_maxWidth = -1;
@@ -475,8 +471,6 @@ void wxToolBar95::OnSysColourChanged(wxSysColourChangedEvent& event)
{ {
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
// Remap the buttons // Remap the buttons
CreateTools(); CreateTools();

View File

@@ -95,7 +95,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(parent->GetDefaultForegroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ;
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();
@@ -254,7 +254,7 @@ void wxTextCtrl::AdoptAttributesFromHWND(void)
void wxTextCtrl::SetupColours(void) void wxTextCtrl::SetupColours(void)
{ {
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(GetParent()->GetDefaultForegroundColour()); SetForegroundColour(GetParent()->GetForegroundColour());
} }
wxString wxTextCtrl::GetValue(void) const wxString wxTextCtrl::GetValue(void) const

View File

@@ -61,7 +61,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
{ {
wxSystemSettings settings; wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(parent->GetDefaultForegroundColour()); SetForegroundColour(parent->GetForegroundColour());
SetName(name); SetName(name);
SetValidator(validator); SetValidator(validator);

View File

@@ -238,10 +238,9 @@ wxWindow::wxWindow(void)
wxSystemSettings settings; wxSystemSettings settings;
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
// m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
/* /*
wxColour(GetRValue(GetSysColor(COLOR_WINDOW)), wxColour(GetRValue(GetSysColor(COLOR_WINDOW)),
@@ -437,9 +436,8 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
wxSystemSettings settings; wxSystemSettings settings;
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
// m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_windowStyle = style; m_windowStyle = style;

View File

@@ -75,10 +75,9 @@ wxWindow::wxWindow()
m_caretWidth = 0; m_caretHeight = 0; m_caretWidth = 0; m_caretHeight = 0;
m_caretEnabled = FALSE; m_caretEnabled = FALSE;
m_caretShown = FALSE; m_caretShown = FALSE;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
// m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL; m_pDropTarget = NULL;
@@ -185,10 +184,9 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
else else
m_windowId = id; m_windowId = id;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; // m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_windowStyle = style; m_windowStyle = style;

View File

@@ -46,6 +46,7 @@ IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler)
BEGIN_EVENT_TABLE(wxResourceEditorDialogHandler, wxEvtHandler) BEGIN_EVENT_TABLE(wxResourceEditorDialogHandler, wxEvtHandler)
EVT_PAINT(wxResourceEditorDialogHandler::OnPaint) EVT_PAINT(wxResourceEditorDialogHandler::OnPaint)
EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent) EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent)
EVT_SIZE(wxResourceEditorDialogHandler::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxResourceEditorControlHandler, wxEvtHandler) BEGIN_EVENT_TABLE(wxResourceEditorControlHandler, wxEvtHandler)
@@ -292,6 +293,23 @@ void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int
handlerDialog->PopupMenu(menu, x, y); handlerDialog->PopupMenu(menu, x, y);
} }
// Under Windows 95, you can resize a panel interactively depending on
// window styles.
void wxResourceEditorDialogHandler::OnSize(wxSizeEvent& event)
{
// Update the associated resource
int w, h;
handlerDialog->GetClientSize(& w, & h);
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerDialog);
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxSize sz = handlerDialog->ConvertPixelsToDialog(wxSize(w, h));
w = sz.x; h = sz.y;
}
resource->SetSize(resource->GetX(), resource->GetY(), w, h);
}
// An event outside any items: may be a drag event. // An event outside any items: may be a drag event.
void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event) void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event)
{ {
@@ -354,6 +372,15 @@ void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event)
OnRightClick(x, y, keys); OnRightClick(x, y, keys);
} }
else if (event.LeftDClick())
{
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog);
}
} }
else else
event.Skip(); event.Skip();
@@ -911,6 +938,9 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
handlerControl->GetPosition(&xpos, &ypos); handlerControl->GetPosition(&xpos, &ypos);
handlerControl->GetSize(&width, &height); handlerControl->GetSize(&width, &height);
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl);
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl->GetParent());
if (selectionHandle > 0) if (selectionHandle > 0)
{ {
int x1, y1, width1, height1; int x1, y1, width1, height1;
@@ -967,11 +997,33 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
break; break;
} }
handlerControl->SetSize(x1, y1, width1, height1); handlerControl->SetSize(x1, y1, width1, height1);
// Also update the associated resource
// We need to convert to dialog units if this is not a dialog or panel, but
// the parent resource specifies dialog units.
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxPoint pt = handlerControl->GetParent()->ConvertPixelsToDialog(wxPoint(x1, y1));
x1 = pt.x; y1 = pt.y;
wxSize sz = handlerControl->GetParent()->ConvertPixelsToDialog(wxSize(width1, height1));
width1 = sz.x; height1 = sz.y;
}
resource->SetSize(x1, y1, width1, height1);
} }
else else
{ {
handlerControl->Move((int)(x - dragOffsetX), (int)(y - dragOffsetY)); int newX = (int)(x - dragOffsetX);
OldOnMove((int)(x - dragOffsetX), (int)(y - dragOffsetY)); int newY = (int)(y - dragOffsetY);
handlerControl->Move(newX, newY);
OldOnMove(newX, newY);
// Also update the associated resource
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxPoint pt = handlerControl->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY));
newX = pt.x; newY = pt.y;
}
resource->SetSize(newX, newY, resource->GetWidth(), resource->GetHeight());
// Also move other selected items // Also move other selected items
wxNode *node = panel->GetChildren()->First(); wxNode *node = panel->GetChildren()->First();
@@ -991,6 +1043,16 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
item->Move(x2, y2); item->Move(x2, y2);
((wxResourceEditorControlHandler *)item->GetEventHandler())->OldOnMove(x2, y2); ((wxResourceEditorControlHandler *)item->GetEventHandler())->OldOnMove(x2, y2);
((wxResourceEditorControlHandler *)item->GetEventHandler())->DrawSelectionHandles(dc); ((wxResourceEditorControlHandler *)item->GetEventHandler())->DrawSelectionHandles(dc);
// Also update the associated resource
resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY));
x2 = pt.x; y2 = pt.y;
}
resource->SetSize(x2, y2, resource->GetWidth(), resource->GetHeight());
} }
} }
node = node->Next(); node = node->Next();

View File

@@ -50,6 +50,7 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void OnSize(wxSizeEvent& event);
virtual void OnItemEvent(wxControl *win, wxMouseEvent& event); virtual void OnItemEvent(wxControl *win, wxMouseEvent& event);
virtual void OnLeftClick(int x, int y, int keys); virtual void OnLeftClick(int x, int y, int keys);

View File

@@ -48,7 +48,7 @@ wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWin
{ {
} }
void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event) void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event))
{ {
#if 0 #if 0
long sel = GetSelection(); long sel = GetSelection();
@@ -70,7 +70,7 @@ void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event)
#endif #endif
} }
void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& event) void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{ {
long sel = GetSelection(); long sel = GetSelection();
if (sel == -1) if (sel == -1)

View File

@@ -515,7 +515,7 @@ bool wxResourceManager::DisassociateWindows()
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
DisassociateResource(res); DisassociateResource(res);
@@ -541,7 +541,7 @@ void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *wi
else else
{ {
char buf[200]; char buf[200];
sprintf(buf, "AssociateResource: cannot find child window %s", child->GetName() ? child->GetName() : "(unnamed)"); sprintf(buf, "AssociateResource: cannot find child window %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)");
wxMessageBox(buf, "Dialog Editor problem", wxOK); wxMessageBox(buf, "Dialog Editor problem", wxOK);
} }
@@ -644,7 +644,7 @@ wxItemResource *wxResourceManager::FindResourceForWindow(wxWindow *win)
{ {
m_resourceAssociations.BeginFind(); m_resourceAssociations.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceAssociations.Next()) while ((node = m_resourceAssociations.Next()))
{ {
wxWindow *w = (wxWindow *)node->Data(); wxWindow *w = (wxWindow *)node->Data();
if (w == win) if (w == win)
@@ -675,8 +675,10 @@ void wxResourceManager::MakeUniqueName(char *prefix, char *buf)
wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title) wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title)
{ {
/*
int frameWidth = 420; int frameWidth = 420;
int frameHeight = 300; int frameHeight = 300;
*/
wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title, wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title,
wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y), wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y),
@@ -849,7 +851,7 @@ void wxResourceManager::UpdateResourceList()
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType()); wxString resType(res->GetType());
@@ -956,6 +958,8 @@ bool wxResourceManager::CreateNewPanel()
resource->SetType("wxDialog"); resource->SetType("wxDialog");
resource->SetName(buf); resource->SetName(buf);
resource->SetTitle(buf); resource->SetTitle(buf);
resource->SetResourceStyle(wxRESOURCE_USE_DEFAULTS);
resource->SetResourceStyle(wxRESOURCE_DIALOG_UNITS);
wxString newIdName; wxString newIdName;
int id = GenerateWindowId("ID_DIALOG", newIdName); int id = GenerateWindowId("ID_DIALOG", newIdName);
@@ -966,13 +970,19 @@ bool wxResourceManager::CreateNewPanel()
m_resourceTable.AddResource(resource); m_resourceTable.AddResource(resource);
wxSize size(400, 300);
wxPanel *panel = new wxPanel(m_editorPanel, -1, wxPanel *panel = new wxPanel(m_editorPanel, -1,
wxPoint(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY()), wxPoint(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY()),
wxSize(400, 300), wxRAISED_BORDER|wxDEFAULT_DIALOG_STYLE, buf); size, wxRAISED_BORDER|wxDEFAULT_DIALOG_STYLE, buf);
m_editorPanel->m_childWindow = panel; m_editorPanel->m_childWindow = panel;
resource->SetStyle(panel->GetWindowStyleFlag()); resource->SetStyle(panel->GetWindowStyleFlag());
resource->SetSize(10, 10, 400, 300);
// Store dialog units in resource
size = panel->ConvertPixelsToDialog(size);
resource->SetSize(10, 10, size.x, size.y);
// For editing in situ we will need to use the hash table to ensure // For editing in situ we will need to use the hash table to ensure
// we don't dereference invalid pointers. // we don't dereference invalid pointers.
@@ -1006,7 +1016,14 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
wxItemResource *res = new wxItemResource; wxItemResource *res = new wxItemResource;
wxControl *newItem = NULL; wxControl *newItem = NULL;
res->SetSize(x, y, -1, -1);
if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
{
wxPoint pt = panel->ConvertPixelsToDialog(pt);
res->SetSize(pt.x, pt.y, -1, -1);
}
else res->SetSize(x, y, -1, -1);
res->SetType(iType); res->SetType(iType);
wxString prefix; wxString prefix;
@@ -1069,7 +1086,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
wxString names[] = { "One", "Two" }; wxString names[] = { "One", "Two" };
newItem = new wxRadioBox(panel, -1, "Radiobox", wxPoint(x, y), wxSize(-1, -1), 2, names, 2, newItem = new wxRadioBox(panel, -1, "Radiobox", wxPoint(x, y), wxSize(-1, -1), 2, names, 2,
wxHORIZONTAL, wxDefaultValidator, buf); wxHORIZONTAL, wxDefaultValidator, buf);
res->SetStringValues(new wxStringList("One", "Two", NULL)); res->SetStringValues(wxStringList("One", "Two", NULL));
} }
else if (itemType == "wxRadioButton") else if (itemType == "wxRadioButton")
{ {
@@ -1183,16 +1200,13 @@ bool wxResourceManager::TestCurrentDialog(wxWindow* parent)
InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE); InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE);
wxDialog* dialog = new wxDialog; wxDialog* dialog = new wxDialog;
long oldStyle = item->GetStyle();
bool success = FALSE; bool success = FALSE;
// item->SetStyle(wxDEFAULT_DIALOG_STYLE);
if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable)) if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable))
{ {
dialog->Centre(); dialog->Centre();
dialog->ShowModal(); dialog->ShowModal();
success = TRUE; success = TRUE;
} }
// item->SetStyle(oldStyle);
return success; return success;
} }
return FALSE; return FALSE;
@@ -1204,7 +1218,7 @@ wxWindow *wxResourceManager::FindParentOfSelection()
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
wxWindow *win = FindWindowForResource(res); wxWindow *win = FindWindowForResource(res);
@@ -1246,7 +1260,7 @@ void wxResourceManager::AlignItems(int flag)
int centreX = (int)(firstX + (firstW / 2)); int centreX = (int)(firstX + (firstW / 2));
int centreY = (int)(firstY + (firstH / 2)); int centreY = (int)(firstY + (firstH / 2));
while (node = node->Next()) while ((node = node->Next()))
{ {
wxControl *item = (wxControl *)node->Data(); wxControl *item = (wxControl *)node->Data();
if (item->GetParent() == win) if (item->GetParent() == win)
@@ -1325,10 +1339,8 @@ void wxResourceManager::CopySize()
int firstW, firstH; int firstW, firstH;
firstSelection->GetPosition(&firstX, &firstY); firstSelection->GetPosition(&firstX, &firstY);
firstSelection->GetSize(&firstW, &firstH); firstSelection->GetSize(&firstW, &firstH);
int centreX = (int)(firstX + (firstW / 2));
int centreY = (int)(firstY + (firstH / 2));
while (node = node->Next()) while ((node = node->Next()))
{ {
wxControl *item = (wxControl *)node->Data(); wxControl *item = (wxControl *)node->Data();
if (item->GetParent() == win) if (item->GetParent() == win)
@@ -1389,7 +1401,7 @@ bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res)
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *thisRes = (wxItemResource *)node->Data(); wxItemResource *thisRes = (wxItemResource *)node->Data();
if (thisRes->GetChildren().Member(res)) if (thisRes->GetChildren().Member(res))
@@ -1421,10 +1433,12 @@ bool wxResourceManager::DeleteResource(wxItemResource *res)
// associate bitmap resource if not being used. // associate bitmap resource if not being used.
wxString resType(res->GetType()); wxString resType(res->GetType());
/* shouldn't have to do this now bitmaps are ref-counted
if ((resType == "wxMessage" || resType == "wxStaticBitmap" || resType == "wxButton" || resType == "wxBitmapButton") && res->GetValue4()) if ((resType == "wxMessage" || resType == "wxStaticBitmap" || resType == "wxButton" || resType == "wxBitmapButton") && res->GetValue4())
{ {
PossiblyDeleteBitmapResource(res->GetValue4()); PossiblyDeleteBitmapResource(res->GetValue4());
} }
*/
// Remove symbol from table if appropriate // Remove symbol from table if appropriate
if (!IsSymbolUsed(res, res->GetId())) if (!IsSymbolUsed(res, res->GetId()))
@@ -1467,7 +1481,7 @@ bool wxResourceManager::DeleteResource(wxWindow *win)
// Will eventually have bitmap type information, for different // Will eventually have bitmap type information, for different
// kinds of bitmap. // kinds of bitmap.
char *wxResourceManager::AddBitmapResource(char *filename) wxString wxResourceManager::AddBitmapResource(const wxString& filename)
{ {
wxItemResource *resource = FindBitmapResourceByFilename(filename); wxItemResource *resource = FindBitmapResourceByFilename(filename);
if (!resource) if (!resource)
@@ -1496,11 +1510,11 @@ char *wxResourceManager::AddBitmapResource(char *filename)
if (resource) if (resource)
return resource->GetName(); return resource->GetName();
else else
return NULL; return wxEmptyString;
} }
// Delete the bitmap resource if it isn't being used by another resource. // Delete the bitmap resource if it isn't being used by another resource.
void wxResourceManager::PossiblyDeleteBitmapResource(char *resourceName) void wxResourceManager::PossiblyDeleteBitmapResource(const wxString& resourceName)
{ {
if (!IsBitmapResourceUsed(resourceName)) if (!IsBitmapResourceUsed(resourceName))
{ {
@@ -1510,11 +1524,11 @@ void wxResourceManager::PossiblyDeleteBitmapResource(char *resourceName)
} }
} }
bool wxResourceManager::IsBitmapResourceUsed(char *resourceName) bool wxResourceManager::IsBitmapResourceUsed(const wxString& resourceName)
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType()); wxString resType(res->GetType());
@@ -1538,13 +1552,13 @@ bool wxResourceManager::IsBitmapResourceUsed(char *resourceName)
} }
// Given a wxButton or wxMessage, find the corresponding bitmap filename. // Given a wxButton or wxMessage, find the corresponding bitmap filename.
char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource) wxString wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource)
{ {
if (!resource || !resource->GetValue4()) if (!resource || (resource->GetValue4() == ""))
return NULL; return wxEmptyString;
wxItemResource *bitmapResource = m_resourceTable.FindResource(resource->GetValue4()); wxItemResource *bitmapResource = m_resourceTable.FindResource(resource->GetValue4());
if (!bitmapResource) if (!bitmapResource)
return NULL; return wxEmptyString;
wxNode *node = bitmapResource->GetChildren().First(); wxNode *node = bitmapResource->GetChildren().First();
while (node) while (node)
@@ -1557,14 +1571,14 @@ char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource)
node = node->Next(); node = node->Next();
} }
return NULL; return wxEmptyString;
} }
wxItemResource *wxResourceManager::FindBitmapResourceByFilename(char *filename) wxItemResource *wxResourceManager::FindBitmapResourceByFilename(const wxString& filename)
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType()); wxString resType(res->GetType());
@@ -1591,7 +1605,7 @@ bool wxResourceManager::IsSymbolUsed(wxItemResource* thisResource, wxWindowID id
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
@@ -1634,7 +1648,7 @@ void wxResourceManager::ChangeIds(int oldId, int newId)
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
@@ -1666,7 +1680,7 @@ bool wxResourceManager::RepairResourceIds()
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType()); wxString resType(res->GetType());
@@ -1742,6 +1756,9 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
wxWindow *newWin = NULL; wxWindow *newWin = NULL;
wxWindow *parent = win->GetParent(); wxWindow *parent = win->GetParent();
wxItemResource* parentResource = NULL;
if (parent)
FindResourceForWindow(parent);
if (win->IsKindOf(CLASSINFO(wxPanel))) if (win->IsKindOf(CLASSINFO(wxPanel)))
{ {
@@ -1755,7 +1772,7 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
win->PopEventHandler(TRUE); win->PopEventHandler(TRUE);
DeleteWindow(win); DeleteWindow(win);
newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource); newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource, parentResource);
newWin->PushEventHandler(new wxResourceEditorControlHandler((wxControl*) newWin, (wxControl*) newWin)); newWin->PushEventHandler(new wxResourceEditorControlHandler((wxControl*) newWin, (wxControl*) newWin));
AssociateResource(resource, newWin); AssociateResource(resource, newWin);
UpdateResourceList(); UpdateResourceList();
@@ -1811,7 +1828,7 @@ bool wxResourceManager::RecreateSelection()
return TRUE; return TRUE;
} }
bool wxResourceManager::EditDialog(wxDialog *dialog, wxWindow *parent) bool wxResourceManager::EditDialog(wxDialog *WXUNUSED(dialog), wxWindow *WXUNUSED(parent))
{ {
return FALSE; return FALSE;
} }
@@ -1822,7 +1839,7 @@ bool wxResourceManager::InstantiateAllResourcesFromWindows()
{ {
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
while (node = m_resourceTable.Next()) while ((node = m_resourceTable.Next()))
{ {
wxItemResource *res = (wxItemResource *)node->Data(); wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType()); wxString resType(res->GetType());
@@ -1861,7 +1878,7 @@ bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource *resource,
if (!childWindow) if (!childWindow)
{ {
char buf[200]; char buf[200];
sprintf(buf, "Could not find window %s", child->GetName()); sprintf(buf, "Could not find window %s", (const char*) child->GetName());
wxMessageBox(buf, "Dialog Editor problem", wxOK); wxMessageBox(buf, "Dialog Editor problem", wxOK);
} }
else else
@@ -2231,7 +2248,7 @@ EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& s
{ {
} }
bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled) bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled))
{ {
wxResourceManager *manager = wxResourceManager::GetCurrentResourceManager(); wxResourceManager *manager = wxResourceManager::GetCurrentResourceManager();

View File

@@ -117,7 +117,7 @@ class wxResourceTableWithSaving: public wxResourceTable
m_styleTable.Init(); m_styleTable.Init();
} }
virtual bool Save(const wxString& filename); virtual bool Save(const wxString& filename);
virtual bool SaveResource(ostream& stream, wxItemResource *item); virtual bool SaveResource(ostream& stream, wxItemResource* item, wxItemResource* parentItem);
void GeneratePanelStyleString(long windowStyle, char *buf); void GeneratePanelStyleString(long windowStyle, char *buf);
void GenerateDialogStyleString(long windowStyle, char *buf); void GenerateDialogStyleString(long windowStyle, char *buf);
@@ -144,8 +144,8 @@ class wxResourceTableWithSaving: public wxResourceTable
bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle); bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle);
*/ */
void OutputFont(ostream& stream, wxFont *font); void OutputFont(ostream& stream, const wxFont& font);
wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource); wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource);
protected: protected:
wxWindowStyleTable m_styleTable; wxWindowStyleTable m_styleTable;
@@ -219,17 +219,17 @@ public:
virtual bool DeleteResource(wxWindow *win); virtual bool DeleteResource(wxWindow *win);
// Add bitmap resource if there isn't already one with this filename. // 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. // 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 // Helper function for above
virtual bool IsBitmapResourceUsed(char *resourceName); virtual bool IsBitmapResourceUsed(const wxString& resourceName);
wxItemResource *FindBitmapResourceByFilename(char *filename); wxItemResource *FindBitmapResourceByFilename(const wxString& filename);
char *FindBitmapFilenameForResource(wxItemResource *resource); wxString FindBitmapFilenameForResource(wxItemResource *resource);
// Is this window identifier in use? // Is this window identifier in use?
bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ; bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;

View File

@@ -43,27 +43,27 @@
#include "reseditr.h" #include "reseditr.h"
char *SafeString(char *s); char *SafeString(char *s);
char *SafeWord(char *s); char *SafeWord(const wxString& s);
// Save an association between the child resource and the panel item, to allow // Save an association between the child resource and the panel item, to allow
// us not to require unique window names. // us not to require unique window names.
wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, wxItemResource *childResource) wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource)
{ {
wxControl *item = wxResourceTable::CreateItem(panel, childResource); wxControl *item = wxResourceTable::CreateItem(panel, childResource, parentResource);
if (item) if (item)
wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item); wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item);
return item; return item;
} }
void wxResourceTableWithSaving::OutputFont(ostream& stream, wxFont *font) void wxResourceTableWithSaving::OutputFont(ostream& stream, const wxFont& font)
{ {
stream << "[" << font->GetPointSize() << ", '"; stream << "[" << font.GetPointSize() << ", '";
stream << font->GetFamilyString() << "', '"; stream << font.GetFamilyString() << "', '";
stream << font->GetStyleString() << "', '"; stream << font.GetStyleString() << "', '";
stream << font->GetWeightString() << "', "; stream << font.GetWeightString() << "', ";
stream << (int)font->GetUnderlined(); stream << (int)font.GetUnderlined();
if (font->GetFaceName() != "") if (font.GetFaceName() != "")
stream << ", '" << font->GetFaceName() << "'"; stream << ", '" << font.GetFaceName() << "'";
stream << "]"; stream << "]";
} }
@@ -79,21 +79,21 @@ bool wxResourceTableWithSaving::Save(const wxString& filename)
BeginFind(); BeginFind();
wxNode *node = NULL; wxNode *node = NULL;
while (node = Next()) while ((node = Next()))
{ {
wxItemResource *item = (wxItemResource *)node->Data(); wxItemResource *item = (wxItemResource *)node->Data();
wxString resType(item->GetType()); wxString resType(item->GetType());
if (resType == "wxDialogBox" || resType == "wxDialog" || resType == "wxPanel" || resType == "wxBitmap") if (resType == "wxDialogBox" || resType == "wxDialog" || resType == "wxPanel" || resType == "wxBitmap")
{ {
if (!SaveResource(stream, item)) if (!SaveResource(stream, item, (wxItemResource*) NULL))
return FALSE; return FALSE;
} }
} }
return TRUE; return TRUE;
} }
bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *item) bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource* item, wxItemResource* parentItem)
{ {
char styleBuf[400]; char styleBuf[400];
wxString itemType(item->GetType()); wxString itemType(item->GetType());
@@ -110,6 +110,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << "static char *" << item->GetName() << " = \"panel(name = '" << item->GetName() << "',\\\n"; stream << "static char *" << item->GetName() << " = \"panel(name = '" << item->GetName() << "',\\\n";
GenerateDialogStyleString(item->GetStyle(), styleBuf); GenerateDialogStyleString(item->GetStyle(), styleBuf);
} }
stream << " style = '" << styleBuf << "',\\\n"; stream << " style = '" << styleBuf << "',\\\n";
stream << " title = '" << item->GetTitle() << "',\\\n"; stream << " title = '" << item->GetTitle() << "',\\\n";
stream << " id = " << item->GetId() << ",\\\n"; stream << " id = " << item->GetId() << ",\\\n";
@@ -118,19 +119,29 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
if (1) // item->GetStyle() & wxNO_3D) if (1) // item->GetStyle() & wxNO_3D)
{ {
if (item->GetBackgroundColour()) if (item->GetBackgroundColour().Ok())
{ {
char buf[7]; char buf[7];
wxDecToHex(item->GetBackgroundColour()->Red(), buf); wxDecToHex(item->GetBackgroundColour().Red(), buf);
wxDecToHex(item->GetBackgroundColour()->Green(), buf+2); wxDecToHex(item->GetBackgroundColour().Green(), buf+2);
wxDecToHex(item->GetBackgroundColour()->Blue(), buf+4); wxDecToHex(item->GetBackgroundColour().Blue(), buf+4);
buf[6] = 0; buf[6] = 0;
stream << ",\\\n " << "background_colour = '" << buf << "'"; stream << ",\\\n " << "background_colour = '" << buf << "'";
} }
} }
if (item->GetFont() && item->GetFont()->Ok()) int dialogUnits = 0;
int useDefaults = 0;
if ((item->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
dialogUnits = 1;
if ((item->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
useDefaults = 1;
stream << ",\\\n " << "use_dialog_units = " << dialogUnits;
stream << ",\\\n " << "use_system_defaults = " << useDefaults;
if (item->GetFont().Ok())
{ {
stream << ",\\\n font = "; stream << ",\\\n font = ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -147,7 +158,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << " control = ["; stream << " control = [";
SaveResource(stream, child); SaveResource(stream, child, item);
stream << "]"; stream << "]";
@@ -165,7 +176,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
if (item->GetValue4()) if (item->GetValue4())
stream << ", '" << item->GetValue4() << "'"; stream << ", '" << item->GetValue4() << "'";
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -179,7 +190,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
if (item->GetValue4()) if (item->GetValue4())
stream << ", '" << item->GetValue4() << "'"; stream << ", '" << item->GetValue4() << "'";
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -192,7 +203,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1(); stream << ", " << item->GetValue1();
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -205,7 +216,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1(); stream << ", " << item->GetValue1();
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -217,7 +228,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << item->GetId() << ", " << "wxStaticBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << item->GetId() << ", " << "wxStaticBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -231,7 +242,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << SafeWord(item->GetValue4()); stream << ", " << SafeWord(item->GetValue4());
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -244,7 +255,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1() << ", " << item->GetValue2(); stream << ", " << item->GetValue1() << ", " << item->GetValue2();
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -257,7 +268,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3(); stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3();
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -282,9 +293,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
// Default list of values // Default list of values
stream << ", ["; stream << ", [";
if (item->GetStringValues()) if (item->GetStringValues().Number() > 0)
{ {
wxNode *node = item->GetStringValues()->First(); wxNode *node = item->GetStringValues().First();
while (node) while (node)
{ {
char *s = (char *)node->Data(); char *s = (char *)node->Data();
@@ -314,7 +325,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
break; break;
} }
} }
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -334,9 +345,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
// Default list of values // Default list of values
stream << ", ["; stream << ", [";
if (item->GetStringValues()) if (item->GetStringValues().Number() > 0)
{ {
wxNode *node = item->GetStringValues()->First(); wxNode *node = item->GetStringValues().First();
while (node) while (node)
{ {
char *s = (char *)node->Data(); char *s = (char *)node->Data();
@@ -347,7 +358,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
} }
} }
stream << "]"; stream << "]";
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -364,9 +375,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
// Default list of values // Default list of values
stream << ", ["; stream << ", [";
if (item->GetStringValues()) if (item->GetStringValues().Number() > 0)
{ {
wxNode *node = item->GetStringValues()->First(); wxNode *node = item->GetStringValues().First();
while (node) while (node)
{ {
char *s = (char *)node->Data(); char *s = (char *)node->Data();
@@ -377,7 +388,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
} }
} }
stream << "], " << item->GetValue1(); stream << "], " << item->GetValue1();
if (item->GetFont()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
@@ -552,9 +563,9 @@ void wxResourceTableWithSaving::GenerateControlStyleString(const wxString& windo
} }
// Returns quoted string or "NULL" // Returns quoted string or "NULL"
char *SafeString(char *s) char *SafeString(const wxString& s)
{ {
if (!s) if (s == "")
return "NULL"; return "NULL";
else else
{ {
@@ -566,14 +577,14 @@ char *SafeString(char *s)
} }
// Returns quoted string or '' // Returns quoted string or ''
char *SafeWord(char *s) char *SafeWord(const wxString& s)
{ {
if (!s) if (s == "")
return "''"; return "''";
else else
{ {
strcpy(wxBuffer, "'"); strcpy(wxBuffer, "'");
strcat(wxBuffer, s); strcat(wxBuffer, (const char*) s);
strcat(wxBuffer, "'"); strcat(wxBuffer, "'");
return wxBuffer; return wxBuffer;
} }

View File

@@ -70,7 +70,7 @@ bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
str.UngetWriteBuf(); str.UngetWriteBuf();
// Look for #define occurrences // Look for #define occurrences
size_t pos = str.Find("#define"); int pos = str.Find("#define");
while (pos != -1) while (pos != -1)
{ {
size_t len = str.Length(); size_t len = str.Length();

File diff suppressed because it is too large Load Diff

View File

@@ -40,15 +40,16 @@ private:
class wxResourcePropertyListView: public wxPropertyListView class wxResourcePropertyListView: public wxPropertyListView
{ {
public: public:
wxPropertyInfo *propertyInfo;
wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT): wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT):
wxPropertyListView(propPanel, flags) wxPropertyListView(propPanel, flags)
{ {
propertyInfo = info; m_propertyInfo = info;
} }
void OnPropertyChanged(wxProperty *property); void OnPropertyChanged(wxProperty *property);
bool OnClose(void); bool OnClose(void);
wxPropertyInfo* m_propertyInfo;
}; };
// Generic class for relating an object to a collection of properties. // Generic class for relating an object to a collection of properties.
@@ -76,9 +77,6 @@ class wxPropertyInfo: public wxObject
// For all windows // For all windows
class wxWindowPropertyInfo: public wxPropertyInfo class wxWindowPropertyInfo: public wxPropertyInfo
{ {
protected:
wxWindow *propertyWindow;
wxItemResource *propertyResource;
public: public:
wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL); wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
~wxWindowPropertyInfo(void); ~wxWindowPropertyInfo(void);
@@ -86,9 +84,9 @@ class wxWindowPropertyInfo: public wxPropertyInfo
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
inline void SetPropertyWindow(wxWindow *win) { propertyWindow = win; } inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; }
inline void SetResource(wxItemResource *res) { propertyResource = res; } inline void SetResource(wxItemResource *res) { m_propertyResource = res; }
// Helper functions for font properties // Helper functions for font properties
@@ -100,6 +98,10 @@ class wxWindowPropertyInfo: public wxPropertyInfo
// Set the window style // Set the window style
void SetWindowStyle(wxWindow* win, long style, bool set); void SetWindowStyle(wxWindow* win, long style, bool set);
protected:
wxWindow* m_propertyWindow;
wxItemResource* m_propertyResource;
}; };
// For panel items // For panel items
@@ -338,6 +340,9 @@ class wxPanelPropertyInfo: public wxWindowPropertyInfo
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
// Convert this dialog, and its children, to or from dialog units
void ConvertDialogUnits(bool toDialogUnits);
}; };
int wxStringToFontWeight(wxString& val); int wxStringToFontWeight(wxString& val);

File diff suppressed because it is too large Load Diff

View File

@@ -41,11 +41,6 @@ class wxPropertyValidatorRegistry;
class wxPropertySheet: public wxObject class wxPropertySheet: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxPropertySheet) DECLARE_DYNAMIC_CLASS(wxPropertySheet)
protected:
wxObject *viewedObject;
wxList properties;
wxPropertyView *propertyView;
public: public:
wxPropertySheet(void); wxPropertySheet(void);
~wxPropertySheet(void); ~wxPropertySheet(void);
@@ -63,10 +58,16 @@ class wxPropertySheet: public wxObject
virtual bool Load(ostream& str); virtual bool Load(ostream& str);
virtual void UpdateAllViews(wxPropertyView *thisView = NULL); virtual void UpdateAllViews(wxPropertyView *thisView = NULL);
inline virtual wxList& GetProperties(void) { return properties; } inline virtual wxList& GetProperties(void) const { return (wxList&) m_properties; }
// Sets/clears the modified flag for each property value // Sets/clears the modified flag for each property value
virtual void SetAllModified(bool flag = TRUE); virtual void SetAllModified(bool flag = TRUE);
protected:
wxObject* m_viewedObject;
wxList m_properties;
wxPropertyView* m_propertyView;
}; };
@@ -75,12 +76,6 @@ class wxPropertySheet: public wxObject
class wxPropertyView: public wxEvtHandler class wxPropertyView: public wxEvtHandler
{ {
DECLARE_DYNAMIC_CLASS(wxPropertyView) DECLARE_DYNAMIC_CLASS(wxPropertyView)
protected:
long buttonFlags;
wxPropertySheet *propertySheet;
wxProperty *currentProperty;
wxList validatorRegistryList;
wxPropertyValidator *currentValidator;
public: public:
wxPropertyView(long flags = 0); wxPropertyView(long flags = 0);
~wxPropertyView(void); ~wxPropertyView(void);
@@ -97,35 +92,39 @@ class wxPropertyView: public wxEvtHandler
virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {} virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {}
virtual void AddRegistry(wxPropertyValidatorRegistry *registry); virtual void AddRegistry(wxPropertyValidatorRegistry *registry);
inline virtual wxList& GetRegistryList(void) inline virtual wxList& GetRegistryList(void) const
{ return validatorRegistryList; } { return (wxList&) m_validatorRegistryList; }
virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property); virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property);
inline virtual void SetPropertySheet(wxPropertySheet *sheet) { propertySheet = sheet; } inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; }
inline virtual wxPropertySheet *GetPropertySheet(void) { return propertySheet; } inline virtual wxPropertySheet *GetPropertySheet(void) const { return m_propertySheet; }
virtual void OnOk(void) {}; virtual void OnOk(void) {};
virtual void OnCancel(void) {}; virtual void OnCancel(void) {};
virtual void OnHelp(void) {}; virtual void OnHelp(void) {};
inline virtual bool OnClose(void) { return FALSE; } inline virtual bool OnClose(void) { return FALSE; }
inline long GetFlags(void) { return buttonFlags; } inline long GetFlags(void) { return m_buttonFlags; }
protected:
long m_buttonFlags;
wxPropertySheet* m_propertySheet;
wxProperty* m_currentProperty;
wxList m_validatorRegistryList;
wxPropertyValidator* m_currentValidator;
}; };
class wxPropertyValidator: public wxEvtHandler class wxPropertyValidator: public wxEvtHandler
{ {
DECLARE_DYNAMIC_CLASS(wxPropertyValidator) DECLARE_DYNAMIC_CLASS(wxPropertyValidator)
protected:
long validatorFlags;
wxProperty *validatorProperty;
public: public:
wxPropertyValidator(long flags = 0); wxPropertyValidator(long flags = 0);
~wxPropertyValidator(void); ~wxPropertyValidator(void);
inline long GetFlags(void) { return validatorFlags; } inline long GetFlags(void) const { return m_validatorFlags; }
inline void SetValidatorProperty(wxProperty *prop) { validatorProperty = prop; } inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; }
inline wxProperty *GetValidatorProperty(void) { return validatorProperty; } inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; }
virtual bool StringToFloat (char *s, float *number); virtual bool StringToFloat (char *s, float *number);
virtual bool StringToDouble (char *s, double *number); virtual bool StringToDouble (char *s, double *number);
@@ -135,6 +134,10 @@ class wxPropertyValidator: public wxEvtHandler
virtual char *DoubleToString (double number); virtual char *DoubleToString (double number);
virtual char *IntToString (int number); virtual char *IntToString (int number);
virtual char *LongToString (long number); virtual char *LongToString (long number);
protected:
long m_validatorFlags;
wxProperty* m_validatorProperty;
}; };
@@ -172,24 +175,6 @@ typedef enum {
class wxPropertyValue: public wxObject class wxPropertyValue: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxPropertyValue) DECLARE_DYNAMIC_CLASS(wxPropertyValue)
public:
wxObject *client_data;
wxPropertyValueType type;
bool modifiedFlag;
union {
long integer; // Also doubles as bool
char *string;
float real;
long *integerPtr;
bool *boolPtr;
char **stringPtr;
float *realPtr;
wxPropertyValue *first; // If is a list expr, points to the first node
} value;
wxPropertyValue *next; // If this is a node in a list, points to the next node
wxPropertyValue *last; // If is a list expr, points to the last node
wxPropertyValue(void); // Unknown type wxPropertyValue(void); // Unknown type
wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor
@@ -209,26 +194,26 @@ class wxPropertyValue: public wxObject
~wxPropertyValue(void); ~wxPropertyValue(void);
virtual inline wxPropertyValueType Type(void) { return type; } virtual inline wxPropertyValueType Type(void) const { return m_type; }
virtual inline void SetType(wxPropertyValueType typ) { type = typ; } virtual inline void SetType(wxPropertyValueType typ) { m_type = typ; }
virtual long IntegerValue(void); virtual long IntegerValue(void) const;
virtual float RealValue(void); virtual float RealValue(void) const;
virtual bool BoolValue(void); virtual bool BoolValue(void) const;
virtual char *StringValue(void); virtual char *StringValue(void) const;
virtual long *IntegerValuePtr(void); virtual long *IntegerValuePtr(void) const;
virtual float *RealValuePtr(void); virtual float *RealValuePtr(void) const;
virtual bool *BoolValuePtr(void); virtual bool *BoolValuePtr(void) const;
virtual char **StringValuePtr(void); virtual char **StringValuePtr(void) const;
// Get nth arg of clause (starting from 1) // Get nth arg of clause (starting from 1)
virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg); virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg) const;
// Return nth argument of a list expression (starting from zero) // Return nth argument of a list expression (starting from zero)
virtual wxPropertyValue *Nth(int arg); virtual wxPropertyValue *Nth(int arg) const;
// Returns the number of elements in a list expression // Returns the number of elements in a list expression
virtual int Number(void); virtual int Number(void) const;
virtual wxPropertyValue *NewCopy(void); virtual wxPropertyValue *NewCopy(void) const;
virtual void Copy(wxPropertyValue& copyFrom); virtual void Copy(wxPropertyValue& copyFrom);
virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause
@@ -240,16 +225,16 @@ class wxPropertyValue: public wxObject
virtual void Insert(wxPropertyValue *expr); virtual void Insert(wxPropertyValue *expr);
// Get first expr in list // Get first expr in list
virtual inline wxPropertyValue *GetFirst(void) virtual inline wxPropertyValue *GetFirst(void) const
{ return ((type == wxPropertyValueList) ? value.first : (wxPropertyValue*)NULL); } { return ((m_type == wxPropertyValueList) ? m_value.first : (wxPropertyValue*)NULL); }
// Get next expr if this is a node in a list // Get next expr if this is a node in a list
virtual inline wxPropertyValue *GetNext(void) virtual inline wxPropertyValue *GetNext(void) const
{ return next; } { return m_next; }
// Get last expr in list // Get last expr in list
virtual inline wxPropertyValue *GetLast(void) virtual inline wxPropertyValue *GetLast(void) const
{ return ((type == wxPropertyValueList) ? last : (wxPropertyValue*)NULL); } { return ((m_type == wxPropertyValueList) ? m_last : (wxPropertyValue*)NULL); }
// Delete this node from the list // Delete this node from the list
virtual void Delete(wxPropertyValue *node); virtual void Delete(wxPropertyValue *node);
@@ -257,13 +242,13 @@ class wxPropertyValue: public wxObject
// Clear list // Clear list
virtual void ClearList(void); virtual void ClearList(void);
virtual inline void SetClientData(wxObject *data) { client_data = data; } virtual inline void SetClientData(wxObject *data) { m_clientData = data; }
virtual inline wxObject *GetClientData(void) { return client_data; } virtual inline wxObject *GetClientData(void) { return m_clientData; }
virtual wxString GetStringRepresentation(void); virtual wxString GetStringRepresentation(void);
inline void SetModified(bool flag = TRUE) { modifiedFlag = flag; } inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; }
inline bool GetModified(void) { return modifiedFlag; } inline bool GetModified(void) { return m_modifiedFlag; }
// Operators // Operators
void operator=(const wxPropertyValue& val); void operator=(const wxPropertyValue& val);
@@ -276,6 +261,26 @@ class wxPropertyValue: public wxObject
void operator=(const long *val); void operator=(const long *val);
void operator=(const bool *val); void operator=(const bool *val);
void operator=(const float *val); void operator=(const float *val);
public:
wxObject* m_clientData;
wxPropertyValueType m_type;
bool m_modifiedFlag;
union {
long integer; // Also doubles as bool
char *string;
float real;
long *integerPtr;
bool *boolPtr;
char **stringPtr;
float *realPtr;
wxPropertyValue *first; // If is a list expr, points to the first node
} m_value;
wxPropertyValue* m_next; // If this is a node in a list, points to the next node
wxPropertyValue* m_last; // If is a list expr, points to the last node
}; };
/* /*
@@ -286,13 +291,13 @@ class wxProperty: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxProperty) DECLARE_DYNAMIC_CLASS(wxProperty)
protected: protected:
bool enabled; bool m_enabled;
public: public:
wxPropertyValue value; wxPropertyValue m_value;
wxString name; wxString m_name;
wxString propertyRole; wxString m_propertyRole;
wxPropertyValidator *propertyValidator; wxPropertyValidator* m_propertyValidator;
wxWindow *propertyWindow; // Usually a panel item, if anything wxWindow* m_propertyWindow; // Usually a panel item, if anything
wxProperty(void); wxProperty(void);
wxProperty(wxProperty& copyFrom); wxProperty(wxProperty& copyFrom);
@@ -300,20 +305,20 @@ class wxProperty: public wxObject
wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL); wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL);
~wxProperty(void); ~wxProperty(void);
virtual wxPropertyValue& GetValue(void); virtual wxPropertyValue& GetValue(void) const;
virtual wxPropertyValidator *GetValidator(void); virtual wxPropertyValidator *GetValidator(void) const;
virtual wxString& GetName(void); virtual wxString& GetName(void) const;
virtual wxString& GetRole(void); virtual wxString& GetRole(void) const;
virtual void SetValue(const wxPropertyValue& val); virtual void SetValue(const wxPropertyValue& val);
virtual void SetValidator(wxPropertyValidator *v); virtual void SetValidator(wxPropertyValidator *v);
virtual void SetName(wxString& nm); virtual void SetName(wxString& nm);
virtual void SetRole(wxString& role); virtual void SetRole(wxString& role);
void operator=(const wxPropertyValue& val); void operator=(const wxPropertyValue& val);
virtual inline void SetWindow(wxWindow *win) { propertyWindow = win; } virtual inline void SetWindow(wxWindow *win) { m_propertyWindow = win; }
virtual inline wxWindow *GetWindow(void) { return propertyWindow; } virtual inline wxWindow *GetWindow(void) const { return m_propertyWindow; }
inline void Enable(bool en) { enabled = en; } inline void Enable(bool en) { m_enabled = en; }
inline bool IsEnabled(void) { return enabled; } inline bool IsEnabled(void) const { return m_enabled; }
}; };
#endif #endif

View File

@@ -54,18 +54,18 @@ BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView)
EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate) EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
END_EVENT_TABLE() END_EVENT_TABLE()
bool wxPropertyFormView::dialogCancelled = FALSE; bool wxPropertyFormView::sm_dialogCancelled = FALSE;
wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags) wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags)
{ {
propertyWindow = propPanel; m_propertyWindow = propPanel;
managedWindow = NULL; m_managedWindow = NULL;
windowCloseButton = NULL; m_windowCloseButton = NULL;
windowCancelButton = NULL; m_windowCancelButton = NULL;
windowHelpButton = NULL; m_windowHelpButton = NULL;
detailedEditing = FALSE; m_detailedEditing = FALSE;
} }
wxPropertyFormView::~wxPropertyFormView(void) wxPropertyFormView::~wxPropertyFormView(void)
@@ -74,7 +74,7 @@ wxPropertyFormView::~wxPropertyFormView(void)
void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel) void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
{ {
propertySheet = ps; m_propertySheet = ps;
AssociatePanel(panel); AssociatePanel(panel);
// CreateControls(); // CreateControls();
@@ -90,10 +90,10 @@ bool wxPropertyFormView::OnUpdateView(void)
bool wxPropertyFormView::Check(void) bool wxPropertyFormView::Check(void)
{ {
if (!propertySheet) if (!m_propertySheet)
return FALSE; return FALSE;
wxNode *node = propertySheet->GetProperties().First(); wxNode *node = m_propertySheet->GetProperties().First();
while (node) while (node)
{ {
wxProperty *prop = (wxProperty *)node->Data(); wxProperty *prop = (wxProperty *)node->Data();
@@ -101,7 +101,7 @@ bool wxPropertyFormView::Check(void)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{ {
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
if (!formValidator->OnCheckValue(prop, this, propertyWindow)) if (!formValidator->OnCheckValue(prop, this, m_propertyWindow))
return FALSE; return FALSE;
} }
node = node->Next(); node = node->Next();
@@ -111,10 +111,10 @@ bool wxPropertyFormView::Check(void)
bool wxPropertyFormView::TransferToPropertySheet(void) bool wxPropertyFormView::TransferToPropertySheet(void)
{ {
if (!propertySheet) if (!m_propertySheet)
return FALSE; return FALSE;
wxNode *node = propertySheet->GetProperties().First(); wxNode *node = m_propertySheet->GetProperties().First();
while (node) while (node)
{ {
wxProperty *prop = (wxProperty *)node->Data(); wxProperty *prop = (wxProperty *)node->Data();
@@ -122,7 +122,7 @@ bool wxPropertyFormView::TransferToPropertySheet(void)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{ {
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnRetrieveValue(prop, this, propertyWindow); formValidator->OnRetrieveValue(prop, this, m_propertyWindow);
} }
node = node->Next(); node = node->Next();
} }
@@ -131,10 +131,10 @@ bool wxPropertyFormView::TransferToPropertySheet(void)
bool wxPropertyFormView::TransferToDialog(void) bool wxPropertyFormView::TransferToDialog(void)
{ {
if (!propertySheet) if (!m_propertySheet)
return FALSE; return FALSE;
wxNode *node = propertySheet->GetProperties().First(); wxNode *node = m_propertySheet->GetProperties().First();
while (node) while (node)
{ {
wxProperty *prop = (wxProperty *)node->Data(); wxProperty *prop = (wxProperty *)node->Data();
@@ -142,7 +142,7 @@ bool wxPropertyFormView::TransferToDialog(void)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{ {
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnDisplayValue(prop, this, propertyWindow); formValidator->OnDisplayValue(prop, this, m_propertyWindow);
} }
node = node->Next(); node = node->Next();
} }
@@ -151,16 +151,16 @@ bool wxPropertyFormView::TransferToDialog(void)
bool wxPropertyFormView::AssociateNames(void) bool wxPropertyFormView::AssociateNames(void)
{ {
if (!propertySheet || !propertyWindow) if (!m_propertySheet || !m_propertyWindow)
return FALSE; return FALSE;
wxNode *node = propertyWindow->GetChildren()->First(); wxNode *node = m_propertyWindow->GetChildren()->First();
while (node) while (node)
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (win->GetName() != "") if (win->GetName() != "")
{ {
wxProperty *prop = propertySheet->GetProperty(win->GetName()); wxProperty *prop = m_propertySheet->GetProperty(win->GetName());
if (prop) if (prop)
prop->SetWindow(win); prop->SetWindow(win);
} }
@@ -182,16 +182,16 @@ void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
if (!Check()) if (!Check())
return; return;
dialogCancelled = FALSE; sm_dialogCancelled = FALSE;
managedWindow->Close(TRUE); m_managedWindow->Close(TRUE);
} }
void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event)) void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
{ {
dialogCancelled = TRUE; sm_dialogCancelled = TRUE;
managedWindow->Close(TRUE); m_managedWindow->Close(TRUE);
} }
void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event)) void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
@@ -210,7 +210,7 @@ void wxPropertyFormView::OnRevert(wxCommandEvent& WXUNUSED(event))
void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event) void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
if (!propertySheet) if (!m_propertySheet)
return; return;
if (win.GetName() == "") if (win.GetName() == "")
@@ -229,7 +229,7 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
else else
{ {
// Find a validator to route the command to. // Find a validator to route the command to.
wxNode *node = propertySheet->GetProperties().First(); wxNode *node = m_propertySheet->GetProperties().First();
while (node) while (node)
{ {
wxProperty *prop = (wxProperty *)node->Data(); wxProperty *prop = (wxProperty *)node->Data();
@@ -239,7 +239,7 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{ {
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnCommand(prop, this, propertyWindow, event); formValidator->OnCommand(prop, this, m_propertyWindow, event);
return; return;
} }
} }
@@ -250,11 +250,11 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
void wxPropertyFormView::OnDoubleClick(wxControl *item) void wxPropertyFormView::OnDoubleClick(wxControl *item)
{ {
if (!propertySheet) if (!m_propertySheet)
return; return;
// Find a validator to route the command to. // Find a validator to route the command to.
wxNode *node = propertySheet->GetProperties().First(); wxNode *node = m_propertySheet->GetProperties().First();
while (node) while (node)
{ {
wxProperty *prop = (wxProperty *)node->Data(); wxProperty *prop = (wxProperty *)node->Data();
@@ -264,7 +264,7 @@ void wxPropertyFormView::OnDoubleClick(wxControl *item)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{ {
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnDoubleClick(prop, this, propertyWindow); formValidator->OnDoubleClick(prop, this, m_propertyWindow);
return; return;
} }
} }
@@ -282,18 +282,18 @@ wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *pare
const wxPoint& pos, const wxSize& size, long style, const wxString& name): const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name) wxDialog(parent, -1, title, pos, size, style, name)
{ {
view = v; m_view = v;
view->AssociatePanel(this); m_view->AssociatePanel(this);
view->SetManagedWindow(this); m_view->SetManagedWindow(this);
// SetAutoLayout(TRUE); // SetAutoLayout(TRUE);
} }
bool wxPropertyFormDialog::OnClose(void) bool wxPropertyFormDialog::OnClose(void)
{ {
if (view) if (m_view)
{ {
view->OnClose(); m_view->OnClose();
view = NULL; m_view = NULL;
return TRUE; return TRUE;
} }
else else
@@ -302,19 +302,19 @@ bool wxPropertyFormDialog::OnClose(void)
void wxPropertyFormDialog::OnDefaultAction(wxControl *item) void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
{ {
view->OnDoubleClick(item); m_view->OnDoubleClick(item);
} }
void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event) void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
if ( view ) if ( m_view )
view->OnCommand(win, event); m_view->OnCommand(win, event);
} }
// Extend event processing to search the view's event table // Extend event processing to search the view's event table
bool wxPropertyFormDialog::ProcessEvent(wxEvent& event) bool wxPropertyFormDialog::ProcessEvent(wxEvent& event)
{ {
if ( !view || ! view->ProcessEvent(event) ) if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event); return wxEvtHandler::ProcessEvent(event);
else else
return TRUE; return TRUE;
@@ -329,18 +329,18 @@ IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel)
void wxPropertyFormPanel::OnDefaultAction(wxControl *item) void wxPropertyFormPanel::OnDefaultAction(wxControl *item)
{ {
view->OnDoubleClick(item); m_view->OnDoubleClick(item);
} }
void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event) void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
view->OnCommand(win, event); m_view->OnCommand(win, event);
} }
// Extend event processing to search the view's event table // Extend event processing to search the view's event table
bool wxPropertyFormPanel::ProcessEvent(wxEvent& event) bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
{ {
if ( !view || ! view->ProcessEvent(event) ) if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event); return wxEvtHandler::ProcessEvent(event);
else else
return TRUE; return TRUE;
@@ -354,8 +354,8 @@ IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)
bool wxPropertyFormFrame::OnClose(void) bool wxPropertyFormFrame::OnClose(void)
{ {
if (view) if (m_view)
return view->OnClose(); return m_view->OnClose();
else else
return FALSE; return FALSE;
} }
@@ -367,12 +367,11 @@ wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView
bool wxPropertyFormFrame::Initialize(void) bool wxPropertyFormFrame::Initialize(void)
{ {
propertyPanel = OnCreatePanel(this, view); m_propertyPanel = OnCreatePanel(this, m_view);
if (propertyPanel) if (m_propertyPanel)
{ {
view->AssociatePanel(propertyPanel); m_view->AssociatePanel(m_propertyPanel);
view->SetManagedWindow(this); m_view->SetManagedWindow(this);
// propertyPanel->SetAutoLayout(TRUE);
return TRUE; return TRUE;
} }
else else
@@ -398,15 +397,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator)
bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view), bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow) wxWindow *parentWindow)
{ {
if (realMin == 0.0 && realMax == 0.0) if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE; return TRUE;
// The item used for viewing the real number: should be a text item. // The item used for viewing the real number: should be a text item.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE; return FALSE;
wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
float val = 0.0; float val = 0.0;
if (!StringToFloat(WXSTRINGCAST value, &val)) if (!StringToFloat(WXSTRINGCAST value, &val))
@@ -417,10 +416,10 @@ bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView
return FALSE; return FALSE;
} }
if (val < realMin || val > realMax) if (val < m_realMin || val > m_realMax)
{ {
char buf[200]; char buf[200];
sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax); sprintf(buf, "Value must be a real number between %.2f and %.2f!", m_realMin, m_realMax);
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE; return FALSE;
} }
@@ -431,11 +430,11 @@ bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
wxWindow *WXUNUSED(parentWindow) ) wxWindow *WXUNUSED(parentWindow) )
{ {
// The item used for viewing the real number: should be a text item. // The item used for viewing the real number: should be a text item.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE; return FALSE;
wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0) if (value.Length() == 0)
return FALSE; return FALSE;
@@ -449,11 +448,11 @@ bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
wxWindow *WXUNUSED(parentWindow) ) wxWindow *WXUNUSED(parentWindow) )
{ {
// The item used for viewing the real number: should be a text item. // The item used for viewing the real number: should be a text item.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE; return FALSE;
wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow; wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(FloatToString(property->GetValue().RealValue())); textItem->SetValue(FloatToString(property->GetValue().RealValue()));
return TRUE; return TRUE;
} }
@@ -466,19 +465,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)
bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow) wxWindow *parentWindow)
{ {
if (integerMin == 0.0 && integerMax == 0.0) if (m_integerMin == 0.0 && m_integerMax == 0.0)
return TRUE; return TRUE;
// The item used for viewing the real number: should be a text item or a slider // The item used for viewing the real number: should be a text item or a slider
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow) if (!m_propertyWindow)
return FALSE; return FALSE;
long val = 0; long val = 0;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{ {
wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (!StringToLong(WXSTRINGCAST value, &val)) if (!StringToLong(WXSTRINGCAST value, &val))
{ {
@@ -488,17 +487,17 @@ bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVi
return FALSE; return FALSE;
} }
} }
else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{ {
val = (long)((wxSlider *)propertyWindow)->GetValue(); val = (long)((wxSlider *)m_propertyWindow)->GetValue();
} }
else else
return FALSE; return FALSE;
if (val < integerMin || val > integerMax) if (val < m_integerMin || val > m_integerMax)
{ {
char buf[200]; char buf[200];
sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax); sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax);
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE; return FALSE;
} }
@@ -509,13 +508,13 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
wxWindow *WXUNUSED(parentWindow)) wxWindow *WXUNUSED(parentWindow))
{ {
// The item used for viewing the real number: should be a text item or a slider // The item used for viewing the real number: should be a text item or a slider
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow) if (!m_propertyWindow)
return FALSE; return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{ {
wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0) if (value.Length() == 0)
return FALSE; return FALSE;
@@ -523,9 +522,9 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
long i = atol((const char *)value); long i = atol((const char *)value);
property->GetValue() = i; property->GetValue() = i;
} }
else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{ {
property->GetValue() = (long)((wxSlider *)propertyWindow)->GetValue(); property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue();
} }
else else
return FALSE; return FALSE;
@@ -537,18 +536,18 @@ bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFor
wxWindow *WXUNUSED(parentWindow)) wxWindow *WXUNUSED(parentWindow))
{ {
// The item used for viewing the real number: should be a text item or a slider // The item used for viewing the real number: should be a text item or a slider
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow) if (!m_propertyWindow)
return FALSE; return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{ {
wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow; wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(LongToString(property->GetValue().IntegerValue())); textItem->SetValue(LongToString(property->GetValue().IntegerValue()));
} }
else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{ {
((wxSlider *)propertyWindow)->SetValue((int)property->GetValue().IntegerValue()); ((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
} }
else else
return FALSE; return FALSE;
@@ -564,8 +563,8 @@ bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView
wxWindow *WXUNUSED(parentWindow)) wxWindow *WXUNUSED(parentWindow))
{ {
// The item used for viewing the boolean: should be a checkbox // The item used for viewing the boolean: should be a checkbox
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE; return FALSE;
return TRUE; return TRUE;
@@ -575,11 +574,11 @@ bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
wxWindow *WXUNUSED(parentWindow) ) wxWindow *WXUNUSED(parentWindow) )
{ {
// The item used for viewing the boolean: should be a checkbox. // The item used for viewing the boolean: should be a checkbox.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE; return FALSE;
wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
property->GetValue() = (bool)checkBox->GetValue(); property->GetValue() = (bool)checkBox->GetValue();
return TRUE; return TRUE;
@@ -589,11 +588,11 @@ bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
wxWindow *WXUNUSED(parentWindow)) wxWindow *WXUNUSED(parentWindow))
{ {
// The item used for viewing the boolean: should be a checkbox. // The item used for viewing the boolean: should be a checkbox.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE; return FALSE;
wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
checkBox->SetValue((bool)property->GetValue().BoolValue()); checkBox->SetValue((bool)property->GetValue().BoolValue());
return TRUE; return TRUE;
} }
@@ -606,23 +605,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)
wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags): wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
wxPropertyFormValidator(flags) wxPropertyFormValidator(flags)
{ {
strings = list; m_strings = list;
} }
bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow ) wxWindow *parentWindow )
{ {
if (!strings) if (!m_strings)
return TRUE; return TRUE;
// The item used for viewing the string: should be a text item, choice item or listbox. // The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow) if (!m_propertyWindow)
return FALSE; return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{ {
wxTextCtrl *text = (wxTextCtrl *)propertyWindow; wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
if (!strings->Member(text->GetValue())) if (!m_strings->Member(text->GetValue()))
{ {
wxString s("Value "); wxString s("Value ");
s += text->GetValue(); s += text->GetValue();
@@ -643,32 +642,32 @@ bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyForm
wxWindow *WXUNUSED(parentWindow) ) wxWindow *WXUNUSED(parentWindow) )
{ {
// The item used for viewing the string: should be a text item, choice item or listbox. // The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow) if (!m_propertyWindow)
return FALSE; return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{ {
wxTextCtrl *text = (wxTextCtrl *)propertyWindow; wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
property->GetValue() = text->GetValue(); property->GetValue() = text->GetValue();
} }
else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{ {
wxListBox *lbox = (wxListBox *)propertyWindow; wxListBox *lbox = (wxListBox *)m_propertyWindow;
if (lbox->GetSelection() > -1) if (lbox->GetSelection() > -1)
property->GetValue() = lbox->GetStringSelection(); property->GetValue() = lbox->GetStringSelection();
} }
/* /*
else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
{ {
wxRadioBox *rbox = (wxRadioBox *)propertyWindow; wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
int n = 0; int n = 0;
if ((n = rbox->GetSelection()) > -1) if ((n = rbox->GetSelection()) > -1)
property->GetValue() = rbox->GetString(n); property->GetValue() = rbox->GetString(n);
} }
*/ */
else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{ {
wxChoice *choice = (wxChoice *)propertyWindow; wxChoice *choice = (wxChoice *)m_propertyWindow;
if (choice->GetSelection() > -1) if (choice->GetSelection() > -1)
property->GetValue() = choice->GetStringSelection(); property->GetValue() = choice->GetStringSelection();
} }
@@ -681,21 +680,21 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
wxWindow *WXUNUSED(parentWindow) ) wxWindow *WXUNUSED(parentWindow) )
{ {
// The item used for viewing the string: should be a text item, choice item or listbox. // The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *propertyWindow = property->GetWindow(); wxWindow *m_propertyWindow = property->GetWindow();
if (!propertyWindow) if (!m_propertyWindow)
return FALSE; return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{ {
wxTextCtrl *text = (wxTextCtrl *)propertyWindow; wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
text->SetValue(property->GetValue().StringValue()); text->SetValue(property->GetValue().StringValue());
} }
else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{ {
wxListBox *lbox = (wxListBox *)propertyWindow; wxListBox *lbox = (wxListBox *)m_propertyWindow;
if (lbox->Number() == 0 && strings) if (lbox->Number() == 0 && m_strings)
{ {
// Try to initialize the listbox from 'strings' // Try to initialize the listbox from 'strings'
wxNode *node = strings->First(); wxNode *node = m_strings->First();
while (node) while (node)
{ {
char *s = (char *)node->Data(); char *s = (char *)node->Data();
@@ -706,21 +705,21 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
lbox->SetStringSelection(property->GetValue().StringValue()); lbox->SetStringSelection(property->GetValue().StringValue());
} }
/* /*
else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
{ {
wxRadioBox *rbox = (wxRadioBox *)propertyWindow; wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
rbox->SetStringSelection(property->GetValue().StringValue()); rbox->SetStringSelection(property->GetValue().StringValue());
} }
*/ */
else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice))) else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{ {
wxChoice *choice = (wxChoice *)propertyWindow; wxChoice *choice = (wxChoice *)m_propertyWindow;
#ifndef __XVIEW__ #ifndef __XVIEW__
if (choice->Number() == 0 && strings) if (choice->Number() == 0 && m_strings)
{ {
// Try to initialize the choice item from 'strings' // Try to initialize the choice item from 'strings'
// XView doesn't allow this kind of thing. // XView doesn't allow this kind of thing.
wxNode *node = strings->First(); wxNode *node = m_strings->First();
while (node) while (node)
{ {
char *s = (char *)node->Data(); char *s = (char *)node->Data();

View File

@@ -29,18 +29,7 @@
class wxPropertyFormView: public wxPropertyView class wxPropertyFormView: public wxPropertyView
{ {
DECLARE_DYNAMIC_CLASS(wxPropertyFormView) DECLARE_DYNAMIC_CLASS(wxPropertyFormView)
protected:
bool detailedEditing; // E.g. using listbox for choices
wxWindow *propertyWindow; // Panel that the controls will appear on
wxWindow *managedWindow; // Frame or dialog
wxButton *windowCloseButton; // Or OK
wxButton *windowCancelButton;
wxButton *windowHelpButton;
public: public:
static bool dialogCancelled;
wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0); wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0);
~wxPropertyFormView(void); ~wxPropertyFormView(void);
@@ -78,15 +67,28 @@ class wxPropertyFormView: public wxPropertyView
// TODO: does OnCommand still get called...??? // TODO: does OnCommand still get called...???
virtual void OnCommand(wxWindow& win, wxCommandEvent& event); virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
inline virtual void AssociatePanel(wxWindow *win) { propertyWindow = win; } inline virtual void AssociatePanel(wxWindow *win) { m_propertyWindow = win; }
inline virtual wxWindow *GetPanel(void) { return propertyWindow; } inline virtual wxWindow *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; } inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; } inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; } inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; } inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
inline virtual wxButton *GetHelpButton() { return windowHelpButton; } inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
public:
static bool sm_dialogCancelled;
protected:
bool m_detailedEditing; // E.g. using listbox for choices
wxWindow* m_propertyWindow; // Panel that the controls will appear on
wxWindow* m_managedWindow; // Frame or dialog
wxButton* m_windowCloseButton; // Or OK
wxButton* m_windowCancelButton;
wxButton* m_windowHelpButton;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@@ -144,14 +146,11 @@ class wxPropertyFormValidator: public wxPropertyValidator
class wxRealFormValidator: public wxPropertyFormValidator class wxRealFormValidator: public wxPropertyFormValidator
{ {
DECLARE_DYNAMIC_CLASS(wxRealFormValidator) DECLARE_DYNAMIC_CLASS(wxRealFormValidator)
protected:
float realMin;
float realMax;
public: public:
// 0.0, 0.0 means no range // 0.0, 0.0 means no range
wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags) wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags)
{ {
realMin = min; realMax = max; m_realMin = min; m_realMax = max;
} }
~wxRealFormValidator(void) {} ~wxRealFormValidator(void) {}
@@ -159,25 +158,30 @@ class wxRealFormValidator: public wxPropertyFormValidator
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
// Called by the view to transfer the property to the window. // Called by the view to transfer the property to the window.
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
float m_realMin;
float m_realMax;
}; };
class wxIntegerFormValidator: public wxPropertyFormValidator class wxIntegerFormValidator: public wxPropertyFormValidator
{ {
DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator) DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator)
protected:
long integerMin;
long integerMax;
public: public:
// 0, 0 means no range // 0, 0 means no range
wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags) wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags)
{ {
integerMin = min; integerMax = max; m_integerMin = min; m_integerMax = max;
} }
~wxIntegerFormValidator(void) {} ~wxIntegerFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
long m_integerMin;
long m_integerMax;
}; };
class wxBoolFormValidator: public wxPropertyFormValidator class wxBoolFormValidator: public wxPropertyFormValidator
@@ -198,20 +202,21 @@ class wxBoolFormValidator: public wxPropertyFormValidator
class wxStringFormValidator: public wxPropertyFormValidator class wxStringFormValidator: public wxPropertyFormValidator
{ {
DECLARE_DYNAMIC_CLASS(wxStringFormValidator) DECLARE_DYNAMIC_CLASS(wxStringFormValidator)
protected:
wxStringList *strings;
public: public:
wxStringFormValidator(wxStringList *list = NULL, long flags = 0); wxStringFormValidator(wxStringList *list = NULL, long flags = 0);
~wxStringFormValidator(void) ~wxStringFormValidator(void)
{ {
if (strings) if (m_strings)
delete strings; delete m_strings;
} }
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
wxStringList* m_strings;
}; };
/* /*
@@ -221,8 +226,6 @@ class wxStringFormValidator: public wxPropertyFormValidator
class wxPropertyFormDialog: public wxDialog class wxPropertyFormDialog: public wxDialog
{ {
DECLARE_CLASS(wxPropertyFormDialog) DECLARE_CLASS(wxPropertyFormDialog)
private:
wxPropertyFormView *view;
public: public:
wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
@@ -233,6 +236,9 @@ class wxPropertyFormDialog: public wxDialog
// Extend event processing to search the view's event table // Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyFormView* m_view;
}; };
/* /*
@@ -242,20 +248,21 @@ class wxPropertyFormDialog: public wxDialog
class wxPropertyFormPanel: public wxPanel class wxPropertyFormPanel: public wxPanel
{ {
DECLARE_CLASS(wxPropertyFormPanel) DECLARE_CLASS(wxPropertyFormPanel)
private:
wxPropertyFormView *view;
public: public:
wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"): const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"):
wxPanel(parent, -1, pos, size, style, name) wxPanel(parent, -1, pos, size, style, name)
{ {
view = v; m_view = v;
} }
void OnDefaultAction(wxControl *item); void OnDefaultAction(wxControl *item);
void OnCommand(wxWindow& win, wxCommandEvent& event); void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to search the view's event table // Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyFormView* m_view;
}; };
/* /*
@@ -265,24 +272,25 @@ class wxPropertyFormPanel: public wxPanel
class wxPropertyFormFrame: public wxFrame class wxPropertyFormFrame: public wxFrame
{ {
DECLARE_CLASS(wxPropertyFormFrame) DECLARE_CLASS(wxPropertyFormFrame)
private:
wxPropertyFormView *view;
wxPanel *propertyPanel;
public: public:
wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title, wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME, const wxString& name = "frame"): long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
wxFrame(parent, -1, title, pos, size, style, name) wxFrame(parent, -1, title, pos, size, style, name)
{ {
view = v; m_view = v;
propertyPanel = NULL; m_propertyPanel = NULL;
} }
bool OnClose(void); bool OnClose(void);
// Must call this to create panel and associate view // Must call this to create panel and associate view
virtual bool Initialize(void); virtual bool Initialize(void);
virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v); virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v);
inline virtual wxPanel *GetPropertyPanel(void) { return propertyPanel; } inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
private:
wxPropertyFormView* m_view;
wxPanel* m_propertyPanel;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -74,28 +74,7 @@
class wxPropertyListView: public wxPropertyView class wxPropertyListView: public wxPropertyView
{ {
DECLARE_DYNAMIC_CLASS(wxPropertyListView) DECLARE_DYNAMIC_CLASS(wxPropertyListView)
protected:
wxListBox *propertyScrollingList;
wxListBox *valueList; // Should really be a combobox, but we don't have one.
wxTextCtrl *valueText;
wxButton *confirmButton; // A tick, as in VB
wxButton *cancelButton; // A cross, as in VB
wxButton *editButton; // Invokes the custom validator, if any
bool detailedEditing; // E.g. using listbox for choices
static wxBitmap *tickBitmap;
static wxBitmap *crossBitmap;
wxPanel *propertyWindow; // Panel that the controls will appear on
wxWindow *managedWindow; // Frame or dialog
wxButton *windowCloseButton; // Or OK
wxButton *windowCancelButton;
wxButton *windowHelpButton;
public: public:
static bool dialogCancelled;
wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT); wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT);
~wxPropertyListView(void); ~wxPropertyListView(void);
@@ -161,26 +140,49 @@ class wxPropertyListView: public wxPropertyView
void OnEdit(wxCommandEvent& event); void OnEdit(wxCommandEvent& event);
void OnText(wxCommandEvent& event); void OnText(wxCommandEvent& event);
inline virtual wxListBox *GetPropertyScrollingList() { return propertyScrollingList; } inline virtual wxListBox *GetPropertyScrollingList() const { return m_propertyScrollingList; }
inline virtual wxListBox *GetValueList() { return valueList; } inline virtual wxListBox *GetValueList() const { return m_valueList; }
inline virtual wxTextCtrl *GetValueText() { return valueText; } inline virtual wxTextCtrl *GetValueText() const { return m_valueText; }
inline virtual wxButton *GetConfirmButton() { return confirmButton; } inline virtual wxButton *GetConfirmButton() const { return m_confirmButton; }
inline virtual wxButton *GetCancelButton() { return cancelButton; } inline virtual wxButton *GetCancelButton() const { return m_cancelButton; }
inline virtual wxButton *GetEditButton() { return editButton; } inline virtual wxButton *GetEditButton() const { return m_editButton; }
inline virtual bool GetDetailedEditing(void) { return detailedEditing; } inline virtual bool GetDetailedEditing(void) const { return m_detailedEditing; }
inline virtual void AssociatePanel(wxPanel *win) { propertyWindow = win; } inline virtual void AssociatePanel(wxPanel *win) { m_propertyWindow = win; }
inline virtual wxPanel *GetPanel(void) { return propertyWindow; } inline virtual wxPanel *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; } inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; } inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; } inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; } inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
inline virtual wxButton *GetHelpButton() { return windowHelpButton; } inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
bool OnClose(void); bool OnClose(void);
public:
static bool sm_dialogCancelled;
protected:
wxListBox* m_propertyScrollingList;
wxListBox* m_valueList; // Should really be a combobox, but we don't have one.
wxTextCtrl* m_valueText;
wxButton* m_confirmButton; // A tick, as in VB
wxButton* m_cancelButton; // A cross, as in VB
wxButton* m_editButton; // Invokes the custom validator, if any
bool m_detailedEditing; // E.g. using listbox for choices
static wxBitmap* sm_tickBitmap;
static wxBitmap* sm_crossBitmap;
wxPanel* m_propertyWindow; // Panel that the controls will appear on
wxWindow* m_managedWindow; // Frame or dialog
wxButton* m_windowCloseButton; // Or OK
wxButton* m_windowCancelButton;
wxButton* m_windowHelpButton;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -188,12 +190,13 @@ class wxPropertyTextEdit: public wxTextCtrl
{ {
DECLARE_CLASS(wxPropertyTextEdit) DECLARE_CLASS(wxPropertyTextEdit)
public: public:
wxPropertyListView *view;
wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id, wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id,
const wxString& value, const wxPoint& pos = wxDefaultPosition, const wxString& value, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text"); const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text");
void OnSetFocus(void); void OnSetFocus(void);
void OnKillFocus(void); void OnKillFocus(void);
wxPropertyListView* m_view;
}; };
#define wxPROP_ALLOW_TEXT_EDITING 1 #define wxPROP_ALLOW_TEXT_EDITING 1
@@ -267,8 +270,6 @@ class wxPropertyListValidator: public wxPropertyValidator
class wxPropertyListDialog: public wxDialog class wxPropertyListDialog: public wxDialog
{ {
DECLARE_CLASS(wxPropertyListDialog) DECLARE_CLASS(wxPropertyListDialog)
private:
wxPropertyListView *view;
public: public:
wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
@@ -280,6 +281,9 @@ class wxPropertyListDialog: public wxDialog
// Extend event processing to search the view's event table // Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyListView* m_view;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -290,21 +294,19 @@ DECLARE_EVENT_TABLE()
class wxPropertyListPanel: public wxPanel class wxPropertyListPanel: public wxPanel
{ {
DECLARE_CLASS(wxPropertyListPanel) DECLARE_CLASS(wxPropertyListPanel)
private:
wxPropertyListView *view;
public: public:
wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = "panel"): long style = 0, const wxString& name = "panel"):
wxPanel(parent, -1, pos, size, style, name) wxPanel(parent, -1, pos, size, style, name)
{ {
view = v; m_view = v;
} }
~wxPropertyListPanel(); ~wxPropertyListPanel();
void OnDefaultAction(wxControl *item); void OnDefaultAction(wxControl *item);
inline void SetView(wxPropertyListView* v) { view = v; } inline void SetView(wxPropertyListView* v) { m_view = v; }
inline wxPropertyListView* GetView() const { return view; } inline wxPropertyListView* GetView() const { return m_view; }
// Extend event processing to search the view's event table // Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
@@ -312,6 +314,9 @@ class wxPropertyListPanel: public wxPanel
// Call Layout() // Call Layout()
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
private:
wxPropertyListView* m_view;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -322,24 +327,25 @@ DECLARE_EVENT_TABLE()
class wxPropertyListFrame: public wxFrame class wxPropertyListFrame: public wxFrame
{ {
DECLARE_CLASS(wxPropertyListFrame) DECLARE_CLASS(wxPropertyListFrame)
private:
wxPropertyListView *view;
wxPropertyListPanel *propertyPanel;
public: public:
wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME, const wxString& name = "frame"): long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
wxFrame(parent, -1, title, pos, size, style, name) wxFrame(parent, -1, title, pos, size, style, name)
{ {
view = v; m_view = v;
propertyPanel = NULL; m_propertyPanel = NULL;
} }
bool OnClose(void); bool OnClose(void);
// Must call this to create panel and associate view // Must call this to create panel and associate view
virtual bool Initialize(void); virtual bool Initialize(void);
virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v); virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v);
inline virtual wxPropertyListPanel *GetPropertyPanel(void) { return propertyPanel; } inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
private:
wxPropertyListView* m_view;
wxPropertyListPanel* m_propertyPanel;
}; };
/* /*
@@ -349,14 +355,11 @@ class wxPropertyListFrame: public wxFrame
class wxRealListValidator: public wxPropertyListValidator class wxRealListValidator: public wxPropertyListValidator
{ {
DECLARE_DYNAMIC_CLASS(wxRealListValidator) DECLARE_DYNAMIC_CLASS(wxRealListValidator)
protected:
float realMin;
float realMax;
public: public:
// 0.0, 0.0 means no range // 0.0, 0.0 means no range
wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
{ {
realMin = min; realMax = max; m_realMin = min; m_realMax = max;
} }
~wxRealListValidator(void) {} ~wxRealListValidator(void) {}
@@ -370,19 +373,20 @@ class wxRealListValidator: public wxPropertyListValidator
// the property list. // the property list.
// Does the transfer from the property editing area to the property itself // Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
float m_realMin;
float m_realMax;
}; };
class wxIntegerListValidator: public wxPropertyListValidator class wxIntegerListValidator: public wxPropertyListValidator
{ {
DECLARE_DYNAMIC_CLASS(wxIntegerListValidator) DECLARE_DYNAMIC_CLASS(wxIntegerListValidator)
protected:
long integerMin;
long integerMax;
public: public:
// 0, 0 means no range // 0, 0 means no range
wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
{ {
integerMin = min; integerMax = max; m_integerMin = min; m_integerMax = max;
} }
~wxIntegerListValidator(void) {} ~wxIntegerListValidator(void) {}
@@ -396,6 +400,10 @@ class wxIntegerListValidator: public wxPropertyListValidator
// the property list. // the property list.
// Does the transfer from the property editing area to the property itself // Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
long m_integerMin;
long m_integerMax;
}; };
class wxBoolListValidator: public wxPropertyListValidator class wxBoolListValidator: public wxPropertyListValidator
@@ -430,15 +438,13 @@ class wxBoolListValidator: public wxPropertyListValidator
class wxStringListValidator: public wxPropertyListValidator class wxStringListValidator: public wxPropertyListValidator
{ {
DECLARE_DYNAMIC_CLASS(wxStringListValidator) DECLARE_DYNAMIC_CLASS(wxStringListValidator)
protected:
wxStringList *strings;
public: public:
wxStringListValidator(wxStringList *list = NULL, long flags = 0); wxStringListValidator(wxStringList *list = NULL, long flags = 0);
~wxStringListValidator(void) ~wxStringListValidator(void)
{ {
if (strings) if (m_strings)
delete strings; delete m_strings;
} }
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
@@ -458,15 +464,14 @@ class wxStringListValidator: public wxPropertyListValidator
// Called when the property is double clicked. Extra functionality can be provided, // Called when the property is double clicked. Extra functionality can be provided,
// cycling through possible values. // cycling through possible values.
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
wxStringList* m_strings;
}; };
class wxFilenameListValidator: public wxPropertyListValidator class wxFilenameListValidator: public wxPropertyListValidator
{ {
DECLARE_DYNAMIC_CLASS(wxFilenameListValidator) DECLARE_DYNAMIC_CLASS(wxFilenameListValidator)
protected:
wxString filenameWildCard;
wxString filenameMessage;
public: public:
wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0); wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0);
@@ -488,6 +493,11 @@ class wxFilenameListValidator: public wxPropertyListValidator
// Called when the edit (...) button is pressed. // Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
wxString m_filenameWildCard;
wxString m_filenameMessage;
}; };
class wxColourListValidator: public wxPropertyListValidator class wxColourListValidator: public wxPropertyListValidator