Add wxCLOSE_BOX to wxFL samples (consider using wxDEFAULT_FRAME_STYLE).

Whitespace/typo fixes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mart Raudsepp
2005-07-22 16:43:04 +00:00
parent b63269cabe
commit 0423ae974b
7 changed files with 279 additions and 279 deletions

View File

@@ -54,37 +54,37 @@ IMPLEMENT_APP (MyApp)
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
MyFrame *frame = new MyFrame(NULL); MyFrame *frame = new MyFrame(NULL);
frame->SetBackgroundColour( wxColour(192,192,192) ); frame->SetBackgroundColour( wxColour(192,192,192) );
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append( NEW_TEST_LOAD, _("&Load layouts") ); file_menu->Append( NEW_TEST_LOAD, _("&Load layouts") );
file_menu->Append( NEW_TEST_SAVE, _("&Store layouts") ); file_menu->Append( NEW_TEST_SAVE, _("&Store layouts") );
file_menu->Append( NEW_TEST_EXIT, _("E&xit") ); file_menu->Append( NEW_TEST_EXIT, _("E&xit") );
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _("&File")); menu_bar->Append(file_menu, _("&File"));
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->CreateStatusBar(3); frame->CreateStatusBar(3);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
frame->Show(true); frame->Show(true);
frame->mpClientWnd->Refresh(); frame->mpClientWnd->Refresh();
SetTopWindow(frame); SetTopWindow(frame);
wxMessageBox(_("Hello, this demo has a bunch of yet-not-fixed-bugs and missing functionality\n\ wxMessageBox(_("Hello, this demo has a bunch of yet-not-fixed-bugs and missing functionality\n\
The ONLY purpose is to demonstrate self-layouting toolbars,\nflat-bitmapped-buttons and 2-new FL-plugins \ The ONLY purpose is to demonstrate self-layouting toolbars,\nflat-bitmapped-buttons and 2-new FL-plugins \
(cbRowDragPlugin & cbBarHintsPlugin)\n\n\ (cbRowDragPlugin & cbBarHintsPlugin)\n\n\
BTW, disabled images and label-text are rendered at run-time") ); BTW, disabled images and label-text are rendered at run-time") );
return true; return true;
} }
@@ -115,76 +115,76 @@ void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value ) wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{ {
wxTextCtrl* pCtrl = wxTextCtrl* pCtrl =
new wxTextCtrl( this, wxID_ANY, value, new wxTextCtrl( this, wxID_ANY, value,
wxDefaultPosition, wxSize(0,0), wxTE_MULTILINE ); wxDefaultPosition, wxSize(0,0), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) ); pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
return pCtrl; return pCtrl;
} }
MyFrame::MyFrame(wxFrame *frame) MyFrame::MyFrame(wxFrame *frame)
: wxFrame( frame, wxID_ANY, _("wxWidgets 2.0 wxFrameLayout Test Application"), wxDefaultPosition, : wxFrame( frame, wxID_ANY, _("wxWidgets 2.0 wxFrameLayout Test Application"), wxDefaultPosition,
wxSize( 700, 500 ), wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION, wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX,
wxT("freimas") ) wxT("freimas") )
{ {
mpClientWnd = CreateTextCtrl( _("Client window") ); mpClientWnd = CreateTextCtrl( _("Client window") );
mpLayout = new wxFrameLayout( this, mpClientWnd ); mpLayout = new wxFrameLayout( this, mpClientWnd );
#if defined(__WXGTK__) || defined(__WXX11__) #if defined(__WXGTK__) || defined(__WXX11__)
cbCommonPaneProperties props; cbCommonPaneProperties props;
mpLayout->GetPaneProperties( props ); mpLayout->GetPaneProperties( props );
props.mRealTimeUpdatesOn = false; // real-time OFF!!! props.mRealTimeUpdatesOn = false; // real-time OFF!!!
mpLayout->SetPaneProperties( props, wxALL_PANES ); mpLayout->SetPaneProperties( props, wxALL_PANES );
#endif #endif
mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() ); mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() );
// this is now default... // this is now default...
//mpLayout->SetMargins( 1,1,1,1 ); // gaps for vertical/horizontal/right/left panes //mpLayout->SetMargins( 1,1,1,1 ); // gaps for vertical/horizontal/right/left panes
// setup plugins for testing // setup plugins for testing
mpLayout->PushDefaultPlugins(); mpLayout->PushDefaultPlugins();
mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // fancy "X"es and bevel for bars mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // fancy "X"es and bevel for bars
mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) ); mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) ); mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) ); mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) );
// drop in some bars // drop in some bars
cbDimInfo sizes0( 200,45, // when docked horizontally cbDimInfo sizes0( 200,45, // when docked horizontally
200,85, // when docked vertically 200,85, // when docked vertically
175,35, // when floated 175,35, // when floated
false, // the bar is not fixed-size false, // the bar is not fixed-size
4, // vertical gap (bar border) 4, // vertical gap (bar border)
4 // horizontal gap (bar border) 4 // horizontal gap (bar border)
); );
cbDimInfo sizes1( 150,35, // when docked horizontally cbDimInfo sizes1( 150,35, // when docked horizontally
150,85, // when docked vertically 150,85, // when docked vertically
175,35, // when floated 175,35, // when floated
true, // the bar is not fixed-size true, // the bar is not fixed-size
4, // vertical gap (bar border) 4, // vertical gap (bar border)
4 // horizontal gap (bar border) 4 // horizontal gap (bar border)
); );
cbDimInfo sizes2( 195,35, // when docked horizontally cbDimInfo sizes2( 195,35, // when docked horizontally
185,37, // when docked vertically 185,37, // when docked vertically
195,35, // when floated 195,35, // when floated
true, // the bar is not fixed-size true, // the bar is not fixed-size
4, // vertical gap (bar border) 4, // vertical gap (bar border)
4, // horizontal gap (bar border) 4, // horizontal gap (bar border)
new cbDynToolBarDimHandler() new cbDynToolBarDimHandler()
); );
mpLayout->AddBar( CreateTextCtrl(_("Hello")), // bar window mpLayout->AddBar( CreateTextCtrl(_("Hello")), // bar window
sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
@@ -192,7 +192,7 @@ MyFrame::MyFrame(wxFrame *frame)
_("InfoViewer1"), // name to refer in customization pop-ups _("InfoViewer1"), // name to refer in customization pop-ups
true true
); );
mpLayout->AddBar( CreateTextCtrl(_("Bye")), // bar window mpLayout->AddBar( CreateTextCtrl(_("Bye")), // bar window
sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
1, // insert into 0th row (vert. position) 1, // insert into 0th row (vert. position)
@@ -200,7 +200,7 @@ MyFrame::MyFrame(wxFrame *frame)
_("InfoViewer2"), // name to refer in customization pop-ups _("InfoViewer2"), // name to refer in customization pop-ups
true true
); );
mpLayout->AddBar( CreateTextCtrl(_("Fixed0")), // bar window mpLayout->AddBar( CreateTextCtrl(_("Fixed0")), // bar window
sizes1, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) sizes1, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
@@ -208,11 +208,11 @@ MyFrame::MyFrame(wxFrame *frame)
_("ToolBar1"), // name to refer in customization pop-ups _("ToolBar1"), // name to refer in customization pop-ups
true true
); );
wxDynamicToolBar* pToolBar = new wxDynamicToolBar(); wxDynamicToolBar* pToolBar = new wxDynamicToolBar();
pToolBar->Create( this, wxID_ANY ); pToolBar->Create( this, wxID_ANY );
// 1001-1006 ids of command events fired by added tool-buttons // 1001-1006 ids of command events fired by added tool-buttons
pToolBar->AddTool( 1001, wxString(wxT(BMP_DIR)) + wxT("new.bmp") ); pToolBar->AddTool( 1001, wxString(wxT(BMP_DIR)) + wxT("new.bmp") );
@@ -220,13 +220,13 @@ MyFrame::MyFrame(wxFrame *frame)
pToolBar->AddTool( 1002, wxString(wxT(BMP_DIR)) + wxT("open.bmp") ); pToolBar->AddTool( 1002, wxString(wxT(BMP_DIR)) + wxT("open.bmp") );
pToolBar->AddTool( 1003, wxString(wxT(BMP_DIR)) + wxT("save.bmp") ); pToolBar->AddTool( 1003, wxString(wxT(BMP_DIR)) + wxT("save.bmp") );
#if wxUSE_STATLINE #if wxUSE_STATLINE
pToolBar->AddSeparator(new wxMySeparatorLine(pToolBar, wxID_ANY)); pToolBar->AddSeparator(new wxMySeparatorLine(pToolBar, wxID_ANY));
#endif // wxUSE_STATLINE #endif // wxUSE_STATLINE
pToolBar->AddTool( 1004, wxString(wxT(BMP_DIR)) + wxT("cut.bmp") ); pToolBar->AddTool( 1004, wxString(wxT(BMP_DIR)) + wxT("cut.bmp") );
pToolBar->AddTool( 1005, wxString(wxT(BMP_DIR)) + wxT("copy.bmp") ); pToolBar->AddTool( 1005, wxString(wxT(BMP_DIR)) + wxT("copy.bmp") );
pToolBar->AddTool( 1006, wxString(wxT(BMP_DIR)) + wxT("paste.bmp") ); pToolBar->AddTool( 1006, wxString(wxT(BMP_DIR)) + wxT("paste.bmp") );
mpLayout->AddBar( pToolBar, // bar window (can be NULL) mpLayout->AddBar( pToolBar, // bar window (can be NULL)
sizes2, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) sizes2, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
@@ -234,13 +234,13 @@ MyFrame::MyFrame(wxFrame *frame)
wxT("ToolBar2"), // name to refer in customization pop-ups wxT("ToolBar2"), // name to refer in customization pop-ups
false false
); );
mpLayout->EnableFloating( true ); // off, thinking about wxGtk... mpLayout->EnableFloating( true ); // off, thinking about wxGtk...
} }
MyFrame::~MyFrame() MyFrame::~MyFrame()
{ {
if ( mpLayout) if ( mpLayout)
delete mpLayout; // should be destroyed manually delete mpLayout; // should be destroyed manually
} }
@@ -260,7 +260,7 @@ void wxMySeparatorLine::DoSetSize( int x, int y,
y += (height - LINE_SIZE) / 2; y += (height - LINE_SIZE) / 2;
height = LINE_SIZE; height = LINE_SIZE;
} }
wxStaticLine::DoSetSize(x, y, width, height, sizeFlags); wxStaticLine::DoSetSize(x, y, width, height, sizeFlags);
} }
#endif // wxUSE_STATLINE #endif // wxUSE_STATLINE

View File

@@ -21,34 +21,34 @@
#define NEW_TEST_EXIT 1103 #define NEW_TEST_EXIT 1103
#include "wx/panel.h" #include "wx/panel.h"
#include "wx/statline.h" #include "wx/statline.h"
// Define a new application type // Define a new application type
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
bool OnInit(void); bool OnInit(void);
}; };
// Define a new frame type // Define a new frame type
class MyFrame: public wxFrame class MyFrame: public wxFrame
{ {
public: public:
wxFrameLayout* mpLayout; wxFrameLayout* mpLayout;
wxTextCtrl* mpClientWnd; wxTextCtrl* mpClientWnd;
wxTextCtrl* CreateTextCtrl( const wxString& value ); wxTextCtrl* CreateTextCtrl( const wxString& value );
public: public:
MyFrame(wxFrame *frame); MyFrame(wxFrame *frame);
virtual ~MyFrame(); virtual ~MyFrame();
bool OnClose(void) { Show(false); return true; } bool OnClose(void) { Show(false); return true; }
void OnLoad( wxCommandEvent& event ); void OnLoad( wxCommandEvent& event );
void OnSave( wxCommandEvent& event ); void OnSave( wxCommandEvent& event );
void OnExit( wxCommandEvent& event ); void OnExit( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -59,9 +59,9 @@ public:
class wxMySeparatorLine : public wxStaticLine class wxMySeparatorLine : public wxStaticLine
{ {
public: public:
wxMySeparatorLine() wxMySeparatorLine()
{} {}
wxMySeparatorLine( wxWindow *parent, wxWindowID id) wxMySeparatorLine( wxWindow *parent, wxWindowID id)
: wxStaticLine( parent, id) : wxStaticLine( parent, id)
{} {}

View File

@@ -622,7 +622,7 @@ wxWindow* MyFrame::CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent )
{ {
bool isNested = (pParent != mpInternalFrm); bool isNested = (pParent != mpInternalFrm);
// check if we're craeting nested layout // check if we're creating nested layout
if ( isNested ) if ( isNested )
{ {
layout.mBorderPen.SetColour( 128,255,128 ); layout.mBorderPen.SetColour( 128,255,128 );

View File

@@ -49,7 +49,7 @@ typedef wxPanel MyTestPanel;
// Define a new application type // Define a new application type
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
bool OnInit(void); bool OnInit(void);
}; };
@@ -57,59 +57,59 @@ public:
// Define a new frame type // Define a new frame type
class MyFrame: public wxFrame class MyFrame: public wxFrame
{ {
protected: protected:
wxFrameLayout* mLayouts[MAX_LAYOUTS]; wxFrameLayout* mLayouts[MAX_LAYOUTS];
wxFrameLayout* mpNestedLayout; wxFrameLayout* mpNestedLayout;
wxFrameLayout* mpAboutBoxLayout; wxFrameLayout* mpAboutBoxLayout;
int mActiveLayoutNo; int mActiveLayoutNo;
bool mAutoSave; bool mAutoSave;
bool mSavedAlready; bool mSavedAlready;
// container windows: // container windows:
wxTextCtrl* mpClntWindow; wxTextCtrl* mpClntWindow;
wxPanel* mpInternalFrm; wxPanel* mpInternalFrm;
wxImageList mImageList; wxImageList mImageList;
wxFrame mAboutBox; wxFrame mAboutBox;
// helpers for control-creation // helpers for control-creation
wxTextCtrl* CreateTxtCtrl ( const wxString& txt = wxT("wxTextCtrl"), wxWindow* parent = NULL ); wxTextCtrl* CreateTxtCtrl ( const wxString& txt = wxT("wxTextCtrl"), wxWindow* parent = NULL );
wxTreeCtrl* CreateTreeCtrl( const wxString& label = wxT("TreeCtrl") ); wxTreeCtrl* CreateTreeCtrl( const wxString& label = wxT("TreeCtrl") );
wxChoice* CreateChoice ( const wxString& txt = wxT("Choice1") ); wxChoice* CreateChoice ( const wxString& txt = wxT("Choice1") );
wxButton* CreateButton ( const wxString& label = wxT("wxButton"), wxWindow* pParent = NULL, long id = ID_SAY_ITSOK ); wxButton* CreateButton ( const wxString& label = wxT("wxButton"), wxWindow* pParent = NULL, long id = ID_SAY_ITSOK );
// helpers for layout-creation // helpers for layout-creation
void AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent ); void AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent );
wxWindow* CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent ); wxWindow* CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent );
void DropInSomeBars( int layoutNo ); void DropInSomeBars( int layoutNo );
void CreateLayout( int layoutNo ); void CreateLayout( int layoutNo );
void RemoveLayout( int layoutNo ); void RemoveLayout( int layoutNo );
void InitAboutBox(); void InitAboutBox();
void ActivateLayout( int layoutNo ); void ActivateLayout( int layoutNo );
public: /* public */ public: /* public */
MyFrame( wxFrame *frame, const wxChar *title, int x, int y, int w, int h); MyFrame( wxFrame *frame, const wxChar *title, int x, int y, int w, int h);
~MyFrame(); ~MyFrame();
void SyncMenuBarItems(); void SyncMenuBarItems();
// event handlers // event handlers
bool OnClose(void); bool OnClose(void);
void OnLoad( wxCommandEvent& event ); void OnLoad( wxCommandEvent& event );
void OnStore( wxCommandEvent& event ); void OnStore( wxCommandEvent& event );
void OnAutoSave( wxCommandEvent& event ); void OnAutoSave( wxCommandEvent& event );
@@ -122,15 +122,15 @@ public: /* public */
void OnFirst( wxCommandEvent& event ); void OnFirst( wxCommandEvent& event );
void OnSecond( wxCommandEvent& event ); void OnSecond( wxCommandEvent& event );
void OnThird( wxCommandEvent& event ); void OnThird( wxCommandEvent& event );
void OnSayItsOk( wxCommandEvent& event ); void OnSayItsOk( wxCommandEvent& event );
void OnBtnYes( wxCommandEvent& event ); void OnBtnYes( wxCommandEvent& event );
void OnBtnNo( wxCommandEvent& event ); void OnBtnNo( wxCommandEvent& event );
void OnBtnEsc( wxCommandEvent& event ); void OnBtnEsc( wxCommandEvent& event );
void OnChar( wxKeyEvent& event ); void OnChar( wxKeyEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
// Define a new button type, StartButton95 (Just for fun) // Define a new button type, StartButton95 (Just for fun)
@@ -138,21 +138,21 @@ public: /* public */
class StartButton95 : public wxPanel class StartButton95 : public wxPanel
{ {
DECLARE_DYNAMIC_CLASS( StartButton95 ) DECLARE_DYNAMIC_CLASS( StartButton95 )
bool m_bPressed; bool m_bPressed;
wxBitmap m_PBmp; wxBitmap m_PBmp;
wxBitmap m_DBmp; wxBitmap m_DBmp;
public: public:
StartButton95(void) : m_bPressed(false) {} StartButton95(void) : m_bPressed(false) {}
StartButton95(wxWindow* parent) StartButton95(wxWindow* parent)
: m_bPressed(false) { wxPanel::Create(parent,wxID_ANY); } : m_bPressed(false) { wxPanel::Create(parent,wxID_ANY); }
void OnMouseDown( wxMouseEvent& event ); void OnMouseDown( wxMouseEvent& event );
void OnMouseUp( wxMouseEvent& event ); void OnMouseUp( wxMouseEvent& event );
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -3,7 +3,7 @@
// Purpose: Contrib. demo // Purpose: Contrib. demo
// Author: Aleksandras Gluchovas // Author: Aleksandras Gluchovas
// Modified by: Sebastian Haase (June 21, 2001) // Modified by: Sebastian Haase (June 21, 2001)
// Created: 24/11/98 // Created: 24/11/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas // Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license // Licence: wxWindows license
@@ -34,7 +34,7 @@
#define ID_QUIT 104 #define ID_QUIT 104
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
bool OnInit(void); bool OnInit(void);
}; };
@@ -45,19 +45,19 @@ protected:
wxFrameLayout* mpLayout; wxFrameLayout* mpLayout;
wxWindow* mpClientWnd; wxWindow* mpClientWnd;
wxPanel* mpInternalFrm; wxPanel* mpInternalFrm;
wxTextCtrl* CreateTextCtrl( const wxString& value ); wxTextCtrl* CreateTextCtrl( const wxString& value );
public: public:
MyFrame( wxWindow* parent, const wxChar *title ); MyFrame( wxWindow* parent, const wxChar *title );
~MyFrame(); ~MyFrame();
void OnLoad( wxCommandEvent& event ); void OnLoad( wxCommandEvent& event );
void OnStore( wxCommandEvent& event ); void OnStore( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event );
bool OnClose(void) { return true; } bool OnClose(void) { return true; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -68,30 +68,30 @@ IMPLEMENT_APP (MyApp)
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
// wxWidgets boiler-plate: // wxWidgets boiler-plate:
MyFrame *frame = new MyFrame(NULL, _("wxFrameLayout sample")); MyFrame *frame = new MyFrame(NULL, _("wxFrameLayout sample"));
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append( ID_LOAD, _("&Load layout") ); file_menu->Append( ID_LOAD, _("&Load layout") );
file_menu->Append( ID_STORE, _("&Store layout") ); file_menu->Append( ID_STORE, _("&Store layout") );
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append( ID_QUIT, _("E&xit") ); file_menu->Append( ID_QUIT, _("E&xit") );
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _("&File")); menu_bar->Append(file_menu, _("&File"));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->CreateStatusBar(3); frame->CreateStatusBar(3);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
frame->Show(true); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);
return true; return true;
} }
@@ -107,40 +107,40 @@ MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
: wxFrame( parent, wxID_ANY, title, wxDefaultPosition, : wxFrame( parent, wxID_ANY, title, wxDefaultPosition,
wxSize( 700, 500 ), wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION, wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX,
wxT("freimas") ) wxT("freimas") )
{ {
mpInternalFrm = (wxPanel*)this; mpInternalFrm = (wxPanel*)this;
mpClientWnd = CreateTextCtrl( _("Client window") ); mpClientWnd = CreateTextCtrl( _("Client window") );
// btw, creation of internal frame is needed for wxGtk version // btw, creation of internal frame is needed for wxGtk version
// to act correctly (since menu-bar is a separate window there..) // to act correctly (since menu-bar is a separate window there..)
mpLayout = new wxFrameLayout( mpInternalFrm, mpClientWnd ); mpLayout = new wxFrameLayout( mpInternalFrm, mpClientWnd );
#if defined(__WXGTK__) || defined(__WXX11__) #if defined(__WXGTK__) || defined(__WXX11__)
// real-time dosn't work well under wxGtk yet // real-time dosn't work well under wxGtk yet
cbCommonPaneProperties props; cbCommonPaneProperties props;
mpLayout->GetPaneProperties( props ); mpLayout->GetPaneProperties( props );
props.mRealTimeUpdatesOn = false; // off props.mRealTimeUpdatesOn = false; // off
mpLayout->SetPaneProperties( props, wxALL_PANES ); mpLayout->SetPaneProperties( props, wxALL_PANES );
#endif #endif
mpLayout->PushDefaultPlugins(); mpLayout->PushDefaultPlugins();
mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso
//mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); //mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
cbDimInfo sizes( 80,65, // when docked horizontally cbDimInfo sizes( 80,65, // when docked horizontally
80,65, // when docked vertically 80,65, // when docked vertically
80,30, // when floated 80,30, // when floated
true, // the bar is fixed-size true, // the bar is fixed-size
5, // vertical gap (bar border) 5, // vertical gap (bar border)
5 // horizontal gap (bar border) 5 // horizontal gap (bar border)
); );
// drop-in 20 bars // drop-in 20 bars
for( int i = 1; i <= 20; ++i ) for( int i = 1; i <= 20; ++i )
{ {
@@ -148,11 +148,11 @@ MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
wxSprintf( buf, wxT("%d"), i ); wxSprintf( buf, wxT("%d"), i );
wxString name = wxString(wxT("Bar-")); wxString name = wxString(wxT("Bar-"));
name += buf; name += buf;
sizes.mIsFixed = i % 5 > 0; // every fifth bar is not fixed-size sizes.mIsFixed = i % 5 > 0; // every fifth bar is not fixed-size
if ( !sizes.mIsFixed ) name += wxT(" (flexible)"); if ( !sizes.mIsFixed ) name += wxT(" (flexible)");
mpLayout->AddBar( CreateTextCtrl(name),// bar window mpLayout->AddBar( CreateTextCtrl(name),// bar window
sizes, i % MAX_PANES,// alignment ( 0-top,1-bottom, etc) sizes, i % MAX_PANES,// alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
@@ -165,17 +165,17 @@ MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
MyFrame::~MyFrame() MyFrame::~MyFrame()
{ {
// layout is not a window, should be released manually // layout is not a window, should be released manually
if ( mpLayout ) if ( mpLayout )
delete mpLayout; delete mpLayout;
} }
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value ) wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{ {
wxTextCtrl* pCtrl = new wxTextCtrl( mpInternalFrm, wxID_ANY, value, wxTextCtrl* pCtrl = new wxTextCtrl( mpInternalFrm, wxID_ANY, value,
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE ); wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) ); pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
return pCtrl; return pCtrl;
} }
@@ -192,7 +192,7 @@ void MyFrame::OnStore( wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
{ {
Show( false ); // TRICK:: hide it, to avoid flickered destruction Show( false ); // TRICK:: hide it, to avoid flickered destruction
Close(true); Close(true);
} }

View File

@@ -3,7 +3,7 @@
// Purpose: Contrib. demo // Purpose: Contrib. demo
// Author: Aleksandras Gluchovas // Author: Aleksandras Gluchovas
// Modified by: Sebastian Haase (June 21, 2001) // Modified by: Sebastian Haase (June 21, 2001)
// Created: 24/11/98 // Created: 24/11/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas // Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license // Licence: wxWindows license
@@ -35,7 +35,7 @@
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
bool OnInit(void); bool OnInit(void);
}; };
@@ -45,20 +45,20 @@ class MyFrame: public wxFrame
protected: protected:
wxFrameLayout* mpLayout; wxFrameLayout* mpLayout;
wxWindow* mpClientWnd; wxWindow* mpClientWnd;
wxTextCtrl* CreateTextCtrl( const wxString& value ); wxTextCtrl* CreateTextCtrl( const wxString& value );
public: public:
MyFrame( wxWindow* parent, const wxChar *title ); MyFrame( wxWindow* parent, const wxChar *title );
~MyFrame(); ~MyFrame();
void populateMyFrame(); void populateMyFrame();
void OnLoad( wxCommandEvent& event ); void OnLoad( wxCommandEvent& event );
void OnStore( wxCommandEvent& event ); void OnStore( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event );
bool OnClose(void) { return true; } bool OnClose(void) { return true; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -69,30 +69,30 @@ IMPLEMENT_APP (MyApp)
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
// wxWidgets boiler-plate: // wxWidgets boiler-plate:
MyFrame *frame = new MyFrame(NULL, _("wxFrameLayout sample")); MyFrame *frame = new MyFrame(NULL, _("wxFrameLayout sample"));
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append( ID_LOAD, _("&Load layout") ); file_menu->Append( ID_LOAD, _("&Load layout") );
file_menu->Append( ID_STORE, _("&Store layout") ); file_menu->Append( ID_STORE, _("&Store layout") );
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append( ID_QUIT, _("E&xit") ); file_menu->Append( ID_QUIT, _("E&xit") );
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _("&File")); menu_bar->Append(file_menu, _("&File"));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->CreateStatusBar(3); frame->CreateStatusBar(3);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
frame->Show(true); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);
frame->populateMyFrame(); frame->populateMyFrame();
return true; return true;
} }
@@ -108,7 +108,7 @@ MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
: wxFrame( parent, wxID_ANY, title, wxDefaultPosition, : wxFrame( parent, wxID_ANY, title, wxDefaultPosition,
wxSize( 700, 500 ), wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION, wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX,
wxT("freimas") ) wxT("freimas") )
{ {
} }
@@ -116,45 +116,45 @@ MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
void MyFrame::populateMyFrame() void MyFrame::populateMyFrame()
{ {
mpClientWnd = CreateTextCtrl( _("Client window") ); mpClientWnd = CreateTextCtrl( _("Client window") );
mpLayout = new wxFrameLayout( this, mpClientWnd ); mpLayout = new wxFrameLayout( this, mpClientWnd );
/// mpLayout->PushDefaultPlugins(); /// mpLayout->PushDefaultPlugins();
/// mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso /// mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso
/// //mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); /// //mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
cbDimInfo sizes( 80,65, // when docked horizontally cbDimInfo sizes( 80,65, // when docked horizontally
80,165, // when docked vertically 80,165, // when docked vertically
180,30, // when floated 180,30, // when floated
true, // the bar is fixed-size true, // the bar is fixed-size
5, // vertical gap (bar border) 5, // vertical gap (bar border)
5 // horizontal gap (bar border) 5 // horizontal gap (bar border)
); );
// drop-in 20 bars // drop-in 20 bars
for( int i = 1; i <= 10; ++i ) for( int i = 1; i <= 10; ++i )
{ {
wxSleep(1); wxSleep(1);
wxYield(); // CHECK! wxYield(); // CHECK!
wxChar buf[4]; wxChar buf[4];
wxSprintf( buf, wxT("%d"), i ); wxSprintf( buf, wxT("%d"), i );
wxString name = wxString(wxT("Bar-")); wxString name = wxString(wxT("Bar-"));
name += buf; name += buf;
//sizes.mIsFixed = i % 2 > 0; // every fifth bar is not fixed-size //sizes.mIsFixed = i % 2 > 0; // every fifth bar is not fixed-size
if ( !sizes.mIsFixed ) name += wxT(" (flexible)"); if ( !sizes.mIsFixed ) name += wxT(" (flexible)");
// mpLayout->AddBar( CreateTextCtrl(name),// bar window // mpLayout->AddBar( CreateTextCtrl(name), // bar window
mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name),// bar window mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name), // bar window
sizes, i % MAX_PANES,// alignment ( 0-top,1-bottom, etc) sizes, i % MAX_PANES, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels) 0, // offset from the start of row (in pixels)
name // name to refere in customization pop-ups name // name to refere in customization pop-ups
); );
mpLayout->RecalcLayout(true); mpLayout->RecalcLayout(true);
// Layout(); // Layout();
// Refresh(); // Refresh();
} }
@@ -163,17 +163,17 @@ void MyFrame::populateMyFrame()
MyFrame::~MyFrame() MyFrame::~MyFrame()
{ {
// layout is not a window, should be released manually // layout is not a window, should be released manually
if ( mpLayout ) if ( mpLayout )
delete mpLayout; delete mpLayout;
} }
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value ) wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{ {
wxTextCtrl* pCtrl = new wxTextCtrl( this, wxID_ANY, value, wxTextCtrl* pCtrl = new wxTextCtrl( this, wxID_ANY, value,
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE ); wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) ); pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
return pCtrl; return pCtrl;
} }
@@ -190,7 +190,7 @@ void MyFrame::OnStore( wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
{ {
Show( false ); // TRICK:: hide it, to avoid flickered destruction Show( false ); // TRICK:: hide it, to avoid flickered destruction
Close(true); Close(true);
} }

View File

@@ -3,7 +3,7 @@
// Purpose: Contrib. demo // Purpose: Contrib. demo
// Author: Aleksandras Gluchovas // Author: Aleksandras Gluchovas
// Modified by: Sebastian Haase (June 21, 2001) // Modified by: Sebastian Haase (June 21, 2001)
// Created: 24/11/98 // Created: 24/11/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas // Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license // Licence: wxWindows license
@@ -37,7 +37,7 @@
#define ID_BUTT2 146 #define ID_BUTT2 146
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
bool OnInit(void); bool OnInit(void);
}; };
@@ -47,22 +47,22 @@ class MyFrame: public wxFrame
protected: protected:
wxFrameLayout* mpLayout; wxFrameLayout* mpLayout;
wxWindow* mpClientWnd; wxWindow* mpClientWnd;
wxButton * my_butt; wxButton * my_butt;
wxTextCtrl* CreateTextCtrl( const wxString& value ); wxTextCtrl* CreateTextCtrl( const wxString& value );
public: public:
MyFrame( wxWindow* parent, const wxChar *title ); MyFrame( wxWindow* parent, const wxChar *title );
~MyFrame(); ~MyFrame();
void OnLoad( wxCommandEvent& event ); void OnLoad( wxCommandEvent& event );
void OnStore( wxCommandEvent& event ); void OnStore( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event );
void OnButt( wxCommandEvent& event ); void OnButt( wxCommandEvent& event );
void OnButt2( wxCommandEvent& event ); void OnButt2( wxCommandEvent& event );
bool OnClose(void) { return true; } bool OnClose(void) { return true; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -73,29 +73,29 @@ IMPLEMENT_APP (MyApp)
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
// wxWidgets boiler-plate: // wxWidgets boiler-plate:
MyFrame *frame = new MyFrame(NULL, _("wxFrameLayout sample")); MyFrame *frame = new MyFrame(NULL, _("wxFrameLayout sample"));
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append( ID_LOAD, _("&Load layout") ); file_menu->Append( ID_LOAD, _("&Load layout") );
file_menu->Append( ID_STORE, _("&Store layout") ); file_menu->Append( ID_STORE, _("&Store layout") );
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append( ID_QUIT, _("E&xit") ); file_menu->Append( ID_QUIT, _("E&xit") );
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _("&File")); menu_bar->Append(file_menu, _("&File"));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->CreateStatusBar(3); frame->CreateStatusBar(3);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
frame->Show(true); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);
return true; return true;
} }
@@ -113,74 +113,74 @@ MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
: wxFrame( parent, wxID_ANY, title, wxDefaultPosition, : wxFrame( parent, wxID_ANY, title, wxDefaultPosition,
wxSize( 700, 500 ), wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION, wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX,
wxT("freimas") ) wxT("freimas") )
{ {
mpClientWnd = new wxWindow(this, wxID_ANY); mpClientWnd = new wxWindow(this, wxID_ANY);
mpLayout = new wxFrameLayout( this, mpClientWnd ); mpLayout = new wxFrameLayout( this, mpClientWnd );
/// mpLayout->PushDefaultPlugins(); /// mpLayout->PushDefaultPlugins();
/// mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso /// mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso
/// //mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); /// //mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
cbDimInfo sizes( 80,65, // when docked horizontally cbDimInfo sizes( 80,65, // when docked horizontally
80,165, // when docked vertically 80,165, // when docked vertically
180,30, // when floated 180,30, // when floated
true, // the bar is fixed-size true, // the bar is fixed-size
5, // vertical gap (bar border) 5, // vertical gap (bar border)
5 // horizontal gap (bar border) 5 // horizontal gap (bar border)
); );
// drop-in some bars // drop-in some bars
for( int i = 1; i <= 11; ++i ) for( int i = 1; i <= 11; ++i )
{ {
wxChar buf[4]; wxChar buf[4];
wxSprintf( buf, wxT("%d"), i ); wxSprintf( buf, wxT("%d"), i );
wxString name = wxString(wxT("Bar-")); wxString name = wxString(wxT("Bar-"));
name += buf; name += buf;
sizes.mIsFixed = (i !=3); // every fifth bar is not fixed-size sizes.mIsFixed = (i !=3); // every fifth bar is not fixed-size
if ( !sizes.mIsFixed ) name += wxT(" (flexible)"); if ( !sizes.mIsFixed ) name += wxT(" (flexible)");
// mpLayout->AddBar( CreateTextCtrl(name),// bar window // mpLayout->AddBar( CreateTextCtrl(name), // bar window
if(i != 4 && i!= 5 && i!=11) { if(i != 4 && i!= 5 && i!=11) {
mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name),// bar window mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name), // bar window
sizes, sizes,
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc) i % MAX_PANES, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels) 0, // offset from the start of row (in pixels)
name // name to refere in customization pop-ups name // name to refere in customization pop-ups
); );
} else if(i==4){ } else if(i==4){
mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name),// bar window mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name), // bar window
cbDimInfo( 100,100, 100,100, 100,100, true, 5, 5), cbDimInfo( 100,100, 100,100, 100,100, true, 5, 5),
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc) i % MAX_PANES, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels) 0, // offset from the start of row (in pixels)
name // name to refere in customization pop-ups name // name to refere in customization pop-ups
); );
} else if(i==5) { } else if(i==5) {
my_butt = new wxButton(this, ID_BUTT, name); my_butt = new wxButton(this, ID_BUTT, name);
mpLayout->AddBar( my_butt,// bar window mpLayout->AddBar( my_butt, // bar window
cbDimInfo( 100,100, 200,200, 400,400, true, 5, 5), cbDimInfo( 100,100, 200,200, 400,400, true, 5, 5),
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc) i % MAX_PANES, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels) 0, // offset from the start of row (in pixels)
name // name to refere in customization pop-ups name // name to refere in customization pop-ups
); );
} else if(i==11) { } else if(i==11) {
mpLayout->AddBar( new wxButton(this, ID_BUTT2, name+wxT("_2")), mpLayout->AddBar( new wxButton(this, ID_BUTT2, name+wxT("_2")),
cbDimInfo( 100,100, 200,200, 400,400, true, 5, 5), cbDimInfo( 100,100, 200,200, 400,400, true, 5, 5),
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc) i % MAX_PANES, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position) 0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels) 0, // offset from the start of row (in pixels)
name // name to refere in customization pop-ups name // name to refere in customization pop-ups
); );
} }
// mpLayout->RecalcLayout(true); // mpLayout->RecalcLayout(true);
// Layout(); // Layout();
// Refresh(); // Refresh();
@@ -190,17 +190,17 @@ MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
MyFrame::~MyFrame() MyFrame::~MyFrame()
{ {
// layout is not a window, should be released manually // layout is not a window, should be released manually
if ( mpLayout ) if ( mpLayout )
delete mpLayout; delete mpLayout;
} }
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value ) wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{ {
wxTextCtrl* pCtrl = new wxTextCtrl( this, wxID_ANY, value, wxTextCtrl* pCtrl = new wxTextCtrl( this, wxID_ANY, value,
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE ); wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) ); pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
return pCtrl; return pCtrl;
} }
@@ -217,38 +217,38 @@ void MyFrame::OnStore( wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
{ {
Show( false ); // TRICK:: hide it, to avoid flickered destruction Show( false ); // TRICK:: hide it, to avoid flickered destruction
Close(true); Close(true);
} }
void MyFrame::OnButt( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnButt( wxCommandEvent& WXUNUSED(event) )
{ {
static int i =0; static int i =0;
// cbBarInfo* FindBarByName( const wxString& name ); // cbBarInfo* FindBarByName( const wxString& name );
switch(i % 2) { switch(i % 2) {
case 0: case 0:
{ {
cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-1"))); cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-1")));
if(x) if(x)
mpLayout->InverseVisibility(x); mpLayout->InverseVisibility(x);
else else
wxBell(); wxBell();
break; break;
} }
case 1: case 1:
{ {
cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-6"))); cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-6")));
if(x) if(x)
{ {
if(i % 4 == 1) if(i % 4 == 1)
{ {
mpLayout->SetBarState(x, wxCBAR_FLOATING, true); mpLayout->SetBarState(x, wxCBAR_FLOATING, true);
//mpLayout->RecalcLayout(true); //mpLayout->RecalcLayout(true);
mpLayout->RepositionFloatedBar(x); mpLayout->RepositionFloatedBar(x);
} }
else else
{ {
mpLayout->SetBarState(x, 0, true); mpLayout->SetBarState(x, 0, true);
//mpLayout->RecalcLayout(true); //mpLayout->RecalcLayout(true);
@@ -256,12 +256,12 @@ void MyFrame::OnButt( wxCommandEvent& WXUNUSED(event) )
} }
// // // x->mState = wxCBAR_FLOATING; // // // x->mState = wxCBAR_FLOATING;
// // // mpLayout->ApplyBarProperties(x); // // // mpLayout->ApplyBarProperties(x);
} }
else else
{ {
wxBell(); wxBell();
} }
break; break;
} }
} }
@@ -271,14 +271,14 @@ void MyFrame::OnButt( wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnButt2( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnButt2( wxCommandEvent& WXUNUSED(event) )
{ {
static int i =0; static int i =0;
// cbBarInfo* FindBarByName( const wxString& name ); // cbBarInfo* FindBarByName( const wxString& name );
switch(i % 2) { switch(i % 2) {
case 0: case 0:
{ {
cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-1"))); cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-1")));
if(x) if(x)
{ {
for(int a=0;a<MAX_BAR_STATES;a++) for(int a=0;a<MAX_BAR_STATES;a++)
{ {
@@ -288,10 +288,10 @@ void MyFrame::OnButt2( wxCommandEvent& WXUNUSED(event) )
x->mpBarWnd->SetSize(200,200); x->mpBarWnd->SetSize(200,200);
mpLayout->SetBarState(x, wxCBAR_FLOATING, true); // HACK !!! mpLayout->SetBarState(x, wxCBAR_FLOATING, true); // HACK !!!
mpLayout->SetBarState(x, 0, true); // HACK !!! mpLayout->SetBarState(x, 0, true); // HACK !!!
wxYield(); // HACK !!! needed to resize BEFORE redraw wxYield(); // HACK !!! needed to resize BEFORE redraw
mpLayout->RefreshNow( true ); // HACK !!! needed to trigger redraw mpLayout->RefreshNow( true ); // HACK !!! needed to trigger redraw
} }
else else
{ {
wxBell(); wxBell();
} }
@@ -301,32 +301,32 @@ void MyFrame::OnButt2( wxCommandEvent& WXUNUSED(event) )
case 1: case 1:
{ {
cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-1"))); cbBarInfo* x = mpLayout->FindBarByName(wxString(wxT("Bar-1")));
if(x) if(x)
{ {
//mpLayout->InverseVisibility(x); //mpLayout->InverseVisibility(x);
for(int a=0;a<MAX_BAR_STATES;a++) for(int a=0;a<MAX_BAR_STATES;a++)
{ {
// see cbPaneDrawPlugin::OnSizeBarWindow( cbSizeBarWndEvent& event ) // see cbPaneDrawPlugin::OnSizeBarWindow( cbSizeBarWndEvent& event )
x->mDimInfo.mSizes[a].x = 10 + 2 + 2*x->mDimInfo.mHorizGap; x->mDimInfo.mSizes[a].x = 10 + 2 + 2*x->mDimInfo.mHorizGap;
x->mDimInfo.mSizes[a].y = 10 + 2 + 2*x->mDimInfo.mVertGap; x->mDimInfo.mSizes[a].y = 10 + 2 + 2*x->mDimInfo.mVertGap;
} }
x->mpBarWnd->SetSize(10,10); x->mpBarWnd->SetSize(10,10);
mpLayout->SetBarState(x, wxCBAR_FLOATING, true); // HACK !!! mpLayout->SetBarState(x, wxCBAR_FLOATING, true); // HACK !!!
mpLayout->SetBarState(x, 0, true); // HACK !!! mpLayout->SetBarState(x, 0, true); // HACK !!!
wxYield(); // HACK !!! needed to resize BEFORE redraw wxYield(); // HACK !!! needed to resize BEFORE redraw
mpLayout->RefreshNow( true ); // HACK !!! needed to trigger redraw mpLayout->RefreshNow( true ); // HACK !!! needed to trigger redraw
// // mpLayout->SetBarState(x, wxCBAR_FLOATING, true); // mpLayout->SetBarState(x, wxCBAR_FLOATING, true);
// // mpLayout->RecalcLayout(true); // mpLayout->RecalcLayout(true);
// // mpLayout->RepositionFloatedBar(x); // mpLayout->RepositionFloatedBar(x);
// // mpLayout->RecalcLayout(true); // mpLayout->RecalcLayout(true);
// // mpLayout->RepositionFloatedBar(x); // mpLayout->RepositionFloatedBar(x);
// // mpLayout->SetBarState(x, 0, true); // mpLayout->SetBarState(x, 0, true);
// // wxYield(); // wxYield();
// // mpLayout->RefreshNow( true ); // mpLayout->RefreshNow( true );
// // mpLayout->RecalcLayout(true); // mpLayout->RecalcLayout(true);
} }
else else
{ {
wxBell(); wxBell();
} }