Major changes to Dialog Editor (still at alpha level)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-07-02 15:19:34 +00:00
parent 201812a850
commit ae8351fc61
16 changed files with 1761 additions and 1252 deletions

View File

@@ -36,18 +36,26 @@ MyApp::MyApp(void)
{ {
} }
wxResourceManager theResourceManager; wxResourceManager *theResourceManager = NULL;
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
theResourceManager.Initialize(); theResourceManager = new wxResourceManager;
theResourceManager.ShowResourceEditor(TRUE); theResourceManager->Initialize();
theResourceManager->ShowResourceEditor(TRUE);
if (argc > 1) if (argc > 1)
theResourceManager.Load(argv[1]); theResourceManager->Load(argv[1]);
SetTopWindow(theResourceManager.GetEditorFrame()); SetTopWindow(theResourceManager->GetEditorFrame());
return TRUE; return TRUE;
} }
int MyApp::OnExit(void)
{
delete theResourceManager;
theResourceManager = NULL;
return 0;
}

View File

@@ -27,6 +27,7 @@ class MyApp: public wxApp
public: public:
MyApp(void); MyApp(void);
bool OnInit(void); bool OnInit(void);
int OnExit(void);
}; };
DECLARE_APP(MyApp) DECLARE_APP(MyApp)

View File

@@ -1,7 +1,31 @@
aaa ICON "dialoged.ico" aaa ICON "bitmaps/dialoged.ico"
DIALOGEDICON ICON "dialoged.ico" DIALOGEDICON ICON "bitmaps/dialoged.ico"
aiai_icn ICON "aiai.ico" DIALOG_ICON ICON "bitmaps/dialog.ico"
FOLDER1_ICON ICON "bitmaps/folder1.ico"
FOLDER2_ICON ICON "bitmaps/folder2.ico"
BUTTONSM_ICON ICON "bitmaps/buttonsm.ico"
/* For control list */
ARROW_ICON ICON "bitmaps/arrow.ico"
BUTTON_ICON ICON "bitmaps/button.ico"
BMPBUTTON_ICON ICON "bitmaps/bmpbuttn.ico"
STATICTEXT_ICON ICON "bitmaps/stattext.ico"
STATICBMP_ICON ICON "bitmaps/statbmp.ico"
STATICBOX_ICON ICON "bitmaps/statbox.ico"
TEXTSING_ICON ICON "bitmaps/textsing.ico"
TEXTMULT_ICON ICON "bitmaps/textmult.ico"
LISTBOX_ICON ICON "bitmaps/listbox.ico"
CHOICE_ICON ICON "bitmaps/choice.ico"
COMBOBOX_ICON ICON "bitmaps/combobox.ico"
CHECKBOX_ICON ICON "bitmaps/checkbox.ico"
SLIDER_ICON ICON "bitmaps/slider.ico"
GAUGE_ICON ICON "bitmaps/gauge.ico"
RADIOBOX_ICON ICON "bitmaps/radiobox.ico"
RADIOBTN_ICON ICON "bitmaps/radiobtn.ico"
SCROLBAR_ICON ICON "bitmaps/scrolbar.ico"
aiai_icn ICON "bitmaps/aiai.ico"
#include "wx/msw/wx.rc" #include "wx/msw/wx.rc"
DIALOGBOXTOOL BITMAP "bitmaps/dialog.bmp" DIALOGBOXTOOL BITMAP "bitmaps/dialog.bmp"

View File

@@ -39,8 +39,7 @@
#include "winprop.h" #include "winprop.h"
#include "editrpal.h" #include "editrpal.h"
#include "dlghndlr.h" #include "dlghndlr.h"
#include "edlist.h"
extern void wxResourceEditWindow(wxWindow *win);
IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler) IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler)
IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler) IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler)
@@ -75,6 +74,12 @@ wxResourceEditorDialogHandler::wxResourceEditorDialogHandler(wxPanel *dialog, wx
oldDragY = 0; oldDragY = 0;
dragTolerance = 3; dragTolerance = 3;
checkTolerance = TRUE; checkTolerance = TRUE;
m_mouseCaptured = FALSE;
// m_treeItem = 0;
}
wxResourceEditorDialogHandler::~wxResourceEditorDialogHandler(void)
{
} }
void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select) void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select)
@@ -85,34 +90,6 @@ void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select)
resourceManager->RemoveSelection(item); resourceManager->RemoveSelection(item);
} }
bool wxResourceEditorDialogHandler::OnClose(void)
{
handlerDialog->PopEventHandler();
// Now reset all child event handlers
wxNode *node = handlerDialog->GetChildren()->First();
while ( node )
{
wxWindow *child = (wxWindow *)node->Data();
wxEvtHandler *childHandler = child->GetEventHandler();
if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler != child )
{
child->PopEventHandler();
delete childHandler;
}
node = node->Next();
}
// Save the information before deleting the dialog.
resourceManager->InstantiateResourceFromWindow(handlerResource, handlerDialog, TRUE);
resourceManager->DisassociateResource(handlerDialog, FALSE);
handlerDialog->Show(FALSE);
delete this;
return TRUE;
}
void wxResourceEditorDialogHandler::OnPaint(wxPaintEvent& event) void wxResourceEditorDialogHandler::OnPaint(wxPaintEvent& event)
{ {
wxPaintDC dc(handlerDialog); wxPaintDC dc(handlerDialog);
@@ -138,7 +115,99 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
{ {
if (keys & wxKEY_CTRL) if (keys & wxKEY_CTRL)
{ {
wxResourceEditWindow(handlerDialog); wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog);
return;
}
// Deselect all items if click on panel
if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() == RESED_POINTER)
{
int needsRefresh = 0;
wxNode *node = handlerDialog->GetChildren()->First();
while (node)
{
wxControl *item = (wxControl *)node->Data();
wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected())
{
needsRefresh ++;
OnItemSelect(item, FALSE);
childHandler->SelectItem(FALSE);
}
node = node->Next();
}
if (needsRefresh > 0)
{
wxClientDC dc(handlerDialog);
dc.Clear();
handlerDialog->Refresh();
}
return;
}
wxResourceManager* manager = resourceManager;
switch (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection())
{
case RESED_BUTTON:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y);
break;
case RESED_BMPBUTTON:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxBitmapButton", x, y, TRUE);
break;
case RESED_STATICTEXT:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y);
break;
case RESED_STATICBMP:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE);
break;
case RESED_TEXTCTRL_SINGLE:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y);
break;
case RESED_TEXTCTRL_MULTIPLE:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y);
break;
case RESED_CHOICE:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
break;
case RESED_CHECKBOX:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y);
break;
case RESED_RADIOBOX:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioBox", x, y);
break;
case RESED_LISTBOX:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxListBox", x, y);
break;
case RESED_SLIDER:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxSlider", x, y);
break;
case RESED_GAUGE:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxGauge", x, y);
break;
case RESED_STATICBOX:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBox", x, y);
break;
case RESED_SCROLLBAR:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxScrollBar", x, y);
break;
default:
break;
}
// Now switch pointer on.
if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() != RESED_POINTER)
{
wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->SetItemState(RESED_POINTER, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
}
#if 0
void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
{
if (keys & wxKEY_CTRL)
{
wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog);
return; return;
} }
@@ -168,6 +237,8 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
return; return;
} }
wxResourceManager* manager = resourceManager;
switch (resourceManager->GetEditorPalette()->currentlySelected) switch (resourceManager->GetEditorPalette()->currentlySelected)
{ {
case PALETTE_FRAME: case PALETTE_FRAME:
@@ -187,16 +258,16 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y, TRUE); resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y, TRUE);
break; break;
case PALETTE_MESSAGE: case PALETTE_MESSAGE:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y); resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y);
break; break;
case PALETTE_BITMAP_MESSAGE: case PALETTE_BITMAP_MESSAGE:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y, TRUE); resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE);
break; break;
case PALETTE_TEXT: case PALETTE_TEXT:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxText", x, y); resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y);
break; break;
case PALETTE_MULTITEXT: case PALETTE_MULTITEXT:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMultiText", x, y); resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y);
break; break;
case PALETTE_CHOICE: case PALETTE_CHOICE:
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y); resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
@@ -227,30 +298,27 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
} }
// Now switch pointer on. // Now switch pointer on.
if (resourceManager->GetEditorPalette()->currentlySelected != PALETTE_ARROW) if (manager->GetEditorPalette()->currentlySelected != PALETTE_ARROW)
{ {
resourceManager->GetEditorPalette()->ToggleTool(resourceManager->GetEditorPalette()->currentlySelected, FALSE); manager->GetEditorPalette()->ToggleTool(manager->GetEditorPalette()->currentlySelected, FALSE);
resourceManager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE); manager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE);
resourceManager->GetEditorPalette()->currentlySelected = PALETTE_ARROW; manager->GetEditorPalette()->currentlySelected = PALETTE_ARROW;
} }
} }
#endif
void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys) void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys)
{ {
wxMenu *menu = resourceManager->GetPopupMenu(); wxMenu *menu = resourceManager->GetPopupMenu();
menu->SetClientData((char *)handlerDialog); menu->SetClientData((char *)handlerDialog);
#ifdef __MOTIF__
handlerDialog->FakePopupMenu(menu, x, y);
#else
handlerDialog->PopupMenu(menu, x, y); handlerDialog->PopupMenu(menu, x, y);
#endif
} }
void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int y, int keys) void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int y, int keys)
{ {
if (keys & wxKEY_CTRL) if (keys & wxKEY_CTRL)
{ {
wxResourceEditWindow(item); wxResourceManager::GetCurrentResourceManager()->EditWindow(item);
return; return;
} }
@@ -321,11 +389,7 @@ void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int
wxMenu *menu = resourceManager->GetPopupMenu(); wxMenu *menu = resourceManager->GetPopupMenu();
menu->SetClientData((char *)item); menu->SetClientData((char *)item);
#ifdef __MOTIF__
handlerDialog->FakePopupMenu(menu, x, y);
#else
handlerDialog->PopupMenu(menu, x, y); handlerDialog->PopupMenu(menu, x, y);
#endif
} }
// An event outside any items: may be a drag event. // An event outside any items: may be a drag event.
@@ -371,9 +435,25 @@ void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event)
if (event.ControlDown()) keys = keys | wxKEY_CTRL; if (event.ControlDown()) keys = keys | wxKEY_CTRL;
if (event.LeftUp()) if (event.LeftUp())
OnLeftClick(x, y, keys); {
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
OnLeftClick(x, y, keys);
}
else if (event.RightUp()) else if (event.RightUp())
OnRightClick(x, y, keys); {
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
OnRightClick(x, y, keys);
}
} }
else else
event.Skip(); event.Skip();
@@ -420,12 +500,27 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
checkTolerance = FALSE; checkTolerance = FALSE;
} }
} }
if (dragging && dragItem && dragMode == wxDRAG_MODE_START_LEFT) if (event.LeftDClick())
{
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
wxResourceManager::GetCurrentResourceManager()->EditWindow(item);
}
else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_LEFT)
{ {
dragMode = wxDRAG_MODE_CONTINUE_LEFT; dragMode = wxDRAG_MODE_CONTINUE_LEFT;
wxClientDC dc(handlerDialog); wxClientDC dc(handlerDialog);
childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
oldDragX = x; oldDragY = y; oldDragX = x; oldDragY = y;
if (!m_mouseCaptured)
{
handlerDialog->CaptureMouse();
m_mouseCaptured = TRUE;
}
} }
else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT) else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT)
{ {
@@ -439,10 +534,18 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
wxClientDC dc(handlerDialog); wxClientDC dc(handlerDialog);
dragMode = wxDRAG_MODE_NONE; dragMode = wxDRAG_MODE_NONE;
checkTolerance = TRUE; checkTolerance = TRUE;
childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle); childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle);
childHandler->OnDragEnd(x, y, keys, dc, selectionHandle); childHandler->OnDragEnd(x, y, keys, dc, selectionHandle);
dragItem = NULL; dragItem = NULL;
dragType = wxDRAG_TYPE_NONE; dragType = wxDRAG_TYPE_NONE;
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
} }
else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT) else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT)
{ {
@@ -450,6 +553,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
dragMode = wxDRAG_MODE_CONTINUE_RIGHT; dragMode = wxDRAG_MODE_CONTINUE_RIGHT;
childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
oldDragX = x; oldDragY = y; oldDragX = x; oldDragY = y;
if (!m_mouseCaptured)
{
handlerDialog->CaptureMouse();
m_mouseCaptured = TRUE;
}
} }
else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT)
{ {
@@ -461,6 +570,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
checkTolerance = TRUE; checkTolerance = TRUE;
dragItem = NULL; dragItem = NULL;
dragType = wxDRAG_TYPE_NONE; dragType = wxDRAG_TYPE_NONE;
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
} }
else if (event.IsButton()) else if (event.IsButton())
{ {
@@ -473,6 +588,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
firstDragX = x; firstDragX = x;
firstDragY = y; firstDragY = y;
dragType = selectionHandle; dragType = selectionHandle;
if (!m_mouseCaptured)
{
handlerDialog->CaptureMouse();
m_mouseCaptured = TRUE;
}
} }
else if (event.RightDown()) else if (event.RightDown())
{ {
@@ -481,6 +602,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
firstDragX = x; firstDragX = x;
firstDragY = y; firstDragY = y;
dragType = selectionHandle; dragType = selectionHandle;
if (!m_mouseCaptured)
{
handlerDialog->CaptureMouse();
m_mouseCaptured = TRUE;
}
} }
else if (event.LeftUp()) else if (event.LeftUp())
{ {
@@ -490,6 +617,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
OnLeftClick(x, y, keys); OnLeftClick(x, y, keys);
dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE;
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
} }
else if (event.RightUp()) else if (event.RightUp())
{ {
@@ -499,6 +632,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
OnRightClick(x, y, keys); OnRightClick(x, y, keys);
dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE;
if (m_mouseCaptured)
{
handlerDialog->ReleaseMouse();
m_mouseCaptured = FALSE;
}
} }
} }
} }
@@ -549,6 +688,11 @@ wxResourceEditorControlHandler::wxResourceEditorControlHandler(wxControl *contro
isSelected = FALSE; isSelected = FALSE;
dragOffsetX = 0; dragOffsetX = 0;
dragOffsetY = 0; dragOffsetY = 0;
// m_treeItem = 0;
}
wxResourceEditorControlHandler::~wxResourceEditorControlHandler(void)
{
} }
/* /*
@@ -679,7 +823,8 @@ void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys
dc.SetLogicalFunction(wxXOR); dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxBLACK_DASHED_PEN); wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetPen(pen);
dc.SetBrush(wxTRANSPARENT_BRUSH); dc.SetBrush(wxTRANSPARENT_BRUSH);
dc.SetOptimization(TRUE); dc.SetOptimization(TRUE);
@@ -797,7 +942,8 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
dc.BeginDrawing(); dc.BeginDrawing();
dc.SetLogicalFunction(wxXOR); dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxBLACK_DASHED_PEN); wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetPen(pen);
dc.SetBrush(wxTRANSPARENT_BRUSH); dc.SetBrush(wxTRANSPARENT_BRUSH);
DrawBoundingBox(dc, x1, y1, width1, height1); DrawBoundingBox(dc, x1, y1, width1, height1);
@@ -807,9 +953,9 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
else else
{ {
dc.BeginDrawing(); dc.BeginDrawing();
dc.SetLogicalFunction(wxXOR); dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxBLACK_DASHED_PEN); wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetPen(pen);
dc.SetBrush(wxTRANSPARENT_BRUSH); dc.SetBrush(wxTRANSPARENT_BRUSH);
DrawBoundingBox(dc, (int)(x - dragOffsetX), (int)(y - dragOffsetY), width, height); DrawBoundingBox(dc, (int)(x - dragOffsetX), (int)(y - dragOffsetY), width, height);
@@ -835,7 +981,6 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
} }
node = node->Next(); node = node->Next();
} }
dc.EndDrawing(); dc.EndDrawing();
} }
} }
@@ -936,7 +1081,6 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
node = node->Next(); node = node->Next();
} }
} }
dc.SetOptimization(FALSE); dc.SetOptimization(FALSE);
dc.SetLogicalFunction(wxCOPY); dc.SetLogicalFunction(wxCOPY);
@@ -960,9 +1104,11 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
// by default. // by default.
void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event) void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event)
{ {
/*
if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) || if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) ||
(event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK)) (event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK))
return; return;
*/
wxWindow *panel = handlerControl->GetParent(); wxWindow *panel = handlerControl->GetParent();
if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) )
return; return;

View File

@@ -41,12 +41,12 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
int firstDragY; int firstDragY;
int oldDragX; int oldDragX;
int oldDragY; int oldDragY;
bool m_mouseCaptured;
// 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);
bool OnClose(void);
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
@@ -64,6 +64,12 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
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
/*
inline long GetTreeItem() const { return m_treeItem; }
inline void SetTreeItem(long item) { m_treeItem = item; }
*/
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -79,11 +85,12 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
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;
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);
@@ -116,6 +123,12 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
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
/*
inline long GetTreeItem() const { return m_treeItem; }
inline void SetTreeItem(long item) { m_treeItem = item; }
*/
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -38,28 +38,6 @@
#include "reseditr.h" #include "reseditr.h"
#include "editrpal.h" #include "editrpal.h"
// Bitmaps for palette
wxBitmap *PaletteFrameBitmap = NULL;
wxBitmap *PaletteDialogBoxBitmap = NULL;
wxBitmap *PalettePanelBitmap = NULL;
wxBitmap *PaletteCanvasBitmap = NULL;
wxBitmap *PaletteTextWindowBitmap = NULL;
wxBitmap *PaletteMessageBitmap = NULL;
wxBitmap *PaletteButtonBitmap = NULL;
wxBitmap *PaletteCheckBoxBitmap = NULL;
wxBitmap *PaletteListBoxBitmap = NULL;
wxBitmap *PaletteRadioBoxBitmap = NULL;
wxBitmap *PaletteChoiceBitmap = NULL;
wxBitmap *PaletteTextBitmap = NULL;
wxBitmap *PaletteMultiTextBitmap = NULL;
wxBitmap *PaletteSliderBitmap = NULL;
wxBitmap *PaletteArrowBitmap = NULL;
wxBitmap *PaletteGroupBitmap = NULL;
wxBitmap *PaletteGaugeBitmap = NULL;
wxBitmap *PalettePictureBitmap = NULL;
wxBitmap *PaletteBitmapButtonBitmap = NULL;
wxBitmap *PaletteScrollbarBitmap = NULL;
#ifdef __X__ #ifdef __X__
#include "bitmaps/frame.xbm" #include "bitmaps/frame.xbm"
#include "bitmaps/dialog.xbm" #include "bitmaps/dialog.xbm"
@@ -142,23 +120,25 @@ void EditorToolPalette::OnMouseEnter(int toolIndex)
case PALETTE_PANEL: case PALETTE_PANEL:
managerFrame->SetStatusText("wxPanel"); managerFrame->SetStatusText("wxPanel");
break; break;
#if 0
case PALETTE_CANVAS: case PALETTE_CANVAS:
managerFrame->SetStatusText("wxCanvas"); managerFrame->SetStatusText("wxCanvas");
break; break;
case PALETTE_TEXT_WINDOW: case PALETTE_TEXT_WINDOW:
managerFrame->SetStatusText("wxTextWindow"); managerFrame->SetStatusText("wxTextWindow");
break; break;
#endif
case PALETTE_BUTTON: case PALETTE_BUTTON:
managerFrame->SetStatusText("wxButton"); managerFrame->SetStatusText("wxButton");
break; break;
case PALETTE_MESSAGE: case PALETTE_MESSAGE:
managerFrame->SetStatusText("wxMessage"); managerFrame->SetStatusText("wxStaticText");
break; break;
case PALETTE_TEXT: case PALETTE_TEXT:
managerFrame->SetStatusText("wxText"); managerFrame->SetStatusText("wxTextCtrl (single-line)");
break; break;
case PALETTE_MULTITEXT: case PALETTE_MULTITEXT:
managerFrame->SetStatusText("wxMultiText"); managerFrame->SetStatusText("wxTextCtrl (multi-line)");
break; break;
case PALETTE_CHOICE: case PALETTE_CHOICE:
managerFrame->SetStatusText("wxChoice"); managerFrame->SetStatusText("wxChoice");
@@ -176,16 +156,16 @@ void EditorToolPalette::OnMouseEnter(int toolIndex)
managerFrame->SetStatusText("wxSlider"); managerFrame->SetStatusText("wxSlider");
break; break;
case PALETTE_GROUPBOX: case PALETTE_GROUPBOX:
managerFrame->SetStatusText("wxGroupBox"); managerFrame->SetStatusText("wxStaticBox");
break; break;
case PALETTE_GAUGE: case PALETTE_GAUGE:
managerFrame->SetStatusText("wxGauge"); managerFrame->SetStatusText("wxGauge");
break; break;
case PALETTE_BITMAP_MESSAGE: case PALETTE_BITMAP_MESSAGE:
managerFrame->SetStatusText("Bitmap wxMessage"); managerFrame->SetStatusText("wxStaticBitmap");
break; break;
case PALETTE_BITMAP_BUTTON: case PALETTE_BITMAP_BUTTON:
managerFrame->SetStatusText("Bitmap wxButton"); managerFrame->SetStatusText("wxBitmapButton");
break; break;
case PALETTE_SCROLLBAR: case PALETTE_SCROLLBAR:
managerFrame->SetStatusText("wxScrollBar"); managerFrame->SetStatusText("wxScrollBar");
@@ -211,58 +191,44 @@ void EditorToolPalette::OnPaint(wxPaintEvent& event)
dc.DrawLine(0, h-1, w, h-1); dc.DrawLine(0, h-1, w, h-1);
} }
bool wxResourceManager::InitializeTools(void) EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
{ {
// Load palette bitmaps // Load palette bitmaps
#ifdef __WINDOWS__ #ifdef __WINDOWS__
PaletteFrameBitmap = new wxBitmap("FRAMETOOL"); wxBitmap PaletteMessageBitmap("MESSAGETOOL");
PaletteDialogBoxBitmap = new wxBitmap("DIALOGBOXTOOL"); wxBitmap PaletteButtonBitmap("BUTTONTOOL");
PalettePanelBitmap = new wxBitmap("PANELTOOL"); wxBitmap PaletteCheckBoxBitmap("CHECKBOXTOOL");
PaletteCanvasBitmap = new wxBitmap("CANVASTOOL"); wxBitmap PaletteListBoxBitmap("LISTBOXTOOL");
PaletteTextWindowBitmap = new wxBitmap("TEXTWINDOWTOOL"); wxBitmap PaletteRadioBoxBitmap("RADIOBOXTOOL");
PaletteMessageBitmap = new wxBitmap("MESSAGETOOL"); wxBitmap PaletteChoiceBitmap("CHOICETOOL");
PaletteButtonBitmap = new wxBitmap("BUTTONTOOL"); wxBitmap PaletteTextBitmap("TEXTTOOL");
PaletteCheckBoxBitmap = new wxBitmap("CHECKBOXTOOL"); wxBitmap PaletteMultiTextBitmap("MULTITEXTTOOL");
PaletteListBoxBitmap = new wxBitmap("LISTBOXTOOL"); wxBitmap PaletteSliderBitmap("SLIDERTOOL");
PaletteRadioBoxBitmap = new wxBitmap("RADIOBOXTOOL"); wxBitmap PaletteArrowBitmap("ARROWTOOL");
PaletteChoiceBitmap = new wxBitmap("CHOICETOOL"); wxBitmap PaletteGroupBitmap("GROUPTOOL");
PaletteTextBitmap = new wxBitmap("TEXTTOOL"); wxBitmap PaletteGaugeBitmap("GAUGETOOL");
PaletteMultiTextBitmap = new wxBitmap("MULTITEXTTOOL"); wxBitmap PalettePictureBitmap("PICTURETOOL");
PaletteSliderBitmap = new wxBitmap("SLIDERTOOL"); wxBitmap PaletteBitmapButtonBitmap("BMPBUTTONTOOL");
PaletteArrowBitmap = new wxBitmap("ARROWTOOL"); wxBitmap PaletteScrollbarBitmap("SCROLLBARTOOL");
PaletteGroupBitmap = new wxBitmap("GROUPTOOL");
PaletteGaugeBitmap = new wxBitmap("GAUGETOOL");
PalettePictureBitmap = new wxBitmap("PICTURETOOL");
PaletteBitmapButtonBitmap = new wxBitmap("BMPBUTTONTOOL");
PaletteScrollbarBitmap = new wxBitmap("SCROLLBARTOOL");
#endif #endif
#ifdef __X__ #ifdef __X__
PaletteFrameBitmap = new wxBitmap(frame_bits, frame_width, frame_height); wxBitmap PaletteMessageBitmap(message_bits, message_width, message_height);
PaletteDialogBoxBitmap = new wxBitmap(dialog_bits, dialog_width, dialog_height); wxBitmap PaletteButtonBitmap(button_bits, button_width, button_height);
PalettePanelBitmap = new wxBitmap(panel_bits, panel_width, panel_height); wxBitmap PaletteCheckBoxBitmap(check_bits, check_width, check_height);
PaletteCanvasBitmap = new wxBitmap(canvas_bits, canvas_width, canvas_height); wxBitmap PaletteListBoxBitmap(listbox_bits, listbox_width, listbox_height);
PaletteTextWindowBitmap = new wxBitmap(textsw_bits, textsw_width, textsw_height); wxBitmap PaletteRadioBoxBitmap(radio_bits, radio_width, radio_height);
PaletteMessageBitmap = new wxBitmap(message_bits, message_width, message_height); wxBitmap PaletteChoiceBitmap(choice_bits, choice_width, choice_height);
PaletteButtonBitmap = new wxBitmap(button_bits, button_width, button_height); wxBitmap PaletteTextBitmap(text_bits, text_width, text_height);
PaletteCheckBoxBitmap = new wxBitmap(check_bits, check_width, check_height); wxBitmap PaletteMultiTextBitmap(mtext_bits, mtext_width, mtext_height);
PaletteListBoxBitmap = new wxBitmap(listbox_bits, listbox_width, listbox_height); wxBitmap PaletteSliderBitmap(slider_bits, slider_width, slider_height);
PaletteRadioBoxBitmap = new wxBitmap(radio_bits, radio_width, radio_height); wxBitmap PaletteArrowBitmap(arrow_bits, arrow_width, arrow_height);
PaletteChoiceBitmap = new wxBitmap(choice_bits, choice_width, choice_height); wxBitmap PaletteGroupBitmap(group_bits, group_width, group_height);
PaletteTextBitmap = new wxBitmap(text_bits, text_width, text_height); wxBitmap PaletteGaugeBitmap(gauge_bits, gauge_width, gauge_height);
PaletteMultiTextBitmap = new wxBitmap(mtext_bits, mtext_width, mtext_height); wxBitmap PalettePictureBitmap(picture_bits, picture_width, picture_height);
PaletteSliderBitmap = new wxBitmap(slider_bits, slider_width, slider_height); wxBitmap PaletteBitmapButtonBitmap(bmpbuttn_bits, bmpbuttn_width, bmpbuttn_height);
PaletteArrowBitmap = new wxBitmap(arrow_bits, arrow_width, arrow_height); wxBitmap PaletteScrollbarBitmap(scroll_bits, scroll_width, scroll_height);
PaletteGroupBitmap = new wxBitmap(group_bits, group_width, group_height);
PaletteGaugeBitmap = new wxBitmap(gauge_bits, gauge_width, gauge_height);
PalettePictureBitmap = new wxBitmap(picture_bits, picture_width, picture_height);
PaletteBitmapButtonBitmap = new wxBitmap(bmpbuttn_bits, bmpbuttn_width, bmpbuttn_height);
PaletteScrollbarBitmap = new wxBitmap(scroll_bits, scroll_width, scroll_height);
#endif #endif
return TRUE;
}
EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
{
EditorToolPalette *palette = new EditorToolPalette(this, parent, 0, 0, -1, -1, wxNO_BORDER, // wxTB_3DBUTTONS, EditorToolPalette *palette = new EditorToolPalette(this, parent, 0, 0, -1, -1, wxNO_BORDER, // wxTB_3DBUTTONS,
wxVERTICAL, 1); wxVERTICAL, 1);
@@ -274,28 +240,19 @@ EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
#endif #endif
*/ */
// palette->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
palette->AddTool(PALETTE_ARROW, PaletteArrowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Pointer"); palette->AddTool(PALETTE_ARROW, PaletteArrowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Pointer");
/* palette->AddTool(PALETTE_MESSAGE, PaletteMessageBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticText");
palette->AddTool(PALETTE_FRAME, PaletteFrameBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxFrame"); palette->AddTool(PALETTE_BITMAP_MESSAGE, PalettePictureBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticBitmap");
palette->AddTool(PALETTE_DIALOG_BOX, PaletteDialogBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxDialog");
palette->AddTool(PALETTE_PANEL, PalettePanelBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxPanel");
palette->AddTool(PALETTE_CANVAS, PaletteCanvasBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCanvas");
palette->AddTool(PALETTE_TEXT_WINDOW, PaletteTextWindowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxTextWindow");
*/
palette->AddTool(PALETTE_MESSAGE, PaletteMessageBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxMessage");
palette->AddTool(PALETTE_BITMAP_MESSAGE, PalettePictureBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Picture wxMessage");
palette->AddTool(PALETTE_BUTTON, PaletteButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Button"); palette->AddTool(PALETTE_BUTTON, PaletteButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Button");
palette->AddTool(PALETTE_BITMAP_BUTTON, PaletteBitmapButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Picture wxButton"); palette->AddTool(PALETTE_BITMAP_BUTTON, PaletteBitmapButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxBitmapButton");
palette->AddTool(PALETTE_CHECKBOX, PaletteCheckBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCheckBox"); palette->AddTool(PALETTE_CHECKBOX, PaletteCheckBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCheckBox");
palette->AddTool(PALETTE_RADIOBOX, PaletteRadioBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxRadioBox"); palette->AddTool(PALETTE_RADIOBOX, PaletteRadioBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxRadioBox");
palette->AddTool(PALETTE_LISTBOX, PaletteListBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxListBox"); palette->AddTool(PALETTE_LISTBOX, PaletteListBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxListBox");
palette->AddTool(PALETTE_CHOICE, PaletteChoiceBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxChoice"); palette->AddTool(PALETTE_CHOICE, PaletteChoiceBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxChoice");
palette->AddTool(PALETTE_TEXT, PaletteTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxText"); palette->AddTool(PALETTE_TEXT, PaletteTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxTextCtrl (single-line)");
palette->AddTool(PALETTE_MULTITEXT, PaletteMultiTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxMultiText"); palette->AddTool(PALETTE_MULTITEXT, PaletteMultiTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxTextCtrl (multi-line)");
palette->AddTool(PALETTE_SLIDER, PaletteSliderBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxSlider"); palette->AddTool(PALETTE_SLIDER, PaletteSliderBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxSlider");
palette->AddTool(PALETTE_GROUPBOX, PaletteGroupBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGroupBox"); palette->AddTool(PALETTE_GROUPBOX, PaletteGroupBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticBox");
palette->AddTool(PALETTE_GAUGE, PaletteGaugeBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGauge"); palette->AddTool(PALETTE_GAUGE, PaletteGaugeBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGauge");
palette->AddTool(PALETTE_SCROLLBAR, PaletteScrollbarBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxScrollBar"); palette->AddTool(PALETTE_SCROLLBAR, PaletteScrollbarBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxScrollBar");

View File

@@ -0,0 +1,144 @@
/////////////////////////////////////////////////////////////////////////////
// Name: edlist.cpp
// Purpose: Resource editor project management tree
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "edlist.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/checkbox.h"
#include "wx/button.h"
#include "wx/choice.h"
#include "wx/listbox.h"
#include "wx/radiobox.h"
#include "wx/statbox.h"
#include "wx/gauge.h"
#include "wx/slider.h"
#include "wx/textctrl.h"
#endif
#include "edlist.h"
#include "reseditr.h"
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)
{
Initialize();
}
wxResourceEditorControlList::~wxResourceEditorControlList()
{
SetImageList(NULL, wxIMAGE_LIST_SMALL);
}
// Load icons and add to the list
void wxResourceEditorControlList::Initialize()
{
wxIcon icon1("ARROW_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon1);
wxIcon icon2("BUTTON_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon2);
wxIcon icon3("BMPBUTTON_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon3);
wxIcon icon4("STATICTEXT_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon4);
wxIcon icon5("STATICBMP_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon5);
wxIcon icon6("STATICBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon6);
wxIcon icon7("TEXTSING_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon7);
wxIcon icon8("TEXTMULT_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon8);
wxIcon icon9("LISTBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon9);
wxIcon icon10("CHOICE_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon10);
wxIcon icon11("COMBOBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon11);
wxIcon icon12("CHECKBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon12);
wxIcon icon13("SLIDER_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon13);
wxIcon icon14("GAUGE_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon14);
wxIcon icon15("RADIOBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon15);
wxIcon icon16("RADIOBTN_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
m_imageList.Add(icon16);
wxIcon icon17("SCROLBAR_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
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);
id = InsertItem(3, "wxStaticText", 3);
id = InsertItem(4, "wxStaticBitmap", 4);
id = InsertItem(5, "wxStaticBox", 5);
id = InsertItem(6, "wxTextCtrl", 6);
id = InsertItem(7, "wxTextCtrl", 7);
id = InsertItem(8, "wxListBox", 8);
id = InsertItem(9, "wxChoice", 9);
id = InsertItem(10, "wxComboBox", 10);
id = InsertItem(11, "wxCheckBox", 11);
id = InsertItem(12, "wxSlider", 12);
id = InsertItem(13, "wxGauge", 13);
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);
}
// Get selection, or -1
long wxResourceEditorControlList::GetSelection() const
{
return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////
// Name: edlist.h
// Purpose: Resource editor list of controls
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _EDLIST_H_
#define _EDLIST_H_
#include <wx/listctrl.h>
#include <wx/imaglist.h>
class wxResourceEditorControlList: public wxListCtrl
{
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()
protected:
wxImageList m_imageList;
};
#endif

View File

@@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////
// Name: edtree.cpp
// Purpose: Resource editor project management tree
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "edtree.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/checkbox.h"
#include "wx/button.h"
#include "wx/choice.h"
#include "wx/listbox.h"
#include "wx/radiobox.h"
#include "wx/statbox.h"
#include "wx/gauge.h"
#include "wx/slider.h"
#include "wx/textctrl.h"
#endif
#include "edtree.h"
#include "reseditr.h"
BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl)
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)
{
}
void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event)
{
#if 0
long sel = GetSelection();
if (sel == -1)
return;
if (GetItemData(sel) == 0)
return;
wxItemResource* res = (wxItemResource*) GetItemData(sel);
wxString resType(res->GetType());
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
return;
wxResourceEditorFrame *frame = (wxResourceEditorFrame *)wxWindow::GetParent();
wxResourceManager *manager = frame->manager;
manager->EditSelectedResource();
#endif
}
void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& event)
{
long sel = GetSelection();
if (sel == -1)
return;
if (GetItemData(sel) == 0)
return;
if (m_invalid)
return;
wxItemResource* res = (wxItemResource*) GetItemData(sel);
wxString resType(res->GetType());
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
return;
wxResourceManager::GetCurrentResourceManager()->Edit(res);
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////
// Name: edtree.h
// Purpose: Resource editor project management tree control
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _EDTREE_H_
#define _EDTREE_H_
#include <wx/treectrl.h>
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()
};
#endif

View File

@@ -25,7 +25,7 @@ LOCALDOCDIR=$(WXDIR)\utils\dialoged\docs
PROGRAM=dialoged PROGRAM=dialoged
OBJECTS = dialoged.obj editrpal.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj OBJECTS = dialoged.obj editrpal.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj edtree.obj edlist.obj
all: wxprop dialoged.exe all: wxprop dialoged.exe
@@ -72,6 +72,16 @@ reseditr.obj: winprop.h reseditr.h editrpal.h reseditr.$(SRCSUFF) $(DUMMYOB
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<< <<
edtree.obj: winprop.h reseditr.h editrpal.h edtree.h edtree.$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
edlist.obj: winprop.h reseditr.h edlist.h edlist.$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
dlghndlr.obj: winprop.h reseditr.h editrpal.h dlghndlr.$(SRCSUFF) $(DUMMYOBJ) dlghndlr.obj: winprop.h reseditr.h editrpal.h dlghndlr.$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<< $(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)

File diff suppressed because it is too large Load Diff

View File

@@ -22,25 +22,45 @@
#include "wx/string.h" #include "wx/string.h"
#include "wx/layout.h" #include "wx/layout.h"
#include "wx/resource.h" #include "wx/resource.h"
#include "wx/tbarsmpl.h" #include "wx/toolbar.h"
#include "wx/imaglist.h"
#include "proplist.h" #include "proplist.h"
#if defined(__WINDOWS__) && defined(__WIN95__)
#include "wx/tbar95.h"
#elif defined(__WINDOWS__)
#include "wx/tbarmsw.h"
#endif
#define RESED_DELETE 1 #define RESED_DELETE 1
#define RESED_TOGGLE_TEST_MODE 2
#define RESED_RECREATE 3 #define RESED_RECREATE 3
#define RESED_CLEAR 4 #define RESED_CLEAR 4
#define RESED_NEW_DIALOG 5 #define RESED_NEW_DIALOG 5
#define RESED_NEW_PANEL 6 #define RESED_NEW_PANEL 6
#define RESED_TEST 10
#define RESED_CONTENTS 20 #define RESED_CONTENTS 20
#define IDC_TREECTRL 100
#define IDC_LISTCTRL 101
// For control list ('palette')
#define RESED_POINTER 0
#define RESED_BUTTON 1
#define RESED_BMPBUTTON 2
#define RESED_STATICTEXT 3
#define RESED_STATICBMP 4
#define RESED_STATICBOX 5
#define RESED_TEXTCTRL_SINGLE 6
#define RESED_TEXTCTRL_MULTIPLE 7
#define RESED_LISTBOX 8
#define RESED_CHOICE 9
#define RESED_COMBOBOX 10
#define RESED_CHECKBOX 11
#define RESED_SLIDER 12
#define RESED_GAUGE 13
#define RESED_RADIOBOX 14
#define RESED_RADIOBUTTON 15
#define RESED_SCROLLBAR 16
#define RESED_TREECTRL 17
#define RESED_LISTCTRL 18
#define RESED_SPINBUTTON 19
/* /*
* Controls loading, saving, user interface of resource editor(s). * Controls loading, saving, user interface of resource editor(s).
*/ */
@@ -49,6 +69,8 @@ class wxResourceEditorFrame;
class EditorToolPalette; class EditorToolPalette;
class EditorToolBar; class EditorToolBar;
class wxWindowPropertyInfo; class wxWindowPropertyInfo;
class wxResourceEditorProjectTree;
class wxResourceEditorControlList;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#define wxHelpController wxWinHelpController #define wxHelpController wxWinHelpController
@@ -88,7 +110,7 @@ class wxHelpController;
class wxResourceTableWithSaving: public wxResourceTable class wxResourceTableWithSaving: public wxResourceTable
{ {
public: public:
wxResourceTableWithSaving(void):wxResourceTable() wxResourceTableWithSaving():wxResourceTable()
{ {
} }
virtual bool Save(const wxString& filename); virtual bool Save(const wxString& filename);
@@ -117,80 +139,73 @@ class wxResourceTableWithSaving: public wxResourceTable
wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource); wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource);
}; };
class wxResourceEditorScrolledWindow;
class wxResourceManager: public wxObject class wxResourceManager: public wxObject
{ {
protected: friend class wxResourceEditorFrame;
wxHelpController *helpInstance;
wxResourceTableWithSaving resourceTable;
wxFrame *editorFrame;
wxPanel *editorPanel;
wxMenu *popupMenu;
wxListBox *editorResourceList;
EditorToolPalette *editorPalette;
EditorToolBar *editorToolBar;
int nameCounter;
bool modified;
bool editMode;
wxHashTable resourceAssociations;
wxList selections;
wxString currentFilename;
public:
// Options to be saved/restored
wxString optionsResourceFilename; // e.g. dialoged.ini, .dialogrc
wxRectangle propertyWindowSize;
wxRectangle resourceEditorWindowSize;
public: public:
static wxResourceManager *currentResourceManager; wxResourceManager();
~wxResourceManager();
wxResourceManager(void); // Operations
~wxResourceManager(void);
bool Initialize(void); // Initializes the resource manager
bool Initialize();
bool LoadOptions(void); // Load/save window size etc.
bool SaveOptions(void); bool LoadOptions();
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(void); virtual bool Save();
virtual bool SaveAs(void); virtual bool SaveAs();
virtual bool Save(const wxString& filename); virtual bool Save(const wxString& filename);
virtual bool Load(const wxString& filename); virtual bool Load(const wxString& filename);
virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE); virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
virtual void SetFrameTitle(const wxString& filename); virtual void SetFrameTitle(const wxString& filename);
virtual bool DisassociateWindows(bool deleteWindows = TRUE); virtual void ClearCurrentDialog();
virtual bool New(bool loadFromFile = TRUE, const wxString& filename = ""); virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
virtual bool SaveIfModified(void); virtual bool SaveIfModified();
virtual void AlignItems(int flag); virtual void AlignItems(int flag);
virtual void CopySize(void); virtual void CopySize();
virtual void ToBackOrFront(bool toBack); virtual void ToBackOrFront(bool toBack);
virtual wxWindow *FindParentOfSelection(void); virtual wxWindow *FindParentOfSelection();
virtual wxFrame *OnCreateEditorFrame(const char *title); virtual wxFrame *OnCreateEditorFrame(const char *title);
virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent); virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
virtual wxPanel *OnCreateEditorPanel(wxFrame *parent); virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent); virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent);
virtual EditorToolPalette *OnCreatePalette(wxFrame *parent); virtual EditorToolPalette *OnCreatePalette(wxFrame *parent);
// virtual bool DeletePalette(void);
virtual bool InitializeTools(void);
virtual void UpdateResourceList(void); // Create a window information object for the give window
virtual void AddItemsRecursively(int level, wxItemResource *resource); wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
virtual bool EditSelectedResource(void); // 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 Edit(wxItemResource *res);
virtual bool CreateNewDialog(void); virtual bool CreateNewPanel();
virtual bool CreateNewPanel(void);
virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE); virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
virtual bool DeleteSelection(bool deleteWindow = TRUE); virtual bool DeleteSelection();
// 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(wxItemResource *res);
virtual bool DeleteResource(wxWindow *win, bool deleteWindow = TRUE); virtual bool DeleteResource(wxWindow *win);
// Add bitmap resource if there isn't already one with this filename. // Add bitmap resource if there isn't already one with this filename.
virtual char *AddBitmapResource(char *filename); virtual char *AddBitmapResource(char *filename);
@@ -210,7 +225,7 @@ class wxResourceManager: public wxObject
// fly, you'll need to delete the window and create it again. // fly, you'll need to delete the window and create it again.
virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL); virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL);
virtual bool RecreateSelection(void); virtual bool RecreateSelection();
// Need to search through resource table removing this from // Need to search through resource table removing this from
// any resource which has this as a parent. // any resource which has this as a parent.
@@ -218,116 +233,129 @@ class wxResourceManager: public wxObject
virtual bool EditDialog(wxDialog *dialog, wxWindow *parent); virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
inline void SetEditorFrame(wxFrame *fr) { editorFrame = fr; }
inline void SetEditorToolBar(EditorToolBar *tb) { editorToolBar = tb; }
inline void SetEditorPalette(EditorToolPalette *pal) { editorPalette = pal; }
inline wxFrame *GetEditorFrame(void) { return editorFrame; }
inline wxListBox *GetEditorResourceList(void) { return editorResourceList; }
inline EditorToolPalette *GetEditorPalette(void) { return editorPalette; }
inline wxList& GetSelections(void) { return selections; }
void AddSelection(wxWindow *win); void AddSelection(wxWindow *win);
void RemoveSelection(wxWindow *win); void RemoveSelection(wxWindow *win);
// inline void SetCurrentResource(wxItemResource *item) { currentResource = item; }
// inline void SetCurrentResourceWindow(wxWindow *win) { currentResourceWindow = win; }
// inline wxItemResource *GetCurrentResource(void) { return currentResource; }
// inline wxWindow *GetCurrentResourceWindow(void) { return currentResourceWindow; }
inline wxMenu *GetPopupMenu(void) { return popupMenu; }
inline wxHelpController *GetHelpInstance(void) { return helpInstance; }
virtual void MakeUniqueName(char *prefix, char *buf); virtual void MakeUniqueName(char *prefix, char *buf);
// (Dis)associate resource<->physical window // (Dis)associate resource<->physical window
// Doesn't delete any windows.
virtual void AssociateResource(wxItemResource *resource, wxWindow *win); virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
virtual bool DisassociateResource(wxItemResource *resource, bool deleteWindow = TRUE); virtual bool DisassociateResource(wxItemResource *resource);
virtual bool DisassociateResource(wxWindow *win, bool deleteWindow = TRUE); virtual bool DisassociateResource(wxWindow *win);
virtual bool DisassociateWindows();
virtual wxItemResource *FindResourceForWindow(wxWindow *win); virtual wxItemResource *FindResourceForWindow(wxWindow *win);
virtual wxWindow *FindWindowForResource(wxItemResource *resource); virtual wxWindow *FindWindowForResource(wxItemResource *resource);
virtual bool InstantiateAllResourcesFromWindows(void); virtual bool InstantiateAllResourcesFromWindows();
virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE); virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
virtual void Modify(bool mod = TRUE) { modified = mod; } // Accessors
virtual bool Modified(void) { return modified; } inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
inline void SetEditorPalette(EditorToolPalette *pal) { m_editorPalette = pal; }
inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; }
inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; }
inline EditorToolPalette *GetEditorPalette() const { return m_editorPalette; }
inline wxList& GetSelections() { return m_selections; }
inline wxMenu *GetPopupMenu() const { return m_popupMenu; }
inline wxHelpController *GetHelpController() const { return m_helpController; }
inline bool GetEditMode(void) { return editMode; } inline void Modify(bool mod = TRUE) { m_modified = mod; }
void SetEditMode(bool flag, bool changeCurrentResource = TRUE); inline bool Modified() const { return m_modified; }
inline wxResourceTable& GetResourceTable(void) { return resourceTable; } inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
inline wxHashTable& GetResourceAssociations(void) { return resourceAssociations; } inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
inline wxString& GetCurrentFilename(void) { return currentFilename; }
// void UsePosition(bool usePos, wxItemResource *resource = NULL, int x = 0, int y = 0); inline wxString& GetCurrentFilename() { return m_currentFilename; }
static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
// Member variables
protected:
wxHelpController* m_helpController;
wxResourceTableWithSaving m_resourceTable;
wxFrame* m_editorFrame;
wxResourceEditorScrolledWindow* m_editorPanel;
wxMenu* m_popupMenu;
wxResourceEditorProjectTree* m_editorResourceTree;
wxResourceEditorControlList* m_editorControlList;
EditorToolPalette* m_editorPalette;
EditorToolBar* m_editorToolBar;
int m_nameCounter;
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;
}; };
class wxResourceEditorFrame: public wxFrame class wxResourceEditorFrame: public wxFrame
{ {
public: public:
DECLARE_CLASS(wxResourceEditorFrame)
wxResourceManager *manager; wxResourceManager *manager;
wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, char *title, int x = -1, int y = -1, int width = 600, int height = 400, wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
long style = 0, char *name = "frame"); const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400),
~wxResourceEditorFrame(void); long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
void OldOnMenuCommand(int cmd); ~wxResourceEditorFrame();
bool OnClose(void);
bool OnClose();
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()
}; };
class wxResourceEditorPanel: public wxPanel class wxResourceEditorScrolledWindow: public wxScrolledWindow
{ {
public: public:
wxResourceEditorPanel(wxWindow *parent, int x = -1, int y = -1, int width = 600, int height = 400, wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, char *name = "panel"); long style = 0);
~wxResourceEditorPanel(void); ~wxResourceEditorScrolledWindow();
void OnDefaultAction(wxControl *item);
}; void OnScroll(wxScrollEvent& event);
void OnPaint(wxPaintEvent& event);
void DrawTitle(wxDC& dc);
// Accessors
inline int GetMarginX() { return m_marginX; }
inline int GetMarginY() { return m_marginY; }
class DialogEditorPanelFrame: public wxFrame
{
public: public:
DialogEditorPanelFrame(wxFrame *parent, char *title, int x, int y, int w, int h, long style, char *name): wxWindow* m_childWindow;
wxFrame(parent, -1, title, wxPoint(x, y), wxSize(w, h), style, name) private:
{ int m_marginX, m_marginY;
}
bool OnClose(void); DECLARE_EVENT_TABLE()
}; };
// Edit menu
#define OBJECT_EDITOR_NEW_FRAME 220
#define OBJECT_EDITOR_NEW_DIALOG 221
#define OBJECT_EDITOR_NEW_PANEL 222
#define OBJECT_EDITOR_NEW_CANVAS 223
#define OBJECT_EDITOR_NEW_TEXT_WINDOW 224
#define OBJECT_EDITOR_NEW_BUTTON 225
#define OBJECT_EDITOR_NEW_CHECKBOX 226
#define OBJECT_EDITOR_NEW_MESSAGE 227
#define OBJECT_EDITOR_NEW_CHOICE 228
#define OBJECT_EDITOR_NEW_LISTBOX 229
#define OBJECT_EDITOR_NEW_RADIOBOX 230
#define OBJECT_EDITOR_NEW_SLIDER 231
#define OBJECT_EDITOR_NEW_TEXT 232
#define OBJECT_EDITOR_NEW_MULTITEXT 233
#define OBJECT_EDITOR_NEW_GAUGE 234
#define OBJECT_EDITOR_NEW_GROUPBOX 235
#define OBJECT_EDITOR_NEW_ITEM 240
#define OBJECT_EDITOR_NEW_SUBWINDOW 241
#define OBJECT_EDITOR_EDIT_MENU 250
#define OBJECT_EDITOR_EDIT_ATTRIBUTES 251
#define OBJECT_EDITOR_CLOSE_OBJECT 252
#define OBJECT_EDITOR_DELETE_OBJECT 253
#define OBJECT_EDITOR_EDIT_TOOLBAR 254
#define OBJECT_EDITOR_TOGGLE_TEST_MODE 255
#define OBJECT_EDITOR_RC_CONVERT 260
#define OBJECT_EDITOR_RC_CONVERT_MENU 261
#define OBJECT_EDITOR_RC_CONVERT_DIALOG 262
#define OBJECT_EDITOR_GRID 263
#define OBJECT_MENU_EDIT 1 #define OBJECT_MENU_EDIT 1
#define OBJECT_MENU_DELETE 2 #define OBJECT_MENU_DELETE 2
@@ -336,16 +364,10 @@ class DialogEditorPanelFrame: public wxFrame
* *
*/ */
#if defined(__WINDOWS__) && defined(__WIN95__) class EditorToolBar: public wxToolBar
class EditorToolBar: public wxToolBar95
#elif defined(__WINDOWS__)
class EditorToolBar: public wxToolBarMSW
#else
class EditorToolBar: public wxToolBarSimple
#endif
{ {
public: public:
EditorToolBar(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1, EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2); long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2);
bool OnLeftClick(int toolIndex, bool toggled); bool OnLeftClick(int toolIndex, bool toggled);
void OnMouseEnter(int toolIndex); void OnMouseEnter(int toolIndex);
@@ -355,24 +377,23 @@ DECLARE_EVENT_TABLE()
}; };
// Toolbar ids // Toolbar ids
#define TOOLBAR_LOAD_FILE 1 #define TOOLBAR_LOAD_FILE 1
#define TOOLBAR_SAVE_FILE 2 #define TOOLBAR_SAVE_FILE 2
#define TOOLBAR_NEW 3 #define TOOLBAR_NEW 3
// #define TOOLBAR_GEN_CLIPS 4 #define TOOLBAR_TREE 5
#define TOOLBAR_TREE 5 #define TOOLBAR_HELP 6
#define TOOLBAR_HELP 6
// Formatting tools // Formatting tools
#define TOOLBAR_FORMAT_HORIZ 10 #define TOOLBAR_FORMAT_HORIZ 10
#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11 #define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11
#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12 #define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12
#define TOOLBAR_FORMAT_VERT 13 #define TOOLBAR_FORMAT_VERT 13
#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14 #define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14
#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15 #define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15
#define TOOLBAR_TO_FRONT 16 #define TOOLBAR_TO_FRONT 16
#define TOOLBAR_TO_BACK 17 #define TOOLBAR_TO_BACK 17
#define TOOLBAR_COPY_SIZE 18 #define TOOLBAR_COPY_SIZE 18
#endif #endif

View File

@@ -51,7 +51,7 @@ wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, wxItemResource
{ {
wxControl *item = wxResourceTable::CreateItem(panel, childResource); wxControl *item = wxResourceTable::CreateItem(panel, childResource);
if (item) if (item)
wxResourceManager::currentResourceManager->GetResourceAssociations().Put((long)childResource, item); wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item);
return item; return item;
} }
@@ -113,10 +113,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << " style = '" << styleBuf << "',\\\n"; stream << " style = '" << styleBuf << "',\\\n";
stream << " title = '" << item->GetTitle() << "',\\\n"; stream << " title = '" << item->GetTitle() << "',\\\n";
stream << " x = " << item->GetX() << ", y = " << item->GetY(); stream << " x = " << item->GetX() << ", y = " << item->GetY();
stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight() << ",\\\n"; stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight();
stream << " modal = " << item->GetValue1(); // stream << " modal = " << item->GetValue1();
if (item->GetStyle() & wxUSER_COLOURS) if (1) // item->GetStyle() & wxNO_3D)
{ {
if (item->GetBackgroundColour()) if (item->GetBackgroundColour())
{ {
@@ -128,6 +128,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << ",\\\n " << "background_colour = '" << buf << "'"; stream << ",\\\n " << "background_colour = '" << buf << "'";
} }
#if 0
if (item->GetLabelColour()) if (item->GetLabelColour())
{ {
char buf[7]; char buf[7];
@@ -148,21 +149,16 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
stream << ",\\\n " << "button_colour = '" << buf << "'"; stream << ",\\\n " << "button_colour = '" << buf << "'";
} }
#endif
} }
if (item->GetFont()) if (item->GetFont() && item->GetFont()->Ok())
{ {
stream << ",\\\n font = "; stream << ",\\\n font = ";
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
} }
/*
if (item->GetButtonFont())
{
stream << ",\\\n button_font = ";
OutputFont(stream, item->GetButtonFont());
}
*/
if (item->GetChildren().Number() > 0) if (item->GetChildren().Number() > 0)
stream << ",\\\n"; stream << ",\\\n";
else else
@@ -184,10 +180,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
} }
stream << ").\";\n\n"; stream << ").\";\n\n";
} }
else if (itemType == "wxButton") else if (itemType == "wxButton" || itemType == "wxBitmapButton")
{ {
GenerateButtonStyleString(item->GetStyle(), styleBuf); GenerateButtonStyleString(item->GetStyle(), styleBuf);
stream << "wxButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
if (item->GetValue4()) if (item->GetValue4())
@@ -198,10 +194,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
} }
} }
else if (itemType == "wxMessage") else if (itemType == "wxStaticText" || itemType == "wxStaticBitmap")
{ {
GenerateMessageStyleString(item->GetStyle(), styleBuf); GenerateMessageStyleString(item->GetStyle(), styleBuf);
stream << "wxMessage, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
if (item->GetValue4()) if (item->GetValue4())
@@ -225,7 +221,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
} }
} }
else if (itemType == "wxGroupBox") else if (itemType == "wxStaticBox")
{ {
GenerateGroupBoxStyleString(item->GetStyle(), styleBuf); GenerateGroupBoxStyleString(item->GetStyle(), styleBuf);
stream << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
@@ -237,10 +233,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
OutputFont(stream, item->GetFont()); OutputFont(stream, item->GetFont());
} }
} }
else if (itemType == "wxText" || itemType == "wxMultiText") else if (itemType == "wxText" || itemType == "wxMultiText" || itemType == "wxTextCtrl")
{ {
GenerateTextStyleString(item->GetStyle(), styleBuf); GenerateTextStyleString(item->GetStyle(), styleBuf);
stream << ((itemType == "wxText") ? "wxText, " : "wxMultiText, "); stream << "wxTextCtrl, ";
stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
stream << item->GetWidth() << ", " << item->GetHeight(); stream << item->GetWidth() << ", " << item->GetHeight();
@@ -524,7 +520,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
void wxResourceTableWithSaving::GenerateWindowStyleString(long windowStyle, char *buf) void wxResourceTableWithSaving::GenerateWindowStyleString(long windowStyle, char *buf)
{ {
GenerateStyle(buf, windowStyle, wxUSER_COLOURS, "wxUSER_COLOURS"); GenerateStyle(buf, windowStyle, wxNO_3D, "wxNO_3D");
GenerateStyle(buf, windowStyle, wxVSCROLL, "wxVSCROLL"); GenerateStyle(buf, windowStyle, wxVSCROLL, "wxVSCROLL");
GenerateStyle(buf, windowStyle, wxHSCROLL, "wxHSCROLL"); GenerateStyle(buf, windowStyle, wxHSCROLL, "wxHSCROLL");
GenerateStyle(buf, windowStyle, wxBORDER, "wxBORDER"); GenerateStyle(buf, windowStyle, wxBORDER, "wxBORDER");
@@ -598,6 +594,7 @@ void wxResourceTableWithSaving::GenerateTextStyleString(long windowStyle, char *
GenerateStyle(buf, windowStyle, wxTE_PROCESS_ENTER, "wxTE_PROCESS_ENTER"); GenerateStyle(buf, windowStyle, wxTE_PROCESS_ENTER, "wxTE_PROCESS_ENTER");
GenerateStyle(buf, windowStyle, wxTE_READONLY, "wxTE_READONLY"); GenerateStyle(buf, windowStyle, wxTE_READONLY, "wxTE_READONLY");
GenerateStyle(buf, windowStyle, wxTE_PASSWORD, "wxTE_PASSWORD"); GenerateStyle(buf, windowStyle, wxTE_PASSWORD, "wxTE_PASSWORD");
GenerateStyle(buf, windowStyle, wxTE_MULTILINE, "wxTE_MULTILINE");
if (strlen(buf) == 0) if (strlen(buf) == 0)
strcat(buf, "0"); strcat(buf, "0");

View File

@@ -61,29 +61,52 @@ bool wxResourcePropertyListView::OnClose(void)
GetManagedWindow()->GetSize(& w, & h); GetManagedWindow()->GetSize(& w, & h);
GetManagedWindow()->GetPosition(& x, & y); GetManagedWindow()->GetPosition(& x, & y);
wxResourceManager::currentResourceManager->propertyWindowSize.width = w; wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w;
wxResourceManager::currentResourceManager->propertyWindowSize.height = h; wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h;
wxResourceManager::currentResourceManager->propertyWindowSize.x = x; wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x;
wxResourceManager::currentResourceManager->propertyWindowSize.y = y; wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y;
return wxPropertyListView::OnClose(); return wxPropertyListView::OnClose();
} }
wxWindow *wxPropertyInfo::sm_propertyWindow;
/*
* wxDialogEditorPropertyListDialog
*/
wxDialogEditorPropertyListDialog::wxDialogEditorPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name):
wxPropertyListDialog(v, parent, title, pos, size, style, name)
{
m_propSheet = NULL;
m_propInfo = NULL;
}
wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog()
{
delete m_propSheet;
delete m_propInfo;
wxPropertyInfo::sm_propertyWindow = NULL;
}
/* /*
* wxPropertyInfo * wxPropertyInfo
*/ */
wxWindow *wxPropertyInfo::sm_propertyWindow;
// Edit the information represented by this object, whatever that // Edit the information represented by this object, whatever that
// might be. // might be.
bool wxPropertyInfo::Edit(wxWindow *parent, char *title) bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
{ {
int width = wxResourceManager::currentResourceManager->propertyWindowSize.width; if (sm_propertyWindow)
int height = wxResourceManager::currentResourceManager->propertyWindowSize.height; return FALSE;
int x = wxResourceManager::currentResourceManager->propertyWindowSize.x;
int y = wxResourceManager::currentResourceManager->propertyWindowSize.y; int width = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width;
int height = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height;
int x = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x;
int y = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y;
wxPropertySheet *propSheet = new wxPropertySheet; wxPropertySheet *propSheet = new wxPropertySheet;
wxStringList propNames; wxStringList propNames;
@@ -104,37 +127,33 @@ bool wxPropertyInfo::Edit(wxWindow *parent, char *title)
// Reset 'modified' flags for all property values // Reset 'modified' flags for all property values
propSheet->SetAllModified(FALSE); propSheet->SetAllModified(FALSE);
if (!title)
title = "Properties";
wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL, wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL,
#ifdef __XVIEW__ #ifdef __XVIEW__
wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL |
#endif #endif
wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES);
wxPropertyListDialog *propDialog = new wxPropertyListDialog(view, NULL, title, wxPoint(x, y), wxSize(width, height), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE); wxDialogEditorPropertyListDialog *propDialog = new wxDialogEditorPropertyListDialog(view,
wxResourceManager::GetCurrentResourceManager()->GetEditorFrame(), title, wxPoint(x, y),
wxSize(width, height), wxDEFAULT_DIALOG_STYLE);
sm_propertyWindow = propDialog; sm_propertyWindow = propDialog;
wxPropertyValidatorRegistry theValidatorRegistry; propDialog->m_registry.RegisterValidator((wxString)"real", new wxRealListValidator);
theValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator); propDialog->m_registry.RegisterValidator((wxString)"string", new wxStringListValidator);
theValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator); propDialog->m_registry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
theValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator); propDialog->m_registry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
theValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator); propDialog->m_registry.RegisterValidator((wxString)"filename", new wxFilenameListValidator);
theValidatorRegistry.RegisterValidator((wxString)"filename", new wxFilenameListValidator); propDialog->m_registry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
theValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
propDialog->m_propInfo = this;
propDialog->m_propSheet = propSheet;
// view->propertyWindow = propDialog; // view->propertyWindow = propDialog;
view->AddRegistry(&theValidatorRegistry); view->AddRegistry(&(propDialog->m_registry));
view->ShowView(propSheet, propDialog); view->ShowView(propSheet, propDialog);
int ret = propDialog->ShowModal(); propDialog->Show(TRUE);
sm_propertyWindow = NULL; return TRUE;
delete propSheet;
if ( ret == wxID_CANCEL )
return FALSE;
else
return TRUE;
} }
/* /*
@@ -288,13 +307,13 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
else if (name == "name") else if (name == "name")
{ {
// Remove old name from resource table, if it's there. // Remove old name from resource table, if it's there.
wxItemResource *oldResource = (wxItemResource *)wxResourceManager::currentResourceManager->GetResourceTable().Delete(propertyWindow->GetName()); wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(propertyWindow->GetName());
if (oldResource) if (oldResource)
{ {
// It's a top-level resource // It's a top-level resource
propertyWindow->SetName(property->GetValue().StringValue()); propertyWindow->SetName(property->GetValue().StringValue());
oldResource->SetName(property->GetValue().StringValue()); oldResource->SetName(property->GetValue().StringValue());
wxResourceManager::currentResourceManager->GetResourceTable().Put(propertyWindow->GetName(), oldResource); wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(propertyWindow->GetName(), oldResource);
} }
else else
{ {
@@ -303,7 +322,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
propertyResource->SetName(property->GetValue().StringValue()); propertyResource->SetName(property->GetValue().StringValue());
} }
// Refresh the resource manager list, because the name changed. // Refresh the resource manager list, because the name changed.
wxResourceManager::currentResourceManager->UpdateResourceList(); wxResourceManager::GetCurrentResourceManager()->UpdateResourceList();
return TRUE; return TRUE;
} }
else if (name == "title") else if (name == "title")
@@ -337,10 +356,12 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (width != newWidth) if (width != newWidth)
{ {
propertyWindow->SetSize(newWidth, height); propertyWindow->SetSize(newWidth, height);
/*
if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog))) if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
{ {
propertyWindow->GetParent()->SetClientSize(newWidth, height); propertyWindow->GetParent()->SetClientSize(newWidth, height);
} }
*/
} }
return TRUE; return TRUE;
} }
@@ -352,10 +373,12 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (height != newHeight) if (height != newHeight)
{ {
propertyWindow->SetSize(width, newHeight); propertyWindow->SetSize(width, newHeight);
/*
if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog))) if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
{ {
propertyWindow->GetParent()->SetClientSize(width, newHeight); propertyWindow->GetParent()->SetClientSize(width, newHeight);
} }
*/
} }
return TRUE; return TRUE;
} }
@@ -398,7 +421,7 @@ bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
/* /*
* Panel items * Controls
*/ */
wxProperty *wxItemPropertyInfo::GetProperty(wxString& name) wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
@@ -454,7 +477,7 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
wxControl *item = (wxControl *)propertyWindow; wxControl *item = (wxControl *)propertyWindow;
wxString str(item->GetLabel()); wxString str(item->GetLabel());
resource->SetTitle(WXSTRINGCAST str); resource->SetTitle(WXSTRINGCAST str);
if (item->GetFont()) if (item->GetFont() && item->GetFont()->Ok())
resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(), resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(),
item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(), item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(),
item->GetFont()->GetUnderlined(), item->GetFont()->GetFaceName())); item->GetFont()->GetUnderlined(), item->GetFont()->GetFaceName()));
@@ -468,65 +491,13 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name) wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name)
{ {
wxButton *button = (wxButton *)propertyWindow; wxButton *button = (wxButton *)propertyWindow;
/* return wxItemPropertyInfo::GetProperty(name);
if (name == "label" && isBitmapButton)
{
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(button);
wxString str("none.bmp");
if (resource)
{
char *filename = wxResourceManager::currentResourceManager->FindBitmapFilenameForResource(resource);
if (filename)
str = filename;
}
return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
}
else
*/
return wxItemPropertyInfo::GetProperty(name);
} }
bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property) bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{ {
wxButton *button = (wxButton *)propertyWindow; wxButton *button = (wxButton *)propertyWindow;
/* return wxItemPropertyInfo::SetProperty(name, property);
if (name == "label" && isBitmapButton)
{
char *s = property->GetValue().StringValue();
if (s && wxFileExists(s))
{
s = copystring(s);
wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP);
if (!bitmap->Ok())
{
delete bitmap;
delete[] s;
return FALSE;
}
else
{
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(button);
if (resource)
{
wxString oldResource(resource->GetValue4());
char *resName = wxResourceManager::currentResourceManager->AddBitmapResource(s);
resource->SetValue4(resName);
if (!oldResource.IsNull())
wxResourceManager::currentResourceManager->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
}
button->SetLabel(bitmap);
delete[] s;
return TRUE;
}
}
return FALSE;
}
else
*/
return wxItemPropertyInfo::SetProperty(name, property);
} }
void wxButtonPropertyInfo::GetPropertyNames(wxStringList& names) void wxButtonPropertyInfo::GetPropertyNames(wxStringList& names)
@@ -541,36 +512,135 @@ bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
} }
/* /*
* Message * wxBitmapButton
*/ */
wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name) wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
{ {
wxStaticText *message = (wxStaticText *)propertyWindow; wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
/* if (name == "label")
if (name == "label" && isBitmapMessage)
{ {
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
wxString str("none.bmp"); wxString str("none.bmp");
if (resource) if (resource)
{ {
char *filename = wxResourceManager::currentResourceManager->FindBitmapFilenameForResource(resource); char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
if (filename) if (filename)
str = filename; str = filename;
} }
return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
} }
else else
*/ return wxButtonPropertyInfo::GetProperty(name);
return wxItemPropertyInfo::GetProperty(name); }
bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
if (name == "label")
{
char *s = property->GetValue().StringValue();
if (s && wxFileExists(s))
{
s = copystring(s);
wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP);
if (!bitmap->Ok())
{
delete bitmap;
delete[] s;
return FALSE;
}
else
{
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
if (resource)
{
wxString oldResource(resource->GetValue4());
char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
resource->SetValue4(resName);
if (!oldResource.IsNull())
wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
}
button->SetLabel(bitmap);
delete[] s;
return TRUE;
}
}
return FALSE;
}
else
return wxButtonPropertyInfo::SetProperty(name, property);
}
void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList& names)
{
// names.Add("label");
wxButtonPropertyInfo::GetPropertyNames(names);
}
bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
{
return wxItemPropertyInfo::InstantiateResource(resource);
}
/*
* wxStaticText
*/
wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name)
{
wxStaticText *message = (wxStaticText *)propertyWindow;
return wxItemPropertyInfo::GetProperty(name);
} }
bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property) bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{ {
wxStaticText *message = (wxStaticText *)propertyWindow; wxStaticText *message = (wxStaticText *)propertyWindow;
return wxItemPropertyInfo::SetProperty(name, property);
}
void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names)
{
names.Add("label");
wxItemPropertyInfo::GetPropertyNames(names);
}
bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
{
return wxItemPropertyInfo::InstantiateResource(resource);
}
/* /*
if (name == "label" && isBitmapMessage) * wxStaticBitmap
*/
wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
{
wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
if (name == "label")
{
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
wxString str("none.bmp");
if (resource)
{
char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
if (filename)
str = filename;
}
return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
}
else
return wxItemPropertyInfo::GetProperty(name);
}
bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
if (name == "label")
{ {
char *s = property->GetValue().StringValue(); char *s = property->GetValue().StringValue();
if (s && wxFileExists(s)) if (s && wxFileExists(s))
@@ -586,18 +656,18 @@ bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
} }
else else
{ {
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
if (resource) if (resource)
{ {
wxString oldResource(resource->GetValue4()); wxString oldResource(resource->GetValue4());
char *resName = wxResourceManager::currentResourceManager->AddBitmapResource(s); char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
resource->SetValue4(resName); resource->SetValue4(resName);
if (!oldResource.IsNull()) if (!oldResource.IsNull())
wxResourceManager::currentResourceManager->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource); wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
} }
message->SetLabel(bitmap); message->SetBitmap(bitmap);
delete[] s; delete[] s;
return TRUE; return TRUE;
} }
@@ -605,17 +675,16 @@ bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
return FALSE; return FALSE;
} }
else else
*/
return wxItemPropertyInfo::SetProperty(name, property); return wxItemPropertyInfo::SetProperty(name, property);
} }
void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names) void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList& names)
{ {
names.Add("label"); names.Add("label");
wxItemPropertyInfo::GetPropertyNames(names); wxItemPropertyInfo::GetPropertyNames(names);
} }
bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource) bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
{ {
return wxItemPropertyInfo::InstantiateResource(resource); return wxItemPropertyInfo::InstantiateResource(resource);
} }
@@ -664,10 +733,10 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD) if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD)
flag -= wxTE_PASSWORD; flag -= wxTE_PASSWORD;
} }
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
resource->SetStyle(flag); resource->SetStyle(flag);
wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
return TRUE; return TRUE;
} }
else if (name == "readonly") else if (name == "readonly")
@@ -683,10 +752,10 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if ((flag & wxTE_READONLY) == wxTE_READONLY) if ((flag & wxTE_READONLY) == wxTE_READONLY)
flag -= wxTE_READONLY; flag -= wxTE_READONLY;
} }
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
resource->SetStyle(flag); resource->SetStyle(flag);
wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
return TRUE; return TRUE;
} }
else else
@@ -729,7 +798,7 @@ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
else if (name == "multiple") else if (name == "multiple")
{ {
char *pos = NULL; char *pos = NULL;
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
if (!resource) if (!resource)
return NULL; return NULL;
@@ -782,10 +851,10 @@ bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
mult = wxLB_EXTENDED; mult = wxLB_EXTENDED;
else else
mult = wxLB_SINGLE; mult = wxLB_SINGLE;
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
if (resource) if (resource)
resource->SetValue1(mult); resource->SetValue1(mult);
wxResourceManager::currentResourceManager->RecreateWindowFromResource(listBox, this); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
return TRUE; return TRUE;
} }
else else
@@ -926,7 +995,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (name == "numberRowsOrCols") if (name == "numberRowsOrCols")
{ {
radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue()); radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
return TRUE; return TRUE;
} }
else if (name == "orientation") else if (name == "orientation")
@@ -947,7 +1016,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
} }
radioBox->SetWindowStyleFlag(windowStyle); radioBox->SetWindowStyleFlag(windowStyle);
wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
return TRUE; return TRUE;
} }
else if (name == "values") else if (name == "values")
@@ -955,7 +1024,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
// Set property into *resource*, not wxRadioBox, and then recreate // Set property into *resource*, not wxRadioBox, and then recreate
// the wxRadioBox. This is because we can't dynamically set the strings // the wxRadioBox. This is because we can't dynamically set the strings
// of a wxRadioBox. // of a wxRadioBox.
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(propertyWindow); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
if (!resource) if (!resource)
return FALSE; return FALSE;
@@ -975,7 +1044,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
stringList->Add(s); stringList->Add(s);
expr = expr->GetNext(); expr = expr->GetNext();
} }
wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
return TRUE; return TRUE;
} }
return wxItemPropertyInfo::SetProperty(name, property); return wxItemPropertyInfo::SetProperty(name, property);
@@ -1142,7 +1211,7 @@ bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
int w, h; int w, h;
slider->GetSize(&w, &h); slider->GetSize(&w, &h);
slider = (wxSlider *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(slider, this); slider = (wxSlider *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider, this);
slider->SetSize(-1, -1, h, w); slider->SetSize(-1, -1, h, w);
return TRUE; return TRUE;
@@ -1307,7 +1376,7 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
int w, h; int w, h;
scrollBar->GetSize(&w, &h); scrollBar->GetSize(&w, &h);
scrollBar = (wxScrollBar *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(scrollBar, this); scrollBar = (wxScrollBar *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar, this);
scrollBar->SetSize(-1, -1, h, w); scrollBar->SetSize(-1, -1, h, w);
return TRUE; return TRUE;
@@ -1380,10 +1449,10 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" ||
name == "buttonFontUnderlined") name == "buttonFontUnderlined")
return GetFontProperty(name, buttonFont); return GetFontProperty(name, buttonFont);
else if (name == "userColours") else if (name == "no3D")
{ {
bool userColours; bool userColours;
if (panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) if (panelWindow->GetWindowStyleFlag() & wxNO_3D)
userColours = TRUE; userColours = TRUE;
else else
userColours = FALSE; userColours = FALSE;
@@ -1400,6 +1469,14 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
return new wxProperty(name, buf, "string", new wxColourListValidator); return new wxProperty(name, buf, "string", new wxColourListValidator);
} }
else if (name == "title")
{
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
if (resource)
return new wxProperty(name, resource->GetTitle(), "string");
else
return new wxProperty(name, "Could not get title", "string");
}
else else
return wxWindowPropertyInfo::GetProperty(name); return wxWindowPropertyInfo::GetProperty(name);
} }
@@ -1424,31 +1501,25 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
panelWindow->SetButtonFont(newFont); panelWindow->SetButtonFont(newFont);
return TRUE; return TRUE;
} }
else if (name == "userColours") else if (name == "no3D")
{ {
bool userColours = property->GetValue().BoolValue(); bool userColours = property->GetValue().BoolValue();
long flag = panelWindow->GetWindowStyleFlag(); long flag = panelWindow->GetWindowStyleFlag();
if (userColours) if (userColours)
{ {
if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) != wxUSER_COLOURS) if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) != wxNO_3D)
panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxUSER_COLOURS); panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxNO_3D);
} }
else else
{ {
if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) == wxUSER_COLOURS) if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) == wxNO_3D)
panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxUSER_COLOURS); panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxNO_3D);
} }
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(panelWindow); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
resource->SetStyle(panelWindow->GetWindowStyleFlag()); resource->SetStyle(panelWindow->GetWindowStyleFlag());
panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(panelWindow, this); panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
// panelWindow->SetUserEditMode(wxResourceManager::currentResourceManager->GetEditMode());
#ifdef __WINDOWS__
// This window should not be enabled by being recreated: we're in a modal dialog (property editor)
::EnableWindow((HWND) panelWindow->GetHWND(), FALSE);
::BringWindowToTop((HWND) sm_propertyWindow->GetHWND());
#endif
return TRUE; return TRUE;
} }
else if (name == "backgroundColour") else if (name == "backgroundColour")
@@ -1460,15 +1531,20 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
wxColour col(r,g,b); wxColour col(r,g,b);
panelWindow->SetBackgroundColour(col); panelWindow->SetBackgroundColour(col);
panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(panelWindow, this); panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
// panelWindow->SetUserEditMode(wxResourceManager::currentResourceManager->GetEditMode());
#ifdef __WINDOWS__
// This window should not be enabled by being recreated: we're in a modal dialog (property editor)
::EnableWindow((HWND) panelWindow->GetHWND(), FALSE);
::BringWindowToTop((HWND) sm_propertyWindow->GetHWND());
#endif
return TRUE; return TRUE;
} }
else if (name == "title")
{
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
if (resource)
{
resource->SetTitle(property->GetValue().StringValue());
return TRUE;
}
else
return FALSE;
}
else else
return wxWindowPropertyInfo::SetProperty(name, property); return wxWindowPropertyInfo::SetProperty(name, property);
} }
@@ -1477,8 +1553,8 @@ void wxPanelPropertyInfo::GetPropertyNames(wxStringList& names)
{ {
wxWindowPropertyInfo::GetPropertyNames(names); wxWindowPropertyInfo::GetPropertyNames(names);
// names.Add("orientation"); names.Add("title");
names.Add("userColours"); names.Add("no3D");
names.Add("backgroundColour"); names.Add("backgroundColour");
} }
@@ -1495,6 +1571,7 @@ bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource)
return wxWindowPropertyInfo::InstantiateResource(resource); return wxWindowPropertyInfo::InstantiateResource(resource);
} }
#if 0
/* /*
* Dialog boxes * Dialog boxes
*/ */
@@ -1504,7 +1581,7 @@ wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name)
wxDialog *dialogWindow = (wxDialog *)propertyWindow; wxDialog *dialogWindow = (wxDialog *)propertyWindow;
if (name == "modal") if (name == "modal")
{ {
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
if (!resource) if (!resource)
return NULL; return NULL;
@@ -1521,7 +1598,7 @@ bool wxDialogPropertyInfo::SetProperty(wxString& name, wxProperty *property)
if (name == "modal") if (name == "modal")
{ {
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
if (!resource) if (!resource)
return FALSE; return FALSE;
@@ -1548,6 +1625,7 @@ bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource)
return wxPanelPropertyInfo::InstantiateResource(resource); return wxPanelPropertyInfo::InstantiateResource(resource);
} }
#endif
/* /*
* Utilities * Utilities

View File

@@ -20,6 +20,21 @@
class wxPropertyInfo; class wxPropertyInfo;
class wxDialogEditorPropertyListDialog: public wxPropertyListDialog
{
friend class wxPropertyInfo;
public:
wxDialogEditorPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
~wxDialogEditorPropertyListDialog();
private:
wxPropertySheet* m_propSheet;
wxPropertyValidatorRegistry m_registry;
wxPropertyInfo* m_propInfo;
};
// A kind of property list view that intercepts OnPropertyChanged // A kind of property list view that intercepts OnPropertyChanged
// feedback. // feedback.
class wxResourcePropertyListView: public wxPropertyListView class wxResourcePropertyListView: public wxPropertyListView
@@ -42,6 +57,7 @@ class wxResourcePropertyListView: public wxPropertyListView
// them with separate classes. // them with separate classes.
class wxPropertyInfo: public wxObject class wxPropertyInfo: public wxObject
{ {
friend class wxDialogEditorPropertyListDialog;
protected: protected:
static wxWindow *sm_propertyWindow; static wxWindow *sm_propertyWindow;
wxPropertyInfo(void) wxPropertyInfo(void)
@@ -54,7 +70,7 @@ class wxPropertyInfo: public wxObject
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, char *title); virtual bool Edit(wxWindow *parent, const wxString& title);
}; };
// For all windows // For all windows
@@ -102,33 +118,55 @@ class wxButtonPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
bool isBitmapButton; wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmButton = FALSE): wxItemPropertyInfo(win, res) { }
wxItemPropertyInfo(win, res) { isBitmapButton = bmButton; }
~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);
inline bool IsBitmapButton(void) { return isBitmapButton; }
}; };
// For messages // 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);
};
// For static text controls
class wxStaticTextPropertyInfo: public wxItemPropertyInfo class wxStaticTextPropertyInfo: public wxItemPropertyInfo
{ {
protected: protected:
public: public:
bool isBitmapMessage; wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmMessage = FALSE): wxItemPropertyInfo(win, res) { }
wxItemPropertyInfo(win, res) { isBitmapMessage = bmMessage; }
~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);
};
inline bool IsBitmapMessage(void) { return isBitmapMessage; } // 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);
}; };
// For text/multitext items // For text/multitext items
@@ -271,20 +309,6 @@ class wxPanelPropertyInfo: public wxWindowPropertyInfo
bool InstantiateResource(wxItemResource *resource); bool InstantiateResource(wxItemResource *resource);
}; };
// For dialogs
class wxDialogPropertyInfo: public wxPanelPropertyInfo
{
protected:
public:
wxDialogPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxPanelPropertyInfo(win, res) {}
~wxDialogPropertyInfo(void) {}
wxProperty *GetProperty(wxString& name);
bool SetProperty(wxString& name, wxProperty *property);
void GetPropertyNames(wxStringList& names);
bool InstantiateResource(wxItemResource *resource);
};
int wxStringToFontWeight(wxString& val); int wxStringToFontWeight(wxString& val);
int wxStringToFontStyle(wxString& val); int wxStringToFontStyle(wxString& val);
int wxStringToFontFamily(wxString& val); int wxStringToFontFamily(wxString& val);