#define wxID_HIGHEST 5999
+// Shortcut for easier dialog-unit-to-pixel conversion
+#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixel(pt)
+
#ifdef __WXMSW__
// Stand-ins for Windows types, to avoid
// #including all of windows.h
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
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);
bool Close( bool force = FALSE );
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 OnIdle( wxIdleEvent& event );
int *externalLeading = (int *) NULL,
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 wxFont *GetFont();
// For backward compatibility
wxCursor *m_cursor;
wxFont m_font;
wxColour m_backgroundColour;
- wxColour m_defaultBackgroundColour;
wxColour m_foregroundColour ;
- wxColour m_defaultForegroundColour;
wxRegion m_updateRegion;
long m_windowStyle;
bool m_isShown;
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
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);
bool Close( bool force = FALSE );
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 OnIdle( wxIdleEvent& event );
int *externalLeading = (int *) NULL,
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 wxFont *GetFont();
// For backward compatibility
wxCursor *m_cursor;
wxFont m_font;
wxColour m_backgroundColour;
- wxColour m_defaultBackgroundColour;
wxColour m_foregroundColour ;
- wxColour m_defaultForegroundColour;
wxRegion m_updateRegion;
long m_windowStyle;
bool m_isShown;
inline virtual void SetForegroundColour(const wxColour& col);
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
inline virtual wxButton *GetDefaultItem() const;
inline virtual void SetDefaultItem(wxButton *but);
// Resource loading
#if wxUSE_WX_RESOURCES
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
virtual void GetTextExtent(const wxString& string, int *x, int *y,
virtual void GetClientSizeConstraint(int *w, int *h) 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 ;
// Generates a new id for controls
wxColour m_backgroundColour ;
wxColour m_foregroundColour ;
- wxColour m_defaultBackgroundColour;
- wxColour m_defaultForegroundColour;
wxAcceleratorTable m_acceleratorTable;
#if wxUSE_DRAG_AND_DROP
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
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 void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
inline virtual void SetForegroundColour(const wxColour& col);
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
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
// Resource loading
#if wxUSE_WX_RESOURCES
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
// Native resource loading
virtual void GetClientSizeConstraint(int *w, int *h) 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 ;
void MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
#endif
wxButton * m_defaultItem;
-
wxColour m_backgroundColour ;
- wxColour m_defaultBackgroundColour;
-
wxColour m_foregroundColour ;
- wxColour m_defaultForegroundColour;
-
bool m_backgroundTransparent;
int m_xThumbSize;
inline wxColour wxWindow::GetBackgroundColour(void) const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
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 void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
#define RESOURCE_PLATFORM_MAC 3
#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
*/
{
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:
- wxItemResource(void);
- ~wxItemResource(void);
+ wxItemResource();
+ ~wxItemResource();
- void SetType(char *typ);
- inline void SetStyle(long styl) { windowStyle = styl; }
+ inline void SetType(const wxString& type) { m_itemType = type; }
+ inline void SetStyle(long styl) { m_windowStyle = styl; }
inline void SetId(int id) { m_windowId = id; }
- inline void SetBitmap(wxBitmap *bm) { bitmap = bm; }
- inline wxBitmap *GetBitmap(void) { return bitmap; }
- inline void SetFont(wxFont *font) { windowFont = font; }
- inline wxFont *GetFont(void) { return windowFont; }
+ inline void SetBitmap(const wxBitmap& bm) { m_bitmap = bm; }
+ inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
+ inline void SetFont(const wxFont& font) { m_windowFont = font; }
+ inline wxFont& GetFont() const { return (wxFont&) m_windowFont; }
inline void SetSize(int xx, int yy, int ww, int hh)
- { x = xx; y = yy; width = ww; height = hh; }
- void SetTitle(char *t);
- void SetName(char *n);
- inline void SetValue1(long v) { value1 = v; }
- inline void SetValue2(long v) { value2 = v; }
- inline void SetValue3(long v) { value3 = v; }
- inline void SetValue5(long v) { value5 = v; }
- void SetValue4(char *v);
- void SetStringValues(wxStringList *svalues);
-
- inline char *GetType(void) { return itemType; }
- inline int GetX(void) { return x; }
- inline int GetY(void) { return y; }
- inline int GetWidth(void) { return width; }
- inline int GetHeight(void) { return height; }
-
- inline char *GetTitle(void) { return title; }
- inline char *GetName(void) { return name; }
- inline long GetStyle(void) { return windowStyle; }
- inline int GetId(void) { return m_windowId; }
-
- inline long GetValue1(void) { return value1; }
- inline long GetValue2(void) { return value2; }
- inline long GetValue3(void) { return value3; }
- inline long GetValue5(void) { return value5; }
- inline char *GetValue4(void) { return value4; }
- inline wxList& GetChildren(void) { return children; }
- inline wxStringList *GetStringValues(void) { return stringValues; }
-
- inline void SetBackgroundColour(wxColour *col) { if (backgroundColour) delete backgroundColour; backgroundColour = col; }
- inline void SetLabelColour(wxColour *col) { if (labelColour) delete labelColour; labelColour = col; }
- inline void SetButtonColour(wxColour *col) { if (buttonColour) delete buttonColour; buttonColour = col; }
+ { m_x = xx; m_y = yy; m_width = ww; m_height = hh; }
+ inline void SetTitle(const wxString& title) { m_title = title; }
+ inline void SetName(const wxString& name) { m_name = name; }
+ inline void SetValue1(long v) { m_value1 = v; }
+ inline void SetValue2(long v) { m_value2 = v; }
+ inline void SetValue3(long v) { m_value3 = v; }
+ inline void SetValue5(long v) { m_value5 = v; }
+ inline void SetValue4(const wxString& v) { m_value4 = v; }
+ inline void SetStringValues(const wxStringList& svalues) { m_stringValues = svalues; }
+
+ inline wxString GetType() const { return m_itemType; }
+ inline int GetX() const { return m_x; }
+ inline int GetY() const { return m_y; }
+ inline int GetWidth() const { return m_width; }
+ inline int GetHeight() const { return m_height; }
+
+ inline wxString GetTitle() const { return m_title; }
+ inline wxString GetName() const { return m_name; }
+ inline long GetStyle() const { return m_windowStyle; }
+ inline int GetId() const { return m_windowId; }
+
+ inline long GetValue1() const { return m_value1; }
+ inline long GetValue2() const { return m_value2; }
+ inline long GetValue3() const { return m_value3; }
+ inline long GetValue5() const { return m_value5; }
+ inline wxString GetValue4() const { return m_value4; }
+ inline wxList& GetChildren() const { return (wxList&) m_children; }
+ inline wxStringList& GetStringValues() const { return (wxStringList&) m_stringValues; }
+
+ inline void SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; }
+ inline void SetLabelColour(const wxColour& col) { m_labelColour = col; }
+ inline void SetButtonColour(const wxColour& col) { m_buttonColour = col; }
- inline wxColour *GetBackgroundColour(void) { return backgroundColour; }
- inline wxColour *GetLabelColour(void) { return labelColour; }
- inline wxColour *GetButtonColour(void) { return buttonColour; }
+ inline wxColour& GetBackgroundColour() const { return (wxColour&) m_backgroundColour; }
+ inline wxColour& GetLabelColour() const { return (wxColour&) m_labelColour; }
+ 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
};
/*
public:
wxHashTable identifiers;
- wxResourceTable(void);
- ~wxResourceTable(void);
-
+ wxResourceTable();
+ ~wxResourceTable();
+
virtual wxItemResource *FindResource(const wxString& name) const;
virtual void AddResource(wxItemResource *item);
virtual bool DeleteResource(const wxString& name);
- virtual bool ParseResourceFile(char *filename);
- virtual bool ParseResourceData(char *data);
- virtual bool SaveResource(char *filename);
+ virtual bool ParseResourceFile(const wxString& filename);
+ virtual bool ParseResourceData(const wxString& data);
+ virtual bool SaveResource(const wxString& filename);
// Register XBM/XPM data
- virtual bool RegisterResourceBitmapData(char *name, char bits[], int width, int height);
- virtual bool RegisterResourceBitmapData(char *name, char **data);
+ virtual bool RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height);
+ 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 wxCleanUpResourceSystem(void);
+extern void WXDLLEXPORT wxInitializeResourceSystem();
+extern void WXDLLEXPORT wxCleanUpResourceSystem();
WXDLLEXPORT_DATA(extern wxResourceTable*) wxDefaultResourceTable;
-extern long WXDLLEXPORT wxParseWindowStyle(char *style);
+extern long WXDLLEXPORT wxParseWindowStyle(const wxString& style);
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxIcon;
-extern wxBitmap* WXDLLEXPORT wxResourceCreateBitmap(char *resource, wxResourceTable *table = (wxResourceTable *) NULL);
-extern wxIcon* WXDLLEXPORT wxResourceCreateIcon(char *resource, wxResourceTable *table = (wxResourceTable *) NULL);
-extern wxMenuBar* WXDLLEXPORT wxResourceCreateMenuBar(char *resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL);
-extern wxMenu* WXDLLEXPORT wxResourceCreateMenu(char *resource, wxResourceTable *table = (wxResourceTable *) NULL);
-extern bool WXDLLEXPORT wxResourceParseData(char *resource, wxResourceTable *table = (wxResourceTable *) NULL);
-extern bool WXDLLEXPORT wxResourceParseFile(char *filename, wxResourceTable *table = (wxResourceTable *) NULL);
-extern bool WXDLLEXPORT wxResourceParseString(char *s, wxResourceTable *table = (wxResourceTable *) NULL);
+extern wxBitmap WXDLLEXPORT wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
+extern wxIcon WXDLLEXPORT wxResourceCreateIcon(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
+extern wxMenuBar* WXDLLEXPORT wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL);
+extern wxMenu* WXDLLEXPORT wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
+extern bool WXDLLEXPORT wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
+extern bool WXDLLEXPORT wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL);
+extern bool WXDLLEXPORT wxResourceParseString(const wxString& s, wxResourceTable *table = (wxResourceTable *) NULL);
extern void WXDLLEXPORT wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL);
// Register XBM/XPM data
-extern bool WXDLLEXPORT wxResourceRegisterBitmapData(char *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 bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL);
+extern bool WXDLLEXPORT wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table = (wxResourceTable *) NULL);
#define wxResourceRegisterIconData wxResourceRegisterBitmapData
/*
* Resource identifer code: #define storage
*/
-extern bool WXDLLEXPORT wxResourceAddIdentifier(char *name, int value, wxResourceTable *table = (wxResourceTable *) NULL);
-extern int WXDLLEXPORT wxResourceGetIdentifier(char *name, wxResourceTable *table = (wxResourceTable *) NULL);
+extern bool WXDLLEXPORT wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table = (wxResourceTable *) NULL);
+extern int WXDLLEXPORT wxResourceGetIdentifier(const wxString& name, wxResourceTable *table = (wxResourceTable *) NULL);
#endif
#endif
inline virtual void SetForegroundColour(const wxColour& col);
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
inline virtual wxButton *GetDefaultItem() const;
inline virtual void SetDefaultItem(wxButton *but);
// Resource loading
#if wxUSE_WX_RESOURCES
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
virtual void GetTextExtent(const wxString& string, int *x, int *y,
virtual void GetClientSizeConstraint(int *w, int *h) 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 ;
// Generates a new id for controls
wxColour m_backgroundColour ;
wxColour m_foregroundColour ;
- wxColour m_defaultBackgroundColour;
- wxColour m_defaultForegroundColour;
wxAcceleratorTable m_acceleratorTable;
#if wxUSE_DRAG_AND_DROP
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
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 void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
// 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
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.
long WXDLLEXPORT wxExecute(char **argv, bool sync = FALSE,
#include "wx/wxexpr.h"
// Forward (private) declarations
-bool wxResourceInterpretResources(wxResourceTable& table, PrologDatabase& db);
-wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, PrologExpr *expr, bool isPanel = FALSE);
-wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *expr);
-wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, PrologExpr *expr);
-wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, PrologExpr *expr);
-wxItemResource *wxResourceInterpretString(wxResourceTable& table, PrologExpr *expr);
-wxItemResource *wxResourceInterpretBitmap(wxResourceTable& table, PrologExpr *expr);
-wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, PrologExpr *expr);
+bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db);
+wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = FALSE);
+wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr);
+wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr);
+wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr);
+wxItemResource *wxResourceInterpretString(wxResourceTable& table, wxExpr *expr);
+wxItemResource *wxResourceInterpretBitmap(wxResourceTable& table, wxExpr *expr);
+wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr);
// Interpret list expression
-wxFont *wxResourceInterpretFontSpec(PrologExpr *expr);
+wxFont wxResourceInterpretFontSpec(wxExpr *expr);
-bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResourceTable *table = (wxResourceTable *) NULL);
-bool wxResourceParseIncludeFile(char *f, wxResourceTable *table = (wxResourceTable *) NULL);
+bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table = (wxResourceTable *) NULL);
+bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table = (wxResourceTable *) NULL);
wxResourceTable *wxDefaultResourceTable = (wxResourceTable *) NULL;
static long wxResourceBufferCount = 0;
static int wxResourceStringPtr = 0;
-void wxInitializeResourceSystem(void)
+void wxInitializeResourceSystem()
{
wxDefaultResourceTable = new wxResourceTable;
}
-void wxCleanUpResourceSystem(void)
+void wxCleanUpResourceSystem()
{
delete wxDefaultResourceTable;
if (wxResourceBuffer)
IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
#endif
-wxItemResource::wxItemResource(void)
+wxItemResource::wxItemResource()
{
- itemType = (char *) NULL;
- title = (char *) NULL;
- name = (char *) NULL;
- windowStyle = 0;
- x = y = width = height = 0;
- value1 = value2 = value3 = value5 = 0;
- value4 = (char *) NULL;
- stringValues = (wxStringList *) NULL;
- bitmap = (wxBitmap *) NULL;
- backgroundColour = labelColour = buttonColour = (wxColour *) NULL;
- windowFont = (wxFont *) NULL;
+ m_itemType = "";
+ m_title = "";
+ m_name = "";
+ m_windowStyle = 0;
+ m_x = m_y = m_width = m_height = 0;
+ m_value1 = m_value2 = m_value3 = m_value5 = 0;
+ m_value4 = "";
m_windowId = 0;
+ m_exStyle = 0;
}
-wxItemResource::~wxItemResource(void)
+wxItemResource::~wxItemResource()
{
- if (itemType) delete[] itemType;
- if (title) delete[] title;
- if (name) delete[] name;
- if (value4) delete[] value4;
- if (stringValues)
- delete stringValues;
- if (bitmap)
- delete bitmap;
- if (backgroundColour)
- delete backgroundColour;
- if (labelColour)
- delete labelColour;
- if (buttonColour)
- delete buttonColour;
- wxNode *node = children.First();
+ wxNode *node = m_children.First();
while (node)
{
wxItemResource *item = (wxItemResource *)node->Data();
delete item;
delete node;
- node = children.First();
+ node = m_children.First();
}
}
-void wxItemResource::SetTitle(char *t)
-{
- if (t == title)
- return;
-
- if (title) delete[] title;
- if (t)
- title = copystring(t);
- else
- title = (char *) NULL;
-}
-
-void wxItemResource::SetType(char *t)
-{
- if (itemType == t)
- return;
-
- if (itemType) delete[] itemType;
- if (t)
- itemType = copystring(t);
- else
- itemType = (char *) NULL;
-}
-
-void wxItemResource::SetName(char *n)
-{
- if (n == name)
- return;
-
- if (name) delete[] name;
- if (n)
- name = copystring(n);
- else
- name = (char *) NULL;
-}
-
-void wxItemResource::SetStringValues(wxStringList *svalues)
-{
- if (stringValues)
- delete stringValues;
- if (svalues)
- stringValues = svalues;
- else
- stringValues = (wxStringList *) NULL;
-}
-
-void wxItemResource::SetValue4(char *v)
-{
- if (value4 == v)
- return;
-
- if (value4) delete[] value4;
- if (v)
- value4 = copystring(v);
- else
- value4 = (char *) NULL;
-}
-
/*
* Resource table
*/
-wxResourceTable::wxResourceTable(void):wxHashTable(wxKEY_STRING), identifiers(wxKEY_STRING)
+wxResourceTable::wxResourceTable():wxHashTable(wxKEY_STRING), identifiers(wxKEY_STRING)
{
}
-wxResourceTable::~wxResourceTable(void)
+wxResourceTable::~wxResourceTable()
{
ClearTable();
}
void wxResourceTable::AddResource(wxItemResource *item)
{
- char *name = item->GetName();
- if (!name)
+ wxString name = item->GetName();
+ if (name == "")
name = item->GetTitle();
- if (!name)
+ if (name == "")
name = "no name";
// Delete existing resource, if any.
return FALSE;
}
-bool wxResourceTable::ParseResourceFile(char *filename)
+bool wxResourceTable::ParseResourceFile(const wxString& filename)
{
- PrologDatabase db;
+ wxExprDatabase db;
- FILE *fd = fopen(filename, "r");
+ FILE *fd = fopen((const char*) filename, "r");
if (!fd)
return FALSE;
bool eof = FALSE;
return wxResourceInterpretResources(*this, db);
}
-bool wxResourceTable::ParseResourceData(char *data)
+bool wxResourceTable::ParseResourceData(const wxString& data)
{
- PrologDatabase db;
- if (!db.ReadPrologFromString(data))
+ wxExprDatabase db;
+ if (!db.ReadFromString(data))
{
wxLogWarning(_("Ill-formed resource file syntax."));
return FALSE;
return wxResourceInterpretResources(*this, db);
}
-bool wxResourceTable::RegisterResourceBitmapData(char *name, char bits[], int width, int height)
+bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height)
{
// Register pre-loaded bitmap data
wxItemResource *item = new wxItemResource;
return TRUE;
}
-bool wxResourceTable::RegisterResourceBitmapData(char *name, char **data)
+bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char **data)
{
// Register pre-loaded bitmap data
wxItemResource *item = new wxItemResource;
return TRUE;
}
-bool wxResourceTable::SaveResource(char *WXUNUSED(filename))
+bool wxResourceTable::SaveResource(const wxString& WXUNUSED(filename))
{
return FALSE;
}
-void wxResourceTable::ClearTable(void)
+void wxResourceTable::ClearTable()
{
BeginFind();
wxNode *node = Next();
}
}
-wxControl *wxResourceTable::CreateItem(wxWindow *parent, wxItemResource *childResource) const
+wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* childResource, const wxItemResource* parentResource) const
{
int id = childResource->GetId();
if ( id == 0 )
id = -1;
+ bool dlgUnits = ((parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0);
+
wxControl *control = (wxControl *) NULL;
wxString itemType(childResource->GetType());
+
+ wxPoint pos;
+ wxSize size;
+ if (dlgUnits)
+ {
+ pos = parent->ConvertDialogToPixels(wxPoint(childResource->GetX(), childResource->GetY()));
+ size = parent->ConvertDialogToPixels(wxSize(childResource->GetWidth(), childResource->GetHeight()));
+ }
+ else
+ {
+ pos = wxPoint(childResource->GetX(), childResource->GetY());
+ size = wxSize(childResource->GetWidth(), childResource->GetHeight());
+ }
+
if (itemType == wxString("wxButton") || itemType == wxString("wxBitmapButton"))
{
- if (childResource->GetValue4())
+ if (childResource->GetValue4() != "")
{
// Bitmap button
- wxBitmap *bitmap = childResource->GetBitmap();
- if (!bitmap)
+ wxBitmap bitmap = childResource->GetBitmap();
+ if (!bitmap.Ok())
{
bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this);
- childResource->SetBitmap(bitmap);
+ ((wxItemResource*) childResource)->SetBitmap(bitmap);
}
- if (bitmap)
- control = new wxBitmapButton(parent, id, *bitmap,
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ if (bitmap.Ok())
+ control = new wxBitmapButton(parent, id, bitmap, pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
}
else
// Normal, text button
- control = new wxButton(parent, id, childResource->GetTitle(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxButton(parent, id, childResource->GetTitle(), pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
}
else if (itemType == wxString("wxMessage") || itemType == wxString("wxStaticText") ||
itemType == wxString("wxStaticBitmap"))
{
- if (childResource->GetValue4())
+ if (childResource->GetValue4() != "")
{
// Bitmap message
- wxBitmap *bitmap = childResource->GetBitmap();
- if (!bitmap)
+ wxBitmap bitmap = childResource->GetBitmap();
+ if (!bitmap.Ok())
{
bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this);
- childResource->SetBitmap(bitmap);
+ ((wxItemResource*) childResource)->SetBitmap(bitmap);
}
#if wxUSE_BITMAP_MESSAGE
- if (bitmap)
- control = new wxStaticBitmap(parent, id, *bitmap,
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ if (bitmap.Ok())
+ control = new wxStaticBitmap(parent, id, bitmap, pos, size,
childResource->GetStyle(), childResource->GetName());
#endif
}
else
{
- control = new wxStaticText(parent, id, childResource->GetTitle(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxStaticText(parent, id, childResource->GetTitle(), pos, size,
childResource->GetStyle(), childResource->GetName());
}
}
else if (itemType == wxString("wxText") || itemType == wxString("wxTextCtrl") || itemType == wxString("wxMultiText"))
{
- control = new wxTextCtrl(parent, id, childResource->GetValue4(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxTextCtrl(parent, id, childResource->GetValue4(), pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
}
else if (itemType == wxString("wxCheckBox"))
{
- control = new wxCheckBox(parent, id, childResource->GetTitle(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxCheckBox(parent, id, childResource->GetTitle(), pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
((wxCheckBox *)control)->SetValue((childResource->GetValue1() != 0));
#if wxUSE_GAUGE
else if (itemType == wxString("wxGauge"))
{
- control = new wxGauge(parent, id, (int)childResource->GetValue2(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxGauge(parent, id, (int)childResource->GetValue2(), pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
((wxGauge *)control)->SetValue((int)childResource->GetValue1());
else if (itemType == wxString("wxRadioButton"))
{
control = new wxRadioButton(parent, id, childResource->GetTitle(), // (int)childResource->GetValue1(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
}
#endif
#if wxUSE_SCROLLBAR
else if (itemType == wxString("wxScrollBar"))
{
- control = new wxScrollBar(parent, id,
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxScrollBar(parent, id, pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
((wxScrollBar *)control)->SetValue((int)childResource->GetValue1());
((wxScrollBar *)control)->SetPageSize((int)childResource->GetValue2());
else if (itemType == wxString("wxSlider"))
{
control = new wxSlider(parent, id, (int)childResource->GetValue1(),
- (int)childResource->GetValue2(), (int)childResource->GetValue3(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ (int)childResource->GetValue2(), (int)childResource->GetValue3(), pos, size,
childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
}
else if (itemType == wxString("wxGroupBox") || itemType == wxString("wxStaticBox"))
{
- control = new wxStaticBox(parent, id, childResource->GetTitle(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxStaticBox(parent, id, childResource->GetTitle(), pos, size,
childResource->GetStyle(), childResource->GetName());
}
else if (itemType == wxString("wxListBox"))
{
- wxStringList *stringList = childResource->GetStringValues();
+ wxStringList& stringList = childResource->GetStringValues();
wxString *strings = (wxString *) NULL;
int noStrings = 0;
- if (stringList && (stringList->Number() > 0))
+ if (stringList.Number() > 0)
{
- noStrings = stringList->Number();
+ noStrings = stringList.Number();
strings = new wxString[noStrings];
- wxNode *node = stringList->First();
+ wxNode *node = stringList.First();
int i = 0;
while (node)
{
node = node->Next();
}
}
- control = new wxListBox(parent, id,
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxListBox(parent, id, pos, size,
noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
if (strings)
}
else if (itemType == wxString("wxChoice"))
{
- wxStringList *stringList = childResource->GetStringValues();
+ wxStringList& stringList = childResource->GetStringValues();
wxString *strings = (wxString *) NULL;
int noStrings = 0;
- if (stringList && (stringList->Number() > 0))
+ if (stringList.Number() > 0)
{
- noStrings = stringList->Number();
+ noStrings = stringList.Number();
strings = new wxString[noStrings];
- wxNode *node = stringList->First();
+ wxNode *node = stringList.First();
int i = 0;
while (node)
{
node = node->Next();
}
}
- control = new wxChoice(parent, id,
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxChoice(parent, id, pos, size,
noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
if (strings)
#if wxUSE_COMBOBOX
else if (itemType == wxString("wxComboBox"))
{
- wxStringList *stringList = childResource->GetStringValues();
+ wxStringList& stringList = childResource->GetStringValues();
wxString *strings = (wxString *) NULL;
int noStrings = 0;
- if (stringList && (stringList->Number() > 0))
+ if (stringList.Number() > 0)
{
- noStrings = stringList->Number();
+ noStrings = stringList.Number();
strings = new wxString[noStrings];
- wxNode *node = stringList->First();
+ wxNode *node = stringList.First();
int i = 0;
while (node)
{
node = node->Next();
}
}
- control = new wxComboBox(parent, id, childResource->GetValue4(),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxComboBox(parent, id, childResource->GetValue4(), pos, size,
noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName());
if (strings)
#endif
else if (itemType == wxString("wxRadioBox"))
{
- wxStringList *stringList = childResource->GetStringValues();
+ wxStringList& stringList = childResource->GetStringValues();
wxString *strings = (wxString *) NULL;
int noStrings = 0;
- if (stringList && (stringList->Number() > 0))
+ if (stringList.Number() > 0)
{
- noStrings = stringList->Number();
+ noStrings = stringList.Number();
strings = new wxString[noStrings];
- wxNode *node = stringList->First();
+ wxNode *node = stringList.First();
int i = 0;
while (node)
{
node = node->Next();
}
}
- control = new wxRadioBox(parent, (wxWindowID) id, wxString(childResource->GetTitle()),
- wxPoint(childResource->GetX(), childResource->GetY()),
- wxSize(childResource->GetWidth(), childResource->GetHeight()),
+ control = new wxRadioBox(parent, (wxWindowID) id, wxString(childResource->GetTitle()), pos, size,
noStrings, strings, (int)childResource->GetValue1(), childResource->GetStyle(), wxDefaultValidator,
childResource->GetName());
delete[] strings;
}
- if (control && childResource->GetFont())
- control->SetFont(*childResource->GetFont());
+ if ((parentResource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
+ {
+ // Don't set font; will be inherited from parent.
+ }
+ else
+ {
+ if (control && childResource->GetFont().Ok())
+ control->SetFont(childResource->GetFont());
+ }
return control;
}
* Interpret database as a series of resources
*/
-bool wxResourceInterpretResources(wxResourceTable& table, PrologDatabase& db)
+bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db)
{
wxNode *node = db.First();
while (node)
{
- PrologExpr *clause = (PrologExpr *)node->Data();
+ wxExpr *clause = (wxExpr *)node->Data();
wxString functor(clause->Functor());
wxItemResource *item = (wxItemResource *) NULL;
if (item)
{
// Remove any existing resource of same name
- if (item->GetName())
+ if (item->GetName() != "")
table.DeleteResource(item->GetName());
table.AddResource(item);
}
return FALSE;
}
-wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, PrologExpr *expr, bool isPanel)
+wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel)
{
wxItemResource *dialogItem = new wxItemResource;
if (isPanel)
dialogItem->SetType("wxPanel");
else
dialogItem->SetType("wxDialog");
- char *style = (char *) NULL;
- char *title = (char *) NULL;
- char *name = (char *) NULL;
- char *backColourHex = (char *) NULL;
- char *labelColourHex = (char *) NULL;
- char *buttonColourHex = (char *) NULL;
+ wxString style = "";
+ wxString title = "";
+ wxString name = "";
+ wxString backColourHex = "";
+ wxString labelColourHex = "";
+ wxString buttonColourHex = "";
long windowStyle = wxDEFAULT_DIALOG_STYLE;
if (isPanel)
int x = 0; int y = 0; int width = -1; int height = -1;
int isModal = 0;
- PrologExpr *labelFontExpr = (PrologExpr *) NULL;
- PrologExpr *buttonFontExpr = (PrologExpr *) NULL;
- PrologExpr *fontExpr = (PrologExpr *) NULL;
- expr->AssignAttributeValue("style", &style);
- expr->AssignAttributeValue("name", &name);
- expr->AssignAttributeValue("title", &title);
- expr->AssignAttributeValue("x", &x);
- expr->AssignAttributeValue("y", &y);
- expr->AssignAttributeValue("width", &width);
- expr->AssignAttributeValue("height", &height);
- expr->AssignAttributeValue("modal", &isModal);
- expr->AssignAttributeValue("label_font", &labelFontExpr);
- expr->AssignAttributeValue("button_font", &buttonFontExpr);
- expr->AssignAttributeValue("font", &fontExpr);
- expr->AssignAttributeValue("background_colour", &backColourHex);
- expr->AssignAttributeValue("label_colour", &labelColourHex);
- expr->AssignAttributeValue("button_colour", &buttonColourHex);
+ wxExpr *labelFontExpr = (wxExpr *) NULL;
+ wxExpr *buttonFontExpr = (wxExpr *) NULL;
+ wxExpr *fontExpr = (wxExpr *) NULL;
+ expr->GetAttributeValue("style", style);
+ expr->GetAttributeValue("name", name);
+ expr->GetAttributeValue("title", title);
+ expr->GetAttributeValue("x", x);
+ expr->GetAttributeValue("y", y);
+ expr->GetAttributeValue("width", width);
+ expr->GetAttributeValue("height", height);
+ expr->GetAttributeValue("modal", isModal);
+ expr->GetAttributeValue("label_font", &labelFontExpr);
+ expr->GetAttributeValue("button_font", &buttonFontExpr);
+ expr->GetAttributeValue("font", &fontExpr);
+ expr->GetAttributeValue("background_colour", backColourHex);
+ expr->GetAttributeValue("label_colour", labelColourHex);
+ expr->GetAttributeValue("button_colour", buttonColourHex);
+
+ int useDialogUnits = 0;
+ expr->GetAttributeValue("use_dialog_units", useDialogUnits);
+ if (useDialogUnits != 0)
+ dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_DIALOG_UNITS);
+
+ int useDefaults = 0;
+ expr->GetAttributeValue("use_system_defaults", useDefaults);
+ if (useDefaults != 0)
+ dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_USE_DEFAULTS);
long id = 0;
expr->GetAttributeValue("id", id);
dialogItem->SetId(id);
- if (style)
+ if (style != "")
{
windowStyle = wxParseWindowStyle(style);
}
dialogItem->SetStyle(windowStyle);
dialogItem->SetValue1(isModal);
- if (name)
- dialogItem->SetName(name);
- if (title)
- dialogItem->SetTitle(title);
+ dialogItem->SetName(name);
+ dialogItem->SetTitle(title);
dialogItem->SetSize(x, y, width, height);
- if (backColourHex)
+ if (backColourHex != "")
{
int r = 0;
int g = 0;
int b = 0;
- r = wxHexToDec(backColourHex);
- g = wxHexToDec(backColourHex+2);
- b = wxHexToDec(backColourHex+4);
- dialogItem->SetBackgroundColour(new wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
- delete[] backColourHex;
+ r = wxHexToDec(backColourHex.Mid(0, 2));
+ g = wxHexToDec(backColourHex.Mid(2, 2));
+ b = wxHexToDec(backColourHex.Mid(4, 2));
+ dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
}
- if (labelColourHex)
+ if (labelColourHex != "")
{
int r = 0;
int g = 0;
int b = 0;
- r = wxHexToDec(labelColourHex);
- g = wxHexToDec(labelColourHex+2);
- b = wxHexToDec(labelColourHex+4);
- dialogItem->SetLabelColour(new wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
- delete[] labelColourHex;
+ r = wxHexToDec(labelColourHex.Mid(0, 2));
+ g = wxHexToDec(labelColourHex.Mid(2, 2));
+ b = wxHexToDec(labelColourHex.Mid(4, 2));
+ dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
}
- if (buttonColourHex)
+ if (buttonColourHex != "")
{
int r = 0;
int g = 0;
int b = 0;
- r = wxHexToDec(buttonColourHex);
- g = wxHexToDec(buttonColourHex+2);
- b = wxHexToDec(buttonColourHex+4);
- dialogItem->SetButtonColour(new wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
- delete[] buttonColourHex;
+ r = wxHexToDec(buttonColourHex.Mid(0, 2));
+ g = wxHexToDec(buttonColourHex.Mid(2, 2));
+ b = wxHexToDec(buttonColourHex.Mid(4, 2));
+ dialogItem->SetButtonColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
}
- if (name)
- delete[] name;
- if (title)
- delete[] title;
- if (style)
- delete[] style;
-
if (fontExpr)
dialogItem->SetFont(wxResourceInterpretFontSpec(fontExpr));
else if (buttonFontExpr)
dialogItem->SetFont(wxResourceInterpretFontSpec(labelFontExpr));
// Now parse all controls
- PrologExpr *controlExpr = expr->GetFirst();
+ wxExpr *controlExpr = expr->GetFirst();
while (controlExpr)
{
if (controlExpr->Number() == 3)
if (controlKeyword != "" && controlKeyword == "control")
{
// The value part: always a list.
- PrologExpr *listExpr = controlExpr->Nth(2);
+ wxExpr *listExpr = controlExpr->Nth(2);
if (listExpr->Type() == PrologList)
{
wxItemResource *controlItem = wxResourceInterpretControl(table, listExpr);
return dialogItem;
}
-wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *expr)
+wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
{
wxItemResource *controlItem = new wxItemResource;
int x = 0; int y = 0; int width = -1; int height = -1;
int count = 0;
- PrologExpr *expr1 = expr->Nth(0);
+ wxExpr *expr1 = expr->Nth(0);
if ( expr1->Type() == PrologString || expr1->Type() == PrologWord )
{
else
{
wxString str(expr1->StringValue());
- id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
+ id = wxResourceGetIdentifier(str, &table);
if (id == 0)
{
wxLogWarning(_("Could not resolve control class or id '%s'. "
if (expr1)
{
style = expr1->StringValue();
- windowStyle = wxParseWindowStyle(WXSTRINGCAST style);
+ windowStyle = wxParseWindowStyle(style);
}
expr1 = expr->Nth(count);
height = (int)expr1->IntegerValue();
controlItem->SetStyle(windowStyle);
- controlItem->SetName(WXSTRINGCAST name);
- controlItem->SetTitle(WXSTRINGCAST title);
+ controlItem->SetName(name);
+ controlItem->SetTitle(title);
controlItem->SetSize(x, y, width, height);
- controlItem->SetType(WXSTRINGCAST controlType);
+ controlItem->SetType(controlType);
controlItem->SetId(id);
if (controlType == "wxButton")
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
{
wxString str(expr->Nth(count)->StringValue());
- controlItem->SetValue4(WXSTRINGCAST str);
+ controlItem->SetValue4(str);
count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
{
wxString str(expr->Nth(count)->StringValue());
- controlItem->SetValue4(WXSTRINGCAST str);
+ controlItem->SetValue4(str);
count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
{
wxString str(expr->Nth(count)->StringValue());
- controlItem->SetValue4(WXSTRINGCAST str);
+ controlItem->SetValue4(str);
count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
}
else if (controlType == "wxListBox")
{
- PrologExpr *valueList = (PrologExpr *) NULL;
+ wxExpr *valueList = (wxExpr *) NULL;
if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList))
{
- wxStringList *stringList = new wxStringList;
- PrologExpr *stringExpr = valueList->GetFirst();
+ wxStringList stringList;
+ wxExpr *stringExpr = valueList->GetFirst();
while (stringExpr)
{
- stringList->Add(stringExpr->StringValue());
+ stringList.Add(stringExpr->StringValue());
stringExpr = stringExpr->GetNext();
}
controlItem->SetStringValues(stringList);
count ++;
// Check for wxSINGLE/wxMULTIPLE
- PrologExpr *mult = (PrologExpr *) NULL;
+ wxExpr *mult = (wxExpr *) NULL;
controlItem->SetValue1(wxLB_SINGLE);
if ((mult = expr->Nth(count)) && ((mult->Type() == PrologString)||(mult->Type() == PrologWord)))
{
}
else if (controlType == "wxChoice")
{
- PrologExpr *valueList = (PrologExpr *) NULL;
+ wxExpr *valueList = (wxExpr *) NULL;
// Check for default value list
if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList))
{
- wxStringList *stringList = new wxStringList;
- PrologExpr *stringExpr = valueList->GetFirst();
+ wxStringList stringList;
+ wxExpr *stringExpr = valueList->GetFirst();
while (stringExpr)
{
- stringList->Add(stringExpr->StringValue());
+ stringList.Add(stringExpr->StringValue());
stringExpr = stringExpr->GetNext();
}
controlItem->SetStringValues(stringList);
#if wxUSE_COMBOBOX
else if (controlType == "wxComboBox")
{
- PrologExpr *textValue = expr->Nth(count);
+ wxExpr *textValue = expr->Nth(count);
if (textValue && (textValue->Type() == PrologString || textValue->Type() == PrologWord))
{
wxString str(textValue->StringValue());
- controlItem->SetValue4(WXSTRINGCAST str);
+ controlItem->SetValue4(str);
count ++;
- PrologExpr *valueList = (PrologExpr *) NULL;
+ wxExpr *valueList = (wxExpr *) NULL;
// Check for default value list
if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList))
{
- wxStringList *stringList = new wxStringList;
- PrologExpr *stringExpr = valueList->GetFirst();
+ wxStringList stringList;
+ wxExpr *stringExpr = valueList->GetFirst();
while (stringExpr)
{
- stringList->Add(stringExpr->StringValue());
+ stringList.Add(stringExpr->StringValue());
stringExpr = stringExpr->GetNext();
}
controlItem->SetStringValues(stringList);
#if 1
else if (controlType == "wxRadioBox")
{
- PrologExpr *valueList = (PrologExpr *) NULL;
+ wxExpr *valueList = (wxExpr *) NULL;
// Check for default value list
if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList))
{
- wxStringList *stringList = new wxStringList;
- PrologExpr *stringExpr = valueList->GetFirst();
+ wxStringList stringList;
+ wxExpr *stringExpr = valueList->GetFirst();
while (stringExpr)
{
- stringList->Add(stringExpr->StringValue());
+ stringList.Add(stringExpr->StringValue());
stringExpr = stringExpr->GetNext();
}
controlItem->SetStringValues(stringList);
}
// Forward declaration
-wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, PrologExpr *expr);
+wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr);
/*
* Interpet a menu item
*/
-wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, PrologExpr *expr)
+wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr)
{
wxItemResource *item = new wxItemResource;
- PrologExpr *labelExpr = expr->Nth(0);
- PrologExpr *idExpr = expr->Nth(1);
- PrologExpr *helpExpr = expr->Nth(2);
- PrologExpr *checkableExpr = expr->Nth(3);
+ wxExpr *labelExpr = expr->Nth(0);
+ wxExpr *idExpr = expr->Nth(1);
+ wxExpr *helpExpr = expr->Nth(2);
+ wxExpr *checkableExpr = expr->Nth(3);
// Further keywords/attributes to follow sometime...
if (expr->Number() == 0)
if (labelExpr)
{
wxString str(labelExpr->StringValue());
- item->SetTitle(WXSTRINGCAST str);
+ item->SetTitle(str);
}
if (idExpr)
{
if ((idExpr->Type() == PrologString) || (idExpr->Type() == PrologWord))
{
wxString str(idExpr->StringValue());
- id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
+ id = wxResourceGetIdentifier(str, &table);
if (id == 0)
{
wxLogWarning(_("Could not resolve menu id '%s'. "
if (helpExpr)
{
wxString str(helpExpr->StringValue());
- item->SetValue4(WXSTRINGCAST str);
+ item->SetValue4(str);
}
if (checkableExpr)
item->SetValue2(checkableExpr->IntegerValue());
// Find the first expression that's a list, for submenu
- PrologExpr *subMenuExpr = expr->GetFirst();
+ wxExpr *subMenuExpr = expr->GetFirst();
while (subMenuExpr && (subMenuExpr->Type() != PrologList))
subMenuExpr = subMenuExpr->GetNext();
* Interpret a nested list as a menu
*/
/*
-wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, PrologExpr *expr)
+wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr)
{
wxItemResource *menu = new wxItemResource;
// menu->SetType(wxTYPE_MENU);
menu->SetType("wxMenu");
- PrologExpr *element = expr->GetFirst();
+ wxExpr *element = expr->GetFirst();
while (element)
{
wxItemResource *item = wxResourceInterpretMenuItem(table, element);
}
*/
-wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, PrologExpr *expr)
+wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr)
{
- PrologExpr *listExpr = (PrologExpr *) NULL;
- expr->AssignAttributeValue("menu", &listExpr);
+ wxExpr *listExpr = (wxExpr *) NULL;
+ expr->GetAttributeValue("menu", &listExpr);
if (!listExpr)
return (wxItemResource *) NULL;
if (!menuResource)
return (wxItemResource *) NULL;
-
- char *name = (char *) NULL;
- expr->AssignAttributeValue("name", &name);
- if (name)
+
+ wxString name;
+ if (expr->GetAttributeValue("name", name))
{
menuResource->SetName(name);
- delete[] name;
}
return menuResource;
}
-wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, PrologExpr *expr)
+wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr)
{
- PrologExpr *listExpr = (PrologExpr *) NULL;
- expr->AssignAttributeValue("menu", &listExpr);
+ wxExpr *listExpr = (wxExpr *) NULL;
+ expr->GetAttributeValue("menu", &listExpr);
if (!listExpr)
return (wxItemResource *) NULL;
resource->SetType("wxMenu");
// resource->SetType(wxTYPE_MENU);
- PrologExpr *element = listExpr->GetFirst();
+ wxExpr *element = listExpr->GetFirst();
while (element)
{
wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr);
element = element->GetNext();
}
- char *name = (char *) NULL;
- expr->AssignAttributeValue("name", &name);
- if (name)
+ wxString name;
+ if (expr->GetAttributeValue("name", name))
{
resource->SetName(name);
- delete[] name;
}
return resource;
}
-wxItemResource *wxResourceInterpretString(wxResourceTable& WXUNUSED(table), PrologExpr *WXUNUSED(expr))
+wxItemResource *wxResourceInterpretString(wxResourceTable& WXUNUSED(table), wxExpr *WXUNUSED(expr))
{
return (wxItemResource *) NULL;
}
-wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), PrologExpr *expr)
+wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxExpr *expr)
{
wxItemResource *bitmapItem = new wxItemResource;
// bitmapItem->SetType(wxTYPE_BITMAP);
bitmapItem->SetType("wxBitmap");
- char *name = (char *) NULL;
- expr->AssignAttributeValue("name", &name);
- if (name)
+ wxString name;
+ if (expr->GetAttributeValue("name", name))
{
bitmapItem->SetName(name);
- delete[] name;
}
// Now parse all bitmap specifications
- PrologExpr *bitmapExpr = expr->GetFirst();
+ wxExpr *bitmapExpr = expr->GetFirst();
while (bitmapExpr)
{
if (bitmapExpr->Number() == 3)
if (bitmapKeyword == "bitmap" || bitmapKeyword == "icon")
{
// The value part: always a list.
- PrologExpr *listExpr = bitmapExpr->Nth(2);
+ wxExpr *listExpr = bitmapExpr->Nth(2);
if (listExpr->Type() == PrologList)
{
wxItemResource *bitmapSpec = new wxItemResource;
// List is of form: [filename, bitmaptype, platform, colours, xresolution, yresolution]
// where everything after 'filename' is optional.
- PrologExpr *nameExpr = listExpr->Nth(0);
- PrologExpr *typeExpr = listExpr->Nth(1);
- PrologExpr *platformExpr = listExpr->Nth(2);
- PrologExpr *coloursExpr = listExpr->Nth(3);
- PrologExpr *xresExpr = listExpr->Nth(4);
- PrologExpr *yresExpr = listExpr->Nth(5);
+ wxExpr *nameExpr = listExpr->Nth(0);
+ wxExpr *typeExpr = listExpr->Nth(1);
+ wxExpr *platformExpr = listExpr->Nth(2);
+ wxExpr *coloursExpr = listExpr->Nth(3);
+ wxExpr *xresExpr = listExpr->Nth(4);
+ wxExpr *yresExpr = listExpr->Nth(5);
if (nameExpr && nameExpr->StringValue())
{
- wxString str(nameExpr->StringValue());
- bitmapSpec->SetName(WXSTRINGCAST str);
+ bitmapSpec->SetName(nameExpr->StringValue());
}
if (typeExpr && typeExpr->StringValue())
{
- wxString str(typeExpr->StringValue());
- bitmapSpec->SetValue1(wxParseWindowStyle(WXSTRINGCAST str));
+ bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue()));
}
else
bitmapSpec->SetValue1(0);
return bitmapItem;
}
-wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, PrologExpr *expr)
+wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr)
{
wxItemResource *item = wxResourceInterpretBitmap(table, expr);
if (item)
}
// Interpret list expression as a font
-wxFont *wxResourceInterpretFontSpec(PrologExpr *expr)
+wxFont wxResourceInterpretFontSpec(wxExpr *expr)
{
if (expr->Type() != PrologList)
- return (wxFont *) NULL;
+ return wxNullFont;
int point = 10;
int family = wxSWISS;
int underline = 0;
wxString faceName("");
- PrologExpr *pointExpr = expr->Nth(0);
- PrologExpr *familyExpr = expr->Nth(1);
- PrologExpr *styleExpr = expr->Nth(2);
- PrologExpr *weightExpr = expr->Nth(3);
- PrologExpr *underlineExpr = expr->Nth(4);
- PrologExpr *faceNameExpr = expr->Nth(5);
+ wxExpr *pointExpr = expr->Nth(0);
+ wxExpr *familyExpr = expr->Nth(1);
+ wxExpr *styleExpr = expr->Nth(2);
+ wxExpr *weightExpr = expr->Nth(3);
+ wxExpr *underlineExpr = expr->Nth(4);
+ wxExpr *faceNameExpr = expr->Nth(5);
if (pointExpr)
point = (int)pointExpr->IntegerValue();
if (familyExpr)
{
str = familyExpr->StringValue();
- family = (int)wxParseWindowStyle(WXSTRINGCAST str);
+ family = (int)wxParseWindowStyle(str);
}
if (styleExpr)
{
str = styleExpr->StringValue();
- style = (int)wxParseWindowStyle(WXSTRINGCAST str);
+ style = (int)wxParseWindowStyle(str);
}
if (weightExpr)
{
str = weightExpr->StringValue();
- weight = (int)wxParseWindowStyle(WXSTRINGCAST str);
+ weight = (int)wxParseWindowStyle(str);
}
if (underlineExpr)
underline = (int)underlineExpr->IntegerValue();
if (faceNameExpr)
faceName = faceNameExpr->StringValue();
- char *faceName1 = (char *) NULL;
- if (faceName != "")
- faceName1 = WXSTRINGCAST faceName;
- wxFont *font = wxTheFontList->FindOrCreateFont(point, family, style, weight, (underline != 0), faceName1);
+ wxFont font(point, family, style, weight, (underline != 0), faceName);
return font;
}
* (Re)allocate buffer for reading in from resource file
*/
-bool wxReallocateResourceBuffer(void)
+bool wxReallocateResourceBuffer()
{
if (!wxResourceBuffer)
{
with possible comments.
*/
-bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResourceTable *table)
+bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
* "wxSYSTEM_MENU | wxBORDER" -> integer
*/
-char *wxResourceParseWord(char *s, int *i)
+char* wxResourceParseWord(char*s, int *i)
{
if (!s)
- return (char *) NULL;
+ return (char*) NULL;
static char buf[150];
int len = strlen(s);
}
*i = ii;
if (j == 0)
- return (char *) NULL;
+ return (char*) NULL;
else
return buf;
}
static int wxResourceBitListCount = (sizeof(wxResourceBitListTable)/sizeof(wxResourceBitListStruct));
-long wxParseWindowStyle(char *bitListString)
+long wxParseWindowStyle(const wxString& bitListString)
{
int i = 0;
char *word;
long bitList = 0;
- while ((word = wxResourceParseWord(bitListString, &i)))
+ while ((word = wxResourceParseWord((char*) (const char*) bitListString, &i)))
{
bool found = FALSE;
int j;
* depth and appropriate type.
*/
-wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
+wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
{
if (!item->GetType() || strcmp(item->GetType(), "wxBitmap") != 0)
{
- wxLogWarning(_("%s not a bitmap resource specification."), resource);
- return (wxBitmap *) NULL;
+ wxLogWarning(_("%s not a bitmap resource specification."), (const char*) resource);
+ return wxNullBitmap;
}
int thisDepth = wxDisplayDepth();
long thisNoColours = (long)pow(2.0, (double)thisDepth);
}
// If no matching resource, fail.
if (!optResource)
- return (wxBitmap *) NULL;
+ return wxNullBitmap;
- char *name = optResource->GetName();
+ wxString name = optResource->GetName();
int bitmapType = (int)optResource->GetValue1();
- wxBitmap *bitmap = (wxBitmap *) NULL;
switch (bitmapType)
{
case wxBITMAP_TYPE_XBM_DATA:
if (!item)
{
wxLogWarning(_("Failed to find XBM resource %s.\n"
- "Forgot to use wxResourceLoadBitmapData?"), name);
+ "Forgot to use wxResourceLoadBitmapData?"), (const char*) name);
return (wxBitmap *) NULL;
}
- bitmap = new wxBitmap((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
+ return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ;
#else
wxLogWarning(_("No XBM facility available!"));
#endif
if (!item)
{
wxLogWarning(_("Failed to find XPM resource %s.\n"
- "Forgot to use wxResourceLoadBitmapData?"), name);
+ "Forgot to use wxResourceLoadBitmapData?"), (const char*) name);
return (wxBitmap *) NULL;
}
- bitmap = new wxBitmap(item->GetValue1());
+ return wxBitmap(item->GetValue1());
#else
wxLogWarning(_("No XPM facility available!"));
#endif
}
default:
{
- bitmap = new wxBitmap(name, bitmapType);
+ return wxBitmap(name, bitmapType);
break;
}
}
- if (!bitmap)
- return (wxBitmap *) NULL;
-
- if (bitmap->Ok())
- {
- return bitmap;
- }
- else
- {
- delete bitmap;
- return (wxBitmap *) NULL;
- }
+ return wxNullBitmap;
}
else
{
- wxLogWarning(_("Bitmap resource specification %s not found."), resource);
- return (wxBitmap *) NULL;
+ wxLogWarning(_("Bitmap resource specification %s not found."), (const char*) resource);
+ return wxNullBitmap;
}
}
* depth and appropriate type.
*/
-wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
+wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
{
if (!table)
- table = wxDefaultResourceTable;
+ table = wxDefaultResourceTable;
wxItemResource *item = table->FindResource(resource);
if (item)
{
- if (!item->GetType() || strcmp(item->GetType(), "wxIcon") != 0)
+ if ((item->GetType() == "") || strcmp(item->GetType(), "wxIcon") != 0)
{
- wxLogWarning(_("%s not an icon resource specification."), resource);
- return (wxIcon *) NULL;
+ wxLogWarning(_("%s not an icon resource specification."), (const char*) resource);
+ return wxNullIcon;
}
int thisDepth = wxDisplayDepth();
long thisNoColours = (long)pow(2.0, (double)thisDepth);
}
// If no matching resource, fail.
if (!optResource)
- return (wxIcon *) NULL;
+ return wxNullIcon;
- char *name = optResource->GetName();
+ wxString name = optResource->GetName();
int bitmapType = (int)optResource->GetValue1();
- wxIcon *icon = (wxIcon *) NULL;
switch (bitmapType)
{
case wxBITMAP_TYPE_XBM_DATA:
if (!item)
{
wxLogWarning(_("Failed to find XBM resource %s.\n"
- "Forgot to use wxResourceLoadIconData?"), name);
+ "Forgot to use wxResourceLoadIconData?"), (const char*) name);
return (wxIcon *) NULL;
}
- icon = new wxIcon((char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
+ return wxIcon((char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
#else
wxLogWarning(_("No XBM facility available!"));
#endif
wxLogWarning(buf);
return NULL;
}
- icon = new wxIcon((char **)item->GetValue1());
+ return wxIcon((char **)item->GetValue1());
#else
wxLogWarning(_("No XPM facility available!"));
#endif
default:
{
#ifdef __WXGTK__
- wxLogWarning(_("Icon resource specification %s not found."), resource);
+ wxLogWarning(_("Icon resource specification %s not found."), (const char*) resource);
#else
- icon = new wxIcon(name, bitmapType);
+ return wxIcon(name, bitmapType);
#endif
break;
}
}
- if (!icon)
- return (wxIcon *) NULL;
-
- if (icon->Ok())
- {
- return icon;
- }
- else
- {
- delete icon;
- return (wxIcon *) NULL;
- }
+ return wxNullIcon;
}
else
{
- wxLogWarning(_("Icon resource specification %s not found."), resource);
+ wxLogWarning(_("Icon resource specification %s not found."), (const char*) resource);
return (wxIcon *) NULL;
}
}
while (node)
{
wxItemResource *child = (wxItemResource *)node->Data();
- if (child->GetType() && strcmp(child->GetType(), "wxMenuSeparator") == 0)
+ if ((child->GetType() != "") && (child->GetType() == "wxMenuSeparator"))
menu->AppendSeparator();
else if (child->GetChildren().Number() > 0)
{
return menu;
}
-wxMenuBar *wxResourceCreateMenuBar(char *resource, wxResourceTable *table, wxMenuBar *menuBar)
+wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table, wxMenuBar *menuBar)
{
if (!table)
table = wxDefaultResourceTable;
wxItemResource *menuResource = table->FindResource(resource);
- if (menuResource && menuResource->GetType() && strcmp(menuResource->GetType(), "wxMenu") == 0)
+ if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu"))
{
if (!menuBar)
menuBar = new wxMenuBar;
return (wxMenuBar *) NULL;
}
-wxMenu *wxResourceCreateMenu(char *resource, wxResourceTable *table)
+wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
wxItemResource *menuResource = table->FindResource(resource);
- if (menuResource && menuResource->GetType() && strcmp(menuResource->GetType(), "wxMenu") == 0)
+ if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu"))
// if (menuResource && (menuResource->GetType() == wxTYPE_MENU))
return wxResourceCreateMenu(menuResource);
return (wxMenu *) NULL;
}
// Global equivalents (so don't have to refer to default table explicitly)
-bool wxResourceParseData(char *resource, wxResourceTable *table)
+bool wxResourceParseData(const wxString& resource, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
return table->ParseResourceData(resource);
}
-bool wxResourceParseFile(char *filename, wxResourceTable *table)
+bool wxResourceParseFile(const wxString& filename, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
}
// Register XBM/XPM data
-bool wxResourceRegisterBitmapData(char *name, char bits[], int width, int height, wxResourceTable *table)
+bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
return table->RegisterResourceBitmapData(name, bits, width, height);
}
-bool wxResourceRegisterBitmapData(char *name, char **data, wxResourceTable *table)
+bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
* Identifiers
*/
-bool wxResourceAddIdentifier(char *name, int value, wxResourceTable *table)
+bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
return TRUE;
}
-int wxResourceGetIdentifier(char *name, wxResourceTable *table)
+int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
* Parse #include file for #defines (only)
*/
-bool wxResourceParseIncludeFile(char *f, wxResourceTable *table)
+bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
}
}
-static int ungetc_string(void)
+static int ungetc_string()
{
wxResourceStringPtr --;
return 0;
with possible comments.
*/
-bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxResourceTable *table)
+bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
}
}
- PrologDatabase db;
+ wxExprDatabase db;
wxResourceStringPtr = 0;
bool eof = FALSE;
! ((strcmp(resource->GetType(), "wxDialog") == 0) || (strcmp(resource->GetType(), "wxPanel") == 0)))
return FALSE;
- char *title = resource->GetTitle();
+ wxString title(resource->GetTitle());
long theWindowStyle = resource->GetStyle();
bool isModal = (resource->GetValue1() != 0);
int x = resource->GetX();
int y = resource->GetY();
int width = resource->GetWidth();
int height = resource->GetHeight();
- char *name = resource->GetName();
-
- wxFont *theFont = resource->GetFont();
+ wxString name = resource->GetName();
if (IsKindOf(CLASSINFO(wxDialog)))
{
wxDialog *dialogBox = (wxDialog *)this;
- long modalStyle = isModal ? wxDIALOG_MODAL : 0;
+ long modalStyle = isModal ? wxDIALOG_MODAL : 0;
if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name))
return FALSE;
- dialogBox->SetClientSize(width, height);
+
+ // Only reset the client size if we know we're not going to do it again below.
+ if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0)
+ dialogBox->SetClientSize(width, height);
+ }
+ else if (IsKindOf(CLASSINFO(wxPanel)))
+ {
+ wxPanel* panel = (wxPanel *)this;
+ if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name))
+ return FALSE;
}
else
{
- if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name))
+ if (!this->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name))
return FALSE;
}
- if (theFont)
- SetFont(*theFont);
+ if ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
+ {
+ // No need to do this since it's done in wxPanel or wxDialog constructor.
+ // SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+ }
+ else
+ {
+ if (resource->GetFont().Ok())
+ SetFont(resource->GetFont());
+ if (resource->GetBackgroundColour().Ok())
+ SetBackgroundColour(resource->GetBackgroundColour());
+ }
- if (resource->GetBackgroundColour())
- SetBackgroundColour(*resource->GetBackgroundColour());
+ // Should have some kind of font at this point
+ if (!GetFont()->Ok())
+ SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+ if (!GetBackgroundColour().Ok())
+ SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
+
+ // Only when we've created the window and set the font can we set the correct size,
+ // if based on dialog units.
+ if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
+ {
+ wxSize sz = ConvertDialogToPixels(wxSize(width, height));
+ SetClientSize(sz.x, sz.y);
+
+ wxPoint pt = ConvertDialogToPixels(wxPoint(x, y));
+ Move(pt.x, pt.y);
+ }
- // TODO
- if (resource->GetLabelColour())
- SetForegroundColour(*resource->GetLabelColour());
- else if (resource->GetButtonColour())
- SetForegroundColour(*resource->GetButtonColour());
-
// Now create children
wxNode *node = resource->GetChildren().First();
while (node)
{
wxItemResource *childResource = (wxItemResource *)node->Data();
- (void) CreateItem(childResource, table);
+ (void) CreateItem(childResource, resource, table);
node = node->Next();
}
return TRUE;
}
-wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxResourceTable *table)
+wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table)
{
if (!table)
table = wxDefaultResourceTable;
- return table->CreateItem((wxWindow *)this, (wxItemResource *)resource);
+ return table->CreateItem((wxWindow *)this, resource, parentResource);
}
#endif // wxUSE_WX_RESOURCES
// Set it to grey (or other 3D face colour)
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_3DFACE));
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
{ m_lastX = 7; m_lastY = 3; }
'C', 'D', 'E', 'F' };
// Convert 2-digit hex number to decimal
-int wxHexToDec(char *buf)
+int wxHexToDec(const wxString& buf)
{
int firstDigit, secondDigit;
- if (buf[0] >= 'A')
- firstDigit = buf[0] - 'A' + 10;
+ if (buf.GetChar(0) >= 'A')
+ firstDigit = buf.GetChar(0) - 'A' + 10;
else
- firstDigit = buf[0] - '0';
+ firstDigit = buf.GetChar(0) - '0';
- if (buf[1] >= 'A')
- secondDigit = buf[1] - 'A' + 10;
+ if (buf.GetChar(1) >= 'A')
+ secondDigit = buf.GetChar(1) - 'A' + 10;
else
- secondDigit = buf[1] - '0';
+ secondDigit = buf.GetChar(1) - '0';
return firstDigit * 16 + secondDigit;
}
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
bool
StringMatch (char *str1, char *str2, bool subString, bool exact)
}
}
}
+
+// 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;
+}
+
if ( ret ) {
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
}
void wxPanel::OnSysColourChanged(wxSysColourChangedEvent& event)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
Refresh();
// Propagate the event to the non-top-level children
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
SetName(name);
SetValidator(validator);
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
SetName(name);
SetValidator(validator);
m_caretWidth = 0; m_caretHeight = 0;
m_caretEnabled = 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_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
#if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL;
else
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_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_windowStyle = style;
parent->AddChild(this);
- m_backgroundColour = parent->GetDefaultBackgroundColour() ;
- m_foregroundColour = parent->GetDefaultForegroundColour() ;
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = style;
m_marginX = 0;
m_marginY = 0;
SetValidator(validator);
parent->AddChild((wxButton *)this);
- m_backgroundColour = parent->GetDefaultBackgroundColour() ;
- m_foregroundColour = parent->GetDefaultForegroundColour() ;
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = (long&)style;
SetValidator(validator);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style;
SetValidator(validator);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style;
if ( id == -1 )
SetName(name);
SetValidator(validator);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_noStrings = n;
m_windowStyle = style;
SetName(name);
SetValidator(validator);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_noStrings = n;
m_windowStyle = style;
m_modalShowing = FALSE;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
}
bool wxDialog::Create(wxWindow *parent, wxWindowID id,
const wxString& name)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetName(name);
if (!parent)
Ctl3dColorChange();
#else
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
Refresh();
#endif
}
m_rangeMax = range;
m_gaugePos = 0;
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style;
m_rangeMax = range;
m_gaugePos = 0;
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style;
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
void wxListBox::SetupColours(void)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(GetParent()->GetDefaultForegroundColour());
+ SetForegroundColour(GetParent()->GetForegroundColour());
}
void wxListBox::SetFirstItem(int N)
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
if (parent) parent->AddChild(this);
m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
m_foregroundColour = *wxBLACK ;
- m_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
-
// style
m_windowStyle = style | wxTAB_TRAVERSAL;
SetValidator(val);
parent->AddChild(this);
- m_backgroundColour = parent->GetDefaultBackgroundColour() ;
- m_foregroundColour = parent->GetDefaultForegroundColour() ;
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = (long&)style;
SetValidator(val);
parent->AddChild(this);
- m_backgroundColour = parent->GetDefaultBackgroundColour() ;
- m_foregroundColour = parent->GetDefaultForegroundColour() ;
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
m_windowStyle = (long&)style;
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour());
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetBackgroundColour(parent->GetBackgroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
if ( id == -1 )
m_windowId = (int)NewControlId();
SetValidator(validator);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour());
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetBackgroundColour(parent->GetBackgroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
if ( id == -1 )
m_windowId = (int)NewControlId();
SetName(name);
SetValidator(validator);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style;
if ( id == -1 )
SetValidator(validator);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_staticValue = 0;
m_staticMin = 0;
SetValidator(validator);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_staticValue = 0;
m_staticMin = 0;
long style, const wxString& name)
{
wxSystemSettings settings;
- m_backgroundColour = parent->GetDefaultBackgroundColour() ;
- m_foregroundColour = parent->GetDefaultForegroundColour() ;
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
SetName(name);
SetName(name);
if (parent) parent->AddChild(this);
- m_backgroundColour = parent->GetDefaultBackgroundColour() ;
- m_foregroundColour = parent->GetDefaultForegroundColour() ;
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
if ( id == -1 )
m_windowId = (int)NewControlId();
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
if ( id == -1 )
m_windowId = (int)NewControlId();
SetName(name);
if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
if ( id == -1 )
m_windowId = (int)NewControlId();
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
m_foregroundColour = *wxBLACK ;
- m_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
- GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
-
SetName(name);
int x = pos.x;
{
m_backgroundColour = wxColour(GetRValue(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
// CreateTools();
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
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)
wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports horizontal orientation.", "wxToolBar95 usage", wxOK);
m_maxWidth = -1;
{
m_backgroundColour = wxColour(GetRValue(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
CreateTools();
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
if ( id == -1 )
m_windowId = (int)NewControlId();
void wxTextCtrl::SetupColours(void)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(GetParent()->GetDefaultForegroundColour());
+ SetForegroundColour(GetParent()->GetForegroundColour());
}
wxString wxTextCtrl::GetValue(void) const
{
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
SetName(name);
SetValidator(validator);
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_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
/*
wxColour(GetRValue(GetSysColor(COLOR_WINDOW)),
wxSystemSettings settings;
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
+ // m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_foregroundColour = *wxBLACK;
- m_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_windowStyle = style;
m_caretWidth = 0; m_caretHeight = 0;
m_caretEnabled = 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_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
#if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL;
else
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_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_windowStyle = style;
BEGIN_EVENT_TABLE(wxResourceEditorDialogHandler, wxEvtHandler)
EVT_PAINT(wxResourceEditorDialogHandler::OnPaint)
EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent)
+ EVT_SIZE(wxResourceEditorDialogHandler::OnSize)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxResourceEditorControlHandler, wxEvtHandler)
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.
void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event)
{
OnRightClick(x, y, keys);
}
+ else if (event.LeftDClick())
+ {
+ if (m_mouseCaptured)
+ {
+ handlerDialog->ReleaseMouse();
+ m_mouseCaptured = FALSE;
+ }
+ wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog);
+ }
}
else
event.Skip();
handlerControl->GetPosition(&xpos, &ypos);
handlerControl->GetSize(&width, &height);
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl);
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl->GetParent());
+
if (selectionHandle > 0)
{
int x1, y1, width1, height1;
break;
}
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
{
- handlerControl->Move((int)(x - dragOffsetX), (int)(y - dragOffsetY));
- OldOnMove((int)(x - dragOffsetX), (int)(y - dragOffsetY));
+ int newX = (int)(x - dragOffsetX);
+ 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
wxNode *node = panel->GetChildren()->First();
item->Move(x2, y2);
((wxResourceEditorControlHandler *)item->GetEventHandler())->OldOnMove(x2, y2);
((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();
void OnPaint(wxPaintEvent& event);
void OnMouseEvent(wxMouseEvent& event);
+ void OnSize(wxSizeEvent& event);
virtual void OnItemEvent(wxControl *win, wxMouseEvent& event);
virtual void OnLeftClick(int x, int y, int keys);
{
}
-void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event)
+void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event))
{
#if 0
long sel = GetSelection();
#endif
}
-void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& event)
+void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{
long sel = GetSelection();
if (sel == -1)
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
DisassociateResource(res);
else
{
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);
}
{
m_resourceAssociations.BeginFind();
wxNode *node;
- while (node = m_resourceAssociations.Next())
+ while ((node = m_resourceAssociations.Next()))
{
wxWindow *w = (wxWindow *)node->Data();
if (w == win)
wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title)
{
+ /*
int frameWidth = 420;
int frameHeight = 300;
+ */
wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title,
wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y),
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType());
resource->SetType("wxDialog");
resource->SetName(buf);
resource->SetTitle(buf);
+ resource->SetResourceStyle(wxRESOURCE_USE_DEFAULTS);
+ resource->SetResourceStyle(wxRESOURCE_DIALOG_UNITS);
wxString newIdName;
int id = GenerateWindowId("ID_DIALOG", newIdName);
m_resourceTable.AddResource(resource);
+ wxSize size(400, 300);
+
wxPanel *panel = new wxPanel(m_editorPanel, -1,
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;
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
// we don't dereference invalid pointers.
wxItemResource *res = new wxItemResource;
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);
wxString prefix;
wxString names[] = { "One", "Two" };
newItem = new wxRadioBox(panel, -1, "Radiobox", wxPoint(x, y), wxSize(-1, -1), 2, names, 2,
wxHORIZONTAL, wxDefaultValidator, buf);
- res->SetStringValues(new wxStringList("One", "Two", NULL));
+ res->SetStringValues(wxStringList("One", "Two", NULL));
}
else if (itemType == "wxRadioButton")
{
InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE);
wxDialog* dialog = new wxDialog;
- long oldStyle = item->GetStyle();
bool success = FALSE;
-// item->SetStyle(wxDEFAULT_DIALOG_STYLE);
if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable))
{
dialog->Centre();
dialog->ShowModal();
success = TRUE;
}
-// item->SetStyle(oldStyle);
return success;
}
return FALSE;
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
wxWindow *win = FindWindowForResource(res);
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();
if (item->GetParent() == win)
int firstW, firstH;
firstSelection->GetPosition(&firstX, &firstY);
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();
if (item->GetParent() == win)
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *thisRes = (wxItemResource *)node->Data();
if (thisRes->GetChildren().Member(res))
// If this is a button or message resource, delete the
// associate bitmap resource if not being used.
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())
{
PossiblyDeleteBitmapResource(res->GetValue4());
}
+*/
// Remove symbol from table if appropriate
if (!IsSymbolUsed(res, res->GetId()))
// Will eventually have bitmap type information, for different
// kinds of bitmap.
-char *wxResourceManager::AddBitmapResource(char *filename)
+wxString wxResourceManager::AddBitmapResource(const wxString& filename)
{
wxItemResource *resource = FindBitmapResourceByFilename(filename);
if (!resource)
if (resource)
return resource->GetName();
else
- return NULL;
+ return wxEmptyString;
}
// 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))
{
}
}
-bool wxResourceManager::IsBitmapResourceUsed(char *resourceName)
+bool wxResourceManager::IsBitmapResourceUsed(const wxString& resourceName)
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType());
}
// Given a wxButton or wxMessage, find the corresponding bitmap filename.
-char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource)
+wxString wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource)
{
- if (!resource || !resource->GetValue4())
- return NULL;
+ if (!resource || (resource->GetValue4() == ""))
+ return wxEmptyString;
wxItemResource *bitmapResource = m_resourceTable.FindResource(resource->GetValue4());
if (!bitmapResource)
- return NULL;
+ return wxEmptyString;
wxNode *node = bitmapResource->GetChildren().First();
while (node)
node = node->Next();
}
- return NULL;
+ return wxEmptyString;
}
-wxItemResource *wxResourceManager::FindBitmapResourceByFilename(char *filename)
+wxItemResource *wxResourceManager::FindBitmapResourceByFilename(const wxString& filename)
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType());
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType());
wxWindow *newWin = NULL;
wxWindow *parent = win->GetParent();
+ wxItemResource* parentResource = NULL;
+ if (parent)
+ FindResourceForWindow(parent);
if (win->IsKindOf(CLASSINFO(wxPanel)))
{
win->PopEventHandler(TRUE);
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));
AssociateResource(resource, newWin);
UpdateResourceList();
return TRUE;
}
-bool wxResourceManager::EditDialog(wxDialog *dialog, wxWindow *parent)
+bool wxResourceManager::EditDialog(wxDialog *WXUNUSED(dialog), wxWindow *WXUNUSED(parent))
{
return FALSE;
}
{
m_resourceTable.BeginFind();
wxNode *node;
- while (node = m_resourceTable.Next())
+ while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
wxString resType(res->GetType());
if (!childWindow)
{
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);
}
else
{
}
-bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled)
+bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled))
{
wxResourceManager *manager = wxResourceManager::GetCurrentResourceManager();
m_styleTable.Init();
}
virtual bool Save(const wxString& filename);
- virtual bool SaveResource(ostream& stream, wxItemResource *item);
+ virtual bool SaveResource(ostream& stream, wxItemResource* item, wxItemResource* parentItem);
void GeneratePanelStyleString(long windowStyle, char *buf);
void GenerateDialogStyleString(long windowStyle, char *buf);
bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle);
*/
- void OutputFont(ostream& stream, wxFont *font);
- wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource);
+ void OutputFont(ostream& stream, const wxFont& font);
+ wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource);
protected:
wxWindowStyleTable m_styleTable;
virtual bool DeleteResource(wxWindow *win);
// Add bitmap resource if there isn't already one with this filename.
- virtual char *AddBitmapResource(char *filename);
+ virtual wxString AddBitmapResource(const wxString& filename);
// Delete the bitmap resource if it isn't being used by another resource.
- virtual void PossiblyDeleteBitmapResource(char *resourceName);
+ virtual void PossiblyDeleteBitmapResource(const wxString& resourceName);
// Helper function for above
- virtual bool IsBitmapResourceUsed(char *resourceName);
+ virtual bool IsBitmapResourceUsed(const wxString& resourceName);
- wxItemResource *FindBitmapResourceByFilename(char *filename);
+ wxItemResource *FindBitmapResourceByFilename(const wxString& filename);
- char *FindBitmapFilenameForResource(wxItemResource *resource);
+ wxString FindBitmapFilenameForResource(wxItemResource *resource);
// Is this window identifier in use?
bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;
#include "reseditr.h"
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
// 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)
wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item);
return item;
}
-void wxResourceTableWithSaving::OutputFont(ostream& stream, wxFont *font)
+void wxResourceTableWithSaving::OutputFont(ostream& stream, const wxFont& font)
{
- stream << "[" << font->GetPointSize() << ", '";
- stream << font->GetFamilyString() << "', '";
- stream << font->GetStyleString() << "', '";
- stream << font->GetWeightString() << "', ";
- stream << (int)font->GetUnderlined();
- if (font->GetFaceName() != "")
- stream << ", '" << font->GetFaceName() << "'";
+ stream << "[" << font.GetPointSize() << ", '";
+ stream << font.GetFamilyString() << "', '";
+ stream << font.GetStyleString() << "', '";
+ stream << font.GetWeightString() << "', ";
+ stream << (int)font.GetUnderlined();
+ if (font.GetFaceName() != "")
+ stream << ", '" << font.GetFaceName() << "'";
stream << "]";
}
BeginFind();
wxNode *node = NULL;
- while (node = Next())
+ while ((node = Next()))
{
wxItemResource *item = (wxItemResource *)node->Data();
wxString resType(item->GetType());
if (resType == "wxDialogBox" || resType == "wxDialog" || resType == "wxPanel" || resType == "wxBitmap")
{
- if (!SaveResource(stream, item))
+ if (!SaveResource(stream, item, (wxItemResource*) NULL))
return FALSE;
}
}
return TRUE;
}
-bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *item)
+bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource* item, wxItemResource* parentItem)
{
char styleBuf[400];
wxString itemType(item->GetType());
stream << "static char *" << item->GetName() << " = \"panel(name = '" << item->GetName() << "',\\\n";
GenerateDialogStyleString(item->GetStyle(), styleBuf);
}
+
stream << " style = '" << styleBuf << "',\\\n";
stream << " title = '" << item->GetTitle() << "',\\\n";
stream << " id = " << item->GetId() << ",\\\n";
if (1) // item->GetStyle() & wxNO_3D)
{
- if (item->GetBackgroundColour())
+ if (item->GetBackgroundColour().Ok())
{
char buf[7];
- wxDecToHex(item->GetBackgroundColour()->Red(), buf);
- wxDecToHex(item->GetBackgroundColour()->Green(), buf+2);
- wxDecToHex(item->GetBackgroundColour()->Blue(), buf+4);
+ wxDecToHex(item->GetBackgroundColour().Red(), buf);
+ wxDecToHex(item->GetBackgroundColour().Green(), buf+2);
+ wxDecToHex(item->GetBackgroundColour().Blue(), buf+4);
buf[6] = 0;
stream << ",\\\n " << "background_colour = '" << buf << "'";
}
}
+
+ 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() && item->GetFont()->Ok())
+ if (item->GetFont().Ok())
{
stream << ",\\\n font = ";
OutputFont(stream, item->GetFont());
stream << " control = [";
- SaveResource(stream, child);
+ SaveResource(stream, child, item);
stream << "]";
stream << item->GetWidth() << ", " << item->GetHeight();
if (item->GetValue4())
stream << ", '" << item->GetValue4() << "'";
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
stream << item->GetWidth() << ", " << item->GetHeight();
if (item->GetValue4())
stream << ", '" << item->GetValue4() << "'";
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1();
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1();
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
stream << item->GetId() << ", " << "wxStaticBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight();
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << SafeWord(item->GetValue4());
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1() << ", " << item->GetValue2();
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight();
stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3();
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
// Default list of values
stream << ", [";
- if (item->GetStringValues())
+ if (item->GetStringValues().Number() > 0)
{
- wxNode *node = item->GetStringValues()->First();
+ wxNode *node = item->GetStringValues().First();
while (node)
{
char *s = (char *)node->Data();
break;
}
}
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
// Default list of values
stream << ", [";
- if (item->GetStringValues())
+ if (item->GetStringValues().Number() > 0)
{
- wxNode *node = item->GetStringValues()->First();
+ wxNode *node = item->GetStringValues().First();
while (node)
{
char *s = (char *)node->Data();
}
}
stream << "]";
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
// Default list of values
stream << ", [";
- if (item->GetStringValues())
+ if (item->GetStringValues().Number() > 0)
{
- wxNode *node = item->GetStringValues()->First();
+ wxNode *node = item->GetStringValues().First();
while (node)
{
char *s = (char *)node->Data();
}
}
stream << "], " << item->GetValue1();
- if (item->GetFont())
+ if (item->GetFont().Ok())
{
stream << ",\\\n ";
OutputFont(stream, item->GetFont());
}
// Returns quoted string or "NULL"
-char *SafeString(char *s)
+char *SafeString(const wxString& s)
{
- if (!s)
+ if (s == "")
return "NULL";
else
{
}
// Returns quoted string or ''
-char *SafeWord(char *s)
+char *SafeWord(const wxString& s)
{
- if (!s)
+ if (s == "")
return "''";
else
{
strcpy(wxBuffer, "'");
- strcat(wxBuffer, s);
+ strcat(wxBuffer, (const char*) s);
strcat(wxBuffer, "'");
return wxBuffer;
}
str.UngetWriteBuf();
// Look for #define occurrences
- size_t pos = str.Find("#define");
+ int pos = str.Find("#define");
while (pos != -1)
{
size_t len = str.Length();
// IF the property value was modified.
if (property->GetValue().GetModified())
{
- propertyInfo->SetProperty(property->GetName(), property);
+ m_propertyInfo->SetProperty(property->GetName(), property);
property->GetValue().SetModified(FALSE);
+ wxResourceManager::GetCurrentResourceManager()->Modify(TRUE);
}
}
// Edit the information represented by this object, whatever that
// might be.
-bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
+bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
{
if (sm_propertyWindow)
{
wxSize(width, height), wxDEFAULT_FRAME_STYLE);
sm_propertyWindow = propWin;
- propWin->m_registry.RegisterValidator((wxString)"real", new wxRealListValidator);
- propWin->m_registry.RegisterValidator((wxString)"string", new wxStringListValidator);
- propWin->m_registry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
- propWin->m_registry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
- propWin->m_registry.RegisterValidator((wxString)"filename", new wxFilenameListValidator);
- propWin->m_registry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
- propWin->m_registry.RegisterValidator((wxString)"window_id", new wxResourceSymbolValidator);
+ propWin->m_registry.RegisterValidator(wxString("real"), new wxRealListValidator);
+ propWin->m_registry.RegisterValidator(wxString("string"), new wxStringListValidator);
+ propWin->m_registry.RegisterValidator(wxString("integer"), new wxIntegerListValidator);
+ propWin->m_registry.RegisterValidator(wxString("bool"), new wxBoolListValidator);
+ propWin->m_registry.RegisterValidator(wxString("filename"), new wxFilenameListValidator);
+ propWin->m_registry.RegisterValidator(wxString("stringlist"), new wxListOfStringsListValidator);
+ propWin->m_registry.RegisterValidator(wxString("window_id"), new wxResourceSymbolValidator);
propWin->m_propInfo = this;
propWin->m_propSheet = propSheet;
-// view->propertyWindow = propWin;
+// view->m_propertyWindow = propWin;
view->AddRegistry(&(propWin->m_registry));
propWin->Initialize();
wxWindowPropertyInfo::wxWindowPropertyInfo(wxWindow *win, wxItemResource *res)
{
- propertyWindow = win;
- propertyResource = res;
+ m_propertyWindow = win;
+ m_propertyResource = res;
}
wxWindowPropertyInfo::~wxWindowPropertyInfo(void)
wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
{
- wxFont *font = propertyWindow->GetFont();
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+
+ wxFont *font = m_propertyWindow->GetFont();
if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" ||
name == "fontUnderlined")
return GetFontProperty(name, font);
else if (name == "name")
- return new wxProperty("name", propertyWindow->GetName(), "string");
+ return new wxProperty("name", m_propertyWindow->GetName(), "string");
else if (name == "title")
- return new wxProperty("title", propertyWindow->GetTitle(), "string");
+ return new wxProperty("title", m_propertyWindow->GetTitle(), "string");
else if (name == "x")
{
- int x, y;
- propertyWindow->GetPosition(&x, &y);
- return new wxProperty("x", (long)x, "integer");
+ return new wxProperty("x", (long)resource->GetX(), "integer");
}
else if (name == "y")
{
- int x, y;
- propertyWindow->GetPosition(&x, &y);
- return new wxProperty("y", (long)y, "integer");
+ return new wxProperty("y", (long)resource->GetY(), "integer");
}
else if (name == "width")
{
- int width, height;
- propertyWindow->GetSize(&width, &height);
- return new wxProperty("width", (long)width, "integer");
+ return new wxProperty("width", (long)resource->GetWidth(), "integer");
}
else if (name == "height")
{
- int width, height;
- propertyWindow->GetSize(&width, &height);
- return new wxProperty("height", (long)height, "integer");
+ return new wxProperty("width", (long)resource->GetHeight(), "integer");
}
else if (name == "id")
{
- wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
if (resource)
{
int id = resource->GetId();
else if (name == "border")
{
wxString border("");
- if (propertyWindow->GetWindowStyleFlag() & wxSIMPLE_BORDER)
+ if (m_propertyWindow->GetWindowStyleFlag() & wxSIMPLE_BORDER)
border = "wxSIMPLE_BORDER";
- else if (propertyWindow->GetWindowStyleFlag() & wxRAISED_BORDER)
+ else if (m_propertyWindow->GetWindowStyleFlag() & wxRAISED_BORDER)
border = "wxRAISED_BORDER";
- else if (propertyWindow->GetWindowStyleFlag() & wxSUNKEN_BORDER)
+ else if (m_propertyWindow->GetWindowStyleFlag() & wxSUNKEN_BORDER)
border = "wxSUNKEN_BORDER";
- else if (propertyWindow->GetWindowStyleFlag() & wxDOUBLE_BORDER)
+ else if (m_propertyWindow->GetWindowStyleFlag() & wxDOUBLE_BORDER)
border = "wxDOUBLE_BORDER";
- else if (propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER)
+ else if (m_propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER)
border = "wxSTATIC_BORDER";
else
border = "wxNO_BORDER";
bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxFont *font = propertyWindow->GetFont();
+ wxFont *font = m_propertyWindow->GetFont();
if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" ))
{
wxFont *newFont = SetFontProperty(name, property, font);
if (newFont)
- propertyWindow->SetFont(newFont);
+ m_propertyWindow->SetFont(newFont);
return TRUE;
}
else if (name == "name")
{
// Remove old name from resource table, if it's there.
- wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(propertyWindow->GetName());
+ wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(m_propertyWindow->GetName());
if (oldResource)
{
// It's a top-level resource
- propertyWindow->SetName(property->GetValue().StringValue());
+ m_propertyWindow->SetName(property->GetValue().StringValue());
oldResource->SetName(property->GetValue().StringValue());
- wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(propertyWindow->GetName(), oldResource);
+ wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(m_propertyWindow->GetName(), oldResource);
}
else
{
// It's a child of something; just set the name of the resource and the window.
- propertyWindow->SetName(property->GetValue().StringValue());
- propertyResource->SetName(property->GetValue().StringValue());
+ m_propertyWindow->SetName(property->GetValue().StringValue());
+ m_propertyResource->SetName(property->GetValue().StringValue());
}
// Refresh the resource manager list, because the name changed.
wxResourceManager::GetCurrentResourceManager()->UpdateResourceList();
}
else if (name == "title")
{
- propertyWindow->SetTitle(property->GetValue().StringValue());
+ m_propertyWindow->SetTitle(property->GetValue().StringValue());
return TRUE;
}
else if (name == "x")
{
int x, y;
- propertyWindow->GetPosition(&x, &y);
+ m_propertyWindow->GetPosition(&x, &y);
int newX = (int)property->GetValue().IntegerValue();
+
+ // We need to convert to pixels if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ {
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(newX, y));
+ newX = pt.x;
+ }
+ }
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(newX, y));
+ newX = pt.x;
+ }
+ }
+
if (x != newX)
- propertyWindow->Move(newX, y);
+ m_propertyWindow->Move(newX, y);
return TRUE;
}
else if (name == "y")
{
int x, y;
- propertyWindow->GetPosition(&x, &y);
+ m_propertyWindow->GetPosition(&x, &y);
int newY = (int)property->GetValue().IntegerValue();
+
+ // We need to convert to pixels if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ {
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(x, newY));
+ newY = pt.y;
+ }
+ }
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY));
+ newY = pt.y;
+ }
+ }
+
if (y != newY)
- propertyWindow->Move(x, newY);
+ m_propertyWindow->Move(x, newY);
return TRUE;
}
else if (name == "width")
{
int width, height;
- propertyWindow->GetSize(&width, &height);
+ m_propertyWindow->GetSize(&width, &height);
int newWidth = (int)property->GetValue().IntegerValue();
+
+ // We need to convert to pixels if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ {
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height));
+ newWidth = sz.x;
+ }
+ }
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height));
+ newWidth = sz.x;
+ }
+ }
+
if (width != newWidth)
{
- propertyWindow->SetSize(newWidth, height);
-/*
- if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
- {
- propertyWindow->GetParent()->SetClientSize(newWidth, height);
- }
-*/
+ m_propertyWindow->SetSize(newWidth, height);
}
return TRUE;
}
else if (name == "height")
{
int width, height;
- propertyWindow->GetSize(&width, &height);
+ m_propertyWindow->GetSize(&width, &height);
int newHeight = (int)property->GetValue().IntegerValue();
+
+ // We need to convert to pixels if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ {
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight));
+ newHeight = sz.y;
+ }
+ }
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight));
+ newHeight = sz.y;
+ }
+ }
+
if (height != newHeight)
{
- propertyWindow->SetSize(width, newHeight);
-/*
- if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
- {
- propertyWindow->GetParent()->SetClientSize(width, newHeight);
- }
-*/
+ m_propertyWindow->SetSize(width, newHeight);
}
return TRUE;
}
else if (name == "id")
{
- wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
if (resource)
{
wxString value = property->GetValue().StringValue();
else
borderStyle = wxNO_BORDER;
- SetWindowStyle(propertyWindow, wxSIMPLE_BORDER, FALSE);
- SetWindowStyle(propertyWindow, wxRAISED_BORDER, FALSE);
- SetWindowStyle(propertyWindow, wxSUNKEN_BORDER, FALSE);
- SetWindowStyle(propertyWindow, wxDOUBLE_BORDER, FALSE);
- SetWindowStyle(propertyWindow, wxSTATIC_BORDER, FALSE);
- SetWindowStyle(propertyWindow, wxNO_BORDER, FALSE);
+ SetWindowStyle(m_propertyWindow, wxSIMPLE_BORDER, FALSE);
+ SetWindowStyle(m_propertyWindow, wxRAISED_BORDER, FALSE);
+ SetWindowStyle(m_propertyWindow, wxSUNKEN_BORDER, FALSE);
+ SetWindowStyle(m_propertyWindow, wxDOUBLE_BORDER, FALSE);
+ SetWindowStyle(m_propertyWindow, wxSTATIC_BORDER, FALSE);
+ SetWindowStyle(m_propertyWindow, wxNO_BORDER, FALSE);
- SetWindowStyle(propertyWindow, borderStyle, TRUE);
+ SetWindowStyle(m_propertyWindow, borderStyle, TRUE);
- wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
- resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
return TRUE;
}
else
names.Add("width");
names.Add("height");
names.Add("border");
- if (!propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ if (!m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
{
names.Add("fontPoints");
names.Add("fontFamily");
// Fill in the wxItemResource members to mirror the current window settings
bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
{
-// resource->SetType(propertyWindow->GetClassInfo()->GetClassName());
-
-// resource->SetStyle(propertyWindow->GetWindowStyleFlag());
- wxString str(propertyWindow->GetName());
- resource->SetName(WXSTRINGCAST str);
+// resource->SetType(m_propertyWindow->GetClassInfo()->GetClassName());
+
+// resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
+ wxString str(m_propertyWindow->GetName());
+ resource->SetName(str);
+
+#if 0
int x, y, w, h;
- propertyWindow->GetSize(&w, &h);
- propertyWindow->GetPosition(&x, &y);
+ if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ m_propertyWindow->GetClientSize(&w, &h);
+ else
+ m_propertyWindow->GetSize(&w, &h);
+
+ m_propertyWindow->GetPosition(&x, &y);
+
+ // We need to convert to dialog units if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+ {
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y));
+ x = pt.x; y = pt.y;
+ wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h));
+ w = sz.x; h = sz.y;
+ }
+ }
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxPoint pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(x, y));
+ x = pt.x; y = pt.y;
+ wxSize sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(w, h));
+ w = sz.x; h = sz.y;
+ }
+ }
+
resource->SetSize(x, y, w, h);
+#endif
+
return TRUE;
}
wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
{
- wxControl *itemWindow = (wxControl *)propertyWindow;
+ wxControl *itemWindow = (wxControl *)m_propertyWindow;
wxFont *font = itemWindow->GetFont();
if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" ||
name == "fontUnderlined")
return GetFontProperty(name, font);
else if (name == "label" && itemWindow->GetLabel())
- return new wxProperty("label", propertyWindow->GetLabel(), "string");
+ return new wxProperty("label", m_propertyWindow->GetLabel(), "string");
else
return wxWindowPropertyInfo::GetProperty(name);
}
bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxControl *itemWindow = (wxControl *)propertyWindow;
+ wxControl *itemWindow = (wxControl *)m_propertyWindow;
wxFont *font = itemWindow->GetFont();
if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" ))
{
wxWindowPropertyInfo::InstantiateResource(resource);
- wxControl *item = (wxControl *)propertyWindow;
+ wxControl *item = (wxControl *)m_propertyWindow;
wxString str(item->GetLabel());
- resource->SetTitle(WXSTRINGCAST str);
+ resource->SetTitle(str);
if (item->GetFont() && item->GetFont()->Ok())
resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(),
item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(),
wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name)
{
- wxButton *button = (wxButton *)propertyWindow;
return wxItemPropertyInfo::GetProperty(name);
}
bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxButton *button = (wxButton *)propertyWindow;
return wxItemPropertyInfo::SetProperty(name, property);
}
wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
{
- wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
+ wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
if (name == "label")
{
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
if (resource)
{
- char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
- if (filename)
- str = filename;
+ str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
}
return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
}
bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
+ wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
if (name == "label")
{
char *s = property->GetValue().StringValue();
if (resource)
{
wxString oldResource(resource->GetValue4());
- char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+ wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
resource->SetValue4(resName);
if (!oldResource.IsNull())
- wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
+ wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource);
}
button->SetLabel(bitmap);
wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name)
{
- wxStaticText *message = (wxStaticText *)propertyWindow;
return wxItemPropertyInfo::GetProperty(name);
}
bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxStaticText *message = (wxStaticText *)propertyWindow;
return wxItemPropertyInfo::SetProperty(name, property);
}
wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
{
- wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
+ wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
if (name == "label")
{
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
if (resource)
{
- char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
- if (filename)
- str = filename;
+ str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
}
return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
}
bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
+ wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
if (name == "label")
{
char *s = property->GetValue().StringValue();
if (resource)
{
wxString oldResource(resource->GetValue4());
- char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+ wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
resource->SetValue4(resName);
if (!oldResource.IsNull())
- wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
+ wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource);
}
message->SetBitmap(bitmap);
wxProperty *wxTextPropertyInfo::GetProperty(wxString& name)
{
- wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
+ wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
if (name == "value")
return new wxProperty("value", text->GetValue(), "string");
else if (name == "password")
bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
+ wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
if (name == "value")
{
text->SetValue(property->GetValue().StringValue());
bool wxTextPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
+ wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
wxString str(text->GetValue());
- resource->SetValue4(WXSTRINGCAST str);
+ resource->SetValue4(str);
return wxItemPropertyInfo::InstantiateResource(resource);
}
wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
{
- wxListBox *listBox = (wxListBox *)propertyWindow;
+ wxListBox *listBox = (wxListBox *)m_propertyWindow;
if (name == "values")
{
wxStringList *stringList = new wxStringList;
}
else if (name == "multiple")
{
- char *pos = NULL;
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
if (!resource)
return NULL;
bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxListBox *listBox = (wxListBox *)propertyWindow;
+ wxListBox *listBox = (wxListBox *)m_propertyWindow;
if (name == "values")
{
listBox->Clear();
bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxListBox *lbox = (wxListBox *)propertyWindow;
+ wxListBox *lbox = (wxListBox *)m_propertyWindow;
// This will be set for the wxItemResource on reading or in SetProperty
// resource->SetValue1(lbox->GetSelectionMode());
int i;
resource->SetStringValues(NULL);
else
{
- wxStringList *slist = new wxStringList;
+ wxStringList slist;
for (i = 0; i < lbox->Number(); i++)
- slist->Add(lbox->GetString(i));
+ slist.Add(lbox->GetString(i));
resource->SetStringValues(slist);
}
wxProperty *wxChoicePropertyInfo::GetProperty(wxString& name)
{
- wxChoice *choice = (wxChoice *)propertyWindow;
+ wxChoice *choice = (wxChoice *)m_propertyWindow;
if (name == "values")
{
- wxStringList *stringList = new wxStringList;
+ wxStringList* stringList = new wxStringList;
int i;
for (i = 0; i < choice->Number(); i++)
stringList->Add(choice->GetString(i));
bool wxChoicePropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxChoice *choice = (wxChoice *)propertyWindow;
+ wxChoice *choice = (wxChoice *)m_propertyWindow;
if (name == "values")
{
choice->Clear();
bool wxChoicePropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxChoice *choice = (wxChoice *)propertyWindow;
+ wxChoice *choice = (wxChoice *)m_propertyWindow;
int i;
if (choice->Number() == 0)
resource->SetStringValues(NULL);
else
{
- wxStringList *slist = new wxStringList;
+ wxStringList slist;
for (i = 0; i < choice->Number(); i++)
- slist->Add(choice->GetString(i));
+ slist.Add(choice->GetString(i));
resource->SetStringValues(slist);
}
wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name)
{
- wxComboBox *choice = (wxComboBox *)propertyWindow;
+ wxComboBox *choice = (wxComboBox *)m_propertyWindow;
if (name == "values")
{
wxStringList *stringList = new wxStringList;
}
else if (name == "sort")
{
- bool sort = ((propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT);
+ bool sort = ((m_propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT);
return new wxProperty(name, sort, "bool");
}
else if (name == "style")
{
wxString styleStr("dropdown");
- if (propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE)
+ if (m_propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE)
styleStr = "simple";
- else if (propertyWindow->GetWindowStyleFlag() & wxCB_READONLY)
+ else if (m_propertyWindow->GetWindowStyleFlag() & wxCB_READONLY)
styleStr = "readonly";
else
styleStr = "dropdown";
bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxComboBox *choice = (wxComboBox *)propertyWindow;
+ wxComboBox *choice = (wxComboBox *)m_propertyWindow;
if (name == "values")
{
choice->Clear();
}
else if (name == "sort")
{
- SetWindowStyle(propertyWindow, wxCB_SORT, property->GetValue().BoolValue());
+ SetWindowStyle(m_propertyWindow, wxCB_SORT, property->GetValue().BoolValue());
- wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
- resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
- wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(propertyWindow, this);
+ wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
return TRUE;
}
else if (name == "style")
{
- SetWindowStyle(propertyWindow, wxCB_SIMPLE, FALSE);
- SetWindowStyle(propertyWindow, wxCB_DROPDOWN, FALSE);
- SetWindowStyle(propertyWindow, wxCB_READONLY, FALSE);
+ SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, FALSE);
+ SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, FALSE);
+ SetWindowStyle(m_propertyWindow, wxCB_READONLY, FALSE);
wxString styleStr(property->GetValue().StringValue());
if (styleStr == "simple")
- SetWindowStyle(propertyWindow, wxCB_SIMPLE, TRUE);
+ SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, TRUE);
else if (styleStr == "dropdown")
- SetWindowStyle(propertyWindow, wxCB_DROPDOWN, TRUE);
+ SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, TRUE);
else if (styleStr == "readonly")
- SetWindowStyle(propertyWindow, wxCB_READONLY, TRUE);
+ SetWindowStyle(m_propertyWindow, wxCB_READONLY, TRUE);
// Necesary?
- wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
- resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
- wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(propertyWindow, this);
+ wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
return TRUE;
}
bool wxComboBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxComboBox *choice = (wxComboBox *)propertyWindow;
+ wxComboBox *choice = (wxComboBox *)m_propertyWindow;
int i;
if (choice->Number() == 0)
resource->SetStringValues(NULL);
else
{
- wxStringList *slist = new wxStringList;
+ wxStringList slist;
for (i = 0; i < choice->Number(); i++)
- slist->Add(choice->GetString(i));
+ slist.Add(choice->GetString(i));
resource->SetStringValues(slist);
}
wxProperty *wxRadioBoxPropertyInfo::GetProperty(wxString& name)
{
- wxRadioBox *radioBox = (wxRadioBox *)propertyWindow;
+ wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow;
if (name == "numberRowsOrCols")
{
return new wxProperty("numberRowsOrCols", (long)radioBox->GetNumberOfRowsOrCols(), "integer");
if (name == "orientation")
{
wxString orient;
- if (propertyWindow->GetWindowStyleFlag() & wxRA_HORIZONTAL)
+ if (m_propertyWindow->GetWindowStyleFlag() & wxRA_HORIZONTAL)
orient = "wxRA_HORIZONTAL";
else
orient = "wxRA_VERTICAL";
bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxRadioBox *radioBox = (wxRadioBox *)propertyWindow;
+ wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow;
if (name == "numberRowsOrCols")
{
radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
// Set property into *resource*, not wxRadioBox, and then recreate
// the wxRadioBox. This is because we can't dynamically set the strings
// of a wxRadioBox.
- wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
if (!resource)
return FALSE;
- wxStringList *stringList = resource->GetStringValues();
- if (!stringList)
- {
- stringList = new wxStringList;
- resource->SetStringValues(stringList);
- }
- stringList->Clear();
-
+ wxStringList stringList;
wxPropertyValue *expr = property->GetValue().GetFirst();
while (expr)
{
char *s = expr->StringValue();
if (s)
- stringList->Add(s);
+ stringList.Add(s);
expr = expr->GetNext();
}
+ resource->SetStringValues(stringList);
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
return TRUE;
}
bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxRadioBox *rbox = (wxRadioBox *)propertyWindow;
+ wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
// Take strings from resource instead
/*
int i;
wxProperty *wxGroupBoxPropertyInfo::GetProperty(wxString& name)
{
- wxStaticBox *groupBox = (wxStaticBox *)propertyWindow;
return wxItemPropertyInfo::GetProperty(name);
}
bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxStaticBox *gbox = (wxStaticBox *)propertyWindow;
return wxItemPropertyInfo::InstantiateResource(resource);
}
wxProperty *wxCheckBoxPropertyInfo::GetProperty(wxString& name)
{
- wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
+ wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
if (name == "value")
return new wxProperty("value", checkBox->GetValue(), "bool");
else
bool wxCheckBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
+ wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
if (name == "value")
{
checkBox->SetValue((bool)property->GetValue().BoolValue());
bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxCheckBox *cbox = (wxCheckBox *)propertyWindow;
+ wxCheckBox *cbox = (wxCheckBox *)m_propertyWindow;
resource->SetValue1(cbox->GetValue());
return wxItemPropertyInfo::InstantiateResource(resource);
}
wxProperty *wxRadioButtonPropertyInfo::GetProperty(wxString& name)
{
- wxRadioButton *checkBox = (wxRadioButton *)propertyWindow;
+ wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow;
if (name == "value")
return new wxProperty("value", checkBox->GetValue(), "bool");
else
bool wxRadioButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxRadioButton *checkBox = (wxRadioButton *)propertyWindow;
+ wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow;
if (name == "value")
{
checkBox->SetValue((bool)property->GetValue().BoolValue());
bool wxRadioButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxRadioButton *cbox = (wxRadioButton *)propertyWindow;
+ wxRadioButton *cbox = (wxRadioButton *)m_propertyWindow;
resource->SetValue1(cbox->GetValue());
return wxItemPropertyInfo::InstantiateResource(resource);
}
wxProperty *wxSliderPropertyInfo::GetProperty(wxString& name)
{
- wxSlider *slider = (wxSlider *)propertyWindow;
+ wxSlider *slider = (wxSlider *)m_propertyWindow;
if (name == "value")
return new wxProperty("value", (long)slider->GetValue(), "integer");
else if (name == "orientation")
{
char *pos = NULL;
- if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
+ if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
pos = "wxHORIZONTAL";
else
pos = "wxVERTICAL";
bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxSlider *slider = (wxSlider *)propertyWindow;
+ wxSlider *slider = (wxSlider *)m_propertyWindow;
if (name == "value")
{
slider->SetValue((int)property->GetValue().IntegerValue());
bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxSlider *slider = (wxSlider *)propertyWindow;
+ wxSlider *slider = (wxSlider *)m_propertyWindow;
resource->SetValue1(slider->GetValue());
resource->SetValue2(slider->GetMin());
resource->SetValue3(slider->GetMax());
wxProperty *wxGaugePropertyInfo::GetProperty(wxString& name)
{
- wxGauge *gauge = (wxGauge *)propertyWindow;
+ wxGauge *gauge = (wxGauge *)m_propertyWindow;
if (name == "value")
return new wxProperty("value", (long)gauge->GetValue(), "integer");
else if (name == "maxValue")
bool wxGaugePropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxGauge *gauge = (wxGauge *)propertyWindow;
+ wxGauge *gauge = (wxGauge *)m_propertyWindow;
if (name == "value")
{
gauge->SetValue((int)property->GetValue().IntegerValue());
bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxGauge *gauge = (wxGauge *)propertyWindow;
+ wxGauge *gauge = (wxGauge *)m_propertyWindow;
resource->SetValue1(gauge->GetValue());
resource->SetValue2(gauge->GetRange());
return wxItemPropertyInfo::InstantiateResource(resource);
wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
{
- wxScrollBar *scrollBar = (wxScrollBar *)propertyWindow;
+ wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
if (name == "value")
return new wxProperty("value", (long)scrollBar->GetValue(), "integer");
else if (name == "orientation")
{
char *pos = NULL;
- if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
+ if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
pos = "wxHORIZONTAL";
else
pos = "wxVERTICAL";
bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxScrollBar *scrollBar = (wxScrollBar *)propertyWindow;
+ wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
if (name == "value")
{
scrollBar->SetValue((int)property->GetValue().IntegerValue());
bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxScrollBar *sbar = (wxScrollBar *)propertyWindow;
-
+ wxScrollBar *sbar = (wxScrollBar *)m_propertyWindow;
+
resource->SetValue1(sbar->GetValue());
int viewStart, pageLength, objectLength, viewLength;
wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
{
- wxPanel *panelWindow = (wxPanel *)propertyWindow;
+ wxPanel *panelWindow = (wxPanel *)m_propertyWindow;
wxFont *labelFont = panelWindow->GetLabelFont();
wxFont *buttonFont = panelWindow->GetButtonFont();
return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxTHICK_FRAME) == wxTHICK_FRAME),
"bool");
}
+ else if (name == "useSystemDefaults")
+ {
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+ return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) == wxRESOURCE_USE_DEFAULTS),
+ "bool");
+ }
+ else if (name == "useDialogUnits")
+ {
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+ return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == wxRESOURCE_DIALOG_UNITS),
+ "bool");
+ }
else
return wxWindowPropertyInfo::GetProperty(name);
}
bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxPanel *panelWindow = (wxPanel *)propertyWindow;
+ wxPanel *panelWindow = (wxPanel *)m_propertyWindow;
wxFont *labelFont = panelWindow->GetLabelFont();
wxFont *buttonFont = panelWindow->GetButtonFont();
else if (name == "no3D")
{
bool userColours = property->GetValue().BoolValue();
- long flag = panelWindow->GetWindowStyleFlag();
if (userColours)
{
resource->SetStyle(panelWindow->GetWindowStyleFlag());
return TRUE;
}
+ else if (name == "useSystemDefaults")
+ {
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+ bool useDefaults = property->GetValue().BoolValue();
+ long style = resource->GetResourceStyle();
+ if (useDefaults)
+ {
+ if ((style & wxRESOURCE_USE_DEFAULTS) == 0)
+ style |= wxRESOURCE_USE_DEFAULTS;
+ }
+ else
+ {
+ if ((style & wxRESOURCE_USE_DEFAULTS) != 0)
+ style -= wxRESOURCE_USE_DEFAULTS;
+ }
+ resource->SetResourceStyle(style);
+ panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
+ return TRUE;
+ }
+ else if (name == "useDialogUnits")
+ {
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+ bool useDialogUnits = property->GetValue().BoolValue();
+ long style = resource->GetResourceStyle();
+ if (useDialogUnits)
+ {
+ if ((style & wxRESOURCE_DIALOG_UNITS) == 0)
+ {
+ style |= wxRESOURCE_DIALOG_UNITS;
+ ConvertDialogUnits(TRUE); // Convert all resources
+ }
+ }
+ else
+ {
+ if ((style & wxRESOURCE_DIALOG_UNITS) != 0)
+ {
+ style -= wxRESOURCE_DIALOG_UNITS;
+ ConvertDialogUnits(FALSE); // Convert all resources
+ }
+ }
+ resource->SetResourceStyle(style);
+ panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
+ // TODO: need to regenerate the width and height properties else they'll be inconsistent.
+ return TRUE;
+ }
else
return wxWindowPropertyInfo::SetProperty(name, property);
}
names.Add("caption");
names.Add("systemMenu");
names.Add("thickFrame");
+ names.Add("useSystemDefaults");
+ names.Add("useDialogUnits");
}
bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxPanel *panel = (wxPanel *)propertyWindow;
- if (panel->GetFont())
+ wxPanel *panel = (wxPanel *)m_propertyWindow;
+ if (panel->GetFont() && panel->GetFont()->Ok())
resource->SetFont(wxTheFontList->FindOrCreateFont(panel->GetFont()->GetPointSize(),
panel->GetFont()->GetFamily(), panel->GetFont()->GetStyle(), panel->GetFont()->GetWeight(),
panel->GetFont()->GetUnderlined(), panel->GetFont()->GetFaceName()));
- resource->SetBackgroundColour(new wxColour(panel->GetBackgroundColour()));
+ resource->SetBackgroundColour(wxColour(panel->GetBackgroundColour()));
return wxWindowPropertyInfo::InstantiateResource(resource);
}
+// Convert this dialog, and its children, to or from dialog units
+void wxPanelPropertyInfo::ConvertDialogUnits(bool toDialogUnits)
+{
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+
+ wxPoint pt;
+ wxSize sz;
+ if (toDialogUnits)
+ {
+ sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(resource->GetWidth(), resource->GetHeight()));
+ pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(resource->GetX(), resource->GetY()));
+ }
+ else
+ {
+ sz = m_propertyWindow->ConvertDialogToPixels(wxSize(resource->GetWidth(), resource->GetHeight()));
+ pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(resource->GetX(), resource->GetY()));
+ }
+ resource->SetSize(pt.x, pt.y, sz.x, sz.y);
+
+ wxNode* node = m_propertyWindow->GetChildren()->First();
+ while (node)
+ {
+ wxWindow* child = (wxWindow*) node->Data();
+ if (child->IsKindOf(CLASSINFO(wxControl)))
+ {
+ resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(child);
+ if (toDialogUnits)
+ {
+ sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(resource->GetWidth(), resource->GetHeight()));
+ pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(resource->GetX(), resource->GetY()));
+ }
+ else
+ {
+ sz = m_propertyWindow->ConvertDialogToPixels(wxSize(resource->GetWidth(), resource->GetHeight()));
+ pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(resource->GetX(), resource->GetY()));
+ }
+ resource->SetSize(pt.x, pt.y, sz.x, sz.y);
+ }
+ node = node->Next();
+ }
+}
+
#if 0
/*
* Dialog boxes
wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name)
{
- wxDialog *dialogWindow = (wxDialog *)propertyWindow;
+ wxDialog *dialogWindow = (wxDialog *)m_propertyWindow;
if (name == "modal")
{
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
bool wxDialogPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxDialog *dialogWindow = (wxDialog *)propertyWindow;
+ wxDialog *dialogWindow = (wxDialog *)m_propertyWindow;
if (name == "modal")
{
bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource)
{
- wxDialog *dialog = (wxDialog *)propertyWindow;
+ wxDialog *dialog = (wxDialog *)m_propertyWindow;
wxString str(dialog->GetTitle());
- resource->SetTitle(WXSTRINGCAST str);
+ resource->SetTitle(str);
return wxPanelPropertyInfo::InstantiateResource(resource);
}
{
}
-bool wxResourceSymbolValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow))
{
return TRUE;
}
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transferance from the property editing area to the property itself
-bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
{
if (!view->GetValueText())
return FALSE;
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transferance from the property editing area to the property itself
-bool wxResourceSymbolValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
{
if (!view->GetValueText())
return FALSE;
return TRUE;
}
-bool wxResourceSymbolValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
{
if (view->GetConfirmButton())
view->GetConfirmButton()->Enable(TRUE);
return TRUE;
}
-void wxResourceSymbolDialog::OnComboBoxSelect(wxCommandEvent& event)
+void wxResourceSymbolDialog::OnComboBoxSelect(wxCommandEvent& WXUNUSED(event))
{
wxString str(m_nameCtrl->GetStringSelection());
if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(str))
}
}
-void wxResourceSymbolDialog::OnSymbolNameUpdate(wxCommandEvent& event)
+void wxResourceSymbolDialog::OnSymbolNameUpdate(wxCommandEvent& WXUNUSED(event))
{
wxString str(m_nameCtrl->GetValue());
if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(str))
class wxResourcePropertyListView: public wxPropertyListView
{
public:
- wxPropertyInfo *propertyInfo;
-
wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT):
wxPropertyListView(propPanel, flags)
{
- propertyInfo = info;
+ m_propertyInfo = info;
}
void OnPropertyChanged(wxProperty *property);
bool OnClose(void);
+
+ wxPropertyInfo* m_propertyInfo;
+
};
// Generic class for relating an object to a collection of properties.
// For all windows
class wxWindowPropertyInfo: public wxPropertyInfo
{
- protected:
- wxWindow *propertyWindow;
- wxItemResource *propertyResource;
public:
wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
~wxWindowPropertyInfo(void);
bool SetProperty(wxString& name, wxProperty *property);
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
// Set the window style
void SetWindowStyle(wxWindow* win, long style, bool set);
+
+ protected:
+ wxWindow* m_propertyWindow;
+ wxItemResource* m_propertyResource;
};
// For panel items
bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource);
+
+ // Convert this dialog, and its children, to or from dialog units
+ void ConvertDialogUnits(bool toDialogUnits);
};
int wxStringToFontWeight(wxString& val);
wxPropertyValue::wxPropertyValue(void)
{
- type = wxPropertyValueNull;
- next = NULL;
- last = NULL;
- value.first = NULL;
- client_data = NULL;
- modifiedFlag = FALSE;
+ m_type = wxPropertyValueNull;
+ m_next = NULL;
+ m_last = NULL;
+ m_value.first = NULL;
+ m_clientData = NULL;
+ m_modifiedFlag = FALSE;
}
wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
{
- modifiedFlag = FALSE;
+ m_modifiedFlag = FALSE;
Copy((wxPropertyValue& )copyFrom);
}
wxPropertyValue::wxPropertyValue(const char *val)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueString;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueString;
- value.string = copystring(val);
- client_data = NULL;
- next = NULL;
- last = NULL;
+ m_value.string = copystring(val);
+ m_clientData = NULL;
+ m_next = NULL;
+ m_last = NULL;
}
wxPropertyValue::wxPropertyValue(const wxString& val)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueString;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueString;
- value.string = copystring((const char *)val);
- client_data = NULL;
- next = NULL;
- last = NULL;
+ m_value.string = copystring((const char *)val);
+ m_clientData = NULL;
+ m_next = NULL;
+ m_last = NULL;
}
wxPropertyValue::wxPropertyValue(long the_integer)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueInteger;
- value.integer = the_integer;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueInteger;
+ m_value.integer = the_integer;
+ m_clientData = NULL;
+ m_next = NULL;
}
wxPropertyValue::wxPropertyValue(bool val)
{
- modifiedFlag = FALSE;
- type = wxPropertyValuebool;
- value.integer = val;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValuebool;
+ m_value.integer = val;
+ m_clientData = NULL;
+ m_next = NULL;
}
wxPropertyValue::wxPropertyValue(float the_real)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueReal;
- value.real = the_real;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueReal;
+ m_value.real = the_real;
+ m_clientData = NULL;
+ m_next = NULL;
}
wxPropertyValue::wxPropertyValue(double the_real)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueReal;
- value.real = (float)the_real;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueReal;
+ m_value.real = (float)the_real;
+ m_clientData = NULL;
+ m_next = NULL;
}
// Pointer versions: we have a pointer to the real C++ value.
wxPropertyValue::wxPropertyValue(char **val)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueStringPtr;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueStringPtr;
- value.stringPtr = val;
- client_data = NULL;
- next = NULL;
- last = NULL;
+ m_value.stringPtr = val;
+ m_clientData = NULL;
+ m_next = NULL;
+ m_last = NULL;
}
wxPropertyValue::wxPropertyValue(long *val)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueIntegerPtr;
- value.integerPtr = val;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueIntegerPtr;
+ m_value.integerPtr = val;
+ m_clientData = NULL;
+ m_next = NULL;
}
wxPropertyValue::wxPropertyValue(bool *val)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueboolPtr;
- value.boolPtr = val;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueboolPtr;
+ m_value.boolPtr = val;
+ m_clientData = NULL;
+ m_next = NULL;
}
wxPropertyValue::wxPropertyValue(float *val)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueRealPtr;
- value.realPtr = val;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueRealPtr;
+ m_value.realPtr = val;
+ m_clientData = NULL;
+ m_next = NULL;
}
wxPropertyValue::wxPropertyValue(wxList *the_list)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueList;
- client_data = NULL;
- last = NULL;
- value.first = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueList;
+ m_clientData = NULL;
+ m_last = NULL;
+ m_value.first = NULL;
wxNode *node = the_list->First();
while (node)
wxPropertyValue::wxPropertyValue(wxStringList *the_list)
{
- modifiedFlag = FALSE;
- type = wxPropertyValueList;
- client_data = NULL;
- last = NULL;
- value.first = NULL;
+ m_modifiedFlag = FALSE;
+ m_type = wxPropertyValueList;
+ m_clientData = NULL;
+ m_last = NULL;
+ m_value.first = NULL;
wxNode *node = the_list->First();
while (node)
wxPropertyValue::~wxPropertyValue(void)
{
- switch (type)
+ switch (m_type)
{
case wxPropertyValueInteger:
case wxPropertyValuebool:
}
case wxPropertyValueString:
{
- delete value.string;
+ delete m_value.string;
break;
}
case wxPropertyValueList:
{
- wxPropertyValue *expr = value.first;
+ wxPropertyValue *expr = m_value.first;
while (expr)
{
- wxPropertyValue *expr1 = expr->next;
+ wxPropertyValue *expr1 = expr->m_next;
delete expr;
expr = expr1;
void wxPropertyValue::Append(wxPropertyValue *expr)
{
- modifiedFlag = TRUE;
- if (!value.first)
- value.first = expr;
+ m_modifiedFlag = TRUE;
+ if (!m_value.first)
+ m_value.first = expr;
- if (last)
- last->next = expr;
- last = expr;
+ if (m_last)
+ m_last->m_next = expr;
+ m_last = expr;
}
void wxPropertyValue::Insert(wxPropertyValue *expr)
{
- modifiedFlag = TRUE;
- expr->next = value.first;
- value.first = expr;
+ m_modifiedFlag = TRUE;
+ expr->m_next = m_value.first;
+ m_value.first = expr;
- if (!last)
- last = expr;
+ if (!m_last)
+ m_last = expr;
}
// Delete from list
if (expr)
{
if (previous)
- previous->next = expr->next;
+ previous->m_next = expr->m_next;
// If node was the first in the list,
// make the list point to the NEXT one.
if (GetFirst() == expr)
{
- value.first = expr->next;
+ m_value.first = expr->m_next;
}
// If node was the last in the list,
if (GetLast() == expr)
{
if (previous)
- last = previous;
+ m_last = previous;
else
- last = NULL;
+ m_last = NULL;
}
- modifiedFlag = TRUE;
+ m_modifiedFlag = TRUE;
delete expr;
}
{
wxPropertyValue *val = GetFirst();
if (val)
- modifiedFlag = TRUE;
-
+ m_modifiedFlag = TRUE;
+
while (val)
{
wxPropertyValue *next = val->GetNext();
delete val;
val = next;
}
- value.first = NULL;
- last = NULL;
+ m_value.first = NULL;
+ m_last = NULL;
}
-wxPropertyValue *wxPropertyValue::NewCopy(void)
+wxPropertyValue *wxPropertyValue::NewCopy(void) const
{
- switch (type)
+ switch (m_type)
{
case wxPropertyValueInteger:
- return new wxPropertyValue(value.integer);
+ return new wxPropertyValue(m_value.integer);
case wxPropertyValuebool:
- return new wxPropertyValue((bool) (value.integer != 0));
+ return new wxPropertyValue((bool) (m_value.integer != 0));
case wxPropertyValueReal:
- return new wxPropertyValue(value.real);
+ return new wxPropertyValue(m_value.real);
case wxPropertyValueString:
- return new wxPropertyValue(value.string);
+ return new wxPropertyValue(m_value.string);
case wxPropertyValueList:
{
- wxPropertyValue *expr = value.first;
+ wxPropertyValue *expr = m_value.first;
wxPropertyValue *new_list = new wxPropertyValue;
new_list->SetType(wxPropertyValueList);
while (expr)
{
wxPropertyValue *expr2 = expr->NewCopy();
new_list->Append(expr2);
- expr = expr->next;
+ expr = expr->m_next;
}
return new_list;
}
case wxPropertyValueIntegerPtr:
- return new wxPropertyValue(value.integerPtr);
+ return new wxPropertyValue(m_value.integerPtr);
case wxPropertyValueRealPtr:
- return new wxPropertyValue(value.realPtr);
+ return new wxPropertyValue(m_value.realPtr);
case wxPropertyValueboolPtr:
- return new wxPropertyValue(value.boolPtr);
+ return new wxPropertyValue(m_value.boolPtr);
case wxPropertyValueStringPtr:
- return new wxPropertyValue(value.stringPtr);
+ return new wxPropertyValue(m_value.stringPtr);
case wxPropertyValueNull:
#ifdef __X__
void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
{
- type = copyFrom.Type();
-
- switch (type)
+ m_type = copyFrom.Type();
+
+ switch (m_type)
{
case wxPropertyValueInteger:
(*this) = copyFrom.IntegerValue();
case wxPropertyValueList:
{
- value.first = NULL;
- next = NULL;
- last = NULL;
- wxPropertyValue *expr = copyFrom.value.first;
+ m_value.first = NULL;
+ m_next = NULL;
+ m_last = NULL;
+ wxPropertyValue *expr = copyFrom.m_value.first;
while (expr)
{
wxPropertyValue *expr2 = expr->NewCopy();
Append(expr2);
- expr = expr->next;
+ expr = expr->m_next;
}
return;
}
}
// Return nth argument of a clause (starting from 1)
-wxPropertyValue *wxPropertyValue::Arg(wxPropertyValueType type, int arg)
+wxPropertyValue *wxPropertyValue::Arg(wxPropertyValueType type, int arg) const
{
- wxPropertyValue *expr = value.first;
+ wxPropertyValue *expr = m_value.first;
for (int i = 1; i < arg; i++)
if (expr)
- expr = expr->next;
+ expr = expr->m_next;
- if (expr && (expr->type == type))
+ if (expr && (expr->m_type == type))
return expr;
else
return NULL;
}
// Return nth argument of a list expression (starting from zero)
-wxPropertyValue *wxPropertyValue::Nth(int arg)
+wxPropertyValue *wxPropertyValue::Nth(int arg) const
{
- if (type != wxPropertyValueList)
+ if (m_type != wxPropertyValueList)
return NULL;
- wxPropertyValue *expr = value.first;
+ wxPropertyValue *expr = m_value.first;
for (int i = 0; i < arg; i++)
if (expr)
- expr = expr->next;
+ expr = expr->m_next;
else return NULL;
if (expr)
}
// Returns the number of elements in a list expression
-int wxPropertyValue::Number(void)
+int wxPropertyValue::Number(void) const
{
- if (type != wxPropertyValueList)
+ if (m_type != wxPropertyValueList)
return 0;
int i = 0;
- wxPropertyValue *expr = value.first;
+ wxPropertyValue *expr = m_value.first;
while (expr)
{
- expr = expr->next;
+ expr = expr->m_next;
i ++;
}
return i;
void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expression as a top-level clause
{
- if (type != wxPropertyValueList)
+ if (m_type != wxPropertyValueList)
return;
- wxPropertyValue *node = value.first;
+ wxPropertyValue *node = m_value.first;
if (node)
{
node->WritePropertyType(stream);
stream << "(";
- node = node->next;
+ node = node->m_next;
bool first = TRUE;
while (node)
{
if (!first)
stream << " ";
node->WritePropertyType(stream);
- node = node->next;
+ node = node->m_next;
if (node) stream << ",\n";
first = FALSE;
}
void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any other subexpression
{
- switch (type)
+ switch (m_type)
{
case wxPropertyValueInteger:
{
- stream << value.integer;
+ stream << m_value.integer;
break;
}
case wxPropertyValueIntegerPtr:
{
- stream << *value.integerPtr;
+ stream << *m_value.integerPtr;
break;
}
case wxPropertyValuebool:
{
- if (value.integer)
+ if (m_value.integer)
stream << "True";
else
stream << "False";
}
case wxPropertyValueboolPtr:
{
- if (*value.integerPtr)
+ if (*m_value.integerPtr)
stream << "True";
else
stream << "False";
}
case wxPropertyValueReal:
{
- float f = value.real;
+ float f = m_value.real;
sprintf(wxBuffer, "%.6g", (double)f);
stream << wxBuffer;
break;
}
case wxPropertyValueRealPtr:
{
- float f = *value.realPtr;
+ float f = *m_value.realPtr;
/* Now the parser can cope with this.
// Prevent printing in 'e' notation. Any better way?
if (fabs(f) < 0.00001)
{
// stream << "\"";
int i;
- int len = strlen(value.string);
+ int len = strlen(m_value.string);
for (i = 0; i < len; i++)
{
- char ch = value.string[i];
+ char ch = m_value.string[i];
// if (ch == '"' || ch == '\\')
// stream << "\\";
stream << ch;
case wxPropertyValueStringPtr:
{
int i;
- int len = strlen(*(value.stringPtr));
+ int len = strlen(*(m_value.stringPtr));
for (i = 0; i < len; i++)
{
- char ch = *(value.stringPtr)[i];
+ char ch = *(m_value.stringPtr)[i];
}
break;
}
case wxPropertyValueList:
{
- if (!value.first)
+ if (!m_value.first)
stream << "[]";
else
{
- wxPropertyValue *expr = value.first;
+ wxPropertyValue *expr = m_value.first;
stream << "[";
while (expr)
{
expr->WritePropertyType(stream);
- expr = expr->next;
+ expr = expr->m_next;
if (expr) stream << ", ";
}
stream << "]";
void wxPropertyValue::operator=(const wxPropertyValue& val)
{
- modifiedFlag = TRUE;
+ m_modifiedFlag = TRUE;
Copy((wxPropertyValue&)val);
}
{
const char *val = (const char *)val1;
- modifiedFlag = TRUE;
- if (type == wxPropertyValueNull)
- type = wxPropertyValueString;
+ m_modifiedFlag = TRUE;
+ if (m_type == wxPropertyValueNull)
+ m_type = wxPropertyValueString;
- if (type == wxPropertyValueString)
+ if (m_type == wxPropertyValueString)
{
if (val)
- value.string = copystring(val);
+ m_value.string = copystring(val);
else
- value.string = NULL;
+ m_value.string = NULL;
}
- else if (type == wxPropertyValueStringPtr)
+ else if (m_type == wxPropertyValueStringPtr)
{
- if (*value.stringPtr)
- delete[] *value.stringPtr;
+ if (*m_value.stringPtr)
+ delete[] *m_value.stringPtr;
if (val)
- *value.stringPtr = copystring(val);
+ *m_value.stringPtr = copystring(val);
else
- *value.stringPtr = NULL;
+ *m_value.stringPtr = NULL;
}
- client_data = NULL;
- next = NULL;
- last = NULL;
+ m_clientData = NULL;
+ m_next = NULL;
+ m_last = NULL;
}
void wxPropertyValue::operator=(const long val)
{
- modifiedFlag = TRUE;
- if (type == wxPropertyValueNull)
- type = wxPropertyValueInteger;
-
- if (type == wxPropertyValueInteger)
- value.integer = val;
- else if (type == wxPropertyValueIntegerPtr)
- *value.integerPtr = val;
- else if (type == wxPropertyValueReal)
- value.real = (float)val;
- else if (type == wxPropertyValueRealPtr)
- *value.realPtr = (float)val;
-
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = TRUE;
+ if (m_type == wxPropertyValueNull)
+ m_type = wxPropertyValueInteger;
+
+ if (m_type == wxPropertyValueInteger)
+ m_value.integer = val;
+ else if (m_type == wxPropertyValueIntegerPtr)
+ *m_value.integerPtr = val;
+ else if (m_type == wxPropertyValueReal)
+ m_value.real = (float)val;
+ else if (m_type == wxPropertyValueRealPtr)
+ *m_value.realPtr = (float)val;
+
+ m_clientData = NULL;
+ m_next = NULL;
}
void wxPropertyValue::operator=(const bool val)
{
- modifiedFlag = TRUE;
- if (type == wxPropertyValueNull)
- type = wxPropertyValuebool;
+ m_modifiedFlag = TRUE;
+ if (m_type == wxPropertyValueNull)
+ m_type = wxPropertyValuebool;
- if (type == wxPropertyValuebool)
- value.integer = (long)val;
- else if (type == wxPropertyValueboolPtr)
- *value.boolPtr = val;
+ if (m_type == wxPropertyValuebool)
+ m_value.integer = (long)val;
+ else if (m_type == wxPropertyValueboolPtr)
+ *m_value.boolPtr = val;
- client_data = NULL;
- next = NULL;
+ m_clientData = NULL;
+ m_next = NULL;
}
void wxPropertyValue::operator=(const float val)
{
- modifiedFlag = TRUE;
- if (type == wxPropertyValueNull)
- type = wxPropertyValueReal;
-
- if (type == wxPropertyValueInteger)
- value.integer = (long)val;
- else if (type == wxPropertyValueIntegerPtr)
- *value.integerPtr = (long)val;
- else if (type == wxPropertyValueReal)
- value.real = val;
- else if (type == wxPropertyValueRealPtr)
- *value.realPtr = val;
-
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = TRUE;
+ if (m_type == wxPropertyValueNull)
+ m_type = wxPropertyValueReal;
+
+ if (m_type == wxPropertyValueInteger)
+ m_value.integer = (long)val;
+ else if (m_type == wxPropertyValueIntegerPtr)
+ *m_value.integerPtr = (long)val;
+ else if (m_type == wxPropertyValueReal)
+ m_value.real = val;
+ else if (m_type == wxPropertyValueRealPtr)
+ *m_value.realPtr = val;
+
+ m_clientData = NULL;
+ m_next = NULL;
}
void wxPropertyValue::operator=(const char **val)
{
- modifiedFlag = TRUE;
- type = wxPropertyValueStringPtr;
+ m_modifiedFlag = TRUE;
+ m_type = wxPropertyValueStringPtr;
if (val)
- value.stringPtr = (char **)val;
+ m_value.stringPtr = (char **)val;
else
- value.stringPtr = NULL;
- client_data = NULL;
- next = NULL;
- last = NULL;
+ m_value.stringPtr = NULL;
+ m_clientData = NULL;
+ m_next = NULL;
+ m_last = NULL;
}
void wxPropertyValue::operator=(const long *val)
{
- modifiedFlag = TRUE;
- type = wxPropertyValueIntegerPtr;
- value.integerPtr = (long *)val;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = TRUE;
+ m_type = wxPropertyValueIntegerPtr;
+ m_value.integerPtr = (long *)val;
+ m_clientData = NULL;
+ m_next = NULL;
}
void wxPropertyValue::operator=(const bool *val)
{
- modifiedFlag = TRUE;
- type = wxPropertyValueboolPtr;
- value.boolPtr = (bool *)val;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = TRUE;
+ m_type = wxPropertyValueboolPtr;
+ m_value.boolPtr = (bool *)val;
+ m_clientData = NULL;
+ m_next = NULL;
}
void wxPropertyValue::operator=(const float *val)
{
- modifiedFlag = TRUE;
- type = wxPropertyValueRealPtr;
- value.realPtr = (float *)val;
- client_data = NULL;
- next = NULL;
+ m_modifiedFlag = TRUE;
+ m_type = wxPropertyValueRealPtr;
+ m_value.realPtr = (float *)val;
+ m_clientData = NULL;
+ m_next = NULL;
}
-long wxPropertyValue::IntegerValue(void)
+long wxPropertyValue::IntegerValue(void) const
{
- if (type == wxPropertyValueInteger)
- return value.integer;
- else if (type == wxPropertyValueReal)
- return (long)value.real;
- else if (type == wxPropertyValueIntegerPtr)
- return *value.integerPtr;
- else if (type == wxPropertyValueRealPtr)
- return (long)(*value.realPtr);
+ if (m_type == wxPropertyValueInteger)
+ return m_value.integer;
+ else if (m_type == wxPropertyValueReal)
+ return (long)m_value.real;
+ else if (m_type == wxPropertyValueIntegerPtr)
+ return *m_value.integerPtr;
+ else if (m_type == wxPropertyValueRealPtr)
+ return (long)(*m_value.realPtr);
else return 0;
}
-long *wxPropertyValue::IntegerValuePtr(void)
+long *wxPropertyValue::IntegerValuePtr(void) const
{
- return value.integerPtr;
+ return m_value.integerPtr;
}
-float wxPropertyValue::RealValue(void) {
- if (type == wxPropertyValueReal)
- return value.real;
- else if (type == wxPropertyValueRealPtr)
- return *value.realPtr;
- else if (type == wxPropertyValueInteger)
- return (float)value.integer;
- else if (type == wxPropertyValueIntegerPtr)
- return (float)*(value.integerPtr);
+float wxPropertyValue::RealValue(void) const {
+ if (m_type == wxPropertyValueReal)
+ return m_value.real;
+ else if (m_type == wxPropertyValueRealPtr)
+ return *m_value.realPtr;
+ else if (m_type == wxPropertyValueInteger)
+ return (float)m_value.integer;
+ else if (m_type == wxPropertyValueIntegerPtr)
+ return (float)*(m_value.integerPtr);
else return 0.0;
}
-float *wxPropertyValue::RealValuePtr(void)
+float *wxPropertyValue::RealValuePtr(void) const
{
- return value.realPtr;
+ return m_value.realPtr;
}
-bool wxPropertyValue::BoolValue(void) {
- if (type == wxPropertyValueReal)
- return (value.real != 0.0);
- if (type == wxPropertyValueRealPtr)
- return (*(value.realPtr) != 0.0);
- else if (type == wxPropertyValueInteger)
- return (value.integer != 0);
- else if (type == wxPropertyValueIntegerPtr)
- return (*(value.integerPtr) != 0);
- else if (type == wxPropertyValuebool)
- return (value.integer != 0);
- else if (type == wxPropertyValueboolPtr)
- return (*(value.boolPtr) != 0);
+bool wxPropertyValue::BoolValue(void) const {
+ if (m_type == wxPropertyValueReal)
+ return (m_value.real != 0.0);
+ if (m_type == wxPropertyValueRealPtr)
+ return (*(m_value.realPtr) != 0.0);
+ else if (m_type == wxPropertyValueInteger)
+ return (m_value.integer != 0);
+ else if (m_type == wxPropertyValueIntegerPtr)
+ return (*(m_value.integerPtr) != 0);
+ else if (m_type == wxPropertyValuebool)
+ return (m_value.integer != 0);
+ else if (m_type == wxPropertyValueboolPtr)
+ return (*(m_value.boolPtr) != 0);
else return FALSE;
}
-bool *wxPropertyValue::BoolValuePtr(void)
+bool *wxPropertyValue::BoolValuePtr(void) const
{
- return value.boolPtr;
+ return m_value.boolPtr;
}
-char *wxPropertyValue::StringValue(void) {
- if (type == wxPropertyValueString)
- return value.string;
- else if (type == wxPropertyValueStringPtr)
- return *(value.stringPtr);
+char *wxPropertyValue::StringValue(void) const {
+ if (m_type == wxPropertyValueString)
+ return m_value.string;
+ else if (m_type == wxPropertyValueStringPtr)
+ return *(m_value.stringPtr);
else return NULL;
}
-char **wxPropertyValue::StringValuePtr(void)
+char **wxPropertyValue::StringValuePtr(void) const
{
- return value.stringPtr;
+ return m_value.stringPtr;
}
/*
wxProperty::wxProperty(void)
{
- propertyRole = (char *)NULL;
- propertyValidator = NULL;
- propertyWindow = NULL;
- enabled = TRUE;
+ m_propertyRole = (char *)NULL;
+ m_propertyValidator = NULL;
+ m_propertyWindow = NULL;
+ m_enabled = TRUE;
}
wxProperty::wxProperty(wxProperty& copyFrom)
{
- value = copyFrom.GetValue();
- name = copyFrom.GetName();
- propertyRole = copyFrom.GetRole();
- propertyValidator = copyFrom.GetValidator();
- enabled = copyFrom.IsEnabled();
- propertyWindow = NULL;
+ m_value = copyFrom.GetValue();
+ m_name = copyFrom.GetName();
+ m_propertyRole = copyFrom.GetRole();
+ m_propertyValidator = copyFrom.GetValidator();
+ m_enabled = copyFrom.IsEnabled();
+ m_propertyWindow = NULL;
}
-wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):name(nm), propertyRole(role)
+wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):m_name(nm), m_propertyRole(role)
{
- propertyValidator = ed;
- propertyWindow = NULL;
- enabled = TRUE;
+ m_propertyValidator = ed;
+ m_propertyWindow = NULL;
+ m_enabled = TRUE;
}
wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed):
- name(nm), value(val), propertyRole(role)
+ m_name(nm), m_value(val), m_propertyRole(role)
{
- propertyValidator = ed;
- propertyWindow = NULL;
- enabled = TRUE;
+ m_propertyValidator = ed;
+ m_propertyWindow = NULL;
+ m_enabled = TRUE;
}
wxProperty::~wxProperty(void)
{
- if (propertyValidator)
- delete propertyValidator;
+ if (m_propertyValidator)
+ delete m_propertyValidator;
}
-wxPropertyValue& wxProperty::GetValue(void)
+wxPropertyValue& wxProperty::GetValue(void) const
{
- return value;
+ return (wxPropertyValue&) m_value;
}
-wxPropertyValidator *wxProperty::GetValidator(void)
+wxPropertyValidator *wxProperty::GetValidator(void) const
{
- return propertyValidator;
+ return m_propertyValidator;
}
-wxString& wxProperty::GetName(void)
+wxString& wxProperty::GetName(void) const
{
- return name;
+ return (wxString&) m_name;
}
-wxString& wxProperty::GetRole(void)
+wxString& wxProperty::GetRole(void) const
{
- return propertyRole;
+ return (wxString&) m_propertyRole;
}
void wxProperty::SetValue(const wxPropertyValue& val)
{
- value = val;
+ m_value = val;
}
void wxProperty::SetValidator(wxPropertyValidator *ed)
{
- propertyValidator = ed;
+ m_propertyValidator = ed;
}
void wxProperty::SetRole(wxString& role)
{
- propertyRole = role;
+ m_propertyRole = role;
}
void wxProperty::SetName(wxString& nm)
{
- name = nm;
+ m_name = nm;
}
void wxProperty::operator=(const wxPropertyValue& val)
{
- value = val;
+ m_value = val;
}
/*
wxPropertyView::wxPropertyView(long flags)
{
- buttonFlags = flags;
- propertySheet = NULL;
- currentValidator = NULL;
- currentProperty = NULL;
+ m_buttonFlags = flags;
+ m_propertySheet = NULL;
+ m_currentValidator = NULL;
+ m_currentProperty = NULL;
}
wxPropertyView::~wxPropertyView(void)
void wxPropertyView::AddRegistry(wxPropertyValidatorRegistry *registry)
{
- validatorRegistryList.Append(registry);
+ m_validatorRegistryList.Append(registry);
}
wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property)
if (property->GetValidator())
return property->GetValidator();
- wxNode *node = validatorRegistryList.First();
+ wxNode *node = m_validatorRegistryList.First();
while (node)
{
wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->Data();
IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject)
-wxPropertySheet::wxPropertySheet(void):properties(wxKEY_STRING)
+wxPropertySheet::wxPropertySheet(void):m_properties(wxKEY_STRING)
{
}
// Add a property
void wxPropertySheet::AddProperty(wxProperty *property)
{
- properties.Append(property->GetName().GetData(), property);
+ m_properties.Append(property->GetName().GetData(), property);
}
// Get property by name
wxProperty *wxPropertySheet::GetProperty(wxString name)
{
- wxNode *node = properties.Find(name.GetData());
+ wxNode *node = m_properties.Find(name.GetData());
if (!node)
return NULL;
else
// Clear all properties
void wxPropertySheet::Clear(void)
{
- wxNode *node = properties.First();
+ wxNode *node = m_properties.First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
// Sets/clears the modified flag for each property value
void wxPropertySheet::SetAllModified(bool flag)
{
- wxNode *node = properties.First();
+ wxNode *node = m_properties.First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
wxPropertyValidator::wxPropertyValidator(long flags)
{
- validatorFlags = flags;
- validatorProperty = NULL;
+ m_validatorFlags = flags;
+ m_validatorProperty = NULL;
}
wxPropertyValidator::~wxPropertyValidator(void)
class wxPropertySheet: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
- protected:
- wxObject *viewedObject;
- wxList properties;
- wxPropertyView *propertyView;
-
public:
wxPropertySheet(void);
~wxPropertySheet(void);
virtual bool Load(ostream& str);
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
virtual void SetAllModified(bool flag = TRUE);
+
+ protected:
+ wxObject* m_viewedObject;
+ wxList m_properties;
+ wxPropertyView* m_propertyView;
+
};
class wxPropertyView: public wxEvtHandler
{
DECLARE_DYNAMIC_CLASS(wxPropertyView)
- protected:
- long buttonFlags;
- wxPropertySheet *propertySheet;
- wxProperty *currentProperty;
- wxList validatorRegistryList;
- wxPropertyValidator *currentValidator;
public:
wxPropertyView(long flags = 0);
~wxPropertyView(void);
virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {}
virtual void AddRegistry(wxPropertyValidatorRegistry *registry);
- inline virtual wxList& GetRegistryList(void)
- { return validatorRegistryList; }
+ inline virtual wxList& GetRegistryList(void) const
+ { return (wxList&) m_validatorRegistryList; }
virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property);
- inline virtual void SetPropertySheet(wxPropertySheet *sheet) { propertySheet = sheet; }
- inline virtual wxPropertySheet *GetPropertySheet(void) { return propertySheet; }
+ inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; }
+ inline virtual wxPropertySheet *GetPropertySheet(void) const { return m_propertySheet; }
virtual void OnOk(void) {};
virtual void OnCancel(void) {};
virtual void OnHelp(void) {};
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
{
DECLARE_DYNAMIC_CLASS(wxPropertyValidator)
- protected:
- long validatorFlags;
- wxProperty *validatorProperty;
public:
wxPropertyValidator(long flags = 0);
~wxPropertyValidator(void);
- inline long GetFlags(void) { return validatorFlags; }
- inline void SetValidatorProperty(wxProperty *prop) { validatorProperty = prop; }
- inline wxProperty *GetValidatorProperty(void) { return validatorProperty; }
+ inline long GetFlags(void) const { return m_validatorFlags; }
+ inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; }
+ inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; }
virtual bool StringToFloat (char *s, float *number);
virtual bool StringToDouble (char *s, double *number);
virtual char *DoubleToString (double number);
virtual char *IntToString (int number);
virtual char *LongToString (long number);
+
+ protected:
+ long m_validatorFlags;
+ wxProperty* m_validatorProperty;
};
class wxPropertyValue: public wxObject
{
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(const wxPropertyValue& copyFrom); // Copy constructor
~wxPropertyValue(void);
- virtual inline wxPropertyValueType Type(void) { return type; }
- virtual inline void SetType(wxPropertyValueType typ) { type = typ; }
- virtual long IntegerValue(void);
- virtual float RealValue(void);
- virtual bool BoolValue(void);
- virtual char *StringValue(void);
- virtual long *IntegerValuePtr(void);
- virtual float *RealValuePtr(void);
- virtual bool *BoolValuePtr(void);
- virtual char **StringValuePtr(void);
+ virtual inline wxPropertyValueType Type(void) const { return m_type; }
+ virtual inline void SetType(wxPropertyValueType typ) { m_type = typ; }
+ virtual long IntegerValue(void) const;
+ virtual float RealValue(void) const;
+ virtual bool BoolValue(void) const;
+ virtual char *StringValue(void) const;
+ virtual long *IntegerValuePtr(void) const;
+ virtual float *RealValuePtr(void) const;
+ virtual bool *BoolValuePtr(void) const;
+ virtual char **StringValuePtr(void) const;
// 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)
- virtual wxPropertyValue *Nth(int arg);
+ virtual wxPropertyValue *Nth(int arg) const;
// 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 WritePropertyClause(ostream& stream); // Write this expression as a top-level clause
virtual void Insert(wxPropertyValue *expr);
// Get first expr in list
- virtual inline wxPropertyValue *GetFirst(void)
- { return ((type == wxPropertyValueList) ? value.first : (wxPropertyValue*)NULL); }
+ virtual inline wxPropertyValue *GetFirst(void) const
+ { return ((m_type == wxPropertyValueList) ? m_value.first : (wxPropertyValue*)NULL); }
// Get next expr if this is a node in a list
- virtual inline wxPropertyValue *GetNext(void)
- { return next; }
+ virtual inline wxPropertyValue *GetNext(void) const
+ { return m_next; }
// Get last expr in list
- virtual inline wxPropertyValue *GetLast(void)
- { return ((type == wxPropertyValueList) ? last : (wxPropertyValue*)NULL); }
+ virtual inline wxPropertyValue *GetLast(void) const
+ { return ((m_type == wxPropertyValueList) ? m_last : (wxPropertyValue*)NULL); }
// Delete this node from the list
virtual void Delete(wxPropertyValue *node);
// Clear list
virtual void ClearList(void);
- virtual inline void SetClientData(wxObject *data) { client_data = data; }
- virtual inline wxObject *GetClientData(void) { return client_data; }
+ virtual inline void SetClientData(wxObject *data) { m_clientData = data; }
+ virtual inline wxObject *GetClientData(void) { return m_clientData; }
virtual wxString GetStringRepresentation(void);
- inline void SetModified(bool flag = TRUE) { modifiedFlag = flag; }
- inline bool GetModified(void) { return modifiedFlag; }
+ inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; }
+ inline bool GetModified(void) { return m_modifiedFlag; }
// Operators
void operator=(const wxPropertyValue& val);
void operator=(const long *val);
void operator=(const bool *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
+
};
/*
{
DECLARE_DYNAMIC_CLASS(wxProperty)
protected:
- bool enabled;
+ bool m_enabled;
public:
- wxPropertyValue value;
- wxString name;
- wxString propertyRole;
- wxPropertyValidator *propertyValidator;
- wxWindow *propertyWindow; // Usually a panel item, if anything
+ wxPropertyValue m_value;
+ wxString m_name;
+ wxString m_propertyRole;
+ wxPropertyValidator* m_propertyValidator;
+ wxWindow* m_propertyWindow; // Usually a panel item, if anything
wxProperty(void);
wxProperty(wxProperty& copyFrom);
wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL);
~wxProperty(void);
- virtual wxPropertyValue& GetValue(void);
- virtual wxPropertyValidator *GetValidator(void);
- virtual wxString& GetName(void);
- virtual wxString& GetRole(void);
+ virtual wxPropertyValue& GetValue(void) const;
+ virtual wxPropertyValidator *GetValidator(void) const;
+ virtual wxString& GetName(void) const;
+ virtual wxString& GetRole(void) const;
virtual void SetValue(const wxPropertyValue& val);
virtual void SetValidator(wxPropertyValidator *v);
virtual void SetName(wxString& nm);
virtual void SetRole(wxString& role);
void operator=(const wxPropertyValue& val);
- virtual inline void SetWindow(wxWindow *win) { propertyWindow = win; }
- virtual inline wxWindow *GetWindow(void) { return propertyWindow; }
+ virtual inline void SetWindow(wxWindow *win) { m_propertyWindow = win; }
+ virtual inline wxWindow *GetWindow(void) const { return m_propertyWindow; }
- inline void Enable(bool en) { enabled = en; }
- inline bool IsEnabled(void) { return enabled; }
+ inline void Enable(bool en) { m_enabled = en; }
+ inline bool IsEnabled(void) const { return m_enabled; }
};
#endif
EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
END_EVENT_TABLE()
-bool wxPropertyFormView::dialogCancelled = FALSE;
+bool wxPropertyFormView::sm_dialogCancelled = FALSE;
wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags)
{
- propertyWindow = propPanel;
- managedWindow = NULL;
+ m_propertyWindow = propPanel;
+ m_managedWindow = NULL;
- windowCloseButton = NULL;
- windowCancelButton = NULL;
- windowHelpButton = NULL;
+ m_windowCloseButton = NULL;
+ m_windowCancelButton = NULL;
+ m_windowHelpButton = NULL;
- detailedEditing = FALSE;
+ m_detailedEditing = FALSE;
}
wxPropertyFormView::~wxPropertyFormView(void)
void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
{
- propertySheet = ps;
-
+ m_propertySheet = ps;
+
AssociatePanel(panel);
// CreateControls();
// UpdatePropertyList();
bool wxPropertyFormView::Check(void)
{
- if (!propertySheet)
+ if (!m_propertySheet)
return FALSE;
- wxNode *node = propertySheet->GetProperties().First();
+ wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
- if (!formValidator->OnCheckValue(prop, this, propertyWindow))
+ if (!formValidator->OnCheckValue(prop, this, m_propertyWindow))
return FALSE;
}
node = node->Next();
bool wxPropertyFormView::TransferToPropertySheet(void)
{
- if (!propertySheet)
+ if (!m_propertySheet)
return FALSE;
- wxNode *node = propertySheet->GetProperties().First();
+ wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
- formValidator->OnRetrieveValue(prop, this, propertyWindow);
+ formValidator->OnRetrieveValue(prop, this, m_propertyWindow);
}
node = node->Next();
}
bool wxPropertyFormView::TransferToDialog(void)
{
- if (!propertySheet)
+ if (!m_propertySheet)
return FALSE;
- wxNode *node = propertySheet->GetProperties().First();
+ wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
- formValidator->OnDisplayValue(prop, this, propertyWindow);
+ formValidator->OnDisplayValue(prop, this, m_propertyWindow);
}
node = node->Next();
}
bool wxPropertyFormView::AssociateNames(void)
{
- if (!propertySheet || !propertyWindow)
+ if (!m_propertySheet || !m_propertyWindow)
return FALSE;
- wxNode *node = propertyWindow->GetChildren()->First();
+ wxNode *node = m_propertyWindow->GetChildren()->First();
while (node)
{
wxWindow *win = (wxWindow *)node->Data();
if (win->GetName() != "")
{
- wxProperty *prop = propertySheet->GetProperty(win->GetName());
+ wxProperty *prop = m_propertySheet->GetProperty(win->GetName());
if (prop)
prop->SetWindow(win);
}
if (!Check())
return;
- dialogCancelled = FALSE;
+ sm_dialogCancelled = FALSE;
- managedWindow->Close(TRUE);
+ m_managedWindow->Close(TRUE);
}
void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
{
- dialogCancelled = TRUE;
-
- managedWindow->Close(TRUE);
+ sm_dialogCancelled = TRUE;
+
+ m_managedWindow->Close(TRUE);
}
void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
{
- if (!propertySheet)
+ if (!m_propertySheet)
return;
if (win.GetName() == "")
else
{
// Find a validator to route the command to.
- wxNode *node = propertySheet->GetProperties().First();
+ wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
- formValidator->OnCommand(prop, this, propertyWindow, event);
+ formValidator->OnCommand(prop, this, m_propertyWindow, event);
return;
}
}
void wxPropertyFormView::OnDoubleClick(wxControl *item)
{
- if (!propertySheet)
+ if (!m_propertySheet)
return;
// Find a validator to route the command to.
- wxNode *node = propertySheet->GetProperties().First();
+ wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
- formValidator->OnDoubleClick(prop, this, propertyWindow);
+ formValidator->OnDoubleClick(prop, this, m_propertyWindow);
return;
}
}
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
{
- view = v;
- view->AssociatePanel(this);
- view->SetManagedWindow(this);
+ m_view = v;
+ m_view->AssociatePanel(this);
+ m_view->SetManagedWindow(this);
// SetAutoLayout(TRUE);
}
bool wxPropertyFormDialog::OnClose(void)
{
- if (view)
+ if (m_view)
{
- view->OnClose();
- view = NULL;
+ m_view->OnClose();
+ m_view = NULL;
return TRUE;
}
else
void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
{
- view->OnDoubleClick(item);
+ m_view->OnDoubleClick(item);
}
void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event)
{
- if ( view )
- view->OnCommand(win, event);
+ if ( m_view )
+ m_view->OnCommand(win, event);
}
// Extend event processing to search the view's event table
bool wxPropertyFormDialog::ProcessEvent(wxEvent& event)
{
- if ( !view || ! view->ProcessEvent(event) )
+ if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
void wxPropertyFormPanel::OnDefaultAction(wxControl *item)
{
- view->OnDoubleClick(item);
+ m_view->OnDoubleClick(item);
}
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
bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
{
- if ( !view || ! view->ProcessEvent(event) )
+ if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
bool wxPropertyFormFrame::OnClose(void)
{
- if (view)
- return view->OnClose();
+ if (m_view)
+ return m_view->OnClose();
else
return FALSE;
}
bool wxPropertyFormFrame::Initialize(void)
{
- propertyPanel = OnCreatePanel(this, view);
- if (propertyPanel)
+ m_propertyPanel = OnCreatePanel(this, m_view);
+ if (m_propertyPanel)
{
- view->AssociatePanel(propertyPanel);
- view->SetManagedWindow(this);
-// propertyPanel->SetAutoLayout(TRUE);
+ m_view->AssociatePanel(m_propertyPanel);
+ m_view->SetManagedWindow(this);
return TRUE;
}
else
bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
- if (realMin == 0.0 && realMax == 0.0)
+ if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
// The item used for viewing the real number: should be a text item.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
- wxString value(((wxTextCtrl *)propertyWindow)->GetValue());
+ wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
float val = 0.0;
if (!StringToFloat(WXSTRINGCAST value, &val))
return FALSE;
}
- if (val < realMin || val > realMax)
+ if (val < m_realMin || val > m_realMax)
{
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);
return FALSE;
}
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
- wxString value(((wxTextCtrl *)propertyWindow)->GetValue());
+ wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0)
return FALSE;
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
- wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow;
+ wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(FloatToString(property->GetValue().RealValue()));
return TRUE;
}
bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
- if (integerMin == 0.0 && integerMax == 0.0)
+ if (m_integerMin == 0.0 && m_integerMax == 0.0)
return TRUE;
// The item used for viewing the real number: should be a text item or a slider
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow)
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow)
return FALSE;
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))
{
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
return FALSE;
- if (val < integerMin || val > integerMax)
+ if (val < m_integerMin || val > m_integerMax)
{
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);
return FALSE;
}
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow)
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow)
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)
return FALSE;
long i = atol((const char *)value);
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
return FALSE;
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow)
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow)
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()));
}
- 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
return FALSE;
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
return TRUE;
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the boolean: should be a checkbox.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
- wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
-
+ wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
+
property->GetValue() = (bool)checkBox->GetValue();
return TRUE;
}
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
- wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
+ wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
checkBox->SetValue((bool)property->GetValue().BoolValue());
return TRUE;
}
wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
wxPropertyFormValidator(flags)
{
- strings = list;
+ m_strings = list;
}
bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow )
{
- if (!strings)
+ if (!m_strings)
return TRUE;
// The item used for viewing the string: should be a text item, choice item or listbox.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow)
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow)
return FALSE;
- if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
+ if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
- wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
- if (!strings->Member(text->GetValue()))
+ wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
+ if (!m_strings->Member(text->GetValue()))
{
wxString s("Value ");
s += text->GetValue();
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow)
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow)
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();
}
- 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)
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;
if ((n = rbox->GetSelection()) > -1)
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)
property->GetValue() = choice->GetStringSelection();
}
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
- wxWindow *propertyWindow = property->GetWindow();
- if (!propertyWindow)
+ wxWindow *m_propertyWindow = property->GetWindow();
+ if (!m_propertyWindow)
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());
}
- else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{
- wxListBox *lbox = (wxListBox *)propertyWindow;
- if (lbox->Number() == 0 && strings)
+ wxListBox *lbox = (wxListBox *)m_propertyWindow;
+ if (lbox->Number() == 0 && m_strings)
{
// Try to initialize the listbox from 'strings'
- wxNode *node = strings->First();
+ wxNode *node = m_strings->First();
while (node)
{
char *s = (char *)node->Data();
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());
}
*/
- else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
+ else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{
- wxChoice *choice = (wxChoice *)propertyWindow;
+ wxChoice *choice = (wxChoice *)m_propertyWindow;
#ifndef __XVIEW__
- if (choice->Number() == 0 && strings)
+ if (choice->Number() == 0 && m_strings)
{
// Try to initialize the choice item from 'strings'
// XView doesn't allow this kind of thing.
- wxNode *node = strings->First();
+ wxNode *node = m_strings->First();
while (node)
{
char *s = (char *)node->Data();
class wxPropertyFormView: public wxPropertyView
{
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:
- static bool dialogCancelled;
-
wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0);
~wxPropertyFormView(void);
// TODO: does OnCommand still get called...???
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
- inline virtual void AssociatePanel(wxWindow *win) { propertyWindow = win; }
- inline virtual wxWindow *GetPanel(void) { return propertyWindow; }
+ inline virtual void AssociatePanel(wxWindow *win) { m_propertyWindow = win; }
+ inline virtual wxWindow *GetPanel(void) const { return m_propertyWindow; }
+
+ inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
+ inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
+
+ inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
+ inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
+ inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
+
+public:
+ static bool sm_dialogCancelled;
- inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; }
- inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; }
+ protected:
+ bool m_detailedEditing; // E.g. using listbox for choices
- inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; }
- inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; }
- inline virtual wxButton *GetHelpButton() { return windowHelpButton; }
+ 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()
class wxRealFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxRealFormValidator)
- protected:
- float realMin;
- float realMax;
public:
// 0.0, 0.0 means no range
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) {}
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
// Called by the view to transfer the property to the window.
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
+
+ protected:
+ float m_realMin;
+ float m_realMax;
};
class wxIntegerFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator)
- protected:
- long integerMin;
- long integerMax;
public:
// 0, 0 means no range
wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags)
{
- integerMin = min; integerMax = max;
+ m_integerMin = min; m_integerMax = max;
}
~wxIntegerFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(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 wxStringFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxStringFormValidator)
- protected:
- wxStringList *strings;
public:
wxStringFormValidator(wxStringList *list = NULL, long flags = 0);
~wxStringFormValidator(void)
{
- if (strings)
- delete strings;
+ if (m_strings)
+ delete m_strings;
}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
+
+ protected:
+ wxStringList* m_strings;
};
/*
class wxPropertyFormDialog: public wxDialog
{
DECLARE_CLASS(wxPropertyFormDialog)
- private:
- wxPropertyFormView *view;
public:
wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
+
+ private:
+ wxPropertyFormView* m_view;
};
/*
class wxPropertyFormPanel: public wxPanel
{
DECLARE_CLASS(wxPropertyFormPanel)
- private:
- wxPropertyFormView *view;
public:
wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"):
wxPanel(parent, -1, pos, size, style, name)
{
- view = v;
+ m_view = v;
}
void OnDefaultAction(wxControl *item);
void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
+
+ private:
+ wxPropertyFormView* m_view;
};
/*
class wxPropertyFormFrame: public wxFrame
{
DECLARE_CLASS(wxPropertyFormFrame)
- private:
- wxPropertyFormView *view;
- wxPanel *propertyPanel;
public:
wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
wxFrame(parent, -1, title, pos, size, style, name)
{
- view = v;
- propertyPanel = NULL;
+ m_view = v;
+ m_propertyPanel = NULL;
}
bool OnClose(void);
// Must call this to create panel and associate view
virtual bool Initialize(void);
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
long style, const wxString& name):
wxTextCtrl(parent, id, value, pos, size, style, wxDefaultValidator, name)
{
- view = v;
+ m_view = v;
}
void wxPropertyTextEdit::OnSetFocus(void)
EVT_LISTBOX(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect)
END_EVENT_TABLE()
-bool wxPropertyListView::dialogCancelled = FALSE;
-wxBitmap *wxPropertyListView::tickBitmap = NULL;
-wxBitmap *wxPropertyListView::crossBitmap = NULL;
+bool wxPropertyListView::sm_dialogCancelled = FALSE;
+wxBitmap *wxPropertyListView::sm_tickBitmap = NULL;
+wxBitmap *wxPropertyListView::sm_crossBitmap = NULL;
wxPropertyListView::wxPropertyListView(wxPanel *propPanel, long flags):wxPropertyView(flags)
{
- propertyScrollingList = NULL;
- valueList = NULL;
- valueText = NULL;
- editButton = NULL;
- confirmButton = NULL;
- cancelButton = NULL;
- propertyWindow = propPanel;
- managedWindow = NULL;
+ m_propertyScrollingList = NULL;
+ m_valueList = NULL;
+ m_valueText = NULL;
+ m_editButton = NULL;
+ m_confirmButton = NULL;
+ m_cancelButton = NULL;
+ m_propertyWindow = propPanel;
+ m_managedWindow = NULL;
- windowCloseButton = NULL;
- windowCancelButton = NULL;
- windowHelpButton = NULL;
+ m_windowCloseButton = NULL;
+ m_windowCancelButton = NULL;
+ m_windowHelpButton = NULL;
- detailedEditing = FALSE;
+ m_detailedEditing = FALSE;
}
wxPropertyListView::~wxPropertyListView(void)
{
/*
- if (tickBitmap)
- delete tickBitmap;
- if (crossBitmap)
- delete crossBitmap;
+ if (m_tickBitmap)
+ delete m_tickBitmap;
+ if (m_crossBitmap)
+ delete m_crossBitmap;
*/
}
void wxPropertyListView::ShowView(wxPropertySheet *ps, wxPanel *panel)
{
- propertySheet = ps;
-
+ m_propertySheet = ps;
+
AssociatePanel(panel);
CreateControls();
bool wxPropertyListView::UpdatePropertyList(bool clearEditArea)
{
- if (!propertyScrollingList || !propertySheet)
+ if (!m_propertyScrollingList || !m_propertySheet)
return FALSE;
- propertyScrollingList->Clear();
+ m_propertyScrollingList->Clear();
if (clearEditArea)
{
- valueList->Clear();
- valueText->SetValue("");
+ m_valueList->Clear();
+ m_valueText->SetValue("");
}
- wxNode *node = propertySheet->GetProperties().First();
+ wxNode *node = m_propertySheet->GetProperties().First();
// Should sort them... later...
while (node)
wxString stringValueRepr(property->GetValue().GetStringRepresentation());
wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr));
- propertyScrollingList->Append(paddedString.GetData(), (char *)property);
+ m_propertyScrollingList->Append(paddedString.GetData(), (char *)property);
node = node->Next();
}
return TRUE;
bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property)
{
- if (!propertyScrollingList || !propertySheet)
+ if (!m_propertyScrollingList || !m_propertySheet)
return FALSE;
- int currentlySelected = propertyScrollingList->GetSelection();
+ int currentlySelected = m_propertyScrollingList->GetSelection();
// #ifdef __WXMSW__
wxString stringValueRepr(property->GetValue().GetStringRepresentation());
wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr));
// Don't update the listbox unnecessarily because it can cause
// ugly flashing.
- if (paddedString != propertyScrollingList->GetString(sel))
- propertyScrollingList->SetString(sel, paddedString.GetData());
+ if (paddedString != m_propertyScrollingList->GetString(sel))
+ m_propertyScrollingList->SetString(sel, paddedString.GetData());
}
//#else
// UpdatePropertyList(FALSE);
// TODO: why is this necessary?
#ifdef __WXMSW__
if (currentlySelected > -1)
- propertyScrollingList->SetSelection(currentlySelected);
+ m_propertyScrollingList->SetSelection(currentlySelected);
#endif
return TRUE;
// Find the wxListBox index corresponding to this property
int wxPropertyListView::FindListIndexForProperty(wxProperty *property)
{
- int n = propertyScrollingList->Number();
+ int n = m_propertyScrollingList->Number();
for (int i = 0; i < n; i++)
{
- if (property == (wxProperty *)propertyScrollingList->wxListBox::GetClientData(i))
+ if (property == (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(i))
return i;
}
return -1;
// property. NULL resets to show no property.
bool wxPropertyListView::ShowProperty(wxProperty *property, bool select)
{
- if (currentProperty)
+ if (m_currentProperty)
{
- EndShowingProperty(currentProperty);
- currentProperty = NULL;
+ EndShowingProperty(m_currentProperty);
+ m_currentProperty = NULL;
}
- valueList->Clear();
- valueText->SetValue("");
+ m_valueList->Clear();
+ m_valueText->SetValue("");
if (property)
{
- currentProperty = property;
+ m_currentProperty = property;
BeginShowingProperty(property);
}
if (select)
{
int sel = FindListIndexForProperty(property);
if (sel > -1)
- propertyScrollingList->SetSelection(sel);
+ m_propertyScrollingList->SetSelection(sel);
}
return TRUE;
}
// Find appropriate validator and load property into value controls
bool wxPropertyListView::BeginShowingProperty(wxProperty *property)
{
- currentValidator = FindPropertyValidator(property);
- if (!currentValidator)
+ m_currentValidator = FindPropertyValidator(property);
+ if (!m_currentValidator)
return FALSE;
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnPrepareControls(property, this, propertyWindow);
+ listValidator->OnPrepareControls(property, this, m_propertyWindow);
DisplayProperty(property);
return TRUE;
}
// Find appropriate validator and unload property from value controls
bool wxPropertyListView::EndShowingProperty(wxProperty *property)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return FALSE;
RetrieveProperty(property);
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnClearControls(property, this, propertyWindow);
- if (detailedEditing)
+ listValidator->OnClearControls(property, this, m_propertyWindow);
+ if (m_detailedEditing)
{
- listValidator->OnClearDetailControls(property, this, propertyWindow);
- detailedEditing = FALSE;
+ listValidator->OnClearDetailControls(property, this, m_propertyWindow);
+ m_detailedEditing = FALSE;
}
return TRUE;
}
void wxPropertyListView::BeginDetailedEditing(void)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return;
- if (!currentProperty)
+ if (!m_currentProperty)
return;
- if (detailedEditing)
+ if (m_detailedEditing)
return;
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- if (!currentProperty->IsEnabled())
+ if (!m_currentProperty->IsEnabled())
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- if (listValidator->OnPrepareDetailControls(currentProperty, this, propertyWindow))
- detailedEditing = TRUE;
+ if (listValidator->OnPrepareDetailControls(m_currentProperty, this, m_propertyWindow))
+ m_detailedEditing = TRUE;
}
void wxPropertyListView::EndDetailedEditing(void)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return;
- if (!currentProperty)
+ if (!m_currentProperty)
return;
- RetrieveProperty(currentProperty);
+ RetrieveProperty(m_currentProperty);
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- if (detailedEditing)
+ if (m_detailedEditing)
{
- listValidator->OnClearDetailControls(currentProperty, this, propertyWindow);
- detailedEditing = FALSE;
+ listValidator->OnClearDetailControls(m_currentProperty, this, m_propertyWindow);
+ m_detailedEditing = FALSE;
}
}
bool wxPropertyListView::DisplayProperty(wxProperty *property)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return FALSE;
- if (((currentValidator->GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == 0) || !property->IsEnabled())
- valueText->SetEditable(FALSE);
+ if (((m_currentValidator->GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == 0) || !property->IsEnabled())
+ m_valueText->SetEditable(FALSE);
else
- valueText->SetEditable(TRUE);
+ m_valueText->SetEditable(TRUE);
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnDisplayValue(property, this, propertyWindow);
+ listValidator->OnDisplayValue(property, this, m_propertyWindow);
return TRUE;
}
bool wxPropertyListView::RetrieveProperty(wxProperty *property)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return FALSE;
if (!property->IsEnabled())
return FALSE;
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- if (listValidator->OnCheckValue(property, this, propertyWindow))
+ if (listValidator->OnCheckValue(property, this, m_propertyWindow))
{
- if (listValidator->OnRetrieveValue(property, this, propertyWindow))
+ if (listValidator->OnRetrieveValue(property, this, m_propertyWindow))
{
UpdatePropertyDisplayInList(property);
OnPropertyChanged(property);
else
{
// Revert to old value
- listValidator->OnDisplayValue(property, this, propertyWindow);
+ listValidator->OnDisplayValue(property, this, m_propertyWindow);
}
return TRUE;
}
// Called by the listbox callback
void wxPropertyListView::OnPropertySelect(wxCommandEvent& WXUNUSED(event))
{
- int sel = propertyScrollingList->GetSelection();
+ int sel = m_propertyScrollingList->GetSelection();
if (sel > -1)
{
- wxProperty *newSel = (wxProperty *)propertyScrollingList->wxListBox::GetClientData(sel);
- if (newSel && newSel != currentProperty)
+ wxProperty *newSel = (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(sel);
+ if (newSel && newSel != m_currentProperty)
{
ShowProperty(newSel, FALSE);
}
bool wxPropertyListView::CreateControls(void)
{
- wxPanel *panel = (wxPanel *)propertyWindow;
+ wxPanel *panel = (wxPanel *)m_propertyWindow;
int largeButtonWidth = 60;
int largeButtonHeight = 25;
smallButtonHeight = -1;
#endif
- if (valueText)
+ if (m_valueText)
return TRUE;
if (!panel)
// These buttons are at the bottom of the window, but create them now
// so the constraints are evaluated in the correct order
- if (buttonFlags & wxPROP_BUTTON_OK)
+ if (m_buttonFlags & wxPROP_BUTTON_OK)
{
- windowCloseButton = new wxButton(panel, wxID_OK, "OK",
+ m_windowCloseButton = new wxButton(panel, wxID_OK, "OK",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
- windowCloseButton->SetDefault();
- windowCloseButton->SetFocus();
+ m_windowCloseButton->SetDefault();
+ m_windowCloseButton->SetFocus();
}
- else if (buttonFlags & wxPROP_BUTTON_CLOSE)
+ else if (m_buttonFlags & wxPROP_BUTTON_CLOSE)
{
- windowCloseButton = new wxButton(panel, wxID_OK, "Close",
+ m_windowCloseButton = new wxButton(panel, wxID_OK, "Close",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
}
- if (buttonFlags & wxPROP_BUTTON_CANCEL)
+ if (m_buttonFlags & wxPROP_BUTTON_CANCEL)
{
- windowCancelButton = new wxButton(panel, wxID_CANCEL, "Cancel",
+ m_windowCancelButton = new wxButton(panel, wxID_CANCEL, "Cancel",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
}
- if (buttonFlags & wxPROP_BUTTON_HELP)
+ if (m_buttonFlags & wxPROP_BUTTON_HELP)
{
- windowHelpButton = new wxButton(panel, wxID_HELP, "Help",
+ m_windowHelpButton = new wxButton(panel, wxID_HELP, "Help",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
}
- if (windowCloseButton)
+ if (m_windowCloseButton)
{
wxLayoutConstraints *c1 = new wxLayoutConstraints;
c1->bottom.SameAs (panel, wxBottom, 2);
c1->width.AsIs();
c1->height.AsIs();
- windowCloseButton->SetConstraints(c1);
- leftMostWindow = windowCloseButton;
+ m_windowCloseButton->SetConstraints(c1);
+ leftMostWindow = m_windowCloseButton;
}
- if (windowCancelButton)
+ if (m_windowCancelButton)
{
wxLayoutConstraints *c2 = new wxLayoutConstraints;
c2->bottom.SameAs (panel, wxBottom, 2);
c2->width.AsIs();
c2->height.AsIs();
- windowCancelButton->SetConstraints(c2);
- leftMostWindow = windowCancelButton;
+ m_windowCancelButton->SetConstraints(c2);
+ leftMostWindow = m_windowCancelButton;
}
- if (windowHelpButton)
+ if (m_windowHelpButton)
{
wxLayoutConstraints *c2 = new wxLayoutConstraints;
if (leftMostWindow == panel)
c2->bottom.SameAs (panel, wxBottom, 2);
c2->width.AsIs();
c2->height.AsIs();
- windowHelpButton->SetConstraints(c2);
- leftMostWindow = windowHelpButton;
+ m_windowHelpButton->SetConstraints(c2);
+ leftMostWindow = m_windowHelpButton;
}
- if (buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
+ if (m_buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
{
/*
if (!tickBitmap)
/*
if (tickBitmap && crossBitmap)
{
- confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap,
+ m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap,
wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5));
- cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap,
+ m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap,
wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5));
}
else
*/
{
- confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)",
+ m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)",
wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
- cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X",
+ m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X",
wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
}
c->left.SameAs (panel, wxLeft, 2);
/*
if (windowCloseButton)
- c->top.Below (windowCloseButton, 2);
+ c->top.Below (m_windowCloseButton, 2);
else
*/
c->top.SameAs (panel, wxTop, 2);
c->width.AsIs();
c->height.AsIs();
- cancelButton->SetConstraints(c);
+ m_cancelButton->SetConstraints(c);
c = new wxLayoutConstraints;
- c->left.RightOf (cancelButton, 2);
- c->top.SameAs (cancelButton, wxTop, 0);
+ c->left.RightOf (m_cancelButton, 2);
+ c->top.SameAs (m_cancelButton, wxTop, 0);
c->width.AsIs();
c->height.AsIs();
- confirmButton->SetConstraints(c);
+ m_confirmButton->SetConstraints(c);
- cancelButton->Enable(FALSE);
- confirmButton->Enable(FALSE);
+ m_cancelButton->Enable(FALSE);
+ m_confirmButton->Enable(FALSE);
}
- if (buttonFlags & wxPROP_PULLDOWN)
+ if (m_buttonFlags & wxPROP_PULLDOWN)
{
- editButton = new wxButton(panel, wxID_PROP_EDIT, "...",
+ m_editButton = new wxButton(panel, wxID_PROP_EDIT, "...",
wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
- editButton->Enable(FALSE);
+ m_editButton->Enable(FALSE);
wxLayoutConstraints *c = new wxLayoutConstraints;
/*
- if (windowCloseButton)
- c->top.Below (windowCloseButton, 2);
+ if (m_windowCloseButton)
+ c->top.Below (m_windowCloseButton, 2);
else
*/
c->top.SameAs (panel, wxTop, 2);
c->right.SameAs (panel, wxRight, 2);
c->width.AsIs();
c->height.AsIs();
- editButton->SetConstraints(c);
+ m_editButton->SetConstraints(c);
}
- valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER);
- valueText->Enable(FALSE);
+ m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER);
+ m_valueText->Enable(FALSE);
wxLayoutConstraints *c = new wxLayoutConstraints;
- if (cancelButton)
- c->left.RightOf (confirmButton, 2);
+ if (m_cancelButton)
+ c->left.RightOf (m_confirmButton, 2);
else
c->left.SameAs (panel, wxLeft, 2);
/*
- if (windowCloseButton)
- c->top.Below (windowCloseButton, 2);
+ if (m_windowCloseButton)
+ c->top.Below (m_windowCloseButton, 2);
else
*/
c->top.SameAs (panel, wxTop, 2);
- if (editButton)
- c->right.LeftOf (editButton, 2);
+ if (m_editButton)
+ c->right.LeftOf (m_editButton, 2);
else
c->right.SameAs (panel, wxRight, 2);
c->height.AsIs();
- valueText->SetConstraints(c);
+ m_valueText->SetConstraints(c);
- valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60));
- valueList->Show(FALSE);
+ m_valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60));
+ m_valueList->Show(FALSE);
c = new wxLayoutConstraints;
c->left.SameAs (panel, wxLeft, 2);
- c->top.Below (valueText, 2);
+ c->top.Below (m_valueText, 2);
c->right.SameAs (panel, wxRight, 2);
c->height.Absolute(60);
- valueList->SetConstraints(c);
+ m_valueList->SetConstraints(c);
- propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT,
+ m_propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT,
wxPoint(-1, -1), wxSize(300, 300));
- propertyScrollingList->SetFont(boringFont);
+ m_propertyScrollingList->SetFont(boringFont);
c = new wxLayoutConstraints;
c->left.SameAs (panel, wxLeft, 2);
- if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
- c->top.Below (valueText, 2);
+ if (m_buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
+ c->top.Below (m_valueText, 2);
else
- c->top.Below (valueList, 2);
+ c->top.Below (m_valueList, 2);
c->right.SameAs (panel, wxRight, 2);
- if (windowCloseButton)
- c->bottom.Above (windowCloseButton, -2);
+ if (m_windowCloseButton)
+ c->bottom.Above (m_windowCloseButton, -2);
else
c->bottom.SameAs (panel, wxBottom, 2);
- propertyScrollingList->SetConstraints(c);
-
+ m_propertyScrollingList->SetConstraints(c);
// Note: if this is called now, it causes a GPF.
// Why?
void wxPropertyListView::ShowTextControl(bool show)
{
- if (valueText)
- valueText->Show(show);
+ if (m_valueText)
+ m_valueText->Show(show);
}
void wxPropertyListView::ShowListBoxControl(bool show)
{
- if (valueList)
+ if (m_valueList)
{
- valueList->Show(show);
- if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
+ m_valueList->Show(show);
+ if (m_buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
{
- wxLayoutConstraints *constraints = propertyScrollingList->GetConstraints();
+ wxLayoutConstraints *constraints = m_propertyScrollingList->GetConstraints();
if (constraints)
{
if (show)
{
- constraints->top.Below(valueList, 2);
+ constraints->top.Below(m_valueList, 2);
// Maintain back-pointer so when valueList is deleted,
// any reference to it from this window is removed.
- valueList->AddConstraintReference(propertyScrollingList);
+ m_valueList->AddConstraintReference(m_propertyScrollingList);
}
else
{
- constraints->top.Below(valueText, 2);
- valueText->AddConstraintReference(propertyScrollingList);
+ constraints->top.Below(m_valueText, 2);
+ m_valueText->AddConstraintReference(m_propertyScrollingList);
}
- propertyWindow->Layout();
+ m_propertyWindow->Layout();
}
}
}
void wxPropertyListView::EnableCheck(bool show)
{
- if (confirmButton)
- confirmButton->Enable(show);
+ if (m_confirmButton)
+ m_confirmButton->Enable(show);
}
void wxPropertyListView::EnableCross(bool show)
{
- if (cancelButton)
- cancelButton->Enable(show);
+ if (m_cancelButton)
+ m_cancelButton->Enable(show);
}
bool wxPropertyListView::OnClose(void)
void wxPropertyListView::OnValueListSelect(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnValueListSelect(currentProperty, this, propertyWindow);
+ listValidator->OnValueListSelect(m_currentProperty, this, m_propertyWindow);
}
}
// Retrieve the value if any
OnCheck(event);
- managedWindow->Close(TRUE);
+ m_managedWindow->Close(TRUE);
}
void wxPropertyListView::OnCancel(wxCommandEvent& WXUNUSED(event))
{
// SetReturnCode(wxID_CANCEL);
- managedWindow->Close(TRUE);
- dialogCancelled = TRUE;
+ m_managedWindow->Close(TRUE);
+ sm_dialogCancelled = TRUE;
}
void wxPropertyListView::OnHelp(wxCommandEvent& WXUNUSED(event))
void wxPropertyListView::OnCheck(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty)
+ if (m_currentProperty)
{
- RetrieveProperty(currentProperty);
+ RetrieveProperty(m_currentProperty);
}
}
void wxPropertyListView::OnCross(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
// Revert to old value
- listValidator->OnDisplayValue(currentProperty, this, propertyWindow);
+ listValidator->OnDisplayValue(m_currentProperty, this, m_propertyWindow);
}
}
void wxPropertyListView::OnPropertyDoubleClick(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
// Revert to old value
- listValidator->OnDoubleClick(currentProperty, this, propertyWindow);
+ listValidator->OnDoubleClick(m_currentProperty, this, m_propertyWindow);
}
}
void wxPropertyListView::OnEdit(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnEdit(currentProperty, this, propertyWindow);
+ listValidator->OnEdit(m_currentProperty, this, m_propertyWindow);
}
}
const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
{
- view = v;
- view->AssociatePanel( ((wxPanel*)this) );
- view->SetManagedWindow(this);
+ m_view = v;
+ m_view->AssociatePanel( ((wxPanel*)this) );
+ m_view->SetManagedWindow(this);
SetAutoLayout(TRUE);
}
bool wxPropertyListDialog::OnClose(void)
{
- if (view)
+ if (m_view)
{
SetReturnCode(wxID_CANCEL);
- view->OnClose();
- view = NULL;
+ m_view->OnClose();
+ m_view = NULL;
return TRUE;
}
else
void wxPropertyListDialog::OnDefaultAction(wxControl *item)
{
/*
- if (item == view->GetPropertyScrollingList())
+ if (item == m_view->GetPropertyScrollingList())
view->OnDoubleClick();
*/
}
// Extend event processing to search the view's event table
bool wxPropertyListDialog::ProcessEvent(wxEvent& event)
{
- if ( !view || ! view->ProcessEvent(event) )
+ if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
// Extend event processing to search the view's event table
bool wxPropertyListPanel::ProcessEvent(wxEvent& event)
{
- if ( !view || ! view->ProcessEvent(event) )
+ if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
bool wxPropertyListFrame::OnClose(void)
{
- if (view)
+ if (m_view)
{
- if (propertyPanel)
- propertyPanel->SetView(NULL);
- view->OnClose();
- view = NULL;
+ if (m_propertyPanel)
+ m_propertyPanel->SetView(NULL);
+ m_view->OnClose();
+ m_view = NULL;
return TRUE;
}
else
bool wxPropertyListFrame::Initialize(void)
{
- propertyPanel = OnCreatePanel(this, view);
- if (propertyPanel)
+ m_propertyPanel = OnCreatePanel(this, m_view);
+ if (m_propertyPanel)
{
- view->AssociatePanel(propertyPanel);
- view->SetManagedWindow(this);
- propertyPanel->SetAutoLayout(TRUE);
+ m_view->AssociatePanel(m_propertyPanel);
+ m_view->SetManagedWindow(this);
+ m_propertyPanel->SetAutoLayout(TRUE);
return TRUE;
}
else
///
bool wxRealListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (realMin == 0.0 && realMax == 0.0)
+ if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
if (!view->GetValueText())
return FALSE;
}
- if (val < realMin || val > realMax)
+ if (val < m_realMin || val > m_realMax)
{
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);
return FALSE;
}
bool wxIntegerListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (integerMin == 0 && integerMax == 0)
+ if (m_integerMin == 0 && m_integerMax == 0)
return TRUE;
if (!view->GetValueText())
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
- if (val < integerMin || val > integerMax)
+ if (val < m_integerMin || val > m_integerMax)
{
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);
return FALSE;
}
wxStringListValidator::wxStringListValidator(wxStringList *list, long flags):
wxPropertyListValidator(flags)
{
- strings = list;
+ m_strings = list;
// If no constraint, we just allow the string to be edited.
- if (!strings && ((validatorFlags & wxPROP_ALLOW_TEXT_EDITING) == 0))
- validatorFlags |= wxPROP_ALLOW_TEXT_EDITING;
+ if (!m_strings && ((m_validatorFlags & wxPROP_ALLOW_TEXT_EDITING) == 0))
+ m_validatorFlags |= wxPROP_ALLOW_TEXT_EDITING;
}
bool wxStringListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (!strings)
+ if (!m_strings)
return TRUE;
if (!view->GetValueText())
return FALSE;
wxString value(view->GetValueText()->GetValue());
- if (!strings->Member(value.GetData()))
+ if (!m_strings->Member(value.GetData()))
{
wxString s("Value ");
s += value.GetData();
return FALSE;
wxString str(property->GetValue().GetStringRepresentation());
view->GetValueText()->SetValue(str);
- if (strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->Number() > 0)
+ if (m_strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->Number() > 0)
{
view->GetValueList()->SetStringSelection(str);
}
bool wxStringListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
// Unconstrained
- if (!strings)
+ if (!m_strings)
{
if (view->GetEditButton())
view->GetEditButton()->Enable(FALSE);
{
view->ShowListBoxControl(TRUE);
view->GetValueList()->Enable(TRUE);
- wxNode *node = strings->First();
+ wxNode *node = m_strings->First();
while (node)
{
char *s = (char *)node->Data();
bool wxStringListValidator::OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (!strings)
+ if (!m_strings)
{
return TRUE;
}
{
if (!view->GetValueText())
return FALSE;
- if (!strings)
+ if (!m_strings)
return FALSE;
- wxNode *node = strings->First();
+ wxNode *node = m_strings->First();
char *currentString = property->GetValue().StringValue();
while (node)
{
if (node->Next())
nextString = (char *)node->Next()->Data();
else
- nextString = (char *)strings->First()->Data();
+ nextString = (char *)m_strings->First()->Data();
property->GetValue() = wxString(nextString);
view->DisplayProperty(property);
view->UpdatePropertyDisplayInList(property);
IMPLEMENT_DYNAMIC_CLASS(wxFilenameListValidator, wxPropertyListValidator)
wxFilenameListValidator::wxFilenameListValidator(wxString message , wxString wildcard, long flags):
- wxPropertyListValidator(flags), filenameWildCard(wildcard), filenameMessage(message)
+ wxPropertyListValidator(flags), m_filenameWildCard(wildcard), m_filenameMessage(message)
{
}
return;
char *s = wxFileSelector(
- filenameMessage.GetData(),
+ m_filenameMessage.GetData(),
wxPathOnly(property->GetValue().StringValue()),
wxFileNameFromPath(property->GetValue().StringValue()),
NULL,
- filenameWildCard.GetData(),
+ m_filenameWildCard.GetData(),
0,
parentWindow);
if (s)
class wxPropertyStringListEditorDialog: public wxDialog
{
public:
- wxStringList *stringList;
- wxListBox *listBox;
- wxTextCtrl *stringText;
- static bool dialogCancelled;
- int currentSelection;
wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = "stringEditorDialogBox"):
wxDialog(parent, -1, title, pos, size, windowStyle, name)
{
- stringList = NULL;
- stringText = NULL;
- listBox = NULL;
- dialogCancelled = FALSE;
- currentSelection = -1;
+ m_stringList = NULL;
+ m_stringText = NULL;
+ m_listBox = NULL;
+ sm_dialogCancelled = FALSE;
+ m_currentSelection = -1;
}
~wxPropertyStringListEditorDialog(void) {}
bool OnClose(void);
void OnStrings(wxCommandEvent& event);
void OnText(wxCommandEvent& event);
+public:
+ wxStringList* m_stringList;
+ wxListBox* m_listBox;
+ wxTextCtrl* m_stringText;
+ static bool sm_dialogCancelled;
+ int m_currentSelection;
DECLARE_EVENT_TABLE()
};
}
};
-bool wxPropertyStringListEditorDialog::dialogCancelled = FALSE;
+bool wxPropertyStringListEditorDialog::sm_dialogCancelled = FALSE;
// Edit the string list.
bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList *stringList, const char *title)
wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent,
title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
- dialog->stringList = stringList;
+ dialog->m_stringList = stringList;
- dialog->listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS,
+ dialog->m_listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS,
wxPoint(-1, -1), wxSize(-1, -1), 0, NULL, wxLB_SINGLE);
- dialog->stringText = new wxPropertyStringListEditorText(dialog,
+ dialog->m_stringText = new wxPropertyStringListEditorText(dialog,
wxID_PROP_SL_TEXT, "", wxPoint(5, 240),
wxSize(300, -1), wxPROCESS_ENTER);
- dialog->stringText->Enable(FALSE);
+ dialog->m_stringText->Enable(FALSE);
wxButton *addButton = new wxButton(dialog, wxID_PROP_SL_ADD, "Add", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
wxButton *deleteButton = new wxButton(dialog, wxID_PROP_SL_DELETE, "Delete", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
c->top.SameAs (dialog, wxTop, 2);
c->left.SameAs (dialog, wxLeft, 2);
c->right.SameAs (dialog, wxRight, 2);
- c->bottom.SameAs (dialog->stringText, wxTop, 2);
- dialog->listBox->SetConstraints(c);
+ c->bottom.SameAs (dialog->m_stringText, wxTop, 2);
+ dialog->m_listBox->SetConstraints(c);
c = new wxLayoutConstraints;
c->left.SameAs (dialog, wxLeft, 2);
c->right.SameAs (dialog, wxRight, 2);
c->bottom.SameAs (addButton, wxTop, 2);
c->height.AsIs();
- dialog->stringText->SetConstraints(c);
+ dialog->m_stringText->SetConstraints(c);
c = new wxLayoutConstraints;
c->bottom.SameAs (dialog, wxBottom, 2);
{
char *str = (char *)node->Data();
// Save node as client data for each listbox item
- dialog->listBox->Append(str, (char *)node);
+ dialog->m_listBox->Append(str, (char *)node);
node = node->Next();
}
void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& WXUNUSED(event))
{
- int sel = listBox->GetSelection();
+ int sel = m_listBox->GetSelection();
if (sel > -1)
{
- currentSelection = sel;
+ m_currentSelection = sel;
ShowCurrentSelection();
}
void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event))
{
- int sel = listBox->GetSelection();
+ int sel = m_listBox->GetSelection();
if (sel == -1)
return;
- wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(sel);
+ wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel);
if (!node)
return;
- listBox->Delete(sel);
+ m_listBox->Delete(sel);
delete[] (char *)node->Data();
delete node;
- currentSelection = -1;
- stringText->SetValue("");
+ m_currentSelection = -1;
+ m_stringText->SetValue("");
}
void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
SaveCurrentSelection();
char *initialText = "";
- wxNode *node = stringList->Add(initialText);
- listBox->Append(initialText, (char *)node);
- currentSelection = stringList->Number() - 1;
- listBox->SetSelection(currentSelection);
+ wxNode *node = m_stringList->Add(initialText);
+ m_listBox->Append(initialText, (char *)node);
+ m_currentSelection = m_stringList->Number() - 1;
+ m_listBox->SetSelection(m_currentSelection);
ShowCurrentSelection();
- stringText->SetFocus();
+ m_stringText->SetFocus();
}
void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& WXUNUSED(event))
void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
- dialogCancelled = TRUE;
+ sm_dialogCancelled = TRUE;
EndModal(wxID_CANCEL);
Close(TRUE);
}
void wxPropertyStringListEditorDialog::SaveCurrentSelection(void)
{
- if (currentSelection == -1)
+ if (m_currentSelection == -1)
return;
- wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection);
+ wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(m_currentSelection);
if (!node)
return;
- wxString txt(stringText->GetValue());
+ wxString txt(m_stringText->GetValue());
if (node->Data())
delete[] (char *)node->Data();
node->SetData((wxObject *)copystring(txt));
- listBox->SetString(currentSelection, (char *)node->Data());
+ m_listBox->SetString(m_currentSelection, (char *)node->Data());
}
void wxPropertyStringListEditorDialog::ShowCurrentSelection(void)
{
- if (currentSelection == -1)
+ if (m_currentSelection == -1)
{
- stringText->SetValue("");
+ m_stringText->SetValue("");
return;
}
- wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection);
+ wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(m_currentSelection);
char *txt = (char *)node->Data();
- stringText->SetValue(txt);
- stringText->Enable(TRUE);
+ m_stringText->SetValue(txt);
+ m_stringText->Enable(TRUE);
}
class wxPropertyListView: public wxPropertyView
{
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:
- static bool dialogCancelled;
-
wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT);
~wxPropertyListView(void);
void OnEdit(wxCommandEvent& event);
void OnText(wxCommandEvent& event);
- inline virtual wxListBox *GetPropertyScrollingList() { return propertyScrollingList; }
- inline virtual wxListBox *GetValueList() { return valueList; }
- inline virtual wxTextCtrl *GetValueText() { return valueText; }
- inline virtual wxButton *GetConfirmButton() { return confirmButton; }
- inline virtual wxButton *GetCancelButton() { return cancelButton; }
- inline virtual wxButton *GetEditButton() { return editButton; }
- inline virtual bool GetDetailedEditing(void) { return detailedEditing; }
+ inline virtual wxListBox *GetPropertyScrollingList() const { return m_propertyScrollingList; }
+ inline virtual wxListBox *GetValueList() const { return m_valueList; }
+ inline virtual wxTextCtrl *GetValueText() const { return m_valueText; }
+ inline virtual wxButton *GetConfirmButton() const { return m_confirmButton; }
+ inline virtual wxButton *GetCancelButton() const { return m_cancelButton; }
+ inline virtual wxButton *GetEditButton() const { return m_editButton; }
+ inline virtual bool GetDetailedEditing(void) const { return m_detailedEditing; }
- inline virtual void AssociatePanel(wxPanel *win) { propertyWindow = win; }
- inline virtual wxPanel *GetPanel(void) { return propertyWindow; }
+ inline virtual void AssociatePanel(wxPanel *win) { m_propertyWindow = win; }
+ inline virtual wxPanel *GetPanel(void) const { return m_propertyWindow; }
- inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; }
- inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; }
+ inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
+ inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
- inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; }
- inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; }
- inline virtual wxButton *GetHelpButton() { return windowHelpButton; }
+ inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
+ inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
+ inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
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_CLASS(wxPropertyTextEdit)
public:
- wxPropertyListView *view;
wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id,
const wxString& value, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text");
void OnSetFocus(void);
void OnKillFocus(void);
+
+ wxPropertyListView* m_view;
};
#define wxPROP_ALLOW_TEXT_EDITING 1
class wxPropertyListDialog: public wxDialog
{
DECLARE_CLASS(wxPropertyListDialog)
- private:
- wxPropertyListView *view;
public:
wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
+ private:
+ wxPropertyListView* m_view;
+
DECLARE_EVENT_TABLE()
};
class wxPropertyListPanel: public wxPanel
{
DECLARE_CLASS(wxPropertyListPanel)
- private:
- wxPropertyListView *view;
public:
wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = "panel"):
wxPanel(parent, -1, pos, size, style, name)
{
- view = v;
+ m_view = v;
}
~wxPropertyListPanel();
void OnDefaultAction(wxControl *item);
- inline void SetView(wxPropertyListView* v) { view = v; }
- inline wxPropertyListView* GetView() const { return view; }
+ inline void SetView(wxPropertyListView* v) { m_view = v; }
+ inline wxPropertyListView* GetView() const { return m_view; }
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
// Call Layout()
void OnSize(wxSizeEvent& event);
+ private:
+ wxPropertyListView* m_view;
+
DECLARE_EVENT_TABLE()
};
class wxPropertyListFrame: public wxFrame
{
DECLARE_CLASS(wxPropertyListFrame)
- private:
- wxPropertyListView *view;
- wxPropertyListPanel *propertyPanel;
public:
wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
wxFrame(parent, -1, title, pos, size, style, name)
{
- view = v;
- propertyPanel = NULL;
+ m_view = v;
+ m_propertyPanel = NULL;
}
bool OnClose(void);
// Must call this to create panel and associate view
virtual bool Initialize(void);
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;
};
/*
class wxRealListValidator: public wxPropertyListValidator
{
DECLARE_DYNAMIC_CLASS(wxRealListValidator)
- protected:
- float realMin;
- float realMax;
public:
// 0.0, 0.0 means no range
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) {}
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+
+ protected:
+ float m_realMin;
+ float m_realMax;
};
class wxIntegerListValidator: public wxPropertyListValidator
{
DECLARE_DYNAMIC_CLASS(wxIntegerListValidator)
- protected:
- long integerMin;
- long integerMax;
public:
// 0, 0 means no range
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) {}
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+
+ protected:
+ long m_integerMin;
+ long m_integerMax;
};
class wxBoolListValidator: public wxPropertyListValidator
class wxStringListValidator: public wxPropertyListValidator
{
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
- protected:
- wxStringList *strings;
public:
wxStringListValidator(wxStringList *list = NULL, long flags = 0);
~wxStringListValidator(void)
{
- if (strings)
- delete strings;
+ if (m_strings)
+ delete m_strings;
}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked. Extra functionality can be provided,
// cycling through possible values.
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+
+ protected:
+ wxStringList* m_strings;
};
class wxFilenameListValidator: public wxPropertyListValidator
{
DECLARE_DYNAMIC_CLASS(wxFilenameListValidator)
- protected:
- wxString filenameWildCard;
- wxString filenameMessage;
-
public:
wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0);
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+
+ protected:
+ wxString m_filenameWildCard;
+ wxString m_filenameMessage;
+
};
class wxColourListValidator: public wxPropertyListValidator