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

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

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

View File

@@ -28,8 +28,8 @@
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MyApp)
BEGIN_EVENT_TABLE(MyApp, wxApp) BEGIN_EVENT_TABLE(MyApp, wxApp)
EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu) EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu)
EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu) EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu)
END_EVENT_TABLE() END_EVENT_TABLE()
MyApp::MyApp(void) MyApp::MyApp(void)

View File

@@ -26,7 +26,7 @@ class MyChild;
// Define a new application // Define a new application
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
MyApp(void); MyApp(void);
bool OnInit(void); bool OnInit(void);
int OnExit(void); int OnExit(void);

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -41,8 +41,8 @@ BEGIN_EVENT_TABLE(wxResourceEditorControlList, wxListCtrl)
END_EVENT_TABLE() END_EVENT_TABLE()
wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style): long style):
wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE) wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE)
{ {
Initialize(); Initialize();
} }
@@ -149,13 +149,13 @@ void wxResourceEditorControlList::Initialize()
id = InsertItem(15, "wxRadioButton", 15); id = InsertItem(15, "wxRadioButton", 15);
id = InsertItem(16, "wxScrollBar", 16); id = InsertItem(16, "wxScrollBar", 16);
/* /*
InsertItem(RESED_TREECTRL, "wxTreeCtrl", 16); InsertItem(RESED_TREECTRL, "wxTreeCtrl", 16);
InsertItem(RESED_LISTCTRL, "wxListCtrl", 17); InsertItem(RESED_LISTCTRL, "wxListCtrl", 17);
InsertItem(RESED_SPINBUTTON, "wxSpinButton", 18); InsertItem(RESED_SPINBUTTON, "wxSpinButton", 18);
*/ */
// SetColumnWidth(-1, 80); // SetColumnWidth(-1, 80);
} }
// Get selection, or -1 // Get selection, or -1

View File

@@ -28,7 +28,7 @@ public:
// Get selection, or -1 // Get selection, or -1
long GetSelection() const; long GetSelection() const;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected: protected:
wxImageList m_imageList; wxImageList m_imageList;

View File

@@ -38,13 +38,13 @@
#include "reseditr.h" #include "reseditr.h"
BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl) BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl)
EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick) EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged) EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style): long style):
wxTreeCtrl(parent, id, pos, size, style) wxTreeCtrl(parent, id, pos, size, style)
{ {
} }

View File

@@ -28,7 +28,7 @@ public:
protected: protected:
bool m_invalid; // While TRUE, don't respond to selections etc. bool m_invalid; // While TRUE, don't respond to selections etc.
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -32,7 +32,7 @@
#include "symbtabl.h" #include "symbtabl.h"
wxResourceSymbolTable::wxResourceSymbolTable(): wxResourceSymbolTable::wxResourceSymbolTable():
m_hashTable(wxKEY_STRING) m_hashTable(wxKEY_STRING)
{ {
} }
@@ -238,8 +238,8 @@ int wxResourceSymbolTable::FindHighestId()
} }
/* /*
* A table of the standard identifiers * A table of the standard identifiers
*/ */
struct wxStandardSymbolStruct struct wxStandardSymbolStruct
{ {

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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