Dialog unit mods; wxProp tidying
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -849,6 +849,9 @@ enum {
|
||||
|
||||
#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
|
||||
|
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
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 );
|
||||
@@ -105,6 +105,14 @@ public:
|
||||
|
||||
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 );
|
||||
|
||||
@@ -167,15 +175,6 @@ public:
|
||||
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
|
||||
@@ -259,9 +258,7 @@ public:
|
||||
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;
|
||||
|
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
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 );
|
||||
@@ -105,6 +105,14 @@ public:
|
||||
|
||||
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 );
|
||||
|
||||
@@ -167,15 +175,6 @@ public:
|
||||
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
|
||||
@@ -259,9 +258,7 @@ public:
|
||||
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;
|
||||
|
@@ -318,15 +318,6 @@ public:
|
||||
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);
|
||||
@@ -338,7 +329,8 @@ public:
|
||||
// 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,
|
||||
@@ -436,6 +428,14 @@ public:
|
||||
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
|
||||
@@ -528,8 +528,6 @@ protected:
|
||||
|
||||
wxColour m_backgroundColour ;
|
||||
wxColour m_foregroundColour ;
|
||||
wxColour m_defaultBackgroundColour;
|
||||
wxColour m_defaultForegroundColour;
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
@@ -598,10 +596,6 @@ inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundCol
|
||||
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
|
||||
inline 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; }
|
||||
|
@@ -330,15 +330,6 @@ public:
|
||||
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); }
|
||||
@@ -359,7 +350,7 @@ public:
|
||||
// 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
|
||||
@@ -474,6 +465,14 @@ public:
|
||||
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,
|
||||
@@ -638,13 +637,8 @@ protected:
|
||||
#endif
|
||||
|
||||
wxButton * m_defaultItem;
|
||||
|
||||
wxColour m_backgroundColour ;
|
||||
wxColour m_defaultBackgroundColour;
|
||||
|
||||
wxColour m_foregroundColour ;
|
||||
wxColour m_defaultForegroundColour;
|
||||
|
||||
bool m_backgroundTransparent;
|
||||
|
||||
int m_xThumbSize;
|
||||
@@ -710,10 +704,6 @@ inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundCol
|
||||
inline wxColour wxWindow::GetBackgroundColour(void) const { return m_backgroundColour; };
|
||||
inline 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; }
|
||||
|
@@ -31,6 +31,17 @@
|
||||
#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
|
||||
*/
|
||||
@@ -39,71 +50,76 @@ class WXDLLEXPORT wxItemResource: public wxObject
|
||||
{
|
||||
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);
|
||||
{ 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 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 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 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 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(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 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 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; }
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -119,55 +135,55 @@ class WXDLLEXPORT wxResourceTable: public wxHashTable
|
||||
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
|
||||
|
@@ -318,15 +318,6 @@ public:
|
||||
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);
|
||||
@@ -338,7 +329,8 @@ public:
|
||||
// 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,
|
||||
@@ -436,6 +428,14 @@ public:
|
||||
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
|
||||
@@ -482,8 +482,6 @@ protected:
|
||||
|
||||
wxColour m_backgroundColour ;
|
||||
wxColour m_foregroundColour ;
|
||||
wxColour m_defaultBackgroundColour;
|
||||
wxColour m_defaultForegroundColour;
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
@@ -522,10 +520,6 @@ inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundCol
|
||||
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
|
||||
inline 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; }
|
||||
|
@@ -91,10 +91,11 @@ bool WXDLLEXPORT StringMatch(char *one, char *two, bool subString = TRUE, bool e
|
||||
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
|
||||
|
||||
// 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,
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,6 @@ bool wxToolBarSimple::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos
|
||||
// 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; }
|
||||
|
@@ -240,19 +240,19 @@ static char hexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A'
|
||||
'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;
|
||||
}
|
||||
@@ -267,6 +267,14 @@ void wxDecToHex(int dec, char *buf)
|
||||
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)
|
||||
|
@@ -64,3 +64,27 @@ void wxWindow::UpdateWindowUI()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog units translations. Implemented in wincmn.cpp.
|
||||
wxPoint wxWindow::ConvertPixelsToDialog(const wxPoint& pt)
|
||||
{
|
||||
int charWidth = GetCharWidth();
|
||||
int charHeight = GetCharHeight();
|
||||
wxPoint pt2;
|
||||
pt2.x = (int) ((pt.x * 4) / charWidth) ;
|
||||
pt2.y = (int) ((pt.y * 8) / charHeight) ;
|
||||
|
||||
return pt2;
|
||||
}
|
||||
|
||||
wxPoint wxWindow::ConvertDialogToPixels(const wxPoint& pt)
|
||||
{
|
||||
int charWidth = GetCharWidth();
|
||||
int charHeight = GetCharHeight();
|
||||
wxPoint pt2;
|
||||
pt2.x = (int) ((pt.x * charWidth) / 4) ;
|
||||
pt2.y = (int) ((pt.y * charHeight) / 8) ;
|
||||
|
||||
return pt2;
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,6 @@ bool wxPanel::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ( ret ) {
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
|
||||
}
|
||||
|
||||
@@ -73,7 +72,6 @@ void wxPanel::SetFocus()
|
||||
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
|
||||
|
@@ -127,7 +127,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
|
||||
|
||||
wxSystemSettings settings;
|
||||
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
@@ -127,7 +127,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
|
||||
|
||||
wxSystemSettings settings;
|
||||
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
@@ -99,10 +99,9 @@ wxWindow::wxWindow()
|
||||
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;
|
||||
@@ -320,10 +319,10 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
|
||||
|
@@ -44,8 +44,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
||||
|
||||
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;
|
||||
|
@@ -56,8 +56,8 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
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;
|
||||
|
||||
|
@@ -51,8 +51,8 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
SetValidator(validator);
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
@@ -221,8 +221,8 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l
|
||||
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 )
|
||||
|
@@ -56,8 +56,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
|
@@ -70,8 +70,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
|
@@ -78,7 +78,6 @@ wxDialog::wxDialog(void)
|
||||
m_modalShowing = FALSE;
|
||||
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
}
|
||||
|
||||
bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
||||
@@ -89,7 +88,6 @@ 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)
|
||||
@@ -592,7 +590,6 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
Ctl3dColorChange();
|
||||
#else
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
Refresh();
|
||||
#endif
|
||||
}
|
||||
|
@@ -52,8 +52,8 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
|
||||
m_rangeMax = range;
|
||||
m_gaugePos = 0;
|
||||
|
||||
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
|
@@ -87,8 +87,8 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
|
||||
m_rangeMax = range;
|
||||
m_gaugePos = 0;
|
||||
|
||||
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
|
@@ -160,7 +160,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxSystemSettings settings;
|
||||
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
|
||||
|
||||
@@ -266,7 +266,7 @@ wxListBox::~wxListBox(void)
|
||||
void wxListBox::SetupColours(void)
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
SetForegroundColour(GetParent()->GetDefaultForegroundColour());
|
||||
SetForegroundColour(GetParent()->GetForegroundColour());
|
||||
}
|
||||
|
||||
void wxListBox::SetFirstItem(int N)
|
||||
|
@@ -126,7 +126,7 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
|
||||
|
||||
wxSystemSettings settings;
|
||||
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
|
@@ -130,9 +130,6 @@ bool wxNotebook::Create(wxWindow *parent,
|
||||
m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
|
||||
m_foregroundColour = *wxBLACK ;
|
||||
|
||||
m_defaultForegroundColour = *wxBLACK ;
|
||||
m_defaultBackgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
|
||||
|
||||
// style
|
||||
m_windowStyle = style | wxTAB_TRAVERSAL;
|
||||
|
||||
|
@@ -98,8 +98,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
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;
|
||||
|
||||
@@ -207,8 +207,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
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;
|
||||
|
||||
|
@@ -45,8 +45,8 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetDefaultBackgroundColour());
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour());
|
||||
SetBackgroundColour(parent->GetBackgroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
@@ -187,8 +187,8 @@ bool wxBitmapRadioButton::Create(wxWindow *parent, wxWindowID id,
|
||||
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();
|
||||
|
@@ -55,8 +55,8 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
||||
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
m_windowStyle = style;
|
||||
|
||||
if ( id == -1 )
|
||||
|
@@ -68,8 +68,8 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
|
@@ -62,8 +62,8 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
|
@@ -47,8 +47,8 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
||||
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);
|
||||
|
||||
|
@@ -46,8 +46,8 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
||||
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();
|
||||
|
@@ -52,8 +52,8 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
|
@@ -42,8 +42,8 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||
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();
|
||||
|
@@ -72,10 +72,6 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
||||
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;
|
||||
@@ -196,8 +192,6 @@ void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
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();
|
||||
|
@@ -100,10 +100,6 @@ bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, co
|
||||
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;
|
||||
@@ -475,8 +471,6 @@ void wxToolBar95::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
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();
|
||||
|
@@ -95,7 +95,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
@@ -254,7 +254,7 @@ void wxTextCtrl::AdoptAttributesFromHWND(void)
|
||||
void wxTextCtrl::SetupColours(void)
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
SetForegroundColour(GetParent()->GetDefaultForegroundColour());
|
||||
SetForegroundColour(GetParent()->GetForegroundColour());
|
||||
}
|
||||
|
||||
wxString wxTextCtrl::GetValue(void) const
|
||||
|
@@ -61,7 +61,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
|
||||
{
|
||||
wxSystemSettings settings;
|
||||
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
@@ -238,10 +238,9 @@ wxWindow::wxWindow(void)
|
||||
|
||||
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)),
|
||||
@@ -437,9 +436,8 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
|
||||
|
@@ -75,10 +75,9 @@ wxWindow::wxWindow()
|
||||
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;
|
||||
@@ -185,10 +184,9 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
|
||||
|
@@ -46,6 +46,7 @@ IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler)
|
||||
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)
|
||||
@@ -292,6 +293,23 @@ void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int
|
||||
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)
|
||||
{
|
||||
@@ -354,6 +372,15 @@ 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();
|
||||
@@ -911,6 +938,9 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
|
||||
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;
|
||||
@@ -967,11 +997,33 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
|
||||
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();
|
||||
@@ -991,6 +1043,16 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
|
||||
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();
|
||||
|
@@ -50,6 +50,7 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
|
||||
|
||||
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);
|
||||
|
@@ -48,7 +48,7 @@ wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWin
|
||||
{
|
||||
}
|
||||
|
||||
void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event)
|
||||
void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event))
|
||||
{
|
||||
#if 0
|
||||
long sel = GetSelection();
|
||||
@@ -70,7 +70,7 @@ void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event)
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& event)
|
||||
void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
|
||||
{
|
||||
long sel = GetSelection();
|
||||
if (sel == -1)
|
||||
|
@@ -515,7 +515,7 @@ bool wxResourceManager::DisassociateWindows()
|
||||
{
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceTable.Next())
|
||||
while ((node = m_resourceTable.Next()))
|
||||
{
|
||||
wxItemResource *res = (wxItemResource *)node->Data();
|
||||
DisassociateResource(res);
|
||||
@@ -541,7 +541,7 @@ void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *wi
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ wxItemResource *wxResourceManager::FindResourceForWindow(wxWindow *win)
|
||||
{
|
||||
m_resourceAssociations.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceAssociations.Next())
|
||||
while ((node = m_resourceAssociations.Next()))
|
||||
{
|
||||
wxWindow *w = (wxWindow *)node->Data();
|
||||
if (w == win)
|
||||
@@ -675,8 +675,10 @@ void wxResourceManager::MakeUniqueName(char *prefix, char *buf)
|
||||
|
||||
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),
|
||||
@@ -849,7 +851,7 @@ void wxResourceManager::UpdateResourceList()
|
||||
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceTable.Next())
|
||||
while ((node = m_resourceTable.Next()))
|
||||
{
|
||||
wxItemResource *res = (wxItemResource *)node->Data();
|
||||
wxString resType(res->GetType());
|
||||
@@ -956,6 +958,8 @@ bool wxResourceManager::CreateNewPanel()
|
||||
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);
|
||||
@@ -966,13 +970,19 @@ bool wxResourceManager::CreateNewPanel()
|
||||
|
||||
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.
|
||||
@@ -1006,7 +1016,14 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
|
||||
|
||||
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;
|
||||
@@ -1069,7 +1086,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
|
||||
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")
|
||||
{
|
||||
@@ -1183,16 +1200,13 @@ bool wxResourceManager::TestCurrentDialog(wxWindow* parent)
|
||||
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;
|
||||
@@ -1204,7 +1218,7 @@ wxWindow *wxResourceManager::FindParentOfSelection()
|
||||
{
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceTable.Next())
|
||||
while ((node = m_resourceTable.Next()))
|
||||
{
|
||||
wxItemResource *res = (wxItemResource *)node->Data();
|
||||
wxWindow *win = FindWindowForResource(res);
|
||||
@@ -1246,7 +1260,7 @@ void wxResourceManager::AlignItems(int flag)
|
||||
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)
|
||||
@@ -1325,10 +1339,8 @@ void wxResourceManager::CopySize()
|
||||
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)
|
||||
@@ -1389,7 +1401,7 @@ bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res)
|
||||
{
|
||||
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))
|
||||
@@ -1420,11 +1432,13 @@ bool wxResourceManager::DeleteResource(wxItemResource *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()))
|
||||
@@ -1467,7 +1481,7 @@ bool wxResourceManager::DeleteResource(wxWindow *win)
|
||||
|
||||
// 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)
|
||||
@@ -1496,11 +1510,11 @@ char *wxResourceManager::AddBitmapResource(char *filename)
|
||||
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))
|
||||
{
|
||||
@@ -1510,11 +1524,11 @@ void wxResourceManager::PossiblyDeleteBitmapResource(char *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());
|
||||
@@ -1538,13 +1552,13 @@ bool wxResourceManager::IsBitmapResourceUsed(char *resourceName)
|
||||
}
|
||||
|
||||
// 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)
|
||||
@@ -1557,14 +1571,14 @@ char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource)
|
||||
|
||||
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());
|
||||
@@ -1591,7 +1605,7 @@ bool wxResourceManager::IsSymbolUsed(wxItemResource* thisResource, wxWindowID id
|
||||
{
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceTable.Next())
|
||||
while ((node = m_resourceTable.Next()))
|
||||
{
|
||||
wxItemResource *res = (wxItemResource *)node->Data();
|
||||
|
||||
@@ -1634,7 +1648,7 @@ void wxResourceManager::ChangeIds(int oldId, int newId)
|
||||
{
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceTable.Next())
|
||||
while ((node = m_resourceTable.Next()))
|
||||
{
|
||||
wxItemResource *res = (wxItemResource *)node->Data();
|
||||
|
||||
@@ -1666,7 +1680,7 @@ bool wxResourceManager::RepairResourceIds()
|
||||
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceTable.Next())
|
||||
while ((node = m_resourceTable.Next()))
|
||||
{
|
||||
wxItemResource *res = (wxItemResource *)node->Data();
|
||||
wxString resType(res->GetType());
|
||||
@@ -1742,6 +1756,9 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
|
||||
|
||||
wxWindow *newWin = NULL;
|
||||
wxWindow *parent = win->GetParent();
|
||||
wxItemResource* parentResource = NULL;
|
||||
if (parent)
|
||||
FindResourceForWindow(parent);
|
||||
|
||||
if (win->IsKindOf(CLASSINFO(wxPanel)))
|
||||
{
|
||||
@@ -1755,7 +1772,7 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
|
||||
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();
|
||||
@@ -1811,7 +1828,7 @@ bool wxResourceManager::RecreateSelection()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxResourceManager::EditDialog(wxDialog *dialog, wxWindow *parent)
|
||||
bool wxResourceManager::EditDialog(wxDialog *WXUNUSED(dialog), wxWindow *WXUNUSED(parent))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1822,7 +1839,7 @@ bool wxResourceManager::InstantiateAllResourcesFromWindows()
|
||||
{
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
while (node = m_resourceTable.Next())
|
||||
while ((node = m_resourceTable.Next()))
|
||||
{
|
||||
wxItemResource *res = (wxItemResource *)node->Data();
|
||||
wxString resType(res->GetType());
|
||||
@@ -1861,7 +1878,7 @@ bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource *resource,
|
||||
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
|
||||
@@ -2231,7 +2248,7 @@ EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& s
|
||||
{
|
||||
}
|
||||
|
||||
bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled)
|
||||
bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled))
|
||||
{
|
||||
wxResourceManager *manager = wxResourceManager::GetCurrentResourceManager();
|
||||
|
||||
|
@@ -117,7 +117,7 @@ class wxResourceTableWithSaving: public wxResourceTable
|
||||
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);
|
||||
@@ -144,8 +144,8 @@ class wxResourceTableWithSaving: public wxResourceTable
|
||||
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;
|
||||
@@ -219,17 +219,17 @@ public:
|
||||
virtual bool DeleteResource(wxWindow *win);
|
||||
|
||||
// Add bitmap resource if there isn't already one with this filename.
|
||||
virtual char *AddBitmapResource(char *filename);
|
||||
virtual wxString AddBitmapResource(const wxString& filename);
|
||||
|
||||
// Delete the bitmap resource if it isn't being used by another resource.
|
||||
virtual void PossiblyDeleteBitmapResource(char *resourceName);
|
||||
virtual void PossiblyDeleteBitmapResource(const wxString& resourceName);
|
||||
|
||||
// Helper function for above
|
||||
virtual bool IsBitmapResourceUsed(char *resourceName);
|
||||
virtual bool IsBitmapResourceUsed(const wxString& resourceName);
|
||||
|
||||
wxItemResource *FindBitmapResourceByFilename(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) ;
|
||||
|
@@ -43,27 +43,27 @@
|
||||
#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 << "]";
|
||||
}
|
||||
|
||||
@@ -79,21 +79,21 @@ bool wxResourceTableWithSaving::Save(const wxString& filename)
|
||||
|
||||
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());
|
||||
@@ -110,6 +110,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
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";
|
||||
@@ -118,19 +119,29 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
|
||||
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());
|
||||
@@ -147,7 +158,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
|
||||
stream << " control = [";
|
||||
|
||||
SaveResource(stream, child);
|
||||
SaveResource(stream, child, item);
|
||||
|
||||
stream << "]";
|
||||
|
||||
@@ -165,7 +176,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
stream << item->GetWidth() << ", " << item->GetHeight();
|
||||
if (item->GetValue4())
|
||||
stream << ", '" << item->GetValue4() << "'";
|
||||
if (item->GetFont())
|
||||
if (item->GetFont().Ok())
|
||||
{
|
||||
stream << ",\\\n ";
|
||||
OutputFont(stream, item->GetFont());
|
||||
@@ -179,7 +190,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
stream << item->GetWidth() << ", " << item->GetHeight();
|
||||
if (item->GetValue4())
|
||||
stream << ", '" << item->GetValue4() << "'";
|
||||
if (item->GetFont())
|
||||
if (item->GetFont().Ok())
|
||||
{
|
||||
stream << ",\\\n ";
|
||||
OutputFont(stream, item->GetFont());
|
||||
@@ -192,7 +203,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
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());
|
||||
@@ -205,7 +216,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
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());
|
||||
@@ -217,7 +228,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
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());
|
||||
@@ -231,7 +242,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
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());
|
||||
@@ -244,7 +255,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
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());
|
||||
@@ -257,7 +268,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
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());
|
||||
@@ -282,9 +293,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
// 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();
|
||||
@@ -314,7 +325,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (item->GetFont())
|
||||
if (item->GetFont().Ok())
|
||||
{
|
||||
stream << ",\\\n ";
|
||||
OutputFont(stream, item->GetFont());
|
||||
@@ -334,9 +345,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
// 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();
|
||||
@@ -347,7 +358,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
}
|
||||
}
|
||||
stream << "]";
|
||||
if (item->GetFont())
|
||||
if (item->GetFont().Ok())
|
||||
{
|
||||
stream << ",\\\n ";
|
||||
OutputFont(stream, item->GetFont());
|
||||
@@ -364,9 +375,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
// 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();
|
||||
@@ -377,7 +388,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
}
|
||||
}
|
||||
stream << "], " << item->GetValue1();
|
||||
if (item->GetFont())
|
||||
if (item->GetFont().Ok())
|
||||
{
|
||||
stream << ",\\\n ";
|
||||
OutputFont(stream, item->GetFont());
|
||||
@@ -552,9 +563,9 @@ void wxResourceTableWithSaving::GenerateControlStyleString(const wxString& windo
|
||||
}
|
||||
|
||||
// Returns quoted string or "NULL"
|
||||
char *SafeString(char *s)
|
||||
char *SafeString(const wxString& s)
|
||||
{
|
||||
if (!s)
|
||||
if (s == "")
|
||||
return "NULL";
|
||||
else
|
||||
{
|
||||
@@ -566,14 +577,14 @@ char *SafeString(char *s)
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
|
||||
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();
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -40,15 +40,16 @@ private:
|
||||
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.
|
||||
@@ -76,9 +77,6 @@ class wxPropertyInfo: public wxObject
|
||||
// For all windows
|
||||
class wxWindowPropertyInfo: public wxPropertyInfo
|
||||
{
|
||||
protected:
|
||||
wxWindow *propertyWindow;
|
||||
wxItemResource *propertyResource;
|
||||
public:
|
||||
wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
|
||||
~wxWindowPropertyInfo(void);
|
||||
@@ -86,9 +84,9 @@ class wxWindowPropertyInfo: public wxPropertyInfo
|
||||
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
|
||||
|
||||
@@ -100,6 +98,10 @@ class wxWindowPropertyInfo: public wxPropertyInfo
|
||||
|
||||
// Set the window style
|
||||
void SetWindowStyle(wxWindow* win, long style, bool set);
|
||||
|
||||
protected:
|
||||
wxWindow* m_propertyWindow;
|
||||
wxItemResource* m_propertyResource;
|
||||
};
|
||||
|
||||
// For panel items
|
||||
@@ -338,6 +340,9 @@ class wxPanelPropertyInfo: public wxWindowPropertyInfo
|
||||
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);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -41,11 +41,6 @@ class wxPropertyValidatorRegistry;
|
||||
class wxPropertySheet: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
|
||||
protected:
|
||||
wxObject *viewedObject;
|
||||
wxList properties;
|
||||
wxPropertyView *propertyView;
|
||||
|
||||
public:
|
||||
wxPropertySheet(void);
|
||||
~wxPropertySheet(void);
|
||||
@@ -63,10 +58,16 @@ class wxPropertySheet: public wxObject
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -75,12 +76,6 @@ class wxPropertySheet: public wxObject
|
||||
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);
|
||||
@@ -97,35 +92,39 @@ class wxPropertyView: public wxEvtHandler
|
||||
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);
|
||||
@@ -135,6 +134,10 @@ class wxPropertyValidator: public wxEvtHandler
|
||||
virtual char *DoubleToString (double number);
|
||||
virtual char *IntToString (int number);
|
||||
virtual char *LongToString (long number);
|
||||
|
||||
protected:
|
||||
long m_validatorFlags;
|
||||
wxProperty* m_validatorProperty;
|
||||
};
|
||||
|
||||
|
||||
@@ -172,24 +175,6 @@ typedef enum {
|
||||
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
|
||||
@@ -209,26 +194,26 @@ class wxPropertyValue: public wxObject
|
||||
|
||||
~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
|
||||
@@ -240,16 +225,16 @@ class wxPropertyValue: public wxObject
|
||||
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);
|
||||
@@ -257,13 +242,13 @@ class wxPropertyValue: public wxObject
|
||||
// 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);
|
||||
@@ -276,6 +261,26 @@ class wxPropertyValue: public wxObject
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -286,13 +291,13 @@ class wxProperty: public wxObject
|
||||
{
|
||||
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);
|
||||
@@ -300,20 +305,20 @@ class wxProperty: public wxObject
|
||||
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
|
||||
|
@@ -54,18 +54,18 @@ BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView)
|
||||
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)
|
||||
@@ -74,8 +74,8 @@ wxPropertyFormView::~wxPropertyFormView(void)
|
||||
|
||||
void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
|
||||
{
|
||||
propertySheet = ps;
|
||||
|
||||
m_propertySheet = ps;
|
||||
|
||||
AssociatePanel(panel);
|
||||
// CreateControls();
|
||||
// UpdatePropertyList();
|
||||
@@ -90,10 +90,10 @@ bool wxPropertyFormView::OnUpdateView(void)
|
||||
|
||||
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();
|
||||
@@ -101,7 +101,7 @@ bool wxPropertyFormView::Check(void)
|
||||
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();
|
||||
@@ -111,10 +111,10 @@ bool wxPropertyFormView::Check(void)
|
||||
|
||||
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();
|
||||
@@ -122,7 +122,7 @@ bool wxPropertyFormView::TransferToPropertySheet(void)
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnRetrieveValue(prop, this, propertyWindow);
|
||||
formValidator->OnRetrieveValue(prop, this, m_propertyWindow);
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
@@ -131,10 +131,10 @@ bool wxPropertyFormView::TransferToPropertySheet(void)
|
||||
|
||||
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();
|
||||
@@ -142,7 +142,7 @@ bool wxPropertyFormView::TransferToDialog(void)
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnDisplayValue(prop, this, propertyWindow);
|
||||
formValidator->OnDisplayValue(prop, this, m_propertyWindow);
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
@@ -151,16 +151,16 @@ bool wxPropertyFormView::TransferToDialog(void)
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -182,16 +182,16 @@ void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
|
||||
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))
|
||||
@@ -210,7 +210,7 @@ void wxPropertyFormView::OnRevert(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
|
||||
{
|
||||
if (!propertySheet)
|
||||
if (!m_propertySheet)
|
||||
return;
|
||||
|
||||
if (win.GetName() == "")
|
||||
@@ -229,7 +229,7 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
|
||||
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();
|
||||
@@ -239,7 +239,7 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnCommand(prop, this, propertyWindow, event);
|
||||
formValidator->OnCommand(prop, this, m_propertyWindow, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -250,11 +250,11 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
|
||||
|
||||
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();
|
||||
@@ -264,7 +264,7 @@ void wxPropertyFormView::OnDoubleClick(wxControl *item)
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnDoubleClick(prop, this, propertyWindow);
|
||||
formValidator->OnDoubleClick(prop, this, m_propertyWindow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -282,18 +282,18 @@ wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *pare
|
||||
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
|
||||
@@ -302,19 +302,19 @@ bool wxPropertyFormDialog::OnClose(void)
|
||||
|
||||
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;
|
||||
@@ -329,18 +329,18 @@ IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel)
|
||||
|
||||
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;
|
||||
@@ -354,8 +354,8 @@ IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)
|
||||
|
||||
bool wxPropertyFormFrame::OnClose(void)
|
||||
{
|
||||
if (view)
|
||||
return view->OnClose();
|
||||
if (m_view)
|
||||
return m_view->OnClose();
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
@@ -367,12 +367,11 @@ wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView
|
||||
|
||||
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
|
||||
@@ -398,15 +397,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator)
|
||||
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))
|
||||
@@ -417,10 +416,10 @@ bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView
|
||||
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;
|
||||
}
|
||||
@@ -431,11 +430,11 @@ bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
|
||||
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;
|
||||
@@ -449,11 +448,11 @@ bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
|
||||
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;
|
||||
}
|
||||
@@ -466,19 +465,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)
|
||||
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))
|
||||
{
|
||||
@@ -488,17 +487,17 @@ bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVi
|
||||
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;
|
||||
}
|
||||
@@ -509,13 +508,13 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
|
||||
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;
|
||||
@@ -523,9 +522,9 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
|
||||
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;
|
||||
@@ -537,18 +536,18 @@ bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFor
|
||||
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;
|
||||
@@ -564,8 +563,8 @@ bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView
|
||||
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;
|
||||
@@ -575,12 +574,12 @@ bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
|
||||
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;
|
||||
}
|
||||
@@ -589,11 +588,11 @@ bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
|
||||
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;
|
||||
}
|
||||
@@ -606,23 +605,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)
|
||||
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();
|
||||
@@ -643,32 +642,32 @@ bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyForm
|
||||
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();
|
||||
}
|
||||
@@ -681,21 +680,21 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
|
||||
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();
|
||||
@@ -706,21 +705,21 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
|
||||
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();
|
||||
|
@@ -29,18 +29,7 @@
|
||||
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);
|
||||
|
||||
@@ -78,15 +67,28 @@ class wxPropertyFormView: public wxPropertyView
|
||||
// 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) { 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; }
|
||||
|
||||
public:
|
||||
static bool sm_dialogCancelled;
|
||||
|
||||
protected:
|
||||
bool m_detailedEditing; // E.g. using listbox for choices
|
||||
|
||||
wxWindow* m_propertyWindow; // Panel that the controls will appear on
|
||||
wxWindow* m_managedWindow; // Frame or dialog
|
||||
|
||||
wxButton* m_windowCloseButton; // Or OK
|
||||
wxButton* m_windowCancelButton;
|
||||
wxButton* m_windowHelpButton;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
@@ -144,14 +146,11 @@ class wxPropertyFormValidator: public wxPropertyValidator
|
||||
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) {}
|
||||
|
||||
@@ -159,25 +158,30 @@ class wxRealFormValidator: public wxPropertyFormValidator
|
||||
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
|
||||
@@ -198,20 +202,21 @@ 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;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -221,8 +226,6 @@ class wxStringFormValidator: public wxPropertyFormValidator
|
||||
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,
|
||||
@@ -233,6 +236,9 @@ class wxPropertyFormDialog: public wxDialog
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
private:
|
||||
wxPropertyFormView* m_view;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -242,20 +248,21 @@ class wxPropertyFormDialog: public wxDialog
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -265,24 +272,25 @@ class wxPropertyFormPanel: public wxPanel
|
||||
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
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -74,28 +74,7 @@
|
||||
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);
|
||||
|
||||
@@ -161,26 +140,49 @@ class wxPropertyListView: public wxPropertyView
|
||||
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()
|
||||
};
|
||||
|
||||
@@ -188,12 +190,13 @@ class wxPropertyTextEdit: public wxTextCtrl
|
||||
{
|
||||
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
|
||||
@@ -267,8 +270,6 @@ class wxPropertyListValidator: public wxPropertyValidator
|
||||
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,
|
||||
@@ -280,6 +281,9 @@ class wxPropertyListDialog: public wxDialog
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
private:
|
||||
wxPropertyListView* m_view;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
@@ -290,21 +294,19 @@ 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);
|
||||
@@ -312,6 +314,9 @@ class wxPropertyListPanel: public wxPanel
|
||||
// Call Layout()
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
private:
|
||||
wxPropertyListView* m_view;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
@@ -322,24 +327,25 @@ 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;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -349,14 +355,11 @@ class wxPropertyListFrame: public wxFrame
|
||||
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) {}
|
||||
|
||||
@@ -370,19 +373,20 @@ class wxRealListValidator: public wxPropertyListValidator
|
||||
// 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) {}
|
||||
|
||||
@@ -396,6 +400,10 @@ class wxIntegerListValidator: public wxPropertyListValidator
|
||||
// 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
|
||||
@@ -430,15 +438,13 @@ 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);
|
||||
@@ -458,15 +464,14 @@ class wxStringListValidator: public wxPropertyListValidator
|
||||
// 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);
|
||||
|
||||
@@ -488,6 +493,11 @@ class wxFilenameListValidator: public wxPropertyListValidator
|
||||
|
||||
// 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
|
||||
|
Reference in New Issue
Block a user