Initial revision

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1998-05-20 14:01:55 +00:00
parent 1b66e7e5ab
commit c801d85f15
779 changed files with 172138 additions and 0 deletions

1
samples/layout/Makefile Normal file
View File

@@ -0,0 +1 @@
include ../../src/gtk/setup/general/makeapp

View File

@@ -0,0 +1,26 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a library only
RULE=bin
# define library name
BIN_TARGET=test
# define library sources
BIN_SRC=\
layout.cpp
#define library objects
BIN_OBJ=\
layout.o
# additional things needed to link
BIN_LINK=
# additional things needed to compile
ADD_COMPILE=
# include the definitions now
include ../../../template.mak

BIN
samples/layout/aiai.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

38
samples/layout/aiai.xbm Normal file
View File

@@ -0,0 +1,38 @@
#define aiai_width 64
#define aiai_height 64
static char aiai_bits[] = {
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x11,0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44,0x44,0x44,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x11,0x11,0x11,0x11,0x44,0x44,0x44,0x42,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x47,0x44,0x44,0x44,0x44,0x11,0x11,0x11,0x17,0x11,0x11,0x11,0x11,0x11,
0x11,0x91,0x1f,0x11,0x11,0x11,0x11,0x44,0x44,0xc4,0x4f,0x44,0x44,0x44,0x44,
0x44,0x44,0xc4,0x5f,0x44,0xf4,0x45,0x44,0x11,0x11,0xf1,0x1f,0x11,0xf9,0x13,
0x11,0x11,0x11,0xf1,0x3f,0x11,0xfd,0x13,0x11,0x44,0x44,0xf4,0x7f,0x44,0xfc,
0x47,0x44,0x44,0x44,0xf4,0x7f,0x44,0xfc,0x47,0x44,0x11,0x11,0xf9,0x7f,0x11,
0xf9,0x13,0x11,0x11,0x11,0xfd,0xff,0x11,0xf1,0x11,0x11,0x44,0x44,0xfc,0xff,
0x44,0x44,0x44,0x44,0x44,0x44,0xfe,0xff,0x45,0x44,0x44,0x44,0x11,0x11,0xff,
0xff,0x11,0xfd,0x13,0x11,0x11,0x11,0xff,0xff,0x13,0xfd,0x13,0x11,0x44,0xc4,
0xff,0xff,0x07,0xfc,0x43,0x44,0x44,0xff,0xff,0xf9,0xff,0xfd,0xfb,0xff,0x11,
0xc0,0xff,0x00,0x00,0xfc,0x03,0x00,0x11,0xc0,0x7f,0x00,0x00,0xfc,0x03,0x00,
0x04,0xe0,0x7f,0x00,0x00,0xfc,0x03,0x00,0xf4,0xf7,0xbf,0xff,0xff,0xfd,0xfb,
0x7f,0x01,0xf0,0x1f,0x00,0x00,0xfc,0x03,0x00,0x01,0xf8,0x1f,0x00,0x00,0xfc,
0x03,0x00,0x00,0xfc,0x0f,0x00,0x00,0xfc,0x03,0x40,0xfe,0xfd,0xef,0xff,0xff,
0xfd,0xfb,0x4f,0x00,0xfe,0x07,0x00,0x00,0xfc,0x03,0x10,0x00,0xfe,0x03,0x00,
0x00,0xfc,0x03,0x10,0x00,0xff,0x03,0x00,0x00,0xfc,0x03,0x44,0x7f,0xff,0x01,
0x00,0x00,0xfc,0xfb,0x44,0x91,0xff,0xff,0xff,0xff,0xff,0x13,0x11,0xd1,0xff,
0xff,0xff,0xff,0xff,0x13,0x11,0xe4,0xff,0xff,0xff,0xff,0xff,0x47,0x44,0xe4,
0xff,0xff,0xff,0xff,0xff,0x47,0x44,0xf1,0xff,0xff,0xff,0xff,0xff,0x13,0x11,
0xf1,0xff,0xff,0xff,0xff,0xff,0x13,0x11,0xfc,0xff,0xff,0xff,0xff,0xff,0x47,
0x44,0xfc,0xff,0xff,0xff,0xff,0xff,0x47,0x44,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x10,0x11,0x44,0x44,0xc4,0x44,0x44,
0xc4,0x44,0x44,0x44,0x4e,0xc4,0x44,0x4e,0xc4,0x44,0x44,0x11,0x1f,0xd1,0x11,
0x1f,0xd1,0x11,0x11,0x91,0x31,0xd1,0x91,0x31,0xd1,0x11,0x11,0xc4,0x64,0xcc,
0xcc,0x64,0xcc,0x44,0x44,0x64,0xc4,0xcc,0x6c,0xc4,0xcc,0x44,0x44,0xf1,0xff,
0xd1,0xf1,0xff,0xd1,0x11,0x11,0xf9,0xff,0xd3,0xf9,0xff,0xd3,0x11,0x11,0x4c,
0x44,0xc6,0x4c,0x44,0xc6,0x44,0x44,0x4c,0x44,0xc6,0x4c,0x44,0xc6,0x44,0x44,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44};

161
samples/layout/expt.cpp Normal file
View File

@@ -0,0 +1,161 @@
/*
* Experimental code to use operators for constraint specification.
* In the end, the syntax didn't look much clearer than
* the original, so abandoned.
Example:
wxConstrain(frame->panel,
( leftOf (frame->panel) = leftOf (frame),
topOf (frame->panel) = topOf (frame),
rightOf (frame->panel) = rightOf (frame),
heightOf (frame->panel) = 50 % heightOf (frame)
)
);
*/
// Operator experiments
#define wxCONSTRAINT_OP_REL 1
#define wxCONSTRAINT_OP_PERCENT 2
#define wxCONSTRAINT_OP_EDGE 3
#define wxCONSTRAINT_OP_ABS 4
#define wxCONSTRAINT_OP_AND 5
class wxConstraintOp: public wxObject
{
public:
int opType;
wxEdge edge;
wxRelationship relationship;
wxWindow *win;
int value;
int margin;
wxConstraintOp *lhs;
wxConstraintOp *rhs;
wxConstraintOp(int typ)
{
opType = typ;
edge = wxLeft;
win = NULL;
value = 0;
margin = 0;
relationship = wxSameAs;
lhs = 0; rhs = 0;
}
wxConstraintOp(const wxConstraintOp& op)
{
opType = op.opType;
edge = op.edge;
relationship = op.relationship;
win = op.win;
value = op.value;
margin = op.margin;
if (op.lhs)
lhs = new wxConstraintOp(*op.lhs);
else
lhs = NULL;
if (op.rhs)
rhs = new wxConstraintOp(*op.rhs);
else
rhs = NULL;
}
~wxConstraintOp(void)
{
if (lhs)
delete lhs;
if (rhs)
delete rhs;
}
wxConstraintOp operator = (const wxConstraintOp& arg2);
wxConstraintOp operator = (const int value);
friend wxConstraintOp operator % (const int perCent, const wxConstraintOp& arg2);
friend wxConstraintOp operator + (wxConstraintOp& arg1, int margin);
friend wxConstraintOp operator - (wxConstraintOp& arg1, int margin);
friend wxConstraintOp operator , (const wxConstraintOp& arg1, const wxConstraintOp& arg2);
};
wxConstraintOp leftOf(wxWindow *win)
{
wxConstraintOp thing(wxCONSTRAINT_OP_EDGE);
thing.win = win;
thing.edge = wxLeft;
return thing;
}
wxConstraintOp topOf(wxWindow *win)
{
wxConstraintOp thing(wxCONSTRAINT_OP_EDGE);
thing.win = win;
thing.edge = wxTop;
return thing;
}
wxConstraintOp widthOf(wxWindow *win)
{
wxConstraintOp thing(wxCONSTRAINT_OP_EDGE);
thing.win = win;
thing.edge = wxWidth;
return thing;
}
wxConstraintOp wxConstraintOp::operator = (const wxConstraintOp& arg2)
{
wxConstraintOp op3(wxCONSTRAINT_OP_REL);
op3.relationship = wxPercentOf;
op3.value = 100;
if ((op3.relationship == wxPercentOf) && (op3.value > 0))
op3.value = this->value;
op3.lhs = new wxConstraintOp(*this);
op3.rhs = new wxConstraintOp(arg2);
return op3;
}
wxConstraintOp wxConstraintOp::operator = (const int value)
{
wxConstraintOp op3(wxCONSTRAINT_OP_REL);
op3.relationship = wxAbsolute;
op3.lhs = new wxConstraintOp(*this);
op3.rhs = new wxConstraintOp(wxCONSTRAINT_OP_ABS);
op3.value = value;
return op3;
}
wxConstraintOp operator % (const int perCent, const wxConstraintOp& arg2)
{
wxConstraintOp op3(arg2);
op3.opType = wxCONSTRAINT_OP_EDGE;
op3.value = perCent;
if (op3.value > 0)
op3.value = arg2.value;
return op3;
}
wxConstraintOp operator + (wxConstraintOp& arg1, int margin)
{
wxConstraintOp op3(arg1);
op3.margin = margin;
return op3;
}
wxConstraintOp operator - (wxConstraintOp& arg1, int margin)
{
wxConstraintOp op3(arg1);
op3.margin = - margin;
return op3;
}
wxConstraintOp operator , (const wxConstraintOp& arg1, const wxConstraintOp& arg2)
{
wxConstraintOp op3(wxCONSTRAINT_OP_AND);
op3.lhs = new wxConstraintOp(arg1);
op3.rhs = new wxConstraintOp(arg2);
return op3;
}

11
samples/layout/fload.xbm Normal file
View File

@@ -0,0 +1,11 @@
#define fload_width 30
#define fload_height 30
static char fload_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x0f,0xf8,0xff,0xfb,0x0f,0x08,0x00,0xf0,
0x0f,0xc8,0xff,0xef,0x0f,0x48,0x00,0xf0,0x0f,0x48,0x00,0xf8,0x0f,0x48,0x00,
0xfc,0x0e,0x48,0x00,0x7f,0x0c,0x48,0xc0,0xbf,0x00,0x48,0xf0,0x9f,0x04,0x48,
0xfe,0x8f,0x04,0x48,0xff,0x87,0x04,0x48,0x00,0x80,0x04,0x48,0x00,0x80,0x04,
0x48,0x00,0x80,0x04,0x48,0x00,0x80,0x04,0xc8,0xff,0xff,0x04,0x08,0x00,0x00,
0x04,0x08,0x00,0x00,0x04,0x08,0xff,0x1f,0x04,0x08,0x01,0x10,0x04,0x08,0x1d,
0x10,0x04,0x08,0x15,0x10,0x04,0x08,0x15,0x10,0x04,0x08,0x15,0x10,0x04,0x08,
0x15,0x10,0x04,0x10,0x1d,0x10,0x04,0xe0,0xff,0xff,0x07,0x00,0x00,0x00,0x00};

367
samples/layout/layout.cpp Normal file
View File

@@ -0,0 +1,367 @@
/////////////////////////////////////////////////////////////////////////////
// Name: layout.cpp
// Purpose: Layout sample
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// 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"
#endif
#if !USE_CONSTRAINTS
#error You must set USE_CONSTRAINTS to 1 in wx_setup.h!
#endif
#include <ctype.h>
#include "layout.h"
// Declare two frames
MyFrame *frame = NULL;
wxMenuBar *menu_bar = NULL;
IMPLEMENT_APP(MyApp)
#ifdef __X__
#include "aiai.xbm"
#endif
MyApp::MyApp()
{
}
bool MyApp::OnInit(void)
{
// Create the main frame window
frame = new MyFrame(NULL, "wxWindows Layout Demo", 0, 0, 550, 500);
frame->SetAutoLayout(TRUE);
// Give it a status line
frame->CreateStatusBar(2);
// Load icon and bitmap
#ifdef __WINDOWS__
frame->SetIcon(wxIcon("aiai_icn"));
#endif
#ifdef __X__
frame->SetIcon(wxIcon(aiai_bits, aiai_width, aiai_height));
#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(LAYOUT_LOAD_FILE, "&Load file", "Load a text file");
file_menu->Append(LAYOUT_TEST, "&Test sizers", "Test sizer code");
file_menu->AppendSeparator();
file_menu->Append(LAYOUT_QUIT, "E&xit", "Quit program");
wxMenu *help_menu = new wxMenu;
help_menu->Append(LAYOUT_ABOUT, "&About", "About layout demo");
menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with the frame
frame->SetMenuBar(menu_bar);
// Make a panel
frame->panel = new wxPanel(frame, 0, 0, 1000, 500, wxTAB_TRAVERSAL);
frame->panel->SetBackgroundColour(wxColour(192, 192, 192));
// frame->panel->SetAutoLayout(TRUE);
// Create some panel items
wxButton *btn1 = new wxButton(frame->panel, -1, "A button (1)") ;
wxLayoutConstraints *b1 = new wxLayoutConstraints;
b1->centreX.SameAs (frame->panel, wxCentreX);
b1->top.SameAs (frame->panel, wxTop, 5);
b1->width.PercentOf (frame->panel, wxWidth, 80);
b1->height.PercentOf (frame->panel, wxHeight, 10);
btn1->SetConstraints(b1);
wxListBox *list = new wxListBox(frame->panel, -1,
wxPoint(-1, -1), wxSize(200, 100));
list->Append("Apple");
list->Append("Pear");
list->Append("Orange");
list->Append("Banana");
list->Append("Fruit");
wxLayoutConstraints *b2 = new wxLayoutConstraints;
b2->top.Below (btn1, 5);
b2->left.SameAs (frame->panel, wxLeft, 5);
b2->width.PercentOf (frame->panel, wxWidth, 40);
b2->bottom.SameAs (frame->panel, wxBottom, 5);
list->SetConstraints(b2);
wxTextCtrl *mtext = new wxTextCtrl(frame->panel, -1, "Some text",
wxPoint(-1, -1), wxSize(150, 100));
wxLayoutConstraints *b3 = new wxLayoutConstraints;
b3->top.Below (btn1, 5);
b3->left.RightOf (list, 5);
b3->right.SameAs (frame->panel, wxRight, 5);
b3->bottom.SameAs (frame->panel, wxBottom, 5);
mtext->SetConstraints(b3);
frame->canvas = new MyWindow(frame, 0, 0, 400, 400, wxRETAINED);
// Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction
// canvas->SetScrollbars(20, 20, 50, 50, 4, 4);
// Make a text window
frame->text_window = new MyTextWindow(frame, 0, 250, 400, 250);
// Set constraints for panel subwindow
wxLayoutConstraints *c1 = new wxLayoutConstraints;
c1->left.SameAs (frame, wxLeft);
c1->top.SameAs (frame, wxTop);
c1->right.PercentOf (frame, wxWidth, 50);
c1->height.PercentOf (frame, wxHeight, 50);
frame->panel->SetConstraints(c1);
// Set constraints for canvas subwindow
wxLayoutConstraints *c2 = new wxLayoutConstraints;
c2->left.SameAs (frame->panel, wxRight);
c2->top.SameAs (frame, wxTop);
c2->right.SameAs (frame, wxRight);
c2->height.PercentOf (frame, wxHeight, 50);
frame->canvas->SetConstraints(c2);
// Set constraints for text subwindow
wxLayoutConstraints *c3 = new wxLayoutConstraints;
c3->left.SameAs (frame, wxLeft);
c3->top.Below (frame->panel);
c3->right.SameAs (frame, wxRight);
c3->bottom.SameAs (frame, wxBottom);
frame->text_window->SetConstraints(c3);
frame->Show(TRUE);
frame->SetStatusText("wxWindows layout demo");
SetTopWindow(frame);
return TRUE;
}
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h):
wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{
panel = NULL;
text_window = NULL;
canvas = NULL;
}
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(LAYOUT_LOAD_FILE, MyFrame::LoadFile)
EVT_MENU(LAYOUT_QUIT, MyFrame::Quit)
EVT_MENU(LAYOUT_TEST, MyFrame::TestSizers)
EVT_MENU(LAYOUT_ABOUT, MyFrame::About)
EVT_SIZE(MyFrame::OnSize)
END_EVENT_TABLE()
void MyFrame::LoadFile(wxCommandEvent& event)
{
char *s = wxFileSelector("Load text file", NULL, NULL, NULL, "*.txt");
if (s)
{
#ifdef __WINDOWS__
frame->text_window->LoadFile(s);
#endif
}
}
void MyFrame::Quit(wxCommandEvent& event)
{
this->Close(TRUE);
}
void MyFrame::TestSizers(wxCommandEvent& event)
{
SizerFrame *newFrame = new SizerFrame(NULL, "Sizer Test Frame", 50, 50, 500, 500);
newFrame->Show(TRUE);
}
void MyFrame::About(wxCommandEvent& event)
{
(void)wxMessageBox("wxWindows GUI library layout demo\n",
"About Layout Demo", wxOK|wxCENTRE);
}
// Size the subwindows when the frame is resized
void MyFrame::OnSize(wxSizeEvent& event)
{
Layout();
}
void MyFrame::Draw(wxDC& dc, bool draw_bitmaps)
{
dc.SetPen(wxGREEN_PEN);
dc.DrawLine(0.0, 0.0, 200.0, 200.0);
dc.DrawLine(200.0, 0.0, 0.0, 200.0);
dc.SetBrush(wxCYAN_BRUSH);
dc.SetPen(wxRED_PEN);
dc.DrawRectangle(100.0, 100.0, 100.0, 50.0);
dc.DrawRoundedRectangle(150.0, 150.0, 100.0, 50.0,20.0);
dc.DrawEllipse(250.0, 250.0, 100.0, 50.0);
dc.DrawSpline(50.0, 200.0, 50.0, 100.0, 200.0, 10.0);
dc.DrawLine(50.0, 230.0, 200.0, 230.0);
dc.SetPen(wxBLACK_PEN);
dc.DrawArc(50.0, 300.0, 100.0, 250.0, 100.0, 300.0);
}
BEGIN_EVENT_TABLE(MyWindow, wxWindow)
EVT_PAINT(MyWindow::OnPaint)
END_EVENT_TABLE()
// Define a constructor for my canvas
MyWindow::MyWindow(wxFrame *frame, int x, int y, int w, int h, long style):
wxWindow(frame, -1, wxPoint(x, y), wxSize(w, h), style)
{
}
MyWindow::~MyWindow(void)
{
}
// Define the repainting behaviour
void MyWindow::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this);
frame->Draw(dc,TRUE);
}
// Define the behaviour for the frame closing
// - must delete all frames except for the main one.
bool MyFrame::OnClose(void)
{
Show(FALSE);
return TRUE;
}
SizerFrame::SizerFrame(wxFrame *frame, char *title, int x, int y, int w, int h):
wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{
panel = new wxPanel(this, -1, wxPoint(0, 0), wxSize(-1, -1), wxTAB_TRAVERSAL);
panel->SetBackgroundColour(wxColour(192, 192, 192));
// A sizer to fit the whole panel, plus two sizers, one
// above the other. A button is centred on the lower
// sizer; a rowcol containing 3 buttons is centred on the upper
// sizer.
wxSizer *expandSizer = new wxSizer(panel, wxSizerExpand);
expandSizer->SetName("expandSizer");
wxLayoutConstraints *c;
/////// TOP OF PANEL
///////
wxSizer *topSizer = new wxSizer(expandSizer);
topSizer->SetName("topSizer");
// Specify constraints for the top sizer
c = new wxLayoutConstraints;
c->left.SameAs (expandSizer, wxLeft);
c->top.SameAs (expandSizer, wxTop);
c->right.SameAs (expandSizer, wxRight);
c->height.PercentOf (expandSizer, wxHeight, 50);
topSizer->SetConstraints(c);
/*
* Add a row-col sizer and some buttons
*/
// Default is layout by rows, 20 columns per row, shrink to fit.
wxRowColSizer *rowCol = new wxRowColSizer(topSizer);
rowCol->SetName("rowCol");
wxButton *button = new wxButton(panel, -1, "Button 1");
rowCol->AddSizerChild(button);
button = new wxButton(panel, -1, "Button 2");
rowCol->AddSizerChild(button);
button = new wxButton(panel, -1, "Button 3");
rowCol->AddSizerChild(button);
// Centre the rowcol in the middle of the upper sizer
c = new wxLayoutConstraints;
c->centreX.SameAs (topSizer, wxCentreX);
c->centreY.SameAs (topSizer, wxCentreY);
c->width.AsIs();
c->height.AsIs();
rowCol->SetConstraints(c);
/////// BOTTOM OF PANEL
///////
wxSizer *bottomSizer = new wxSizer(expandSizer);
// Specify constraints for the bottom sizer
c = new wxLayoutConstraints;
c->left.SameAs (expandSizer, wxLeft);
c->top.PercentOf (expandSizer, wxHeight, 50);
c->right.SameAs (expandSizer, wxRight);
c->height.PercentOf (expandSizer, wxHeight, 50);
bottomSizer->SetConstraints(c);
wxButton *button2 = new wxButton(panel, -1, "Test button");
// The button should be a child of the bottom sizer
bottomSizer->AddSizerChild(button2);
// Centre the button on the sizer
c = new wxLayoutConstraints;
c->centreX.SameAs (bottomSizer, wxCentreX);
c->centreY.SameAs (bottomSizer, wxCentreY);
c->width.PercentOf (bottomSizer, wxWidth, 20);
c->height.PercentOf (bottomSizer, wxHeight, 20);
button2->SetConstraints(c);
}
BEGIN_EVENT_TABLE(SizerFrame, wxFrame)
EVT_SIZE(SizerFrame::OnSize)
END_EVENT_TABLE()
// Size the subwindows when the frame is resized
void SizerFrame::OnSize(wxSizeEvent& event)
{
wxFrame::OnSize(event);
panel->Layout();
}
bool SizerFrame::OnClose(void)
{
Show(FALSE);
return TRUE;
}

View File

@@ -0,0 +1,9 @@
NAME Layout
DESCRIPTION 'Layout'
EXETYPE WINDOWS
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 1024
STACKSIZE 16192

79
samples/layout/layout.h Normal file
View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////
// Name: layout.h
// Purpose: Layout sample
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Define a new application
class MyApp: public wxApp
{
public:
MyApp(void) ;
bool OnInit(void);
};
// Define a new frame
class MyTextWindow;
class MyWindow;
class MyFrame: public wxFrame
{
public:
wxPanel *panel;
MyTextWindow *text_window;
MyWindow *canvas;
MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
void OnSize(wxSizeEvent& event);
bool OnClose(void);
void Draw(wxDC& dc, bool draw_bitmaps = TRUE);
void LoadFile(wxCommandEvent& event);
void Quit(wxCommandEvent& event);
void TestSizers(wxCommandEvent& event);
void About(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
// Define a new text subwindow that can respond to drag-and-drop
class MyTextWindow: public wxTextCtrl
{
public:
MyTextWindow(wxFrame *frame, int x=-1, int y=-1, int width=-1, int height=-1,
long style=wxTE_MULTILINE):
wxTextCtrl(frame, -1, "", wxPoint(x, y), wxSize(width, height), style)
{
}
};
// Define a new canvas which can receive some events
class MyWindow: public wxWindow
{
public:
MyWindow(wxFrame *frame, int x, int y, int w, int h, long style = wxRETAINED);
~MyWindow(void) ;
void OnPaint(wxPaintEvent& event);
DECLARE_EVENT_TABLE()
};
class SizerFrame: public wxFrame
{
public:
wxPanel *panel;
SizerFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
void OnSize(wxSizeEvent& event);
bool OnClose(void);
DECLARE_EVENT_TABLE()
};
#define LAYOUT_QUIT 100
#define LAYOUT_TEST 101
#define LAYOUT_ABOUT 102
#define LAYOUT_LOAD_FILE 103

3
samples/layout/layout.rc Normal file
View File

@@ -0,0 +1,3 @@
aiai_icn ICON "aiai.ico"
#include "wx/msw/wx.rc"

View File

@@ -0,0 +1,63 @@
#
# File: makefile.bcc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds layout example (DOS).
# WXWIN and BCCDIR are set by parent make
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makeb32.env
WXLIBDIR = $(WXDIR)\lib
WXLIB = $(WXLIBDIR)\wx32.lib
LIBS=$(WXLIB) cw32 import32
TARGET=layout
!if "$(FINAL)" == "0"
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS= -v
!else
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS =
!endif
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
OBJECTS = layout.obj
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
tlink32 $(LINKFLAGS) @&&!
c0w32.obj $(OBJECTS)
$(TARGET)
nul
$(LIBS)
$(TARGET).def
!
brc32 -K $(TARGET).res
.$(SRCSUFF).obj:
bcc32 $(CPPFLAGS) -c {$< }
.c.obj:
bcc32 $(CPPFLAGS) -P- -c {$< }
layout.obj: layout.$(SRCSUFF) layout.h
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.rws

View File

@@ -0,0 +1,76 @@
#
# File: makefile.bcc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds layout example (DOS).
!if "$(BCCDIR)" == ""
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
!endif
!if "$(WXWIN)" == ""
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
!endif
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makebcc.env
THISDIR = $(WXDIR)\samples\layout
WXLIB = $(WXDIR)\lib\wx.lib
LIBS=$(WXLIB) mathwl cwl import
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
CFG=$(WXDIR)\src\wxwin.cfg
!ifndef FINAL
FINAL=0
!endif
!if "$(FINAL)" == "0"
LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS= -v
!else
LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
OPT = -O2
DEBUG_FLAGS =
!endif
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
HEADERS = layout.h
SOURCES = layout.$(SRCSUFF)
OBJECTS = layout.obj
layout: layout.exe
all: layout.exe
layout.exe: $(WXLIB) layout.obj layout.def layout.res
tlink $(LINKFLAGS) @&&!
c0wl.obj layout.obj
layout
nul
$(LIBS)
layout.def
!
rc -30 -K layout.res
.$(SRCSUFF).obj:
bcc $(CPPFLAGS) -c {$< }
layout.obj: layout.$(SRCSUFF)
layout.res : layout.rc $(WXDIR)\include\msw\wx.rc
rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa layout
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.rws

View File

@@ -0,0 +1,85 @@
#
# File: makefile.dos
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds layout example (DOS).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info.
# Set WXDIR for your system
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makemsc.env
THISDIR = $(WXDIR)\samples\layout
WXLIB = $(WXDIR)\lib\wx.lib
LIBS=$(WXLIB) oldnames libw llibcew commdlg ddeml shell mmsystem
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
DUMMY=$(WXDIR)\src\msw\dummy.obj
# Set this to nothing if using MS C++ 7
ZOPTION=/Z7
!ifndef FINAL
FINAL=0
!endif
!if "$(FINAL)" == "0"
CPPFLAGS=/AL /W3 /Zi $(ZOPTION) /G2sw /Od $(INC) /YuWX_PREC.H /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch
LINKFLAGS=/NOD /CO /ONERROR:NOEXE /SEG:512
!else
CPPFLAGS=/AL /W3 /G2sw $(INC) /Ox /YuWX_PREC.H /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch
LINKFLAGS=/NOD /ONERROR:NOEXE /SEG:512
!endif
HEADERS = layout.h
SOURCES = layout.$(SRCSUFF)
OBJECTS = layout.obj
layout: layout.exe
all: wx layout.exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.dos FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.dos clean
cd $(THISDIR)
layout.exe: $(DUMMY) $(WXLIB) layout.obj layout.def layout.res
link $(LINKFLAGS) @<<
$(DUMMY) layout.obj,
layout,
NUL,
$(LIBS),
layout.def
;
<<
rc -31 -K layout.res
layout.obj: layout.h layout.$(SRCSUFF) $(DUMMY)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
layout.res : layout.rc $(WXDIR)\include\msw\wx.rc
rc -r /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa layout
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb

View File

@@ -0,0 +1,35 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile for layout example (UNIX).
WXDIR = ../..
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/makeg95.env
OBJECTS=$(OBJDIR)/layout.$(OBJSUFF) $(OBJDIR)/layout_resources.o
all: $(OBJDIR) layout.exe
$(OBJDIR):
mkdir $(OBJDIR)
layout.exe: $(OBJECTS) $(WXLIB)
$(CC) $(LDFLAGS) -o layout$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
$(OBJDIR)/layout.$(OBJSUFF): layout.$(SRCSUFF) layout.h
$(CC) -c $(CPPFLAGS) -o $@ layout.$(SRCSUFF)
$(OBJDIR)/layout_resources.o: layout.rc
$(RESCOMP) -i layout.rc -o $(OBJDIR)/layout_resources.o $(RESFLAGS)
clean:
rm -f $(OBJECTS) layout$(GUISUFFIX).exe core *.res *.rsc

View File

@@ -0,0 +1,63 @@
#
# File: makefile.nt
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds layout example (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
!include $(WXDIR)\src\ntwxwin.mak
THISDIR = $(WXDIR)\samples\layout
PROGRAM=layout
OBJECTS = $(PROGRAM).obj
$(PROGRAM): $(PROGRAM).exe
all: wx $(PROGRAM).exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.nt FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.nt clean
cd $(THISDIR)
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
$(link) @<<
-out:$(PROGRAM).exe
$(LINKFLAGS)
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
$(LIBS)
<<
$(PROGRAM).obj: $(PROGRAM).h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
clean:
-erase *.obj
-erase *.sbr
-erase *.exe
-erase *.res
-erase *.map
-erase *.pdb

View File

@@ -0,0 +1,37 @@
# Symantec C++ makefile for layout example
# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makesc.env
WXLIB = $(WXDIR)\lib\wx.lib
INCDIR = $(WXDIR)\include
MSWINC = $(INCDIR)\msw
BASEINC = $(INCDIR)\base
CC=sc
RC=rc
CFLAGS = -o -ml -W -Dwx_msw
LDFLAGS = -ml -W
INCLUDE=$(BASEINC);$(MSWINC)
LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
.$(SRCSUFF).obj:
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
.rc.res:
*$(RC) -r -I$(INCLUDE) $<
layout.exe: layout.obj layout.def layout.res
*$(CC) $(LDFLAGS) -o$@ layout.obj layout.def $(LIBS)
*$(RC) -k layout.res
clean:
-del *.obj
-del *.exe
-del *.res
-del *.map
-del *.rws

View File

@@ -0,0 +1,76 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile for layout example (UNIX).
WXDIR = ../..
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/make.env
OBJECTS=$(OBJDIR)/layout.$(OBJSUFF)
.SUFFIXES:
all: $(OBJDIR) layout$(GUISUFFIX)
wxmotif:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
wxxview:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
wxhp:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
# For SGI, include -lPW on your LDLIBS
motif: wxmotif
$(MAKE) -f makefile.unx all GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
xview: wxxview
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' LDLIBS='$(XVIEWLDLIBS)'
hp: wxhp
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC OPT='' DEBUG='$(DEBUG)' WARN='-w' \
XINCLUDE='$(HPXINCLUDE)' \
XLIB='$(HPXLIB)' \
XVIEW_LINK='' \
LDLIBS='$(HPLDLIBS)'
$(OBJDIR):
mkdir $(OBJDIR)
layout$(GUISUFFIX): $(OBJDIR)/layout.$(OBJSUFF) $(WXLIB)
$(CC) $(LDFLAGS) -o layout$(GUISUFFIX) $(OBJDIR)/layout.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
$(OBJDIR)/layout.$(OBJSUFF): layout.$(SRCSUFF) layout.h
$(CC) -c $(CPPFLAGS) -o $@ layout.$(SRCSUFF)
clean_motif:
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
clean_ol:
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
clean_hp:
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
cleanany:
rm -f $(OBJECTS) layout$(GUISUFFIX) core
wxclean_ol:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_ol
wxclean_motif:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_motif
wxclean_hp:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_hp

View File

@@ -0,0 +1,41 @@
#************************************************************************
# Makefile for LAYOUT under VMS
# by Stefan Hammes
# (incomplete) update history:
# 14.05.95
#************************************************************************
#************************************************************************
# Definition section
# (cave: definitions and includes must begin with ',')
#************************************************************************
APPOPTS =
APPDEFS =
APPINCS =
#************************************************************************
# Module section
#************************************************************************
# Name of main module
MAIN = layout
# Object modules of the application.
OBJS = layout.obj
OBJLIST =layout.obj
.include [--.src]makevms.env
# main dependency
$(MAIN).exe : $(OBJS)
$(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(OBJLIST),$(WXLIB)/lib,$(OPTSFILE)/option
- purge *.exe
#************************************************************************
# Header file depedencies following
#************************************************************************
layout.obj : layout.cc layout.h

View File

@@ -0,0 +1,44 @@
#
# Makefile for WATCOM
#
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
# 8 Nov 1994
#
WXDIR = ..\..
!include $(WXDIR)\src\makewat.env
WXLIB = $(WXDIR)\lib
NAME = layout
LNK = $(name).lnk
OBJS = $(name).obj
all: $(name).exe
$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
wlink @$(LNK)
$(BINDCOMMAND) $(name).res
$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc
$(RC) $(RESFLAGS1) $(name).rc
$(LNK) : makefile.wat
%create $(LNK)
@%append $(LNK) debug all
@%append $(LNK) system $(LINKOPTION)
@%append $(LNK) $(MINDATA)
@%append $(LNK) $(MAXDATA)
@%append $(LNK) $(STACK)
@%append $(LNK) name $(name)
@%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
@for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
@for %i in ($(OBJS)) do @%append $(LNK) file %i
thing: .SYMBOLIC
echo $(WATLIBDIR)
clean: .SYMBOLIC
-erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex