Dialog Editor bug fixes, old resource conversion, additional layout helpers

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-04-22 14:41:06 +00:00
parent 076d7d4005
commit 0fa7b0e3e5
37 changed files with 6553 additions and 5922 deletions

View File

@@ -41,12 +41,15 @@ all dialogs in a particular directory.
\subsection{File menu} \subsection{File menu}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{New dialog}{Creates a new dialog resource.} \twocolitem{New Dialog}{Creates a new dialog resource.}
\twocolitem{New project}{Creates a new project (clears index and resets project name).} \twocolitem{New Project}{Creates a new project (clears index and resets project name).}
\twocolitem{Open}{Opens an existing resource file.} \twocolitem{Open...}{Opens an existing resource file.}
\twocolitem{Save}{Saves the current resources.} \twocolitem{Save}{Saves the current resources.}
\twocolitem{Save As...}{Saves the current resources in a named file.} \twocolitem{Save As...}{Saves the current resources in a named file.}
\twocolitem{Clear}{Clears the current resources.} \twocolitem{Clear}{Clears the current resources.}
\twocolitem{Convert Old Resources...}{Takes a directory of wxWindows 1.68 dialog resources,
and converts them to wxWindows 2 resources, in a separate directory. See
\helpref{Converting old files}{convertingoldfiles}.}
\twocolitem{Exit}{Exits the program.} \twocolitem{Exit}{Exits the program.}
\end{twocollist} \end{twocollist}
@@ -63,7 +66,7 @@ item.}
\subsection{Help menu} \subsection{Help menu}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{Help topics}{Displays on-line help at the contents page.} \twocolitem{Help Topics}{Displays on-line help at the contents page.}
\twocolitem{About}{Displays an dialog showing the Dialog Editor version and author.} \twocolitem{About}{Displays an dialog showing the Dialog Editor version and author.}
\end{twocollist} \end{twocollist}
@@ -76,15 +79,21 @@ The command toolbar consists of the following tools:
\twocolitem{\icon{new.eps}{New}}{Clears the project.} \twocolitem{\icon{new.eps}{New}}{Clears the project.}
\twocolitem{\icon{open.eps}{Open}}{Opens an existing resource file.} \twocolitem{\icon{open.eps}{Open}}{Opens an existing resource file.}
\twocolitem{\icon{save.eps}{Save}}{Saves the current resources.} \twocolitem{\icon{save.eps}{Save}}{Saves the current resources.}
\twocolitem{\icon{vert.eps}{Horizontal align}}{Aligns the centre of the selected items horizontally.} \twocolitem{\icon{vert.eps}{Horizontal align}}{Aligns the centre of the selected controls horizontally.}
\twocolitem{\icon{alignt.eps}{Horizontal top-align}}{Aligns the top sides of the selected items horizontally.} \twocolitem{\icon{alignt.eps}{Horizontal top-align}}{Aligns the top sides of the selected controls horizontally.}
\twocolitem{\icon{alignb.eps}{Horizontal bottom-align}}{Aligns the bottom sides of the selected items horizontally.} \twocolitem{\icon{alignb.eps}{Horizontal bottom-align}}{Aligns the bottom sides of the selected controls horizontally.}
\twocolitem{\icon{horiz.eps}{Vertical align}}{Aligns the centre of the selected items vertically.} \twocolitem{\icon{horiz.eps}{Vertical align}}{Aligns the centre of the selected controls vertically.}
\twocolitem{\icon{alignl.eps}{Vertical left-align}}{Aligns the left sides of the selected items vertically.} \twocolitem{\icon{alignl.eps}{Vertical left-align}}{Aligns the left sides of the selected controls vertically.}
\twocolitem{\icon{alignr.eps}{Vertical right-align}}{Aligns the right sides of the selected items vertically.} \twocolitem{\icon{alignr.eps}{Vertical right-align}}{Aligns the right sides of the selected controls vertically.}
\twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected item to the subsequently selected item(s).} \twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected item(s) to the front of the display list.} \twocolitem{\icon{copywdth.eps}{Copy width}}{Copies the width of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{toback.eps}{To back}}{Puts the selected item(s) to the back of the display list.} \twocolitem{\icon{copyhght.eps}{Copy height}}{Copies the height of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{disthor.eps}{Distribute horizontally}}{Evenly distributes the space between the selected controls, horizontally. Note that the controls
should be selected in order from left to right.}
\twocolitem{\icon{distvert.eps}{Distribute vertically}}{Evenly distributes the space between the selected controls, vertically. Note that the controls
should be selected in order from top to bottom.}
\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected control(s) to the front of the display list.}
\twocolitem{\icon{toback.eps}{To back}}{Puts the selected control(s) to the back of the display list.}
\twocolitem{\icon{help.eps}{Help}}{Invokes Dialog Editor help.} \twocolitem{\icon{help.eps}{Help}}{Invokes Dialog Editor help.}
\end{twocollist} \end{twocollist}
@@ -198,3 +207,28 @@ resource files for different platforms, with spacing modified to suit each
environment. The best thing is to try your dialog resource on several platforms environment. The best thing is to try your dialog resource on several platforms
and see whether tweaking is required for some platforms. and see whether tweaking is required for some platforms.
\section{Converting old files}\label{convertingoldfiles}
Dialog Editor can make an attempt at converting dialog resources created with Dialog Editor for wxWindows 1.68.
The command is {\bf Convert Old Resources...} on the {\bf File} menu.
You need to specify two directories, an input and an output directory. Dialog Editor will
do the following conversions:
\begin{enumerate}\itemsep=0pt
\item wxMultiText becomes a wxTextCtrl with wxTE\_MULTILINE style.
\item wxText becomes a wxTextCtrl.
\item wxMessage becomes either a wxStaticText or wxStaticBitmap.
\item wxButton becomes a wxBitmapButton if necessary.
\item wxGroupBox becomes wxStaticBox.
\item Controls that no longer have labels, such as wxTextCtrl and wxListBox,
have a separate wxStaticText control created for them at approximately the correct
position. The label's window name becomes ControlName_Label where ControlName is
the name of the control that formerly had the label.
\item Identifiers are allocated.
\item Font sizes are reduced to counter the decreased font size now created by wxWindows
for a given point size.
\item The dialog height is reduced slightly to compensate for the fact that the dialog caption
is no longer included in the size.
\end{enumerate}

View File

@@ -2,6 +2,15 @@
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}% \setfooter{\thepage}{}{}{}{}{\thepage}%
April 22nd, 2000 Version 2.1
\begin{itemize}\itemsep=0pt
\item Various bug fixes.
\item Added buttons for distributing space horizontally and vertically, and
for copying width and height independently.
\item Added 'Convert old resources' facility.
\end{itemize}
December 31st 1998, Version 2.0 December 31st 1998, Version 2.0
\begin{itemize}\itemsep=0pt \begin{itemize}\itemsep=0pt

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@@ -4,9 +4,9 @@
%\special{!/@scaleunit 1 def} %\special{!/@scaleunit 1 def}
\parskip=10pt \parskip=10pt
\parindent=0pt \parindent=0pt
\title{User Manual for Dialog Editor Version 2.0} \title{User Manual for Dialog Editor Version 2.1}
\winhelpignore{\author{Julian Smart, Anthemion Software} \winhelpignore{\author{Julian Smart, Anthemion Software}
\date{December 1998} \date{April 2000}
} }
\makeindex \makeindex
\begin{document} \begin{document}
@@ -23,7 +23,7 @@
\setfooter{\thepage}{}{}{}{}{\thepage}% \setfooter{\thepage}{}{}{}{}{\thepage}%
\begin{center} \begin{center}
Copyright (c) 1998 Julian Smart, Anthemion Software Copyright (c) 2000 Julian Smart, Anthemion Software
\end{center} \end{center}
Please see the wxWindows licence for conditions of use. Please see the wxWindows licence for conditions of use.

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * copyhght_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" . ",
" ............. ",
" ",
" ...... ...... ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" ...... ...... ",
" ",
" ............. ",
" . "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * copywdth_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" ",
" . ........ . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . ........ . ",
" .. .. ",
" . ........ . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . ........ . ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * disthor_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" ",
" ... ... ... ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" ... ... ... ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * distvert_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .............. ",
" ",
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .............. ",
" ",
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .............. ",
" "};

View File

@@ -28,8 +28,8 @@
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MyApp)
BEGIN_EVENT_TABLE(MyApp, wxApp) BEGIN_EVENT_TABLE(MyApp, wxApp)
EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu) EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu)
EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu) EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu)
END_EVENT_TABLE() END_EVENT_TABLE()
MyApp::MyApp(void) MyApp::MyApp(void)
@@ -44,14 +44,14 @@ bool MyApp::OnInit(void)
{ {
theResourceManager = new wxResourceManager; theResourceManager = new wxResourceManager;
theResourceManager->Initialize(); theResourceManager->Initialize();
theResourceManager->ShowResourceEditor(TRUE); theResourceManager->ShowResourceEditor(TRUE);
if (argc > 1) if (argc > 1)
theResourceManager->Load(argv[1]); theResourceManager->Load(argv[1]);
SetTopWindow(theResourceManager->GetEditorFrame()); SetTopWindow(theResourceManager->GetEditorFrame());
return TRUE; return TRUE;
} }

View File

@@ -26,16 +26,16 @@ class MyChild;
// Define a new application // Define a new application
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
MyApp(void); MyApp(void);
bool OnInit(void); bool OnInit(void);
int OnExit(void); int OnExit(void);
void OnObjectPopupMenu(wxCommandEvent& event) void OnObjectPopupMenu(wxCommandEvent& event)
{ {
ObjectMenuProc((wxMenu *)event.GetEventObject(), event); ObjectMenuProc((wxMenu *)event.GetEventObject(), event);
} }
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -57,6 +57,10 @@ HELPTOOL BITMAP "bitmaps/help.bmp"
COPYSIZETOOL BITMAP "bitmaps/copysize.bmp" COPYSIZETOOL BITMAP "bitmaps/copysize.bmp"
TOFRONTTOOL BITMAP "bitmaps/tofront.bmp" TOFRONTTOOL BITMAP "bitmaps/tofront.bmp"
TOBACKTOOL BITMAP "bitmaps/toback.bmp" TOBACKTOOL BITMAP "bitmaps/toback.bmp"
COPYWIDTHTOOL BITMAP "bitmaps/copywdth.bmp"
COPYHEIGHTTOOL BITMAP "bitmaps/copyhght.bmp"
DISTHORIZTOOL BITMAP "bitmaps/disthor.bmp"
DISTVERTTOOL BITMAP "bitmaps/distvert.bmp"
WXWINBMP BITMAP "bitmaps/wxwin.bmp" WXWINBMP BITMAP "bitmaps/wxwin.bmp"

File diff suppressed because it is too large Load Diff

View File

@@ -25,114 +25,125 @@
class wxResourceEditorDialogHandler: public wxEvtHandler class wxResourceEditorDialogHandler: public wxEvtHandler
{ {
DECLARE_CLASS(wxResourceEditorDialogHandler) DECLARE_CLASS(wxResourceEditorDialogHandler)
public: public:
wxResourceManager *resourceManager; wxResourceManager *resourceManager;
wxPanel *handlerDialog; wxPanel *handlerDialog;
wxItemResource *handlerResource; wxItemResource *handlerResource;
wxEvtHandler *handlerOldHandler; wxEvtHandler *handlerOldHandler;
wxControl *dragItem; wxControl *dragItem;
int dragMode; int dragMode;
int dragType; int dragType;
int dragTolerance; int dragTolerance;
bool checkTolerance; bool checkTolerance;
int firstDragX; int firstDragX;
int firstDragY; int firstDragY;
int oldDragX; int oldDragX;
int oldDragY; int oldDragY;
bool m_mouseCaptured; bool m_mouseCaptured;
// long m_treeItem; // long m_treeItem;
wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler, wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
wxResourceManager *manager); wxResourceManager *manager);
~wxResourceEditorDialogHandler(void); ~wxResourceEditorDialogHandler(void);
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
virtual void OnItemEvent(wxControl *win, wxMouseEvent& event); virtual void OnItemEvent(wxControl *win, wxMouseEvent& event);
virtual void OnLeftClick(int x, int y, int keys); virtual void OnLeftClick(int x, int y, int keys);
virtual void OnRightClick(int x, int y, int keys); virtual void OnRightClick(int x, int y, int keys);
virtual void OnItemLeftClick(wxControl *item, int x, int y, int keys); virtual void OnItemLeftClick(wxControl *item, int x, int y, int keys);
virtual void OnItemRightClick(wxControl *item, int x, int y, int keys); virtual void OnItemRightClick(wxControl *item, int x, int y, int keys);
virtual void OnItemSelect(wxControl *item, bool select); virtual void OnItemSelect(wxControl *item, bool select);
virtual void OnItemMove( virtual void OnItemMove(
wxControl *WXUNUSED(item), int WXUNUSED(x), int WXUNUSED(y) ) {}; wxControl *WXUNUSED(item), int WXUNUSED(x), int WXUNUSED(y) ) {};
virtual void OnItemSize( virtual void OnItemSize(
wxControl *WXUNUSED(item), int WXUNUSED(w), int WXUNUSED(h) ) {}; wxControl *WXUNUSED(item), int WXUNUSED(w), int WXUNUSED(h) ) {};
void AddChildHandlers(void); void AddChildHandlers(void);
void PaintSelectionHandles(wxDC& dc); void PaintSelectionHandles(wxDC& dc);
void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle); void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
// Accessors // Accessors
/* /*
inline long GetTreeItem() const { return m_treeItem; } inline long GetTreeItem() const { return m_treeItem; }
inline void SetTreeItem(long item) { m_treeItem = item; } inline void SetTreeItem(long item) { m_treeItem = item; }
*/ */
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
class wxResourceEditorControlHandler: public wxEvtHandler class wxResourceEditorControlHandler: public wxEvtHandler
{ {
DECLARE_CLASS(wxResourceEditorControlHandler) DECLARE_CLASS(wxResourceEditorControlHandler)
public: public:
// wxResourceManager *resourceManager; // wxResourceManager *resourceManager;
wxControl *handlerControl; wxControl *handlerControl;
// wxItemResource *handlerResource; // wxItemResource *handlerResource;
wxEvtHandler *handlerOldHandler; wxEvtHandler *handlerOldHandler;
bool isSelected;
int handleSize; // selection handle size
int handleMargin; // Distance between item edge and handle edge
long m_treeItem;
static int dragOffsetX; // Distance between pointer at start of drag and
static int dragOffsetY; // top-left of item
wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler);
~wxResourceEditorControlHandler(void);
void OnMouseEvent(wxMouseEvent& event);
// Manipulation and drawing of items in Edit Mode
// Calculate position of the 8 handles
virtual void CalcSelectionHandles(int *hx, int *hy);
virtual void DrawSelectionHandles(wxDC& dc, bool erase = FALSE);
virtual void DrawBoundingBox(wxDC& dc, int x, int y, int w, int h);
virtual void SelectItem(bool select);
virtual inline bool IsSelected(void) { return isSelected; }
// Returns TRUE or FALSE
virtual bool HitTest(int x, int y);
// Returns 0 (no hit), 1 - 8 for which selection handle
// (clockwise from top middle)
virtual int SelectionHandleHitTest(int x, int y);
// If selectionHandle is zero, not dragging the selection handle.
virtual void OnDragBegin(int x, int y, int keys, wxDC& dc, int selectionHandle);
virtual void OnDragContinue(bool paintIt, int x, int y, int keys, wxDC& dc, int selectionHandle);
virtual void OnDragEnd(int x, int y, int keys, wxDC& dc, int selectionHandle);
// These functions call panel functions
// by default.
virtual void OldOnMove(int x, int y);
virtual void OldOnSize(int w, int h);
virtual void OnLeftClick(int x, int y, int keys);
virtual void OnRightClick(int x, int y, int keys);
virtual void OnSelect(bool select);
// Accessors
/*
inline long GetTreeItem() const { return m_treeItem; }
inline void SetTreeItem(long item) { m_treeItem = item; }
*/
DECLARE_EVENT_TABLE()
};
bool isSelected; // This dialog, for testing dialogs, has to intercept commands before
int handleSize; // selection handle size // they go up the hierarchy and accidentally set off arbitrary
int handleMargin; // Distance between item edge and handle edge // Dialog Editor functionality
long m_treeItem; class ResourceEditorDialogTester: public wxDialog
static int dragOffsetX; // Distance between pointer at start of drag and {
static int dragOffsetY; // top-left of item public:
ResourceEditorDialogTester() {}
wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler);
~wxResourceEditorControlHandler(void); bool ProcessEvent(wxEvent& event);
void OnMouseEvent(wxMouseEvent& event);
// Manipulation and drawing of items in Edit Mode
// Calculate position of the 8 handles
virtual void CalcSelectionHandles(int *hx, int *hy);
virtual void DrawSelectionHandles(wxDC& dc, bool erase = FALSE);
virtual void DrawBoundingBox(wxDC& dc, int x, int y, int w, int h);
virtual void SelectItem(bool select);
virtual inline bool IsSelected(void) { return isSelected; }
// Returns TRUE or FALSE
virtual bool HitTest(int x, int y);
// Returns 0 (no hit), 1 - 8 for which selection handle
// (clockwise from top middle)
virtual int SelectionHandleHitTest(int x, int y);
// If selectionHandle is zero, not dragging the selection handle.
virtual void OnDragBegin(int x, int y, int keys, wxDC& dc, int selectionHandle);
virtual void OnDragContinue(bool paintIt, int x, int y, int keys, wxDC& dc, int selectionHandle);
virtual void OnDragEnd(int x, int y, int keys, wxDC& dc, int selectionHandle);
// These functions call panel functions
// by default.
virtual void OldOnMove(int x, int y);
virtual void OldOnSize(int w, int h);
virtual void OnLeftClick(int x, int y, int keys);
virtual void OnRightClick(int x, int y, int keys);
virtual void OnSelect(bool select);
// Accessors
/*
inline long GetTreeItem() const { return m_treeItem; }
inline void SetTreeItem(long item) { m_treeItem = item; }
*/
DECLARE_EVENT_TABLE()
}; };
#endif #endif

View File

@@ -41,8 +41,8 @@ BEGIN_EVENT_TABLE(wxResourceEditorControlList, wxListCtrl)
END_EVENT_TABLE() END_EVENT_TABLE()
wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style): long style):
wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE) wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE)
{ {
Initialize(); Initialize();
} }
@@ -74,7 +74,7 @@ void wxResourceEditorControlList::Initialize()
wxIcon icon16("RADIOBTN_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); wxIcon icon16("RADIOBTN_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
wxIcon icon17("SCROLBAR_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); wxIcon icon17("SCROLBAR_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
#else #else
#include "bitmaps/arrow.xpm" #include "bitmaps/arrow.xpm"
wxIcon icon1( arrow_xpm ); wxIcon icon1( arrow_xpm );
#include "bitmaps/button.xpm" #include "bitmaps/button.xpm"
@@ -110,7 +110,7 @@ void wxResourceEditorControlList::Initialize()
#include "bitmaps/scrolbar.xpm" #include "bitmaps/scrolbar.xpm"
wxIcon icon17( scrolbar_xpm ); wxIcon icon17( scrolbar_xpm );
#endif #endif
m_imageList.Add(icon1); m_imageList.Add(icon1);
m_imageList.Add(icon2); m_imageList.Add(icon2);
m_imageList.Add(icon3); m_imageList.Add(icon3);
@@ -130,7 +130,7 @@ void wxResourceEditorControlList::Initialize()
m_imageList.Add(icon17); m_imageList.Add(icon17);
SetImageList(& m_imageList, wxIMAGE_LIST_SMALL); SetImageList(& m_imageList, wxIMAGE_LIST_SMALL);
long id = InsertItem(0, "Pointer", 0); long id = InsertItem(0, "Pointer", 0);
id = InsertItem(1, "wxButton", 1); id = InsertItem(1, "wxButton", 1);
id = InsertItem(2, "wxBitmapButton", 2); id = InsertItem(2, "wxBitmapButton", 2);
@@ -148,14 +148,14 @@ void wxResourceEditorControlList::Initialize()
id = InsertItem(14, "wxRadioBox", 14); id = InsertItem(14, "wxRadioBox", 14);
id = InsertItem(15, "wxRadioButton", 15); id = InsertItem(15, "wxRadioButton", 15);
id = InsertItem(16, "wxScrollBar", 16); id = InsertItem(16, "wxScrollBar", 16);
/* /*
InsertItem(RESED_TREECTRL, "wxTreeCtrl", 16); InsertItem(RESED_TREECTRL, "wxTreeCtrl", 16);
InsertItem(RESED_LISTCTRL, "wxListCtrl", 17); InsertItem(RESED_LISTCTRL, "wxListCtrl", 17);
InsertItem(RESED_SPINBUTTON, "wxSpinButton", 18); InsertItem(RESED_SPINBUTTON, "wxSpinButton", 18);
*/ */
// SetColumnWidth(-1, 80); // SetColumnWidth(-1, 80);
} }
// Get selection, or -1 // Get selection, or -1

View File

@@ -21,15 +21,15 @@ public:
wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style = wxLC_SMALL_ICON|wxLC_AUTOARRANGE|wxLC_SINGLE_SEL); long style = wxLC_SMALL_ICON|wxLC_AUTOARRANGE|wxLC_SINGLE_SEL);
~wxResourceEditorControlList(); ~wxResourceEditorControlList();
// Load icons and add to the list // Load icons and add to the list
void Initialize(); void Initialize();
// Get selection, or -1 // Get selection, or -1
long GetSelection() const; long GetSelection() const;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected: protected:
wxImageList m_imageList; wxImageList m_imageList;
}; };

View File

@@ -38,13 +38,13 @@
#include "reseditr.h" #include "reseditr.h"
BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl) BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl)
EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick) EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged) EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style): long style):
wxTreeCtrl(parent, id, pos, size, style) wxTreeCtrl(parent, id, pos, size, style)
{ {
} }
@@ -54,18 +54,18 @@ void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event))
long sel = GetSelection(); long sel = GetSelection();
if (sel == -1) if (sel == -1)
return; return;
if (GetItemData(sel) == 0) if (GetItemData(sel) == 0)
return; return;
wxItemResource* res = (wxResourceTreeData *)GetItemData(sel)->GetResource(); wxItemResource* res = (wxResourceTreeData *)GetItemData(sel)->GetResource();
wxString resType(res->GetType()); wxString resType(res->GetType());
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel") if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
return; return;
wxResourceEditorFrame *frame = (wxResourceEditorFrame *)wxWindow::GetParent(); wxResourceEditorFrame *frame = (wxResourceEditorFrame *)wxWindow::GetParent();
wxResourceManager *manager = frame->manager; wxResourceManager *manager = frame->manager;
manager->EditSelectedResource(); manager->EditSelectedResource();
#endif #endif
} }
@@ -75,18 +75,18 @@ void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
long sel = GetSelection(); long sel = GetSelection();
if (sel == -1) if (sel == -1)
return; return;
if (GetItemData(sel) == 0) if (GetItemData(sel) == 0)
return; return;
if (m_invalid) if (m_invalid)
return; return;
wxItemResource* res = ((wxResourceTreeData *)GetItemData(sel))->GetResource(); wxItemResource* res = ((wxResourceTreeData *)GetItemData(sel))->GetResource();
wxString resType(res->GetType()); wxString resType(res->GetType());
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel") if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
return; return;
wxResourceManager::GetCurrentResourceManager()->Edit(res); wxResourceManager::GetCurrentResourceManager()->Edit(res);
} }

View File

@@ -19,17 +19,17 @@ class wxResourceEditorProjectTree: public wxTreeCtrl
public: public:
wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style = wxTR_HAS_BUTTONS); long style = wxTR_HAS_BUTTONS);
void LeftDClick(wxMouseEvent& event); void LeftDClick(wxMouseEvent& event);
void OnSelChanged(wxTreeEvent& event); void OnSelChanged(wxTreeEvent& event);
inline void SetInvalid(bool invalid) { m_invalid = invalid; } inline void SetInvalid(bool invalid) { m_invalid = invalid; }
protected: protected:
bool m_invalid; // While TRUE, don't respond to selections etc. bool m_invalid; // While TRUE, don't respond to selections etc.
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@
#ifndef _RESEDITR_H_ #ifndef _RESEDITR_H_
#define _RESEDITR_H_ #define _RESEDITR_H_
#define wxDIALOG_EDITOR_VERSION 1.7 #define wxDIALOG_EDITOR_VERSION 2.1
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface "reseditr.h" #pragma interface "reseditr.h"
@@ -30,17 +30,18 @@
#include "symbtabl.h" #include "symbtabl.h"
#include "winstyle.h" #include "winstyle.h"
#define RESED_DELETE 1 #define RESED_DELETE 301
#define RESED_RECREATE 3 #define RESED_RECREATE 303
#define RESED_CLEAR 4 #define RESED_CLEAR 304
#define RESED_NEW_DIALOG 5 #define RESED_NEW_DIALOG 305
#define RESED_NEW_PANEL 6 #define RESED_NEW_PANEL 306
#define RESED_TEST 10 #define RESED_TEST 310
#define RESED_CONVERT_WXRS 311 // Convert old WXRs to new
#define RESED_CONTENTS 20 #define RESED_CONTENTS 320
#define IDC_TREECTRL 100 #define IDC_TREECTRL 500
#define IDC_LISTCTRL 101 #define IDC_LISTCTRL 501
// For control list ('palette') // For control list ('palette')
#define RESED_POINTER 0 #define RESED_POINTER 0
@@ -65,8 +66,8 @@
#define RESED_SPINBUTTON 19 #define RESED_SPINBUTTON 19
/* /*
* Controls loading, saving, user interface of resource editor(s). * Controls loading, saving, user interface of resource editor(s).
*/ */
class wxResourceEditorFrame; class wxResourceEditorFrame;
class EditorToolBar; class EditorToolBar;
@@ -83,373 +84,365 @@ class wxResourceEditorControlList;
class wxHelpController; class wxHelpController;
/* /*
* The resourceTable contains a list of wxItemResources (which each may * The resourceTable contains a list of wxItemResources (which each may
* have further children, defining e.g. a dialog box with controls). * have further children, defining e.g. a dialog box with controls).
* *
* We need to associate actual windows with each wxItemResource, * We need to associate actual windows with each wxItemResource,
* instead of the current 'one current window' scheme. * instead of the current 'one current window' scheme.
* *
* - We create a new dialog, create a wxItemResource, * - We create a new dialog, create a wxItemResource,
* associate the dialog with wxItemResource via a hash table. * associate the dialog with wxItemResource via a hash table.
* Must be a hash table in case dialog is deleted without * Must be a hash table in case dialog is deleted without
* telling the resource manager. * telling the resource manager.
* - When we save the resource after editing/closing the dialog, * - When we save the resource after editing/closing the dialog,
* we check the wxItemResource/wxDialog and children for * we check the wxItemResource/wxDialog and children for
* consistency (throw away items no longer in the wxDialog, * consistency (throw away items no longer in the wxDialog,
* create any new wxItemResources). * create any new wxItemResources).
* - We save the wxItemResources via the wxPropertyInfo classes, * - We save the wxItemResources via the wxPropertyInfo classes,
* so devolve the code to the appropriate class. * so devolve the code to the appropriate class.
* This involves creating a new temporary wxPropertyInfo for * This involves creating a new temporary wxPropertyInfo for
* the purpose. * the purpose.
* *
* We currently assume we only create one instance of a window for * We currently assume we only create one instance of a window for
* each wxItemResource. We will need to relax this when we're editing * each wxItemResource. We will need to relax this when we're editing
* in situ. * in situ.
* *
* *
*/ */
class wxResourceTableWithSaving: public wxResourceTable class wxResourceTableWithSaving: public wxResourceTable
{ {
public: public:
wxResourceTableWithSaving():wxResourceTable() wxResourceTableWithSaving():wxResourceTable()
{ {
// Add all known window styles // Add all known window styles
m_styleTable.Init(); m_styleTable.Init();
} }
virtual bool Save(const wxString& filename); virtual bool Save(const wxString& filename);
virtual bool SaveResource(wxTextOutputStream& stream, wxItemResource* item, wxItemResource* parentItem); virtual bool SaveResource(wxTextOutputStream& stream, wxItemResource* item, wxItemResource* parentItem);
void GeneratePanelStyleString(long windowStyle, char *buf); void GeneratePanelStyleString(long windowStyle, char *buf);
void GenerateDialogStyleString(long windowStyle, char *buf); void GenerateDialogStyleString(long windowStyle, char *buf);
/* void GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf);
void GenerateRadioBoxStyleString(long windowStyle, char *buf);
void GenerateMessageStyleString(long windowStyle, char *buf); void OutputFont(wxTextOutputStream& stream, const wxFont& font);
void GenerateTextStyleString(long windowStyle, char *buf); wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource);
void GenerateButtonStyleString(long windowStyle, char *buf);
void GenerateCheckBoxStyleString(long windowStyle, char *buf);
void GenerateRadioButtonStyleString(long windowStyle, char *buf);
void GenerateListBoxStyleString(long windowStyle, char *buf);
void GenerateSliderStyleString(long windowStyle, char *buf);
void GenerateGroupBoxStyleString(long windowStyle, char *buf);
void GenerateGaugeStyleString(long windowStyle, char *buf);
void GenerateChoiceStyleString(long windowStyle, char *buf);
void GenerateComboBoxStyleString(long windowStyle, char *buf);
void GenerateScrollBarStyleString(long windowStyle, char *buf);
*/
void GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf);
/*
bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle);
*/
void OutputFont(wxTextOutputStream& stream, const wxFont& font);
wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource);
protected: protected:
wxWindowStyleTable m_styleTable; wxWindowStyleTable m_styleTable;
}; };
class wxResourceEditorScrolledWindow; class wxResourceEditorScrolledWindow;
class wxResourceManager: public wxObject class wxResourceManager: public wxObject
{ {
friend class wxResourceEditorFrame; friend class wxResourceEditorFrame;
public: public:
wxResourceManager(); wxResourceManager();
~wxResourceManager(); ~wxResourceManager();
// Operations
// Initializes the resource manager
bool Initialize();
// Load/save window size etc.
bool LoadOptions();
bool SaveOptions();
// Show or hide the resource editor frame, which displays a list
// of resources with ability to edit them.
virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor");
// Convert old WXRs to new
virtual bool ConvertWXRs();
bool DoConvertWXR(const wxString& oldPath, const wxString& newPath);
bool ChangeOldToNewResource(wxItemResource* parent, wxItemResource* res);
bool InsertLabelResource(wxItemResource* parent, wxItemResource* res);
// Operations virtual bool Save();
virtual bool SaveAs();
// Initializes the resource manager virtual bool Save(const wxString& filename);
bool Initialize(); virtual bool Load(const wxString& filename);
virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
// Load/save window size etc. virtual void SetFrameTitle(const wxString& filename);
bool LoadOptions(); virtual void ClearCurrentDialog();
bool SaveOptions(); virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
virtual bool SaveIfModified();
// Show or hide the resource editor frame, which displays a list virtual void AlignItems(int flag);
// of resources with ability to edit them. virtual void CopySize(int command); // Copy width, height or both from first control
virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor"); virtual void ToBackOrFront(bool toBack);
virtual void DistributePositions(int command); // Distribute controls evenly between first and last
virtual bool Save(); virtual wxWindow *FindParentOfSelection();
virtual bool SaveAs();
virtual bool Save(const wxString& filename); virtual wxFrame *OnCreateEditorFrame(const char *title);
virtual bool Load(const wxString& filename); virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE); virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
virtual void SetFrameTitle(const wxString& filename); virtual wxToolBar *OnCreateToolBar(wxFrame *parent);
virtual void ClearCurrentDialog();
virtual bool New(bool loadFromFile = TRUE, const wxString& filename = ""); // Create a window information object for the give window
virtual bool SaveIfModified(); wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
virtual void AlignItems(int flag); // Edit the given window
virtual void CopySize(); void EditWindow(wxWindow *win);
virtual void ToBackOrFront(bool toBack);
virtual wxWindow *FindParentOfSelection(); virtual void UpdateResourceList();
virtual void AddItemsRecursively(long parent, wxItemResource *resource);
virtual wxFrame *OnCreateEditorFrame(const char *title); virtual bool EditSelectedResource();
virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent); virtual bool Edit(wxItemResource *res);
virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent); virtual bool CreateNewPanel();
virtual wxToolBar *OnCreateToolBar(wxFrame *parent); virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
virtual bool DeleteSelection();
// Create a window information object for the give window virtual bool TestCurrentDialog(wxWindow* parent);
wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
// Edit the given window // Saves the window info into the resource, and deletes the
void EditWindow(wxWindow *win); // handler. Doesn't actually disassociate the window from
// the resources. Replaces OnClose.
virtual void UpdateResourceList(); virtual bool SaveInfoAndDeleteHandler(wxWindow* win);
virtual void AddItemsRecursively(long parent, wxItemResource *resource);
virtual bool EditSelectedResource(); // Destroys the window. If this is the 'current' panel, NULLs the
virtual bool Edit(wxItemResource *res); // variable.
virtual bool CreateNewPanel(); virtual bool DeleteWindow(wxWindow* win);
virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE); virtual bool DeleteResource(wxItemResource *res);
virtual bool DeleteSelection(); virtual bool DeleteResource(wxWindow *win);
virtual bool TestCurrentDialog(wxWindow* parent);
// Add bitmap resource if there isn't already one with this filename.
// Saves the window info into the resource, and deletes the virtual wxString AddBitmapResource(const wxString& filename);
// handler. Doesn't actually disassociate the window from
// the resources. Replaces OnClose. // Delete the bitmap resource if it isn't being used by another resource.
virtual bool SaveInfoAndDeleteHandler(wxWindow* win); virtual void PossiblyDeleteBitmapResource(const wxString& resourceName);
// Destroys the window. If this is the 'current' panel, NULLs the // Helper function for above
// variable. virtual bool IsBitmapResourceUsed(const wxString& resourceName);
virtual bool DeleteWindow(wxWindow* win);
virtual bool DeleteResource(wxItemResource *res); wxItemResource *FindBitmapResourceByFilename(const wxString& filename);
virtual bool DeleteResource(wxWindow *win);
wxString FindBitmapFilenameForResource(wxItemResource *resource);
// Add bitmap resource if there isn't already one with this filename.
virtual wxString AddBitmapResource(const wxString& filename); // Is this window identifier in use?
bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;
// Delete the bitmap resource if it isn't being used by another resource.
virtual void PossiblyDeleteBitmapResource(const wxString& resourceName); // Is this window identifier compatible with the given name? (i.e.
// does it already exist under a different name)
// Helper function for above bool IsIdentifierOK(const wxString& name, wxWindowID id);
virtual bool IsBitmapResourceUsed(const wxString& resourceName);
// Change all integer ids that match oldId, to newId.
wxItemResource *FindBitmapResourceByFilename(const wxString& filename); // This is necessary if an id is changed for one resource - all resources
// must be changed.
wxString FindBitmapFilenameForResource(wxItemResource *resource); void ChangeIds(int oldId, int newId);
// Is this window identifier in use? // If any resource ids were missing (or their symbol was missing),
bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ; // repair them i.e. give them new ids. Returns TRUE if any resource
// needed repairing.
// Is this window identifier compatible with the given name? (i.e. bool RepairResourceIds();
// does it already exist under a different name)
bool IsIdentifierOK(const wxString& name, wxWindowID id); // Deletes 'win' and creates a new window from the resource that
// was associated with it. E.g. if you can't change properties on the
// Change all integer ids that match oldId, to newId. // fly, you'll need to delete the window and create it again.
// This is necessary if an id is changed for one resource - all resources virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE);
// must be changed.
void ChangeIds(int oldId, int newId); virtual bool RecreateSelection();
// If any resource ids were missing (or their symbol was missing), // Remove selection handles if this control is selected
// repair them i.e. give them new ids. Returns TRUE if any resource void DeselectItemIfNecessary(wxWindow *win);
// needed repairing.
bool RepairResourceIds(); // Need to search through resource table removing this from
// any resource which has this as a parent.
// Deletes 'win' and creates a new window from the resource that virtual bool RemoveResourceFromParent(wxItemResource *res);
// was associated with it. E.g. if you can't change properties on the
// fly, you'll need to delete the window and create it again. virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE);
void AddSelection(wxWindow *win);
virtual bool RecreateSelection(); void RemoveSelection(wxWindow *win);
// Remove selection handles if this control is selected virtual void MakeUniqueName(char *prefix, char *buf);
void DeselectItemIfNecessary(wxWindow *win);
// (Dis)associate resource<->physical window
// Need to search through resource table removing this from // Doesn't delete any windows.
// any resource which has this as a parent. virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
virtual bool RemoveResourceFromParent(wxItemResource *res); virtual bool DisassociateResource(wxItemResource *resource);
virtual bool DisassociateResource(wxWindow *win);
virtual bool EditDialog(wxDialog *dialog, wxWindow *parent); virtual bool DisassociateWindows();
virtual wxItemResource *FindResourceForWindow(wxWindow *win);
void AddSelection(wxWindow *win); virtual wxWindow *FindWindowForResource(wxItemResource *resource);
void RemoveSelection(wxWindow *win);
virtual bool InstantiateAllResourcesFromWindows();
virtual void MakeUniqueName(char *prefix, char *buf); virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
// (Dis)associate resource<->physical window // Accessors
// Doesn't delete any windows. inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
virtual void AssociateResource(wxItemResource *resource, wxWindow *win); inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
virtual bool DisassociateResource(wxItemResource *resource); inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
virtual bool DisassociateResource(wxWindow *win); inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; }
virtual bool DisassociateWindows(); inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; }
virtual wxItemResource *FindResourceForWindow(wxWindow *win); inline wxList& GetSelections() { return m_selections; }
virtual wxWindow *FindWindowForResource(wxItemResource *resource); inline wxMenu *GetPopupMenu() const { return m_popupMenu; }
virtual bool InstantiateAllResourcesFromWindows();
virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
// Accessors
inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; }
inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; }
inline wxList& GetSelections() { return m_selections; }
inline wxMenu *GetPopupMenu() const { return m_popupMenu; }
#ifdef __WXMSW__ #ifdef __WXMSW__
inline wxHelpController *GetHelpController() const { return m_helpController; } inline wxHelpController *GetHelpController() const { return m_helpController; }
#endif #endif
inline void Modify(bool mod = TRUE) { m_modified = mod; } inline void Modify(bool mod = TRUE) { m_modified = mod; }
inline bool Modified() const { return m_modified; } inline bool Modified() const { return m_modified; }
inline wxResourceTable& GetResourceTable() { return m_resourceTable; } inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; } inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
inline wxString GetCurrentFilename() const { return m_currentFilename; } inline wxString GetCurrentFilename() const { return m_currentFilename; }
static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; } static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; } inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; }
inline wxString GetSymbolFilename() const { return m_symbolFilename; } inline wxString GetSymbolFilename() const { return m_symbolFilename; }
inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; } inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; } inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; } wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; }
// Generate a window id and a first stab at a name // Generate a window id and a first stab at a name
int GenerateWindowId(const wxString& prefix, wxString& idName) ; int GenerateWindowId(const wxString& prefix, wxString& idName) ;
// Member variables // Member variables
protected: protected:
#ifdef __WXMSW__ #ifdef __WXMSW__
wxHelpController* m_helpController; wxHelpController* m_helpController;
#endif #endif
wxResourceTableWithSaving m_resourceTable; wxResourceTableWithSaving m_resourceTable;
wxFrame* m_editorFrame; wxFrame* m_editorFrame;
wxResourceEditorScrolledWindow* m_editorPanel; wxResourceEditorScrolledWindow* m_editorPanel;
wxMenu* m_popupMenu; wxMenu* m_popupMenu;
wxResourceEditorProjectTree* m_editorResourceTree; wxResourceEditorProjectTree* m_editorResourceTree;
wxResourceEditorControlList* m_editorControlList; wxResourceEditorControlList* m_editorControlList;
EditorToolBar* m_editorToolBar; EditorToolBar* m_editorToolBar;
int m_nameCounter; int m_nameCounter;
int m_symbolIdCounter; // For generating window ids int m_symbolIdCounter; // For generating window ids
bool m_modified; bool m_modified;
wxHashTable m_resourceAssociations; wxHashTable m_resourceAssociations;
wxList m_selections; wxList m_selections;
wxString m_currentFilename; wxString m_currentFilename;
wxBitmap* m_bitmapImage; // Default for static bitmaps/buttons wxBitmap* m_bitmapImage; // Default for static bitmaps/buttons
wxImageList m_imageList; wxImageList m_imageList;
long m_rootDialogItem; // Root of dialog hierarchy in tree (unused) long m_rootDialogItem; // Root of dialog hierarchy in tree (unused)
// Options to be saved/restored // Options to be saved/restored
wxString m_optionsResourceFilename; // e.g. dialoged.ini, .dialogrc wxString m_optionsResourceFilename; // e.g. dialoged.ini, .dialogrc
wxRect m_propertyWindowSize; wxRect m_propertyWindowSize;
wxRect m_resourceEditorWindowSize; wxRect m_resourceEditorWindowSize;
static wxResourceManager* sm_currentResourceManager; static wxResourceManager* sm_currentResourceManager;
// Symbol table with identifiers for controls // Symbol table with identifiers for controls
wxResourceSymbolTable m_symbolTable; wxResourceSymbolTable m_symbolTable;
// Filename for include file, e.g. resource.h // Filename for include file, e.g. resource.h
wxString m_symbolFilename; wxString m_symbolFilename;
}; };
class wxResourceEditorFrame: public wxFrame class wxResourceEditorFrame: public wxFrame
{ {
public: public:
DECLARE_CLASS(wxResourceEditorFrame) DECLARE_CLASS(wxResourceEditorFrame)
wxResourceManager *manager; wxResourceManager *manager;
wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title, wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400),
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
~wxResourceEditorFrame(); ~wxResourceEditorFrame();
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);
void OnNew(wxCommandEvent& event); void OnNew(wxCommandEvent& event);
void OnOpen(wxCommandEvent& event); void OnOpen(wxCommandEvent& event);
void OnNewDialog(wxCommandEvent& event); void OnNewDialog(wxCommandEvent& event);
void OnClear(wxCommandEvent& event); void OnClear(wxCommandEvent& event);
void OnSave(wxCommandEvent& event); void OnSave(wxCommandEvent& event);
void OnSaveAs(wxCommandEvent& event); void OnSaveAs(wxCommandEvent& event);
void OnExit(wxCommandEvent& event); void OnExit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnContents(wxCommandEvent& event); void OnContents(wxCommandEvent& event);
void OnDeleteSelection(wxCommandEvent& event); void OnDeleteSelection(wxCommandEvent& event);
void OnRecreateSelection(wxCommandEvent& event); void OnRecreateSelection(wxCommandEvent& event);
void OnTest(wxCommandEvent& event); void OnTest(wxCommandEvent& event);
void OnConvertWXRs(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
}; };
class wxResourceEditorScrolledWindow: public wxScrolledWindow class wxResourceEditorScrolledWindow: public wxScrolledWindow
{ {
public: public:
wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0); long style = 0);
~wxResourceEditorScrolledWindow(); ~wxResourceEditorScrolledWindow();
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void DrawTitle(wxDC& dc); void DrawTitle(wxDC& dc);
// Accessors // Accessors
inline int GetMarginX() { return m_marginX; } inline int GetMarginX() { return m_marginX; }
inline int GetMarginY() { return m_marginY; } inline int GetMarginY() { return m_marginY; }
public: public:
wxWindow* m_childWindow; wxWindow* m_childWindow;
private: private:
int m_marginX, m_marginY; int m_marginX, m_marginY;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#define OBJECT_MENU_EDIT 1 #define OBJECT_MENU_EDIT 1
#define OBJECT_MENU_DELETE 2 #define OBJECT_MENU_DELETE 2
/* /*
* Main toolbar * Main toolbar
* *
*/ */
class EditorToolBar: public wxToolBar class EditorToolBar: public wxToolBar
{ {
public: public:
EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0), EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
long style = wxTB_HORIZONTAL); long style = wxTB_HORIZONTAL);
bool OnLeftClick(int toolIndex, bool toggled); bool OnLeftClick(int toolIndex, bool toggled);
void OnMouseEnter(int toolIndex); void OnMouseEnter(int toolIndex);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
// Toolbar ids // Toolbar ids
#define TOOLBAR_LOAD_FILE 1 #define TOOLBAR_LOAD_FILE 101
#define TOOLBAR_SAVE_FILE 2 #define TOOLBAR_SAVE_FILE 102
#define TOOLBAR_NEW 3 #define TOOLBAR_NEW 103
#define TOOLBAR_TREE 5 #define TOOLBAR_TREE 105
#define TOOLBAR_HELP 6 #define TOOLBAR_HELP 106
// Formatting tools // Formatting tools
#define TOOLBAR_FORMAT_HORIZ 10 #define TOOLBAR_FORMAT_HORIZ 110
#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11 #define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 111
#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12 #define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 112
#define TOOLBAR_FORMAT_VERT 13 #define TOOLBAR_FORMAT_VERT 113
#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14 #define TOOLBAR_FORMAT_VERT_TOP_ALIGN 114
#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15 #define TOOLBAR_FORMAT_VERT_BOT_ALIGN 115
#define TOOLBAR_TO_FRONT 16 #define TOOLBAR_TO_FRONT 116
#define TOOLBAR_TO_BACK 17 #define TOOLBAR_TO_BACK 117
#define TOOLBAR_COPY_SIZE 18 #define TOOLBAR_COPY_SIZE 118
#define TOOLBAR_COPY_WIDTH 119
#define TOOLBAR_COPY_HEIGHT 120
#define TOOLBAR_DISTRIBUTE_HORIZ 121
#define TOOLBAR_DISTRIBUTE_VERT 122
/* /*
* this class is used to store data associated with a tree item * this class is used to store data associated with a tree item
*/ */
class wxResourceTreeData : public wxTreeItemData class wxResourceTreeData : public wxTreeItemData
{ {
public: public:
wxResourceTreeData(wxItemResource *resource) { m_resource = resource; } wxResourceTreeData(wxItemResource *resource) { m_resource = resource; }
wxItemResource *GetResource() const { return m_resource; } wxItemResource *GetResource() const { return m_resource; }
private: private:
wxItemResource *m_resource; wxItemResource *m_resource;
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -32,7 +32,7 @@
#include "symbtabl.h" #include "symbtabl.h"
wxResourceSymbolTable::wxResourceSymbolTable(): wxResourceSymbolTable::wxResourceSymbolTable():
m_hashTable(wxKEY_STRING) m_hashTable(wxKEY_STRING)
{ {
} }
@@ -48,70 +48,70 @@ bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
wxFile file; wxFile file;
if (!wxFileExists(filename)) if (!wxFileExists(filename))
return FALSE; return FALSE;
if (!file.Open(filename, wxFile::read)) if (!file.Open(filename, wxFile::read))
return FALSE; return FALSE;
off_t len = file.Length(); off_t len = file.Length();
if (len == -1) if (len == -1)
return FALSE; return FALSE;
Clear(); Clear();
AddStandardSymbols(); AddStandardSymbols();
wxString str; wxString str;
char* p = str.GetWriteBuf(len + 1); char* p = str.GetWriteBuf(len + 1);
if (file.Read(p, len) == wxFile::fd_invalid) if (file.Read(p, len) == wxFile::fd_invalid)
{ {
str.UngetWriteBuf(); str.UngetWriteBuf();
return FALSE; return FALSE;
} }
str.UngetWriteBuf(); str.UngetWriteBuf();
// Look for #define occurrences // Look for #define occurrences
int pos = str.Find("#define"); int pos = str.Find("#define");
while (pos != -1) while (pos != -1)
{ {
size_t len = str.Length(); size_t len = str.Length();
size_t i = pos + 8; size_t i = pos + 8;
// Eat whitespace until symbol // Eat whitespace until symbol
while ((str[i] == ' ' || str[i] == '\t') && (i < len)) while ((str[i] == ' ' || str[i] == '\t') && (i < len))
i ++; i ++;
size_t start = i; size_t start = i;
// Eat symbol // Eat symbol
while (str[i] != ' ' && str[i] != '\t' && (i < len)) while (str[i] != ' ' && str[i] != '\t' && (i < len))
i ++; i ++;
size_t end = i-1; size_t end = i-1;
wxString symbol(str.Mid(start, (end - start + 1))); wxString symbol(str.Mid(start, (end - start + 1)));
// Eat whitespace until number // Eat whitespace until number
while ((str[i] == ' ' || str[i] == '\t') && (i < len)) while ((str[i] == ' ' || str[i] == '\t') && (i < len))
i ++; i ++;
size_t startNum = i; size_t startNum = i;
// Eat number // Eat number
while (str[i] != ' ' && str[i] != '\t' && str[i] != '\n' && (i < len)) while (str[i] != ' ' && str[i] != '\t' && str[i] != '\n' && (i < len))
i ++; i ++;
size_t endNum = i-1; size_t endNum = i-1;
wxString numStr(str.Mid(startNum, (endNum - startNum + 1))); wxString numStr(str.Mid(startNum, (endNum - startNum + 1)));
int id = atol(numStr); int id = atol(numStr);
AddSymbol(symbol, id); AddSymbol(symbol, id);
str = str.Right(len - i); str = str.Right(len - i);
pos = str.Find("#define"); pos = str.Find("#define");
} }
return TRUE; return TRUE;
} }
@@ -120,30 +120,30 @@ bool wxResourceSymbolTable::WriteIncludeFile(const wxString& filename)
wxFile file; wxFile file;
if (!file.Open(filename, wxFile::write)) if (!file.Open(filename, wxFile::write))
return FALSE; return FALSE;
wxString fileOnly(wxFileNameFromPath(filename)); wxString fileOnly(wxFileNameFromPath(filename));
wxString line; wxString line;
line.Printf("/*\n * %s\n * Window identifiers file written by Dialog Editor\n */\n\n", line.Printf("/*\n * %s\n * Window identifiers file written by Dialog Editor\n */\n\n",
(const char*) fileOnly); (const char*) fileOnly);
file.Write(line, line.Length()); file.Write(line, line.Length());
m_hashTable.BeginFind(); m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next(); wxNode* node = m_hashTable.Next();
while (node) while (node)
{ {
const char* str = node->GetKeyString(); const char* str = node->GetKeyString();
int id = (int) node->Data() ; int id = (int) node->Data() ;
if (!IsStandardSymbol(str)) if (!IsStandardSymbol(str))
{ {
wxString line; wxString line;
line.Printf("#define %s %ld\n", str, id); line.Printf("#define %s %ld\n", str, id);
file.Write(line, line.Length()); file.Write(line, line.Length());
} }
node = m_hashTable.Next(); node = m_hashTable.Next();
} }
return TRUE; return TRUE;
@@ -177,14 +177,14 @@ bool wxResourceSymbolTable::RemoveSymbol(int id)
wxString wxResourceSymbolTable::GetSymbolForId(int id) wxString wxResourceSymbolTable::GetSymbolForId(int id)
{ {
m_hashTable.BeginFind(); m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next(); wxNode* node = m_hashTable.Next();
while (node) while (node)
{ {
const char* str = node->GetKeyString(); const char* str = node->GetKeyString();
if (str && ( ((int) node->Data()) == id) ) if (str && ( ((int) node->Data()) == id) )
return wxString(str); return wxString(str);
node = m_hashTable.Next(); node = m_hashTable.Next();
} }
return wxString(""); return wxString("");
@@ -203,13 +203,13 @@ bool wxResourceSymbolTable::SymbolExists(const wxString& symbol) const
bool wxResourceSymbolTable::IdExists(int id) bool wxResourceSymbolTable::IdExists(int id)
{ {
m_hashTable.BeginFind(); m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next(); wxNode* node = m_hashTable.Next();
while (node) while (node)
{ {
if ( (((int) node->Data()) == id) ) if ( (((int) node->Data()) == id) )
return TRUE; return TRUE;
node = m_hashTable.Next(); node = m_hashTable.Next();
} }
return FALSE; return FALSE;
@@ -218,19 +218,19 @@ bool wxResourceSymbolTable::IdExists(int id)
int wxResourceSymbolTable::FindHighestId() int wxResourceSymbolTable::FindHighestId()
{ {
int highest = 0; int highest = 0;
m_hashTable.BeginFind(); m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next(); wxNode* node = m_hashTable.Next();
while (node) while (node)
{ {
int id = ((int) node->Data()); int id = ((int) node->Data());
if (id > highest) if (id > highest)
highest = id; highest = id;
node = m_hashTable.Next(); node = m_hashTable.Next();
} }
// Make sure we don't clash with future standard wxWindows ids // Make sure we don't clash with future standard wxWindows ids
if (highest <= wxID_HIGHEST) if (highest <= wxID_HIGHEST)
highest = wxID_HIGHEST + 1; highest = wxID_HIGHEST + 1;
@@ -238,8 +238,8 @@ int wxResourceSymbolTable::FindHighestId()
} }
/* /*
* A table of the standard identifiers * A table of the standard identifiers
*/ */
struct wxStandardSymbolStruct struct wxStandardSymbolStruct
{ {
@@ -256,7 +256,7 @@ static wxStandardSymbolStruct sg_StandardSymbols[] =
{ "wxID_STATIC", wxID_STATIC }, { "wxID_STATIC", wxID_STATIC },
{ "wxID_YES", wxID_YES }, { "wxID_YES", wxID_YES },
{ "wxID_NO", wxID_NO }, { "wxID_NO", wxID_NO },
{ "wxID_OPEN", wxID_OPEN }, { "wxID_OPEN", wxID_OPEN },
{ "wxID_CLOSE", wxID_CLOSE }, { "wxID_CLOSE", wxID_CLOSE },
{ "wxID_NEW", wxID_NEW }, { "wxID_NEW", wxID_NEW },
@@ -274,14 +274,14 @@ static wxStandardSymbolStruct sg_StandardSymbols[] =
{ "wxID_HELP_COMMANDS", wxID_HELP_COMMANDS }, { "wxID_HELP_COMMANDS", wxID_HELP_COMMANDS },
{ "wxID_HELP_PROCEDURES", wxID_HELP_PROCEDURES }, { "wxID_HELP_PROCEDURES", wxID_HELP_PROCEDURES },
{ "wxID_HELP_CONTEXT", wxID_HELP_CONTEXT }, { "wxID_HELP_CONTEXT", wxID_HELP_CONTEXT },
{ "wxID_CUT", wxID_CUT }, { "wxID_CUT", wxID_CUT },
{ "wxID_COPY", wxID_COPY }, { "wxID_COPY", wxID_COPY },
{ "wxID_PASTE", wxID_PASTE }, { "wxID_PASTE", wxID_PASTE },
{ "wxID_CLEAR", wxID_CLEAR }, { "wxID_CLEAR", wxID_CLEAR },
{ "wxID_FIND", wxID_FIND }, { "wxID_FIND", wxID_FIND },
{ "wxID_DUPLICATE", wxID_DUPLICATE }, { "wxID_DUPLICATE", wxID_DUPLICATE },
{ "wxID_FILE1", wxID_FILE1 }, { "wxID_FILE1", wxID_FILE1 },
{ "wxID_FILE2", wxID_FILE2 }, { "wxID_FILE2", wxID_FILE2 },
{ "wxID_FILE3", wxID_FILE3 }, { "wxID_FILE3", wxID_FILE3 },
@@ -291,7 +291,7 @@ static wxStandardSymbolStruct sg_StandardSymbols[] =
{ "wxID_FILE7", wxID_FILE7 }, { "wxID_FILE7", wxID_FILE7 },
{ "wxID_FILE8", wxID_FILE8 }, { "wxID_FILE8", wxID_FILE8 },
{ "wxID_FILE9", wxID_FILE9 } { "wxID_FILE9", wxID_FILE9 }
}; };
static int sg_StandardSymbolSize = (sizeof(sg_StandardSymbols)/sizeof(wxStandardSymbolStruct)); static int sg_StandardSymbolSize = (sizeof(sg_StandardSymbols)/sizeof(wxStandardSymbolStruct));
@@ -319,12 +319,12 @@ bool wxResourceSymbolTable::IsStandardSymbol(const wxString& symbol) const
bool wxResourceSymbolTable::FillComboBox(wxComboBox* comboBox) bool wxResourceSymbolTable::FillComboBox(wxComboBox* comboBox)
{ {
m_hashTable.BeginFind(); m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next(); wxNode* node = m_hashTable.Next();
while (node) while (node)
{ {
const char* str = node->GetKeyString(); const char* str = node->GetKeyString();
comboBox->Append(str); comboBox->Append(str);
node = m_hashTable.Next(); node = m_hashTable.Next();
} }

View File

@@ -21,8 +21,8 @@ class wxResourceSymbolTable: public wxObject
public: public:
wxResourceSymbolTable(); wxResourceSymbolTable();
~wxResourceSymbolTable(); ~wxResourceSymbolTable();
// Operations // Operations
bool ReadIncludeFile(const wxString& filename); bool ReadIncludeFile(const wxString& filename);
bool WriteIncludeFile(const wxString& filename); bool WriteIncludeFile(const wxString& filename);
void Clear(); void Clear();
@@ -31,22 +31,22 @@ public:
bool RemoveSymbol(int id); bool RemoveSymbol(int id);
void AddStandardSymbols(); void AddStandardSymbols();
bool FillComboBox(wxComboBox* comboBox); bool FillComboBox(wxComboBox* comboBox);
// Accessors // Accessors
wxString GetSymbolForId(int id); wxString GetSymbolForId(int id);
int GetIdForSymbol(const wxString& symbol); int GetIdForSymbol(const wxString& symbol);
bool SymbolExists(const wxString& symbol) const; bool SymbolExists(const wxString& symbol) const;
bool IdExists(int id) ; bool IdExists(int id) ;
bool IsStandardSymbol(const wxString& symbol) const; bool IsStandardSymbol(const wxString& symbol) const;
int FindHighestId() ; int FindHighestId() ;
// Implementation // Implementation
// Member variables // Member variables
protected: protected:
wxHashTable m_hashTable; wxHashTable m_hashTable;
}; };
#endif #endif
// _SYMBTABL_H_ // _SYMBTABL_H_

File diff suppressed because it is too large Load Diff

View File

@@ -28,9 +28,9 @@ public:
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
~wxDialogEditorPropertyListFrame(); ~wxDialogEditorPropertyListFrame();
wxPropertyInfo* GetInfo() const { return m_propInfo; } wxPropertyInfo* GetInfo() const { return m_propInfo; }
private: private:
wxPropertySheet* m_propSheet; wxPropertySheet* m_propSheet;
wxPropertyValidatorRegistry m_registry; wxPropertyValidatorRegistry m_registry;
@@ -41,17 +41,17 @@ private:
// feedback. // feedback.
class wxResourcePropertyListView: public wxPropertyListView class wxResourcePropertyListView: public wxPropertyListView
{ {
public: public:
wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT): wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT):
wxPropertyListView(propPanel, flags) wxPropertyListView(propPanel, flags)
{ {
m_propertyInfo = info; m_propertyInfo = info;
} }
void OnPropertyChanged(wxProperty *property); void OnPropertyChanged(wxProperty *property);
bool OnClose(void); bool OnClose(void);
wxPropertyInfo* m_propertyInfo; wxPropertyInfo* m_propertyInfo;
}; };
// Generic class for relating an object to a collection of properties. // Generic class for relating an object to a collection of properties.
@@ -61,294 +61,294 @@ class wxResourcePropertyListView: public wxPropertyListView
class wxPropertyInfo: public wxObject class wxPropertyInfo: public wxObject
{ {
friend class wxDialogEditorPropertyListFrame; friend class wxDialogEditorPropertyListFrame;
protected: protected:
static wxWindow *sm_propertyWindow; static wxWindow *sm_propertyWindow;
wxPropertyInfo(void) wxPropertyInfo(void)
{ {
} }
~wxPropertyInfo(void) ~wxPropertyInfo(void)
{ {
} }
public: public:
virtual wxProperty *GetProperty(wxString& propName) = 0; virtual wxProperty *GetProperty(wxString& propName) = 0;
virtual bool SetProperty(wxString& propName, wxProperty *property) = 0; virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
virtual void GetPropertyNames(wxStringList& names) = 0; virtual void GetPropertyNames(wxStringList& names) = 0;
virtual bool Edit(wxWindow *parent, const wxString& title); virtual bool Edit(wxWindow *parent, const wxString& title);
static void CloseWindow(); // Close the current window if open. static void CloseWindow(); // Close the current window if open.
}; };
// For all windows // For all windows
class wxWindowPropertyInfo: public wxPropertyInfo class wxWindowPropertyInfo: public wxPropertyInfo
{ {
public: public:
wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL); wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
~wxWindowPropertyInfo(void); ~wxWindowPropertyInfo(void);
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; } inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; }
inline void SetResource(wxItemResource *res) { m_propertyResource = res; } inline void SetResource(wxItemResource *res) { m_propertyResource = res; }
// Helper functions for font properties // Helper functions for font properties
wxProperty *GetFontProperty(wxString& name, wxFont *font); wxProperty *GetFontProperty(wxString& name, wxFont *font);
wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont); wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont);
// Fill in the wxItemResource members to mirror the current window settings // Fill in the wxItemResource members to mirror the current window settings
virtual bool InstantiateResource(wxItemResource *resource); virtual bool InstantiateResource(wxItemResource *resource);
// Set the window style // Set the window style
void SetWindowStyle(wxWindow* win, long style, bool set); void SetWindowStyle(wxWindow* win, long style, bool set);
wxWindow* GetWindow() const { return m_propertyWindow; } wxWindow* GetWindow() const { return m_propertyWindow; }
wxItemResource* GetResource() const { return m_propertyResource; } wxItemResource* GetResource() const { return m_propertyResource; }
protected: protected:
wxWindow* m_propertyWindow; wxWindow* m_propertyWindow;
wxItemResource* m_propertyResource; wxItemResource* m_propertyResource;
}; };
// For panel items // For panel items
class wxItemPropertyInfo: public wxWindowPropertyInfo class wxItemPropertyInfo: public wxWindowPropertyInfo
{ {
protected: protected:
public: public:
wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxWindowPropertyInfo(win, res) {} wxWindowPropertyInfo(win, res) {}
~wxItemPropertyInfo(void) {} ~wxItemPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For buttons // For buttons
class wxButtonPropertyInfo: public wxItemPropertyInfo class wxButtonPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) { } wxItemPropertyInfo(win, res) { }
~wxButtonPropertyInfo(void) {} ~wxButtonPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For bitmap buttons // For bitmap buttons
class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo
{ {
protected: protected:
public: public:
wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxButtonPropertyInfo(win, res) { } wxButtonPropertyInfo(win, res) { }
~wxBitmapButtonPropertyInfo(void) {} ~wxBitmapButtonPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For static text controls // For static text controls
class wxStaticTextPropertyInfo: public wxItemPropertyInfo class wxStaticTextPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) { } wxItemPropertyInfo(win, res) { }
~wxStaticTextPropertyInfo(void) {} ~wxStaticTextPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For static bitmap controls // For static bitmap controls
class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) { } wxItemPropertyInfo(win, res) { }
~wxStaticBitmapPropertyInfo(void) {} ~wxStaticBitmapPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For text/multitext items // For text/multitext items
class wxTextPropertyInfo: public wxItemPropertyInfo class wxTextPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxTextPropertyInfo(void) {} ~wxTextPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For list boxes // For list boxes
class wxListBoxPropertyInfo: public wxItemPropertyInfo class wxListBoxPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxListBoxPropertyInfo(void) {} ~wxListBoxPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For choice items // For choice items
class wxChoicePropertyInfo: public wxItemPropertyInfo class wxChoicePropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxChoicePropertyInfo(void) {} ~wxChoicePropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For choice items // For choice items
class wxComboBoxPropertyInfo: public wxChoicePropertyInfo class wxComboBoxPropertyInfo: public wxChoicePropertyInfo
{ {
protected: protected:
public: public:
wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxChoicePropertyInfo(win, res) {} wxChoicePropertyInfo(win, res) {}
~wxComboBoxPropertyInfo(void) {} ~wxComboBoxPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For radiobox items // For radiobox items
class wxRadioBoxPropertyInfo: public wxItemPropertyInfo class wxRadioBoxPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxRadioBoxPropertyInfo(void) {} ~wxRadioBoxPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For groupbox items // For groupbox items
class wxGroupBoxPropertyInfo: public wxItemPropertyInfo class wxGroupBoxPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxGroupBoxPropertyInfo(void) {} ~wxGroupBoxPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For checkbox items // For checkbox items
class wxCheckBoxPropertyInfo: public wxItemPropertyInfo class wxCheckBoxPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxCheckBoxPropertyInfo(void) {} ~wxCheckBoxPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For radiobutton items // For radiobutton items
class wxRadioButtonPropertyInfo: public wxItemPropertyInfo class wxRadioButtonPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxRadioButtonPropertyInfo(void) {} ~wxRadioButtonPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For gauge items // For gauge items
class wxGaugePropertyInfo: public wxItemPropertyInfo class wxGaugePropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxGaugePropertyInfo(void) {} ~wxGaugePropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For scrollbar items // For scrollbar items
class wxScrollBarPropertyInfo: public wxItemPropertyInfo class wxScrollBarPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxScrollBarPropertyInfo(void) {} ~wxScrollBarPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For slider items // For slider items
class wxSliderPropertyInfo: public wxItemPropertyInfo class wxSliderPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {} wxItemPropertyInfo(win, res) {}
~wxSliderPropertyInfo(void) {} ~wxSliderPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For panels // For panels
class wxPanelPropertyInfo: public wxWindowPropertyInfo class wxPanelPropertyInfo: public wxWindowPropertyInfo
{ {
protected: protected:
public: public:
wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL): wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxWindowPropertyInfo(win, res) {} wxWindowPropertyInfo(win, res) {}
~wxPanelPropertyInfo(void) {} ~wxPanelPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name); wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property); bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names); void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
// Convert this dialog, and its children, to or from dialog units // Convert this dialog, and its children, to or from dialog units
void ConvertDialogUnits(bool toDialogUnits); void ConvertDialogUnits(bool toDialogUnits);
}; };
int wxStringToFontWeight(wxString& val); int wxStringToFontWeight(wxString& val);
@@ -356,39 +356,39 @@ int wxStringToFontStyle(wxString& val);
int wxStringToFontFamily(wxString& val); int wxStringToFontFamily(wxString& val);
/* /*
* A validator to allow editing symbol/id pairs * A validator to allow editing symbol/id pairs
*/ */
class wxResourceSymbolValidator: public wxPropertyListValidator class wxResourceSymbolValidator: public wxPropertyListValidator
{ {
DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator) DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator)
protected: protected:
public: public:
wxResourceSymbolValidator(long flags = 0); wxResourceSymbolValidator(long flags = 0);
~wxResourceSymbolValidator(void); ~wxResourceSymbolValidator(void);
// Called when TICK is pressed or focus is lost. // Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value. // Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update // Called when TICK is pressed or focus is lost or view wants to update
// the property list. // the property list.
// Does the transferance from the property editing area to the property itself // Does the transferance from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the edit (...) button is pressed. // Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
}; };
/* /*
* A dialog for editing symbol/id pairs * A dialog for editing symbol/id pairs
*/ */
class wxResourceSymbolDialog: public wxDialog class wxResourceSymbolDialog: public wxDialog
{ {
@@ -396,31 +396,31 @@ public:
wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
void Init(); void Init();
inline void SetSymbol(const wxString& symbol) { m_symbolName = symbol; } inline void SetSymbol(const wxString& symbol) { m_symbolName = symbol; }
inline void SetId(long id) { m_symbolId = id; } inline void SetId(long id) { m_symbolId = id; }
inline wxString GetSymbol() const { return m_symbolName; } inline wxString GetSymbol() const { return m_symbolName; }
inline long GetId() const { return m_symbolId; } inline long GetId() const { return m_symbolId; }
bool CheckValues(); bool CheckValues();
void OnOK(wxCommandEvent& event); void OnOK(wxCommandEvent& event);
void OnComboBoxSelect(wxCommandEvent& event); void OnComboBoxSelect(wxCommandEvent& event);
void OnSymbolNameUpdate(wxCommandEvent& event); void OnSymbolNameUpdate(wxCommandEvent& event);
protected: protected:
wxString m_symbolName; wxString m_symbolName;
long m_symbolId; long m_symbolId;
wxComboBox* m_nameCtrl; wxComboBox* m_nameCtrl;
wxTextCtrl* m_idCtrl; wxTextCtrl* m_idCtrl;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#define ID_SYMBOLNAME_COMBOBOX 100 #define ID_SYMBOLNAME_COMBOBOX 100
#define ID_SYMBOLID_TEXTCTRL 101 #define ID_SYMBOLID_TEXTCTRL 101
#endif #endif
// _WINPROP_H_ // _WINPROP_H_

View File

@@ -32,244 +32,244 @@
#include "winstyle.h" #include "winstyle.h"
/* /*
* Styles * Styles
*/ */
/* wxListBox */ /* wxListBox */
static wxWindowStylePair g_WindowStylesListBox[] = { static wxWindowStylePair g_WindowStylesListBox[] = {
{ "wxLB_SINGLE", wxLB_SINGLE }, { "wxLB_SINGLE", wxLB_SINGLE },
{ "wxLB_MULTIPLE", wxLB_MULTIPLE }, { "wxLB_MULTIPLE", wxLB_MULTIPLE },
{ "wxLB_EXTENDED", wxLB_EXTENDED }, { "wxLB_EXTENDED", wxLB_EXTENDED },
{ "wxLB_NEEDED_SB", wxLB_NEEDED_SB }, { "wxLB_NEEDED_SB", wxLB_NEEDED_SB },
{ "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB }, { "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB },
{ "wxLB_SORT", wxLB_SORT }, { "wxLB_SORT", wxLB_SORT },
{ "wxLB_OWNERDRAW", wxLB_OWNERDRAW }, { "wxLB_OWNERDRAW", wxLB_OWNERDRAW },
{ "wxLB_HSCROLL", wxLB_HSCROLL } { "wxLB_HSCROLL", wxLB_HSCROLL }
}; };
int g_WindowStylesListBoxCount = sizeof(g_WindowStylesListBox)/sizeof(wxWindowStylePair) ; int g_WindowStylesListBoxCount = sizeof(g_WindowStylesListBox)/sizeof(wxWindowStylePair) ;
/* wxComboxBox */ /* wxComboxBox */
static wxWindowStylePair g_WindowStylesComboBox[] = { static wxWindowStylePair g_WindowStylesComboBox[] = {
{ "wxCB_SIMPLE", wxCB_SIMPLE }, { "wxCB_SIMPLE", wxCB_SIMPLE },
{ "wxCB_DROPDOWN", wxCB_DROPDOWN }, { "wxCB_DROPDOWN", wxCB_DROPDOWN },
{ "wxCB_READONLY", wxCB_READONLY }, { "wxCB_READONLY", wxCB_READONLY },
{ "wxCB_SORT", wxCB_SORT } { "wxCB_SORT", wxCB_SORT }
}; };
int g_WindowStylesComboBoxCount = sizeof(g_WindowStylesComboBox)/sizeof(wxWindowStylePair) ; int g_WindowStylesComboBoxCount = sizeof(g_WindowStylesComboBox)/sizeof(wxWindowStylePair) ;
#if 0 #if 0
/* wxChoice */ /* wxChoice */
static wxWindowStylePair g_WindowStylesChoice[] = { static wxWindowStylePair g_WindowStylesChoice[] = {
}; };
int g_WindowStylesChoiceCount = sizeof(g_WindowStylesChoice)/sizeof(wxWindowStylePair) ; int g_WindowStylesChoiceCount = sizeof(g_WindowStylesChoice)/sizeof(wxWindowStylePair) ;
#endif #endif
/* wxGauge */ /* wxGauge */
static wxWindowStylePair g_WindowStylesGauge[] = { static wxWindowStylePair g_WindowStylesGauge[] = {
{ "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR }, { "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR },
{ "wxGA_HORIZONTAL", wxGA_HORIZONTAL }, { "wxGA_HORIZONTAL", wxGA_HORIZONTAL },
{ "wxGA_VERTICAL", wxGA_VERTICAL } { "wxGA_VERTICAL", wxGA_VERTICAL }
}; };
int g_WindowStylesGaugeCount = sizeof(g_WindowStylesGauge)/sizeof(wxWindowStylePair) ; int g_WindowStylesGaugeCount = sizeof(g_WindowStylesGauge)/sizeof(wxWindowStylePair) ;
/* wxTextCtrl */ /* wxTextCtrl */
static wxWindowStylePair g_WindowStylesTextCtrl[] = { static wxWindowStylePair g_WindowStylesTextCtrl[] = {
// { "wxPASSWORD", wxPASSWORD}, // { "wxPASSWORD", wxPASSWORD},
// { "wxPROCESS_ENTER", wxPROCESS_ENTER}, // { "wxPROCESS_ENTER", wxPROCESS_ENTER},
{ "wxTE_PASSWORD", wxTE_PASSWORD}, { "wxTE_PASSWORD", wxTE_PASSWORD},
{ "wxTE_READONLY", wxTE_READONLY}, { "wxTE_READONLY", wxTE_READONLY},
{ "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER}, { "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER},
{ "wxTE_MULTILINE", wxTE_MULTILINE} { "wxTE_MULTILINE", wxTE_MULTILINE}
}; };
int g_WindowStylesTextCtrlCount = sizeof(g_WindowStylesTextCtrl)/sizeof(wxWindowStylePair) ; int g_WindowStylesTextCtrlCount = sizeof(g_WindowStylesTextCtrl)/sizeof(wxWindowStylePair) ;
/* wxRadioButton */ /* wxRadioButton */
static wxWindowStylePair g_WindowStylesRadioButton[] = { static wxWindowStylePair g_WindowStylesRadioButton[] = {
{ "wxRB_GROUP", wxRB_GROUP } { "wxRB_GROUP", wxRB_GROUP }
}; };
int g_WindowStylesRadioButtonCount = sizeof(g_WindowStylesRadioButton)/sizeof(wxWindowStylePair) ; int g_WindowStylesRadioButtonCount = sizeof(g_WindowStylesRadioButton)/sizeof(wxWindowStylePair) ;
/* wxRadioBox */ /* wxRadioBox */
static wxWindowStylePair g_WindowStylesRadioBox[] = { static wxWindowStylePair g_WindowStylesRadioBox[] = {
{ "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS }, { "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS },
{ "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS } { "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS }
/* /*
, ,
{ "wxRA_HORIZONTAL", wxRA_HORIZONTAL }, { "wxRA_HORIZONTAL", wxRA_HORIZONTAL },
{ "wxRA_VERTICAL", wxRA_VERTICAL } { "wxRA_VERTICAL", wxRA_VERTICAL }
*/ */
}; };
int g_WindowStylesRadioBoxCount = sizeof(g_WindowStylesRadioBox)/sizeof(wxWindowStylePair) ; int g_WindowStylesRadioBoxCount = sizeof(g_WindowStylesRadioBox)/sizeof(wxWindowStylePair) ;
/* wxSlider */ /* wxSlider */
static wxWindowStylePair g_WindowStylesSlider[] = { static wxWindowStylePair g_WindowStylesSlider[] = {
{ "wxSL_HORIZONTAL", wxSL_HORIZONTAL }, { "wxSL_HORIZONTAL", wxSL_HORIZONTAL },
{ "wxSL_VERTICAL", wxSL_VERTICAL }, { "wxSL_VERTICAL", wxSL_VERTICAL },
{ "wxSL_AUTOTICKS", wxSL_AUTOTICKS }, { "wxSL_AUTOTICKS", wxSL_AUTOTICKS },
{ "wxSL_LABELS", wxSL_LABELS }, { "wxSL_LABELS", wxSL_LABELS },
{ "wxSL_LEFT", wxSL_LEFT }, { "wxSL_LEFT", wxSL_LEFT },
{ "wxSL_TOP", wxSL_TOP }, { "wxSL_TOP", wxSL_TOP },
{ "wxSL_RIGHT", wxSL_RIGHT }, { "wxSL_RIGHT", wxSL_RIGHT },
{ "wxSL_BOTTOM", wxSL_BOTTOM }, { "wxSL_BOTTOM", wxSL_BOTTOM },
{ "wxSL_BOTH", wxSL_BOTH }, { "wxSL_BOTH", wxSL_BOTH },
{ "wxSL_SELRANGE", wxSL_SELRANGE } { "wxSL_SELRANGE", wxSL_SELRANGE }
}; };
int g_WindowStylesSliderCount = sizeof(g_WindowStylesSlider)/sizeof(wxWindowStylePair) ; int g_WindowStylesSliderCount = sizeof(g_WindowStylesSlider)/sizeof(wxWindowStylePair) ;
/* wxScrollBar */ /* wxScrollBar */
static wxWindowStylePair g_WindowStylesScrollBar[] = { static wxWindowStylePair g_WindowStylesScrollBar[] = {
{ "wxSB_HORIZONTAL", wxSB_HORIZONTAL }, { "wxSB_HORIZONTAL", wxSB_HORIZONTAL },
{ "wxSB_VERTICAL", wxSB_VERTICAL } { "wxSB_VERTICAL", wxSB_VERTICAL }
}; };
int g_WindowStylesScrollBarCount = sizeof(g_WindowStylesScrollBar)/sizeof(wxWindowStylePair) ; int g_WindowStylesScrollBarCount = sizeof(g_WindowStylesScrollBar)/sizeof(wxWindowStylePair) ;
/* wxButton */ /* wxButton */
static wxWindowStylePair g_WindowStylesButton[] = { static wxWindowStylePair g_WindowStylesButton[] = {
{ "wxBU_AUTODRAW", wxBU_AUTODRAW }, { "wxBU_AUTODRAW", wxBU_AUTODRAW },
{ "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW } { "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW }
}; };
int g_WindowStylesButtonCount = sizeof(g_WindowStylesButton)/sizeof(wxWindowStylePair) ; int g_WindowStylesButtonCount = sizeof(g_WindowStylesButton)/sizeof(wxWindowStylePair) ;
/* wxTreeCtrl */ /* wxTreeCtrl */
static wxWindowStylePair g_WindowStylesTreeCtrl[] = { static wxWindowStylePair g_WindowStylesTreeCtrl[] = {
{ "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS }, { "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS },
{ "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS }, { "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS },
{ "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT } { "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT }
}; };
int g_WindowStylesTreeCtrlCount = sizeof(g_WindowStylesTreeCtrl)/sizeof(wxWindowStylePair) ; int g_WindowStylesTreeCtrlCount = sizeof(g_WindowStylesTreeCtrl)/sizeof(wxWindowStylePair) ;
/* wxListCtrl */ /* wxListCtrl */
static wxWindowStylePair g_WindowStylesListCtrl[] = { static wxWindowStylePair g_WindowStylesListCtrl[] = {
{ "wxLC_ICON", wxLC_ICON }, { "wxLC_ICON", wxLC_ICON },
{ "wxLC_SMALL_ICON", wxLC_SMALL_ICON }, { "wxLC_SMALL_ICON", wxLC_SMALL_ICON },
{ "wxLC_LIST", wxLC_LIST }, { "wxLC_LIST", wxLC_LIST },
{ "wxLC_REPORT", wxLC_REPORT }, { "wxLC_REPORT", wxLC_REPORT },
{ "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP }, { "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP },
{ "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT }, { "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT },
{ "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE }, { "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE },
{ "wxLC_USER_TEXT", wxLC_USER_TEXT }, { "wxLC_USER_TEXT", wxLC_USER_TEXT },
{ "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS }, { "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS },
{ "wxLC_NO_HEADER", wxLC_NO_HEADER }, { "wxLC_NO_HEADER", wxLC_NO_HEADER },
{ "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER }, { "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER },
{ "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL }, { "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL },
{ "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING }, { "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING },
{ "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING } { "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING }
}; };
int g_WindowStylesListCtrlCount = sizeof(g_WindowStylesListCtrl)/sizeof(wxWindowStylePair) ; int g_WindowStylesListCtrlCount = sizeof(g_WindowStylesListCtrl)/sizeof(wxWindowStylePair) ;
/* wxSpinButton */ /* wxSpinButton */
static wxWindowStylePair g_WindowStylesSpinButton[] = { static wxWindowStylePair g_WindowStylesSpinButton[] = {
{ "wxSP_VERTICAL", wxSP_VERTICAL}, { "wxSP_VERTICAL", wxSP_VERTICAL},
{ "wxSP_HORIZONTAL", wxSP_HORIZONTAL}, { "wxSP_HORIZONTAL", wxSP_HORIZONTAL},
{ "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS}, { "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS},
{ "wxSP_WRAP", wxSP_WRAP} { "wxSP_WRAP", wxSP_WRAP}
}; };
int g_WindowStylesSpinButtonCount = sizeof(g_WindowStylesSpinButton)/sizeof(wxWindowStylePair) ; int g_WindowStylesSpinButtonCount = sizeof(g_WindowStylesSpinButton)/sizeof(wxWindowStylePair) ;
/* wxSplitterWindow */ /* wxSplitterWindow */
static wxWindowStylePair g_WindowStylesSplitterWindow[] = { static wxWindowStylePair g_WindowStylesSplitterWindow[] = {
{ "wxSP_NOBORDER", wxSP_NOBORDER}, { "wxSP_NOBORDER", wxSP_NOBORDER},
{ "wxSP_3D", wxSP_3D}, { "wxSP_3D", wxSP_3D},
{ "wxSP_BORDER", wxSP_BORDER} { "wxSP_BORDER", wxSP_BORDER}
}; };
int g_WindowStylesSplitterWindowCount = sizeof(g_WindowStylesSplitterWindow)/sizeof(wxWindowStylePair) ; int g_WindowStylesSplitterWindowCount = sizeof(g_WindowStylesSplitterWindow)/sizeof(wxWindowStylePair) ;
/* wxTabCtrl */ /* wxTabCtrl */
static wxWindowStylePair g_WindowStylesTabCtrl[] = { static wxWindowStylePair g_WindowStylesTabCtrl[] = {
{ "wxTC_MULTILINE", wxTC_MULTILINE}, { "wxTC_MULTILINE", wxTC_MULTILINE},
{ "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY}, { "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY},
{ "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH}, { "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH},
{ "wxTC_OWNERDRAW", wxTC_OWNERDRAW} { "wxTC_OWNERDRAW", wxTC_OWNERDRAW}
}; };
int g_WindowStylesTabCtrlCount = sizeof(g_WindowStylesTabCtrl)/sizeof(wxWindowStylePair) ; int g_WindowStylesTabCtrlCount = sizeof(g_WindowStylesTabCtrl)/sizeof(wxWindowStylePair) ;
/* wxStatusBar95 */ /* wxStatusBar95 */
static wxWindowStylePair g_WindowStylesStatusBar[] = { static wxWindowStylePair g_WindowStylesStatusBar[] = {
{ "wxST_SIZEGRIP", wxST_SIZEGRIP} { "wxST_SIZEGRIP", wxST_SIZEGRIP}
}; };
int g_WindowStylesStatusBarCount = sizeof(g_WindowStylesStatusBar)/sizeof(wxWindowStylePair) ; int g_WindowStylesStatusBarCount = sizeof(g_WindowStylesStatusBar)/sizeof(wxWindowStylePair) ;
/* wxControl */ /* wxControl */
static wxWindowStylePair g_WindowStylesControl[] = { static wxWindowStylePair g_WindowStylesControl[] = {
{ "wxFIXED_LENGTH", wxFIXED_LENGTH}, { "wxFIXED_LENGTH", wxFIXED_LENGTH},
{ "wxALIGN_LEFT", wxALIGN_LEFT}, { "wxALIGN_LEFT", wxALIGN_LEFT},
{ "wxALIGN_CENTRE", wxALIGN_CENTRE}, { "wxALIGN_CENTRE", wxALIGN_CENTRE},
{ "wxALIGN_RIGHT", wxALIGN_RIGHT}, { "wxALIGN_RIGHT", wxALIGN_RIGHT},
{ "wxCOLOURED", wxCOLOURED} { "wxCOLOURED", wxCOLOURED}
}; };
int g_WindowStylesControlCount = sizeof(g_WindowStylesControl)/sizeof(wxWindowStylePair) ; int g_WindowStylesControlCount = sizeof(g_WindowStylesControl)/sizeof(wxWindowStylePair) ;
/* wxToolBar */ /* wxToolBar */
static wxWindowStylePair g_WindowStylesToolBar[] = { static wxWindowStylePair g_WindowStylesToolBar[] = {
{ "wxTB_3DBUTTONS", wxTB_3DBUTTONS}, { "wxTB_3DBUTTONS", wxTB_3DBUTTONS},
{ "wxTB_HORIZONTAL", wxTB_HORIZONTAL}, { "wxTB_HORIZONTAL", wxTB_HORIZONTAL},
{ "wxTB_VERTICAL", wxTB_VERTICAL}, { "wxTB_VERTICAL", wxTB_VERTICAL},
{ "wxTB_FLAT", wxTB_FLAT} { "wxTB_FLAT", wxTB_FLAT}
}; };
int g_WindowStylesToolBarCount = sizeof(g_WindowStylesToolBar)/sizeof(wxWindowStylePair) ; int g_WindowStylesToolBarCount = sizeof(g_WindowStylesToolBar)/sizeof(wxWindowStylePair) ;
/* Frame/dialog */ /* Frame/dialog */
static wxWindowStylePair g_WindowStylesDialog[] = { static wxWindowStylePair g_WindowStylesDialog[] = {
{ "wxSTAY_ON_TOP", wxSTAY_ON_TOP}, { "wxSTAY_ON_TOP", wxSTAY_ON_TOP},
{ "wxCAPTION", wxCAPTION}, { "wxCAPTION", wxCAPTION},
{ "wxICONIZE", wxICONIZE}, { "wxICONIZE", wxICONIZE},
{ "wxMINIMIZE", wxICONIZE}, { "wxMINIMIZE", wxICONIZE},
{ "wxMAXIMIZE", wxMAXIMIZE}, { "wxMAXIMIZE", wxMAXIMIZE},
{ "wxTHICK_FRAME", wxTHICK_FRAME}, { "wxTHICK_FRAME", wxTHICK_FRAME},
{ "wxRESIZE_BORDER", wxRESIZE_BORDER}, { "wxRESIZE_BORDER", wxRESIZE_BORDER},
{ "wxSYSTEM_MENU", wxSYSTEM_MENU}, { "wxSYSTEM_MENU", wxSYSTEM_MENU},
{ "wxMINIMIZE_BOX", wxMINIMIZE_BOX}, { "wxMINIMIZE_BOX", wxMINIMIZE_BOX},
{ "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX}, { "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX},
{ "wxRESIZE_BOX", wxRESIZE_BOX} { "wxRESIZE_BOX", wxRESIZE_BOX}
}; };
int g_WindowStylesDialogCount = sizeof(g_WindowStylesDialog)/sizeof(wxWindowStylePair) ; int g_WindowStylesDialogCount = sizeof(g_WindowStylesDialog)/sizeof(wxWindowStylePair) ;
/* Generic */ /* Generic */
static wxWindowStylePair g_WindowStylesWindow[] = { static wxWindowStylePair g_WindowStylesWindow[] = {
{ "wxBORDER", wxBORDER}, { "wxBORDER", wxBORDER},
{ "wxDOUBLE_BORDER", wxDOUBLE_BORDER}, { "wxDOUBLE_BORDER", wxDOUBLE_BORDER},
{ "wxSUNKEN_BORDER", wxSUNKEN_BORDER}, { "wxSUNKEN_BORDER", wxSUNKEN_BORDER},
{ "wxRAISED_BORDER", wxRAISED_BORDER}, { "wxRAISED_BORDER", wxRAISED_BORDER},
{ "wxSIMPLE_BORDER", wxSIMPLE_BORDER}, { "wxSIMPLE_BORDER", wxSIMPLE_BORDER},
{ "wxSTATIC_BORDER", wxSTATIC_BORDER}, { "wxSTATIC_BORDER", wxSTATIC_BORDER},
{ "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW}, { "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW},
{ "wxNO_BORDER", wxNO_BORDER}, { "wxNO_BORDER", wxNO_BORDER},
{ "wxCLIP_CHILDREN", wxCLIP_CHILDREN} { "wxCLIP_CHILDREN", wxCLIP_CHILDREN}
/* Would be duplicated with e.g. wxLB_HSCROLL /* Would be duplicated with e.g. wxLB_HSCROLL
{ "wxVSCROLL", wxVSCROLL }, { "wxVSCROLL", wxVSCROLL },
{ "wxHSCROLL", wxHSCROLL } { "wxHSCROLL", wxHSCROLL }
*/ */
}; };
int g_WindowStylesWindowCount = sizeof(g_WindowStylesWindow)/sizeof(wxWindowStylePair) ; int g_WindowStylesWindowCount = sizeof(g_WindowStylesWindow)/sizeof(wxWindowStylePair) ;
/* /*
* A table holding all class style objects * A table holding all class style objects
*/ */
wxWindowStyleTable::wxWindowStyleTable(): wxWindowStyleTable::wxWindowStyleTable():
m_classes(wxKEY_STRING) m_classes(wxKEY_STRING)
{ {
} }
@@ -294,7 +294,7 @@ void wxWindowStyleTable::Init()
AddStyles("wxSlider", g_WindowStylesSliderCount, g_WindowStylesSlider); AddStyles("wxSlider", g_WindowStylesSliderCount, g_WindowStylesSlider);
AddStyles("wxGauge", g_WindowStylesGaugeCount, g_WindowStylesGauge); AddStyles("wxGauge", g_WindowStylesGaugeCount, g_WindowStylesGauge);
AddStyles("wxComboBox", g_WindowStylesComboBoxCount, g_WindowStylesComboBox); AddStyles("wxComboBox", g_WindowStylesComboBoxCount, g_WindowStylesComboBox);
// AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice); // AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice);
AddStyles("wxScrollBar", g_WindowStylesScrollBarCount, g_WindowStylesScrollBar); AddStyles("wxScrollBar", g_WindowStylesScrollBarCount, g_WindowStylesScrollBar);
} }
@@ -334,25 +334,25 @@ bool wxWindowStyleTable::GenerateStyleStrings(const wxString& className, long wi
wxWindowStyleClass* styleClass = FindClass(className); wxWindowStyleClass* styleClass = FindClass(className);
if (!styleClass) if (!styleClass)
return FALSE; return FALSE;
styleClass->GenerateStyleStrings(windowStyle, buf); styleClass->GenerateStyleStrings(windowStyle, buf);
return TRUE; return TRUE;
} }
/* /*
* Holds all the styles for a particular class * Holds all the styles for a particular class
*/ */
wxWindowStyleClass::wxWindowStyleClass(int n, wxWindowStylePair *styles) wxWindowStyleClass::wxWindowStyleClass(int n, wxWindowStylePair *styles)
{ {
m_styleCount = n; m_styleCount = n;
m_styles = styles; m_styles = styles;
/* /*
m_styles = new wxWindowStylePair[n]; m_styles = new wxWindowStylePair[n];
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
m_styles[i] = styles[i]; m_styles[i] = styles[i];
*/ */
} }
wxWindowStyleClass::~wxWindowStyleClass() wxWindowStyleClass::~wxWindowStyleClass()
@@ -371,15 +371,15 @@ bool wxWindowStyleClass::GenerateStyle(char *buf, long windowStyle, long flag, c
// Ignore zero flags // Ignore zero flags
if (flag == 0) if (flag == 0)
return TRUE; return TRUE;
if ((windowStyle & flag) == flag) if ((windowStyle & flag) == flag)
{ {
if (strlen(buf) > 0) if (strlen(buf) > 0)
strcat(buf, " | "); strcat(buf, " | ");
strcat(buf, (const char*) strStyle); strcat(buf, (const char*) strStyle);
return TRUE; return TRUE;
} }
else else
return FALSE; return FALSE;
} }

View File

@@ -19,8 +19,8 @@
#include "wx/wx.h" #include "wx/wx.h"
/* /*
* A class for storing/generating window styles. * A class for storing/generating window styles.
*/ */
class wxWindowStyleClass; class wxWindowStyleClass;
@@ -37,41 +37,41 @@ class wxWindowStyleTable: public wxObject
public: public:
wxWindowStyleTable(); wxWindowStyleTable();
~wxWindowStyleTable(); ~wxWindowStyleTable();
// Operations // Operations
void ClearTable(); void ClearTable();
void AddStyles(const wxString& className, int n, wxWindowStylePair *styles); void AddStyles(const wxString& className, int n, wxWindowStylePair *styles);
wxWindowStyleClass* FindClass(const wxString& className) ; wxWindowStyleClass* FindClass(const wxString& className) ;
bool GenerateStyleStrings(const wxString& className, long windowStyle, char *buf); bool GenerateStyleStrings(const wxString& className, long windowStyle, char *buf);
// Initialise with all possible styles // Initialise with all possible styles
void Init(); void Init();
// Members // Members
protected: protected:
wxList m_classes; // A list of wxWindowStyleClass objects, indexed by class name wxList m_classes; // A list of wxWindowStyleClass objects, indexed by class name
}; };
/* /*
* Classes for storing all the window style identifiers associated with a particular class * Classes for storing all the window style identifiers associated with a particular class
*/ */
class wxWindowStyleClass: public wxObject class wxWindowStyleClass: public wxObject
{ {
public: public:
wxWindowStyleClass(int n, wxWindowStylePair *styles); wxWindowStyleClass(int n, wxWindowStylePair *styles);
~wxWindowStyleClass(); ~wxWindowStyleClass();
// Operations // Operations
void GenerateStyleStrings(long windowStyle, char *buf); void GenerateStyleStrings(long windowStyle, char *buf);
bool GenerateStyle(char *buf, long windowStyle, long flag, const wxString& strStyle); bool GenerateStyle(char *buf, long windowStyle, long flag, const wxString& strStyle);
// Members // Members
protected: protected:
wxWindowStylePair* m_styles; // An array of wxWindowStylePair objects wxWindowStylePair* m_styles; // An array of wxWindowStylePair objects
int m_styleCount; int m_styleCount;
}; };
#endif #endif
// _DE_WINSTYLE_H_ // _DE_WINSTYLE_H_