Removed wxProp source files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1 +0,0 @@
|
||||
include ../../../setup/general/makedirs
|
@@ -1,69 +0,0 @@
|
||||
#
|
||||
# wxprop source makefile for Unix
|
||||
#
|
||||
# Copyright 1998, Robert Roebling
|
||||
#
|
||||
|
||||
# wxWindows base directory
|
||||
WXBASEDIR=@WXBASEDIR@
|
||||
|
||||
# set the OS type for compilation
|
||||
OS=@OS@
|
||||
|
||||
# compile a library only
|
||||
RULE=gslib
|
||||
|
||||
# needed for unactivated
|
||||
NONE=
|
||||
|
||||
# define library name
|
||||
LIB_TARGET=wx_prop_gtk
|
||||
LIB_MAJOR=0
|
||||
LIB_MINOR=1
|
||||
|
||||
# define library sources
|
||||
|
||||
LIB_CPP_SRC=\
|
||||
\
|
||||
prop.cpp \
|
||||
propform.cpp \
|
||||
proplist.cpp
|
||||
|
||||
#define library objects
|
||||
LIB_OBJ=\
|
||||
$(LIB_CPP_SRC:.cpp=.o)
|
||||
|
||||
all::
|
||||
|
||||
clean::
|
||||
|
||||
install::
|
||||
@echo "Installing library files and headers for libwx_prop_gtk.."
|
||||
@echo " Creating directory.."
|
||||
@$(WXBASEDIR)/mkinstalldirs /usr/local/include/wx_prop
|
||||
@echo " Copying headers from /include/wx"
|
||||
@cd $(WXBASEDIR)/utils/wxprop/src ; \
|
||||
for f in *.h ; do \
|
||||
rm -f /usr/local/include/wx_prop/$$f ; \
|
||||
$(INSTALL_DATA) $$f /usr/local/include/wx_prop/$$f ; \
|
||||
done
|
||||
@echo " Copying static library files to /usr/local/lib"
|
||||
@cd $(WXBASEDIR)/lib/$(OS) ; \
|
||||
for f in libwx_prop_gtk.a ; do \
|
||||
rm -f /usr/local/lib/$$f ; \
|
||||
$(INSTALL_DATA) $$f /usr/local/lib/$$f ; \
|
||||
done
|
||||
@echo " Copying shared libraries to /usr/local/lib"
|
||||
@cd $(WXBASEDIR)/lib/$(OS) ; \
|
||||
for f in libwx_prop_gtk.so* ; do \
|
||||
rm -f /usr/local/lib/$$f ; \
|
||||
$(INSTALL_PROGRAM) $$f /usr/local/lib/$$f ; \
|
||||
done
|
||||
|
||||
|
||||
#additional things needed for compile
|
||||
ADD_COMPILE=
|
||||
|
||||
# include the definitions now
|
||||
include ../../../../template.mak
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 198 B |
@@ -1,74 +0,0 @@
|
||||
#
|
||||
# File: makefile.b32
|
||||
# Author: Patrick Halke
|
||||
# Created: 1995
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds 32bit wxProperty library for Windows
|
||||
# and Borland C++ 4.x
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makeb32.env
|
||||
|
||||
WXINC = $(WXDIR)\include
|
||||
TARGET=test
|
||||
TESTOBJECTS=test.obj
|
||||
LIBTARGET= $(WXLIBDIR)\wxprop.lib
|
||||
LIBS=$(WXLIB)\wx32.lib $(LIBTARGET) cw32 import32 ole2w32
|
||||
|
||||
!ifndef DEBUG
|
||||
DEBUG=0
|
||||
!endif
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||
OPT = -Od
|
||||
DEBUG_FLAGS= -v -DDEBUG=$(DEBUG)
|
||||
!else
|
||||
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||
OPT = -O2
|
||||
DEBUG_FLAGS = -DDEBUG=$(DEBUG)
|
||||
!endif
|
||||
|
||||
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
OBJECTS = prop.obj proplist.obj propform.obj
|
||||
|
||||
all: $(LIBTARGET)
|
||||
|
||||
$(LIBTARGET): $(OBJECTS)
|
||||
erase $(LIBTARGET)
|
||||
tlib $(LIBTARGET) /P32 @&&!
|
||||
+$(OBJECTS:.obj =.obj +)
|
||||
!
|
||||
|
||||
prop.obj: prop.$(SRCSUFF) prop.h
|
||||
proplist.obj: proplist.$(SRCSUFF) prop.h proplist.h
|
||||
propform.obj: propform.$(SRCSUFF) prop.h propform.h
|
||||
|
||||
$(TARGET).exe: $(TESTOBJECTS) $(LIBTARGET) $(TARGET).def $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(TESTOBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS) $(LIBTARGET)
|
||||
$(TARGET).def
|
||||
$(TARGET).res
|
||||
!
|
||||
|
||||
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
|
||||
|
||||
test.obj: test.$(SRCSUFF) test.h
|
||||
|
||||
clean:
|
||||
-erase *.obj $(LIBTARGET) *.exe *.res *.map *.rws
|
@@ -1,138 +0,0 @@
|
||||
#
|
||||
# File: makefile.dos
|
||||
# Author: Julian Smart
|
||||
# Created: 1995
|
||||
# Updated:
|
||||
# Copyright: (c) 1995, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds wxPropertySheet library and example (DOS).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
!include $(WXDIR)\src\makemsc.env
|
||||
|
||||
THISDIR = $(WXDIR)\utils\wxprop\src
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
|
||||
PROPLIB = $(WXDIR)\utils\wxprop\lib\wxprop.lib
|
||||
DOCDIR = $(WXDIR)\utils\wxprop\docs
|
||||
|
||||
LIBS=$(WXLIB) $(PROPLIB) oldnames libw llibcew commdlg shell ddeml
|
||||
INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw
|
||||
|
||||
# Default is to output RTF for WinHelp
|
||||
!ifndef RTFSTYLE
|
||||
RTFSTYLE=-winhelp
|
||||
!endif
|
||||
|
||||
OBJECTS = prop.obj proplist.obj propform.obj
|
||||
TESTOBJECTS = test.obj
|
||||
|
||||
all: $(PROPLIB)
|
||||
|
||||
test: test.exe
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.dos
|
||||
cd $(THISDIR)
|
||||
|
||||
wxclean:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.dos clean
|
||||
cd $(THISDIR)
|
||||
|
||||
$(PROPLIB): $(OBJECTS)
|
||||
-erase $(PROPLIB)
|
||||
lib /PAGESIZE:128 @<<
|
||||
$(PROPLIB)
|
||||
y
|
||||
$(OBJECTS)
|
||||
nul
|
||||
;
|
||||
<<
|
||||
|
||||
test.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(PROPLIB) $(TESTOBJECTS) test.def test.res
|
||||
link $(LINKFLAGS) @<<
|
||||
$(WXDIR)\src\msw\dummy.obj $(TESTOBJECTS),
|
||||
test,
|
||||
NUL,
|
||||
$(LIBS),
|
||||
test.def
|
||||
;
|
||||
<<
|
||||
rc -30 -K test.res
|
||||
|
||||
test.obj: test.h wx_prop.h test.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
prop.obj: prop.h prop.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
proplist.obj: prop.h proplist.h proplist.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
propform.obj: prop.h propform.h propform.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
test.res : test.rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
rc -r /i$(WXDIR)\include\wx test
|
||||
|
||||
# Making documents
|
||||
docs: hlp
|
||||
hlp: $(DOCDIR)/prop.hlp
|
||||
hlp32: $(DOCDIR)/hlp32/prop.hlp
|
||||
rtf: $(DOCDIR)/prop.rtf
|
||||
|
||||
$(DOCDIR)/prop.hlp: $(DOCDIR)/prop.rtf $(DOCDIR)/prop.hpj
|
||||
cd $(DOCDIR)
|
||||
-erase prop.ph
|
||||
hc prop
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)/hlp32/prop.hlp: $(DOCDIR)/hlp32/prop.rtf $(DOCDIR)/hlp32/prop.hpj
|
||||
cd $(DOCDIR)/hlp32
|
||||
-erase prop.ph
|
||||
start /w hcw /c /e clockwrk.hpj
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)/prop.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/body.tex $(DOCDIR)/prop.tex
|
||||
cd $(DOCDIR)
|
||||
-wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/prop.rtf -twice $(RTFSTYLE)
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)/hlp32/prop.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/body.tex $(DOCDIR)/prop.tex
|
||||
cd $(DOCDIR)
|
||||
-wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/hlp32/prop.rtf -twice -winhelp -macros $(DOCDIR)/t2rtf32.ini
|
||||
cd $(THISDIR)
|
||||
|
||||
wordrtf:
|
||||
cd $(DOCDIR)
|
||||
-wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/prop.rtf -twice -rtf
|
||||
cd $(THISDIR)
|
||||
|
||||
cleanrtf:
|
||||
cd $(DOCDIR)
|
||||
-erase *.rtf
|
||||
cd $(THISDIR)
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.sbr
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.pdb
|
||||
-erase $(PROPLIB)
|
@@ -1,54 +0,0 @@
|
||||
#
|
||||
# File: makefile.g95
|
||||
# Author: Julian Smart
|
||||
# Created: 1996
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds wxProp library and example under GNU-WIN32
|
||||
#
|
||||
WXDIR = ../../..
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
PROPDIR = $(WXDIR)/utils/wxprop
|
||||
PROPLIB = $(PROPDIR)/lib/$(LIBPREFIX)wxprop.$(LIBSUFF)
|
||||
THISDIR = $(PROPDIR)/src
|
||||
|
||||
OBJECTS = $(OBJDIR)/prop.$(OBJSUFF) $(OBJDIR)/proplist.$(OBJSUFF) $(OBJDIR)/propform.$(OBJSUFF)
|
||||
TESTOBJECTS = $(OBJDIR)/test.$(OBJSUFF) $(OBJDIR)/test_resources.$(OBJSUFF)
|
||||
|
||||
LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib -L../lib
|
||||
LDLIBS=-lwxprop $(LIBS)
|
||||
|
||||
all: $(OBJDIR) $(PROPLIB)
|
||||
|
||||
test: $(OBJDIR) test.exe
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
$(PROPLIB): $(OBJECTS)
|
||||
rm -f $@
|
||||
ar $(AROPTIONS) $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(OBJDIR)/test.$(OBJSUFF): test.h test.$(SRCSUFF) $(PROPLIB)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF)
|
||||
|
||||
test.exe: $(TESTOBJECTS)
|
||||
$(CC) $(LDFLAGS) -o test$(GUISUFFIX)$(EXESUFF) $(TESTOBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/prop.$(OBJSUFF): prop.h prop.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ prop.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/proplist.$(OBJSUFF): proplist.h prop.h proplist.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ proplist.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/propform.$(OBJSUFF): propform.h prop.h propform.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ propform.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/test_resources.o: test.rc
|
||||
$(RESCOMP) -i test.rc -o $(OBJDIR)/test_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f *.$(OBJSUFF) $(PROPLIB) objects/test.o *.exe *.res *.map *.rsc
|
@@ -1,144 +0,0 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds wxProperty class library (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
PROPDIR = $(WXDIR)\utils\wxprop
|
||||
THISDIR = $(WXDIR)\utils\wxprop\src
|
||||
EXTRALIBS=$(PROPDIR)\lib\wxprop.lib
|
||||
DOCDIR=$(WXDIR)\docs
|
||||
LOCALDOCDIR=$(WXDIR)\utils\wxprop\docs
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
PROGRAM=test
|
||||
|
||||
OBJECTS = prop.obj proplist.obj propform.obj
|
||||
PROGOBJECTS = $(PROGRAM).obj
|
||||
LIBTARGET=$(PROPDIR)\lib\wxprop.lib
|
||||
|
||||
all: $(LIBTARGET)
|
||||
|
||||
|
||||
$(PROGRAM): $(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)
|
||||
|
||||
$(LIBTARGET): $(OBJECTS)
|
||||
-erase $(LIBTARGET)
|
||||
$(implib) @<<
|
||||
-out:$(LIBTARGET)
|
||||
-machine:$(CPU)
|
||||
$(OBJECTS)
|
||||
<<
|
||||
|
||||
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(PROGOBJECTS) $(LIBTARGET) $(PROGRAM).res
|
||||
$(link) @<<
|
||||
-out:$(PROGRAM).exe
|
||||
$(LINKFLAGS)
|
||||
$(DUMMYOBJ) $(PROGOBJECTS) $(PROGRAM).res
|
||||
$(LIBS)
|
||||
<<
|
||||
|
||||
prop.obj: prop.h prop.$(SRCSUFF) $(DUMMYOBJ)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
proplist.obj: prop.h proplist.$(SRCSUFF) $(DUMMYOBJ)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
propform.obj: propform.h propform.$(SRCSUFF) $(DUMMYOBJ)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(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
|
||||
-erase $(LIBTARGET)
|
||||
|
||||
DOCSOURCES=$(LOCALDOCDIR)\prop.tex $(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\body.tex $(LOCALDOCDIR)\changes.tex
|
||||
|
||||
html: $(DOCDIR)\html\wxprop\prop.htm
|
||||
hlp: $(DOCDIR)\winhelp\wxprop.hlp
|
||||
pdfrtf: $(DOCDIR)\pdf\wxprop.rtf
|
||||
ps: $(WXDIR)\docs\ps\wxprop.ps
|
||||
|
||||
$(DOCDIR)\winhelp\wxprop.hlp: $(LOCALDOCDIR)\wxprop.rtf $(LOCALDOCDIR)\wxprop.hpj
|
||||
cd $(LOCALDOCDIR)
|
||||
-erase wxprop.ph
|
||||
hc wxprop
|
||||
move wxprop.hlp $(DOCDIR)\winhelp\wxprop.hlp
|
||||
move wxprop.cnt $(DOCDIR)\winhelp\wxprop.cnt
|
||||
cd $(THISDIR)
|
||||
|
||||
$(LOCALDOCDIR)\wxprop.rtf: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(LOCALDOCDIR)\wxprop.rtf -twice -winhelp
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)\pdf\wxprop.rtf: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-copy *.bmp *.wmf $(DOCDIR)\pdf
|
||||
-start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(DOCDIR)\pdf\wxprop.rtf -twice -rtf
|
||||
cd $(THISDIR)
|
||||
|
||||
$(DOCDIR)\html\wxprop\prop.htm: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-mkdir $(DOCDIR)\html\wxprop
|
||||
-start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(DOCDIR)\html\wxprop\prop.htm -twice -html
|
||||
-erase $(DOCDIR)\html\wxprop\*.con
|
||||
-erase $(DOCDIR)\html\wxprop\*.ref
|
||||
cd $(THISDIR)
|
||||
|
||||
$(LOCALDOCDIR)\prop.dvi: $(DOCSOURCES)
|
||||
cd $(LOCALDOCDIR)
|
||||
-latex prop
|
||||
-latex prop
|
||||
-makeindx prop
|
||||
-bibtex prop
|
||||
-latex prop
|
||||
-latex prop
|
||||
cd $(THISDIR)
|
||||
|
||||
$(WXDIR)\docs\ps\wxprop.ps: $(LOCALDOCDIR)\prop.dvi
|
||||
cd $(LOCALDOCDIR)
|
||||
-dvips32 -o wxprop.ps prop
|
||||
move wxprop.ps $(WXDIR)\docs\ps\wxprop.ps
|
||||
cd $(THISDIR)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,325 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: prop.h
|
||||
// Purpose: Property sheet classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _PROP_H_
|
||||
#define _PROP_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "prop.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/listbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/layout.h"
|
||||
|
||||
class wxWindow;
|
||||
class wxProperty;
|
||||
class wxPropertyValue;
|
||||
class wxPropertySheet;
|
||||
class wxPropertyView;
|
||||
class wxPropertyValidator;
|
||||
class wxPropertyValidatorRegistry;
|
||||
|
||||
#define wxPROPERTY_VERSION 2.0
|
||||
|
||||
// A storable sheet of values
|
||||
class wxPropertySheet: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
|
||||
public:
|
||||
wxPropertySheet(void);
|
||||
~wxPropertySheet(void);
|
||||
|
||||
// Add a property
|
||||
virtual void AddProperty(wxProperty *property);
|
||||
|
||||
// Get property by name
|
||||
virtual wxProperty *GetProperty(wxString name);
|
||||
|
||||
// Clear all properties
|
||||
virtual void Clear(void);
|
||||
|
||||
virtual bool Save(ostream& str);
|
||||
virtual bool Load(ostream& str);
|
||||
|
||||
virtual void UpdateAllViews(wxPropertyView *thisView = NULL);
|
||||
inline virtual wxList& GetProperties(void) const { return (wxList&) m_properties; }
|
||||
|
||||
// Sets/clears the modified flag for each property value
|
||||
virtual void SetAllModified(bool flag = TRUE);
|
||||
|
||||
protected:
|
||||
wxObject* m_viewedObject;
|
||||
wxList m_properties;
|
||||
wxPropertyView* m_propertyView;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Base class for property sheet views. There are currently two directly derived
|
||||
// classes: wxPropertyListView, and wxPropertyFormView.
|
||||
class wxPropertyView: public wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyView)
|
||||
public:
|
||||
wxPropertyView(long flags = 0);
|
||||
~wxPropertyView(void);
|
||||
|
||||
// Associates and shows the view
|
||||
virtual void ShowView(wxPropertySheet *WXUNUSED(propertySheet), wxWindow *WXUNUSED(panel)) {}
|
||||
|
||||
// Update this view of the viewed object, called e.g. by
|
||||
// the object itself.
|
||||
virtual bool OnUpdateView(void) {return FALSE;};
|
||||
|
||||
// Override this to do something as soon as the property changed,
|
||||
// if the view and validators support it.
|
||||
virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {}
|
||||
|
||||
virtual void AddRegistry(wxPropertyValidatorRegistry *registry);
|
||||
inline virtual wxList& GetRegistryList(void) const
|
||||
{ return (wxList&) m_validatorRegistryList; }
|
||||
|
||||
virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property);
|
||||
inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; }
|
||||
inline virtual wxPropertySheet *GetPropertySheet(void) const { return m_propertySheet; }
|
||||
|
||||
virtual void OnOk(void) {};
|
||||
virtual void OnCancel(void) {};
|
||||
virtual void OnHelp(void) {};
|
||||
|
||||
inline virtual bool OnClose(void) { return FALSE; }
|
||||
inline long GetFlags(void) { return m_buttonFlags; }
|
||||
|
||||
protected:
|
||||
long m_buttonFlags;
|
||||
wxPropertySheet* m_propertySheet;
|
||||
wxProperty* m_currentProperty;
|
||||
wxList m_validatorRegistryList;
|
||||
wxPropertyValidator* m_currentValidator;
|
||||
};
|
||||
|
||||
|
||||
class wxPropertyValidator: public wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyValidator)
|
||||
public:
|
||||
wxPropertyValidator(long flags = 0);
|
||||
~wxPropertyValidator(void);
|
||||
|
||||
inline long GetFlags(void) const { return m_validatorFlags; }
|
||||
inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; }
|
||||
inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; }
|
||||
|
||||
virtual bool StringToFloat (char *s, float *number);
|
||||
virtual bool StringToDouble (char *s, double *number);
|
||||
virtual bool StringToInt (char *s, int *number);
|
||||
virtual bool StringToLong (char *s, long *number);
|
||||
virtual char *FloatToString (float number);
|
||||
virtual char *DoubleToString (double number);
|
||||
virtual char *IntToString (int number);
|
||||
virtual char *LongToString (long number);
|
||||
|
||||
protected:
|
||||
long m_validatorFlags;
|
||||
wxProperty* m_validatorProperty;
|
||||
};
|
||||
|
||||
|
||||
// extern wxPropertyValidator *wxDefaultPropertyValidator;
|
||||
|
||||
class wxPropertyValidatorRegistry: public wxHashTable
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry)
|
||||
public:
|
||||
wxPropertyValidatorRegistry(void);
|
||||
~wxPropertyValidatorRegistry(void);
|
||||
|
||||
virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator);
|
||||
virtual wxPropertyValidator *GetValidator(const wxString& roleName);
|
||||
void ClearRegistry(void);
|
||||
};
|
||||
|
||||
/*
|
||||
* Property value class
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
wxPropertyValueNull,
|
||||
wxPropertyValueInteger,
|
||||
wxPropertyValueReal,
|
||||
wxPropertyValuebool,
|
||||
wxPropertyValueString,
|
||||
wxPropertyValueList,
|
||||
wxPropertyValueIntegerPtr,
|
||||
wxPropertyValueRealPtr,
|
||||
wxPropertyValueboolPtr,
|
||||
wxPropertyValueStringPtr
|
||||
} wxPropertyValueType;
|
||||
|
||||
class wxPropertyValue: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyValue)
|
||||
|
||||
wxPropertyValue(void); // Unknown type
|
||||
wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor
|
||||
wxPropertyValue(const char *val);
|
||||
wxPropertyValue(const wxString& val);
|
||||
wxPropertyValue(long val);
|
||||
wxPropertyValue(bool val);
|
||||
wxPropertyValue(float val);
|
||||
wxPropertyValue(double the_real);
|
||||
wxPropertyValue(wxList *val);
|
||||
wxPropertyValue(wxStringList *val);
|
||||
// Pointer versions
|
||||
wxPropertyValue(char **val);
|
||||
wxPropertyValue(long *val);
|
||||
wxPropertyValue(bool *val);
|
||||
wxPropertyValue(float *val);
|
||||
|
||||
~wxPropertyValue(void);
|
||||
|
||||
virtual inline wxPropertyValueType Type(void) const { return m_type; }
|
||||
virtual inline void SetType(wxPropertyValueType typ) { m_type = typ; }
|
||||
virtual long IntegerValue(void) const;
|
||||
virtual float RealValue(void) const;
|
||||
virtual bool BoolValue(void) const;
|
||||
virtual char *StringValue(void) const;
|
||||
virtual long *IntegerValuePtr(void) const;
|
||||
virtual float *RealValuePtr(void) const;
|
||||
virtual bool *BoolValuePtr(void) const;
|
||||
virtual char **StringValuePtr(void) const;
|
||||
|
||||
// Get nth arg of clause (starting from 1)
|
||||
virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg) const;
|
||||
|
||||
// Return nth argument of a list expression (starting from zero)
|
||||
virtual wxPropertyValue *Nth(int arg) const;
|
||||
// Returns the number of elements in a list expression
|
||||
virtual int Number(void) const;
|
||||
|
||||
virtual wxPropertyValue *NewCopy(void) const;
|
||||
virtual void Copy(wxPropertyValue& copyFrom);
|
||||
|
||||
virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause
|
||||
virtual void WritePropertyType(ostream& stream); // Write as any other subexpression
|
||||
|
||||
// Append an expression to a list
|
||||
virtual void Append(wxPropertyValue *expr);
|
||||
// Insert at beginning of list
|
||||
virtual void Insert(wxPropertyValue *expr);
|
||||
|
||||
// Get first expr in list
|
||||
virtual inline wxPropertyValue *GetFirst(void) const
|
||||
{ return ((m_type == wxPropertyValueList) ? m_value.first : (wxPropertyValue*)NULL); }
|
||||
|
||||
// Get next expr if this is a node in a list
|
||||
virtual inline wxPropertyValue *GetNext(void) const
|
||||
{ return m_next; }
|
||||
|
||||
// Get last expr in list
|
||||
virtual inline wxPropertyValue *GetLast(void) const
|
||||
{ return ((m_type == wxPropertyValueList) ? m_last : (wxPropertyValue*)NULL); }
|
||||
|
||||
// Delete this node from the list
|
||||
virtual void Delete(wxPropertyValue *node);
|
||||
|
||||
// Clear list
|
||||
virtual void ClearList(void);
|
||||
|
||||
virtual inline void SetClientData(wxObject *data) { m_clientData = data; }
|
||||
virtual inline wxObject *GetClientData(void) { return m_clientData; }
|
||||
|
||||
virtual wxString GetStringRepresentation(void);
|
||||
|
||||
inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; }
|
||||
inline bool GetModified(void) { return m_modifiedFlag; }
|
||||
|
||||
// Operators
|
||||
void operator=(const wxPropertyValue& val);
|
||||
// void operator=(const char *val);
|
||||
void operator=(const wxString& val);
|
||||
void operator=(const long val);
|
||||
void operator=(const bool val);
|
||||
void operator=(const float val);
|
||||
void operator=(const char **val);
|
||||
void operator=(const long *val);
|
||||
void operator=(const bool *val);
|
||||
void operator=(const float *val);
|
||||
|
||||
public:
|
||||
wxObject* m_clientData;
|
||||
wxPropertyValueType m_type;
|
||||
bool m_modifiedFlag;
|
||||
|
||||
union {
|
||||
long integer; // Also doubles as bool
|
||||
char *string;
|
||||
float real;
|
||||
long *integerPtr;
|
||||
bool *boolPtr;
|
||||
char **stringPtr;
|
||||
float *realPtr;
|
||||
wxPropertyValue *first; // If is a list expr, points to the first node
|
||||
} m_value;
|
||||
|
||||
wxPropertyValue* m_next; // If this is a node in a list, points to the next node
|
||||
wxPropertyValue* m_last; // If is a list expr, points to the last node
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Property class: contains a name and a value.
|
||||
*/
|
||||
|
||||
class wxProperty: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxProperty)
|
||||
protected:
|
||||
bool m_enabled;
|
||||
public:
|
||||
wxPropertyValue m_value;
|
||||
wxString m_name;
|
||||
wxString m_propertyRole;
|
||||
wxPropertyValidator* m_propertyValidator;
|
||||
wxWindow* m_propertyWindow; // Usually a panel item, if anything
|
||||
|
||||
wxProperty(void);
|
||||
wxProperty(wxProperty& copyFrom);
|
||||
wxProperty(wxString name, wxString role, wxPropertyValidator *ed = NULL);
|
||||
wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL);
|
||||
~wxProperty(void);
|
||||
|
||||
virtual wxPropertyValue& GetValue(void) const;
|
||||
virtual wxPropertyValidator *GetValidator(void) const;
|
||||
virtual wxString& GetName(void) const;
|
||||
virtual wxString& GetRole(void) const;
|
||||
virtual void SetValue(const wxPropertyValue& val);
|
||||
virtual void SetValidator(wxPropertyValidator *v);
|
||||
virtual void SetName(wxString& nm);
|
||||
virtual void SetRole(wxString& role);
|
||||
void operator=(const wxPropertyValue& val);
|
||||
virtual inline void SetWindow(wxWindow *win) { m_propertyWindow = win; }
|
||||
virtual inline wxWindow *GetWindow(void) const { return m_propertyWindow; }
|
||||
|
||||
inline void Enable(bool en) { m_enabled = en; }
|
||||
inline bool IsEnabled(void) const { return m_enabled; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -1,743 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: propform.cpp
|
||||
// Purpose: Property form classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "propform.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 <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#if wxUSE_IOSTREAMH
|
||||
#if defined(__WXMSW__) && !defined(__GNUWIN32__)
|
||||
#include <strstrea.h>
|
||||
#else
|
||||
#include <strstream.h>
|
||||
#endif
|
||||
#else
|
||||
#include <strstream>
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/list.h"
|
||||
#include "propform.h"
|
||||
|
||||
/*
|
||||
* Property view
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView)
|
||||
EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk)
|
||||
EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel)
|
||||
EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp)
|
||||
EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert)
|
||||
EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
bool wxPropertyFormView::sm_dialogCancelled = FALSE;
|
||||
|
||||
wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags)
|
||||
{
|
||||
m_propertyWindow = propPanel;
|
||||
m_managedWindow = NULL;
|
||||
|
||||
m_windowCloseButton = NULL;
|
||||
m_windowCancelButton = NULL;
|
||||
m_windowHelpButton = NULL;
|
||||
|
||||
m_detailedEditing = FALSE;
|
||||
}
|
||||
|
||||
wxPropertyFormView::~wxPropertyFormView(void)
|
||||
{
|
||||
}
|
||||
|
||||
void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
|
||||
{
|
||||
m_propertySheet = ps;
|
||||
|
||||
AssociatePanel(panel);
|
||||
// CreateControls();
|
||||
// UpdatePropertyList();
|
||||
}
|
||||
|
||||
// Update this view of the viewed object, called e.g. by
|
||||
// the object itself.
|
||||
bool wxPropertyFormView::OnUpdateView(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxPropertyFormView::Check(void)
|
||||
{
|
||||
if (!m_propertySheet)
|
||||
return FALSE;
|
||||
|
||||
wxNode *node = m_propertySheet->GetProperties().First();
|
||||
while (node)
|
||||
{
|
||||
wxProperty *prop = (wxProperty *)node->Data();
|
||||
wxPropertyValidator *validator = FindPropertyValidator(prop);
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
if (!formValidator->OnCheckValue(prop, this, m_propertyWindow))
|
||||
return FALSE;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxPropertyFormView::TransferToPropertySheet(void)
|
||||
{
|
||||
if (!m_propertySheet)
|
||||
return FALSE;
|
||||
|
||||
wxNode *node = m_propertySheet->GetProperties().First();
|
||||
while (node)
|
||||
{
|
||||
wxProperty *prop = (wxProperty *)node->Data();
|
||||
wxPropertyValidator *validator = FindPropertyValidator(prop);
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnRetrieveValue(prop, this, m_propertyWindow);
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxPropertyFormView::TransferToDialog(void)
|
||||
{
|
||||
if (!m_propertySheet)
|
||||
return FALSE;
|
||||
|
||||
wxNode *node = m_propertySheet->GetProperties().First();
|
||||
while (node)
|
||||
{
|
||||
wxProperty *prop = (wxProperty *)node->Data();
|
||||
wxPropertyValidator *validator = FindPropertyValidator(prop);
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnDisplayValue(prop, this, m_propertyWindow);
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxPropertyFormView::AssociateNames(void)
|
||||
{
|
||||
if (!m_propertySheet || !m_propertyWindow)
|
||||
return FALSE;
|
||||
|
||||
wxNode *node = m_propertyWindow->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if (win->GetName() != "")
|
||||
{
|
||||
wxProperty *prop = m_propertySheet->GetProperty(win->GetName());
|
||||
if (prop)
|
||||
prop->SetWindow(win);
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool wxPropertyFormView::OnClose(void)
|
||||
{
|
||||
delete this;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// Retrieve the value if any
|
||||
if (!Check())
|
||||
return;
|
||||
|
||||
sm_dialogCancelled = FALSE;
|
||||
TransferToPropertySheet();
|
||||
|
||||
m_managedWindow->Close(TRUE);
|
||||
}
|
||||
|
||||
void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
sm_dialogCancelled = TRUE;
|
||||
|
||||
m_managedWindow->Close(TRUE);
|
||||
}
|
||||
|
||||
void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
}
|
||||
|
||||
void wxPropertyFormView::OnUpdate(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (Check())
|
||||
TransferToPropertySheet();
|
||||
}
|
||||
|
||||
void wxPropertyFormView::OnRevert(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
TransferToDialog();
|
||||
}
|
||||
|
||||
void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
|
||||
{
|
||||
if (!m_propertySheet)
|
||||
return;
|
||||
|
||||
if (win.GetName() == "")
|
||||
return;
|
||||
|
||||
if (strcmp(win.GetName(), "ok") == 0)
|
||||
OnOk(event);
|
||||
else if (strcmp(win.GetName(), "cancel") == 0)
|
||||
OnCancel(event);
|
||||
else if (strcmp(win.GetName(), "help") == 0)
|
||||
OnHelp(event);
|
||||
else if (strcmp(win.GetName(), "update") == 0)
|
||||
OnUpdate(event);
|
||||
else if (strcmp(win.GetName(), "revert") == 0)
|
||||
OnRevert(event);
|
||||
else
|
||||
{
|
||||
// Find a validator to route the command to.
|
||||
wxNode *node = m_propertySheet->GetProperties().First();
|
||||
while (node)
|
||||
{
|
||||
wxProperty *prop = (wxProperty *)node->Data();
|
||||
if (prop->GetWindow() && (prop->GetWindow() == &win))
|
||||
{
|
||||
wxPropertyValidator *validator = FindPropertyValidator(prop);
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnCommand(prop, this, m_propertyWindow, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxPropertyFormView::OnDoubleClick(wxControl *item)
|
||||
{
|
||||
if (!m_propertySheet)
|
||||
return;
|
||||
|
||||
// Find a validator to route the command to.
|
||||
wxNode *node = m_propertySheet->GetProperties().First();
|
||||
while (node)
|
||||
{
|
||||
wxProperty *prop = (wxProperty *)node->Data();
|
||||
if (prop->GetWindow() && ((wxControl *)prop->GetWindow() == item))
|
||||
{
|
||||
wxPropertyValidator *validator = FindPropertyValidator(prop);
|
||||
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
|
||||
{
|
||||
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
|
||||
formValidator->OnDoubleClick(prop, this, m_propertyWindow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Property form dialog box
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog)
|
||||
|
||||
wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
|
||||
wxDialog(parent, -1, title, pos, size, style, name)
|
||||
{
|
||||
m_view = v;
|
||||
m_view->AssociatePanel(this);
|
||||
m_view->SetManagedWindow(this);
|
||||
// SetAutoLayout(TRUE);
|
||||
}
|
||||
|
||||
bool wxPropertyFormDialog::OnClose(void)
|
||||
{
|
||||
if (m_view)
|
||||
{
|
||||
m_view->OnClose();
|
||||
m_view = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
|
||||
{
|
||||
m_view->OnDoubleClick(item);
|
||||
}
|
||||
|
||||
void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event)
|
||||
{
|
||||
if ( m_view )
|
||||
m_view->OnCommand(win, event);
|
||||
}
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
bool wxPropertyFormDialog::ProcessEvent(wxEvent& event)
|
||||
{
|
||||
if ( !m_view || ! m_view->ProcessEvent(event) )
|
||||
return wxEvtHandler::ProcessEvent(event);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Property form panel
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel)
|
||||
|
||||
void wxPropertyFormPanel::OnDefaultAction(wxControl *item)
|
||||
{
|
||||
m_view->OnDoubleClick(item);
|
||||
}
|
||||
|
||||
void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event)
|
||||
{
|
||||
m_view->OnCommand(win, event);
|
||||
}
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
|
||||
{
|
||||
if ( !m_view || ! m_view->ProcessEvent(event) )
|
||||
return wxEvtHandler::ProcessEvent(event);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Property frame
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)
|
||||
|
||||
bool wxPropertyFormFrame::OnClose(void)
|
||||
{
|
||||
if (m_view)
|
||||
return m_view->OnClose();
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v)
|
||||
{
|
||||
return new wxPropertyFormPanel(v, parent);
|
||||
}
|
||||
|
||||
bool wxPropertyFormFrame::Initialize(void)
|
||||
{
|
||||
m_propertyPanel = OnCreatePanel(this, m_view);
|
||||
if (m_propertyPanel)
|
||||
{
|
||||
m_view->AssociatePanel(m_propertyPanel);
|
||||
m_view->SetManagedWindow(this);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Property form specific validator
|
||||
*/
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxPropertyFormValidator, wxPropertyValidator)
|
||||
|
||||
|
||||
/*
|
||||
* Default validators
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator)
|
||||
|
||||
///
|
||||
/// Real number form validator
|
||||
///
|
||||
bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *parentWindow)
|
||||
{
|
||||
if (m_realMin == 0.0 && m_realMax == 0.0)
|
||||
return TRUE;
|
||||
|
||||
// The item used for viewing the real number: should be a text item.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
return FALSE;
|
||||
|
||||
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
|
||||
|
||||
float val = 0.0;
|
||||
if (!StringToFloat(WXSTRINGCAST value, &val))
|
||||
{
|
||||
char buf[200];
|
||||
sprintf(buf, "Value %s is not a valid real number!", (const char *)value);
|
||||
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (val < m_realMin || val > m_realMax)
|
||||
{
|
||||
char buf[200];
|
||||
sprintf(buf, "Value must be a real number between %.2f and %.2f!", m_realMin, m_realMax);
|
||||
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) )
|
||||
{
|
||||
// The item used for viewing the real number: should be a text item.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
return FALSE;
|
||||
|
||||
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
|
||||
|
||||
if (value.Length() == 0)
|
||||
return FALSE;
|
||||
|
||||
float f = (float)atof((const char *)value);
|
||||
property->GetValue() = f;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) )
|
||||
{
|
||||
// The item used for viewing the real number: should be a text item.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
return FALSE;
|
||||
|
||||
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
|
||||
textItem->SetValue(FloatToString(property->GetValue().RealValue()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///
|
||||
/// Integer validator
|
||||
///
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)
|
||||
|
||||
bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *parentWindow)
|
||||
{
|
||||
if (m_integerMin == 0.0 && m_integerMax == 0.0)
|
||||
return TRUE;
|
||||
|
||||
// The item used for viewing the real number: should be a text item or a slider
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow)
|
||||
return FALSE;
|
||||
|
||||
long val = 0;
|
||||
|
||||
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
|
||||
|
||||
if (!StringToLong(WXSTRINGCAST value, &val))
|
||||
{
|
||||
char buf[200];
|
||||
sprintf(buf, "Value %s is not a valid integer!", (const char *)value);
|
||||
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
|
||||
{
|
||||
val = (long)((wxSlider *)m_propertyWindow)->GetValue();
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
if (val < m_integerMin || val > m_integerMax)
|
||||
{
|
||||
char buf[200];
|
||||
sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax);
|
||||
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow))
|
||||
{
|
||||
// The item used for viewing the real number: should be a text item or a slider
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow)
|
||||
return FALSE;
|
||||
|
||||
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
|
||||
|
||||
if (value.Length() == 0)
|
||||
return FALSE;
|
||||
|
||||
long i = atol((const char *)value);
|
||||
property->GetValue() = i;
|
||||
}
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
|
||||
{
|
||||
property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue();
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow))
|
||||
{
|
||||
// The item used for viewing the real number: should be a text item or a slider
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow)
|
||||
return FALSE;
|
||||
|
||||
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
|
||||
textItem->SetValue(LongToString(property->GetValue().IntegerValue()));
|
||||
}
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
|
||||
{
|
||||
((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///
|
||||
/// Boolean validator
|
||||
///
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator)
|
||||
|
||||
bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow))
|
||||
{
|
||||
// The item used for viewing the boolean: should be a checkbox
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) )
|
||||
{
|
||||
// The item used for viewing the boolean: should be a checkbox.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
|
||||
return FALSE;
|
||||
|
||||
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
|
||||
|
||||
property->GetValue() = (bool)checkBox->GetValue();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow))
|
||||
{
|
||||
// The item used for viewing the boolean: should be a checkbox.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
|
||||
return FALSE;
|
||||
|
||||
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
|
||||
checkBox->SetValue((bool)property->GetValue().BoolValue());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///
|
||||
/// String validator
|
||||
///
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)
|
||||
|
||||
wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
|
||||
wxPropertyFormValidator(flags)
|
||||
{
|
||||
m_strings = list;
|
||||
}
|
||||
|
||||
bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *parentWindow )
|
||||
{
|
||||
if (!m_strings)
|
||||
return TRUE;
|
||||
|
||||
// The item used for viewing the string: should be a text item, choice item or listbox.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow)
|
||||
return FALSE;
|
||||
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
|
||||
if (!m_strings->Member(text->GetValue()))
|
||||
{
|
||||
wxString s("Value ");
|
||||
s += text->GetValue();
|
||||
s += " is not valid.";
|
||||
wxMessageBox(s, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Any other item constrains the string value,
|
||||
// so we don't have to check it.
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) )
|
||||
{
|
||||
// The item used for viewing the string: should be a text item, choice item or listbox.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow)
|
||||
return FALSE;
|
||||
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
|
||||
property->GetValue() = text->GetValue();
|
||||
}
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
|
||||
{
|
||||
wxListBox *lbox = (wxListBox *)m_propertyWindow;
|
||||
if (lbox->GetSelection() > -1)
|
||||
property->GetValue() = lbox->GetStringSelection();
|
||||
}
|
||||
/*
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
|
||||
{
|
||||
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
|
||||
int n = 0;
|
||||
if ((n = rbox->GetSelection()) > -1)
|
||||
property->GetValue() = rbox->GetString(n);
|
||||
}
|
||||
*/
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
|
||||
{
|
||||
wxChoice *choice = (wxChoice *)m_propertyWindow;
|
||||
if (choice->GetSelection() > -1)
|
||||
property->GetValue() = choice->GetStringSelection();
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) )
|
||||
{
|
||||
// The item used for viewing the string: should be a text item, choice item or listbox.
|
||||
wxWindow *m_propertyWindow = property->GetWindow();
|
||||
if (!m_propertyWindow)
|
||||
return FALSE;
|
||||
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
|
||||
text->SetValue(property->GetValue().StringValue());
|
||||
}
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
|
||||
{
|
||||
wxListBox *lbox = (wxListBox *)m_propertyWindow;
|
||||
if (lbox->Number() == 0 && m_strings)
|
||||
{
|
||||
// Try to initialize the listbox from 'strings'
|
||||
wxNode *node = m_strings->First();
|
||||
while (node)
|
||||
{
|
||||
char *s = (char *)node->Data();
|
||||
lbox->Append(s);
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
lbox->SetStringSelection(property->GetValue().StringValue());
|
||||
}
|
||||
/*
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
|
||||
{
|
||||
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
|
||||
rbox->SetStringSelection(property->GetValue().StringValue());
|
||||
}
|
||||
*/
|
||||
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
|
||||
{
|
||||
wxChoice *choice = (wxChoice *)m_propertyWindow;
|
||||
#ifndef __XVIEW__
|
||||
if (choice->Number() == 0 && m_strings)
|
||||
{
|
||||
// Try to initialize the choice item from 'strings'
|
||||
// XView doesn't allow this kind of thing.
|
||||
wxNode *node = m_strings->First();
|
||||
while (node)
|
||||
{
|
||||
char *s = (char *)node->Data();
|
||||
choice->Append(s);
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
choice->SetStringSelection(property->GetValue().StringValue());
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -1,297 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: propform.h
|
||||
// Purpose: Property form classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _PROPFORM_H_
|
||||
#define _PROPFORM_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "propform.h"
|
||||
#endif
|
||||
|
||||
#include "prop.h"
|
||||
|
||||
////
|
||||
//// Property form classes: for using an existing dialog or panel
|
||||
////
|
||||
|
||||
#define wxID_PROP_REVERT 3100
|
||||
#define wxID_PROP_UPDATE 3101
|
||||
|
||||
// Mediates between a physical panel and the property sheet
|
||||
class wxPropertyFormView: public wxPropertyView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyFormView)
|
||||
public:
|
||||
wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0);
|
||||
~wxPropertyFormView(void);
|
||||
|
||||
// Associates and shows the view
|
||||
virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel);
|
||||
|
||||
// Update this view of the viewed object, called e.g. by
|
||||
// the object itself.
|
||||
virtual bool OnUpdateView(void);
|
||||
|
||||
// Transfer values from property sheet to dialog
|
||||
virtual bool TransferToDialog(void);
|
||||
|
||||
// Transfer values from dialog to property sheet
|
||||
virtual bool TransferToPropertySheet(void);
|
||||
|
||||
// Check that all the values are valid
|
||||
virtual bool Check(void);
|
||||
|
||||
// Give each property in the sheet a panel item, by matching
|
||||
// the name of the property to the name of the panel item.
|
||||
// The user doesn't always want to call this; sometimes, it
|
||||
// will have been done explicitly (e.g., no matching names).
|
||||
virtual bool AssociateNames(void);
|
||||
|
||||
void OnOk(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnUpdate(wxCommandEvent& event);
|
||||
void OnRevert(wxCommandEvent& event);
|
||||
|
||||
virtual bool OnClose(void);
|
||||
virtual void OnDoubleClick(wxControl *item);
|
||||
|
||||
// TODO: does OnCommand still get called...???
|
||||
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
|
||||
|
||||
inline virtual void AssociatePanel(wxWindow *win) { m_propertyWindow = win; }
|
||||
inline virtual wxWindow *GetPanel(void) const { return m_propertyWindow; }
|
||||
|
||||
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
|
||||
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
|
||||
|
||||
inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
|
||||
inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
|
||||
inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
|
||||
|
||||
public:
|
||||
static bool sm_dialogCancelled;
|
||||
|
||||
protected:
|
||||
bool m_detailedEditing; // E.g. using listbox for choices
|
||||
|
||||
wxWindow* m_propertyWindow; // Panel that the controls will appear on
|
||||
wxWindow* m_managedWindow; // Frame or dialog
|
||||
|
||||
wxButton* m_windowCloseButton; // Or OK
|
||||
wxButton* m_windowCancelButton;
|
||||
wxButton* m_windowHelpButton;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* The type of validator used for forms (wxForm style but using an existing panel
|
||||
* or dialog box).
|
||||
* Classes derived from this know how to map from whatever widget they
|
||||
* find themselves paired with, to the wxProperty and vice versa.
|
||||
* Should the widget pointer be stored with the validator, or
|
||||
* the wxProperty? If with the property, we don't have to supply
|
||||
* a validator for every property. Otherwise, there ALWAYS needs
|
||||
* to be a validator. On the other hand, not storing a wxWindow pointer
|
||||
* in the wxProperty is more elegant. Perhaps.
|
||||
* I think on balance, should put wxWindow pointer into wxProperty.
|
||||
* After all, wxProperty will often be used to represent the data
|
||||
* assocated with a window. It's that kinda thing.
|
||||
*/
|
||||
|
||||
class wxPropertyFormValidator: public wxPropertyValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyFormValidator)
|
||||
protected:
|
||||
public:
|
||||
wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { }
|
||||
~wxPropertyFormValidator(void) {}
|
||||
|
||||
// Called to check value is OK (e.g. when OK is pressed)
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) ) { return TRUE; }
|
||||
|
||||
// Does the transferance from the property editing area to the property itself.
|
||||
// Called by the view, e.g. when closing the window.
|
||||
virtual bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0;
|
||||
|
||||
// Called by the view to transfer the property to the window.
|
||||
virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0;
|
||||
|
||||
virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) ) { }
|
||||
virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) ) { }
|
||||
virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow) ) { }
|
||||
virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
|
||||
wxWindow *WXUNUSED(parentWindow), wxCommandEvent& WXUNUSED(event) ) {}
|
||||
};
|
||||
|
||||
/*
|
||||
* Some default validators
|
||||
*/
|
||||
|
||||
class wxRealFormValidator: public wxPropertyFormValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRealFormValidator)
|
||||
public:
|
||||
// 0.0, 0.0 means no range
|
||||
wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags)
|
||||
{
|
||||
m_realMin = min; m_realMax = max;
|
||||
}
|
||||
~wxRealFormValidator(void) {}
|
||||
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
// Called by the view to transfer the property to the window.
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
|
||||
protected:
|
||||
float m_realMin;
|
||||
float m_realMax;
|
||||
};
|
||||
|
||||
class wxIntegerFormValidator: public wxPropertyFormValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator)
|
||||
public:
|
||||
// 0, 0 means no range
|
||||
wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags)
|
||||
{
|
||||
m_integerMin = min; m_integerMax = max;
|
||||
}
|
||||
~wxIntegerFormValidator(void) {}
|
||||
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
|
||||
protected:
|
||||
long m_integerMin;
|
||||
long m_integerMax;
|
||||
};
|
||||
|
||||
class wxBoolFormValidator: public wxPropertyFormValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBoolFormValidator)
|
||||
protected:
|
||||
public:
|
||||
wxBoolFormValidator(long flags = 0):wxPropertyFormValidator(flags)
|
||||
{
|
||||
}
|
||||
~wxBoolFormValidator(void) {}
|
||||
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
};
|
||||
|
||||
class wxStringFormValidator: public wxPropertyFormValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStringFormValidator)
|
||||
public:
|
||||
wxStringFormValidator(wxStringList *list = NULL, long flags = 0);
|
||||
|
||||
~wxStringFormValidator(void)
|
||||
{
|
||||
if (m_strings)
|
||||
delete m_strings;
|
||||
}
|
||||
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
|
||||
|
||||
protected:
|
||||
wxStringList* m_strings;
|
||||
};
|
||||
|
||||
/*
|
||||
* A default dialog box class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyFormDialog: public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyFormDialog)
|
||||
public:
|
||||
wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
|
||||
bool OnClose(void);
|
||||
void OnDefaultAction(wxControl *item);
|
||||
void OnCommand(wxWindow& win, wxCommandEvent& event);
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
private:
|
||||
wxPropertyFormView* m_view;
|
||||
};
|
||||
|
||||
/*
|
||||
* A default panel class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyFormPanel: public wxPanel
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyFormPanel)
|
||||
public:
|
||||
wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"):
|
||||
wxPanel(parent, -1, pos, size, style, name)
|
||||
{
|
||||
m_view = v;
|
||||
}
|
||||
void OnDefaultAction(wxControl *item);
|
||||
void OnCommand(wxWindow& win, wxCommandEvent& event);
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
private:
|
||||
wxPropertyFormView* m_view;
|
||||
};
|
||||
|
||||
/*
|
||||
* A default frame class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyFormFrame: public wxFrame
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyFormFrame)
|
||||
public:
|
||||
wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
|
||||
wxFrame(parent, -1, title, pos, size, style, name)
|
||||
{
|
||||
m_view = v;
|
||||
m_propertyPanel = NULL;
|
||||
}
|
||||
bool OnClose(void);
|
||||
|
||||
// Must call this to create panel and associate view
|
||||
virtual bool Initialize(void);
|
||||
virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v);
|
||||
inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
|
||||
|
||||
private:
|
||||
wxPropertyFormView* m_view;
|
||||
wxPanel* m_propertyPanel;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,557 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: proplist.h
|
||||
// Purpose: Property list classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
||||
TO DO:
|
||||
|
||||
(1) Optional popup-help for each item, and an optional Help button
|
||||
for dialog.
|
||||
|
||||
(2) Align Ok, Cancel, Help buttons properly.
|
||||
|
||||
(3) Consider retrieving the rectangle on the panel that can be
|
||||
drawn into (where the value listbox is) and giving an example
|
||||
of editing graphically. May be too fancy.
|
||||
|
||||
(4) Deriveable types for wxPropertyValue => may need to reorganise
|
||||
wxPropertyValue to use inheritance rather than present all-types-in-one
|
||||
scheme.
|
||||
|
||||
(5) Optional popup panel for value list, perhaps.
|
||||
|
||||
(6) Floating point checking routine still crashes with Floating
|
||||
point error for zany input.
|
||||
|
||||
(7) Property sheet with choice (or listbox) to select alternative
|
||||
sheets... multiple views per panel, only one active. For this
|
||||
we really need a wxChoice that can be dynamically set: XView
|
||||
may be a problem; Motif?
|
||||
|
||||
(8) More example validators, e.g. colour selector.
|
||||
*/
|
||||
|
||||
#ifndef _PROPLIST_H_
|
||||
#define _PROPLIST_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "proplist.h"
|
||||
#endif
|
||||
|
||||
#include "prop.h"
|
||||
|
||||
#define wxPROP_BUTTON_CLOSE 1
|
||||
#define wxPROP_BUTTON_OK 2
|
||||
#define wxPROP_BUTTON_CANCEL 4
|
||||
#define wxPROP_BUTTON_CHECK_CROSS 8
|
||||
#define wxPROP_BUTTON_HELP 16
|
||||
#define wxPROP_DYNAMIC_VALUE_FIELD 32
|
||||
#define wxPROP_PULLDOWN 64
|
||||
#define wxPROP_SHOWVALUES 128
|
||||
|
||||
#ifdef __XVIEW__
|
||||
#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN
|
||||
#else
|
||||
#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN | wxPROP_SHOWVALUES
|
||||
#endif
|
||||
|
||||
#define wxID_PROP_CROSS 3000
|
||||
#define wxID_PROP_CHECK 3001
|
||||
#define wxID_PROP_EDIT 3002
|
||||
#define wxID_PROP_TEXT 3003
|
||||
#define wxID_PROP_SELECT 3004
|
||||
#define wxID_PROP_VALUE_SELECT 3005
|
||||
|
||||
// Mediates between a physical panel and the property sheet
|
||||
class wxPropertyListView: public wxPropertyView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyListView)
|
||||
public:
|
||||
wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT);
|
||||
~wxPropertyListView(void);
|
||||
|
||||
// Associates and shows the view
|
||||
virtual void ShowView(wxPropertySheet *propertySheet, wxPanel *panel);
|
||||
|
||||
// Update this view of the viewed object, called e.g. by
|
||||
// the object itself.
|
||||
virtual bool OnUpdateView(void);
|
||||
|
||||
wxString MakeNameValueString(wxString name, wxString value);
|
||||
|
||||
// Update a single line in the list of properties
|
||||
virtual bool UpdatePropertyDisplayInList(wxProperty *property);
|
||||
|
||||
// Update the whole list
|
||||
virtual bool UpdatePropertyList(bool clearEditArea = TRUE);
|
||||
|
||||
// Find the wxListBox index corresponding to this property
|
||||
virtual int FindListIndexForProperty(wxProperty *property);
|
||||
|
||||
// Select and show string representation in editor the given
|
||||
// property. NULL resets to show no property.
|
||||
virtual bool ShowProperty(wxProperty *property, bool select = TRUE);
|
||||
virtual bool EditProperty(wxProperty *property);
|
||||
|
||||
// Update the display from the property
|
||||
virtual bool DisplayProperty(wxProperty *property);
|
||||
// Update the property from the display
|
||||
virtual bool RetrieveProperty(wxProperty *property);
|
||||
|
||||
// Find appropriate validator and load property into value controls
|
||||
virtual bool BeginShowingProperty(wxProperty *property);
|
||||
// Find appropriate validator and unload property from value controls
|
||||
virtual bool EndShowingProperty(wxProperty *property);
|
||||
|
||||
// Begin detailed editing (e.g. using value listbox)
|
||||
virtual void BeginDetailedEditing(void);
|
||||
|
||||
// End detailed editing (e.g. using value listbox)
|
||||
virtual void EndDetailedEditing(void);
|
||||
|
||||
// Called by the property listbox
|
||||
void OnPropertySelect(wxCommandEvent& event);
|
||||
|
||||
// Called by the value listbox
|
||||
void OnValueListSelect(wxCommandEvent& event);
|
||||
|
||||
virtual bool CreateControls(void);
|
||||
virtual void ShowTextControl(bool show);
|
||||
virtual void ShowListBoxControl(bool show);
|
||||
virtual void EnableCheck(bool show);
|
||||
virtual void EnableCross(bool show);
|
||||
|
||||
void OnOk(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnPropertyDoubleClick(wxCommandEvent& event);
|
||||
// virtual void OnDoubleClick(void);
|
||||
|
||||
void OnCheck(wxCommandEvent& event);
|
||||
void OnCross(wxCommandEvent& event);
|
||||
void OnEdit(wxCommandEvent& event);
|
||||
void OnText(wxCommandEvent& event);
|
||||
|
||||
inline virtual wxListBox *GetPropertyScrollingList() const { return m_propertyScrollingList; }
|
||||
inline virtual wxListBox *GetValueList() const { return m_valueList; }
|
||||
inline virtual wxTextCtrl *GetValueText() const { return m_valueText; }
|
||||
inline virtual wxButton *GetConfirmButton() const { return m_confirmButton; }
|
||||
inline virtual wxButton *GetCancelButton() const { return m_cancelButton; }
|
||||
inline virtual wxButton *GetEditButton() const { return m_editButton; }
|
||||
inline virtual bool GetDetailedEditing(void) const { return m_detailedEditing; }
|
||||
|
||||
inline virtual void AssociatePanel(wxPanel *win) { m_propertyWindow = win; }
|
||||
inline virtual wxPanel *GetPanel(void) const { return m_propertyWindow; }
|
||||
|
||||
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
|
||||
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
|
||||
|
||||
inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
|
||||
inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
|
||||
inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
|
||||
|
||||
bool OnClose(void);
|
||||
|
||||
public:
|
||||
static bool sm_dialogCancelled;
|
||||
|
||||
protected:
|
||||
wxListBox* m_propertyScrollingList;
|
||||
wxListBox* m_valueList; // Should really be a combobox, but we don't have one.
|
||||
wxTextCtrl* m_valueText;
|
||||
wxButton* m_confirmButton; // A tick, as in VB
|
||||
wxButton* m_cancelButton; // A cross, as in VB
|
||||
wxButton* m_editButton; // Invokes the custom validator, if any
|
||||
|
||||
bool m_detailedEditing; // E.g. using listbox for choices
|
||||
|
||||
static wxBitmap* sm_tickBitmap;
|
||||
static wxBitmap* sm_crossBitmap;
|
||||
|
||||
wxPanel* m_propertyWindow; // Panel that the controls will appear on
|
||||
wxWindow* m_managedWindow; // Frame or dialog
|
||||
|
||||
wxButton* m_windowCloseButton; // Or OK
|
||||
wxButton* m_windowCancelButton;
|
||||
wxButton* m_windowHelpButton;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class wxPropertyTextEdit: public wxTextCtrl
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyTextEdit)
|
||||
public:
|
||||
wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id,
|
||||
const wxString& value, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text");
|
||||
void OnSetFocus(void);
|
||||
void OnKillFocus(void);
|
||||
|
||||
wxPropertyListView* m_view;
|
||||
};
|
||||
|
||||
#define wxPROP_ALLOW_TEXT_EDITING 1
|
||||
|
||||
/*
|
||||
* The type of validator used for property lists (Visual Basic style)
|
||||
*/
|
||||
|
||||
class wxPropertyListValidator: public wxPropertyValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { }
|
||||
~wxPropertyListValidator(void) {}
|
||||
|
||||
// Called when the property is selected or deselected: typically displays the value
|
||||
// in the edit control (having chosen a suitable control to display: (non)editable text or listbox)
|
||||
virtual bool OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the property is double clicked. Extra functionality can be provided, such as
|
||||
// cycling through possible values.
|
||||
inline virtual bool OnDoubleClick(
|
||||
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
|
||||
{ return TRUE; }
|
||||
|
||||
// Called when the value listbox is selected. Default behaviour is to copy
|
||||
// string to text control, and retrieve the value into the property.
|
||||
virtual bool OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the property value is edited using standard text control
|
||||
inline virtual bool OnPrepareControls(
|
||||
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
|
||||
{ return TRUE; }
|
||||
|
||||
virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the property is edited in detail
|
||||
inline virtual bool OnPrepareDetailControls(
|
||||
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
|
||||
{ return TRUE; }
|
||||
|
||||
// Called if focus lost, IF we're in a modeless property editing situation.
|
||||
inline virtual bool OnClearDetailControls(
|
||||
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
|
||||
{ return TRUE; }
|
||||
|
||||
// Called when the edit (...) button is pressed. The default implementation
|
||||
// calls view->BeginDetailedEditing; the filename validator (for example) overrides
|
||||
// this function to show the file selector.
|
||||
virtual void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
inline virtual bool OnCheckValue(
|
||||
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
|
||||
{ return TRUE; }
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transferance from the property editing area to the property itself
|
||||
virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
};
|
||||
|
||||
/*
|
||||
* A default dialog box class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyListDialog: public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyListDialog)
|
||||
public:
|
||||
wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
|
||||
bool OnClose(void);
|
||||
void OnDefaultAction(wxControl *item);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
private:
|
||||
wxPropertyListView* m_view;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* A default panel class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyListPanel: public wxPanel
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyListPanel)
|
||||
public:
|
||||
wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = "panel"):
|
||||
wxPanel(parent, -1, pos, size, style, name)
|
||||
{
|
||||
m_view = v;
|
||||
}
|
||||
~wxPropertyListPanel();
|
||||
void OnDefaultAction(wxControl *item);
|
||||
|
||||
inline void SetView(wxPropertyListView* v) { m_view = v; }
|
||||
inline wxPropertyListView* GetView() const { return m_view; }
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
// Call Layout()
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
private:
|
||||
wxPropertyListView* m_view;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* A default frame class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyListFrame: public wxFrame
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyListFrame)
|
||||
public:
|
||||
wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
|
||||
wxFrame(parent, -1, title, pos, size, style, name)
|
||||
{
|
||||
m_view = v;
|
||||
m_propertyPanel = NULL;
|
||||
}
|
||||
bool OnClose(void);
|
||||
|
||||
// Must call this to create panel and associate view
|
||||
virtual bool Initialize(void);
|
||||
virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v);
|
||||
inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
|
||||
|
||||
private:
|
||||
wxPropertyListView* m_view;
|
||||
wxPropertyListPanel* m_propertyPanel;
|
||||
};
|
||||
|
||||
/*
|
||||
* Some default validators
|
||||
*/
|
||||
|
||||
class wxRealListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRealListValidator)
|
||||
public:
|
||||
// 0.0, 0.0 means no range
|
||||
wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
|
||||
{
|
||||
m_realMin = min; m_realMax = max;
|
||||
}
|
||||
~wxRealListValidator(void) {}
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transfer from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
protected:
|
||||
float m_realMin;
|
||||
float m_realMax;
|
||||
};
|
||||
|
||||
class wxIntegerListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIntegerListValidator)
|
||||
public:
|
||||
// 0, 0 means no range
|
||||
wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
|
||||
{
|
||||
m_integerMin = min; m_integerMax = max;
|
||||
}
|
||||
~wxIntegerListValidator(void) {}
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transfer from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
protected:
|
||||
long m_integerMin;
|
||||
long m_integerMax;
|
||||
};
|
||||
|
||||
class wxBoolListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBoolListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags)
|
||||
{
|
||||
}
|
||||
~wxBoolListValidator(void) {}
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transfer from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the property is double clicked. Extra functionality can be provided,
|
||||
// cycling through possible values.
|
||||
virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
};
|
||||
|
||||
class wxStringListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
|
||||
public:
|
||||
wxStringListValidator(wxStringList *list = NULL, long flags = 0);
|
||||
|
||||
~wxStringListValidator(void)
|
||||
{
|
||||
if (m_strings)
|
||||
delete m_strings;
|
||||
}
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transfer from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the property is double clicked. Extra functionality can be provided,
|
||||
// cycling through possible values.
|
||||
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
protected:
|
||||
wxStringList* m_strings;
|
||||
};
|
||||
|
||||
class wxFilenameListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFilenameListValidator)
|
||||
public:
|
||||
wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0);
|
||||
|
||||
~wxFilenameListValidator(void);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transferance from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the edit (...) button is pressed.
|
||||
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
protected:
|
||||
wxString m_filenameWildCard;
|
||||
wxString m_filenameMessage;
|
||||
|
||||
};
|
||||
|
||||
class wxColourListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxColourListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxColourListValidator(long flags = 0);
|
||||
|
||||
~wxColourListValidator(void);
|
||||
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the edit (...) button is pressed.
|
||||
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
};
|
||||
|
||||
class wxListOfStringsListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxListOfStringsListValidator(long flags = 0);
|
||||
|
||||
~wxListOfStringsListValidator(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost.
|
||||
// Return FALSE if value didn't check out; signal to restore old value.
|
||||
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when TICK is pressed or focus is lost or view wants to update
|
||||
// the property list.
|
||||
// Does the transfer from the property editing area to the property itself
|
||||
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
// Called when the property is double clicked.
|
||||
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
|
||||
bool EditStringList(wxWindow *parent, wxStringList *stringList, const char *title = "String List Editor");
|
||||
|
||||
// Called when the edit (...) button is pressed.
|
||||
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -1,321 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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);
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
NAME TEST
|
||||
DESCRIPTION 'wxProperty test'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 1024
|
||||
STACKSIZE 8192
|
@@ -1,127 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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 "proplist.h"
|
||||
#include "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
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 198 B |
Reference in New Issue
Block a user