Added Property List classes to main library; added proplist sample; merged

changes.txt files


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-12-31 16:15:45 +00:00
parent 8973fbec7e
commit e3a43801df
76 changed files with 9575 additions and 2686 deletions

View File

@@ -11,7 +11,8 @@
WXDIR = $(WXWIN)
TARGET=bombs
OBJECTS=$(TARGET).obj bombs1.obj game.obj
OBJECTS=dialoged.obj reseditr.obj dlghndlr.obj reswrite.obj\
winprop.obj edtree.obj edlist.obj symbtabl.obj winstyle.obj
!include $(WXDIR)\src\makeprog.msc

View File

@@ -11,7 +11,7 @@
PROGRAM=bombs
OBJECTS=$(PROGRAM).o bombs1.o game.o
OBJECTS = bombs.o bombs1.o game.o
include ../../src/makeprog.env

View File

@@ -16,6 +16,8 @@ WXDIR = ..
THISDIR=$(WXDIR)/samples
all:
cd $(WXDIR)/samples/bombs; make -f makefile.g95
cd $(WXDIR)/samples/fractal; make -f makefile.g95
cd $(WXDIR)/samples/splitter; make -f makefile.g95
cd $(WXDIR)/samples/resource; make -f makefile.g95
cd $(WXDIR)/samples/controls; make -f makefile.g95
@@ -26,6 +28,7 @@ all:
cd $(WXDIR)/samples/minimal; make -f makefile.g95
cd $(WXDIR)/samples/layout; make -f makefile.g95
cd $(WXDIR)/samples/printing; make -f makefile.g95
cd $(WXDIR)/samples/proplist; make -f makefile.g95
cd $(WXDIR)/samples/toolbar; make -f makefile.g95
cd $(WXDIR)/samples/dialogs; make -f makefile.g95
cd $(WXDIR)/samples/docview; make -f makefile.g95
@@ -43,11 +46,14 @@ all:
# cd $(WXDIR)/samples/regtest; make -f makefile.g95
clean:
cd $(WXDIR)/samples/bombs; make -f makefile.g95 clean
cd $(WXDIR)/samples/fractal; make -f makefile.g95 clean
cd $(WXDIR)/samples/splitter; make -f makefile.g95 clean
cd $(WXDIR)/samples/mdi; make -f makefile.g95 clean
cd $(WXDIR)/samples/minimal; make -f makefile.g95 clean
cd $(WXDIR)/samples/layout; make -f makefile.g95 clean
cd $(WXDIR)/samples/printing; make -f makefile.g95 clean
cd $(WXDIR)/samples/proplist; make -f makefile.g95 clean
cd $(WXDIR)/samples/toolbar; make -f makefile.g95 clean
cd $(WXDIR)/samples/dialogs; make -f makefile.g95 clean
cd $(WXDIR)/samples/resource; make -f makefile.g95 clean

View File

@@ -74,28 +74,18 @@ all:
nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
cd $(WXDIR)\samples\minifram
nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
cd $(WXDIR)\samples\bombs
nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
cd $(WXDIR)\samples\fractal
nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
cd $(WXDIR)\samples\wxpoem
nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
cd $(WXDIR)\samples\types
nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
cd $(WXDIR)\samples\proplist
nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\regtest
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\hello
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\fractal
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\ipc
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\wxpoem
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\types
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\pressup
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\bombs
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\animate
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\panel
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
# cd $(WXDIR)\samples\odbc
# nmake -f makefile.nt DEBUG_FLAGS=$(DEBUG_FLAGS) LINK_DEBUG_FLAGS=$(LINK_DEBUG_FLAGS)
clean:
cd $(WXDIR)\samples\splitter
@@ -150,24 +140,14 @@ clean:
nmake -f makefile.nt clean
cd $(WXDIR)\samples\minifram
nmake -f makefile.nt clean
# cd $(WXDIR)\samples\hello
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\fractal
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\ipc
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\types
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\pressup
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\bombs
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\odbc
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\animate
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\panel
# nmake -f makefile.nt clean
# cd $(WXDIR)\samples\wxpoem
# nmake -f makefile.nt clean
cd $(WXDIR)\samples\bombs
nmake -f makefile.nt clean
cd $(WXDIR)\samples\fractal
nmake -f makefile.nt clean
cd $(WXDIR)\samples\wxpoem
nmake -f makefile.nt clean
cd $(WXDIR)\samples\types
nmake -f makefile.nt clean
cd $(WXDIR)\samples\proplist
nmake -f makefile.nt clean

View File

@@ -15,6 +15,7 @@ TARGET=motif
THISDIR = $(WXDIR)/samples
all:
cd bombs; $(MAKE) -f makefile.unx $(TARGET)
cd config; $(MAKE) -f makefile.unx $(TARGET)
cd controls; $(MAKE) -f makefile.unx $(TARGET)
cd dialogs; $(MAKE) -f makefile.unx $(TARGET)
@@ -22,6 +23,7 @@ all:
cd docview; $(MAKE) -f makefile.unx $(TARGET)
cd docvwmdi; $(MAKE) -f makefile.unx $(TARGET)
cd dynamic; $(MAKE) -f makefile.unx $(TARGET)
cd fractal; $(MAKE) -f makefile.unx $(TARGET)
cd grid; $(MAKE) -f makefile.unx $(TARGET)
cd help; $(MAKE) -f makefile.unx $(TARGET)
cd image; $(MAKE) -f makefile.unx $(TARGET)
@@ -33,6 +35,7 @@ all:
cd nativdlg; $(MAKE) -f makefile.unx $(TARGET)
cd notebook; $(MAKE) -f makefile.unx $(TARGET)
cd printing; $(MAKE) -f makefile.unx $(TARGET)
cd proplist; $(MAKE) -f makefile.unx $(TARGET)
cd resource; $(MAKE) -f makefile.unx $(TARGET)
cd sashtest; $(MAKE) -f makefile.unx $(TARGET)
cd splitter; $(MAKE) -f makefile.unx $(TARGET)
@@ -45,6 +48,7 @@ all:
cd wxpoem; $(MAKE) -f makefile.unx $(TARGET)
clean:
cd bombs; $(MAKE) -f makefile.unx clean$(TARGET)
cd config; $(MAKE) -f makefile.unx clean$(TARGET)
cd controls; $(MAKE) -f makefile.unx clean$(TARGET)
cd dialogs; $(MAKE) -f makefile.unx clean$(TARGET)
@@ -52,6 +56,7 @@ clean:
cd docview; $(MAKE) -f makefile.unx clean$(TARGET)
cd docvwmdi; $(MAKE) -f makefile.unx clean$(TARGET)
cd dynamic; $(MAKE) -f makefile.unx clean$(TARGET)
cd fractal; $(MAKE) -f makefile.unx clean$(TARGET)
cd grid; $(MAKE) -f makefile.unx clean$(TARGET)
cd help; $(MAKE) -f makefile.unx clean$(TARGET)
cd image; $(MAKE) -f makefile.unx clean$(TARGET)
@@ -63,6 +68,7 @@ clean:
cd nativdlg; $(MAKE) -f makefile.unx clean$(TARGET)
cd notebook; $(MAKE) -f makefile.unx clean$(TARGET)
cd printing; $(MAKE) -f makefile.unx clean$(TARGET)
cd proplist; $(MAKE) -f makefile.unx clean$(TARGET)
cd resource; $(MAKE) -f makefile.unx clean$(TARGET)
cd sashtest; $(MAKE) -f makefile.unx clean$(TARGET)
cd splitter; $(MAKE) -f makefile.unx clean$(TARGET)

View File

@@ -0,0 +1 @@
include ../../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=\
test.cpp
#define library objects
BIN_OBJ=\
test.o
# additional things needed to link
BIN_LINK=
# additional things needed to compile
ADD_COMPILE=
# include the definitions now
include ../../../template.mak

BIN
samples/proplist/cross.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

View File

@@ -0,0 +1,64 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright:
#
# "%W% %G%"
#
# Makefile : Builds test example
# WXWIN and BCCDIR are set by parent make
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makeb32.env
WXLIBDIR = $(WXDIR)\lib
WXINC = $(WXDIR)\include\msw
WXLIB = $(WXLIBDIR)\wx32.lib
LIBS=$(WXLIB) cw32 import32 ole2w32
TARGET=test
!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 = test.obj
$(TARGET).exe: $(OBJECTS) $(TARGET).res
tlink32 $(LINKFLAGS) @&&!
c0w32.obj $(OBJECTS)
$(TARGET)
nul
$(LIBS)
$(TARGET).def
$(TARGET).res
!
.$(SRCSUFF).obj:
bcc32 $(CPPFLAGS) -c {$< }
.c.obj:
bcc32 $(CPPFLAGS) -P- -c {$< }
test.obj: test.$(SRCSUFF)
$(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,19 @@
#
# File: makefile.bcc
# Author: Julian Smart
# Created: 1998
# Updated:
#
# Builds a BC++ 16-bit sample
!if "$(WXWIN)" == ""
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
!endif
WXDIR = $(WXWIN)
TARGET=test
OBJECTS=$(TARGET).obj
!include $(WXDIR)\src\makeprog.bcc

View File

@@ -0,0 +1,17 @@
#
# File: makefile.dos
# Author: Julian Smart
# Created: 1998
# Updated:
#
# Makefile : Builds 16-bit sample, VC++ 1.5
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
WXDIR = $(WXWIN)
TARGET=test
OBJECTS=$(TARGET).obj
!include $(WXDIR)\src\makeprog.msc

View File

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

View File

@@ -0,0 +1,64 @@
#
# File: makefile.nt
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds test example (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
WXUSINGDLL=0
!include $(WXDIR)\src\ntwxwin.mak
THISDIR = $(WXDIR)\samples\test
PROGRAM=test
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).$(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 *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb

321
samples/proplist/test.cpp Normal file
View File

@@ -0,0 +1,321 @@
/////////////////////////////////////////////////////////////////////////////
// Name: test.cpp
// Purpose: Property sheet test implementation
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "test.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "test.h"
// A macro needed for some compilers (AIX) that need 'main' to be defined
// in the application itself.
IMPLEMENT_WXWIN_MAIN
IMPLEMENT_APP(MyApp)
wxPropertyValidatorRegistry myListValidatorRegistry;
wxPropertyValidatorRegistry myFormValidatorRegistry;
MyApp::MyApp(void)
{
m_childWindow = NULL;
m_mainFrame = NULL;
}
bool MyApp::OnInit(void)
{
RegisterValidators();
// Create the main frame window
m_mainFrame = new MyFrame(NULL, "wxPropertySheet Demo", wxPoint(0, 0), wxSize(300, 400), wxDEFAULT_FRAME);
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(PROPERTY_TEST_DIALOG_LIST, "Test property list &dialog...");
file_menu->Append(PROPERTY_TEST_FRAME_LIST, "Test property list &frame...");
file_menu->AppendSeparator();
file_menu->Append(PROPERTY_TEST_DIALOG_FORM, "Test property form d&ialog...");
file_menu->Append(PROPERTY_TEST_FRAME_FORM, "Test property form f&rame...");
file_menu->AppendSeparator();
file_menu->Append(PROPERTY_QUIT, "E&xit");
wxMenu *help_menu = new wxMenu;
help_menu->Append(PROPERTY_ABOUT, "&About");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with the frame
m_mainFrame->SetMenuBar(menu_bar);
m_mainFrame->Centre(wxBOTH);
m_mainFrame->Show(TRUE);
SetTopWindow(m_mainFrame);
return TRUE;
}
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_CLOSE(MyFrame::OnCloseWindow)
EVT_MENU(PROPERTY_QUIT, MyFrame::OnQuit)
EVT_MENU(PROPERTY_ABOUT, MyFrame::OnAbout)
EVT_MENU(PROPERTY_TEST_DIALOG_LIST, MyFrame::OnDialogList)
EVT_MENU(PROPERTY_TEST_FRAME_LIST, MyFrame::OnFrameList)
EVT_MENU(PROPERTY_TEST_DIALOG_FORM, MyFrame::OnDialogForm)
EVT_MENU(PROPERTY_TEST_FRAME_FORM, MyFrame::OnFrameForm)
END_EVENT_TABLE()
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type):
wxFrame(frame, -1, title, pos, size, type)
{
}
// Define the behaviour for the frame closing
// - must delete all frames except for the main one.
void MyFrame::OnCloseWindow(wxCloseEvent& event)
{
if (wxGetApp().m_childWindow)
{
wxGetApp().m_childWindow->Close(TRUE);
}
Destroy();
}
void MyFrame::OnQuit(wxCommandEvent& event)
{
Close(TRUE);
}
void MyFrame::OnDialogList(wxCommandEvent& event)
{
wxGetApp().PropertyListTest(TRUE);
}
void MyFrame::OnFrameList(wxCommandEvent& event)
{
wxGetApp().PropertyListTest(FALSE);
}
void MyFrame::OnDialogForm(wxCommandEvent& event)
{
wxGetApp().PropertyFormTest(TRUE);
}
void MyFrame::OnFrameForm(wxCommandEvent& event)
{
wxGetApp().PropertyFormTest(FALSE);
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
(void)wxMessageBox("Property Classes Demo\nAuthor: Julian Smart", "About Property Classes Test");
}
void MyApp::RegisterValidators(void)
{
myListValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator);
myListValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator);
myListValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
myListValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
myListValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
myFormValidatorRegistry.RegisterValidator((wxString)"real", new wxRealFormValidator);
myFormValidatorRegistry.RegisterValidator((wxString)"string", new wxStringFormValidator);
myFormValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerFormValidator);
myFormValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolFormValidator);
}
void MyApp::PropertyListTest(bool useDialog)
{
if (m_childWindow)
return;
wxPropertySheet *sheet = new wxPropertySheet;
sheet->AddProperty(new wxProperty("fred", 1.0, "real"));
sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool"));
sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50)));
sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0)));
sheet->AddProperty(new wxProperty("julian", "one", "string"));
sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")));
wxStringList *strings = new wxStringList("one", "two", "three", NULL);
sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings)));
wxStringList *strings2 = new wxStringList("earth", "fire", "wind", "water", NULL);
sheet->AddProperty(new wxProperty("string list", strings2, "stringlist"));
wxPropertyListView *view =
new wxPropertyListView(NULL,
wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES);
wxDialog *propDialog = NULL;
wxPropertyListFrame *propFrame = NULL;
if (useDialog)
{
propDialog = new PropListDialog(view, NULL, "Property Sheet Test",
wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
m_childWindow = propDialog;
}
else
{
propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500));
m_childWindow = propFrame;
}
view->AddRegistry(&myListValidatorRegistry);
if (useDialog)
{
view->ShowView(sheet, propDialog);
propDialog->Centre(wxBOTH);
propDialog->Show(TRUE);
}
else
{
propFrame->Initialize();
view->ShowView(sheet, propFrame->GetPropertyPanel());
propFrame->Centre(wxBOTH);
propFrame->Show(TRUE);
}
}
void MyApp::PropertyFormTest(bool useDialog)
{
if (m_childWindow)
return;
#if 0
wxPropertySheet *sheet = new wxPropertySheet;
sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0)));
sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool"));
sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50)));
sheet->AddProperty(new wxProperty("julian", "one", "string"));
wxStringList *strings = new wxStringList("one", "two", "three", NULL);
sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings)));
wxPropertyFormView *view = new wxPropertyFormView(NULL);
wxDialogBox *propDialog = NULL;
wxPropertyFormFrame *propFrame = NULL;
if (useDialog)
{
propDialog = new PropFormDialog(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(380, 250),
wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
m_childWindow = propDialog;
}
else
{
propFrame = new PropFormFrame(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(280, 250));
propFrame->Initialize();
m_childWindow = propFrame;
}
wxPanel *panel = propDialog ? propDialog : propFrame->GetPropertyPanel();
panel->SetLabelPosition(wxVERTICAL);
// Add items to the panel
(void) new wxButton(panel, -1, "OK", -1, -1, -1, -1, 0, "ok");
(void) new wxButton(panel, -1, "Cancel", -1, -1, 80, -1, 0, "cancel");
(void) new wxButton(panel, -1, "Update", -1, -1, 80, -1, 0, "update");
(void) new wxButton(panel, -1, "Revert", -1, -1, -1, -1, 0, "revert");
panel->NewLine();
// The name of this text item matches the "fred" property
(void) new wxText(panel, -1, "Fred", "", -1, -1, 90, -1, 0, "fred");
(void) new wxCheckBox(panel, -1, "Yes or no", -1, -1, -1, -1, 0, "tough choice");
(void) new wxSlider(panel, -1, "Scale", 0, -50, 50, 150, -1, -1, wxHORIZONTAL, "ian");
panel->NewLine();
(void) new wxListBox(panel, -1, "Constrained", wxSINGLE, -1, -1, 100, 90, 0, NULL, 0, "constrained");
view->AddRegistry(&myFormValidatorRegistry);
if (useDialog)
{
view->ShowView(sheet, propDialog);
view->AssociateNames();
view->TransferToDialog();
propDialog->Centre(wxBOTH);
propDialog->Show(TRUE);
}
else
{
view->ShowView(sheet, propFrame->GetPropertyPanel());
view->AssociateNames();
view->TransferToDialog();
propFrame->Centre(wxBOTH);
propFrame->Show(TRUE);
}
#endif
}
BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame)
EVT_CLOSE(PropListFrame::OnCloseWindow)
END_EVENT_TABLE()
void PropListFrame::OnCloseWindow(wxCloseEvent& event)
{
wxGetApp().m_childWindow = NULL;
wxPropertyListFrame::OnCloseWindow(event);
}
BEGIN_EVENT_TABLE(PropListDialog, wxPropertyListDialog)
EVT_CLOSE(PropListDialog::OnCloseWindow)
END_EVENT_TABLE()
void PropListDialog::OnCloseWindow(wxCloseEvent& event)
{
wxGetApp().m_childWindow = NULL;
wxPropertyListDialog::OnCloseWindow(event);
}
BEGIN_EVENT_TABLE(PropFormFrame, wxPropertyFormFrame)
EVT_CLOSE(PropFormFrame::OnCloseWindow)
END_EVENT_TABLE()
void PropFormFrame::OnCloseWindow(wxCloseEvent& event)
{
wxGetApp().m_childWindow = NULL;
wxPropertyFormFrame::OnCloseWindow(event);
}
BEGIN_EVENT_TABLE(PropFormDialog, wxPropertyFormDialog)
EVT_CLOSE(PropFormDialog::OnCloseWindow)
END_EVENT_TABLE()
void PropFormDialog::OnCloseWindow(wxCloseEvent& event)
{
wxGetApp().m_childWindow = NULL;
wxPropertyFormDialog::OnCloseWindow(event);
}

View File

@@ -0,0 +1,8 @@
NAME TEST
DESCRIPTION 'wxProperty test'
EXETYPE WINDOWS
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 1024
STACKSIZE 8192

127
samples/proplist/test.h Normal file
View File

@@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////
// Name: test.h
// Purpose: Property sheet sample
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma interface "test.h"
#endif
#ifndef _PROPTEST_H_
#define _PROPTEST_H_
#include "wx/proplist.h"
#include "wx/propform.h"
class MyChild;
// Define a new application
class MyFrame;
class MyApp: public wxApp
{
public:
MyApp(void);
bool OnInit(void);
void RegisterValidators(void);
void PropertyListTest(bool useDialog);
void PropertyFormTest(bool useDialog);
MyFrame* m_mainFrame;
wxWindow* m_childWindow;
};
DECLARE_APP(MyApp)
// Define a new frame
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type);
void OnCloseWindow(wxCloseEvent& event);
void OnQuit(wxCommandEvent& event);
void OnDialogList(wxCommandEvent& event);
void OnFrameList(wxCommandEvent& event);
void OnDialogForm(wxCommandEvent& event);
void OnFrameForm(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
class PropListFrame: public wxPropertyListFrame
{
public:
PropListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
wxPropertyListFrame(v, parent, title, pos, size, style, name)
{
}
void OnCloseWindow(wxCloseEvent& event);
DECLARE_EVENT_TABLE()
};
class PropListDialog: public wxPropertyListDialog
{
public:
PropListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"):
wxPropertyListDialog(v, parent, title, pos, size, style, name)
{
}
void OnCloseWindow(wxCloseEvent& event);
DECLARE_EVENT_TABLE()
};
class PropFormFrame: public wxPropertyFormFrame
{
public:
PropFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
wxPropertyFormFrame(v, parent, title, pos, size, style, name)
{
}
void OnCloseWindow(wxCloseEvent& event);
DECLARE_EVENT_TABLE()
};
class PropFormDialog: public wxPropertyFormDialog
{
public:
PropFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"):
wxPropertyFormDialog(v, parent, title, pos, size, style, name)
{
}
void OnCloseWindow(wxCloseEvent& event);
DECLARE_EVENT_TABLE()
};
#define PROPERTY_QUIT 1
#define PROPERTY_ABOUT 2
#define PROPERTY_TEST_DIALOG_LIST 3
#define PROPERTY_TEST_FRAME_LIST 4
#define PROPERTY_TEST_DIALOG_FORM 5
#define PROPERTY_TEST_FRAME_FORM 6
#endif

5
samples/proplist/test.rc Normal file
View File

@@ -0,0 +1,5 @@
tick_bmp BITMAP "tick.bmp"
cross_bmp BITMAP "cross.bmp"
#include "wx/msw/wx.rc"

BIN
samples/proplist/tick.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B