Added Aleksandras' framelayout code, with more or less working Linux Makefiles

General makefiles to be added later.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Harco de Hilster
1999-03-07 23:34:37 +00:00
parent 8c0d01c876
commit bd9396d52d
84 changed files with 32941 additions and 0 deletions

View File

@@ -0,0 +1 @@
include ../../../setup/general/makedirs

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1 @@
include ../../../../setup/general/makedirs

View File

@@ -0,0 +1,27 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a binary only
RULE=bin
# define executable name
BIN_TARGET=fl_demo
# define library sources
BIN_CPP_SRC=\
fl_demo.cpp\
#define library objects
BIN_OBJ=\
$(BIN_CPP_SRC:.cpp=.o)
# additional things needed to link
BIN_LINK=-lwx_fl_gtk
# additional things needed to compile
ADD_COMPILE=-I../../../src
# include the definitions now
include ../../../../../template.mak

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,142 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 04/11/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __FLDEMO_G__
#define __FLDEMO_G__
// ID for the menu commands
#define MINIMAL_QUIT 1
#define MINIMAL_ABOUT 102
#define ID_LOAD 103
#define ID_STORE 104
#define ID_AUTOSAVE 105
#define ID_SETTINGS 106
#define ID_REMOVE 107
#define ID_REMOVEALL 108
#define ID_RECREATE 109
#define ID_ACTIVATE 110
#define ID_FIRST 111
#define ID_SECOND 112
#define ID_THIRD 113
#define ID_SAY_ITSOK 114
#define ID_BTN_YES 115
#define ID_BTN_NO 116
#define ID_BTN_ESC 117
#define MAX_LAYOUTS 3
#define FIRST_LAYOUT 0
#define SECOND_LAYOUT 1
#define THIRD_LAYOUT 2
class wxFrameLayout;
class wxObjectStorage;
// FOR NOW::
typedef wxPanel MyTestPanel;
// Define a new application type
class MyApp: public wxApp
{
public:
bool OnInit(void);
};
// Define a new frame type
class MyFrame: public wxFrame
{
protected:
wxFrameLayout* mLayouts[MAX_LAYOUTS];
wxFrameLayout* mpNestedLayout;
wxFrameLayout* mpAboutBoxLayout;
int mActiveLayoutNo;
bool mAutoSave;
bool mSavedAlready;
// container windows:
wxTextCtrl* mpClntWindow;
wxPanel* mpInternalFrm;
wxImageList mImageList;
wxFrame mAboutBox;
// helpers for control-creation
wxTextCtrl* CreateTxtCtrl ( const wxString& txt = "wxTextCtrl", wxWindow* parent = NULL );
wxTreeCtrl* CreateTreeCtrl( const wxString& label = "TreeCtrl" );
wxChoice* CreateChoice ( const wxString& txt = "Choice1" );
wxButton* CreateButton ( const wxString& label = "wxButton",
wxWindow* pParent = NULL, long id = ID_SAY_ITSOK );
// helpers for layout-creation
void AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent );
wxWindow* CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent );
void DropInSomeBars( int layoutNo );
void CreateLayout( int layoutNo );
void RemoveLayout( int layoutNo );
void DestroyEverything();
void InitAboutBox();
void ActivateLayout( int layoutNo );
void SerializeMe( wxObjectStorage& store );
public: /* public */
MyFrame(wxFrame *frame, char *title,
int x, int y, int w, int h);
~MyFrame();
void SyncMenuBarItems();
// event handlers
bool OnClose(void);
void OnLoad( wxCommandEvent& event );
void OnStore( wxCommandEvent& event );
void OnAutoSave( wxCommandEvent& event );
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnSettings( wxCommandEvent& event );
void OnRemove( wxCommandEvent& event );
void OnRemoveAll( wxCommandEvent& event );
void OnRecreate( wxCommandEvent& event );
void OnFirst( wxCommandEvent& event );
void OnSecond( wxCommandEvent& event );
void OnThird( wxCommandEvent& event );
void OnSayItsOk( wxCommandEvent& event );
void OnBtnYes( wxCommandEvent& event );
void OnBtnNo( wxCommandEvent& event );
void OnBtnEsc( wxCommandEvent& event );
void OnChar( wxKeyEvent& event );
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -0,0 +1,29 @@
#!/bin/sh
cat <<EOF
This script will create Linux build dirs in each of the sample subdirs and
create the makefile.
Make sure you execute the samples in the bitmaps dir, otherwise they
won't find their bitmaps! This will probably result in a crash.
Until I find a more elegant method for this...
EOF
for DIR in demo sample test ; do
cd $DIR
echo Entering $DIR ...
if [ ! -d Linux ] ; then
echo "Making Linux dir"
mkdir Linux
fi
echo "Creating Makefile"
sed -f ../../../../setup/Linux/substit Makefile.in > Linux/Makefile
cd ..
done

View File

@@ -0,0 +1 @@
include ../../../../setup/general/makedirs

View File

@@ -0,0 +1,27 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a binary only
RULE=bin
# define executable name
BIN_TARGET=fl_sample
# define library sources
BIN_CPP_SRC=\
fl_sample.cpp\
#define library objects
BIN_OBJ=\
$(BIN_CPP_SRC:.cpp=.o)
# additional things needed to link
BIN_LINK=-lwx_fl_gtk
# additional things needed to compile
ADD_COMPILE=-I../../../src
# include the definitions now
include ../../../../../template.mak

View File

@@ -0,0 +1,294 @@
/////////////////////////////////////////////////////////////////////////////
// Name: main.cpp
// Purpose: Contrib. demo
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 24/11/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "fl_sample.cpp"
#pragma interface "fl_sample.cpp"
#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
#include "controlbar.h"
#include "objstore.h"
// plugins used
#include "barhintspl.h"
#include "hintanimpl.h"
#include "wx/textctrl.h"
// ADDED by alex (linker complaints...):
char wxDummyChar=0;
#define ID_LOAD 102
#define ID_STORE 103
#define ID_QUIT 104
#define LAYOUT_FILE "layouts.dat"
class MyApp: public wxApp
{
public:
bool OnInit(void);
};
class MyFrame: public wxFrame
{
protected:
wxFrameLayout* mpLayout;
wxWindow* mpClientWnd;
wxPanel* mpInternalFrm;
void SerializeMe( wxObjectStorage& store );
wxTextCtrl* CreateTextCtrl( const wxString& value );
public:
MyFrame( wxWindow* parent, char *title );
~MyFrame();
void OnLoad( wxCommandEvent& event );
void OnStore( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
bool OnClose(void) { return TRUE; }
DECLARE_EVENT_TABLE()
};
/***** Implementation for class MyApp *****/
IMPLEMENT_APP (MyApp)
bool MyApp::OnInit(void)
{
// wxWindows boiler-plate:
MyFrame *frame = new MyFrame(NULL, "wxFrameLayout sample");
wxMenu *file_menu = new wxMenu;
file_menu->Append( ID_LOAD, "&Load layout" );
file_menu->Append( ID_STORE, "&Store layout" );
file_menu->AppendSeparator();
file_menu->Append( ID_QUIT, "E&xit" );
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
frame->CreateStatusBar(3);
frame->SetMenuBar(menu_bar);
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
/***** Immlementation for class MyFrame *****/
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU( ID_LOAD, MyFrame::OnLoad )
EVT_MENU( ID_STORE, MyFrame::OnStore )
EVT_MENU( ID_QUIT, MyFrame::OnQuit )
END_EVENT_TABLE()
MyFrame::MyFrame( wxWindow* parent, char *title )
: wxFrame( parent, -1, "NewTest-II", wxDefaultPosition,
wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
"freimas" )
{
#ifdef __WXMSW__
mpInternalFrm = (wxPanel*)this;
#else
mpInternalFrm = new wxPanel( this, -1 );
#endif
mpClientWnd = CreateTextCtrl( "Client window" );
// btw, creation of internal frame is needed for wxGtk version
// to act correctly (since menu-bar is a separate window there..)
mpLayout = new wxFrameLayout( mpInternalFrm, mpClientWnd );
#ifdef __WXGTK__
// real-time dosn't work well under wxGtk yet
cbCommonPaneProperties props;
mpLayout->GetPaneProperties( props );
props.mRealTimeUpdatesOn = FALSE; // off
mpLayout->SetPaneProperties( props, wxALL_PANES );
#endif
mpLayout->PushDefaultPlugins();
mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso
//mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
cbDimInfo sizes( 80,65, // when docked horizontally
80,65, // when docked vertically
80,30, // when floated
TRUE, // the bar is fixed-size
5, // vertical gap (bar border)
5 // horizontal gap (bar border)
);
// drop-in 20 bars
for( int i = 1; i <= 10; ++i )
{
char buf[4];
sprintf( buf, "%d", i );
wxString name = wxString("Bar-");
name += buf;
sizes.mIsFixed = i % 5 > 0; // every fifth bar is not fixed-size
if ( !sizes.mIsFixed ) name += " (flexible)";
mpLayout->AddBar( CreateTextCtrl(name),// bar window
sizes, i % MAX_PANES,// alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
name // name to refere in customization pop-ups
);
}
}
MyFrame::~MyFrame()
{
// layout is not a window, should be released manually
if ( mpLayout ) delete mpLayout;
}
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{
wxTextCtrl* pCtrl =
new wxTextCtrl( mpInternalFrm, -1, value,
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
return pCtrl;
}
void MyFrame::OnLoad( wxCommandEvent& event )
{
if ( !wxFileExists( LAYOUT_FILE ) )
{
wxMessageBox( "layout data file `layout.dat' not found\n\n store layout first" );
return;
}
mpLayout->HideBarWindows(); // hide first, to avoid flickered destruction
mpLayout->DestroyBarWindows();
if ( mpClientWnd )
{
mpClientWnd->Destroy();
delete mpLayout;
mpClientWnd = NULL;
}
wxIOStreamWrapper stm;
stm.CreateForInput( LAYOUT_FILE ); // TRUE - create stream for input
wxObjectStorage store( stm );
SerializeMe( store );
mpLayout->Activate();
}
void MyFrame::OnStore( wxCommandEvent& event )
{
wxIOStreamWrapper stm;
stm.CreateForOutput( LAYOUT_FILE ); // FALSE - create stream for output
wxObjectStorage store( stm );
SerializeMe( store );
}
void MyFrame::OnQuit( wxCommandEvent& event )
{
Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
Close(TRUE);
}
void MyFrame::SerializeMe( wxObjectStorage& store )
{
// mark contaienr-frames as not serializable
store.AddInitialRef( mpInternalFrm );
store.AddInitialRef( this );
// does all the rest for as
store.XchgObjPtr( (wxObject**) &(mpLayout) );
store.XchgObjPtr( (wxObject**) &(mpClientWnd) );
store.Finalize(); // finish serialization
}
#ifdef __HACK_MY_MSDEV40__
////////////// new 2.0-magic (linker errors...) ////////////////
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
"recreating toolbar in wxFrame" );
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
if (toolBar)
{
SetToolBar(toolBar);
PositionToolBar();
return toolBar;
}
else
{
return NULL;
}
}
wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
{
return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
}
#endif

View File

@@ -0,0 +1 @@
include ../../../../setup/general/makedirs

View File

@@ -0,0 +1,27 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a binary only
RULE=bin
# define executable name
BIN_TARGET=fl_test
# define library sources
BIN_CPP_SRC=\
fl_test.cpp\
#define library objects
BIN_OBJ=\
$(BIN_CPP_SRC:.cpp=.o)
# additional things needed to link
BIN_LINK=-lwx_fl_gtk
# additional things needed to compile
ADD_COMPILE=-I../../../src
# include the definitions now
include ../../../../../template.mak

View File

@@ -0,0 +1,324 @@
/////////////////////////////////////////////////////////////////////////////
// Name: minimal.cpp
// Purpose: Minimal wxWindows sample
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "minimal.cpp"
#pragma interface "minimal.cpp"
#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
#include "wx/textctrl.h"
#include "controlbar.h" // core API
#include "fl_test.h"
// extra plugins
#include "barhintspl.h" // beveal for bars with "X"s and grooves
#include "rowdragpl.h" // NC-look with dragable rows
#include "cbcustom.h" // customization plugin
#include "hintanimpl.h"
// beuty-care
#include "gcupdatesmgr.h" // smooth d&d
#include "antiflickpl.h" // double-buffered repaint of decorations
#include "dyntbar.h" // auto-layouting toolbar
#include "dyntbarhnd.h" // control-bar dimension handler for it
// comment it out if it breaks, (this is my workaround for MSDev 4.0 linker)
char wxDummyChar;
IMPLEMENT_APP (MyApp)
bool MyApp::OnInit(void)
{
MyFrame *frame = new MyFrame(NULL);
frame->SetBackgroundColour( wxColour(192,192,192) );
wxMenu *file_menu = new wxMenu;
file_menu->Append( NEW_TEST_LOAD, "&Load layouts" );
file_menu->Append( NEW_TEST_SAVE, "&Store layouts" );
file_menu->Append( NEW_TEST_EXIT, "E&xit" );
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
frame->SetMenuBar(menu_bar);
frame->CreateStatusBar(3);
frame->Show(TRUE);
frame->mpClientWnd->Refresh();
SetTopWindow(frame);
return TRUE;
/*
wxMessageBox("Hello, this demo has a bunch of yet-not-fixed-bugs and misssing functionality\n\
The ONLY purpose is to demostrate self-layouting toolbars,\n flat-bitmapped-buttons and 2-new FL-plugins\
(cbRowDragPlugin & cbBarHintsPlugin)\n\n\
BTW, disabled images and label-text are rendered at run-time" );
*/
return TRUE;
}
/***** Implementation for class MyFrame *****/
BEGIN_EVENT_TABLE( MyFrame, wxFrame )
// EVT_CHAR_HOOK(MyFrame::OnKeyDown)
// EVT_PAINT( MyFrame::OnPaint )
EVT_MENU( NEW_TEST_SAVE, MyFrame::OnSave )
EVT_MENU( NEW_TEST_LOAD, MyFrame::OnLoad )
EVT_MENU( NEW_TEST_EXIT, MyFrame::OnExit )
END_EVENT_TABLE()
void MyFrame::OnLoad( wxCommandEvent& event )
{
mpLayout->HideBarWindows();
mpLayout->DestroyBarWindows();
delete mpLayout;
if ( mpClientWnd )
{
mpClientWnd->Destroy();
mpClientWnd = NULL;
}
mpLayout = NULL;
wxIOStreamWrapper& stm = *(new wxIOStreamWrapper());
stm.CreateForInput( "layouts1.dat" );
mStore.SetDataStream( stm );
mStore.XchgObjPtr( (wxObject**) &mpLayout );
mStore.Finalize(); // finish serialization
mpLayout->Activate();
}
void MyFrame::OnSave( wxCommandEvent& event )
{
wxIOStreamWrapper& stm = *(new wxIOStreamWrapper());
stm.CreateForOutput( "layouts1.dat" );
mStore.SetDataStream( stm );
mStore.XchgObjPtr( (wxObject**) &mpLayout );
mStore.Finalize(); // finish serialization
}
void MyFrame::OnExit( wxCommandEvent& event )
{
Destroy();
}
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{
wxTextCtrl* pCtrl =
new wxTextCtrl( mpInternalFrm, -1, value,
wxDefaultPosition, wxSize(0,0), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
return pCtrl;
}
MyFrame::MyFrame(wxFrame *frame)
: wxFrame( frame, -1, "wxWindows 2.0 wxFrameLayout Test Application", wxDefaultPosition,
wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
"freimas" )
{
#ifdef __WXMSW__
mpInternalFrm = (wxPanel*)this;
#else
mpInternalFrm = new wxPanel( this, -1 );
#endif
mpClientWnd = CreateTextCtrl( "Client window" );
mStore.AddInitialRef( this );
mStore.AddInitialRef( mpInternalFrm );
//mStore.AddInitialRef( mpClientWnd );
mpLayout = new wxFrameLayout( mpInternalFrm, mpClientWnd );
#ifdef __WXGTK__
cbCommonPaneProperties props;
mpLayout->GetPaneProperties( props );
props.mRealTimeUpdatesOn = FALSE; // real-time OFF!!!
mpLayout->SetPaneProperties( props, wxALL_PANES );
#endif
mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() );
// this is now default...
//mpLayout->SetMargins( 1,1,1,1 ); // gaps for vertical/horizontal/right/left panes
// setup plugins for testing
mpLayout->PushDefaultPlugins();
mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for bars
mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) );
// drop in some bars
cbDimInfo sizes0(200,45, // when docked horizontally
200,85, // when docked vertically
175,35, // when floated
FALSE, // the bar is not fixed-size
4, // vertical gap (bar border)
4 // horizontal gap (bar border)
);
cbDimInfo sizes1(150,35, // when docked horizontally
150,85, // when docked vertically
175,35, // when floated
TRUE, // the bar is not fixed-size
4, // vertical gap (bar border)
4 // horizontal gap (bar border)
);
cbDimInfo sizes2(175,45, // when docked horizontally
175,37, // when docked vertically
170,35, // when floated
TRUE, // the bar is not fixed-size
4, // vertical gap (bar border)
4, // horizontal gap (bar border)
new cbDynToolBarDimHandler()
);
mpLayout->AddBar( CreateTextCtrl("Hello"), // bar window
sizes0, wxTOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"InfoViewer1", // name to refere in customization pop-ups
TRUE
);
mpLayout->AddBar( CreateTextCtrl("Bye"), // bar window
sizes0, wxTOP, // alignment ( 0-top,1-bottom, etc)
1, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"InfoViewer2", // name to refere in customization pop-ups
TRUE
);
mpLayout->AddBar( CreateTextCtrl("Fixed0"), // bar window
sizes1, wxTOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"ToolBar1", // name to refere in customization pop-ups
TRUE
);
wxDynamicToolBar* pToolBar = new wxDynamicToolBar();
pToolBar->Create( mpInternalFrm, -1 );
// 1001-1006 ids of command events fired by added tool-buttons
pToolBar->AddTool( 1001, "new.bmp" );
pToolBar->AddTool( 1002, "open.bmp" );
pToolBar->AddTool( 1003, "save.bmp" );
pToolBar->AddTool( 1004, "cut.bmp" );
pToolBar->AddTool( 1005, "copy.bmp" );
pToolBar->AddTool( 1006, "paste.bmp" );
mpLayout->AddBar( pToolBar, // bar window (can be NULL)
sizes2, wxTOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"ToolBar2", // name to refere in customization pop-ups
FALSE
);
mpLayout->EnableFloating( TRUE ); // off, thinking bout wxGtk...
}
MyFrame::~MyFrame()
{
if ( mpLayout) delete mpLayout; // should be destroyed manually
}
#ifdef __HACK_MY_MSDEV40__
////////////// new 2.0-magic (linker errors...) ////////////////
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
"recreating toolbar in wxFrame" );
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
if (toolBar)
{
SetToolBar(toolBar);
PositionToolBar();
return toolBar;
}
else
{
return NULL;
}
}
wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
{
return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
}
#endif

View File

@@ -0,0 +1,41 @@
#ifndef __NEW_TEST_G__
#define __NEW_TEST_G__
#include "objstore.h"
#include "wx/panel.h"
// Define a new application type
class MyApp: public wxApp
{ public:
bool OnInit(void);
};
class MyFrame: public wxFrame
{
public:
wxObjectStorage mStore;
wxFrameLayout* mpLayout;
wxTextCtrl* mpClientWnd;
wxPanel* mpInternalFrm;
wxTextCtrl* CreateTextCtrl( const wxString& value );
public:
MyFrame(wxFrame *frame);
virtual ~MyFrame();
bool OnClose(void) { Show(FALSE); return TRUE; }
void OnLoad( wxCommandEvent& event );
void OnSave( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
#define NEW_TEST_SAVE 1101
#define NEW_TEST_LOAD 1102
#define NEW_TEST_EXIT 1103
#endif