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
@@ -41,12 +41,15 @@ all dialogs in a particular directory.
|
||||
\subsection{File menu}
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{New dialog}{Creates a new dialog resource.}
|
||||
\twocolitem{New project}{Creates a new project (clears index and resets project name).}
|
||||
\twocolitem{Open}{Opens an existing resource file.}
|
||||
\twocolitem{New Dialog}{Creates a new dialog resource.}
|
||||
\twocolitem{New Project}{Creates a new project (clears index and resets project name).}
|
||||
\twocolitem{Open...}{Opens an existing resource file.}
|
||||
\twocolitem{Save}{Saves the current resources.}
|
||||
\twocolitem{Save As...}{Saves the current resources in a named file.}
|
||||
\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.}
|
||||
\end{twocollist}
|
||||
|
||||
@@ -63,7 +66,7 @@ item.}
|
||||
\subsection{Help menu}
|
||||
|
||||
\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.}
|
||||
\end{twocollist}
|
||||
|
||||
@@ -76,15 +79,21 @@ The command toolbar consists of the following tools:
|
||||
\twocolitem{\icon{new.eps}{New}}{Clears the project.}
|
||||
\twocolitem{\icon{open.eps}{Open}}{Opens an existing resource file.}
|
||||
\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{alignt.eps}{Horizontal top-align}}{Aligns the top sides of the selected items horizontally.}
|
||||
\twocolitem{\icon{alignb.eps}{Horizontal bottom-align}}{Aligns the bottom sides of the selected items horizontally.}
|
||||
\twocolitem{\icon{horiz.eps}{Vertical align}}{Aligns the centre of the selected items vertically.}
|
||||
\twocolitem{\icon{alignl.eps}{Vertical left-align}}{Aligns the left sides of the selected items vertically.}
|
||||
\twocolitem{\icon{alignr.eps}{Vertical right-align}}{Aligns the right sides of the selected items vertically.}
|
||||
\twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected item to the subsequently selected item(s).}
|
||||
\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected item(s) to the front of the display list.}
|
||||
\twocolitem{\icon{toback.eps}{To back}}{Puts the selected item(s) to the back of the display list.}
|
||||
\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 controls 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 controls 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 controls vertically.}
|
||||
\twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected control to the subsequently selected control(s).}
|
||||
\twocolitem{\icon{copywdth.eps}{Copy width}}{Copies the width of the first selected control to the subsequently selected control(s).}
|
||||
\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.}
|
||||
\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
|
||||
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}
|
||||
|
||||
|
@@ -2,6 +2,15 @@
|
||||
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
|
||||
\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
|
||||
|
||||
\begin{itemize}\itemsep=0pt
|
||||
|
BIN
utils/dialoged/docs/copyhght.bmp
Normal file
After Width: | Height: | Size: 238 B |
BIN
utils/dialoged/docs/copyhght.gif
Normal file
After Width: | Height: | Size: 125 B |
BIN
utils/dialoged/docs/copywdth.bmp
Normal file
After Width: | Height: | Size: 238 B |
BIN
utils/dialoged/docs/copywdth.gif
Normal file
After Width: | Height: | Size: 127 B |
@@ -4,9 +4,9 @@
|
||||
%\special{!/@scaleunit 1 def}
|
||||
\parskip=10pt
|
||||
\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}
|
||||
\date{December 1998}
|
||||
\date{April 2000}
|
||||
}
|
||||
\makeindex
|
||||
\begin{document}
|
||||
@@ -23,7 +23,7 @@
|
||||
\setfooter{\thepage}{}{}{}{}{\thepage}%
|
||||
|
||||
\begin{center}
|
||||
Copyright (c) 1998 Julian Smart, Anthemion Software
|
||||
Copyright (c) 2000 Julian Smart, Anthemion Software
|
||||
\end{center}
|
||||
|
||||
Please see the wxWindows licence for conditions of use.
|
||||
|
BIN
utils/dialoged/docs/disthor.bmp
Normal file
After Width: | Height: | Size: 238 B |
BIN
utils/dialoged/docs/disthor.gif
Normal file
After Width: | Height: | Size: 123 B |
BIN
utils/dialoged/docs/distvert.bmp
Normal file
After Width: | Height: | Size: 238 B |
BIN
utils/dialoged/docs/distvert.gif
Normal file
After Width: | Height: | Size: 113 B |
BIN
utils/dialoged/src/bitmaps/copyhght.bmp
Normal file
After Width: | Height: | Size: 238 B |
21
utils/dialoged/src/bitmaps/copyhght.xpm
Normal 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. ",
|
||||
" ...... ...... ",
|
||||
" ",
|
||||
" ............. ",
|
||||
" . "};
|
BIN
utils/dialoged/src/bitmaps/copywdth.bmp
Normal file
After Width: | Height: | Size: 238 B |
21
utils/dialoged/src/bitmaps/copywdth.xpm
Normal 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. . ",
|
||||
" . ........ . ",
|
||||
" "};
|
BIN
utils/dialoged/src/bitmaps/disthor.bmp
Normal file
After Width: | Height: | Size: 238 B |
21
utils/dialoged/src/bitmaps/disthor.xpm
Normal 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. ",
|
||||
" ... ... ... ",
|
||||
" "};
|
BIN
utils/dialoged/src/bitmaps/distvert.bmp
Normal file
After Width: | Height: | Size: 238 B |
21
utils/dialoged/src/bitmaps/distvert.xpm
Normal file
@@ -0,0 +1,21 @@
|
||||
/* XPM */
|
||||
static char * distvert_xpm[] = {
|
||||
"16 15 3 1",
|
||||
" c #c0c0c0",
|
||||
". c Black",
|
||||
"X c Yellow",
|
||||
" ",
|
||||
" .............. ",
|
||||
" .XXXXXXXXXXXX. ",
|
||||
" .............. ",
|
||||
" ",
|
||||
" ",
|
||||
" .............. ",
|
||||
" .XXXXXXXXXXXX. ",
|
||||
" .............. ",
|
||||
" ",
|
||||
" ",
|
||||
" .............. ",
|
||||
" .XXXXXXXXXXXX. ",
|
||||
" .............. ",
|
||||
" "};
|
@@ -28,8 +28,8 @@
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
BEGIN_EVENT_TABLE(MyApp, wxApp)
|
||||
EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu)
|
||||
EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu)
|
||||
EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu)
|
||||
EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyApp::MyApp(void)
|
||||
@@ -44,14 +44,14 @@ bool MyApp::OnInit(void)
|
||||
{
|
||||
theResourceManager = new wxResourceManager;
|
||||
theResourceManager->Initialize();
|
||||
|
||||
|
||||
theResourceManager->ShowResourceEditor(TRUE);
|
||||
|
||||
|
||||
if (argc > 1)
|
||||
theResourceManager->Load(argv[1]);
|
||||
|
||||
|
||||
SetTopWindow(theResourceManager->GetEditorFrame());
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -26,16 +26,16 @@ class MyChild;
|
||||
// Define a new application
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
public:
|
||||
MyApp(void);
|
||||
bool OnInit(void);
|
||||
int OnExit(void);
|
||||
|
||||
|
||||
void OnObjectPopupMenu(wxCommandEvent& event)
|
||||
{
|
||||
ObjectMenuProc((wxMenu *)event.GetEventObject(), event);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@@ -57,6 +57,10 @@ HELPTOOL BITMAP "bitmaps/help.bmp"
|
||||
COPYSIZETOOL BITMAP "bitmaps/copysize.bmp"
|
||||
TOFRONTTOOL BITMAP "bitmaps/tofront.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"
|
||||
|
||||
|
@@ -25,114 +25,125 @@
|
||||
|
||||
class wxResourceEditorDialogHandler: public wxEvtHandler
|
||||
{
|
||||
DECLARE_CLASS(wxResourceEditorDialogHandler)
|
||||
public:
|
||||
wxResourceManager *resourceManager;
|
||||
wxPanel *handlerDialog;
|
||||
wxItemResource *handlerResource;
|
||||
wxEvtHandler *handlerOldHandler;
|
||||
|
||||
wxControl *dragItem;
|
||||
int dragMode;
|
||||
int dragType;
|
||||
int dragTolerance;
|
||||
bool checkTolerance;
|
||||
int firstDragX;
|
||||
int firstDragY;
|
||||
int oldDragX;
|
||||
int oldDragY;
|
||||
bool m_mouseCaptured;
|
||||
// long m_treeItem;
|
||||
|
||||
wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
|
||||
wxResourceManager *manager);
|
||||
~wxResourceEditorDialogHandler(void);
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
virtual void OnItemEvent(wxControl *win, wxMouseEvent& event);
|
||||
virtual void OnLeftClick(int x, int y, int keys);
|
||||
virtual void OnRightClick(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 OnItemSelect(wxControl *item, bool select);
|
||||
virtual void OnItemMove(
|
||||
wxControl *WXUNUSED(item), int WXUNUSED(x), int WXUNUSED(y) ) {};
|
||||
virtual void OnItemSize(
|
||||
wxControl *WXUNUSED(item), int WXUNUSED(w), int WXUNUSED(h) ) {};
|
||||
|
||||
void AddChildHandlers(void);
|
||||
void PaintSelectionHandles(wxDC& dc);
|
||||
void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
|
||||
|
||||
// Accessors
|
||||
/*
|
||||
inline long GetTreeItem() const { return m_treeItem; }
|
||||
inline void SetTreeItem(long item) { m_treeItem = item; }
|
||||
*/
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_CLASS(wxResourceEditorDialogHandler)
|
||||
public:
|
||||
wxResourceManager *resourceManager;
|
||||
wxPanel *handlerDialog;
|
||||
wxItemResource *handlerResource;
|
||||
wxEvtHandler *handlerOldHandler;
|
||||
|
||||
wxControl *dragItem;
|
||||
int dragMode;
|
||||
int dragType;
|
||||
int dragTolerance;
|
||||
bool checkTolerance;
|
||||
int firstDragX;
|
||||
int firstDragY;
|
||||
int oldDragX;
|
||||
int oldDragY;
|
||||
bool m_mouseCaptured;
|
||||
// long m_treeItem;
|
||||
|
||||
wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
|
||||
wxResourceManager *manager);
|
||||
~wxResourceEditorDialogHandler(void);
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
virtual void OnItemEvent(wxControl *win, wxMouseEvent& event);
|
||||
virtual void OnLeftClick(int x, int y, int keys);
|
||||
virtual void OnRightClick(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 OnItemSelect(wxControl *item, bool select);
|
||||
virtual void OnItemMove(
|
||||
wxControl *WXUNUSED(item), int WXUNUSED(x), int WXUNUSED(y) ) {};
|
||||
virtual void OnItemSize(
|
||||
wxControl *WXUNUSED(item), int WXUNUSED(w), int WXUNUSED(h) ) {};
|
||||
|
||||
void AddChildHandlers(void);
|
||||
void PaintSelectionHandles(wxDC& dc);
|
||||
void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
|
||||
|
||||
// Accessors
|
||||
/*
|
||||
inline long GetTreeItem() const { return m_treeItem; }
|
||||
inline void SetTreeItem(long item) { m_treeItem = item; }
|
||||
*/
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class wxResourceEditorControlHandler: public wxEvtHandler
|
||||
{
|
||||
DECLARE_CLASS(wxResourceEditorControlHandler)
|
||||
public:
|
||||
// wxResourceManager *resourceManager;
|
||||
wxControl *handlerControl;
|
||||
// wxItemResource *handlerResource;
|
||||
wxEvtHandler *handlerOldHandler;
|
||||
DECLARE_CLASS(wxResourceEditorControlHandler)
|
||||
public:
|
||||
// wxResourceManager *resourceManager;
|
||||
wxControl *handlerControl;
|
||||
// wxItemResource *handlerResource;
|
||||
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;
|
||||
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()
|
||||
// This dialog, for testing dialogs, has to intercept commands before
|
||||
// they go up the hierarchy and accidentally set off arbitrary
|
||||
// Dialog Editor functionality
|
||||
class ResourceEditorDialogTester: public wxDialog
|
||||
{
|
||||
public:
|
||||
ResourceEditorDialogTester() {}
|
||||
|
||||
bool ProcessEvent(wxEvent& event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -41,8 +41,8 @@ BEGIN_EVENT_TABLE(wxResourceEditorControlList, wxListCtrl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
long style):
|
||||
wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE)
|
||||
long style):
|
||||
wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
@@ -74,7 +74,7 @@ void wxResourceEditorControlList::Initialize()
|
||||
wxIcon icon16("RADIOBTN_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
|
||||
wxIcon icon17("SCROLBAR_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
|
||||
#else
|
||||
|
||||
|
||||
#include "bitmaps/arrow.xpm"
|
||||
wxIcon icon1( arrow_xpm );
|
||||
#include "bitmaps/button.xpm"
|
||||
@@ -110,7 +110,7 @@ void wxResourceEditorControlList::Initialize()
|
||||
#include "bitmaps/scrolbar.xpm"
|
||||
wxIcon icon17( scrolbar_xpm );
|
||||
#endif
|
||||
|
||||
|
||||
m_imageList.Add(icon1);
|
||||
m_imageList.Add(icon2);
|
||||
m_imageList.Add(icon3);
|
||||
@@ -130,7 +130,7 @@ void wxResourceEditorControlList::Initialize()
|
||||
m_imageList.Add(icon17);
|
||||
|
||||
SetImageList(& m_imageList, wxIMAGE_LIST_SMALL);
|
||||
|
||||
|
||||
long id = InsertItem(0, "Pointer", 0);
|
||||
id = InsertItem(1, "wxButton", 1);
|
||||
id = InsertItem(2, "wxBitmapButton", 2);
|
||||
@@ -148,14 +148,14 @@ void wxResourceEditorControlList::Initialize()
|
||||
id = InsertItem(14, "wxRadioBox", 14);
|
||||
id = InsertItem(15, "wxRadioButton", 15);
|
||||
id = InsertItem(16, "wxScrollBar", 16);
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
InsertItem(RESED_TREECTRL, "wxTreeCtrl", 16);
|
||||
InsertItem(RESED_LISTCTRL, "wxListCtrl", 17);
|
||||
InsertItem(RESED_SPINBUTTON, "wxSpinButton", 18);
|
||||
*/
|
||||
|
||||
// SetColumnWidth(-1, 80);
|
||||
*/
|
||||
|
||||
// SetColumnWidth(-1, 80);
|
||||
}
|
||||
|
||||
// Get selection, or -1
|
||||
|
@@ -21,15 +21,15 @@ public:
|
||||
wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
long style = wxLC_SMALL_ICON|wxLC_AUTOARRANGE|wxLC_SINGLE_SEL);
|
||||
~wxResourceEditorControlList();
|
||||
|
||||
|
||||
// Load icons and add to the list
|
||||
void Initialize();
|
||||
|
||||
|
||||
// Get selection, or -1
|
||||
long GetSelection() const;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
wxImageList m_imageList;
|
||||
};
|
||||
|
@@ -38,13 +38,13 @@
|
||||
#include "reseditr.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl)
|
||||
EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
|
||||
EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
|
||||
EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
|
||||
EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
long style):
|
||||
wxTreeCtrl(parent, id, pos, size, style)
|
||||
long style):
|
||||
wxTreeCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,18 +54,18 @@ void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event))
|
||||
long sel = GetSelection();
|
||||
if (sel == -1)
|
||||
return;
|
||||
|
||||
|
||||
if (GetItemData(sel) == 0)
|
||||
return;
|
||||
|
||||
|
||||
wxItemResource* res = (wxResourceTreeData *)GetItemData(sel)->GetResource();
|
||||
wxString resType(res->GetType());
|
||||
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
|
||||
return;
|
||||
|
||||
|
||||
wxResourceEditorFrame *frame = (wxResourceEditorFrame *)wxWindow::GetParent();
|
||||
wxResourceManager *manager = frame->manager;
|
||||
|
||||
|
||||
manager->EditSelectedResource();
|
||||
#endif
|
||||
}
|
||||
@@ -75,18 +75,18 @@ void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
|
||||
long sel = GetSelection();
|
||||
if (sel == -1)
|
||||
return;
|
||||
|
||||
|
||||
if (GetItemData(sel) == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (m_invalid)
|
||||
return;
|
||||
|
||||
|
||||
wxItemResource* res = ((wxResourceTreeData *)GetItemData(sel))->GetResource();
|
||||
wxString resType(res->GetType());
|
||||
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
|
||||
return;
|
||||
|
||||
|
||||
wxResourceManager::GetCurrentResourceManager()->Edit(res);
|
||||
}
|
||||
|
||||
|
@@ -19,17 +19,17 @@ class wxResourceEditorProjectTree: public wxTreeCtrl
|
||||
public:
|
||||
wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
long style = wxTR_HAS_BUTTONS);
|
||||
|
||||
|
||||
void LeftDClick(wxMouseEvent& event);
|
||||
void OnSelChanged(wxTreeEvent& event);
|
||||
|
||||
|
||||
inline void SetInvalid(bool invalid) { m_invalid = invalid; }
|
||||
|
||||
|
||||
protected:
|
||||
bool m_invalid; // While TRUE, don't respond to selections etc.
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#ifndef _RESEDITR_H_
|
||||
#define _RESEDITR_H_
|
||||
|
||||
#define wxDIALOG_EDITOR_VERSION 1.7
|
||||
#define wxDIALOG_EDITOR_VERSION 2.1
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "reseditr.h"
|
||||
@@ -30,17 +30,18 @@
|
||||
#include "symbtabl.h"
|
||||
#include "winstyle.h"
|
||||
|
||||
#define RESED_DELETE 1
|
||||
#define RESED_RECREATE 3
|
||||
#define RESED_CLEAR 4
|
||||
#define RESED_NEW_DIALOG 5
|
||||
#define RESED_NEW_PANEL 6
|
||||
#define RESED_TEST 10
|
||||
#define RESED_DELETE 301
|
||||
#define RESED_RECREATE 303
|
||||
#define RESED_CLEAR 304
|
||||
#define RESED_NEW_DIALOG 305
|
||||
#define RESED_NEW_PANEL 306
|
||||
#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_LISTCTRL 101
|
||||
#define IDC_TREECTRL 500
|
||||
#define IDC_LISTCTRL 501
|
||||
|
||||
// For control list ('palette')
|
||||
#define RESED_POINTER 0
|
||||
@@ -65,8 +66,8 @@
|
||||
#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 EditorToolBar;
|
||||
@@ -83,373 +84,365 @@ class wxResourceEditorControlList;
|
||||
class wxHelpController;
|
||||
|
||||
/*
|
||||
* The resourceTable contains a list of wxItemResources (which each may
|
||||
* have further children, defining e.g. a dialog box with controls).
|
||||
*
|
||||
* We need to associate actual windows with each wxItemResource,
|
||||
* instead of the current 'one current window' scheme.
|
||||
*
|
||||
* - We create a new dialog, create a wxItemResource,
|
||||
* associate the dialog with wxItemResource via a hash table.
|
||||
* Must be a hash table in case dialog is deleted without
|
||||
* telling the resource manager.
|
||||
* - When we save the resource after editing/closing the dialog,
|
||||
* we check the wxItemResource/wxDialog and children for
|
||||
* consistency (throw away items no longer in the wxDialog,
|
||||
* create any new wxItemResources).
|
||||
* - We save the wxItemResources via the wxPropertyInfo classes,
|
||||
* so devolve the code to the appropriate class.
|
||||
* This involves creating a new temporary wxPropertyInfo for
|
||||
* the purpose.
|
||||
*
|
||||
* We currently assume we only create one instance of a window for
|
||||
* each wxItemResource. We will need to relax this when we're editing
|
||||
* in situ.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
* The resourceTable contains a list of wxItemResources (which each may
|
||||
* have further children, defining e.g. a dialog box with controls).
|
||||
*
|
||||
* We need to associate actual windows with each wxItemResource,
|
||||
* instead of the current 'one current window' scheme.
|
||||
*
|
||||
* - We create a new dialog, create a wxItemResource,
|
||||
* associate the dialog with wxItemResource via a hash table.
|
||||
* Must be a hash table in case dialog is deleted without
|
||||
* telling the resource manager.
|
||||
* - When we save the resource after editing/closing the dialog,
|
||||
* we check the wxItemResource/wxDialog and children for
|
||||
* consistency (throw away items no longer in the wxDialog,
|
||||
* create any new wxItemResources).
|
||||
* - We save the wxItemResources via the wxPropertyInfo classes,
|
||||
* so devolve the code to the appropriate class.
|
||||
* This involves creating a new temporary wxPropertyInfo for
|
||||
* the purpose.
|
||||
*
|
||||
* We currently assume we only create one instance of a window for
|
||||
* each wxItemResource. We will need to relax this when we're editing
|
||||
* in situ.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class wxResourceTableWithSaving: public wxResourceTable
|
||||
{
|
||||
public:
|
||||
wxResourceTableWithSaving():wxResourceTable()
|
||||
{
|
||||
// Add all known window styles
|
||||
m_styleTable.Init();
|
||||
}
|
||||
virtual bool Save(const wxString& filename);
|
||||
virtual bool SaveResource(wxTextOutputStream& stream, wxItemResource* item, wxItemResource* parentItem);
|
||||
|
||||
void GeneratePanelStyleString(long windowStyle, char *buf);
|
||||
void GenerateDialogStyleString(long windowStyle, char *buf);
|
||||
|
||||
/*
|
||||
void GenerateRadioBoxStyleString(long windowStyle, char *buf);
|
||||
void GenerateMessageStyleString(long windowStyle, char *buf);
|
||||
void GenerateTextStyleString(long windowStyle, char *buf);
|
||||
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);
|
||||
|
||||
public:
|
||||
wxResourceTableWithSaving():wxResourceTable()
|
||||
{
|
||||
// Add all known window styles
|
||||
m_styleTable.Init();
|
||||
}
|
||||
virtual bool Save(const wxString& filename);
|
||||
virtual bool SaveResource(wxTextOutputStream& stream, wxItemResource* item, wxItemResource* parentItem);
|
||||
|
||||
void GeneratePanelStyleString(long windowStyle, char *buf);
|
||||
void GenerateDialogStyleString(long windowStyle, char *buf);
|
||||
|
||||
void GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf);
|
||||
|
||||
void OutputFont(wxTextOutputStream& stream, const wxFont& font);
|
||||
wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource);
|
||||
|
||||
protected:
|
||||
wxWindowStyleTable m_styleTable;
|
||||
wxWindowStyleTable m_styleTable;
|
||||
};
|
||||
|
||||
|
||||
class wxResourceEditorScrolledWindow;
|
||||
|
||||
class wxResourceManager: public wxObject
|
||||
{
|
||||
friend class wxResourceEditorFrame;
|
||||
|
||||
friend class wxResourceEditorFrame;
|
||||
|
||||
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
|
||||
|
||||
// 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");
|
||||
|
||||
virtual bool Save();
|
||||
virtual bool SaveAs();
|
||||
virtual bool Save(const wxString& filename);
|
||||
virtual bool Load(const wxString& filename);
|
||||
virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
|
||||
virtual void SetFrameTitle(const wxString& filename);
|
||||
virtual void ClearCurrentDialog();
|
||||
virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
|
||||
virtual bool SaveIfModified();
|
||||
virtual void AlignItems(int flag);
|
||||
virtual void CopySize();
|
||||
virtual void ToBackOrFront(bool toBack);
|
||||
virtual wxWindow *FindParentOfSelection();
|
||||
|
||||
virtual wxFrame *OnCreateEditorFrame(const char *title);
|
||||
virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
|
||||
virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
|
||||
virtual wxToolBar *OnCreateToolBar(wxFrame *parent);
|
||||
|
||||
// Create a window information object for the give window
|
||||
wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
|
||||
// Edit the given window
|
||||
void EditWindow(wxWindow *win);
|
||||
|
||||
virtual void UpdateResourceList();
|
||||
virtual void AddItemsRecursively(long parent, wxItemResource *resource);
|
||||
virtual bool EditSelectedResource();
|
||||
virtual bool Edit(wxItemResource *res);
|
||||
virtual bool CreateNewPanel();
|
||||
virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
|
||||
virtual bool DeleteSelection();
|
||||
virtual bool TestCurrentDialog(wxWindow* parent);
|
||||
|
||||
// Saves the window info into the resource, and deletes the
|
||||
// handler. Doesn't actually disassociate the window from
|
||||
// the resources. Replaces OnClose.
|
||||
virtual bool SaveInfoAndDeleteHandler(wxWindow* win);
|
||||
|
||||
// Destroys the window. If this is the 'current' panel, NULLs the
|
||||
// variable.
|
||||
virtual bool DeleteWindow(wxWindow* win);
|
||||
virtual bool DeleteResource(wxItemResource *res);
|
||||
virtual bool DeleteResource(wxWindow *win);
|
||||
|
||||
// Add bitmap resource if there isn't already one with this filename.
|
||||
virtual wxString AddBitmapResource(const wxString& filename);
|
||||
|
||||
// Delete the bitmap resource if it isn't being used by another resource.
|
||||
virtual void PossiblyDeleteBitmapResource(const wxString& resourceName);
|
||||
|
||||
// Helper function for above
|
||||
virtual bool IsBitmapResourceUsed(const wxString& resourceName);
|
||||
|
||||
wxItemResource *FindBitmapResourceByFilename(const wxString& filename);
|
||||
|
||||
wxString FindBitmapFilenameForResource(wxItemResource *resource);
|
||||
|
||||
// Is this window identifier in use?
|
||||
bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;
|
||||
|
||||
// Is this window identifier compatible with the given name? (i.e.
|
||||
// does it already exist under a different name)
|
||||
bool IsIdentifierOK(const wxString& name, wxWindowID id);
|
||||
|
||||
// Change all integer ids that match oldId, to newId.
|
||||
// This is necessary if an id is changed for one resource - all resources
|
||||
// must be changed.
|
||||
void ChangeIds(int oldId, int newId);
|
||||
|
||||
// If any resource ids were missing (or their symbol was missing),
|
||||
// repair them i.e. give them new ids. Returns TRUE if any resource
|
||||
// needed repairing.
|
||||
bool RepairResourceIds();
|
||||
|
||||
// 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
|
||||
// fly, you'll need to delete the window and create it again.
|
||||
virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE);
|
||||
|
||||
virtual bool RecreateSelection();
|
||||
|
||||
// Remove selection handles if this control is selected
|
||||
void DeselectItemIfNecessary(wxWindow *win);
|
||||
|
||||
// Need to search through resource table removing this from
|
||||
// any resource which has this as a parent.
|
||||
virtual bool RemoveResourceFromParent(wxItemResource *res);
|
||||
|
||||
virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
|
||||
|
||||
void AddSelection(wxWindow *win);
|
||||
void RemoveSelection(wxWindow *win);
|
||||
|
||||
virtual void MakeUniqueName(char *prefix, char *buf);
|
||||
|
||||
// (Dis)associate resource<->physical window
|
||||
// Doesn't delete any windows.
|
||||
virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
|
||||
virtual bool DisassociateResource(wxItemResource *resource);
|
||||
virtual bool DisassociateResource(wxWindow *win);
|
||||
virtual bool DisassociateWindows();
|
||||
virtual wxItemResource *FindResourceForWindow(wxWindow *win);
|
||||
virtual wxWindow *FindWindowForResource(wxItemResource *resource);
|
||||
|
||||
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; }
|
||||
virtual bool Save();
|
||||
virtual bool SaveAs();
|
||||
virtual bool Save(const wxString& filename);
|
||||
virtual bool Load(const wxString& filename);
|
||||
virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
|
||||
virtual void SetFrameTitle(const wxString& filename);
|
||||
virtual void ClearCurrentDialog();
|
||||
virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
|
||||
virtual bool SaveIfModified();
|
||||
virtual void AlignItems(int flag);
|
||||
virtual void CopySize(int command); // Copy width, height or both from first control
|
||||
virtual void ToBackOrFront(bool toBack);
|
||||
virtual void DistributePositions(int command); // Distribute controls evenly between first and last
|
||||
virtual wxWindow *FindParentOfSelection();
|
||||
|
||||
virtual wxFrame *OnCreateEditorFrame(const char *title);
|
||||
virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
|
||||
virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
|
||||
virtual wxToolBar *OnCreateToolBar(wxFrame *parent);
|
||||
|
||||
// Create a window information object for the give window
|
||||
wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
|
||||
// Edit the given window
|
||||
void EditWindow(wxWindow *win);
|
||||
|
||||
virtual void UpdateResourceList();
|
||||
virtual void AddItemsRecursively(long parent, wxItemResource *resource);
|
||||
virtual bool EditSelectedResource();
|
||||
virtual bool Edit(wxItemResource *res);
|
||||
virtual bool CreateNewPanel();
|
||||
virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
|
||||
virtual bool DeleteSelection();
|
||||
virtual bool TestCurrentDialog(wxWindow* parent);
|
||||
|
||||
// Saves the window info into the resource, and deletes the
|
||||
// handler. Doesn't actually disassociate the window from
|
||||
// the resources. Replaces OnClose.
|
||||
virtual bool SaveInfoAndDeleteHandler(wxWindow* win);
|
||||
|
||||
// Destroys the window. If this is the 'current' panel, NULLs the
|
||||
// variable.
|
||||
virtual bool DeleteWindow(wxWindow* win);
|
||||
virtual bool DeleteResource(wxItemResource *res);
|
||||
virtual bool DeleteResource(wxWindow *win);
|
||||
|
||||
// Add bitmap resource if there isn't already one with this filename.
|
||||
virtual wxString AddBitmapResource(const wxString& filename);
|
||||
|
||||
// Delete the bitmap resource if it isn't being used by another resource.
|
||||
virtual void PossiblyDeleteBitmapResource(const wxString& resourceName);
|
||||
|
||||
// Helper function for above
|
||||
virtual bool IsBitmapResourceUsed(const wxString& resourceName);
|
||||
|
||||
wxItemResource *FindBitmapResourceByFilename(const wxString& filename);
|
||||
|
||||
wxString FindBitmapFilenameForResource(wxItemResource *resource);
|
||||
|
||||
// Is this window identifier in use?
|
||||
bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;
|
||||
|
||||
// Is this window identifier compatible with the given name? (i.e.
|
||||
// does it already exist under a different name)
|
||||
bool IsIdentifierOK(const wxString& name, wxWindowID id);
|
||||
|
||||
// Change all integer ids that match oldId, to newId.
|
||||
// This is necessary if an id is changed for one resource - all resources
|
||||
// must be changed.
|
||||
void ChangeIds(int oldId, int newId);
|
||||
|
||||
// If any resource ids were missing (or their symbol was missing),
|
||||
// repair them i.e. give them new ids. Returns TRUE if any resource
|
||||
// needed repairing.
|
||||
bool RepairResourceIds();
|
||||
|
||||
// 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
|
||||
// fly, you'll need to delete the window and create it again.
|
||||
virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE);
|
||||
|
||||
virtual bool RecreateSelection();
|
||||
|
||||
// Remove selection handles if this control is selected
|
||||
void DeselectItemIfNecessary(wxWindow *win);
|
||||
|
||||
// Need to search through resource table removing this from
|
||||
// any resource which has this as a parent.
|
||||
virtual bool RemoveResourceFromParent(wxItemResource *res);
|
||||
|
||||
virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
|
||||
|
||||
void AddSelection(wxWindow *win);
|
||||
void RemoveSelection(wxWindow *win);
|
||||
|
||||
virtual void MakeUniqueName(char *prefix, char *buf);
|
||||
|
||||
// (Dis)associate resource<->physical window
|
||||
// Doesn't delete any windows.
|
||||
virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
|
||||
virtual bool DisassociateResource(wxItemResource *resource);
|
||||
virtual bool DisassociateResource(wxWindow *win);
|
||||
virtual bool DisassociateWindows();
|
||||
virtual wxItemResource *FindResourceForWindow(wxWindow *win);
|
||||
virtual wxWindow *FindWindowForResource(wxItemResource *resource);
|
||||
|
||||
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__
|
||||
inline wxHelpController *GetHelpController() const { return m_helpController; }
|
||||
inline wxHelpController *GetHelpController() const { return m_helpController; }
|
||||
#endif
|
||||
|
||||
inline void Modify(bool mod = TRUE) { m_modified = mod; }
|
||||
inline bool Modified() const { return m_modified; }
|
||||
|
||||
inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
|
||||
inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
|
||||
|
||||
inline wxString GetCurrentFilename() const { return m_currentFilename; }
|
||||
static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
|
||||
|
||||
inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; }
|
||||
inline wxString GetSymbolFilename() const { return m_symbolFilename; }
|
||||
|
||||
inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
|
||||
inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
|
||||
|
||||
wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; }
|
||||
|
||||
// Generate a window id and a first stab at a name
|
||||
int GenerateWindowId(const wxString& prefix, wxString& idName) ;
|
||||
|
||||
// Member variables
|
||||
|
||||
inline void Modify(bool mod = TRUE) { m_modified = mod; }
|
||||
inline bool Modified() const { return m_modified; }
|
||||
|
||||
inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
|
||||
inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
|
||||
|
||||
inline wxString GetCurrentFilename() const { return m_currentFilename; }
|
||||
static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
|
||||
|
||||
inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; }
|
||||
inline wxString GetSymbolFilename() const { return m_symbolFilename; }
|
||||
|
||||
inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
|
||||
inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
|
||||
|
||||
wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; }
|
||||
|
||||
// Generate a window id and a first stab at a name
|
||||
int GenerateWindowId(const wxString& prefix, wxString& idName) ;
|
||||
|
||||
// Member variables
|
||||
protected:
|
||||
#ifdef __WXMSW__
|
||||
wxHelpController* m_helpController;
|
||||
wxHelpController* m_helpController;
|
||||
#endif
|
||||
wxResourceTableWithSaving m_resourceTable;
|
||||
wxFrame* m_editorFrame;
|
||||
wxResourceEditorScrolledWindow* m_editorPanel;
|
||||
wxMenu* m_popupMenu;
|
||||
wxResourceEditorProjectTree* m_editorResourceTree;
|
||||
wxResourceEditorControlList* m_editorControlList;
|
||||
EditorToolBar* m_editorToolBar;
|
||||
int m_nameCounter;
|
||||
int m_symbolIdCounter; // For generating window ids
|
||||
bool m_modified;
|
||||
wxHashTable m_resourceAssociations;
|
||||
wxList m_selections;
|
||||
wxString m_currentFilename;
|
||||
wxBitmap* m_bitmapImage; // Default for static bitmaps/buttons
|
||||
|
||||
wxImageList m_imageList;
|
||||
long m_rootDialogItem; // Root of dialog hierarchy in tree (unused)
|
||||
|
||||
// Options to be saved/restored
|
||||
wxString m_optionsResourceFilename; // e.g. dialoged.ini, .dialogrc
|
||||
wxRect m_propertyWindowSize;
|
||||
wxRect m_resourceEditorWindowSize;
|
||||
static wxResourceManager* sm_currentResourceManager;
|
||||
|
||||
// Symbol table with identifiers for controls
|
||||
wxResourceSymbolTable m_symbolTable;
|
||||
// Filename for include file, e.g. resource.h
|
||||
wxString m_symbolFilename;
|
||||
wxResourceTableWithSaving m_resourceTable;
|
||||
wxFrame* m_editorFrame;
|
||||
wxResourceEditorScrolledWindow* m_editorPanel;
|
||||
wxMenu* m_popupMenu;
|
||||
wxResourceEditorProjectTree* m_editorResourceTree;
|
||||
wxResourceEditorControlList* m_editorControlList;
|
||||
EditorToolBar* m_editorToolBar;
|
||||
int m_nameCounter;
|
||||
int m_symbolIdCounter; // For generating window ids
|
||||
bool m_modified;
|
||||
wxHashTable m_resourceAssociations;
|
||||
wxList m_selections;
|
||||
wxString m_currentFilename;
|
||||
wxBitmap* m_bitmapImage; // Default for static bitmaps/buttons
|
||||
|
||||
wxImageList m_imageList;
|
||||
long m_rootDialogItem; // Root of dialog hierarchy in tree (unused)
|
||||
|
||||
// Options to be saved/restored
|
||||
wxString m_optionsResourceFilename; // e.g. dialoged.ini, .dialogrc
|
||||
wxRect m_propertyWindowSize;
|
||||
wxRect m_resourceEditorWindowSize;
|
||||
static wxResourceManager* sm_currentResourceManager;
|
||||
|
||||
// Symbol table with identifiers for controls
|
||||
wxResourceSymbolTable m_symbolTable;
|
||||
// Filename for include file, e.g. resource.h
|
||||
wxString m_symbolFilename;
|
||||
};
|
||||
|
||||
|
||||
class wxResourceEditorFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(wxResourceEditorFrame)
|
||||
|
||||
wxResourceManager *manager;
|
||||
wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400),
|
||||
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
~wxResourceEditorFrame();
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
void OnNew(wxCommandEvent& event);
|
||||
void OnOpen(wxCommandEvent& event);
|
||||
void OnNewDialog(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
void OnSave(wxCommandEvent& event);
|
||||
void OnSaveAs(wxCommandEvent& event);
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnContents(wxCommandEvent& event);
|
||||
void OnDeleteSelection(wxCommandEvent& event);
|
||||
void OnRecreateSelection(wxCommandEvent& event);
|
||||
void OnTest(wxCommandEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
public:
|
||||
DECLARE_CLASS(wxResourceEditorFrame)
|
||||
|
||||
wxResourceManager *manager;
|
||||
wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400),
|
||||
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
~wxResourceEditorFrame();
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
void OnNew(wxCommandEvent& event);
|
||||
void OnOpen(wxCommandEvent& event);
|
||||
void OnNewDialog(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
void OnSave(wxCommandEvent& event);
|
||||
void OnSaveAs(wxCommandEvent& event);
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnContents(wxCommandEvent& event);
|
||||
void OnDeleteSelection(wxCommandEvent& event);
|
||||
void OnRecreateSelection(wxCommandEvent& event);
|
||||
void OnTest(wxCommandEvent& event);
|
||||
void OnConvertWXRs(wxCommandEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class wxResourceEditorScrolledWindow: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
~wxResourceEditorScrolledWindow();
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
void DrawTitle(wxDC& dc);
|
||||
|
||||
// Accessors
|
||||
inline int GetMarginX() { return m_marginX; }
|
||||
inline int GetMarginY() { return m_marginY; }
|
||||
|
||||
public:
|
||||
wxWindow* m_childWindow;
|
||||
private:
|
||||
int m_marginX, m_marginY;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
public:
|
||||
wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
~wxResourceEditorScrolledWindow();
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
void DrawTitle(wxDC& dc);
|
||||
|
||||
// Accessors
|
||||
inline int GetMarginX() { return m_marginX; }
|
||||
inline int GetMarginY() { return m_marginY; }
|
||||
|
||||
public:
|
||||
wxWindow* m_childWindow;
|
||||
private:
|
||||
int m_marginX, m_marginY;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define OBJECT_MENU_EDIT 1
|
||||
#define OBJECT_MENU_DELETE 2
|
||||
|
||||
/*
|
||||
* Main toolbar
|
||||
*
|
||||
*/
|
||||
|
||||
* Main toolbar
|
||||
*
|
||||
*/
|
||||
|
||||
class EditorToolBar: public wxToolBar
|
||||
{
|
||||
public:
|
||||
EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
|
||||
long style = wxTB_HORIZONTAL);
|
||||
bool OnLeftClick(int toolIndex, bool toggled);
|
||||
void OnMouseEnter(int toolIndex);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
|
||||
long style = wxTB_HORIZONTAL);
|
||||
bool OnLeftClick(int toolIndex, bool toggled);
|
||||
void OnMouseEnter(int toolIndex);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Toolbar ids
|
||||
#define TOOLBAR_LOAD_FILE 1
|
||||
#define TOOLBAR_SAVE_FILE 2
|
||||
#define TOOLBAR_NEW 3
|
||||
#define TOOLBAR_TREE 5
|
||||
#define TOOLBAR_HELP 6
|
||||
#define TOOLBAR_LOAD_FILE 101
|
||||
#define TOOLBAR_SAVE_FILE 102
|
||||
#define TOOLBAR_NEW 103
|
||||
#define TOOLBAR_TREE 105
|
||||
#define TOOLBAR_HELP 106
|
||||
|
||||
// Formatting tools
|
||||
#define TOOLBAR_FORMAT_HORIZ 10
|
||||
#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11
|
||||
#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12
|
||||
#define TOOLBAR_FORMAT_VERT 13
|
||||
#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14
|
||||
#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15
|
||||
#define TOOLBAR_FORMAT_HORIZ 110
|
||||
#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 111
|
||||
#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 112
|
||||
#define TOOLBAR_FORMAT_VERT 113
|
||||
#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 114
|
||||
#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 115
|
||||
|
||||
#define TOOLBAR_TO_FRONT 16
|
||||
#define TOOLBAR_TO_BACK 17
|
||||
#define TOOLBAR_COPY_SIZE 18
|
||||
#define TOOLBAR_TO_FRONT 116
|
||||
#define TOOLBAR_TO_BACK 117
|
||||
#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
|
||||
{
|
||||
public:
|
||||
wxResourceTreeData(wxItemResource *resource) { m_resource = resource; }
|
||||
|
||||
|
||||
wxItemResource *GetResource() const { return m_resource; }
|
||||
|
||||
|
||||
private:
|
||||
wxItemResource *m_resource;
|
||||
};
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "symbtabl.h"
|
||||
|
||||
wxResourceSymbolTable::wxResourceSymbolTable():
|
||||
m_hashTable(wxKEY_STRING)
|
||||
m_hashTable(wxKEY_STRING)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,70 +48,70 @@ bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
|
||||
wxFile file;
|
||||
if (!wxFileExists(filename))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (!file.Open(filename, wxFile::read))
|
||||
return FALSE;
|
||||
|
||||
|
||||
off_t len = file.Length();
|
||||
if (len == -1)
|
||||
return FALSE;
|
||||
|
||||
|
||||
Clear();
|
||||
AddStandardSymbols();
|
||||
|
||||
|
||||
wxString str;
|
||||
char* p = str.GetWriteBuf(len + 1);
|
||||
|
||||
|
||||
if (file.Read(p, len) == wxFile::fd_invalid)
|
||||
{
|
||||
str.UngetWriteBuf();
|
||||
return FALSE;
|
||||
}
|
||||
str.UngetWriteBuf();
|
||||
|
||||
|
||||
// Look for #define occurrences
|
||||
int pos = str.Find("#define");
|
||||
while (pos != -1)
|
||||
{
|
||||
size_t len = str.Length();
|
||||
|
||||
|
||||
size_t i = pos + 8;
|
||||
|
||||
|
||||
// Eat whitespace until symbol
|
||||
while ((str[i] == ' ' || str[i] == '\t') && (i < len))
|
||||
i ++;
|
||||
|
||||
|
||||
size_t start = i;
|
||||
|
||||
|
||||
// Eat symbol
|
||||
while (str[i] != ' ' && str[i] != '\t' && (i < len))
|
||||
i ++;
|
||||
size_t end = i-1;
|
||||
|
||||
|
||||
wxString symbol(str.Mid(start, (end - start + 1)));
|
||||
|
||||
|
||||
// Eat whitespace until number
|
||||
while ((str[i] == ' ' || str[i] == '\t') && (i < len))
|
||||
i ++;
|
||||
|
||||
|
||||
size_t startNum = i;
|
||||
|
||||
|
||||
// Eat number
|
||||
while (str[i] != ' ' && str[i] != '\t' && str[i] != '\n' && (i < len))
|
||||
i ++;
|
||||
|
||||
|
||||
size_t endNum = i-1;
|
||||
|
||||
|
||||
wxString numStr(str.Mid(startNum, (endNum - startNum + 1)));
|
||||
|
||||
|
||||
int id = atol(numStr);
|
||||
|
||||
|
||||
AddSymbol(symbol, id);
|
||||
|
||||
|
||||
str = str.Right(len - i);
|
||||
pos = str.Find("#define");
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -120,30 +120,30 @@ bool wxResourceSymbolTable::WriteIncludeFile(const wxString& filename)
|
||||
wxFile file;
|
||||
if (!file.Open(filename, wxFile::write))
|
||||
return FALSE;
|
||||
|
||||
|
||||
wxString fileOnly(wxFileNameFromPath(filename));
|
||||
wxString line;
|
||||
line.Printf("/*\n * %s\n * Window identifiers file written by Dialog Editor\n */\n\n",
|
||||
(const char*) fileOnly);
|
||||
|
||||
|
||||
file.Write(line, line.Length());
|
||||
|
||||
|
||||
m_hashTable.BeginFind();
|
||||
|
||||
|
||||
wxNode* node = m_hashTable.Next();
|
||||
while (node)
|
||||
{
|
||||
const char* str = node->GetKeyString();
|
||||
int id = (int) node->Data() ;
|
||||
|
||||
|
||||
if (!IsStandardSymbol(str))
|
||||
{
|
||||
wxString line;
|
||||
line.Printf("#define %s %ld\n", str, id);
|
||||
|
||||
|
||||
file.Write(line, line.Length());
|
||||
}
|
||||
|
||||
|
||||
node = m_hashTable.Next();
|
||||
}
|
||||
return TRUE;
|
||||
@@ -177,14 +177,14 @@ bool wxResourceSymbolTable::RemoveSymbol(int id)
|
||||
wxString wxResourceSymbolTable::GetSymbolForId(int id)
|
||||
{
|
||||
m_hashTable.BeginFind();
|
||||
|
||||
|
||||
wxNode* node = m_hashTable.Next();
|
||||
while (node)
|
||||
{
|
||||
const char* str = node->GetKeyString();
|
||||
if (str && ( ((int) node->Data()) == id) )
|
||||
return wxString(str);
|
||||
|
||||
|
||||
node = m_hashTable.Next();
|
||||
}
|
||||
return wxString("");
|
||||
@@ -203,13 +203,13 @@ bool wxResourceSymbolTable::SymbolExists(const wxString& symbol) const
|
||||
bool wxResourceSymbolTable::IdExists(int id)
|
||||
{
|
||||
m_hashTable.BeginFind();
|
||||
|
||||
|
||||
wxNode* node = m_hashTable.Next();
|
||||
while (node)
|
||||
{
|
||||
if ( (((int) node->Data()) == id) )
|
||||
return TRUE;
|
||||
|
||||
|
||||
node = m_hashTable.Next();
|
||||
}
|
||||
return FALSE;
|
||||
@@ -218,19 +218,19 @@ bool wxResourceSymbolTable::IdExists(int id)
|
||||
int wxResourceSymbolTable::FindHighestId()
|
||||
{
|
||||
int highest = 0;
|
||||
|
||||
|
||||
m_hashTable.BeginFind();
|
||||
|
||||
|
||||
wxNode* node = m_hashTable.Next();
|
||||
while (node)
|
||||
{
|
||||
int id = ((int) node->Data());
|
||||
if (id > highest)
|
||||
highest = id;
|
||||
|
||||
|
||||
node = m_hashTable.Next();
|
||||
}
|
||||
|
||||
|
||||
// Make sure we don't clash with future standard wxWindows ids
|
||||
if (highest <= wxID_HIGHEST)
|
||||
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
|
||||
{
|
||||
@@ -256,7 +256,7 @@ static wxStandardSymbolStruct sg_StandardSymbols[] =
|
||||
{ "wxID_STATIC", wxID_STATIC },
|
||||
{ "wxID_YES", wxID_YES },
|
||||
{ "wxID_NO", wxID_NO },
|
||||
|
||||
|
||||
{ "wxID_OPEN", wxID_OPEN },
|
||||
{ "wxID_CLOSE", wxID_CLOSE },
|
||||
{ "wxID_NEW", wxID_NEW },
|
||||
@@ -274,14 +274,14 @@ static wxStandardSymbolStruct sg_StandardSymbols[] =
|
||||
{ "wxID_HELP_COMMANDS", wxID_HELP_COMMANDS },
|
||||
{ "wxID_HELP_PROCEDURES", wxID_HELP_PROCEDURES },
|
||||
{ "wxID_HELP_CONTEXT", wxID_HELP_CONTEXT },
|
||||
|
||||
|
||||
{ "wxID_CUT", wxID_CUT },
|
||||
{ "wxID_COPY", wxID_COPY },
|
||||
{ "wxID_PASTE", wxID_PASTE },
|
||||
{ "wxID_CLEAR", wxID_CLEAR },
|
||||
{ "wxID_FIND", wxID_FIND },
|
||||
{ "wxID_DUPLICATE", wxID_DUPLICATE },
|
||||
|
||||
|
||||
{ "wxID_FILE1", wxID_FILE1 },
|
||||
{ "wxID_FILE2", wxID_FILE2 },
|
||||
{ "wxID_FILE3", wxID_FILE3 },
|
||||
@@ -291,7 +291,7 @@ static wxStandardSymbolStruct sg_StandardSymbols[] =
|
||||
{ "wxID_FILE7", wxID_FILE7 },
|
||||
{ "wxID_FILE8", wxID_FILE8 },
|
||||
{ "wxID_FILE9", wxID_FILE9 }
|
||||
|
||||
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
m_hashTable.BeginFind();
|
||||
|
||||
|
||||
wxNode* node = m_hashTable.Next();
|
||||
while (node)
|
||||
{
|
||||
const char* str = node->GetKeyString();
|
||||
|
||||
|
||||
comboBox->Append(str);
|
||||
node = m_hashTable.Next();
|
||||
}
|
||||
|
@@ -21,8 +21,8 @@ class wxResourceSymbolTable: public wxObject
|
||||
public:
|
||||
wxResourceSymbolTable();
|
||||
~wxResourceSymbolTable();
|
||||
|
||||
// Operations
|
||||
|
||||
// Operations
|
||||
bool ReadIncludeFile(const wxString& filename);
|
||||
bool WriteIncludeFile(const wxString& filename);
|
||||
void Clear();
|
||||
@@ -31,22 +31,22 @@ public:
|
||||
bool RemoveSymbol(int id);
|
||||
void AddStandardSymbols();
|
||||
bool FillComboBox(wxComboBox* comboBox);
|
||||
|
||||
// Accessors
|
||||
|
||||
// Accessors
|
||||
wxString GetSymbolForId(int id);
|
||||
int GetIdForSymbol(const wxString& symbol);
|
||||
bool SymbolExists(const wxString& symbol) const;
|
||||
bool IdExists(int id) ;
|
||||
bool IsStandardSymbol(const wxString& symbol) const;
|
||||
int FindHighestId() ;
|
||||
|
||||
// Implementation
|
||||
|
||||
// Member variables
|
||||
|
||||
// Implementation
|
||||
|
||||
// Member variables
|
||||
protected:
|
||||
wxHashTable m_hashTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _SYMBTABL_H_
|
||||
// _SYMBTABL_H_
|
||||
|
||||
|
@@ -28,9 +28,9 @@ public:
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
~wxDialogEditorPropertyListFrame();
|
||||
|
||||
|
||||
wxPropertyInfo* GetInfo() const { return m_propInfo; }
|
||||
|
||||
|
||||
private:
|
||||
wxPropertySheet* m_propSheet;
|
||||
wxPropertyValidatorRegistry m_registry;
|
||||
@@ -41,17 +41,17 @@ private:
|
||||
// feedback.
|
||||
class wxResourcePropertyListView: public wxPropertyListView
|
||||
{
|
||||
public:
|
||||
wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT):
|
||||
wxPropertyListView(propPanel, flags)
|
||||
{
|
||||
m_propertyInfo = info;
|
||||
}
|
||||
void OnPropertyChanged(wxProperty *property);
|
||||
bool OnClose(void);
|
||||
|
||||
wxPropertyInfo* m_propertyInfo;
|
||||
|
||||
public:
|
||||
wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT):
|
||||
wxPropertyListView(propPanel, flags)
|
||||
{
|
||||
m_propertyInfo = info;
|
||||
}
|
||||
void OnPropertyChanged(wxProperty *property);
|
||||
bool OnClose(void);
|
||||
|
||||
wxPropertyInfo* m_propertyInfo;
|
||||
|
||||
};
|
||||
|
||||
// Generic class for relating an object to a collection of properties.
|
||||
@@ -61,294 +61,294 @@ class wxResourcePropertyListView: public wxPropertyListView
|
||||
class wxPropertyInfo: public wxObject
|
||||
{
|
||||
friend class wxDialogEditorPropertyListFrame;
|
||||
protected:
|
||||
static wxWindow *sm_propertyWindow;
|
||||
wxPropertyInfo(void)
|
||||
{
|
||||
}
|
||||
~wxPropertyInfo(void)
|
||||
{
|
||||
}
|
||||
public:
|
||||
virtual wxProperty *GetProperty(wxString& propName) = 0;
|
||||
virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
|
||||
virtual void GetPropertyNames(wxStringList& names) = 0;
|
||||
virtual bool Edit(wxWindow *parent, const wxString& title);
|
||||
static void CloseWindow(); // Close the current window if open.
|
||||
protected:
|
||||
static wxWindow *sm_propertyWindow;
|
||||
wxPropertyInfo(void)
|
||||
{
|
||||
}
|
||||
~wxPropertyInfo(void)
|
||||
{
|
||||
}
|
||||
public:
|
||||
virtual wxProperty *GetProperty(wxString& propName) = 0;
|
||||
virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
|
||||
virtual void GetPropertyNames(wxStringList& names) = 0;
|
||||
virtual bool Edit(wxWindow *parent, const wxString& title);
|
||||
static void CloseWindow(); // Close the current window if open.
|
||||
};
|
||||
|
||||
// For all windows
|
||||
class wxWindowPropertyInfo: public wxPropertyInfo
|
||||
{
|
||||
public:
|
||||
wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
|
||||
~wxWindowPropertyInfo(void);
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
|
||||
inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; }
|
||||
|
||||
inline void SetResource(wxItemResource *res) { m_propertyResource = res; }
|
||||
|
||||
// Helper functions for font properties
|
||||
|
||||
wxProperty *GetFontProperty(wxString& name, wxFont *font);
|
||||
wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont);
|
||||
|
||||
// Fill in the wxItemResource members to mirror the current window settings
|
||||
virtual bool InstantiateResource(wxItemResource *resource);
|
||||
|
||||
// Set the window style
|
||||
void SetWindowStyle(wxWindow* win, long style, bool set);
|
||||
|
||||
wxWindow* GetWindow() const { return m_propertyWindow; }
|
||||
wxItemResource* GetResource() const { return m_propertyResource; }
|
||||
|
||||
protected:
|
||||
wxWindow* m_propertyWindow;
|
||||
wxItemResource* m_propertyResource;
|
||||
public:
|
||||
wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
|
||||
~wxWindowPropertyInfo(void);
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
|
||||
inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; }
|
||||
|
||||
inline void SetResource(wxItemResource *res) { m_propertyResource = res; }
|
||||
|
||||
// Helper functions for font properties
|
||||
|
||||
wxProperty *GetFontProperty(wxString& name, wxFont *font);
|
||||
wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont);
|
||||
|
||||
// Fill in the wxItemResource members to mirror the current window settings
|
||||
virtual bool InstantiateResource(wxItemResource *resource);
|
||||
|
||||
// Set the window style
|
||||
void SetWindowStyle(wxWindow* win, long style, bool set);
|
||||
|
||||
wxWindow* GetWindow() const { return m_propertyWindow; }
|
||||
wxItemResource* GetResource() const { return m_propertyResource; }
|
||||
|
||||
protected:
|
||||
wxWindow* m_propertyWindow;
|
||||
wxItemResource* m_propertyResource;
|
||||
};
|
||||
|
||||
// For panel items
|
||||
class wxItemPropertyInfo: public wxWindowPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxWindowPropertyInfo(win, res) {}
|
||||
~wxItemPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxWindowPropertyInfo(win, res) {}
|
||||
~wxItemPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For buttons
|
||||
class wxButtonPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxButtonPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxButtonPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For bitmap buttons
|
||||
class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxButtonPropertyInfo(win, res) { }
|
||||
~wxBitmapButtonPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxButtonPropertyInfo(win, res) { }
|
||||
~wxBitmapButtonPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For static text controls
|
||||
class wxStaticTextPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxStaticTextPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxStaticTextPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For static bitmap controls
|
||||
class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxStaticBitmapPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxStaticBitmapPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For text/multitext items
|
||||
class wxTextPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxTextPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxTextPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For list boxes
|
||||
class wxListBoxPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxListBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxListBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For choice items
|
||||
class wxChoicePropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxChoicePropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxChoicePropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For choice items
|
||||
class wxComboBoxPropertyInfo: public wxChoicePropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxChoicePropertyInfo(win, res) {}
|
||||
~wxComboBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxChoicePropertyInfo(win, res) {}
|
||||
~wxComboBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For radiobox items
|
||||
class wxRadioBoxPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxRadioBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxRadioBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For groupbox items
|
||||
class wxGroupBoxPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxGroupBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxGroupBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For checkbox items
|
||||
class wxCheckBoxPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxCheckBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxCheckBoxPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For radiobutton items
|
||||
class wxRadioButtonPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxRadioButtonPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxRadioButtonPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For gauge items
|
||||
class wxGaugePropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxGaugePropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxGaugePropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For scrollbar items
|
||||
class wxScrollBarPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxScrollBarPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxScrollBarPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For slider items
|
||||
class wxSliderPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxSliderPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
protected:
|
||||
public:
|
||||
wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) {}
|
||||
~wxSliderPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
// For panels
|
||||
class wxPanelPropertyInfo: public wxWindowPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxWindowPropertyInfo(win, res) {}
|
||||
~wxPanelPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
|
||||
// Convert this dialog, and its children, to or from dialog units
|
||||
void ConvertDialogUnits(bool toDialogUnits);
|
||||
protected:
|
||||
public:
|
||||
wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxWindowPropertyInfo(win, res) {}
|
||||
~wxPanelPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
|
||||
// Convert this dialog, and its children, to or from dialog units
|
||||
void ConvertDialogUnits(bool toDialogUnits);
|
||||
};
|
||||
|
||||
int wxStringToFontWeight(wxString& val);
|
||||
@@ -356,39 +356,39 @@ int wxStringToFontStyle(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
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator)
|
||||
protected:
|
||||
public:
|
||||
wxResourceSymbolValidator(long flags = 0);
|
||||
|
||||
~wxResourceSymbolValidator(void);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transferance from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the edit (...) button is pressed.
|
||||
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator)
|
||||
protected:
|
||||
public:
|
||||
wxResourceSymbolValidator(long flags = 0);
|
||||
|
||||
~wxResourceSymbolValidator(void);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transferance from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the edit (...) button is pressed.
|
||||
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
|
||||
{
|
||||
@@ -396,31 +396,31 @@ public:
|
||||
wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
|
||||
|
||||
|
||||
void Init();
|
||||
|
||||
|
||||
inline void SetSymbol(const wxString& symbol) { m_symbolName = symbol; }
|
||||
inline void SetId(long id) { m_symbolId = id; }
|
||||
|
||||
|
||||
inline wxString GetSymbol() const { return m_symbolName; }
|
||||
inline long GetId() const { return m_symbolId; }
|
||||
|
||||
|
||||
bool CheckValues();
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnComboBoxSelect(wxCommandEvent& event);
|
||||
void OnSymbolNameUpdate(wxCommandEvent& event);
|
||||
|
||||
|
||||
protected:
|
||||
wxString m_symbolName;
|
||||
long m_symbolId;
|
||||
wxComboBox* m_nameCtrl;
|
||||
wxTextCtrl* m_idCtrl;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define ID_SYMBOLNAME_COMBOBOX 100
|
||||
#define ID_SYMBOLID_TEXTCTRL 101
|
||||
|
||||
#endif
|
||||
// _WINPROP_H_
|
||||
// _WINPROP_H_
|
||||
|
@@ -32,244 +32,244 @@
|
||||
#include "winstyle.h"
|
||||
|
||||
/*
|
||||
* Styles
|
||||
*/
|
||||
* Styles
|
||||
*/
|
||||
|
||||
/* wxListBox */
|
||||
/* wxListBox */
|
||||
static wxWindowStylePair g_WindowStylesListBox[] = {
|
||||
{ "wxLB_SINGLE", wxLB_SINGLE },
|
||||
{ "wxLB_MULTIPLE", wxLB_MULTIPLE },
|
||||
{ "wxLB_EXTENDED", wxLB_EXTENDED },
|
||||
{ "wxLB_NEEDED_SB", wxLB_NEEDED_SB },
|
||||
{ "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB },
|
||||
{ "wxLB_SORT", wxLB_SORT },
|
||||
{ "wxLB_OWNERDRAW", wxLB_OWNERDRAW },
|
||||
{ "wxLB_HSCROLL", wxLB_HSCROLL }
|
||||
{ "wxLB_SINGLE", wxLB_SINGLE },
|
||||
{ "wxLB_MULTIPLE", wxLB_MULTIPLE },
|
||||
{ "wxLB_EXTENDED", wxLB_EXTENDED },
|
||||
{ "wxLB_NEEDED_SB", wxLB_NEEDED_SB },
|
||||
{ "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB },
|
||||
{ "wxLB_SORT", wxLB_SORT },
|
||||
{ "wxLB_OWNERDRAW", wxLB_OWNERDRAW },
|
||||
{ "wxLB_HSCROLL", wxLB_HSCROLL }
|
||||
};
|
||||
|
||||
int g_WindowStylesListBoxCount = sizeof(g_WindowStylesListBox)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxComboxBox */
|
||||
|
||||
/* wxComboxBox */
|
||||
static wxWindowStylePair g_WindowStylesComboBox[] = {
|
||||
{ "wxCB_SIMPLE", wxCB_SIMPLE },
|
||||
{ "wxCB_DROPDOWN", wxCB_DROPDOWN },
|
||||
{ "wxCB_READONLY", wxCB_READONLY },
|
||||
{ "wxCB_SORT", wxCB_SORT }
|
||||
{ "wxCB_SIMPLE", wxCB_SIMPLE },
|
||||
{ "wxCB_DROPDOWN", wxCB_DROPDOWN },
|
||||
{ "wxCB_READONLY", wxCB_READONLY },
|
||||
{ "wxCB_SORT", wxCB_SORT }
|
||||
};
|
||||
|
||||
int g_WindowStylesComboBoxCount = sizeof(g_WindowStylesComboBox)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
#if 0
|
||||
/* wxChoice */
|
||||
/* wxChoice */
|
||||
static wxWindowStylePair g_WindowStylesChoice[] = {
|
||||
};
|
||||
|
||||
int g_WindowStylesChoiceCount = sizeof(g_WindowStylesChoice)/sizeof(wxWindowStylePair) ;
|
||||
#endif
|
||||
|
||||
/* wxGauge */
|
||||
|
||||
/* wxGauge */
|
||||
static wxWindowStylePair g_WindowStylesGauge[] = {
|
||||
{ "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR },
|
||||
{ "wxGA_HORIZONTAL", wxGA_HORIZONTAL },
|
||||
{ "wxGA_VERTICAL", wxGA_VERTICAL }
|
||||
{ "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR },
|
||||
{ "wxGA_HORIZONTAL", wxGA_HORIZONTAL },
|
||||
{ "wxGA_VERTICAL", wxGA_VERTICAL }
|
||||
};
|
||||
|
||||
int g_WindowStylesGaugeCount = sizeof(g_WindowStylesGauge)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxTextCtrl */
|
||||
/* wxTextCtrl */
|
||||
static wxWindowStylePair g_WindowStylesTextCtrl[] = {
|
||||
// { "wxPASSWORD", wxPASSWORD},
|
||||
// { "wxPROCESS_ENTER", wxPROCESS_ENTER},
|
||||
{ "wxTE_PASSWORD", wxTE_PASSWORD},
|
||||
{ "wxTE_READONLY", wxTE_READONLY},
|
||||
{ "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER},
|
||||
{ "wxTE_MULTILINE", wxTE_MULTILINE}
|
||||
// { "wxPASSWORD", wxPASSWORD},
|
||||
// { "wxPROCESS_ENTER", wxPROCESS_ENTER},
|
||||
{ "wxTE_PASSWORD", wxTE_PASSWORD},
|
||||
{ "wxTE_READONLY", wxTE_READONLY},
|
||||
{ "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER},
|
||||
{ "wxTE_MULTILINE", wxTE_MULTILINE}
|
||||
};
|
||||
|
||||
int g_WindowStylesTextCtrlCount = sizeof(g_WindowStylesTextCtrl)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxRadioButton */
|
||||
/* wxRadioButton */
|
||||
static wxWindowStylePair g_WindowStylesRadioButton[] = {
|
||||
{ "wxRB_GROUP", wxRB_GROUP }
|
||||
{ "wxRB_GROUP", wxRB_GROUP }
|
||||
};
|
||||
|
||||
int g_WindowStylesRadioButtonCount = sizeof(g_WindowStylesRadioButton)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxRadioBox */
|
||||
/* wxRadioBox */
|
||||
static wxWindowStylePair g_WindowStylesRadioBox[] = {
|
||||
{ "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS },
|
||||
{ "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS }
|
||||
/*
|
||||
,
|
||||
{ "wxRA_HORIZONTAL", wxRA_HORIZONTAL },
|
||||
{ "wxRA_VERTICAL", wxRA_VERTICAL }
|
||||
*/
|
||||
{ "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS },
|
||||
{ "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS }
|
||||
/*
|
||||
,
|
||||
{ "wxRA_HORIZONTAL", wxRA_HORIZONTAL },
|
||||
{ "wxRA_VERTICAL", wxRA_VERTICAL }
|
||||
*/
|
||||
};
|
||||
|
||||
int g_WindowStylesRadioBoxCount = sizeof(g_WindowStylesRadioBox)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxSlider */
|
||||
/* wxSlider */
|
||||
static wxWindowStylePair g_WindowStylesSlider[] = {
|
||||
{ "wxSL_HORIZONTAL", wxSL_HORIZONTAL },
|
||||
{ "wxSL_VERTICAL", wxSL_VERTICAL },
|
||||
{ "wxSL_AUTOTICKS", wxSL_AUTOTICKS },
|
||||
{ "wxSL_LABELS", wxSL_LABELS },
|
||||
{ "wxSL_LEFT", wxSL_LEFT },
|
||||
{ "wxSL_TOP", wxSL_TOP },
|
||||
{ "wxSL_RIGHT", wxSL_RIGHT },
|
||||
{ "wxSL_BOTTOM", wxSL_BOTTOM },
|
||||
{ "wxSL_BOTH", wxSL_BOTH },
|
||||
{ "wxSL_SELRANGE", wxSL_SELRANGE }
|
||||
{ "wxSL_HORIZONTAL", wxSL_HORIZONTAL },
|
||||
{ "wxSL_VERTICAL", wxSL_VERTICAL },
|
||||
{ "wxSL_AUTOTICKS", wxSL_AUTOTICKS },
|
||||
{ "wxSL_LABELS", wxSL_LABELS },
|
||||
{ "wxSL_LEFT", wxSL_LEFT },
|
||||
{ "wxSL_TOP", wxSL_TOP },
|
||||
{ "wxSL_RIGHT", wxSL_RIGHT },
|
||||
{ "wxSL_BOTTOM", wxSL_BOTTOM },
|
||||
{ "wxSL_BOTH", wxSL_BOTH },
|
||||
{ "wxSL_SELRANGE", wxSL_SELRANGE }
|
||||
};
|
||||
|
||||
int g_WindowStylesSliderCount = sizeof(g_WindowStylesSlider)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxScrollBar */
|
||||
/* wxScrollBar */
|
||||
static wxWindowStylePair g_WindowStylesScrollBar[] = {
|
||||
{ "wxSB_HORIZONTAL", wxSB_HORIZONTAL },
|
||||
{ "wxSB_VERTICAL", wxSB_VERTICAL }
|
||||
{ "wxSB_HORIZONTAL", wxSB_HORIZONTAL },
|
||||
{ "wxSB_VERTICAL", wxSB_VERTICAL }
|
||||
};
|
||||
|
||||
int g_WindowStylesScrollBarCount = sizeof(g_WindowStylesScrollBar)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxButton */
|
||||
/* wxButton */
|
||||
static wxWindowStylePair g_WindowStylesButton[] = {
|
||||
{ "wxBU_AUTODRAW", wxBU_AUTODRAW },
|
||||
{ "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW }
|
||||
{ "wxBU_AUTODRAW", wxBU_AUTODRAW },
|
||||
{ "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW }
|
||||
};
|
||||
|
||||
int g_WindowStylesButtonCount = sizeof(g_WindowStylesButton)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxTreeCtrl */
|
||||
/* wxTreeCtrl */
|
||||
static wxWindowStylePair g_WindowStylesTreeCtrl[] = {
|
||||
{ "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS },
|
||||
{ "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS },
|
||||
{ "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT }
|
||||
{ "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS },
|
||||
{ "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS },
|
||||
{ "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT }
|
||||
};
|
||||
|
||||
int g_WindowStylesTreeCtrlCount = sizeof(g_WindowStylesTreeCtrl)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxListCtrl */
|
||||
/* wxListCtrl */
|
||||
static wxWindowStylePair g_WindowStylesListCtrl[] = {
|
||||
{ "wxLC_ICON", wxLC_ICON },
|
||||
{ "wxLC_SMALL_ICON", wxLC_SMALL_ICON },
|
||||
{ "wxLC_LIST", wxLC_LIST },
|
||||
{ "wxLC_REPORT", wxLC_REPORT },
|
||||
{ "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP },
|
||||
{ "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT },
|
||||
{ "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE },
|
||||
{ "wxLC_USER_TEXT", wxLC_USER_TEXT },
|
||||
{ "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS },
|
||||
{ "wxLC_NO_HEADER", wxLC_NO_HEADER },
|
||||
{ "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER },
|
||||
{ "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL },
|
||||
{ "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING },
|
||||
{ "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING }
|
||||
{ "wxLC_ICON", wxLC_ICON },
|
||||
{ "wxLC_SMALL_ICON", wxLC_SMALL_ICON },
|
||||
{ "wxLC_LIST", wxLC_LIST },
|
||||
{ "wxLC_REPORT", wxLC_REPORT },
|
||||
{ "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP },
|
||||
{ "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT },
|
||||
{ "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE },
|
||||
{ "wxLC_USER_TEXT", wxLC_USER_TEXT },
|
||||
{ "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS },
|
||||
{ "wxLC_NO_HEADER", wxLC_NO_HEADER },
|
||||
{ "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER },
|
||||
{ "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL },
|
||||
{ "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING },
|
||||
{ "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING }
|
||||
};
|
||||
|
||||
int g_WindowStylesListCtrlCount = sizeof(g_WindowStylesListCtrl)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxSpinButton */
|
||||
/* wxSpinButton */
|
||||
static wxWindowStylePair g_WindowStylesSpinButton[] = {
|
||||
{ "wxSP_VERTICAL", wxSP_VERTICAL},
|
||||
{ "wxSP_HORIZONTAL", wxSP_HORIZONTAL},
|
||||
{ "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS},
|
||||
{ "wxSP_WRAP", wxSP_WRAP}
|
||||
{ "wxSP_VERTICAL", wxSP_VERTICAL},
|
||||
{ "wxSP_HORIZONTAL", wxSP_HORIZONTAL},
|
||||
{ "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS},
|
||||
{ "wxSP_WRAP", wxSP_WRAP}
|
||||
};
|
||||
|
||||
int g_WindowStylesSpinButtonCount = sizeof(g_WindowStylesSpinButton)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxSplitterWindow */
|
||||
/* wxSplitterWindow */
|
||||
static wxWindowStylePair g_WindowStylesSplitterWindow[] = {
|
||||
{ "wxSP_NOBORDER", wxSP_NOBORDER},
|
||||
{ "wxSP_3D", wxSP_3D},
|
||||
{ "wxSP_BORDER", wxSP_BORDER}
|
||||
{ "wxSP_NOBORDER", wxSP_NOBORDER},
|
||||
{ "wxSP_3D", wxSP_3D},
|
||||
{ "wxSP_BORDER", wxSP_BORDER}
|
||||
};
|
||||
|
||||
int g_WindowStylesSplitterWindowCount = sizeof(g_WindowStylesSplitterWindow)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxTabCtrl */
|
||||
/* wxTabCtrl */
|
||||
static wxWindowStylePair g_WindowStylesTabCtrl[] = {
|
||||
{ "wxTC_MULTILINE", wxTC_MULTILINE},
|
||||
{ "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY},
|
||||
{ "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH},
|
||||
{ "wxTC_OWNERDRAW", wxTC_OWNERDRAW}
|
||||
{ "wxTC_MULTILINE", wxTC_MULTILINE},
|
||||
{ "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY},
|
||||
{ "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH},
|
||||
{ "wxTC_OWNERDRAW", wxTC_OWNERDRAW}
|
||||
};
|
||||
|
||||
int g_WindowStylesTabCtrlCount = sizeof(g_WindowStylesTabCtrl)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxStatusBar95 */
|
||||
/* wxStatusBar95 */
|
||||
static wxWindowStylePair g_WindowStylesStatusBar[] = {
|
||||
{ "wxST_SIZEGRIP", wxST_SIZEGRIP}
|
||||
{ "wxST_SIZEGRIP", wxST_SIZEGRIP}
|
||||
};
|
||||
|
||||
int g_WindowStylesStatusBarCount = sizeof(g_WindowStylesStatusBar)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxControl */
|
||||
/* wxControl */
|
||||
static wxWindowStylePair g_WindowStylesControl[] = {
|
||||
{ "wxFIXED_LENGTH", wxFIXED_LENGTH},
|
||||
{ "wxALIGN_LEFT", wxALIGN_LEFT},
|
||||
{ "wxALIGN_CENTRE", wxALIGN_CENTRE},
|
||||
{ "wxALIGN_RIGHT", wxALIGN_RIGHT},
|
||||
{ "wxCOLOURED", wxCOLOURED}
|
||||
{ "wxFIXED_LENGTH", wxFIXED_LENGTH},
|
||||
{ "wxALIGN_LEFT", wxALIGN_LEFT},
|
||||
{ "wxALIGN_CENTRE", wxALIGN_CENTRE},
|
||||
{ "wxALIGN_RIGHT", wxALIGN_RIGHT},
|
||||
{ "wxCOLOURED", wxCOLOURED}
|
||||
};
|
||||
|
||||
int g_WindowStylesControlCount = sizeof(g_WindowStylesControl)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* wxToolBar */
|
||||
|
||||
/* wxToolBar */
|
||||
static wxWindowStylePair g_WindowStylesToolBar[] = {
|
||||
{ "wxTB_3DBUTTONS", wxTB_3DBUTTONS},
|
||||
{ "wxTB_HORIZONTAL", wxTB_HORIZONTAL},
|
||||
{ "wxTB_VERTICAL", wxTB_VERTICAL},
|
||||
{ "wxTB_FLAT", wxTB_FLAT}
|
||||
{ "wxTB_3DBUTTONS", wxTB_3DBUTTONS},
|
||||
{ "wxTB_HORIZONTAL", wxTB_HORIZONTAL},
|
||||
{ "wxTB_VERTICAL", wxTB_VERTICAL},
|
||||
{ "wxTB_FLAT", wxTB_FLAT}
|
||||
};
|
||||
|
||||
int g_WindowStylesToolBarCount = sizeof(g_WindowStylesToolBar)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* Frame/dialog */
|
||||
/* Frame/dialog */
|
||||
static wxWindowStylePair g_WindowStylesDialog[] = {
|
||||
{ "wxSTAY_ON_TOP", wxSTAY_ON_TOP},
|
||||
{ "wxCAPTION", wxCAPTION},
|
||||
{ "wxICONIZE", wxICONIZE},
|
||||
{ "wxMINIMIZE", wxICONIZE},
|
||||
{ "wxMAXIMIZE", wxMAXIMIZE},
|
||||
{ "wxTHICK_FRAME", wxTHICK_FRAME},
|
||||
{ "wxRESIZE_BORDER", wxRESIZE_BORDER},
|
||||
{ "wxSYSTEM_MENU", wxSYSTEM_MENU},
|
||||
{ "wxMINIMIZE_BOX", wxMINIMIZE_BOX},
|
||||
{ "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX},
|
||||
{ "wxRESIZE_BOX", wxRESIZE_BOX}
|
||||
{ "wxSTAY_ON_TOP", wxSTAY_ON_TOP},
|
||||
{ "wxCAPTION", wxCAPTION},
|
||||
{ "wxICONIZE", wxICONIZE},
|
||||
{ "wxMINIMIZE", wxICONIZE},
|
||||
{ "wxMAXIMIZE", wxMAXIMIZE},
|
||||
{ "wxTHICK_FRAME", wxTHICK_FRAME},
|
||||
{ "wxRESIZE_BORDER", wxRESIZE_BORDER},
|
||||
{ "wxSYSTEM_MENU", wxSYSTEM_MENU},
|
||||
{ "wxMINIMIZE_BOX", wxMINIMIZE_BOX},
|
||||
{ "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX},
|
||||
{ "wxRESIZE_BOX", wxRESIZE_BOX}
|
||||
};
|
||||
|
||||
int g_WindowStylesDialogCount = sizeof(g_WindowStylesDialog)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/* Generic */
|
||||
/* Generic */
|
||||
static wxWindowStylePair g_WindowStylesWindow[] = {
|
||||
{ "wxBORDER", wxBORDER},
|
||||
{ "wxDOUBLE_BORDER", wxDOUBLE_BORDER},
|
||||
{ "wxSUNKEN_BORDER", wxSUNKEN_BORDER},
|
||||
{ "wxRAISED_BORDER", wxRAISED_BORDER},
|
||||
{ "wxSIMPLE_BORDER", wxSIMPLE_BORDER},
|
||||
{ "wxSTATIC_BORDER", wxSTATIC_BORDER},
|
||||
{ "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW},
|
||||
{ "wxNO_BORDER", wxNO_BORDER},
|
||||
{ "wxCLIP_CHILDREN", wxCLIP_CHILDREN}
|
||||
|
||||
/* Would be duplicated with e.g. wxLB_HSCROLL
|
||||
{ "wxVSCROLL", wxVSCROLL },
|
||||
{ "wxHSCROLL", wxHSCROLL }
|
||||
*/
|
||||
{ "wxBORDER", wxBORDER},
|
||||
{ "wxDOUBLE_BORDER", wxDOUBLE_BORDER},
|
||||
{ "wxSUNKEN_BORDER", wxSUNKEN_BORDER},
|
||||
{ "wxRAISED_BORDER", wxRAISED_BORDER},
|
||||
{ "wxSIMPLE_BORDER", wxSIMPLE_BORDER},
|
||||
{ "wxSTATIC_BORDER", wxSTATIC_BORDER},
|
||||
{ "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW},
|
||||
{ "wxNO_BORDER", wxNO_BORDER},
|
||||
{ "wxCLIP_CHILDREN", wxCLIP_CHILDREN}
|
||||
|
||||
/* Would be duplicated with e.g. wxLB_HSCROLL
|
||||
{ "wxVSCROLL", wxVSCROLL },
|
||||
{ "wxHSCROLL", wxHSCROLL }
|
||||
*/
|
||||
};
|
||||
|
||||
int g_WindowStylesWindowCount = sizeof(g_WindowStylesWindow)/sizeof(wxWindowStylePair) ;
|
||||
|
||||
/*
|
||||
* A table holding all class style objects
|
||||
*/
|
||||
* A table holding all class style objects
|
||||
*/
|
||||
|
||||
|
||||
wxWindowStyleTable::wxWindowStyleTable():
|
||||
m_classes(wxKEY_STRING)
|
||||
m_classes(wxKEY_STRING)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ void wxWindowStyleTable::Init()
|
||||
AddStyles("wxSlider", g_WindowStylesSliderCount, g_WindowStylesSlider);
|
||||
AddStyles("wxGauge", g_WindowStylesGaugeCount, g_WindowStylesGauge);
|
||||
AddStyles("wxComboBox", g_WindowStylesComboBoxCount, g_WindowStylesComboBox);
|
||||
// AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice);
|
||||
// AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice);
|
||||
AddStyles("wxScrollBar", g_WindowStylesScrollBarCount, g_WindowStylesScrollBar);
|
||||
}
|
||||
|
||||
@@ -334,25 +334,25 @@ bool wxWindowStyleTable::GenerateStyleStrings(const wxString& className, long wi
|
||||
wxWindowStyleClass* styleClass = FindClass(className);
|
||||
if (!styleClass)
|
||||
return FALSE;
|
||||
|
||||
|
||||
styleClass->GenerateStyleStrings(windowStyle, buf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Holds all the styles for a particular class
|
||||
*/
|
||||
* Holds all the styles for a particular class
|
||||
*/
|
||||
|
||||
wxWindowStyleClass::wxWindowStyleClass(int n, wxWindowStylePair *styles)
|
||||
{
|
||||
m_styleCount = n;
|
||||
m_styles = styles;
|
||||
/*
|
||||
/*
|
||||
m_styles = new wxWindowStylePair[n];
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
m_styles[i] = styles[i];
|
||||
*/
|
||||
m_styles[i] = styles[i];
|
||||
*/
|
||||
}
|
||||
|
||||
wxWindowStyleClass::~wxWindowStyleClass()
|
||||
@@ -371,15 +371,15 @@ bool wxWindowStyleClass::GenerateStyle(char *buf, long windowStyle, long flag, c
|
||||
// Ignore zero flags
|
||||
if (flag == 0)
|
||||
return TRUE;
|
||||
|
||||
if ((windowStyle & flag) == flag)
|
||||
{
|
||||
if (strlen(buf) > 0)
|
||||
strcat(buf, " | ");
|
||||
strcat(buf, (const char*) strStyle);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
if ((windowStyle & flag) == flag)
|
||||
{
|
||||
if (strlen(buf) > 0)
|
||||
strcat(buf, " | ");
|
||||
strcat(buf, (const char*) strStyle);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,8 @@
|
||||
#include "wx/wx.h"
|
||||
|
||||
/*
|
||||
* A class for storing/generating window styles.
|
||||
*/
|
||||
* A class for storing/generating window styles.
|
||||
*/
|
||||
|
||||
class wxWindowStyleClass;
|
||||
|
||||
@@ -37,41 +37,41 @@ class wxWindowStyleTable: public wxObject
|
||||
public:
|
||||
wxWindowStyleTable();
|
||||
~wxWindowStyleTable();
|
||||
|
||||
// Operations
|
||||
|
||||
// Operations
|
||||
void ClearTable();
|
||||
void AddStyles(const wxString& className, int n, wxWindowStylePair *styles);
|
||||
wxWindowStyleClass* FindClass(const wxString& className) ;
|
||||
bool GenerateStyleStrings(const wxString& className, long windowStyle, char *buf);
|
||||
|
||||
|
||||
// Initialise with all possible styles
|
||||
void Init();
|
||||
|
||||
// Members
|
||||
|
||||
// Members
|
||||
protected:
|
||||
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
|
||||
{
|
||||
public:
|
||||
wxWindowStyleClass(int n, wxWindowStylePair *styles);
|
||||
~wxWindowStyleClass();
|
||||
|
||||
// Operations
|
||||
|
||||
// Operations
|
||||
void GenerateStyleStrings(long windowStyle, char *buf);
|
||||
bool GenerateStyle(char *buf, long windowStyle, long flag, const wxString& strStyle);
|
||||
|
||||
// Members
|
||||
|
||||
// Members
|
||||
protected:
|
||||
wxWindowStylePair* m_styles; // An array of wxWindowStylePair objects
|
||||
int m_styleCount;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _DE_WINSTYLE_H_
|
||||
// _DE_WINSTYLE_H_
|
||||
|