Dialog unit mods; wxProp tidying

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-10-09 12:01:58 +00:00
parent c39d4bcf2b
commit fd71308fc8
57 changed files with 2060 additions and 1850 deletions
+3
View File
@@ -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
+9 -12
View File
@@ -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;
+9 -12
View File
@@ -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;
+10 -16
View File
@@ -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; }
+9 -19
View File
@@ -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; }
+96 -80
View File
@@ -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
+10 -16
View File
@@ -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; }
+2 -1
View File
@@ -91,10 +91,11 @@ bool WXDLLEXPORT StringMatch(char *one, char *two, bool subString = TRUE, bool e
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
// 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,
+338 -431
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -55,7 +55,6 @@ bool wxToolBarSimple::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos
// Set it to grey (or other 3D face colour)
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_3DFACE));
SetDefaultBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_3DFACE));
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
{ m_lastX = 7; m_lastY = 3; }
+15 -7
View File
@@ -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)
+24
View File
@@ -64,3 +64,27 @@ void wxWindow::UpdateWindowUI()
}
}
}
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint wxWindow::ConvertPixelsToDialog(const wxPoint& pt)
{
int charWidth = GetCharWidth();
int charHeight = GetCharHeight();
wxPoint pt2;
pt2.x = (int) ((pt.x * 4) / charWidth) ;
pt2.y = (int) ((pt.y * 8) / charHeight) ;
return pt2;
}
wxPoint wxWindow::ConvertDialogToPixels(const wxPoint& pt)
{
int charWidth = GetCharWidth();
int charHeight = GetCharHeight();
wxPoint pt2;
pt2.x = (int) ((pt.x * charWidth) / 4) ;
pt2.y = (int) ((pt.y * charHeight) / 8) ;
return pt2;
}
-2
View File
@@ -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
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+4 -5
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
+4 -4
View File
@@ -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 )
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
-3
View File
@@ -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
}
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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);
-3
View File
@@ -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;
+4 -4
View File
@@ -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;
+4 -4
View File
@@ -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();
+2 -2
View File
@@ -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 )
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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();
+2 -2
View File
@@ -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();
+2 -2
View File
@@ -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();
-6
View File
@@ -72,10 +72,6 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
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();
-6
View File
@@ -100,10 +100,6 @@ bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, co
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
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();
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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);
+3 -5
View File
@@ -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;
+4 -6
View File
@@ -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;
+64 -2
View File
@@ -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();
+1
View File
@@ -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);
+2 -2
View File
@@ -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)
+55 -38
View File
@@ -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();
+8 -8
View File
@@ -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) ;
+53 -42
View File
@@ -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;
}
+1 -1
View File
@@ -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

Some files were not shown because too many files have changed in this diff Show More