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:
@@ -36,18 +36,26 @@ MyApp::MyApp(void)
|
||||
{
|
||||
}
|
||||
|
||||
wxResourceManager theResourceManager;
|
||||
wxResourceManager *theResourceManager = NULL;
|
||||
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
theResourceManager.Initialize();
|
||||
theResourceManager.ShowResourceEditor(TRUE);
|
||||
theResourceManager = new wxResourceManager;
|
||||
theResourceManager->Initialize();
|
||||
|
||||
theResourceManager->ShowResourceEditor(TRUE);
|
||||
|
||||
if (argc > 1)
|
||||
theResourceManager.Load(argv[1]);
|
||||
theResourceManager->Load(argv[1]);
|
||||
|
||||
SetTopWindow(theResourceManager.GetEditorFrame());
|
||||
SetTopWindow(theResourceManager->GetEditorFrame());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int MyApp::OnExit(void)
|
||||
{
|
||||
delete theResourceManager;
|
||||
theResourceManager = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ class MyApp: public wxApp
|
||||
public:
|
||||
MyApp(void);
|
||||
bool OnInit(void);
|
||||
int OnExit(void);
|
||||
};
|
||||
|
||||
DECLARE_APP(MyApp)
|
||||
|
@@ -1,7 +1,31 @@
|
||||
aaa ICON "dialoged.ico"
|
||||
DIALOGEDICON ICON "dialoged.ico"
|
||||
aaa ICON "bitmaps/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"
|
||||
|
||||
DIALOGBOXTOOL BITMAP "bitmaps/dialog.bmp"
|
||||
|
@@ -39,8 +39,7 @@
|
||||
#include "winprop.h"
|
||||
#include "editrpal.h"
|
||||
#include "dlghndlr.h"
|
||||
|
||||
extern void wxResourceEditWindow(wxWindow *win);
|
||||
#include "edlist.h"
|
||||
|
||||
IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler)
|
||||
IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler)
|
||||
@@ -75,6 +74,12 @@ wxResourceEditorDialogHandler::wxResourceEditorDialogHandler(wxPanel *dialog, wx
|
||||
oldDragY = 0;
|
||||
dragTolerance = 3;
|
||||
checkTolerance = TRUE;
|
||||
m_mouseCaptured = FALSE;
|
||||
// m_treeItem = 0;
|
||||
}
|
||||
|
||||
wxResourceEditorDialogHandler::~wxResourceEditorDialogHandler(void)
|
||||
{
|
||||
}
|
||||
|
||||
void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select)
|
||||
@@ -85,34 +90,6 @@ void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select)
|
||||
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)
|
||||
{
|
||||
wxPaintDC dc(handlerDialog);
|
||||
@@ -138,7 +115,99 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -168,6 +237,8 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
|
||||
return;
|
||||
}
|
||||
|
||||
wxResourceManager* manager = resourceManager;
|
||||
|
||||
switch (resourceManager->GetEditorPalette()->currentlySelected)
|
||||
{
|
||||
case PALETTE_FRAME:
|
||||
@@ -187,16 +258,16 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y, TRUE);
|
||||
break;
|
||||
case PALETTE_MESSAGE:
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y);
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y);
|
||||
break;
|
||||
case PALETTE_BITMAP_MESSAGE:
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y, TRUE);
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE);
|
||||
break;
|
||||
case PALETTE_TEXT:
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxText", x, y);
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y);
|
||||
break;
|
||||
case PALETTE_MULTITEXT:
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMultiText", x, y);
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y);
|
||||
break;
|
||||
case PALETTE_CHOICE:
|
||||
resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
|
||||
@@ -227,30 +298,27 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
|
||||
}
|
||||
|
||||
// Now switch pointer on.
|
||||
if (resourceManager->GetEditorPalette()->currentlySelected != PALETTE_ARROW)
|
||||
if (manager->GetEditorPalette()->currentlySelected != PALETTE_ARROW)
|
||||
{
|
||||
resourceManager->GetEditorPalette()->ToggleTool(resourceManager->GetEditorPalette()->currentlySelected, FALSE);
|
||||
resourceManager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE);
|
||||
resourceManager->GetEditorPalette()->currentlySelected = PALETTE_ARROW;
|
||||
manager->GetEditorPalette()->ToggleTool(manager->GetEditorPalette()->currentlySelected, FALSE);
|
||||
manager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE);
|
||||
manager->GetEditorPalette()->currentlySelected = PALETTE_ARROW;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys)
|
||||
{
|
||||
wxMenu *menu = resourceManager->GetPopupMenu();
|
||||
menu->SetClientData((char *)handlerDialog);
|
||||
#ifdef __MOTIF__
|
||||
handlerDialog->FakePopupMenu(menu, x, y);
|
||||
#else
|
||||
handlerDialog->PopupMenu(menu, x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int y, int keys)
|
||||
{
|
||||
if (keys & wxKEY_CTRL)
|
||||
{
|
||||
wxResourceEditWindow(item);
|
||||
wxResourceManager::GetCurrentResourceManager()->EditWindow(item);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -321,11 +389,7 @@ void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int
|
||||
|
||||
wxMenu *menu = resourceManager->GetPopupMenu();
|
||||
menu->SetClientData((char *)item);
|
||||
#ifdef __MOTIF__
|
||||
handlerDialog->FakePopupMenu(menu, x, y);
|
||||
#else
|
||||
handlerDialog->PopupMenu(menu, x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
// An event outside any items: may be a drag event.
|
||||
@@ -371,10 +435,26 @@ void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event)
|
||||
if (event.ControlDown()) keys = keys | wxKEY_CTRL;
|
||||
|
||||
if (event.LeftUp())
|
||||
{
|
||||
if (m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->ReleaseMouse();
|
||||
m_mouseCaptured = FALSE;
|
||||
}
|
||||
|
||||
OnLeftClick(x, y, keys);
|
||||
}
|
||||
else if (event.RightUp())
|
||||
{
|
||||
if (m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->ReleaseMouse();
|
||||
m_mouseCaptured = FALSE;
|
||||
}
|
||||
|
||||
OnRightClick(x, y, keys);
|
||||
}
|
||||
}
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
@@ -420,12 +500,27 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
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;
|
||||
wxClientDC dc(handlerDialog);
|
||||
childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
|
||||
oldDragX = x; oldDragY = y;
|
||||
if (!m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->CaptureMouse();
|
||||
m_mouseCaptured = TRUE;
|
||||
}
|
||||
}
|
||||
else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT)
|
||||
{
|
||||
@@ -439,10 +534,18 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
wxClientDC dc(handlerDialog);
|
||||
dragMode = wxDRAG_MODE_NONE;
|
||||
checkTolerance = TRUE;
|
||||
|
||||
childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle);
|
||||
childHandler->OnDragEnd(x, y, keys, dc, selectionHandle);
|
||||
|
||||
dragItem = NULL;
|
||||
dragType = wxDRAG_TYPE_NONE;
|
||||
|
||||
if (m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->ReleaseMouse();
|
||||
m_mouseCaptured = FALSE;
|
||||
}
|
||||
}
|
||||
else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT)
|
||||
{
|
||||
@@ -450,6 +553,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
dragMode = wxDRAG_MODE_CONTINUE_RIGHT;
|
||||
childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
|
||||
oldDragX = x; oldDragY = y;
|
||||
|
||||
if (!m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->CaptureMouse();
|
||||
m_mouseCaptured = TRUE;
|
||||
}
|
||||
}
|
||||
else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT)
|
||||
{
|
||||
@@ -461,6 +570,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
checkTolerance = TRUE;
|
||||
dragItem = NULL;
|
||||
dragType = wxDRAG_TYPE_NONE;
|
||||
|
||||
if (m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->ReleaseMouse();
|
||||
m_mouseCaptured = FALSE;
|
||||
}
|
||||
}
|
||||
else if (event.IsButton())
|
||||
{
|
||||
@@ -473,6 +588,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
firstDragX = x;
|
||||
firstDragY = y;
|
||||
dragType = selectionHandle;
|
||||
|
||||
if (!m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->CaptureMouse();
|
||||
m_mouseCaptured = TRUE;
|
||||
}
|
||||
}
|
||||
else if (event.RightDown())
|
||||
{
|
||||
@@ -481,6 +602,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
firstDragX = x;
|
||||
firstDragY = y;
|
||||
dragType = selectionHandle;
|
||||
|
||||
if (!m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->CaptureMouse();
|
||||
m_mouseCaptured = TRUE;
|
||||
}
|
||||
}
|
||||
else if (event.LeftUp())
|
||||
{
|
||||
@@ -490,6 +617,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
OnLeftClick(x, y, keys);
|
||||
|
||||
dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE;
|
||||
|
||||
if (m_mouseCaptured)
|
||||
{
|
||||
handlerDialog->ReleaseMouse();
|
||||
m_mouseCaptured = FALSE;
|
||||
}
|
||||
}
|
||||
else if (event.RightUp())
|
||||
{
|
||||
@@ -499,6 +632,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
|
||||
OnRightClick(x, y, keys);
|
||||
|
||||
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;
|
||||
dragOffsetX = 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.SetPen(wxBLACK_DASHED_PEN);
|
||||
wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
|
||||
dc.SetPen(pen);
|
||||
dc.SetBrush(wxTRANSPARENT_BRUSH);
|
||||
|
||||
dc.SetOptimization(TRUE);
|
||||
@@ -797,7 +942,8 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
|
||||
dc.BeginDrawing();
|
||||
|
||||
dc.SetLogicalFunction(wxXOR);
|
||||
dc.SetPen(wxBLACK_DASHED_PEN);
|
||||
wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
|
||||
dc.SetPen(pen);
|
||||
dc.SetBrush(wxTRANSPARENT_BRUSH);
|
||||
|
||||
DrawBoundingBox(dc, x1, y1, width1, height1);
|
||||
@@ -807,9 +953,9 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
|
||||
else
|
||||
{
|
||||
dc.BeginDrawing();
|
||||
|
||||
dc.SetLogicalFunction(wxXOR);
|
||||
dc.SetPen(wxBLACK_DASHED_PEN);
|
||||
wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
|
||||
dc.SetPen(pen);
|
||||
dc.SetBrush(wxTRANSPARENT_BRUSH);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
dc.EndDrawing();
|
||||
}
|
||||
}
|
||||
@@ -936,7 +1081,6 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
dc.SetOptimization(FALSE);
|
||||
|
||||
dc.SetLogicalFunction(wxCOPY);
|
||||
@@ -960,9 +1104,11 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
|
||||
// by default.
|
||||
void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
/*
|
||||
if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) ||
|
||||
(event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK))
|
||||
return;
|
||||
*/
|
||||
wxWindow *panel = handlerControl->GetParent();
|
||||
if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) )
|
||||
return;
|
||||
|
@@ -41,12 +41,12 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
|
||||
int firstDragY;
|
||||
int oldDragX;
|
||||
int oldDragY;
|
||||
bool m_mouseCaptured;
|
||||
// long m_treeItem;
|
||||
|
||||
wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
|
||||
wxResourceManager *manager);
|
||||
~wxResourceEditorDialogHandler(void) {}
|
||||
|
||||
bool OnClose(void);
|
||||
~wxResourceEditorDialogHandler(void);
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
@@ -64,6 +64,12 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
|
||||
void PaintSelectionHandles(wxDC& dc);
|
||||
void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
|
||||
|
||||
// Accessors
|
||||
/*
|
||||
inline long GetTreeItem() const { return m_treeItem; }
|
||||
inline void SetTreeItem(long item) { m_treeItem = item; }
|
||||
*/
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
@@ -79,11 +85,12 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
|
||||
bool isSelected;
|
||||
int handleSize; // selection handle size
|
||||
int handleMargin; // Distance between item edge and handle edge
|
||||
long m_treeItem;
|
||||
static int dragOffsetX; // Distance between pointer at start of drag and
|
||||
static int dragOffsetY; // top-left of item
|
||||
|
||||
wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler);
|
||||
~wxResourceEditorControlHandler(void) {}
|
||||
~wxResourceEditorControlHandler(void);
|
||||
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
|
||||
@@ -116,6 +123,12 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
|
||||
virtual void OnRightClick(int x, int y, int keys);
|
||||
virtual void OnSelect(bool select);
|
||||
|
||||
// Accessors
|
||||
/*
|
||||
inline long GetTreeItem() const { return m_treeItem; }
|
||||
inline void SetTreeItem(long item) { m_treeItem = item; }
|
||||
*/
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -38,28 +38,6 @@
|
||||
#include "reseditr.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__
|
||||
#include "bitmaps/frame.xbm"
|
||||
#include "bitmaps/dialog.xbm"
|
||||
@@ -142,23 +120,25 @@ void EditorToolPalette::OnMouseEnter(int toolIndex)
|
||||
case PALETTE_PANEL:
|
||||
managerFrame->SetStatusText("wxPanel");
|
||||
break;
|
||||
#if 0
|
||||
case PALETTE_CANVAS:
|
||||
managerFrame->SetStatusText("wxCanvas");
|
||||
break;
|
||||
case PALETTE_TEXT_WINDOW:
|
||||
managerFrame->SetStatusText("wxTextWindow");
|
||||
break;
|
||||
#endif
|
||||
case PALETTE_BUTTON:
|
||||
managerFrame->SetStatusText("wxButton");
|
||||
break;
|
||||
case PALETTE_MESSAGE:
|
||||
managerFrame->SetStatusText("wxMessage");
|
||||
managerFrame->SetStatusText("wxStaticText");
|
||||
break;
|
||||
case PALETTE_TEXT:
|
||||
managerFrame->SetStatusText("wxText");
|
||||
managerFrame->SetStatusText("wxTextCtrl (single-line)");
|
||||
break;
|
||||
case PALETTE_MULTITEXT:
|
||||
managerFrame->SetStatusText("wxMultiText");
|
||||
managerFrame->SetStatusText("wxTextCtrl (multi-line)");
|
||||
break;
|
||||
case PALETTE_CHOICE:
|
||||
managerFrame->SetStatusText("wxChoice");
|
||||
@@ -176,16 +156,16 @@ void EditorToolPalette::OnMouseEnter(int toolIndex)
|
||||
managerFrame->SetStatusText("wxSlider");
|
||||
break;
|
||||
case PALETTE_GROUPBOX:
|
||||
managerFrame->SetStatusText("wxGroupBox");
|
||||
managerFrame->SetStatusText("wxStaticBox");
|
||||
break;
|
||||
case PALETTE_GAUGE:
|
||||
managerFrame->SetStatusText("wxGauge");
|
||||
break;
|
||||
case PALETTE_BITMAP_MESSAGE:
|
||||
managerFrame->SetStatusText("Bitmap wxMessage");
|
||||
managerFrame->SetStatusText("wxStaticBitmap");
|
||||
break;
|
||||
case PALETTE_BITMAP_BUTTON:
|
||||
managerFrame->SetStatusText("Bitmap wxButton");
|
||||
managerFrame->SetStatusText("wxBitmapButton");
|
||||
break;
|
||||
case PALETTE_SCROLLBAR:
|
||||
managerFrame->SetStatusText("wxScrollBar");
|
||||
@@ -211,58 +191,44 @@ void EditorToolPalette::OnPaint(wxPaintEvent& event)
|
||||
dc.DrawLine(0, h-1, w, h-1);
|
||||
}
|
||||
|
||||
bool wxResourceManager::InitializeTools(void)
|
||||
EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
|
||||
{
|
||||
// Load palette bitmaps
|
||||
#ifdef __WINDOWS__
|
||||
PaletteFrameBitmap = new wxBitmap("FRAMETOOL");
|
||||
PaletteDialogBoxBitmap = new wxBitmap("DIALOGBOXTOOL");
|
||||
PalettePanelBitmap = new wxBitmap("PANELTOOL");
|
||||
PaletteCanvasBitmap = new wxBitmap("CANVASTOOL");
|
||||
PaletteTextWindowBitmap = new wxBitmap("TEXTWINDOWTOOL");
|
||||
PaletteMessageBitmap = new wxBitmap("MESSAGETOOL");
|
||||
PaletteButtonBitmap = new wxBitmap("BUTTONTOOL");
|
||||
PaletteCheckBoxBitmap = new wxBitmap("CHECKBOXTOOL");
|
||||
PaletteListBoxBitmap = new wxBitmap("LISTBOXTOOL");
|
||||
PaletteRadioBoxBitmap = new wxBitmap("RADIOBOXTOOL");
|
||||
PaletteChoiceBitmap = new wxBitmap("CHOICETOOL");
|
||||
PaletteTextBitmap = new wxBitmap("TEXTTOOL");
|
||||
PaletteMultiTextBitmap = new wxBitmap("MULTITEXTTOOL");
|
||||
PaletteSliderBitmap = new wxBitmap("SLIDERTOOL");
|
||||
PaletteArrowBitmap = new wxBitmap("ARROWTOOL");
|
||||
PaletteGroupBitmap = new wxBitmap("GROUPTOOL");
|
||||
PaletteGaugeBitmap = new wxBitmap("GAUGETOOL");
|
||||
PalettePictureBitmap = new wxBitmap("PICTURETOOL");
|
||||
PaletteBitmapButtonBitmap = new wxBitmap("BMPBUTTONTOOL");
|
||||
PaletteScrollbarBitmap = new wxBitmap("SCROLLBARTOOL");
|
||||
wxBitmap PaletteMessageBitmap("MESSAGETOOL");
|
||||
wxBitmap PaletteButtonBitmap("BUTTONTOOL");
|
||||
wxBitmap PaletteCheckBoxBitmap("CHECKBOXTOOL");
|
||||
wxBitmap PaletteListBoxBitmap("LISTBOXTOOL");
|
||||
wxBitmap PaletteRadioBoxBitmap("RADIOBOXTOOL");
|
||||
wxBitmap PaletteChoiceBitmap("CHOICETOOL");
|
||||
wxBitmap PaletteTextBitmap("TEXTTOOL");
|
||||
wxBitmap PaletteMultiTextBitmap("MULTITEXTTOOL");
|
||||
wxBitmap PaletteSliderBitmap("SLIDERTOOL");
|
||||
wxBitmap PaletteArrowBitmap("ARROWTOOL");
|
||||
wxBitmap PaletteGroupBitmap("GROUPTOOL");
|
||||
wxBitmap PaletteGaugeBitmap("GAUGETOOL");
|
||||
wxBitmap PalettePictureBitmap("PICTURETOOL");
|
||||
wxBitmap PaletteBitmapButtonBitmap("BMPBUTTONTOOL");
|
||||
wxBitmap PaletteScrollbarBitmap("SCROLLBARTOOL");
|
||||
#endif
|
||||
#ifdef __X__
|
||||
PaletteFrameBitmap = new wxBitmap(frame_bits, frame_width, frame_height);
|
||||
PaletteDialogBoxBitmap = new wxBitmap(dialog_bits, dialog_width, dialog_height);
|
||||
PalettePanelBitmap = new wxBitmap(panel_bits, panel_width, panel_height);
|
||||
PaletteCanvasBitmap = new wxBitmap(canvas_bits, canvas_width, canvas_height);
|
||||
PaletteTextWindowBitmap = new wxBitmap(textsw_bits, textsw_width, textsw_height);
|
||||
PaletteMessageBitmap = new wxBitmap(message_bits, message_width, message_height);
|
||||
PaletteButtonBitmap = new wxBitmap(button_bits, button_width, button_height);
|
||||
PaletteCheckBoxBitmap = new wxBitmap(check_bits, check_width, check_height);
|
||||
PaletteListBoxBitmap = new wxBitmap(listbox_bits, listbox_width, listbox_height);
|
||||
PaletteRadioBoxBitmap = new wxBitmap(radio_bits, radio_width, radio_height);
|
||||
PaletteChoiceBitmap = new wxBitmap(choice_bits, choice_width, choice_height);
|
||||
PaletteTextBitmap = new wxBitmap(text_bits, text_width, text_height);
|
||||
PaletteMultiTextBitmap = new wxBitmap(mtext_bits, mtext_width, mtext_height);
|
||||
PaletteSliderBitmap = new wxBitmap(slider_bits, slider_width, slider_height);
|
||||
PaletteArrowBitmap = new wxBitmap(arrow_bits, arrow_width, arrow_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);
|
||||
wxBitmap PaletteMessageBitmap(message_bits, message_width, message_height);
|
||||
wxBitmap PaletteButtonBitmap(button_bits, button_width, button_height);
|
||||
wxBitmap PaletteCheckBoxBitmap(check_bits, check_width, check_height);
|
||||
wxBitmap PaletteListBoxBitmap(listbox_bits, listbox_width, listbox_height);
|
||||
wxBitmap PaletteRadioBoxBitmap(radio_bits, radio_width, radio_height);
|
||||
wxBitmap PaletteChoiceBitmap(choice_bits, choice_width, choice_height);
|
||||
wxBitmap PaletteTextBitmap(text_bits, text_width, text_height);
|
||||
wxBitmap PaletteMultiTextBitmap(mtext_bits, mtext_width, mtext_height);
|
||||
wxBitmap PaletteSliderBitmap(slider_bits, slider_width, slider_height);
|
||||
wxBitmap PaletteArrowBitmap(arrow_bits, arrow_width, arrow_height);
|
||||
wxBitmap PaletteGroupBitmap(group_bits, group_width, group_height);
|
||||
wxBitmap PaletteGaugeBitmap(gauge_bits, gauge_width, gauge_height);
|
||||
wxBitmap PalettePictureBitmap(picture_bits, picture_width, picture_height);
|
||||
wxBitmap PaletteBitmapButtonBitmap(bmpbuttn_bits, bmpbuttn_width, bmpbuttn_height);
|
||||
wxBitmap PaletteScrollbarBitmap(scroll_bits, scroll_width, scroll_height);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
|
||||
{
|
||||
EditorToolPalette *palette = new EditorToolPalette(this, parent, 0, 0, -1, -1, wxNO_BORDER, // wxTB_3DBUTTONS,
|
||||
wxVERTICAL, 1);
|
||||
|
||||
@@ -274,28 +240,19 @@ EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
|
||||
#endif
|
||||
*/
|
||||
|
||||
// palette->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
|
||||
palette->AddTool(PALETTE_ARROW, PaletteArrowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Pointer");
|
||||
/*
|
||||
palette->AddTool(PALETTE_FRAME, PaletteFrameBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxFrame");
|
||||
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_MESSAGE, PaletteMessageBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticText");
|
||||
palette->AddTool(PALETTE_BITMAP_MESSAGE, PalettePictureBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticBitmap");
|
||||
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_RADIOBOX, PaletteRadioBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxRadioBox");
|
||||
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_TEXT, PaletteTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxText");
|
||||
palette->AddTool(PALETTE_MULTITEXT, PaletteMultiTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxMultiText");
|
||||
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, "wxTextCtrl (multi-line)");
|
||||
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_SCROLLBAR, PaletteScrollbarBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxScrollBar");
|
||||
|
||||
|
144
utils/dialoged/src/edlist.cpp
Normal file
144
utils/dialoged/src/edlist.cpp
Normal 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);
|
||||
}
|
||||
|
||||
|
38
utils/dialoged/src/edlist.h
Normal file
38
utils/dialoged/src/edlist.h
Normal 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
|
||||
|
92
utils/dialoged/src/edtree.cpp
Normal file
92
utils/dialoged/src/edtree.cpp
Normal 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);
|
||||
}
|
||||
|
36
utils/dialoged/src/edtree.h
Normal file
36
utils/dialoged/src/edtree.h
Normal 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
|
||||
|
@@ -25,7 +25,7 @@ LOCALDOCDIR=$(WXDIR)\utils\dialoged\docs
|
||||
|
||||
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
|
||||
|
||||
@@ -72,6 +72,16 @@ reseditr.obj: winprop.h reseditr.h editrpal.h reseditr.$(SRCSUFF) $(DUMMYOB
|
||||
$(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)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -22,25 +22,45 @@
|
||||
#include "wx/string.h"
|
||||
#include "wx/layout.h"
|
||||
#include "wx/resource.h"
|
||||
#include "wx/tbarsmpl.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "wx/imaglist.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_TOGGLE_TEST_MODE 2
|
||||
#define RESED_RECREATE 3
|
||||
#define RESED_CLEAR 4
|
||||
#define RESED_NEW_DIALOG 5
|
||||
#define RESED_NEW_PANEL 6
|
||||
#define RESED_TEST 10
|
||||
|
||||
#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).
|
||||
*/
|
||||
@@ -49,6 +69,8 @@ class wxResourceEditorFrame;
|
||||
class EditorToolPalette;
|
||||
class EditorToolBar;
|
||||
class wxWindowPropertyInfo;
|
||||
class wxResourceEditorProjectTree;
|
||||
class wxResourceEditorControlList;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#define wxHelpController wxWinHelpController
|
||||
@@ -88,7 +110,7 @@ class wxHelpController;
|
||||
class wxResourceTableWithSaving: public wxResourceTable
|
||||
{
|
||||
public:
|
||||
wxResourceTableWithSaving(void):wxResourceTable()
|
||||
wxResourceTableWithSaving():wxResourceTable()
|
||||
{
|
||||
}
|
||||
virtual bool Save(const wxString& filename);
|
||||
@@ -117,80 +139,73 @@ class wxResourceTableWithSaving: public wxResourceTable
|
||||
wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource);
|
||||
};
|
||||
|
||||
class wxResourceEditorScrolledWindow;
|
||||
|
||||
class wxResourceManager: public wxObject
|
||||
{
|
||||
protected:
|
||||
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;
|
||||
friend class wxResourceEditorFrame;
|
||||
|
||||
public:
|
||||
public:
|
||||
wxResourceManager();
|
||||
~wxResourceManager();
|
||||
|
||||
// Options to be saved/restored
|
||||
wxString optionsResourceFilename; // e.g. dialoged.ini, .dialogrc
|
||||
wxRectangle propertyWindowSize;
|
||||
wxRectangle resourceEditorWindowSize;
|
||||
// Operations
|
||||
|
||||
public:
|
||||
static wxResourceManager *currentResourceManager;
|
||||
// Initializes the resource manager
|
||||
bool Initialize();
|
||||
|
||||
wxResourceManager(void);
|
||||
~wxResourceManager(void);
|
||||
|
||||
bool Initialize(void);
|
||||
|
||||
bool LoadOptions(void);
|
||||
bool SaveOptions(void);
|
||||
// Load/save window size etc.
|
||||
bool LoadOptions();
|
||||
bool SaveOptions();
|
||||
|
||||
// Show or hide the resource editor frame, which displays a list
|
||||
// of resources with ability to edit them.
|
||||
virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor");
|
||||
|
||||
virtual bool Save(void);
|
||||
virtual bool SaveAs(void);
|
||||
virtual bool Save();
|
||||
virtual bool SaveAs();
|
||||
virtual bool Save(const wxString& filename);
|
||||
virtual bool Load(const wxString& filename);
|
||||
virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
|
||||
virtual void SetFrameTitle(const wxString& filename);
|
||||
virtual bool DisassociateWindows(bool deleteWindows = TRUE);
|
||||
virtual void ClearCurrentDialog();
|
||||
virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
|
||||
virtual bool SaveIfModified(void);
|
||||
virtual bool SaveIfModified();
|
||||
virtual void AlignItems(int flag);
|
||||
virtual void CopySize(void);
|
||||
virtual void CopySize();
|
||||
virtual void ToBackOrFront(bool toBack);
|
||||
virtual wxWindow *FindParentOfSelection(void);
|
||||
virtual wxWindow *FindParentOfSelection();
|
||||
|
||||
virtual wxFrame *OnCreateEditorFrame(const char *title);
|
||||
virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
|
||||
virtual wxPanel *OnCreateEditorPanel(wxFrame *parent);
|
||||
virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
|
||||
virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent);
|
||||
virtual EditorToolPalette *OnCreatePalette(wxFrame *parent);
|
||||
// virtual bool DeletePalette(void);
|
||||
virtual bool InitializeTools(void);
|
||||
|
||||
virtual void UpdateResourceList(void);
|
||||
virtual void AddItemsRecursively(int level, wxItemResource *resource);
|
||||
virtual bool EditSelectedResource(void);
|
||||
// Create a window information object for the give window
|
||||
wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
|
||||
// Edit the given window
|
||||
void EditWindow(wxWindow *win);
|
||||
|
||||
virtual void UpdateResourceList();
|
||||
virtual void AddItemsRecursively(long parent, wxItemResource *resource);
|
||||
virtual bool EditSelectedResource();
|
||||
virtual bool Edit(wxItemResource *res);
|
||||
virtual bool CreateNewDialog(void);
|
||||
virtual bool CreateNewPanel(void);
|
||||
virtual bool CreateNewPanel();
|
||||
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(wxWindow *win, bool deleteWindow = TRUE);
|
||||
virtual bool DeleteResource(wxWindow *win);
|
||||
|
||||
// Add bitmap resource if there isn't already one with this 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.
|
||||
virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL);
|
||||
|
||||
virtual bool RecreateSelection(void);
|
||||
virtual bool RecreateSelection();
|
||||
|
||||
// Need to search through resource table removing this from
|
||||
// any resource which has this as a parent.
|
||||
@@ -218,116 +233,129 @@ class wxResourceManager: public wxObject
|
||||
|
||||
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 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);
|
||||
|
||||
// (Dis)associate resource<->physical window
|
||||
// Doesn't delete any windows.
|
||||
virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
|
||||
virtual bool DisassociateResource(wxItemResource *resource, bool deleteWindow = TRUE);
|
||||
virtual bool DisassociateResource(wxWindow *win, bool deleteWindow = TRUE);
|
||||
virtual bool DisassociateResource(wxItemResource *resource);
|
||||
virtual bool DisassociateResource(wxWindow *win);
|
||||
virtual bool DisassociateWindows();
|
||||
virtual wxItemResource *FindResourceForWindow(wxWindow *win);
|
||||
virtual wxWindow *FindWindowForResource(wxItemResource *resource);
|
||||
|
||||
virtual bool InstantiateAllResourcesFromWindows(void);
|
||||
virtual bool InstantiateAllResourcesFromWindows();
|
||||
virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
|
||||
|
||||
virtual void Modify(bool mod = TRUE) { modified = mod; }
|
||||
virtual bool Modified(void) { return modified; }
|
||||
// Accessors
|
||||
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; }
|
||||
void SetEditMode(bool flag, bool changeCurrentResource = TRUE);
|
||||
inline void Modify(bool mod = TRUE) { m_modified = mod; }
|
||||
inline bool Modified() const { return m_modified; }
|
||||
|
||||
inline wxResourceTable& GetResourceTable(void) { return resourceTable; }
|
||||
inline wxHashTable& GetResourceAssociations(void) { return resourceAssociations; }
|
||||
inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
|
||||
inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
|
||||
|
||||
inline wxString& GetCurrentFilename(void) { return currentFilename; }
|
||||
inline wxString& GetCurrentFilename() { return m_currentFilename; }
|
||||
static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
|
||||
|
||||
// void UsePosition(bool usePos, wxItemResource *resource = NULL, int x = 0, int y = 0);
|
||||
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
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(wxResourceEditorFrame)
|
||||
|
||||
wxResourceManager *manager;
|
||||
wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, char *title, int x = -1, int y = -1, int width = 600, int height = 400,
|
||||
long style = 0, char *name = "frame");
|
||||
~wxResourceEditorFrame(void);
|
||||
void OldOnMenuCommand(int cmd);
|
||||
bool OnClose(void);
|
||||
wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400),
|
||||
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
~wxResourceEditorFrame();
|
||||
|
||||
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:
|
||||
wxResourceEditorPanel(wxWindow *parent, int x = -1, int y = -1, int width = 600, int height = 400,
|
||||
long style = 0, char *name = "panel");
|
||||
~wxResourceEditorPanel(void);
|
||||
void OnDefaultAction(wxControl *item);
|
||||
};
|
||||
wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
~wxResourceEditorScrolledWindow();
|
||||
|
||||
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:
|
||||
DialogEditorPanelFrame(wxFrame *parent, char *title, int x, int y, int w, int h, long style, char *name):
|
||||
wxFrame(parent, -1, title, wxPoint(x, y), wxSize(w, h), style, name)
|
||||
{
|
||||
}
|
||||
bool OnClose(void);
|
||||
wxWindow* m_childWindow;
|
||||
private:
|
||||
int m_marginX, m_marginY;
|
||||
|
||||
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_DELETE 2
|
||||
|
||||
@@ -336,16 +364,10 @@ class DialogEditorPanelFrame: public wxFrame
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__WINDOWS__) && defined(__WIN95__)
|
||||
class EditorToolBar: public wxToolBar95
|
||||
#elif defined(__WINDOWS__)
|
||||
class EditorToolBar: public wxToolBarMSW
|
||||
#else
|
||||
class EditorToolBar: public wxToolBarSimple
|
||||
#endif
|
||||
class EditorToolBar: public wxToolBar
|
||||
{
|
||||
public:
|
||||
EditorToolBar(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,
|
||||
public:
|
||||
EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
|
||||
long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2);
|
||||
bool OnLeftClick(int toolIndex, bool toggled);
|
||||
void OnMouseEnter(int toolIndex);
|
||||
@@ -358,7 +380,6 @@ DECLARE_EVENT_TABLE()
|
||||
#define TOOLBAR_LOAD_FILE 1
|
||||
#define TOOLBAR_SAVE_FILE 2
|
||||
#define TOOLBAR_NEW 3
|
||||
// #define TOOLBAR_GEN_CLIPS 4
|
||||
#define TOOLBAR_TREE 5
|
||||
#define TOOLBAR_HELP 6
|
||||
|
||||
|
@@ -51,7 +51,7 @@ wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, wxItemResource
|
||||
{
|
||||
wxControl *item = wxResourceTable::CreateItem(panel, childResource);
|
||||
if (item)
|
||||
wxResourceManager::currentResourceManager->GetResourceAssociations().Put((long)childResource, item);
|
||||
wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item);
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -113,10 +113,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
stream << " style = '" << styleBuf << "',\\\n";
|
||||
stream << " title = '" << item->GetTitle() << "',\\\n";
|
||||
stream << " x = " << item->GetX() << ", y = " << item->GetY();
|
||||
stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight() << ",\\\n";
|
||||
stream << " modal = " << item->GetValue1();
|
||||
stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight();
|
||||
// stream << " modal = " << item->GetValue1();
|
||||
|
||||
if (item->GetStyle() & wxUSER_COLOURS)
|
||||
if (1) // item->GetStyle() & wxNO_3D)
|
||||
{
|
||||
if (item->GetBackgroundColour())
|
||||
{
|
||||
@@ -128,6 +128,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
|
||||
stream << ",\\\n " << "background_colour = '" << buf << "'";
|
||||
}
|
||||
#if 0
|
||||
if (item->GetLabelColour())
|
||||
{
|
||||
char buf[7];
|
||||
@@ -148,20 +149,15 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
|
||||
stream << ",\\\n " << "button_colour = '" << buf << "'";
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if (item->GetFont())
|
||||
if (item->GetFont() && item->GetFont()->Ok())
|
||||
{
|
||||
stream << ",\\\n font = ";
|
||||
OutputFont(stream, item->GetFont());
|
||||
}
|
||||
/*
|
||||
if (item->GetButtonFont())
|
||||
{
|
||||
stream << ",\\\n button_font = ";
|
||||
OutputFont(stream, item->GetButtonFont());
|
||||
}
|
||||
*/
|
||||
|
||||
if (item->GetChildren().Number() > 0)
|
||||
stream << ",\\\n";
|
||||
@@ -184,10 +180,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
}
|
||||
stream << ").\";\n\n";
|
||||
}
|
||||
else if (itemType == "wxButton")
|
||||
else if (itemType == "wxButton" || itemType == "wxBitmapButton")
|
||||
{
|
||||
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 << item->GetWidth() << ", " << item->GetHeight();
|
||||
if (item->GetValue4())
|
||||
@@ -198,10 +194,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
OutputFont(stream, item->GetFont());
|
||||
}
|
||||
}
|
||||
else if (itemType == "wxMessage")
|
||||
else if (itemType == "wxStaticText" || itemType == "wxStaticBitmap")
|
||||
{
|
||||
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 << item->GetWidth() << ", " << item->GetHeight();
|
||||
if (item->GetValue4())
|
||||
@@ -225,7 +221,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
OutputFont(stream, item->GetFont());
|
||||
}
|
||||
}
|
||||
else if (itemType == "wxGroupBox")
|
||||
else if (itemType == "wxStaticBox")
|
||||
{
|
||||
GenerateGroupBoxStyleString(item->GetStyle(), styleBuf);
|
||||
stream << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
|
||||
@@ -237,10 +233,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
OutputFont(stream, item->GetFont());
|
||||
}
|
||||
}
|
||||
else if (itemType == "wxText" || itemType == "wxMultiText")
|
||||
else if (itemType == "wxText" || itemType == "wxMultiText" || itemType == "wxTextCtrl")
|
||||
{
|
||||
GenerateTextStyleString(item->GetStyle(), styleBuf);
|
||||
stream << ((itemType == "wxText") ? "wxText, " : "wxMultiText, ");
|
||||
stream << "wxTextCtrl, ";
|
||||
stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
|
||||
stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
|
||||
stream << item->GetWidth() << ", " << item->GetHeight();
|
||||
@@ -524,7 +520,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
|
||||
|
||||
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, wxHSCROLL, "wxHSCROLL");
|
||||
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_READONLY, "wxTE_READONLY");
|
||||
GenerateStyle(buf, windowStyle, wxTE_PASSWORD, "wxTE_PASSWORD");
|
||||
GenerateStyle(buf, windowStyle, wxTE_MULTILINE, "wxTE_MULTILINE");
|
||||
|
||||
if (strlen(buf) == 0)
|
||||
strcat(buf, "0");
|
||||
|
@@ -61,28 +61,51 @@ bool wxResourcePropertyListView::OnClose(void)
|
||||
GetManagedWindow()->GetSize(& w, & h);
|
||||
GetManagedWindow()->GetPosition(& x, & y);
|
||||
|
||||
wxResourceManager::currentResourceManager->propertyWindowSize.width = w;
|
||||
wxResourceManager::currentResourceManager->propertyWindowSize.height = h;
|
||||
wxResourceManager::currentResourceManager->propertyWindowSize.x = x;
|
||||
wxResourceManager::currentResourceManager->propertyWindowSize.y = y;
|
||||
wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w;
|
||||
wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h;
|
||||
wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x;
|
||||
wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
wxWindow *wxPropertyInfo::sm_propertyWindow;
|
||||
|
||||
// Edit the information represented by this object, whatever that
|
||||
// might be.
|
||||
bool wxPropertyInfo::Edit(wxWindow *parent, char *title)
|
||||
bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
|
||||
{
|
||||
int width = wxResourceManager::currentResourceManager->propertyWindowSize.width;
|
||||
int height = wxResourceManager::currentResourceManager->propertyWindowSize.height;
|
||||
int x = wxResourceManager::currentResourceManager->propertyWindowSize.x;
|
||||
int y = wxResourceManager::currentResourceManager->propertyWindowSize.y;
|
||||
if (sm_propertyWindow)
|
||||
return FALSE;
|
||||
|
||||
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;
|
||||
|
||||
@@ -104,36 +127,32 @@ bool wxPropertyInfo::Edit(wxWindow *parent, char *title)
|
||||
// Reset 'modified' flags for all property values
|
||||
propSheet->SetAllModified(FALSE);
|
||||
|
||||
if (!title)
|
||||
title = "Properties";
|
||||
wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL,
|
||||
#ifdef __XVIEW__
|
||||
wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL |
|
||||
#endif
|
||||
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;
|
||||
|
||||
wxPropertyValidatorRegistry theValidatorRegistry;
|
||||
theValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator);
|
||||
theValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator);
|
||||
theValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
|
||||
theValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
|
||||
theValidatorRegistry.RegisterValidator((wxString)"filename", new wxFilenameListValidator);
|
||||
theValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
|
||||
propDialog->m_registry.RegisterValidator((wxString)"real", new wxRealListValidator);
|
||||
propDialog->m_registry.RegisterValidator((wxString)"string", new wxStringListValidator);
|
||||
propDialog->m_registry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
|
||||
propDialog->m_registry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
|
||||
propDialog->m_registry.RegisterValidator((wxString)"filename", new wxFilenameListValidator);
|
||||
propDialog->m_registry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
|
||||
|
||||
propDialog->m_propInfo = this;
|
||||
propDialog->m_propSheet = propSheet;
|
||||
|
||||
// view->propertyWindow = propDialog;
|
||||
view->AddRegistry(&theValidatorRegistry);
|
||||
view->AddRegistry(&(propDialog->m_registry));
|
||||
view->ShowView(propSheet, propDialog);
|
||||
|
||||
int ret = propDialog->ShowModal();
|
||||
sm_propertyWindow = NULL;
|
||||
delete propSheet;
|
||||
|
||||
if ( ret == wxID_CANCEL )
|
||||
return FALSE;
|
||||
else
|
||||
propDialog->Show(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -288,13 +307,13 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
else if (name == "name")
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
// It's a top-level resource
|
||||
propertyWindow->SetName(property->GetValue().StringValue());
|
||||
oldResource->SetName(property->GetValue().StringValue());
|
||||
wxResourceManager::currentResourceManager->GetResourceTable().Put(propertyWindow->GetName(), oldResource);
|
||||
wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(propertyWindow->GetName(), oldResource);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -303,7 +322,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
propertyResource->SetName(property->GetValue().StringValue());
|
||||
}
|
||||
// Refresh the resource manager list, because the name changed.
|
||||
wxResourceManager::currentResourceManager->UpdateResourceList();
|
||||
wxResourceManager::GetCurrentResourceManager()->UpdateResourceList();
|
||||
return TRUE;
|
||||
}
|
||||
else if (name == "title")
|
||||
@@ -337,10 +356,12 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
if (width != newWidth)
|
||||
{
|
||||
propertyWindow->SetSize(newWidth, height);
|
||||
/*
|
||||
if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
propertyWindow->GetParent()->SetClientSize(newWidth, height);
|
||||
}
|
||||
*/
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -352,10 +373,12 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
if (height != newHeight)
|
||||
{
|
||||
propertyWindow->SetSize(width, newHeight);
|
||||
/*
|
||||
if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
propertyWindow->GetParent()->SetClientSize(width, newHeight);
|
||||
}
|
||||
*/
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -398,7 +421,7 @@ bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
|
||||
|
||||
/*
|
||||
* Panel items
|
||||
* Controls
|
||||
*/
|
||||
|
||||
wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
|
||||
@@ -454,7 +477,7 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
wxControl *item = (wxControl *)propertyWindow;
|
||||
wxString str(item->GetLabel());
|
||||
resource->SetTitle(WXSTRINGCAST str);
|
||||
if (item->GetFont())
|
||||
if (item->GetFont() && item->GetFont()->Ok())
|
||||
resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(),
|
||||
item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(),
|
||||
item->GetFont()->GetUnderlined(), item->GetFont()->GetFaceName()));
|
||||
@@ -468,64 +491,12 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
wxButton *button = (wxButton *)propertyWindow;
|
||||
/*
|
||||
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)
|
||||
{
|
||||
wxButton *button = (wxButton *)propertyWindow;
|
||||
/*
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
/*
|
||||
if (name == "label" && isBitmapMessage)
|
||||
wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
|
||||
if (name == "label")
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
|
||||
wxString str("none.bmp");
|
||||
|
||||
if (resource)
|
||||
{
|
||||
char *filename = wxResourceManager::currentResourceManager->FindBitmapFilenameForResource(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 wxButtonPropertyInfo::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)
|
||||
{
|
||||
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();
|
||||
if (s && wxFileExists(s))
|
||||
@@ -586,18 +656,18 @@ bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
|
||||
if (resource)
|
||||
{
|
||||
wxString oldResource(resource->GetValue4());
|
||||
char *resName = wxResourceManager::currentResourceManager->AddBitmapResource(s);
|
||||
char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
|
||||
resource->SetValue4(resName);
|
||||
|
||||
if (!oldResource.IsNull())
|
||||
wxResourceManager::currentResourceManager->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
|
||||
wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
|
||||
}
|
||||
|
||||
message->SetLabel(bitmap);
|
||||
message->SetBitmap(bitmap);
|
||||
delete[] s;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -605,17 +675,16 @@ bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
*/
|
||||
return wxItemPropertyInfo::SetProperty(name, property);
|
||||
}
|
||||
|
||||
void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names)
|
||||
void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList& names)
|
||||
{
|
||||
names.Add("label");
|
||||
wxItemPropertyInfo::GetPropertyNames(names);
|
||||
}
|
||||
|
||||
bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
{
|
||||
return wxItemPropertyInfo::InstantiateResource(resource);
|
||||
}
|
||||
@@ -664,10 +733,10 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD)
|
||||
flag -= wxTE_PASSWORD;
|
||||
}
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
|
||||
resource->SetStyle(flag);
|
||||
|
||||
wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this);
|
||||
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
|
||||
return TRUE;
|
||||
}
|
||||
else if (name == "readonly")
|
||||
@@ -683,10 +752,10 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
if ((flag & wxTE_READONLY) == wxTE_READONLY)
|
||||
flag -= wxTE_READONLY;
|
||||
}
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
|
||||
resource->SetStyle(flag);
|
||||
|
||||
wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this);
|
||||
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -729,7 +798,7 @@ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
|
||||
else if (name == "multiple")
|
||||
{
|
||||
char *pos = NULL;
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
|
||||
if (!resource)
|
||||
return NULL;
|
||||
|
||||
@@ -782,10 +851,10 @@ bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
mult = wxLB_EXTENDED;
|
||||
else
|
||||
mult = wxLB_SINGLE;
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
|
||||
if (resource)
|
||||
resource->SetValue1(mult);
|
||||
wxResourceManager::currentResourceManager->RecreateWindowFromResource(listBox, this);
|
||||
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -926,7 +995,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
if (name == "numberRowsOrCols")
|
||||
{
|
||||
radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
|
||||
wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this);
|
||||
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
|
||||
return TRUE;
|
||||
}
|
||||
else if (name == "orientation")
|
||||
@@ -947,7 +1016,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
}
|
||||
radioBox->SetWindowStyleFlag(windowStyle);
|
||||
|
||||
wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this);
|
||||
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
|
||||
return TRUE;
|
||||
}
|
||||
else if (name == "values")
|
||||
@@ -955,7 +1024,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
// Set property into *resource*, not wxRadioBox, and then recreate
|
||||
// the wxRadioBox. This is because we can't dynamically set the strings
|
||||
// of a wxRadioBox.
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(propertyWindow);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
|
||||
if (!resource)
|
||||
return FALSE;
|
||||
|
||||
@@ -975,7 +1044,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
stringList->Add(s);
|
||||
expr = expr->GetNext();
|
||||
}
|
||||
wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this);
|
||||
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
|
||||
return TRUE;
|
||||
}
|
||||
return wxItemPropertyInfo::SetProperty(name, property);
|
||||
@@ -1142,7 +1211,7 @@ bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
int 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);
|
||||
|
||||
return TRUE;
|
||||
@@ -1307,7 +1376,7 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
int 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);
|
||||
|
||||
return TRUE;
|
||||
@@ -1380,10 +1449,10 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
|
||||
else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" ||
|
||||
name == "buttonFontUnderlined")
|
||||
return GetFontProperty(name, buttonFont);
|
||||
else if (name == "userColours")
|
||||
else if (name == "no3D")
|
||||
{
|
||||
bool userColours;
|
||||
if (panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS)
|
||||
if (panelWindow->GetWindowStyleFlag() & wxNO_3D)
|
||||
userColours = TRUE;
|
||||
else
|
||||
userColours = FALSE;
|
||||
@@ -1400,6 +1469,14 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
|
||||
|
||||
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
|
||||
return wxWindowPropertyInfo::GetProperty(name);
|
||||
}
|
||||
@@ -1424,31 +1501,25 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
panelWindow->SetButtonFont(newFont);
|
||||
return TRUE;
|
||||
}
|
||||
else if (name == "userColours")
|
||||
else if (name == "no3D")
|
||||
{
|
||||
bool userColours = property->GetValue().BoolValue();
|
||||
long flag = panelWindow->GetWindowStyleFlag();
|
||||
|
||||
if (userColours)
|
||||
{
|
||||
if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) != wxUSER_COLOURS)
|
||||
panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxUSER_COLOURS);
|
||||
if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) != wxNO_3D)
|
||||
panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxNO_3D);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) == wxUSER_COLOURS)
|
||||
panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxUSER_COLOURS);
|
||||
if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) == wxNO_3D)
|
||||
panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxNO_3D);
|
||||
}
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(panelWindow);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
|
||||
resource->SetStyle(panelWindow->GetWindowStyleFlag());
|
||||
|
||||
panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->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
|
||||
panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
|
||||
return TRUE;
|
||||
}
|
||||
else if (name == "backgroundColour")
|
||||
@@ -1460,15 +1531,20 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
|
||||
wxColour col(r,g,b);
|
||||
panelWindow->SetBackgroundColour(col);
|
||||
panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->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
|
||||
panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
|
||||
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
|
||||
return wxWindowPropertyInfo::SetProperty(name, property);
|
||||
}
|
||||
@@ -1477,8 +1553,8 @@ void wxPanelPropertyInfo::GetPropertyNames(wxStringList& names)
|
||||
{
|
||||
wxWindowPropertyInfo::GetPropertyNames(names);
|
||||
|
||||
// names.Add("orientation");
|
||||
names.Add("userColours");
|
||||
names.Add("title");
|
||||
names.Add("no3D");
|
||||
names.Add("backgroundColour");
|
||||
}
|
||||
|
||||
@@ -1495,6 +1571,7 @@ bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
return wxWindowPropertyInfo::InstantiateResource(resource);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Dialog boxes
|
||||
*/
|
||||
@@ -1504,7 +1581,7 @@ wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name)
|
||||
wxDialog *dialogWindow = (wxDialog *)propertyWindow;
|
||||
if (name == "modal")
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
|
||||
if (!resource)
|
||||
return NULL;
|
||||
|
||||
@@ -1521,7 +1598,7 @@ bool wxDialogPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
|
||||
if (name == "modal")
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow);
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
|
||||
if (!resource)
|
||||
return FALSE;
|
||||
|
||||
@@ -1548,6 +1625,7 @@ bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
|
||||
return wxPanelPropertyInfo::InstantiateResource(resource);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Utilities
|
||||
|
@@ -20,6 +20,21 @@
|
||||
|
||||
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
|
||||
// feedback.
|
||||
class wxResourcePropertyListView: public wxPropertyListView
|
||||
@@ -42,6 +57,7 @@ class wxResourcePropertyListView: public wxPropertyListView
|
||||
// them with separate classes.
|
||||
class wxPropertyInfo: public wxObject
|
||||
{
|
||||
friend class wxDialogEditorPropertyListDialog;
|
||||
protected:
|
||||
static wxWindow *sm_propertyWindow;
|
||||
wxPropertyInfo(void)
|
||||
@@ -54,7 +70,7 @@ class wxPropertyInfo: public wxObject
|
||||
virtual wxProperty *GetProperty(wxString& propName) = 0;
|
||||
virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
|
||||
virtual void GetPropertyNames(wxStringList& names) = 0;
|
||||
virtual bool Edit(wxWindow *parent, char *title);
|
||||
virtual bool Edit(wxWindow *parent, const wxString& title);
|
||||
};
|
||||
|
||||
// For all windows
|
||||
@@ -102,33 +118,55 @@ class wxButtonPropertyInfo: public wxItemPropertyInfo
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
bool isBitmapButton;
|
||||
wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmButton = FALSE):
|
||||
wxItemPropertyInfo(win, res) { isBitmapButton = bmButton; }
|
||||
wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxButtonPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
|
||||
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
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
bool isBitmapMessage;
|
||||
wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmMessage = FALSE):
|
||||
wxItemPropertyInfo(win, res) { isBitmapMessage = bmMessage; }
|
||||
wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
|
||||
wxItemPropertyInfo(win, res) { }
|
||||
~wxStaticTextPropertyInfo(void) {}
|
||||
wxProperty *GetProperty(wxString& name);
|
||||
bool SetProperty(wxString& name, wxProperty *property);
|
||||
void GetPropertyNames(wxStringList& names);
|
||||
bool InstantiateResource(wxItemResource *resource);
|
||||
};
|
||||
|
||||
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
|
||||
@@ -271,20 +309,6 @@ class wxPanelPropertyInfo: public wxWindowPropertyInfo
|
||||
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 wxStringToFontStyle(wxString& val);
|
||||
int wxStringToFontFamily(wxString& val);
|
||||
|
Reference in New Issue
Block a user