IMPLEMENT_DYNAMIC_CLASS(MyLayoutPanel, wxPanel)
+IMPLEMENT_DYNAMIC_CLASS(MyDrawingPanel, wxPanel)
+
BEGIN_EVENT_TABLE(RubyDialogFrame, wxDialog)
EVT_TIMER(-1, RubyDialogFrame::OnTimerEvent)
EVT_BUTTON(wxID_OK, RubyDialogFrame::OnDefaultButtonPressed)
if (ddx != 0 || ddy != 0)
sResizeSubWindows(dval, current, ddx, ddy);
current->SetSize(frame);
+#if defined(__WXMSW__)
+ if (current->IsKindOf(CLASSINFO(MyDrawingPanel))) {
+ // Cause repaint
+ current->Refresh();
+ }
+#endif
}
}
tc->Connect(-1, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(RubyDialogFrame::OnDialogItemAction), NULL, parent);
} else if (strcmp(type, "view") == 0) {
/* Panel */
- wxPanel *pn = new wxPanel(parent, -1, rect.GetPosition(), rect.GetSize());
+ MyDrawingPanel *pn = new MyDrawingPanel(parent, -1, rect.GetPosition(), rect.GetSize());
control = pn;
pn->Connect(-1, wxEVT_PAINT, wxPaintEventHandler(RubyDialogFrame::HandlePaintEvent), NULL, parent);
} else if (strcmp(type, "layout_view") == 0) {
tb->Create(parent, -1, rect.GetPosition(), rect.GetSize());
control = tb;
tb->SetDataSource(parent);
+#if defined(__WXMSW__)
+ // On Windows, extra resizing seems necessary to properly layout the subwindows
+ tb->SetSize(rect.width + 1, rect.height + 1);
+ tb->SetSize(rect.width, rect.height);
+#endif
} else return NULL;
if (title[0] != 0 || strcmp(type, "textfield") == 0) {
DECLARE_DYNAMIC_CLASS(MyLayoutPanel)
};
+/* MyDrawingPanel: an empty subclass of wxPanel exclusively used as "view" dialog item */
+class MyDrawingPanel: public wxPanel {
+public:
+ MyDrawingPanel(): wxPanel() {}
+ MyDrawingPanel(wxWindow *parent, wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize): wxPanel(parent, winid, pos, size) {}
+ virtual ~MyDrawingPanel() {}
+private:
+ DECLARE_DYNAMIC_CLASS(MyDrawingPanel)
+};
+
class RubyDialogFrame: public wxDialog, public MyListCtrlDataSource {
public:
RDItem **ditems;