-1->wxID_ANY, TRUE->true, FALSE->false and tabs replacements.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
class SashHtmlWindow : public wxHtmlWindow {
|
||||
public:
|
||||
SashHtmlWindow(wxWindow *parent, wxWindowID id = -1,
|
||||
SashHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxHW_SCROLLBAR_NEVER, const wxString& name = wxT("sashHtmlWindow"));
|
||||
|
||||
@@ -62,23 +62,23 @@ wxT("manages the scrollbars provided by <TT>wxDynamicSashWindow</TT> itself.");
|
||||
bool Demo::OnInit() {
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
wxFrame *frame = new wxFrame(NULL, -1, wxT("Dynamic Sash Demo"));
|
||||
wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxT("Dynamic Sash Demo"));
|
||||
frame->SetSize(480, 480);
|
||||
|
||||
wxDynamicSashWindow *sash = new wxDynamicSashWindow(frame, -1);
|
||||
wxHtmlWindow *html = new SashHtmlWindow(sash, -1);
|
||||
wxDynamicSashWindow *sash = new wxDynamicSashWindow(frame, wxID_ANY);
|
||||
wxHtmlWindow *html = new SashHtmlWindow(sash, wxID_ANY);
|
||||
html->SetPage(HTML_content);
|
||||
|
||||
frame->Show();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
SashHtmlWindow::SashHtmlWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name) :
|
||||
wxHtmlWindow(parent, id, pos, size, style, name) {
|
||||
Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxDynamicSashSplitEventFunction)&SashHtmlWindow::OnSplit);
|
||||
|
||||
@@ -97,6 +97,6 @@ wxSize SashHtmlWindow::DoGetBestSize() const {
|
||||
}
|
||||
|
||||
void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) {
|
||||
wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, -1);
|
||||
wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, wxID_ANY);
|
||||
html->SetPage(HTML_content);
|
||||
}
|
||||
|
@@ -65,14 +65,14 @@ IMPLEMENT_APP(SwitchDemo)
|
||||
|
||||
|
||||
SwitchView::SwitchView(wxDynamicSashWindow *win) {
|
||||
Create(win, -1);
|
||||
Create(win, wxID_ANY);
|
||||
|
||||
m_dyn_sash = win;
|
||||
|
||||
m_bar = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, wxT("bar"));
|
||||
m_choice = new wxChoice(m_bar, -1);
|
||||
m_bar = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, wxT("bar"));
|
||||
m_choice = new wxChoice(m_bar, wxID_ANY);
|
||||
m_choice->SetEventHandler(this);
|
||||
m_view = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, 0, wxT("view"));
|
||||
m_view = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, wxT("view"));
|
||||
m_view->SetBackgroundColour(*wxWHITE);
|
||||
m_view->SetEventHandler(this);
|
||||
|
||||
@@ -119,41 +119,41 @@ SwitchView::SwitchView(wxDynamicSashWindow *win) {
|
||||
(wxEventFunction)
|
||||
(wxPaintEventFunction)&SwitchView::OnPaint);
|
||||
|
||||
Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SET_FOCUS, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxFocusEventFunction)&SwitchView::OnFocus);
|
||||
Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_TOP, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxScrollEventFunction)&SwitchView::OnScroll);
|
||||
Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxEraseEventFunction)&SwitchView::OnErase);
|
||||
|
||||
Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxDynamicSashSplitEventFunction)&SwitchView::OnSplit);
|
||||
Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)
|
||||
Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxDynamicSashUnifyEventFunction)&SwitchView::OnUnify);
|
||||
}
|
||||
@@ -252,12 +252,12 @@ bool SwitchDemo::OnInit() {
|
||||
wxFrame *frame;
|
||||
wxDynamicSashWindow *dyn;
|
||||
|
||||
frame = new wxFrame(NULL, -1, wxT("Dynamic Sash Window Switch Demo"));
|
||||
dyn = new wxDynamicSashWindow(frame, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
|
||||
frame = new wxFrame(NULL, wxID_ANY, wxT("Dynamic Sash Window Switch Demo"));
|
||||
dyn = new wxDynamicSashWindow(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
|
||||
new SwitchView(dyn);
|
||||
|
||||
frame->SetSize(480, 480);
|
||||
frame->Show();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
@@ -25,17 +25,17 @@ IMPLEMENT_APP(MyApp)
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
wxDialog dlg(NULL, -1, _("Test dialog"), wxDefaultPosition, wxDefaultSize,
|
||||
wxDialog dlg(NULL, wxID_ANY, _("Test dialog"), wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
||||
|
||||
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(new wxEditableListBox(&dlg, -1, _("Match these wildcards:"),
|
||||
sizer->Add(new wxEditableListBox(&dlg, wxID_ANY, _("Match these wildcards:"),
|
||||
wxDefaultPosition,wxSize(300,200)),
|
||||
1, wxEXPAND|wxALL, 10);
|
||||
|
||||
sizer->Add(5,5);
|
||||
|
||||
wxEditableListBox *lb = new wxEditableListBox(&dlg, -1, _("Except:"),
|
||||
wxEditableListBox *lb = new wxEditableListBox(&dlg, wxID_ANY, _("Except:"),
|
||||
wxDefaultPosition,wxSize(300,200));
|
||||
wxArrayString ar;
|
||||
ar.Add(_T("*.cpp"));
|
||||
@@ -48,10 +48,10 @@ bool MyApp::OnInit()
|
||||
sizer->Add(5,5);
|
||||
|
||||
sizer->Add(new wxButton(&dlg, wxID_OK, _("OK")), 0, wxALIGN_RIGHT | wxALL, 10);
|
||||
dlg.SetAutoLayout(TRUE);
|
||||
dlg.SetAutoLayout(true);
|
||||
dlg.SetSizer(sizer);
|
||||
sizer->Fit(&dlg);
|
||||
dlg.Centre();
|
||||
dlg.Centre();
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
@@ -61,5 +61,5 @@ bool MyApp::OnInit()
|
||||
res << ar[i] << _T("\n");
|
||||
wxMessageBox(res);
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
@@ -165,12 +165,12 @@ bool MyApp::OnInit()
|
||||
|
||||
// and show it (the frames, unlike simple controls, are not shown when
|
||||
// created initially)
|
||||
frame->Show(TRUE);
|
||||
frame->Show(true);
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned FALSE here, the
|
||||
// loop and the application will run. If we returned false here, the
|
||||
// application would exit immediately.
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -179,7 +179,7 @@ bool MyApp::OnInit()
|
||||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxFrame(NULL, -1, title, pos, size, style)
|
||||
: wxFrame(NULL, wxID_ANY, title, pos, size, style)
|
||||
{
|
||||
#if wxUSE_MENUS
|
||||
// create a menu bar
|
||||
@@ -202,7 +202,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->AppendCheckItem(LED_Edit_DrawFaded, _T("Draw &Faded\tCtrl-F"));
|
||||
|
||||
editMenu->Check(LED_Edit_DrawFaded, TRUE);
|
||||
editMenu->Check(LED_Edit_DrawFaded, true);
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
@@ -222,8 +222,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// TRUE is to force the frame to close
|
||||
Close(TRUE);
|
||||
// true is to force the frame to close
|
||||
Close(true);
|
||||
}
|
||||
|
||||
void MyFrame::OnIncrement(wxCommandEvent& WXUNUSED(event))
|
||||
|
@@ -1,194 +1,194 @@
|
||||
/*
|
||||
* File: mtest.cpp
|
||||
* Purpose: wxMultiCellSizer and wxMultiCellCanvas test
|
||||
* Author: Alex Andruschak
|
||||
* Created: 2000
|
||||
* Updated:
|
||||
* File: mtest.cpp
|
||||
* Purpose: wxMultiCellSizer and wxMultiCellCanvas test
|
||||
* Author: Alex Andruschak
|
||||
* Created: 2000
|
||||
* Updated:
|
||||
* Copyright:
|
||||
*/
|
||||
|
||||
static const char sccsid[] = "%W% %G%";
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gizmos/multicell.h"
|
||||
|
||||
class MyApp: public wxApp
|
||||
{public:
|
||||
bool OnInit(void);
|
||||
bool OnInit(void);
|
||||
};
|
||||
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
|
||||
public:
|
||||
MyFrame(int type, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
MyFrame(int type, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
wxMultiCellSizer *sizer;
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
wxMultiCellSizer *sizer;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
MyFrame *frame = new MyFrame(1, (wxFrame *) NULL, wxT("wxMultiCellSizer Sample"), wxPoint(50, 50), wxDefaultSize); //, wxSize(600, 500));
|
||||
MyFrame *frame = new MyFrame(1, (wxFrame *) NULL, wxT("wxMultiCellSizer Sample"), wxPoint(50, 50), wxDefaultSize); //, wxSize(600, 500));
|
||||
|
||||
frame->Show(TRUE);
|
||||
frame->Show(true);
|
||||
|
||||
SetTopWindow(frame);
|
||||
frame = new MyFrame(2, (wxFrame *) NULL, wxT("wxMultiCellCanvas Sample"), wxPoint(100, 100), wxSize(600, 500));
|
||||
SetTopWindow(frame);
|
||||
frame = new MyFrame(2, (wxFrame *) NULL, wxT("wxMultiCellCanvas Sample"), wxPoint(100, 100), wxSize(600, 500));
|
||||
|
||||
frame->Show(TRUE);
|
||||
frame->Show(true);
|
||||
|
||||
SetTopWindow(frame);
|
||||
return TRUE;
|
||||
SetTopWindow(frame);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MyFrame::MyFrame(int type, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||
wxFrame(frame, -1, title, pos, size, wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL)
|
||||
wxFrame(frame, wxID_ANY, title, pos, size, wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL)
|
||||
{
|
||||
CreateStatusBar(1);
|
||||
sizer = NULL;
|
||||
if (type == 1)
|
||||
{
|
||||
// create sizer 4 columns 5 rows
|
||||
wxSize aa(4,9);
|
||||
sizer = new wxMultiCellSizer(aa);
|
||||
sizer->SetDefaultCellSize(wxSize(15,15));
|
||||
sizer->SetRowHeight(7,5,TRUE);
|
||||
sizer->SetRowHeight(8,5,FALSE);
|
||||
// add first row
|
||||
sizer->Add(
|
||||
new wxButton( this, -1,wxT( "B1 - 0,0, horizontal resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,0,1,1, wxDefaultSize, wxHORIZONTAL_RESIZABLE, wxSize(2,2)));
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B2 - 0,1, vertical resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,1,1,1, wxDefaultSize, wxVERTICAL_RESIZABLE, wxSize(2, 2)));
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B3 - 0,2")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,2,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_CENTER_HORIZONTAL)); //, wxALIGN_CENTER));
|
||||
sizer->Add(
|
||||
new wxStaticText(this, -1, wxT("jbb 0,3, lower-right")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,3,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_BOTTOM | wxALIGN_RIGHT));
|
||||
CreateStatusBar(1);
|
||||
sizer = NULL;
|
||||
if (type == 1)
|
||||
{
|
||||
// create sizer 4 columns 5 rows
|
||||
wxSize aa(4,9);
|
||||
sizer = new wxMultiCellSizer(aa);
|
||||
sizer->SetDefaultCellSize(wxSize(15,15));
|
||||
sizer->SetRowHeight(7,5,true);
|
||||
sizer->SetRowHeight(8,5,false);
|
||||
// add first row
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT( "B1 - 0,0, horizontal resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,0,1,1, wxDefaultSize, wxHORIZONTAL_RESIZABLE, wxSize(2,2)));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B2 - 0,1, vertical resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,1,1,1, wxDefaultSize, wxVERTICAL_RESIZABLE, wxSize(2, 2)));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B3 - 0,2")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,2,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_CENTER_HORIZONTAL)); //, wxALIGN_CENTER));
|
||||
sizer->Add(
|
||||
new wxStaticText(this, wxID_ANY, wxT("jbb 0,3, lower-right")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(0,3,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_BOTTOM | wxALIGN_RIGHT));
|
||||
|
||||
// add button for secord row
|
||||
sizer->Add(
|
||||
new wxTextCtrl(this, -1, wxT("Text control - 1,0, 4 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(1,0,1,4));
|
||||
// add button for secord row
|
||||
sizer->Add(
|
||||
new wxTextCtrl(this, wxID_ANY, wxT("Text control - 1,0, 4 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(1,0,1,4));
|
||||
|
||||
// add buttons for next row
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B6 - 2,0, 2 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(2,0,1,2));
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B7 - 2,3")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(2,3,1,1));
|
||||
// add buttons for next row
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B6 - 2,0, 2 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(2,0,1,2));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B7 - 2,3")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(2,3,1,1));
|
||||
|
||||
// and last additions
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B8 - 3,0, 4 rows high, vert resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(3,0,4,1,wxDefaultSize, wxVERTICAL_RESIZABLE));
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B9 - 3,2, 2 cols wide, vert resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(3,2,1,2,wxDefaultSize, wxVERTICAL_RESIZABLE));
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B10 - 4,1, 3 cols wide, vert resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(4,1,1,3,wxDefaultSize, wxVERTICAL_RESIZABLE));
|
||||
// and last additions
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B8 - 3,0, 4 rows high, vert resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(3,0,4,1,wxDefaultSize, wxVERTICAL_RESIZABLE));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B9 - 3,2, 2 cols wide, vert resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(3,2,1,2,wxDefaultSize, wxVERTICAL_RESIZABLE));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B10 - 4,1, 3 cols wide, vert resizable")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(4,1,1,3,wxDefaultSize, wxVERTICAL_RESIZABLE));
|
||||
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B11 - 5,1, 3 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(5,1,1,3));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B11 - 5,1, 3 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(5,1,1,3));
|
||||
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B12 - 6,1, 3 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(6,1,1,3));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B12 - 6,1, 3 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(6,1,1,3));
|
||||
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B13 - 7,1, 2 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(7,1,1,2));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B13 - 7,1, 2 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(7,1,1,2));
|
||||
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("B14 - 8,1, 3 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(8,1,1,3));
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("B14 - 8,1, 3 cols wide")),
|
||||
0, 0, 0, new wxMultiCellItemHandle(8,1,1,3));
|
||||
|
||||
SetAutoLayout( TRUE );
|
||||
// sizer->SetMinSize(sizer->CalcMin());
|
||||
SetSizer( sizer );
|
||||
wxSize s = sizer->CalcMin();
|
||||
wxSize c = GetSize() - GetClientSize();
|
||||
SetSizeHints(s.GetWidth() + c.GetWidth() , s.GetHeight() + c.GetHeight());
|
||||
sizer->EnableGridLines(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create sizer 4 columns 5 rows
|
||||
wxMultiCellCanvas *sizer = new wxMultiCellCanvas(this, 5,5);
|
||||
SetAutoLayout( true );
|
||||
// sizer->SetMinSize(sizer->CalcMin());
|
||||
SetSizer( sizer );
|
||||
wxSize s = sizer->CalcMin();
|
||||
wxSize c = GetSize() - GetClientSize();
|
||||
SetSizeHints(s.GetWidth() + c.GetWidth() , s.GetHeight() + c.GetHeight());
|
||||
sizer->EnableGridLines(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create sizer 4 columns 5 rows
|
||||
wxMultiCellCanvas *sizer = new wxMultiCellCanvas(this, 5,5);
|
||||
|
||||
// add first row
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 1")),
|
||||
0, 0);
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 2")),
|
||||
0, 1);
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 3")),
|
||||
0, 2);
|
||||
sizer->Add(
|
||||
new wxStaticText(this, -1, wxT("jbb test")),
|
||||
0, 3);
|
||||
// add first row
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 1")),
|
||||
0, 0);
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 2")),
|
||||
0, 1);
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 3")),
|
||||
0, 2);
|
||||
sizer->Add(
|
||||
new wxStaticText(this, wxID_ANY, wxT("jbb test")),
|
||||
0, 3);
|
||||
|
||||
sizer->Add(
|
||||
new wxStaticText(this, -1, wxT("jbb test 2")),
|
||||
0, 4);
|
||||
sizer->Add(
|
||||
new wxStaticText(this, wxID_ANY, wxT("jbb test 2")),
|
||||
0, 4);
|
||||
|
||||
// add button for secord row
|
||||
sizer->Add(
|
||||
new wxTextCtrl(this, -1, wxT("Text control")),
|
||||
1, 0);
|
||||
// add button for secord row
|
||||
sizer->Add(
|
||||
new wxTextCtrl(this, wxID_ANY, wxT("Text control")),
|
||||
1, 0);
|
||||
|
||||
// add buttons for next row
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 6")),
|
||||
2, 0);
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 7")),
|
||||
2, 3);
|
||||
// add buttons for next row
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 6")),
|
||||
2, 0);
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 7")),
|
||||
2, 3);
|
||||
|
||||
// and last additions
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 8")),
|
||||
3, 0);
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 9")),
|
||||
3, 1);
|
||||
sizer->Add(
|
||||
new wxButton( this, -1, wxT("Button 10")),
|
||||
4, 1);
|
||||
// and last additions
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 8")),
|
||||
3, 0);
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 9")),
|
||||
3, 1);
|
||||
sizer->Add(
|
||||
new wxButton( this, wxID_ANY, wxT("Button 10")),
|
||||
4, 1);
|
||||
|
||||
sizer->CalculateConstraints();
|
||||
SetSizer( sizer );
|
||||
SetAutoLayout( TRUE );
|
||||
}
|
||||
sizer->CalculateConstraints();
|
||||
SetSizer( sizer );
|
||||
SetAutoLayout( true );
|
||||
}
|
||||
}
|
||||
// Define the repainting behaviour
|
||||
|
||||
@@ -200,16 +200,16 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
|
||||
void MyFrame::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
wxPaintDC dc(this);
|
||||
|
||||
if (sizer)
|
||||
{
|
||||
sizer->OnPaint(dc);
|
||||
}
|
||||
if (sizer)
|
||||
{
|
||||
sizer->OnPaint(dc);
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
||||
{
|
||||
Destroy();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
@@ -138,12 +138,12 @@ bool MyApp::OnInit()
|
||||
|
||||
// and show it (the frames, unlike simple controls, are not shown when
|
||||
// created initially)
|
||||
frame->Show(TRUE);
|
||||
frame->Show(true);
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned FALSE here, the
|
||||
// loop and the application will run. If we returned false here, the
|
||||
// application would exit immediately.
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -155,7 +155,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, idMAIN_FRAME, title, pos, size)
|
||||
{
|
||||
m_splitter = NULL;
|
||||
m_scrolledWindow = NULL;
|
||||
m_scrolledWindow = NULL;
|
||||
m_tree = NULL;
|
||||
m_valueWindow = NULL;
|
||||
#ifdef __WXMAC__
|
||||
@@ -165,26 +165,26 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#endif
|
||||
|
||||
m_scrolledWindow = new wxSplitterScrolledWindow(this, idSCROLLED_WINDOW, wxDefaultPosition,
|
||||
wxSize(300, 400), wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL);
|
||||
wxSize(300, 400), wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL);
|
||||
m_splitter = new wxThinSplitterWindow(m_scrolledWindow, idSPLITTER_WINDOW, wxDefaultPosition,
|
||||
wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */);
|
||||
m_splitter->SetSashSize(2);
|
||||
wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */);
|
||||
m_splitter->SetSashSize(2);
|
||||
|
||||
/* Note the wxTR_ROW_LINES style: draws horizontal lines between items */
|
||||
/* Note the wxTR_ROW_LINES style: draws horizontal lines between items */
|
||||
m_tree = new TestTree(m_splitter , idTREE_CTRL, wxDefaultPosition,
|
||||
wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER | wxTR_ROW_LINES );
|
||||
wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER | wxTR_ROW_LINES );
|
||||
m_valueWindow = new TestValueWindow(m_splitter, idVALUE_WINDOW, wxDefaultPosition,
|
||||
wxDefaultSize, wxNO_BORDER);
|
||||
wxDefaultSize, wxNO_BORDER);
|
||||
m_splitter->SplitVertically(m_tree, m_valueWindow);
|
||||
//m_splitter->AdjustScrollbars();
|
||||
m_splitter->SetSashPosition(200);
|
||||
m_scrolledWindow->SetTargetWindow(m_tree);
|
||||
//m_splitter->AdjustScrollbars();
|
||||
m_splitter->SetSashPosition(200);
|
||||
m_scrolledWindow->SetTargetWindow(m_tree);
|
||||
|
||||
m_scrolledWindow->EnableScrolling(FALSE, FALSE);
|
||||
m_scrolledWindow->EnableScrolling(false, false);
|
||||
|
||||
// Let the two controls know about each other
|
||||
m_valueWindow->SetTreeCtrl(m_tree);
|
||||
m_tree->SetCompanionWindow(m_valueWindow);
|
||||
// Let the two controls know about each other
|
||||
m_valueWindow->SetTreeCtrl(m_tree);
|
||||
m_tree->SetCompanionWindow(m_valueWindow);
|
||||
|
||||
// set the frame icon
|
||||
SetIcon(wxICON(mondrian));
|
||||
@@ -212,8 +212,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// TRUE is to force the frame to close
|
||||
Close(TRUE);
|
||||
// true is to force the frame to close
|
||||
Close(true);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
@@ -238,7 +238,7 @@ TestTree::TestTree(wxWindow* parent, wxWindowID id, const wxPoint& pt,
|
||||
const wxSize& sz, long style):
|
||||
wxRemotelyScrolledTreeCtrl(parent, id, pt, sz, style)
|
||||
{
|
||||
m_imageList = new wxImageList(16, 16, TRUE);
|
||||
m_imageList = new wxImageList(16, 16, true);
|
||||
#if !defined(__WXMSW__) // || wxUSE_XPM_IN_MSW
|
||||
m_imageList->Add(wxIcon(icon1_xpm));
|
||||
m_imageList->Add(wxIcon(icon2_xpm));
|
||||
@@ -250,28 +250,28 @@ TestTree::TestTree(wxWindow* parent, wxWindowID id, const wxPoint& pt,
|
||||
#endif
|
||||
SetImageList(m_imageList);
|
||||
|
||||
|
||||
// Add some dummy items
|
||||
wxTreeItemId rootId = AddRoot(_("Root"), -1, -1);
|
||||
int i;
|
||||
for (i = 1; i <= 20; i++)
|
||||
{
|
||||
wxString label;
|
||||
label.Printf(wxT("Item %d"), i);
|
||||
wxTreeItemId id = AppendItem(rootId, label, 0);
|
||||
//SetItemImage( id, 1, wxTreeItemIcon_Expanded );
|
||||
|
||||
int j;
|
||||
for (j = 0; j < 10; j++)
|
||||
AppendItem(id, _("Child"), 1);
|
||||
}
|
||||
Expand(rootId);
|
||||
// Add some dummy items
|
||||
wxTreeItemId rootId = AddRoot(_("Root"), -1, -1);
|
||||
int i;
|
||||
for (i = 1; i <= 20; i++)
|
||||
{
|
||||
wxString label;
|
||||
label.Printf(wxT("Item %d"), i);
|
||||
wxTreeItemId id = AppendItem(rootId, label, 0);
|
||||
//SetItemImage( id, 1, wxTreeItemIcon_Expanded );
|
||||
|
||||
int j;
|
||||
for (j = 0; j < 10; j++)
|
||||
AppendItem(id, _("Child"), 1);
|
||||
}
|
||||
Expand(rootId);
|
||||
}
|
||||
|
||||
TestTree::~TestTree()
|
||||
{
|
||||
SetImageList(NULL);
|
||||
delete m_imageList;
|
||||
SetImageList(NULL);
|
||||
delete m_imageList;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -289,5 +289,5 @@ TestValueWindow::TestValueWindow(wxWindow* parent, wxWindowID id,
|
||||
long style):
|
||||
wxTreeCompanionWindow(parent, id, pos, sz, style)
|
||||
{
|
||||
SetBackgroundColour(* wxWHITE);
|
||||
SetBackgroundColour(* wxWHITE);
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ protected:
|
||||
class TestValueWindow: public wxTreeCompanionWindow
|
||||
{
|
||||
public:
|
||||
TestValueWindow(wxWindow* parent, wxWindowID id = -1,
|
||||
TestValueWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
Reference in New Issue
Block a user