added foldbar contrib

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-08-03 11:18:36 +00:00
parent 17a6a2e097
commit 957f5ab77a
24 changed files with 3910 additions and 0 deletions

View File

@@ -0,0 +1,532 @@
/////////////////////////////////////////////////////////////////////////////
// Name: expended.cpp
// Purpose: Layout/foldpanelbar sample
// Author: Jorgen Bodde
// Modified by:
// Created: 24/07/2004
// Copyright: (c) Jorgen Bodde based upon FoldPanelBarTest (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// 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/mdi.h"
#endif
#include "wx/toolbar.h"
#include "wx/laywin.h"
#include <wx/spinctrl.h>
#include <wx/slider.h>
#include "extended.h"
MyFrame *frame = NULL;
wxList my_children;
IMPLEMENT_APP(MyApp)
// For drawing lines in a canvas
long xpos = -1;
long ypos = -1;
int winNumber = 1;
// Initialise this in OnInit, not statically
bool MyApp::OnInit(void)
{
// Create the main frame window
frame = new MyFrame(NULL, -1, _T("FoldPanelBar Extended Demo"), wxPoint(-1, -1), wxSize(500, 600),
wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE |
wxHSCROLL | wxVSCROLL);
// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
frame->SetIcon(wxIcon(_T("sashtest_icn")));
#endif
// Associate the menu bar with the frame
frame->SetMenuBar(CreateMenuBar(false));
frame->CreateStatusBar();
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
EVT_MENU(FPBTEST_ABOUT, MyFrame::OnAbout)
EVT_MENU(FPBTEST_NEW_WINDOW, MyFrame::OnNewWindow)
EVT_SIZE(MyFrame::OnSize)
EVT_MENU(FPBTEST_QUIT, MyFrame::OnQuit)
EVT_MENU(FPBTEST_TOGGLE_WINDOW, MyFrame::OnToggleWindow)
EVT_SASH_DRAGGED_RANGE(ID_WINDOW_TOP, ID_WINDOW_BOTTOM, MyFrame::OnFoldPanelBarDrag)
EVT_MENU(FPB_BOTTOM_STICK, MyFrame::OnCreateBottomStyle)
EVT_MENU(FPB_SINGLE_FOLD, MyFrame::OnCreateNormalStyle)
EVT_BUTTON(ID_COLLAPSEME, MyFrame::OnCollapseMe)
EVT_BUTTON(ID_APPLYTOALL, MyFrame::OnExpandMe)
EVT_SCROLL(MyFrame::OnSlideColour)
EVT_RADIOBUTTON(ID_USE_HGRADIENT, MyFrame::OnStyleChange)
EVT_RADIOBUTTON(ID_USE_VGRADIENT, MyFrame::OnStyleChange)
EVT_RADIOBUTTON(ID_USE_SINGLE, MyFrame::OnStyleChange)
EVT_RADIOBUTTON(ID_USE_RECTANGLE, MyFrame::OnStyleChange)
EVT_RADIOBUTTON(ID_USE_FILLED_RECTANGLE, MyFrame::OnStyleChange)
END_EVENT_TABLE()
// Define my frame constructor
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
const long style)
: wxMDIParentFrame(parent, id, title, pos, size, style)
, _flags(0)
{
m_leftWindow1 = new wxSashLayoutWindow(this, ID_WINDOW_LEFT1,
wxDefaultPosition, wxSize(200, 30),
wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN);
m_leftWindow1->SetDefaultSize(wxSize(160, 1000));
m_leftWindow1->SetOrientation(wxLAYOUT_VERTICAL);
m_leftWindow1->SetAlignment(wxLAYOUT_LEFT);
m_leftWindow1->SetSashVisible(wxSASH_RIGHT, TRUE);
m_leftWindow1->SetExtraBorderSize(0);
_pnl = 0;
ReCreateFoldPanel(0);
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
(void)wxMessageBox(_T("wxWidgets 2.0 FoldPanelBar Demo\nAuthor: Julian Smart (c) 1998"), _T("About FoldPanelBar Demo"));
}
void MyFrame::OnToggleWindow(wxCommandEvent& WXUNUSED(event))
{
m_leftWindow1->Show(!m_leftWindow1->IsShown());
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
}
void MyFrame::OnFoldPanelBarDrag(wxSashEvent& event)
{
if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)
return;
if(event.GetId() == ID_WINDOW_LEFT1)
m_leftWindow1->SetDefaultSize(wxSize(event.GetDragRect().width, 1000));
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
// Leaves bits of itself behind sometimes
GetClientWindow()->Refresh();
}
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event))
{
// Make another frame, containing a canvas
MyChild *subframe = new MyChild(frame, _T("Canvas Frame"),
wxPoint(10, 10), wxSize(300, 300),
wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE);
subframe->SetTitle(wxString::Format(_T("Canvas Frame %d"), winNumber));
winNumber ++;
// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
subframe->SetIcon(wxIcon(_T("sashtest_icn")));
#endif
// Give it a status line
subframe->CreateStatusBar();
// Associate the menu bar with the frame
subframe->SetMenuBar(CreateMenuBar(true));
int width, height;
subframe->GetClientSize(&width, &height);
MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
subframe->canvas = canvas;
// Give it scrollbars
canvas->SetScrollbars(20, 20, 50, 50);
subframe->Show(TRUE);
}
void MyFrame::ReCreateFoldPanel(int fpb_flags)
{
// delete earlier panel
m_leftWindow1->DestroyChildren();
// recreate the foldpanelbar
_pnl = new wxFoldPanelBar(m_leftWindow1, -1, wxDefaultPosition, wxSize(-1,-1), wxFPB_DEFAULT_STYLE, fpb_flags);
wxFoldPanel item = _pnl->AddFoldPanel("Caption colours", false);
_pnl->AddFoldPanelWindow(item, new wxStaticText(item.GetParent(), -1, _T("Adjust the first colour")),
wxFPB_ALIGN_WIDTH, 5, 20);
// RED color spin control
_rslider1 = new wxSlider(item.GetParent(), -1, 0, 0, 255);
_pnl->AddFoldPanelWindow(item, _rslider1, wxFPB_ALIGN_WIDTH,
2, 20);
// GREEN color spin control
_gslider1 = new wxSlider(item.GetParent(), -1, 0, 0, 255);
_pnl->AddFoldPanelWindow(item, _gslider1, wxFPB_ALIGN_WIDTH,
0, 20);
// BLUE color spin control
_bslider1 = new wxSlider(item.GetParent(), -1, 0, 0, 255);
_pnl->AddFoldPanelWindow(item, _bslider1, wxFPB_ALIGN_WIDTH,
0, 20);
_pnl->AddFoldPanelSeperator(item);
_pnl->AddFoldPanelWindow(item, new wxStaticText(item.GetParent(), -1, _T("Adjust the second colour")),
wxFPB_ALIGN_WIDTH, 5, 20);
// RED color spin control
_rslider2 = new wxSlider(item.GetParent(), -1, 0, 0, 255);
_pnl->AddFoldPanelWindow(item, _rslider2, wxFPB_ALIGN_WIDTH,
2, 20);
// GREEN color spin control
_gslider2 = new wxSlider(item.GetParent(), -1, 0, 0, 255);
_pnl->AddFoldPanelWindow(item, _gslider2, wxFPB_ALIGN_WIDTH,
0, 20);
// BLUE color spin control
_bslider2 = new wxSlider(item.GetParent(), -1, 0, 0, 255);
_pnl->AddFoldPanelWindow(item, _bslider2, wxFPB_ALIGN_WIDTH,
0, 20);
_pnl->AddFoldPanelSeperator(item);
_btn = new wxButton(item.GetParent(), ID_APPLYTOALL, "Apply to all");
_pnl->AddFoldPanelWindow(item, _btn);
// read back current gradients and set the sliders
// for the colour which is now taken as default
wxCaptionBarStyle style = _pnl->GetCaptionStyle(item);
wxColour col = style.GetFirstColour();
_rslider1->SetValue(col.Red());
_gslider1->SetValue(col.Green());
_bslider1->SetValue(col.Blue());
col = style.GetSecondColour();
_rslider2->SetValue(col.Red());
_gslider2->SetValue(col.Green());
_bslider2->SetValue(col.Blue());
// put down some caption styles from which the user can
// select to show how the current or all caption bars will look like
item = _pnl->AddFoldPanel("Caption style", false);
wxRadioButton *currStyle = new wxRadioButton(item.GetParent(), ID_USE_VGRADIENT, "&Vertical gradient");
_pnl->AddFoldPanelWindow(item, currStyle, wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 10);
currStyle->SetValue(true);
_pnl->AddFoldPanelWindow(item, new wxRadioButton(item.GetParent(), ID_USE_HGRADIENT, "&Horizontal gradient"),
wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 10);
_pnl->AddFoldPanelWindow(item, new wxRadioButton(item.GetParent(), ID_USE_SINGLE, "&Single colour"),
wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 10);
_pnl->AddFoldPanelWindow(item, new wxRadioButton(item.GetParent(), ID_USE_RECTANGLE, "&Rectangle box"),
wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 10);
_pnl->AddFoldPanelWindow(item, new wxRadioButton(item.GetParent(), ID_USE_FILLED_RECTANGLE, "&Filled rectangle box"),
wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 10);
_pnl->AddFoldPanelSeperator(item);
_single = new wxCheckBox(item.GetParent(), -1, "&Only this caption");
_pnl->AddFoldPanelWindow(item, _single, wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 10);
// one more panel to finish it
wxCaptionBarStyle cs;
cs.SetCaptionStyle(wxCAPTIONBAR_RECTANGLE);
item = _pnl->AddFoldPanel("Misc stuff", true, cs);
_pnl->AddFoldPanelWindow(item, new wxButton(item.GetParent(), ID_COLLAPSEME, "Collapse All"));
_pnl->AddFoldPanelWindow(item, new wxStaticText(item.GetParent(), -1, _T("Enter some comments")),
wxFPB_ALIGN_WIDTH, 5, 20);
_pnl->AddFoldPanelWindow(item, new wxTextCtrl(item.GetParent(), -1, "Comments"),
wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 10);
m_leftWindow1->SizeWindows();
}
void MyFrame::OnCreateBottomStyle(wxCommandEvent& event)
{
// recreate with style collapse to bottom, which means
// all panels that are collapsed are placed at the bottom,
// or normal
if(event.IsChecked())
_flags |= wxFPB_COLLAPSE_TO_BOTTOM;
else
_flags &= ~wxFPB_COLLAPSE_TO_BOTTOM;
ReCreateFoldPanel(_flags);
}
void MyFrame::OnCreateNormalStyle(wxCommandEvent& event)
{
// receate with style where only one panel at the time is
// allowed to be opened
// TODO: Not yet implemented!
if(event.IsChecked())
_flags |= wxFPB_SINGLE_FOLD;
else
_flags &= ~wxFPB_SINGLE_FOLD;
ReCreateFoldPanel(_flags);
}
void MyFrame::OnCollapseMe(wxCommandEvent &event)
{
wxFoldPanel item(0);
for(size_t i = 0; i < _pnl->GetCount(); i++)
{
item = _pnl->Item(i);
_pnl->Collapse(item);
}
}
void MyFrame::OnExpandMe(wxCommandEvent &event)
{
wxColour col1(_rslider1->GetValue(), _gslider1->GetValue(), _bslider1->GetValue()),
col2(_rslider2->GetValue(), _gslider2->GetValue(), _bslider2->GetValue());
wxCaptionBarStyle style;
style.SetFirstColour(col1);
style.SetSecondColour(col2);
_pnl->ApplyCaptionStyleAll(style);
}
wxMenuBar *CreateMenuBar(bool with_window)
{
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(FPBTEST_NEW_WINDOW, _T("&New window"));
if(with_window)
file_menu->Append(FPBTEST_CHILD_QUIT, _T("&Close child"));
file_menu->AppendSeparator();
file_menu->Append(FPBTEST_QUIT, _T("&Exit"));
wxMenu *option_menu = 0;
if(with_window)
{
// Dummy option
option_menu = new wxMenu;
option_menu->Append(FPBTEST_REFRESH, _T("&Refresh picture"));
}
// make fold panel menu
wxMenu *fpb_menu = new wxMenu;
fpb_menu->AppendCheckItem(FPB_BOTTOM_STICK, _T("Create with &wxFPB_COLLAPSE_TO_BOTTOM"));
//fpb_menu->AppendCheckItem(FPB_SINGLE_FOLD, _T("Create with &wxFPB_SINGLE_FOLD"));
fpb_menu->AppendSeparator();
fpb_menu->Append(FPBTEST_TOGGLE_WINDOW, _T("&Toggle FoldPanelBar"));
wxMenu *help_menu = new wxMenu;
help_menu->Append(FPBTEST_ABOUT, _T("&About"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
menu_bar->Append(fpb_menu, _T("&FoldPanel"));
if(option_menu)
menu_bar->Append(option_menu, _T("&Options"));
menu_bar->Append(help_menu, _T("&Help"));
return menu_bar;
}
void MyFrame::OnSlideColour(wxScrollEvent &event)
{
wxColour col1(_rslider1->GetValue(), _gslider1->GetValue(), _bslider1->GetValue()),
col2(_rslider2->GetValue(), _gslider2->GetValue(), _bslider2->GetValue());
//_btn->SetBackgroundColour(col);
wxCaptionBarStyle style;
style.SetFirstColour(col1);
style.SetSecondColour(col2);
wxFoldPanel item = _pnl->Item(0);
_pnl->ApplyCaptionStyle(item, style);
}
void MyFrame::OnStyleChange(wxCommandEvent &event)
{
wxCaptionBarStyle style;
switch(event.GetId())
{
case ID_USE_HGRADIENT:
style.SetCaptionStyle(wxCAPTIONBAR_GRADIENT_H);
break;
case ID_USE_VGRADIENT:
style.SetCaptionStyle(wxCAPTIONBAR_GRADIENT_V);
break;
case ID_USE_SINGLE:
style.SetCaptionStyle(wxCAPTIONBAR_SINGLE);
break;
case ID_USE_RECTANGLE:
style.SetCaptionStyle(wxCAPTIONBAR_RECTANGLE);
break;
case ID_USE_FILLED_RECTANGLE:
style.SetCaptionStyle(wxCAPTIONBAR_FILLED_RECTANGLE);
break;
default:
break;
}
if(_single->GetValue())
{
wxFoldPanel item = _pnl->Item(1);
_pnl->ApplyCaptionStyle(item, style);
}
else
_pnl->ApplyCaptionStyleAll(style);
}
/* ----------------------------------------------------------------------------------------------- */
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_MOUSE_EVENTS(MyCanvas::OnEvent)
END_EVENT_TABLE()
// Define a constructor for my canvas
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
: wxScrolledWindow(parent, -1, pos, size,
wxSUNKEN_BORDER | wxNO_FULL_REPAINT_ON_RESIZE)
{
SetBackgroundColour(* wxWHITE);
}
// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
dc.SetFont(*wxSWISS_FONT);
dc.SetPen(*wxGREEN_PEN);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRectangle(100, 100, 100, 50);
dc.DrawRoundedRectangle(150, 150, 100, 50, 20);
dc.DrawEllipse(250, 250, 100, 50);
#if wxUSE_SPLINES
dc.DrawSpline(50, 200, 50, 100, 200, 10);
#endif // wxUSE_SPLINES
dc.DrawLine(50, 230, 200, 230);
dc.DrawText(_T("This is a test string"), 50, 230);
wxPoint points[3];
points[0].x = 200; points[0].y = 300;
points[1].x = 100; points[1].y = 400;
points[2].x = 300; points[2].y = 400;
dc.DrawPolygon(3, points);
}
// This implements a tiny doodling program! Drag the mouse using
// the left button.
void MyCanvas::OnEvent(wxMouseEvent& event)
{
wxClientDC dc(this);
PrepareDC(dc);
wxPoint pt(event.GetLogicalPosition(dc));
if (xpos > -1 && ypos > -1 && event.Dragging())
{
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(xpos, ypos, pt.x, pt.y);
}
xpos = pt.x;
ypos = pt.y;
}
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
{
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
}
// Note that FPBTEST_NEW_WINDOW and FPBTEST_ABOUT commands get passed
// to the parent window for processing, so no need to
// duplicate event handlers here.
BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
EVT_MENU(FPBTEST_CHILD_QUIT, MyChild::OnQuit)
END_EVENT_TABLE()
MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
const long style):
wxMDIChildFrame(parent, -1, title, pos, size, style)
{
canvas = NULL;
my_children.Append(this);
}
MyChild::~MyChild(void)
{
my_children.DeleteObject(this);
}
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
void MyChild::OnActivate(wxActivateEvent& event)
{
if (event.GetActive() && canvas)
canvas->SetFocus();
}

View File

@@ -0,0 +1,106 @@
/////////////////////////////////////////////////////////////////////////////
// Name: extended.h
// Purpose: Layout/foldpanelbar sample
// Author: Jorgen Bodde
// Modified by:
// Created: 24/07/2004
// Copyright: Jorgen Bodde based upon FoldPanelBar sample (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "wx/toolbar.h"
#include "foldpanelbar.h"
wxMenuBar *CreateMenuBar(bool with_window);
enum
{
ID_COLLAPSEME = 10000,
ID_APPLYTOALL,
ID_USE_HGRADIENT,
ID_USE_VGRADIENT,
ID_USE_SINGLE,
ID_USE_RECTANGLE,
ID_USE_FILLED_RECTANGLE
};
// Define a new application
class MyApp: public wxApp
{
public:
bool OnInit(void);
};
class MyCanvas: public wxScrolledWindow
{
public:
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
virtual void OnDraw(wxDC& dc);
void OnEvent(wxMouseEvent& event);
DECLARE_EVENT_TABLE()
};
// Define a new frame
class MyFrame: public wxMDIParentFrame
{
public:
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
void OnSize(wxSizeEvent& event);
void OnAbout(wxCommandEvent& event);
void OnNewWindow(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
void OnToggleWindow(wxCommandEvent& event);
void OnFoldPanelBarDrag(wxSashEvent& event);
void OnCreateBottomStyle(wxCommandEvent& event);
void OnCreateNormalStyle(wxCommandEvent& event);
void OnCollapseMe(wxCommandEvent &event);
void OnExpandMe(wxCommandEvent &event);
void OnSlideColour(wxScrollEvent &event);
void OnStyleChange(wxCommandEvent &event);
protected:
wxSashLayoutWindow* m_leftWindow1;
private:
void ReCreateFoldPanel(int fpb_flags);
wxFoldPanelBar *_pnl;
wxButton *_btn;
wxCheckBox *_single;
wxSlider *_rslider1, *_gslider1, *_bslider1, *_rslider2, *_gslider2, *_bslider2;
int _flags;
DECLARE_EVENT_TABLE()
};
class MyChild: public wxMDIChildFrame
{
public:
MyCanvas *canvas;
MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyChild(void);
void OnActivate(wxActivateEvent& event);
void OnQuit(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
#define FPBTEST_QUIT 1
#define FPBTEST_NEW_WINDOW 2
#define FPBTEST_REFRESH 3
#define FPBTEST_CHILD_QUIT 4
#define FPBTEST_ABOUT 5
#define FPBTEST_TOGGLE_WINDOW 6
#define FPB_BOTTOM_STICK 7
#define FPB_SINGLE_FOLD 8
#define ID_WINDOW_TOP 100
#define ID_WINDOW_LEFT1 101
#define ID_WINDOW_LEFT2 102
#define ID_WINDOW_BOTTOM 103

View File

@@ -0,0 +1,208 @@
/////////////////////////////////////////////////////////////////////////////
// Name: FoldPanelBarTest.cpp
// Purpose: FoldPanelBarTest Test application
// Created: 06/18/04
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
enum
{
ID_COLLAPSEME = 10000,
ID_EXPANDME
};
#include "wx/foldbar/foldpanelbar.h"
#include "foldtestpanel.h"
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
// the application icon (under Windows and OS/2 it is in resources)
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
#include "mondrian.xpm"
#endif
// ----------------------------------------------------------------------------
// MyApp Class
// ----------------------------------------------------------------------------
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
// ----------------------------------------------------------------------------
// MyAppFrame Class
// ----------------------------------------------------------------------------
class MyAppFrame : public wxFrame
{
public:
MyAppFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
long style = wxDEFAULT_FRAME_STYLE);
private:
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
// extra handlers for the bar, to show how it works
void OnCollapseMe(wxCommandEvent &event);
void OnExpandMe(wxCommandEvent &event);
private:
wxMenuBar *CreateMenuBar();
wxFoldPanelBar *_pnl;
private:
DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
enum
{
// menu items
FoldPanelBarTest_Quit = 1,
FoldPanelBarTest_About = wxID_ABOUT
};
// ----------------------------------------------------------------------------
// event tables and other macros for wxWindows
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyAppFrame, wxFrame)
EVT_MENU(FoldPanelBarTest_Quit, MyAppFrame::OnQuit)
EVT_MENU(FoldPanelBarTest_About, MyAppFrame::OnAbout)
EVT_BUTTON(ID_COLLAPSEME, MyAppFrame::OnCollapseMe)
EVT_BUTTON(ID_EXPANDME, MyAppFrame::OnExpandMe)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// MyApp Implementation
// ----------------------------------------------------------------------------
bool MyApp::OnInit()
{
MyAppFrame *frame = new MyAppFrame(_T("FoldPanelBarTest wxWindows Test Application"),
wxPoint(50, 50), wxSize(200, 500));
SetTopWindow(frame);
frame->Show(TRUE);
return TRUE;
}
// ----------------------------------------------------------------------------
// MyAppFrame Implementation
// ----------------------------------------------------------------------------
MyAppFrame::MyAppFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style)
: wxFrame(NULL, -1, title, pos, size, style)
{
SetIcon(wxICON(mondrian));
SetMenuBar(CreateMenuBar());
CreateStatusBar(2);
SetStatusText(_T("Welcome to wxWindows!"));
_pnl = new wxFoldPanelBar(this, -1, wxDefaultPosition, wxDefaultSize, wxFPB_DEFAULT_STYLE, wxFPB_COLLAPSE_TO_BOTTOM);
wxFoldPanel item = _pnl->AddFoldPanel("Test me", false);
_pnl->AddFoldPanelWindow(item, new wxButton(item.GetParent(), ID_COLLAPSEME, "Collapse Me"));
item = _pnl->AddFoldPanel("Test me too!", true);
_pnl->AddFoldPanelWindow(item, new wxButton(item.GetParent(), ID_EXPANDME, "Expand first one"));
_pnl->AddFoldPanelSeperator(item);
_pnl->AddFoldPanelWindow(item, new FoldTestPanel(item.GetParent(), -1));
_pnl->AddFoldPanelSeperator(item);
_pnl->AddFoldPanelWindow(item, new wxTextCtrl(item.GetParent(), -1, "Comment"), wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 20);
item = _pnl->AddFoldPanel("Some opinions ...", false);
_pnl->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), -1, "I like this"));
_pnl->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), -1, "And also this"));
_pnl->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), -1, "And gimme this too"));
_pnl->AddFoldPanelSeperator(item);
_pnl->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), -1, "Check this too if you like"));
_pnl->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), -1, "What about this"));
item = _pnl->AddFoldPanel("Choose one ...", false);
_pnl->AddFoldPanelWindow(item, new wxStaticText(item.GetParent(), -1, "Enter your comment"));
_pnl->AddFoldPanelWindow(item, new wxTextCtrl(item.GetParent(), -1, "Comment"), wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 20);
}
wxMenuBar *MyAppFrame::CreateMenuBar()
{
wxMenuBar *value = 0;
wxMenu *menuFile = new wxMenu;
menuFile->Append(FoldPanelBarTest_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(FoldPanelBarTest_About, _T("&About...\tF1"), _T("Show about dialog"));
value = new wxMenuBar();
value->Append(menuFile, _T("&File"));
value->Append(helpMenu, _T("&Help"));
return value;
}
// event handlers
void MyAppFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
// TRUE is to force the frame to close
Close(TRUE);
}
void MyAppFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxString msg;
msg.Printf( _T("This is the About dialog of the FoldPanelBarTest application.\n")
_T("Welcome to %s"), wxVERSION_STRING);
wxMessageBox(msg, _T("About FoldPanelBarTest"), wxOK | wxICON_INFORMATION, this);
}
void MyAppFrame::OnCollapseMe(wxCommandEvent &event)
{
wxFoldPanel item = _pnl->Item(0);
_pnl->Collapse(item);
}
void MyAppFrame::OnExpandMe(wxCommandEvent &event)
{
_pnl->Expand(_pnl->Item(0));
_pnl->Collapse(_pnl->Item(1));
}

View File

@@ -0,0 +1,4 @@
mondrian ICON "mondrian.ico"
#define FOLDPANELBARTEST_QUIT 1
#define FOLDPANELBARTEST_ABOUT 102

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<makefile>
<include file="../../../build/bakefiles/common_samples.bkl"/>
<set var="CONTRIB_HDR_DIR">$(SRCDIR)/../../../include</set>
<include file="../../../build/bakefiles/common_contrib.bkl"/>
<exe id="foldtest" template="wx_contrib_sample" template_append="wx_append">
<sources>
foldpanelbartest.cpp
foldtestpanel.cpp
layouttest.cpp
test.cpp
</sources>
<wx-lib>foldbar</wx-lib>
<wx-lib>core</wx-lib>
<wx-lib>base</wx-lib>
<win32-res>foldpanelbartest.rc</win32-res>
</exe>
<wx-data id="data">
<dstdir>$(BUILDDIR)</dstdir>
<srcdir>$(SRCDIR)</srcdir>
<files>
mondrian.ico
</files>
</wx-data>
</makefile>

View File

@@ -0,0 +1,168 @@
/////////////////////////////////////////////////////////////////////////////
// Name: foldtestpanel.cpp
// Purpose:
// Author: Jorgen Bodde
// Modified by:
// Created: 06/18/04 22:37:15
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "foldtestpanel.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"
#endif
////@begin includes
////@end includes
#include "foldtestpanel.h"
////@begin XPM images
////@end XPM images
/*!
* FoldTestPanel type definition
*/
IMPLEMENT_CLASS( FoldTestPanel, wxPanel )
/*!
* FoldTestPanel event table definition
*/
BEGIN_EVENT_TABLE( FoldTestPanel, wxPanel )
////@begin FoldTestPanel event table entries
////@end FoldTestPanel event table entries
//EVT_CAPTIONBAR(-1, FoldTestPanel::OnCaptionPanel)
EVT_CAPTIONBAR(wxID_ANY, FoldTestPanel::OnCaptionPanel)
END_EVENT_TABLE()
/*!
* FoldTestPanel constructors
*/
FoldTestPanel::FoldTestPanel( )
{
delete _images;
}
FoldTestPanel::FoldTestPanel( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Create(parent, id, caption, pos, size, style);
}
/*!
* FoldTestPanel creator
*/
bool FoldTestPanel::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin FoldTestPanel member initialisation
blaat = NULL;
////@end FoldTestPanel member initialisation
////@begin FoldTestPanel creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
wxPanel::Create( parent, id, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end FoldTestPanel creation
return TRUE;
}
/*!
* Control creation for FoldTestPanel
*/
void FoldTestPanel::CreateControls()
{
////@begin FoldTestPanel content construction
FoldTestPanel* item1 = this;
wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL);
blaat = item2;
item1->SetSizer(item2);
item1->SetAutoLayout(TRUE);
/* wxPanel* item3 = new wxPanel( item1, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL ); */
wxPanel* item3 = new wxPanel( item1, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
item2->Add(item3, 1, wxGROW|wxADJUST_MINSIZE, 5);
wxBoxSizer* item4 = new wxBoxSizer(wxVERTICAL);
item3->SetSizer(item4);
item3->SetAutoLayout(TRUE);
wxString item5Strings[] = {
_("One"),
_("Two"),
_("Three")
};
wxChoice* item5 = new wxChoice( item3, ID_CHOICE, wxDefaultPosition, wxDefaultSize, 3, item5Strings, 0 );
item4->Add(item5, 0, wxGROW|wxALL, 5);
wxTextCtrl* item6 = new wxTextCtrl( item3, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
item4->Add(item6, 1, wxGROW|wxALL, 5);
wxRadioButton* item7 = new wxRadioButton( item3, ID_RADIOBUTTON, _("I like this"), wxDefaultPosition, wxDefaultSize, 0 );
item7->SetValue(TRUE);
item4->Add(item7, 0, wxALIGN_LEFT|wxALL, 5);
wxRadioButton* item8 = new wxRadioButton( item3, ID_RADIOBUTTON1, _("I hate it"), wxDefaultPosition, wxDefaultSize, 0 );
item8->SetValue(FALSE);
item4->Add(item8, 0, wxALIGN_LEFT|wxALL, 5);
////@end FoldTestPanel content construction
}
void FoldTestPanel::OnCaptionPanel(wxCaptionBarEvent &event)
{
// TODO: What else
}
/*!
* Should we show tooltips?
*/
bool FoldTestPanel::ShowToolTips()
{
return TRUE;
}
/*!
* Get bitmap resources
*/
wxBitmap FoldTestPanel::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin FoldTestPanel bitmap retrieval
return wxNullBitmap;
////@end FoldTestPanel bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon FoldTestPanel::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin FoldTestPanel icon retrieval
return wxNullIcon;
////@end FoldTestPanel icon retrieval
}

View File

@@ -0,0 +1,114 @@
/////////////////////////////////////////////////////////////////////////////
// Name: foldtestpanel.h
// Purpose:
// Author: Jorgen Bodde
// Modified by:
// Created: 06/18/04 22:37:15
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _FOLDTESTPANEL_H_
#define _FOLDTESTPANEL_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "foldtestpanel.cpp"
#endif
/*!
* Includes
*/
#include "wx/foldbar/captionbar.h"
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_TESTPANEL 10000
#define SYMBOL_FOLDTESTPANEL_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_FOLDTESTPANEL_TITLE _("FoldTestPanel")
#define SYMBOL_FOLDTESTPANEL_IDNAME ID_TESTPANEL
#define SYMBOL_FOLDTESTPANEL_SIZE wxSize(400, 300)
#define SYMBOL_FOLDTESTPANEL_POSITION wxDefaultPosition
#define ID_PANEL 10002
#define ID_CHOICE 10003
#define ID_TEXTCTRL 10016
#define ID_RADIOBUTTON 10004
#define ID_RADIOBUTTON1 10005
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
#ifndef wxFIXED_MINSIZE
#define wxFIXED_MINSIZE 0
#endif
/*!
* FoldTestPanel class declaration
*/
class FoldTestPanel: public wxPanel
{
DECLARE_CLASS( FoldTestPanel )
DECLARE_EVENT_TABLE()
private:
wxImageList *_images;
wxRect _oldsize;
void OnCaptionPanel(wxCaptionBarEvent &event);
public:
/// Constructors
FoldTestPanel( );
FoldTestPanel( wxWindow* parent, wxWindowID id = SYMBOL_FOLDTESTPANEL_IDNAME, const wxString& caption = SYMBOL_FOLDTESTPANEL_TITLE, const wxPoint& pos = SYMBOL_FOLDTESTPANEL_POSITION, const wxSize& size = SYMBOL_FOLDTESTPANEL_SIZE, long style = SYMBOL_FOLDTESTPANEL_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_FOLDTESTPANEL_IDNAME, const wxString& caption = SYMBOL_FOLDTESTPANEL_TITLE, const wxPoint& pos = SYMBOL_FOLDTESTPANEL_POSITION, const wxSize& size = SYMBOL_FOLDTESTPANEL_SIZE, long style = SYMBOL_FOLDTESTPANEL_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin FoldTestPanel event handler declarations
////@end FoldTestPanel event handler declarations
////@begin FoldTestPanel member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end FoldTestPanel member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin FoldTestPanel member variables
wxBoxSizer* blaat;
////@end FoldTestPanel member variables
};
#endif
// _FOLDTESTPANEL_H_

View File

@@ -0,0 +1,145 @@
/////////////////////////////////////////////////////////////////////////////
// Name: layouttest.cpp
// Purpose:
// Author: Jorgen Bodde
// Modified by:
// Created: 06/25/04 19:48:57
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "layouttest.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"
#endif
////@begin includes
////@end includes
#include "layouttest.h"
////@begin XPM images
////@end XPM images
/*!
* LayoutTest type definition
*/
IMPLEMENT_CLASS( LayoutTest, wxPanel )
/*!
* LayoutTest event table definition
*/
BEGIN_EVENT_TABLE( LayoutTest, wxPanel )
////@begin LayoutTest event table entries
////@end LayoutTest event table entries
END_EVENT_TABLE()
/*!
* LayoutTest constructors
*/
LayoutTest::LayoutTest( )
{
}
LayoutTest::LayoutTest( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Create(parent, id, caption, pos, size, style);
}
/*!
* LayoutTest creator
*/
bool LayoutTest::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin LayoutTest member initialisation
////@end LayoutTest member initialisation
////@begin LayoutTest creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
wxPanel::Create( parent, id, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end LayoutTest creation
return TRUE;
}
/*!
* Control creation for LayoutTest
*/
void LayoutTest::CreateControls()
{
////@begin LayoutTest content construction
LayoutTest* item1 = this;
wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL);
item1->SetSizer(item2);
item1->SetAutoLayout(TRUE);
wxStaticText* item3 = new wxStaticText( item1, wxID_STATIC, _("lbaaaaaa"), wxDefaultPosition, wxDefaultSize, 0 );
item3->SetBackgroundColour(wxColour(139, 139, 139));
item2->Add(item3, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
wxPanel* item4 = new wxPanel( item1, ID_PANEL1, wxDefaultPosition, wxSize(100, 80), wxTAB_TRAVERSAL );
item2->Add(item4, 0, wxGROW, 5);
wxBoxSizer* item5 = new wxBoxSizer(wxVERTICAL);
item4->SetSizer(item5);
item4->SetAutoLayout(TRUE);
wxStaticText* item6 = new wxStaticText( item4, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );
item5->Add(item6, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);
wxButton* item7 = new wxButton( item4, ID_BUTTON, _("Button"), wxDefaultPosition, wxDefaultSize, 0 );
item5->Add(item7, 0, wxALIGN_LEFT|wxALL, 5);
////@end LayoutTest content construction
}
/*!
* Should we show tooltips?
*/
bool LayoutTest::ShowToolTips()
{
return TRUE;
}
/*!
* Get bitmap resources
*/
wxBitmap LayoutTest::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin LayoutTest bitmap retrieval
return wxNullBitmap;
////@end LayoutTest bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon LayoutTest::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin LayoutTest icon retrieval
return wxNullIcon;
////@end LayoutTest icon retrieval
}

View File

@@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////
// Name: layouttest.h
// Purpose:
// Author: Jorgen Bodde
// Modified by:
// Created: 06/25/04 19:48:57
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _LAYOUTTEST_H_
#define _LAYOUTTEST_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "layouttest.cpp"
#endif
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10001
#define SYMBOL_LAYOUTTEST_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_LAYOUTTEST_TITLE _("Layout Test")
#define SYMBOL_LAYOUTTEST_IDNAME ID_DIALOG
#define SYMBOL_LAYOUTTEST_SIZE wxSize(400, 300)
#define SYMBOL_LAYOUTTEST_POSITION wxDefaultPosition
#define ID_PANEL1 10006
#define ID_BUTTON 10007
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
#ifndef wxFIXED_MINSIZE
#define wxFIXED_MINSIZE 0
#endif
/*!
* LayoutTest class declaration
*/
class LayoutTest: public wxPanel
{
DECLARE_CLASS( LayoutTest )
DECLARE_EVENT_TABLE()
public:
/// Constructors
LayoutTest( );
LayoutTest( wxWindow* parent, wxWindowID id = SYMBOL_LAYOUTTEST_IDNAME, const wxString& caption = SYMBOL_LAYOUTTEST_TITLE, const wxPoint& pos = SYMBOL_LAYOUTTEST_POSITION, const wxSize& size = SYMBOL_LAYOUTTEST_SIZE, long style = SYMBOL_LAYOUTTEST_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_LAYOUTTEST_IDNAME, const wxString& caption = SYMBOL_LAYOUTTEST_TITLE, const wxPoint& pos = SYMBOL_LAYOUTTEST_POSITION, const wxSize& size = SYMBOL_LAYOUTTEST_SIZE, long style = SYMBOL_LAYOUTTEST_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin LayoutTest event handler declarations
////@end LayoutTest event handler declarations
////@begin LayoutTest member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end LayoutTest member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin LayoutTest member variables
////@end LayoutTest member variables
};
#endif
// _LAYOUTTEST_H_

View File

@@ -0,0 +1,211 @@
/////////////////////////////////////////////////////////////////////////////
// Name: test.cpp
// Purpose:
// Author: Jorgen Bodde
// Modified by:
// Created: 06/27/04 13:34:20
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "test.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"
#endif
////@begin includes
////@end includes
#include "test.h"
////@begin XPM images
////@end XPM images
/*!
* TestTest type definition
*/
IMPLEMENT_CLASS( TestTest, wxDialog )
/*!
* TestTest event table definition
*/
BEGIN_EVENT_TABLE( TestTest, wxDialog )
////@begin TestTest event table entries
////@end TestTest event table entries
END_EVENT_TABLE()
/*!
* TestTest constructors
*/
TestTest::TestTest( )
{
}
TestTest::TestTest( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Create(parent, id, caption, pos, size, style);
}
/*!
* TestTest creator
*/
bool TestTest::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin TestTest member initialisation
blaat = NULL;
blaat = NULL;
////@end TestTest member initialisation
////@begin TestTest creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end TestTest creation
return TRUE;
}
/*!
* Control creation for TestTest
*/
void TestTest::CreateControls()
{
////@begin TestTest content construction
TestTest* item1 = this;
wxFlexGridSizer* item2 = new wxFlexGridSizer(2, 1, 0, 0);
item2->AddGrowableRow(0);
item2->AddGrowableCol(0);
item1->SetSizer(item2);
item1->SetAutoLayout(TRUE);
wxPanel* item3 = new wxPanel( item1, ID_PANEL7, wxDefaultPosition, wxSize(100, 50), wxNO_BORDER|wxTAB_TRAVERSAL );
item2->Add(item3, 1, wxGROW|wxGROW|wxADJUST_MINSIZE, 5);
wxBoxSizer* item4 = new wxBoxSizer(wxVERTICAL);
item3->SetSizer(item4);
item3->SetAutoLayout(TRUE);
wxPanel* item5 = new wxPanel( item3, ID_PANEL6, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
item4->Add(item5, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
wxFlexGridSizer* item6 = new wxFlexGridSizer(2, 1, 0, 0);
item6->AddGrowableRow(1);
item6->AddGrowableCol(0);
item5->SetSizer(item6);
item5->SetAutoLayout(TRUE);
wxStaticText* item7 = new wxStaticText( item5, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );
item6->Add(item7, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL|wxADJUST_MINSIZE, 5);
wxPanel* item8 = new wxPanel( item5, ID_PANEL3, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
item6->Add(item8, 1, wxGROW|wxGROW|wxALL, 5);
wxBoxSizer* item9 = new wxBoxSizer(wxVERTICAL);
blaat = item9;
item8->SetSizer(item9);
item8->SetAutoLayout(TRUE);
wxPanel* item10 = new wxPanel( item8, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
item9->Add(item10, 1, wxGROW, 5);
wxBoxSizer* item11 = new wxBoxSizer(wxVERTICAL);
item10->SetSizer(item11);
item10->SetAutoLayout(TRUE);
wxString item12Strings[] = {
_("One"),
_("Two"),
_("Three")
};
wxChoice* item12 = new wxChoice( item10, ID_CHOICE, wxDefaultPosition, wxDefaultSize, 3, item12Strings, 0 );
item11->Add(item12, 0, wxGROW|wxALL, 5);
wxRadioButton* item13 = new wxRadioButton( item10, ID_RADIOBUTTON, _("I like this"), wxDefaultPosition, wxDefaultSize, 0 );
item13->SetValue(TRUE);
item11->Add(item13, 0, wxALIGN_LEFT|wxALL, 5);
wxRadioButton* item14 = new wxRadioButton( item10, ID_RADIOBUTTON1, _("I hate it"), wxDefaultPosition, wxDefaultSize, 0 );
item14->SetValue(FALSE);
item11->Add(item14, 0, wxALIGN_LEFT|wxALL, 5);
wxPanel* item15 = new wxPanel( item3, ID_PANEL2, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
item4->Add(item15, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
wxFlexGridSizer* item16 = new wxFlexGridSizer(2, 1, 0, 0);
item16->AddGrowableRow(1);
item16->AddGrowableCol(0);
item15->SetSizer(item16);
item15->SetAutoLayout(TRUE);
wxStaticText* item17 = new wxStaticText( item15, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );
item16->Add(item17, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL|wxADJUST_MINSIZE|wxFIXED_MINSIZE, 5);
wxPanel* item18 = new wxPanel( item15, ID_PANEL4, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
item16->Add(item18, 0, wxGROW|wxGROW|wxALL, 5);
wxBoxSizer* item19 = new wxBoxSizer(wxVERTICAL);
blaat = item19;
item18->SetSizer(item19);
item18->SetAutoLayout(TRUE);
wxPanel* item20 = new wxPanel( item18, ID_PANEL5, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
item19->Add(item20, 1, wxGROW, 5);
wxBoxSizer* item21 = new wxBoxSizer(wxVERTICAL);
item20->SetSizer(item21);
item20->SetAutoLayout(TRUE);
wxString item22Strings[] = {
_("One"),
_("Two"),
_("Three")
};
wxChoice* item22 = new wxChoice( item20, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 3, item22Strings, 0 );
item21->Add(item22, 0, wxGROW|wxALL, 5);
wxRadioButton* item23 = new wxRadioButton( item20, ID_RADIOBUTTON2, _("I like this"), wxDefaultPosition, wxDefaultSize, 0 );
item23->SetValue(TRUE);
item21->Add(item23, 0, wxALIGN_LEFT|wxALL, 5);
wxRadioButton* item24 = new wxRadioButton( item20, ID_RADIOBUTTON3, _("I hate it"), wxDefaultPosition, wxDefaultSize, 0 );
item24->SetValue(FALSE);
item21->Add(item24, 0, wxALIGN_LEFT|wxALL, 5);
wxPanel* item25 = new wxPanel( item1, ID_PANEL1, wxDefaultPosition, wxSize(100, 20), wxNO_BORDER|wxTAB_TRAVERSAL );
item25->SetBackgroundColour(wxColour(98, 98, 98));
item2->Add(item25, 0, wxGROW|wxGROW|wxFIXED_MINSIZE, 5);
////@end TestTest content construction
}
/*!
* Should we show tooltips?
*/
bool TestTest::ShowToolTips()
{
return TRUE;
}
/*!
* Get bitmap resources
*/
wxBitmap TestTest::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin TestTest bitmap retrieval
return wxNullBitmap;
////@end TestTest bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon TestTest::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin TestTest icon retrieval
return wxNullIcon;
////@end TestTest icon retrieval
}

View File

@@ -0,0 +1,115 @@
/////////////////////////////////////////////////////////////////////////////
// Name: test.h
// Purpose:
// Author: Jorgen Bodde
// Modified by:
// Created: 06/27/04 13:34:20
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _TEST_H_
#define _TEST_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "test.cpp"
#endif
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10001
#define SYMBOL_TESTTEST_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_TESTTEST_TITLE _("Test Me")
#define SYMBOL_TESTTEST_IDNAME ID_DIALOG
#define SYMBOL_TESTTEST_SIZE wxSize(400, 200)
#define SYMBOL_TESTTEST_POSITION wxDefaultPosition
#define ID_PANEL7 10015
#define ID_PANEL6 10014
#define ID_PANEL3 10008
#define ID_PANEL 10002
#define ID_CHOICE 10003
#define ID_RADIOBUTTON 10004
#define ID_RADIOBUTTON1 10005
#define ID_PANEL2 10007
#define ID_PANEL4 10009
#define ID_PANEL5 10010
#define ID_CHOICE1 10011
#define ID_RADIOBUTTON2 10012
#define ID_RADIOBUTTON3 10013
#define ID_PANEL1 10006
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
#ifndef wxFIXED_MINSIZE
#define wxFIXED_MINSIZE 0
#endif
/*!
* TestTest class declaration
*/
class TestTest: public wxDialog
{
DECLARE_CLASS( TestTest )
DECLARE_EVENT_TABLE()
public:
/// Constructors
TestTest( );
TestTest( wxWindow* parent, wxWindowID id = SYMBOL_TESTTEST_IDNAME, const wxString& caption = SYMBOL_TESTTEST_TITLE, const wxPoint& pos = SYMBOL_TESTTEST_POSITION, const wxSize& size = SYMBOL_TESTTEST_SIZE, long style = SYMBOL_TESTTEST_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_TESTTEST_IDNAME, const wxString& caption = SYMBOL_TESTTEST_TITLE, const wxPoint& pos = SYMBOL_TESTTEST_POSITION, const wxSize& size = SYMBOL_TESTTEST_SIZE, long style = SYMBOL_TESTTEST_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin TestTest event handler declarations
////@end TestTest event handler declarations
////@begin TestTest member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end TestTest member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin TestTest member variables
wxBoxSizer* blaat;
////@end TestTest member variables
};
#endif
// _TEST_H_