New location for more samples

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19889 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-03-30 19:36:46 +00:00
parent ed0c2af3ab
commit 820893d0d4
34 changed files with 8705 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
treelayM5.mcp
treelayM*Data
*Classic?Debug*
*Classic?Release*
*Carbon?Debug*
*Carbon?Release*
treelay

View File

@@ -0,0 +1,15 @@
# Purpose: makefile for treelay example (UNIX).
# Created: 2000-03-15
top_srcdir = @top_srcdir@/..
top_builddir = ../../../..
program_dir = samples/treelay
PROGRAM=treelay
OBJECTS =$(PROGRAM).o
DEPFILES=$(PROGRAM).d
include ../../../../src/makeprog.env
@IF_GNU_MAKE@-include $(DEPFILES)

View File

@@ -0,0 +1,10 @@
# Purpose: makefile for treelay example (BC++ 32bit)
# Created: 2000-03-15
WXDIR = $(WXWIN)
TARGET=treelay
OBJECTS = $(TARGET).obj
!include $(WXDIR)\src\makeprog.b32

View File

@@ -0,0 +1,10 @@
# Purpose: makefile for treelay example (Cygwin/Mingw32)
# Created: #03.01.00
WXDIR = ../../../..
TARGET=treelay
OBJECTS = $(TARGET).o
include $(WXDIR)/src/makeprog.g95

View File

@@ -0,0 +1,37 @@
# Purpose: makefile for treelay example (Symantec C++)
# Created: 2000-03-15
WXDIR = $(WXWIN)
WXLIB = $(WXDIR)\lib\wx.lib
INCDIR = $(WXDIR)\include
INCLUDE=$(INCDIR)
TARGET=treelay
include $(WXDIR)\src\makesc.env
treelay.exe: treelay.obj $(DEFFILE) treelay.res
*$(CC) $(LDFLAGS) -o$@ $** $(LIBS)
*$(RC) -k treelay.res
sc32.def:
echo EXETYPE NT > sc32.def
echo SUBSYSTEM WINDOWS >> sc32.def
sc16.def:
echo NAME $(TARGET) > sc16.def
echo EXETYPE WINDOWS >> sc16.def
echo STUB 'WINSTUB.EXE' >> sc16.def
echo CODE PRELOAD MOVEABLE DISCARDABLE >> sc16.def
echo DATA PRELOAD MOVEABLE MULTIPLE >> sc16.def
echo HEAPSIZE 1024 >> sc16.def
echo STACKSIZE 8192 >> sc16.def
clean:
-del *.obj
-del *.exe
-del *.res
-del *.map
-del *.rws
-del sc32.def
-del sc16.def

View File

@@ -0,0 +1,23 @@
# Purpose: makefile for treelay example (Unix)
# Created: 2000-03-15
CXX = $(shell wx-config --cxx)
PROGRAM = treelay
OBJECTS = $(PROGRAM).o
# implementation
.SUFFIXES: .o .cpp
.cpp.o :
$(CXX) -c `wx-config --cxxflags` -o $@ $<
all: $(PROGRAM)
$(PROGRAM): $(OBJECTS)
$(CXX) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
clean:
rm -f *.o $(PROGRAM)

View File

@@ -0,0 +1,11 @@
# Purpose: makefile for treelay example (VC++ 32bit)
# Created: 2000-03-15
# Set WXDIR for your system
WXDIR = $(WXWIN)
PROGRAM=treelay
OBJECTS = $(PROGRAM).obj
!include $(WXDIR)\src\makeprog.vc

View File

@@ -0,0 +1,11 @@
# Purpose: makefile for treelay example (Watcom)
# Created: 2000-03-15
WXDIR = $(%WXWIN)
PROGRAM = treelay
OBJECTS = $(PROGRAM).obj
!include $(WXDIR)\src\makeprog.wat

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,213 @@
///////////////////////////////////////////////////////////////////////////////
// Name: treelay.cpp
// Purpose: wxTreeLayout sample
// Author: Julian Smart
// Modified by:
// Created: 7/4/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/treelay.h"
#include "treelay.h"
wxTreeLayoutStored *myTree = (wxTreeLayoutStored *) NULL;
// A macro needed for some compilers (AIX) that need 'main' to be defined
// in the application itself.
IMPLEMENT_APP(MyApp)
// The `main program' equivalent, creating the windows and returning the
// main frame
bool MyApp::OnInit()
{
// Create the main frame window
MyFrame* frame = new MyFrame(NULL, _T("Tree Test"), wxPoint(-1, -1), wxSize(400, 550));
// Give it a status line
frame->CreateStatusBar(2);
// Give it an icon
#ifdef __WINDOWS__
wxIcon icon(_T("tree_icn"));
frame->SetIcon(icon);
#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(TEST_LEFT_RIGHT, _T("&Left to right"), _T("Redraw left to right"));
file_menu->Append(TEST_TOP_BOTTOM, _T("&Top to bottom"), _T("Redraw top to bottom"));
file_menu->AppendSeparator();
file_menu->Append(TEST_QUIT, _T("E&xit"), _T("Quit program"));
wxMenu *help_menu = new wxMenu;
help_menu->Append(TEST_ABOUT, _T("&About"), _T("About Tree Test"));
wxMenuBar* menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
menu_bar->Append(help_menu, _T("&Help"));
// Associate the menu bar with the frame
frame->SetMenuBar(menu_bar);
MyCanvas *canvas = new MyCanvas(frame);
// Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction
canvas->SetScrollbars(20, 20, 50, 50);
frame->canvas = canvas;
myTree = new wxTreeLayoutStored();
wxClientDC dc(canvas);
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
dc.SetFont(font);
TreeTest(*myTree, dc);
frame->Show(TRUE);
frame->SetStatusText(_T("Hello, tree!"));
// Return the main frame window
return TRUE;
}
int MyApp::OnExit()
{
if (myTree)
{
delete myTree;
myTree = (wxTreeLayoutStored *) NULL;
}
return 0;
}
void MyApp::TreeTest(wxTreeLayoutStored& tree, wxDC& dc)
{
tree.Initialize(200);
tree.AddChild(_T("animal"));
tree.AddChild(_T("mammal"), _T("animal"));
tree.AddChild(_T("insect"), _T("animal"));
tree.AddChild(_T("bird"), _T("animal"));
tree.AddChild(_T("man"), _T("mammal"));
tree.AddChild(_T("cat"), _T("mammal"));
tree.AddChild(_T("dog"), _T("mammal"));
tree.AddChild(_T("giraffe"), _T("mammal"));
tree.AddChild(_T("elephant"), _T("mammal"));
tree.AddChild(_T("donkey"), _T("mammal"));
tree.AddChild(_T("horse"), _T("mammal"));
tree.AddChild(_T("fido"), _T("dog"));
tree.AddChild(_T("domestic cat"), _T("cat"));
tree.AddChild(_T("lion"), _T("cat"));
tree.AddChild(_T("tiger"), _T("cat"));
tree.AddChild(_T("felix"), _T("domestic cat"));
tree.AddChild(_T("socks"), _T("domestic cat"));
tree.AddChild(_T("beetle"), _T("insect"));
tree.AddChild(_T("earwig"), _T("insect"));
tree.AddChild(_T("eagle"), _T("bird"));
tree.AddChild(_T("bluetit"), _T("bird"));
tree.AddChild(_T("sparrow"), _T("bird"));
tree.AddChild(_T("blackbird"), _T("bird"));
tree.AddChild(_T("emu"), _T("bird"));
tree.AddChild(_T("crow"), _T("bird"));
tree.DoLayout(dc);
}
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(TEST_QUIT, MyFrame::OnQuit)
EVT_MENU(TEST_ABOUT, MyFrame::OnAbout)
EVT_MENU(TEST_LEFT_RIGHT, MyFrame::OnLeftRight)
EVT_MENU(TEST_TOP_BOTTOM, MyFrame::OnTopBottom)
EVT_CLOSE(MyFrame::OnCloseWindow)
END_EVENT_TABLE()
// Define my frame constructor
MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size):
wxFrame(parent, -1, title, pos, size)
{
}
void MyFrame::OnQuit(wxCommandEvent& event)
{
Close(TRUE);
}
void MyFrame::OnLeftRight(wxCommandEvent& event)
{
if (myTree)
{
myTree->SetOrientation(FALSE);
wxClientDC dc(canvas);
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
dc.SetFont(font);
wxGetApp().TreeTest(*myTree, dc);
canvas->Refresh();
}
}
void MyFrame::OnTopBottom(wxCommandEvent& event)
{
if (myTree)
{
myTree->SetOrientation(TRUE);
wxClientDC dc(canvas);
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
dc.SetFont(font);
wxGetApp().TreeTest(*myTree, dc);
canvas->Refresh();
}
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
(void)wxMessageBox(_T("wxWindows tree library demo Vsn 2.0\nAuthor: Julian Smart (c) 1998"), _T("About tree test"));
}
void MyFrame::OnCloseWindow(wxCloseEvent& event)
{
Destroy();
}
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_PAINT(MyCanvas::OnPaint)
END_EVENT_TABLE()
// Define a constructor for my canvas
MyCanvas::MyCanvas(wxWindow *parent):
wxScrolledWindow(parent, -1)
{
SetBackgroundColour(*wxWHITE);
}
// Define the repainting behaviour
void MyCanvas::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this);
PrepareDC(dc);
if (myTree)
{
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
dc.SetFont(font);
myTree->Draw(dc);
}
}

View File

@@ -0,0 +1,154 @@
# Microsoft Developer Studio Project File - Name="treelay" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=treelay - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "treelay.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "treelay.mak" CFG="treelay - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "treelay - Win32 Release DLL" (based on "Win32 (x86) Application")
!MESSAGE "treelay - Win32 Debug DLL" (based on "Win32 (x86) Application")
!MESSAGE "treelay - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "treelay - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!ELSEIF "$(CFG)" == "treelay - Win32 Release DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseDll"
# PROP BASE Intermediate_Dir "ReleaseDll"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseDll"
# PROP Intermediate_Dir "ReleaseDll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MD /D WXUSINGDLL /I..\..\lib\mswdll
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "NDEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386 ..\..\lib\wxmsw250.lib
!ELSEIF "$(CFG)" == "treelay - Win32 Debug DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugDll"
# PROP BASE Intermediate_Dir "DebugDll"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugDll"
# PROP Intermediate_Dir "DebugDll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /Zi /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MDd /D "__WXDEBUG__" /D "WXDEBUG=1" /D WXUSINGDLL /I..\..\lib\mswdlld
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "_DEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ..\..\lib\wxmsw250d.lib
!ELSEIF "$(CFG)" == "treelay - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MD /I..\..\lib\msw
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "NDEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386 ..\..\lib\zlib.lib ..\..\lib\regex.lib ..\..\lib\png.lib ..\..\lib\jpeg.lib ..\..\lib\tiff.lib ..\..\lib\wxmsw.lib
!ELSEIF "$(CFG)" == "treelay - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /Zi /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MDd /D "__WXDEBUG__" /D "WXDEBUG=1" /I..\..\lib\mswd
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "_DEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\pngd.lib ..\..\lib\jpegd.lib ..\..\lib\tiffd.lib ..\..\lib\wxmswd.lib
!ENDIF
# Begin Target
# Name "treelay - Win32 Release DLL"
# Name "treelay - Win32 Debug DLL"
# Name "treelay - Win32 Release"
# Name "treelay - Win32 Debug"
# Begin Source File
SOURCE=.\treelay.cpp
# End Source File
# Begin Source File
SOURCE=.\treelay.rc
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,55 @@
///////////////////////////////////////////////////////////////////////////////
// Name: treelay.h
// Purpose: wxTreeLayout sample
// Author: Julian Smart
// Modified by:
// Created: 7/4/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// Define a new application
class MyApp: public wxApp
{
public:
virtual bool OnInit();
virtual int OnExit();
void TreeTest(wxTreeLayoutStored& tree, wxDC& dc);
};
DECLARE_APP(MyApp)
class MyCanvas;
class MyFrame: public wxFrame
{
public:
MyCanvas *canvas;
MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size);
void OnCloseWindow(wxCloseEvent& event);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnLeftRight(wxCommandEvent& event);
void OnTopBottom(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
// Define a new canvas which can receive some events
class MyCanvas: public wxScrolledWindow
{
public:
MyCanvas(wxWindow *frame);
void OnPaint(wxPaintEvent& event);
void OnEvent(wxMouseEvent& event);
void OnChar(wxKeyEvent& event);
DECLARE_EVENT_TABLE()
};
#define TEST_QUIT 1
#define TEST_ABOUT 2
#define TEST_LEFT_RIGHT 3
#define TEST_TOP_BOTTOM 4

View File

@@ -0,0 +1,17 @@
# this is the project file for the treelay wxWindows sample
# we generate the VC++ IDE project file, comment this line
# to generate a makefile for (n)make
TEMPLATE = vc6app
# wx is mandatory for wxWindows projects
CONFIG = wx
# the configurations of wxWindows we want to use: the value below is the
# default one; possible other values are {Debug|Release}Unicode[Dll]
#WXCONFIGS = Debug Release DebugDll ReleaseDll
# project files
SOURCES = treelay.cpp
RC_FILE = treelay.rc
TARGET = treelay

View File

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

File diff suppressed because it is too large Load Diff