initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
335
libs/wxWidgets-3.3.1/samples/widgets/Makefile.in
Normal file
335
libs/wxWidgets-3.3.1/samples/widgets/Makefile.in
Normal file
@@ -0,0 +1,335 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.2.13 (http://www.bakefile.org)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
|
||||
@MAKE_SET@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datarootdir = @datarootdir@
|
||||
INSTALL = @INSTALL@
|
||||
EXEEXT = @EXEEXT@
|
||||
WINDRES = @WINDRES@
|
||||
NM = @NM@
|
||||
BK_DEPS = @BK_DEPS@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS_GUI = @LDFLAGS_GUI@
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
OBJCXXFLAGS = @OBJCXXFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
USE_DPI_AWARE_MANIFEST = @USE_DPI_AWARE_MANIFEST@
|
||||
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
|
||||
TOOLKIT = @TOOLKIT@
|
||||
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
|
||||
TOOLKIT_VERSION = @TOOLKIT_VERSION@
|
||||
TOOLCHAIN_FULLNAME = @TOOLCHAIN_FULLNAME@
|
||||
EXTRALIBS = @EXTRALIBS@
|
||||
EXTRALIBS_XML = @EXTRALIBS_XML@
|
||||
EXTRALIBS_GUI = @EXTRALIBS_GUI@
|
||||
WX_CPPFLAGS = @WX_CPPFLAGS@
|
||||
WX_CXXFLAGS = @WX_CXXFLAGS@
|
||||
WX_LDFLAGS = @WX_LDFLAGS@
|
||||
HOST_SUFFIX = @HOST_SUFFIX@
|
||||
DYLIB_RPATH_FLAG = @DYLIB_RPATH_FLAG@
|
||||
SAMPLES_CXXFLAGS = @SAMPLES_CXXFLAGS@
|
||||
wx_top_builddir = @wx_top_builddir@
|
||||
|
||||
### Variables: ###
|
||||
|
||||
DESTDIR =
|
||||
WX_RELEASE = 3.3
|
||||
WX_VERSION = $(WX_RELEASE).1
|
||||
LIBDIRNAME = $(wx_top_builddir)/lib
|
||||
WIDGETS_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples \
|
||||
$(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
|
||||
WIDGETS_OBJCXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples \
|
||||
$(CPPFLAGS) $(OBJCXXFLAGS)
|
||||
WIDGETS_OBJECTS = \
|
||||
$(__widgets___win32rc) \
|
||||
widgets_activityindicator.o \
|
||||
widgets_bmpcombobox.o \
|
||||
widgets_button.o \
|
||||
widgets_checkbox.o \
|
||||
widgets_choice.o \
|
||||
widgets_clrpicker.o \
|
||||
widgets_combobox.o \
|
||||
widgets_datepick.o \
|
||||
widgets_dirctrl.o \
|
||||
widgets_dirpicker.o \
|
||||
widgets_editlbox.o \
|
||||
widgets_filectrl.o \
|
||||
widgets_filepicker.o \
|
||||
widgets_fontpicker.o \
|
||||
widgets_gauge.o \
|
||||
widgets_headerctrl.o \
|
||||
widgets_hyperlnk.o \
|
||||
widgets_itemcontainer.o \
|
||||
widgets_listbox.o \
|
||||
$(__NATIVE_OBJCPP_SRC_OBJECTS) \
|
||||
widgets_native.o \
|
||||
widgets_notebook.o \
|
||||
widgets_odcombobox.o \
|
||||
widgets_radiobox.o \
|
||||
widgets_searchctrl.o \
|
||||
widgets_slider.o \
|
||||
widgets_spinbtn.o \
|
||||
widgets_static.o \
|
||||
widgets_statbmp.o \
|
||||
widgets_textctrl.o \
|
||||
widgets_timepick.o \
|
||||
widgets_toggle.o \
|
||||
widgets_widgets.o
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@COND_DEPS_TRACKING_0@CXXC = $(CXX)
|
||||
@COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX)
|
||||
@COND_USE_GUI_0@PORTNAME = base
|
||||
@COND_USE_GUI_1@PORTNAME = $(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
|
||||
@COND_TOOLKIT_MAC@WXBASEPORT = _carbon
|
||||
@COND_BUILD_debug@WXDEBUGFLAG = d
|
||||
@COND_WXUNIV_1@WXUNIVNAME = univ
|
||||
@COND_MONOLITHIC_0@EXTRALIBS_FOR_BASE = $(EXTRALIBS)
|
||||
@COND_MONOLITHIC_1@EXTRALIBS_FOR_BASE = $(EXTRALIBS) \
|
||||
@COND_MONOLITHIC_1@ $(EXTRALIBS_XML) $(EXTRALIBS_GUI)
|
||||
@COND_MONOLITHIC_0@EXTRALIBS_FOR_GUI = $(EXTRALIBS_GUI)
|
||||
@COND_MONOLITHIC_1@EXTRALIBS_FOR_GUI =
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
|
||||
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
|
||||
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p_1 = --define wxDEBUG_LEVEL=0
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p_1 = --define wxNO_RTTI
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p_1 = --define wxNO_THREADS
|
||||
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
|
||||
@COND_SHARED_1@__DLLFLAG_p_1 = --define WXUSINGDLL
|
||||
@COND_PLATFORM_WIN32_1@__WIN32_DPI_MANIFEST_p = \
|
||||
@COND_PLATFORM_WIN32_1@ --define \
|
||||
@COND_PLATFORM_WIN32_1@ wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST)
|
||||
COND_PLATFORM_OS2_1___widgets___os2_emxbindcmd = $(NM) widgets$(EXEEXT) | if \
|
||||
grep -q pmwin.763 ; then emxbind -ep widgets$(EXEEXT) ; fi
|
||||
@COND_PLATFORM_OS2_1@__widgets___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___widgets___os2_emxbindcmd)
|
||||
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
|
||||
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
|
||||
@COND_PLATFORM_WIN32_1@__widgets___win32rc = widgets_sample_rc.o
|
||||
@COND_PLATFORM_MACOSX_1@__widgets_app_Contents_PkgInfo___depname \
|
||||
@COND_PLATFORM_MACOSX_1@ = widgets.app/Contents/PkgInfo
|
||||
@COND_PLATFORM_MACOSX_1@__widgets_bundle___depname = widgets_bundle
|
||||
@COND_TOOLKIT_MAC@____widgets_BUNDLE_TGT_REF_DEP = \
|
||||
@COND_TOOLKIT_MAC@ $(__widgets_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_OSX_CARBON@____widgets_BUNDLE_TGT_REF_DEP \
|
||||
@COND_TOOLKIT_OSX_CARBON@ = $(__widgets_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_OSX_COCOA@____widgets_BUNDLE_TGT_REF_DEP \
|
||||
@COND_TOOLKIT_OSX_COCOA@ = $(__widgets_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_OSX_IPHONE@____widgets_BUNDLE_TGT_REF_DEP \
|
||||
@COND_TOOLKIT_OSX_IPHONE@ = $(__widgets_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_COCOA@____widgets_BUNDLE_TGT_REF_DEP = \
|
||||
@COND_TOOLKIT_COCOA@ $(__widgets_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_OSX_COCOA_WXUNIV_0@__NATIVE_OBJCPP_SRC_OBJECTS \
|
||||
@COND_TOOLKIT_OSX_COCOA_WXUNIV_0@ = widgets_native_wrapper.o
|
||||
COND_MONOLITHIC_0___WXLIB_CORE_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)
|
||||
COND_MONOLITHIC_0___WXLIB_BASE_p = \
|
||||
-lwx_base$(WXBASEPORT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
|
||||
COND_MONOLITHIC_1___WXLIB_MONO_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)
|
||||
@COND_MONOLITHIC_1_USE_STC_1@__LIB_SCINTILLA_IF_MONO_p \
|
||||
@COND_MONOLITHIC_1_USE_STC_1@ = $(__LIB_SCINTILLA_p)
|
||||
@COND_USE_STC_1@__LIB_SCINTILLA_p = \
|
||||
@COND_USE_STC_1@ -lwxscintilla$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_1_USE_STC_1@__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
|
||||
@COND_USE_STC_1@__LIB_LEXILLA_p = \
|
||||
@COND_USE_STC_1@ -lwxlexilla$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@__LIB_TIFF_p \
|
||||
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@ = \
|
||||
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@ -lwxtiff$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@__LIB_JPEG_p \
|
||||
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@ = \
|
||||
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@ -lwxjpeg$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@__LIB_PNG_p \
|
||||
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@ = \
|
||||
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@ -lwxpng$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_USE_GUI_1_wxUSE_LIBWEBP_builtin@__LIB_WEBP_p \
|
||||
@COND_USE_GUI_1_wxUSE_LIBWEBP_builtin@ = \
|
||||
@COND_USE_GUI_1_wxUSE_LIBWEBP_builtin@ -lwxwebp$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_wxUSE_ZLIB_builtin@__LIB_ZLIB_p = \
|
||||
@COND_wxUSE_ZLIB_builtin@ -lwxzlib$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_wxUSE_REGEX_builtin@__LIB_REGEX_p = \
|
||||
@COND_wxUSE_REGEX_builtin@ -lwxregexu$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_wxUSE_EXPAT_builtin@__LIB_EXPAT_p = \
|
||||
@COND_wxUSE_EXPAT_builtin@ -lwxexpat$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: widgets$(EXEEXT) $(__widgets_bundle___depname)
|
||||
|
||||
install:
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip: install
|
||||
|
||||
clean:
|
||||
rm -rf ./.deps ./.pch
|
||||
rm -f ./*.o
|
||||
rm -f widgets$(EXEEXT)
|
||||
rm -rf widgets.app
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
|
||||
|
||||
widgets$(EXEEXT): $(WIDGETS_OBJECTS) $(__widgets___win32rc)
|
||||
$(CXX) -o $@ $(WIDGETS_OBJECTS) -L$(LIBDIRNAME) $(DYLIB_RPATH_FLAG) $(LDFLAGS_GUI) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
|
||||
$(__widgets___os2_emxbindcmd)
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@widgets.app/Contents/PkgInfo: widgets$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
|
||||
@COND_PLATFORM_MACOSX_1@ mkdir -p widgets.app/Contents
|
||||
@COND_PLATFORM_MACOSX_1@ mkdir -p widgets.app/Contents/MacOS
|
||||
@COND_PLATFORM_MACOSX_1@ mkdir -p widgets.app/Contents/Resources
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ sed -e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.widgets/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/widgets/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/widgets/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_COPYRIGHT}/Copyright 2002-2025 wxWidgets/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_VERSION}/$(WX_VERSION)/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_INFO_STRING}/widgets version $(WX_VERSION), (c) 2002-2025 wxWidgets/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_LONG_VERSION_STRING}/$(WX_VERSION), (c) 2002-2025 wxWidgets/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_SHORT_VERSION_STRING}/$(WX_RELEASE)/" \
|
||||
@COND_PLATFORM_MACOSX_1@ $(top_srcdir)/src/osx/carbon/Info.plist.in >widgets.app/Contents/Info.plist
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >widgets.app/Contents/PkgInfo
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ ln -f widgets$(EXEEXT) widgets.app/Contents/MacOS/widgets
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns widgets.app/Contents/Resources/wxmac.icns
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@widgets_bundle: $(____widgets_BUNDLE_TGT_REF_DEP)
|
||||
|
||||
widgets_sample_rc.o: $(srcdir)/../../samples/sample.rc
|
||||
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) --include-dir $(srcdir) $(__DLLFLAG_p_1) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
|
||||
|
||||
widgets_activityindicator.o: $(srcdir)/activityindicator.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/activityindicator.cpp
|
||||
|
||||
widgets_bmpcombobox.o: $(srcdir)/bmpcombobox.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/bmpcombobox.cpp
|
||||
|
||||
widgets_button.o: $(srcdir)/button.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/button.cpp
|
||||
|
||||
widgets_checkbox.o: $(srcdir)/checkbox.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/checkbox.cpp
|
||||
|
||||
widgets_choice.o: $(srcdir)/choice.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/choice.cpp
|
||||
|
||||
widgets_clrpicker.o: $(srcdir)/clrpicker.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/clrpicker.cpp
|
||||
|
||||
widgets_combobox.o: $(srcdir)/combobox.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/combobox.cpp
|
||||
|
||||
widgets_datepick.o: $(srcdir)/datepick.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/datepick.cpp
|
||||
|
||||
widgets_dirctrl.o: $(srcdir)/dirctrl.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/dirctrl.cpp
|
||||
|
||||
widgets_dirpicker.o: $(srcdir)/dirpicker.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/dirpicker.cpp
|
||||
|
||||
widgets_editlbox.o: $(srcdir)/editlbox.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/editlbox.cpp
|
||||
|
||||
widgets_filectrl.o: $(srcdir)/filectrl.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/filectrl.cpp
|
||||
|
||||
widgets_filepicker.o: $(srcdir)/filepicker.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/filepicker.cpp
|
||||
|
||||
widgets_fontpicker.o: $(srcdir)/fontpicker.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/fontpicker.cpp
|
||||
|
||||
widgets_gauge.o: $(srcdir)/gauge.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/gauge.cpp
|
||||
|
||||
widgets_headerctrl.o: $(srcdir)/headerctrl.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/headerctrl.cpp
|
||||
|
||||
widgets_hyperlnk.o: $(srcdir)/hyperlnk.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/hyperlnk.cpp
|
||||
|
||||
widgets_itemcontainer.o: $(srcdir)/itemcontainer.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/itemcontainer.cpp
|
||||
|
||||
widgets_listbox.o: $(srcdir)/listbox.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/listbox.cpp
|
||||
|
||||
widgets_native_wrapper.o: $(srcdir)/native_wrapper.mm
|
||||
$(CXXC) -c -o $@ $(WIDGETS_OBJCXXFLAGS) $(srcdir)/native_wrapper.mm
|
||||
|
||||
widgets_native.o: $(srcdir)/native.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/native.cpp
|
||||
|
||||
widgets_notebook.o: $(srcdir)/notebook.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/notebook.cpp
|
||||
|
||||
widgets_odcombobox.o: $(srcdir)/odcombobox.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/odcombobox.cpp
|
||||
|
||||
widgets_radiobox.o: $(srcdir)/radiobox.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/radiobox.cpp
|
||||
|
||||
widgets_searchctrl.o: $(srcdir)/searchctrl.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/searchctrl.cpp
|
||||
|
||||
widgets_slider.o: $(srcdir)/slider.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/slider.cpp
|
||||
|
||||
widgets_spinbtn.o: $(srcdir)/spinbtn.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/spinbtn.cpp
|
||||
|
||||
widgets_static.o: $(srcdir)/static.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/static.cpp
|
||||
|
||||
widgets_statbmp.o: $(srcdir)/statbmp.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/statbmp.cpp
|
||||
|
||||
widgets_textctrl.o: $(srcdir)/textctrl.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/textctrl.cpp
|
||||
|
||||
widgets_timepick.o: $(srcdir)/timepick.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/timepick.cpp
|
||||
|
||||
widgets_toggle.o: $(srcdir)/toggle.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/toggle.cpp
|
||||
|
||||
widgets_widgets.o: $(srcdir)/widgets.cpp
|
||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/widgets.cpp
|
||||
|
||||
|
||||
# Include dependency info, if present:
|
||||
@IF_GNU_MAKE@-include ./.deps/*.d
|
||||
|
||||
.PHONY: all install uninstall clean distclean widgets_bundle
|
||||
156
libs/wxWidgets-3.3.1/samples/widgets/activityindicator.cpp
Normal file
156
libs/wxWidgets-3.3.1/samples/widgets/activityindicator.cpp
Normal file
@@ -0,0 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: activityindicator.cpp
|
||||
// Purpose: Part of the widgets sample showing wxActivityIndicator
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2015-03-06
|
||||
// Copyright: (c) 2015 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_ACTIVITYINDICATOR
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/button.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/stattext.h"
|
||||
#endif
|
||||
|
||||
#include "wx/activityindicator.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/activityindicator.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Control IDs
|
||||
enum
|
||||
{
|
||||
ActivityIndicator_Start = wxID_HIGHEST,
|
||||
ActivityIndicator_Stop,
|
||||
ActivityIndicator_IsRunning
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ActivityIndicatorWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ActivityIndicatorWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
ActivityIndicatorWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, activityindicator_xpm)
|
||||
{
|
||||
m_indicator = nullptr;
|
||||
m_sizerIndicator = nullptr;
|
||||
}
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_indicator; }
|
||||
virtual void RecreateWidget() override;
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
void OnButtonStart(wxCommandEvent&) { m_indicator->Start(); }
|
||||
void OnButtonStop(wxCommandEvent&) { m_indicator->Stop(); }
|
||||
|
||||
void OnUpdateIsRunning(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.SetText(m_indicator && m_indicator->IsRunning()
|
||||
? "Indicator is running"
|
||||
: "Indicator is stopped");
|
||||
}
|
||||
|
||||
// the indicator itself and the sizer it is in
|
||||
wxActivityIndicator *m_indicator;
|
||||
wxStaticBoxSizer *m_sizerIndicator;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ActivityIndicatorWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ActivityIndicatorWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(ActivityIndicator_Start,
|
||||
ActivityIndicatorWidgetsPage::OnButtonStart)
|
||||
EVT_BUTTON(ActivityIndicator_Stop,
|
||||
ActivityIndicatorWidgetsPage::OnButtonStop)
|
||||
|
||||
EVT_UPDATE_UI(ActivityIndicator_IsRunning,
|
||||
ActivityIndicatorWidgetsPage::OnUpdateIsRunning)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ActivityIndicatorWidgetsPage,
|
||||
"ActivityIndicator", NATIVE_CTRLS);
|
||||
|
||||
void ActivityIndicatorWidgetsPage::CreateContent()
|
||||
{
|
||||
wxStaticBoxSizer* const sizerOper = new wxStaticBoxSizer(wxVERTICAL, this,
|
||||
"&Operations");
|
||||
wxStaticBox* const sizerOperBox = sizerOper->GetStaticBox();
|
||||
|
||||
sizerOper->Add(new wxButton(sizerOperBox, ActivityIndicator_Start, "&Start"),
|
||||
wxSizerFlags().Expand().Border());
|
||||
sizerOper->Add(new wxButton(sizerOperBox, ActivityIndicator_Stop, "&Stop"),
|
||||
wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerOper->Add(new wxStaticText(sizerOperBox, ActivityIndicator_IsRunning,
|
||||
"Indicator is initializing..."),
|
||||
wxSizerFlags().Expand().Border());
|
||||
|
||||
|
||||
m_sizerIndicator = new wxStaticBoxSizer(wxHORIZONTAL, this,
|
||||
"Activity Indicator");
|
||||
RecreateWidget();
|
||||
|
||||
|
||||
wxSizer* const sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizerTop->Add(sizerOper, wxSizerFlags().Expand().DoubleBorder());
|
||||
sizerTop->Add(m_sizerIndicator, wxSizerFlags(1).Expand().DoubleBorder());
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
void ActivityIndicatorWidgetsPage::RecreateWidget()
|
||||
{
|
||||
m_sizerIndicator->Clear(true /* delete windows */);
|
||||
|
||||
m_indicator = new wxActivityIndicator(m_sizerIndicator->GetStaticBox(), wxID_ANY,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
GetAttrs().m_defaultFlags);
|
||||
|
||||
NotifyWidgetRecreation(m_indicator);
|
||||
|
||||
m_sizerIndicator->AddStretchSpacer();
|
||||
m_sizerIndicator->Add(m_indicator, wxSizerFlags().Centre());
|
||||
m_sizerIndicator->AddStretchSpacer();
|
||||
m_sizerIndicator->Layout();
|
||||
}
|
||||
|
||||
#endif // wxUSE_ACTIVITYINDICATOR
|
||||
949
libs/wxWidgets-3.3.1/samples/widgets/bmpcombobox.cpp
Normal file
949
libs/wxWidgets-3.3.1/samples/widgets/bmpcombobox.cpp
Normal file
@@ -0,0 +1,949 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: bmpcombobox.cpp
|
||||
// Purpose: Part of the widgets sample showing wxBitmapComboBox
|
||||
// Author: Jaakko Salli
|
||||
// Created: Sep-01-2006
|
||||
// Copyright: (c) 2006 Jaakko Salli
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_BITMAPCOMBOBOX
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/filedlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/dc.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/dir.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include "wx/filename.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/imaglist.h"
|
||||
#include "wx/bmpcbox.h"
|
||||
|
||||
#include "itemcontainer.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/bmpcombobox.xpm"
|
||||
|
||||
// Images loaded from file are reduced this width and height, if larger
|
||||
#define IMG_SIZE_TRUNC 256
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
BitmapComboBoxPage_Reset = wxID_HIGHEST,
|
||||
BitmapComboBoxPage_Insert,
|
||||
BitmapComboBoxPage_InsertText,
|
||||
BitmapComboBoxPage_ChangeHeight,
|
||||
BitmapComboBoxPage_LoadFromFile,
|
||||
BitmapComboBoxPage_SetFromFile,
|
||||
BitmapComboBoxPage_AddWidgetIcons,
|
||||
BitmapComboBoxPage_AddSeveralWithImages,
|
||||
BitmapComboBoxPage_AddSeveral,
|
||||
BitmapComboBoxPage_AddMany,
|
||||
BitmapComboBoxPage_Clear,
|
||||
BitmapComboBoxPage_Change,
|
||||
BitmapComboBoxPage_Delete,
|
||||
BitmapComboBoxPage_DeleteText,
|
||||
BitmapComboBoxPage_DeleteSel,
|
||||
BitmapComboBoxPage_Combo,
|
||||
BitmapComboBoxPage_ContainerTests
|
||||
};
|
||||
|
||||
// kinds of comboboxes
|
||||
enum
|
||||
{
|
||||
ComboKind_Default,
|
||||
ComboKind_Simple,
|
||||
ComboKind_DropDown
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BitmapComboBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class BitmapComboBoxWidgetsPage : public ItemContainerWidgetsPage
|
||||
{
|
||||
public:
|
||||
BitmapComboBoxWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_combobox; }
|
||||
virtual wxItemContainer* GetContainer() const override { return m_combobox; }
|
||||
virtual void RecreateWidget() override { CreateCombo(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonChange(wxCommandEvent& event);
|
||||
void OnButtonDelete(wxCommandEvent& event);
|
||||
void OnButtonDeleteSel(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonInsert(wxCommandEvent &event);
|
||||
void OnTextChangeHeight(wxCommandEvent& event);
|
||||
void OnButtonLoadFromFile(wxCommandEvent& event);
|
||||
void OnButtonSetFromFile(wxCommandEvent& event);
|
||||
void OnButtonAddSeveral(wxCommandEvent& event);
|
||||
void OnButtonAddSeveralWithImages(wxCommandEvent& event);
|
||||
void OnButtonAddWidgetIcons(wxCommandEvent& event);
|
||||
void OnButtonAddMany(wxCommandEvent& event);
|
||||
|
||||
void OnComboBox(wxCommandEvent& event);
|
||||
void OnDropDown(wxCommandEvent& event);
|
||||
void OnCloseUp(wxCommandEvent& event);
|
||||
void OnComboText(wxCommandEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnTextPopupWidth(wxCommandEvent& event);
|
||||
void OnTextPopupHeight(wxCommandEvent& event);
|
||||
void OnTextButtonAll(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIInsert(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIClearButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIItemManipulator(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
|
||||
// reset the bmpcombobox parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the bmpcombobox
|
||||
void CreateCombo();
|
||||
|
||||
// helpers for creating bitmaps
|
||||
wxBitmap CreateBitmap(const wxColour& colour);
|
||||
wxBitmap LoadBitmap(const wxString& filepath);
|
||||
wxBitmap QueryBitmap(wxString* pStr);
|
||||
|
||||
void LoadWidgetImages( wxArrayString* strings, wxImageList* images );
|
||||
|
||||
wxSizer *CreateSizerWithSmallTextAndLabel(const wxString& label,
|
||||
wxWindowID id,
|
||||
wxTextCtrl **ppText,
|
||||
wxWindow* parent = nullptr);
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
void RescaleImage(wxImage& image, int w, int h);
|
||||
#endif
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the sel mode radiobox
|
||||
wxRadioBox *m_radioKind;
|
||||
|
||||
// the checkboxes for styles
|
||||
wxCheckBox *m_chkSort,
|
||||
*m_chkProcessEnter,
|
||||
*m_chkReadonly;
|
||||
|
||||
// the combobox itself and the sizer it is in
|
||||
wxBitmapComboBox *m_combobox;
|
||||
wxSizer *m_sizerCombo;
|
||||
|
||||
// the text entries for "Add/change string" and "Delete" buttons
|
||||
wxTextCtrl *m_textInsert,
|
||||
*m_textChangeHeight,
|
||||
*m_textChange,
|
||||
*m_textDelete;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(BitmapComboBoxWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(BitmapComboBoxWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(BitmapComboBoxPage_Reset, BitmapComboBoxWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(BitmapComboBoxPage_Change, BitmapComboBoxWidgetsPage::OnButtonChange)
|
||||
EVT_BUTTON(BitmapComboBoxPage_Delete, BitmapComboBoxWidgetsPage::OnButtonDelete)
|
||||
EVT_BUTTON(BitmapComboBoxPage_DeleteSel, BitmapComboBoxWidgetsPage::OnButtonDeleteSel)
|
||||
EVT_BUTTON(BitmapComboBoxPage_Clear, BitmapComboBoxWidgetsPage::OnButtonClear)
|
||||
EVT_BUTTON(BitmapComboBoxPage_Insert, BitmapComboBoxWidgetsPage::OnButtonInsert)
|
||||
EVT_BUTTON(BitmapComboBoxPage_AddSeveral, BitmapComboBoxWidgetsPage::OnButtonAddSeveral)
|
||||
EVT_BUTTON(BitmapComboBoxPage_AddSeveralWithImages, BitmapComboBoxWidgetsPage::OnButtonAddSeveralWithImages)
|
||||
EVT_BUTTON(BitmapComboBoxPage_AddWidgetIcons, BitmapComboBoxWidgetsPage::OnButtonAddWidgetIcons)
|
||||
EVT_BUTTON(BitmapComboBoxPage_AddMany, BitmapComboBoxWidgetsPage::OnButtonAddMany)
|
||||
EVT_BUTTON(BitmapComboBoxPage_LoadFromFile, BitmapComboBoxWidgetsPage::OnButtonLoadFromFile)
|
||||
EVT_BUTTON(BitmapComboBoxPage_SetFromFile, BitmapComboBoxWidgetsPage::OnButtonSetFromFile)
|
||||
EVT_BUTTON(BitmapComboBoxPage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
|
||||
|
||||
EVT_TEXT_ENTER(BitmapComboBoxPage_InsertText, BitmapComboBoxWidgetsPage::OnButtonInsert)
|
||||
EVT_TEXT(BitmapComboBoxPage_ChangeHeight, BitmapComboBoxWidgetsPage::OnTextChangeHeight)
|
||||
EVT_TEXT_ENTER(BitmapComboBoxPage_DeleteText, BitmapComboBoxWidgetsPage::OnButtonDelete)
|
||||
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_Reset, BitmapComboBoxWidgetsPage::OnUpdateUIResetButton)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_Insert, BitmapComboBoxWidgetsPage::OnUpdateUIInsert)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_LoadFromFile, BitmapComboBoxWidgetsPage::OnUpdateUIInsert)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_Clear, BitmapComboBoxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_DeleteText, BitmapComboBoxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_Delete, BitmapComboBoxWidgetsPage::OnUpdateUIDeleteButton)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_Change, BitmapComboBoxWidgetsPage::OnUpdateUIItemManipulator)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_SetFromFile, BitmapComboBoxWidgetsPage::OnUpdateUIItemManipulator)
|
||||
EVT_UPDATE_UI(BitmapComboBoxPage_DeleteSel, BitmapComboBoxWidgetsPage::OnUpdateUIItemManipulator)
|
||||
|
||||
EVT_COMBOBOX_DROPDOWN(BitmapComboBoxPage_Combo, BitmapComboBoxWidgetsPage::OnDropDown)
|
||||
EVT_COMBOBOX_CLOSEUP(BitmapComboBoxPage_Combo, BitmapComboBoxWidgetsPage::OnCloseUp)
|
||||
EVT_COMBOBOX(BitmapComboBoxPage_Combo, BitmapComboBoxWidgetsPage::OnComboBox)
|
||||
EVT_TEXT(BitmapComboBoxPage_Combo, BitmapComboBoxWidgetsPage::OnComboText)
|
||||
EVT_TEXT_ENTER(BitmapComboBoxPage_Combo, BitmapComboBoxWidgetsPage::OnComboText)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, BitmapComboBoxWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, BitmapComboBoxWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXMSW__) || defined(__WXGTK__)
|
||||
#define NATIVE_OR_GENERIC_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define NATIVE_OR_GENERIC_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(BitmapComboBoxWidgetsPage, "BitmapCombobox",
|
||||
NATIVE_OR_GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
|
||||
);
|
||||
|
||||
|
||||
BitmapComboBoxWidgetsPage::BitmapComboBoxWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: ItemContainerWidgetsPage(book, imaglist, bmpcombobox_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_chkSort =
|
||||
m_chkProcessEnter =
|
||||
m_chkReadonly = nullptr;
|
||||
|
||||
m_combobox = nullptr;
|
||||
m_sizerCombo = nullptr;
|
||||
|
||||
m_textInsert =
|
||||
m_textChangeHeight =
|
||||
m_textChange =
|
||||
m_textDelete = nullptr;
|
||||
}
|
||||
|
||||
// create a sizer containing a label and a small text ctrl
|
||||
wxSizer *BitmapComboBoxWidgetsPage::CreateSizerWithSmallTextAndLabel(const wxString& label,
|
||||
wxWindowID id,
|
||||
wxTextCtrl **ppText,
|
||||
wxWindow* parent)
|
||||
{
|
||||
wxControl* control = new wxStaticText(parent ? parent : this, wxID_ANY, label);
|
||||
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxTextCtrl *text = new wxTextCtrl(parent ? parent : this, id, wxEmptyString,
|
||||
wxDefaultPosition, wxSize(50,wxDefaultCoord), wxTE_PROCESS_ENTER);
|
||||
|
||||
sizerRow->Add(control, 0, wxRIGHT | wxALIGN_CENTRE_VERTICAL, 5);
|
||||
sizerRow->Add(text, 1, wxFIXED_MINSIZE | wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
|
||||
|
||||
if ( ppText )
|
||||
*ppText = text;
|
||||
|
||||
return sizerRow;
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::CreateContent()
|
||||
{
|
||||
/*
|
||||
What we create here is a frame having 3 panes: style pane is the
|
||||
leftmost one, in the middle the pane with buttons allowing to perform
|
||||
miscellaneous combobox operations and the pane containing the combobox
|
||||
itself to the right
|
||||
*/
|
||||
wxSizer *sizerRow;
|
||||
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// left pane - style
|
||||
wxStaticBoxSizer *sizerStyle = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerStyleBox = sizerStyle->GetStaticBox();
|
||||
|
||||
|
||||
// should be in sync with ComboKind_XXX values
|
||||
static const wxString kinds[] =
|
||||
{
|
||||
"default",
|
||||
"simple",
|
||||
"drop down",
|
||||
};
|
||||
|
||||
m_radioKind = new wxRadioBox(this, wxID_ANY, "Combobox &kind:",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(kinds), kinds,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
|
||||
m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, "&Sort items", wxID_ANY, sizerStyleBox);
|
||||
m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerStyle, "Process &Enter",wxID_ANY, sizerStyleBox);
|
||||
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, "&Read only", wxID_ANY, sizerStyleBox);
|
||||
|
||||
wxButton *btn = new wxButton(sizerStyleBox, BitmapComboBoxPage_Reset, "&Reset");
|
||||
sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3);
|
||||
|
||||
sizerLeft->Add(sizerStyle, wxSizerFlags().Expand());
|
||||
sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
|
||||
|
||||
// left pane - other options
|
||||
wxStaticBoxSizer *sizerOptions = new wxStaticBoxSizer(wxVERTICAL, this, "Demo options");
|
||||
|
||||
sizerRow = CreateSizerWithSmallTextAndLabel("Control &height:",
|
||||
BitmapComboBoxPage_ChangeHeight,
|
||||
&m_textChangeHeight,
|
||||
sizerOptions->GetStaticBox());
|
||||
m_textChangeHeight->SetSize(20, wxDefaultCoord);
|
||||
sizerOptions->Add(sizerRow, 0, wxALL | wxFIXED_MINSIZE /*| wxGROW*/, 5);
|
||||
|
||||
sizerLeft->Add( sizerOptions, wxSizerFlags().Expand().Border(wxTOP, FromDIP(2)));
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change wxBitmapComboBox contents");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_ContainerTests, "Run &tests");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_AddWidgetIcons, "Add &widget icons");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_LoadFromFile, "Insert image from &file");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_SetFromFile, "&Set image from file");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
#endif
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_AddSeveralWithImages, "A&ppend a few strings with images");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_AddSeveral, "Append a &few strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_AddMany, "Append &many strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(BitmapComboBoxPage_Delete,
|
||||
"&Delete this item",
|
||||
BitmapComboBoxPage_DeleteText,
|
||||
&m_textDelete,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_DeleteSel, "Delete &selection");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, BitmapComboBoxPage_Clear, "&Clear");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
wxInitAllImageHandlers();
|
||||
#endif
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
m_combobox = new wxBitmapComboBox();
|
||||
m_combobox->Create(this, BitmapComboBoxPage_Combo, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0, nullptr,
|
||||
// Flags correspond to the checkboxes state in Reset().
|
||||
wxTE_PROCESS_ENTER);
|
||||
|
||||
#if defined(wxGENERIC_BITMAPCOMBOBOX)
|
||||
// This will sure make the list look nicer when larger images are used.
|
||||
m_combobox->SetPopupMaxHeight(600);
|
||||
#endif
|
||||
|
||||
sizerRight->Add(m_combobox, 0, wxGROW | wxALL, 5);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerCombo = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 5, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 4, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void BitmapComboBoxWidgetsPage::Reset()
|
||||
{
|
||||
m_chkSort->SetValue(false);
|
||||
m_chkProcessEnter->SetValue(true);
|
||||
m_chkReadonly->SetValue(false);
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::CreateCombo()
|
||||
{
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkSort->GetValue() )
|
||||
flags |= wxCB_SORT;
|
||||
if ( m_chkProcessEnter->GetValue() )
|
||||
flags |= wxTE_PROCESS_ENTER;
|
||||
if ( m_chkReadonly->GetValue() )
|
||||
flags |= wxCB_READONLY;
|
||||
|
||||
switch ( m_radioKind->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( "unknown combo kind" );
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case ComboKind_Default:
|
||||
break;
|
||||
|
||||
case ComboKind_Simple:
|
||||
flags |= wxCB_SIMPLE;
|
||||
break;
|
||||
|
||||
case ComboKind_DropDown:
|
||||
flags = wxCB_DROPDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
struct Item
|
||||
{
|
||||
Item(const wxString& text, const wxBitmap& bitmap)
|
||||
: text(text), bitmap(bitmap)
|
||||
{
|
||||
}
|
||||
|
||||
wxString text;
|
||||
wxBitmap bitmap;
|
||||
};
|
||||
std::vector<Item> items;
|
||||
if ( m_combobox )
|
||||
{
|
||||
unsigned int count = m_combobox->GetCount();
|
||||
items.reserve(count);
|
||||
|
||||
for ( unsigned int n = 0; n < count; n++ )
|
||||
{
|
||||
items.push_back(Item{m_combobox->GetString(n),
|
||||
m_combobox->GetItemBitmap(n)});
|
||||
}
|
||||
|
||||
m_sizerCombo->Detach( m_combobox );
|
||||
delete m_combobox;
|
||||
}
|
||||
|
||||
m_combobox = new wxBitmapComboBox();
|
||||
m_combobox->Create(this, BitmapComboBoxPage_Combo, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0, nullptr,
|
||||
flags);
|
||||
|
||||
#if defined(wxGENERIC_BITMAPCOMBOBOX)
|
||||
// This will sure make the list look nicer when larger images are used.
|
||||
m_combobox->SetPopupMaxHeight(600);
|
||||
#endif
|
||||
|
||||
NotifyWidgetRecreation(m_combobox);
|
||||
|
||||
for ( const Item& item : items )
|
||||
{
|
||||
m_combobox->Append(item.text, item.bitmap);
|
||||
}
|
||||
|
||||
m_sizerCombo->Add(m_combobox, 0, wxGROW | wxALL, 5);
|
||||
m_sizerCombo->Layout();
|
||||
|
||||
// Allow changing height in order to demonstrate flexible
|
||||
// size of image "thumbnail" painted in the control itself.
|
||||
long h = 0;
|
||||
m_textChangeHeight->GetValue().ToLong(&h);
|
||||
if ( h >= 5 )
|
||||
m_combobox->SetSize(wxDefaultCoord, h);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateCombo();
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int sel = m_combobox->GetSelection();
|
||||
if ( sel != wxNOT_FOUND )
|
||||
{
|
||||
#ifndef __WXGTK__
|
||||
m_combobox->SetString(sel, m_textChange->GetValue());
|
||||
#else
|
||||
wxLogMessage("Not implemented in wxGTK");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long n;
|
||||
if ( !m_textDelete->GetValue().ToULong(&n) ||
|
||||
(n >= m_combobox->GetCount()) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_combobox->Delete(n);
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int sel = m_combobox->GetSelection();
|
||||
if ( sel != wxNOT_FOUND )
|
||||
{
|
||||
m_combobox->Delete(sel);
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Clear();
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
wxString s = m_textInsert->GetValue();
|
||||
if ( !m_textInsert->IsModified() )
|
||||
{
|
||||
// update the default string
|
||||
m_textInsert->SetValue(wxString::Format("test item %u", ++s_item));
|
||||
}
|
||||
|
||||
m_combobox->Insert(s, wxNullBitmap, m_combobox->GetSelection());
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnTextChangeHeight(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long h = 0;
|
||||
if ( m_textChangeHeight )
|
||||
m_textChangeHeight->GetValue().ToLong(&h);
|
||||
if ( h < 5 )
|
||||
return;
|
||||
m_combobox->SetSize(wxDefaultCoord, h);
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonLoadFromFile(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString s;
|
||||
int sel = m_combobox->GetSelection();
|
||||
if ( sel == wxNOT_FOUND )
|
||||
sel = m_combobox->GetCount();
|
||||
|
||||
wxBitmap bmp = QueryBitmap(&s);
|
||||
if (bmp.IsOk())
|
||||
m_combobox->Insert(s, bmp, sel);
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonSetFromFile(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxBitmap bmp = QueryBitmap(nullptr);
|
||||
if (bmp.IsOk())
|
||||
m_combobox->SetItemBitmap(m_combobox->GetSelection(), bmp);
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// "many" means 1000 here
|
||||
for ( unsigned int n = 0; n < 1000; n++ )
|
||||
{
|
||||
m_combobox->Append(wxString::Format("item #%u", n));
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Append("First");
|
||||
m_combobox->Append("another one");
|
||||
m_combobox->Append("and the last (very very very very very very very very very very long) one");
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonAddSeveralWithImages(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static const struct TestEntry
|
||||
{
|
||||
const char *text;
|
||||
unsigned long rgb;
|
||||
} s_entries[] =
|
||||
{
|
||||
{ "Red circle", 0x0000ff },
|
||||
{ "Blue circle", 0xff0000 },
|
||||
{ "Green circle", 0x00ff00 },
|
||||
{ "Black circle", 0x000000 },
|
||||
};
|
||||
|
||||
for ( unsigned i = 0; i < WXSIZEOF(s_entries); i++ )
|
||||
{
|
||||
const TestEntry& e = s_entries[i];
|
||||
m_combobox->Append(e.text, CreateBitmap(wxColour(e.rgb)));
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
void BitmapComboBoxWidgetsPage::RescaleImage(wxImage& image, int w, int h)
|
||||
{
|
||||
if ( image.GetWidth() == w && image.GetHeight() == h )
|
||||
return;
|
||||
|
||||
if ( w <= 0 || h <= 0 )
|
||||
return;
|
||||
|
||||
static bool isFirstScale = true;
|
||||
|
||||
if ( isFirstScale && m_combobox->GetCount() > 0 )
|
||||
{
|
||||
wxMessageBox( "wxBitmapComboBox normally only supports images of one size. "
|
||||
"However, for demonstration purposes, loaded bitmaps are scaled to fit "
|
||||
"using wxImage::Rescale.",
|
||||
"Notice",
|
||||
wxOK,
|
||||
this );
|
||||
|
||||
isFirstScale = false;
|
||||
}
|
||||
|
||||
image.Rescale(w, h);
|
||||
}
|
||||
#endif
|
||||
|
||||
void BitmapComboBoxWidgetsPage::LoadWidgetImages( wxArrayString* strings, wxImageList* images )
|
||||
{
|
||||
wxFileName fn;
|
||||
fn.AssignCwd();
|
||||
fn.AppendDir("icons");
|
||||
|
||||
if ( !wxDir::Exists(fn.GetFullPath()) ||
|
||||
!wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") )
|
||||
{
|
||||
// Try ../../samples/widgets/icons
|
||||
fn.RemoveLastDir();
|
||||
fn.RemoveLastDir();
|
||||
fn.AppendDir("icons");
|
||||
if ( !wxDir::Exists(fn.GetFullPath()) ||
|
||||
!wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") )
|
||||
{
|
||||
// Try ../../../samples/widgets/icons
|
||||
fn.AssignCwd();
|
||||
fn.RemoveLastDir();
|
||||
fn.RemoveLastDir();
|
||||
fn.RemoveLastDir();
|
||||
fn.AppendDir("samples");
|
||||
fn.AppendDir("widgets");
|
||||
fn.AppendDir("icons");
|
||||
if ( !wxDir::Exists(fn.GetFullPath()) ||
|
||||
!wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") )
|
||||
{
|
||||
wxLogWarning("Could not load widget icons.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int i;
|
||||
|
||||
// Get size of existing images in list
|
||||
wxSize foundSize = m_combobox->GetBitmapSize();
|
||||
if ( !foundSize.IsFullySpecified() )
|
||||
foundSize = images->GetSize();
|
||||
|
||||
for ( i=0; i<strings->size(); i++ )
|
||||
{
|
||||
fn.SetFullName((*strings)[i]);
|
||||
wxString name = fn.GetName();
|
||||
|
||||
// Handle few exceptions
|
||||
if ( name == "bmpbtn" )
|
||||
{
|
||||
strings->RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
wxASSERT(fn.FileExists());
|
||||
wxImage image(fn.GetFullPath());
|
||||
wxASSERT(image.IsOk());
|
||||
RescaleImage(image, foundSize.x, foundSize.y);
|
||||
wxBitmap bmp(image);
|
||||
wxASSERT( bmp.IsOk() );
|
||||
#else
|
||||
wxBitmap bmp;
|
||||
#endif
|
||||
images->Add(bmp);
|
||||
(*strings)[i] = name;
|
||||
|
||||
// if the combobox is empty, use as bitmap size of the image list
|
||||
// the size of the first valid image loaded
|
||||
if (foundSize == wxDefaultSize)
|
||||
foundSize = bmp.GetSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnButtonAddWidgetIcons(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxArrayString strings;
|
||||
|
||||
wxSize sz = m_combobox->GetBitmapSize();
|
||||
if ( sz.x <= 0 )
|
||||
{
|
||||
sz.x = 32;
|
||||
sz.y = 32;
|
||||
}
|
||||
|
||||
wxImageList images(sz.x, sz.y);
|
||||
|
||||
LoadWidgetImages(&strings, &images);
|
||||
|
||||
unsigned int i;
|
||||
|
||||
for ( i=0; i<strings.size(); i++ )
|
||||
{
|
||||
m_combobox->Append(strings[i], images.GetBitmap(i));
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable( m_chkSort->GetValue()
|
||||
|| !m_chkProcessEnter->GetValue()
|
||||
|| m_chkReadonly->GetValue() );
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnUpdateUIInsert(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
{
|
||||
bool enable = !(m_combobox->GetWindowStyle() & wxCB_SORT);
|
||||
|
||||
event.Enable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
{
|
||||
unsigned long n;
|
||||
event.Enable(m_textDelete->GetValue().ToULong(&n) &&
|
||||
(n < (unsigned)m_combobox->GetCount()));
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnUpdateUIItemManipulator(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(m_combobox->GetSelection() != wxNOT_FOUND);
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(m_combobox->GetCount() != 0);
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnComboText(wxCommandEvent& event)
|
||||
{
|
||||
if (!m_combobox)
|
||||
return;
|
||||
|
||||
wxString s = event.GetString();
|
||||
|
||||
wxASSERT_MSG( s == m_combobox->GetValue(),
|
||||
"event and combobox values should be the same" );
|
||||
|
||||
if (event.GetEventType() == wxEVT_TEXT_ENTER)
|
||||
{
|
||||
wxLogMessage("BitmapCombobox enter pressed (now '%s')", s);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage("BitmapCombobox text changed (now '%s')", s);
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnComboBox(wxCommandEvent& event)
|
||||
{
|
||||
long sel = event.GetInt();
|
||||
m_textDelete->SetValue(wxString::Format("%ld", sel));
|
||||
|
||||
wxLogMessage("BitmapCombobox item %ld selected", sel);
|
||||
|
||||
wxLogMessage("BitmapCombobox GetValue(): %s", m_combobox->GetValue() );
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateCombo();
|
||||
}
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
wxBitmap BitmapComboBoxWidgetsPage::LoadBitmap(const wxString& filepath)
|
||||
{
|
||||
// Get size of existing images in list
|
||||
wxSize foundSize = m_combobox->GetBitmapSize();
|
||||
|
||||
// Have some reasonable maximum size
|
||||
if ( foundSize.x <= 0 )
|
||||
{
|
||||
foundSize.x = IMG_SIZE_TRUNC;
|
||||
foundSize.y = IMG_SIZE_TRUNC;
|
||||
}
|
||||
|
||||
wxImage image(filepath);
|
||||
if ( image.IsOk() )
|
||||
{
|
||||
// Rescale very large images
|
||||
int ow = image.GetWidth();
|
||||
int oh = image.GetHeight();
|
||||
|
||||
if ( foundSize.x > 0 &&
|
||||
(ow != foundSize.x || oh != foundSize.y) )
|
||||
{
|
||||
int w = ow;
|
||||
if ( w > foundSize.x )
|
||||
w = foundSize.x;
|
||||
int h = oh;
|
||||
if ( h > foundSize.y )
|
||||
h = foundSize.y;
|
||||
|
||||
RescaleImage(image, w, h);
|
||||
}
|
||||
|
||||
return wxBitmap(image);
|
||||
}
|
||||
|
||||
return wxNullBitmap;
|
||||
}
|
||||
#else
|
||||
wxBitmap BitmapComboBoxWidgetsPage::LoadBitmap(const wxString& WXUNUSED(filepath))
|
||||
{
|
||||
return wxNullBitmap;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr)
|
||||
{
|
||||
wxString filepath = wxLoadFileSelector("image",
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
this);
|
||||
|
||||
wxBitmap bitmap;
|
||||
|
||||
if ( !filepath.empty() )
|
||||
{
|
||||
if ( pStr )
|
||||
{
|
||||
*pStr = wxFileName(filepath).GetName();
|
||||
}
|
||||
|
||||
bitmap = LoadBitmap(filepath);
|
||||
}
|
||||
|
||||
if (bitmap.IsOk())
|
||||
{
|
||||
wxLogDebug("%i, %i",bitmap.GetWidth(), bitmap.GetHeight());
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
wxBitmap BitmapComboBoxWidgetsPage::CreateBitmap(const wxColour& colour)
|
||||
{
|
||||
const int w = 10,
|
||||
h = 10;
|
||||
|
||||
wxMemoryDC dc;
|
||||
wxBitmap bmp(w, h);
|
||||
dc.SelectObject(bmp);
|
||||
|
||||
// Draw transparent background
|
||||
wxColour magic(255, 0, 255);
|
||||
wxBrush magicBrush(magic);
|
||||
dc.SetBrush(magicBrush);
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.DrawRectangle(0, 0, w, h);
|
||||
|
||||
// Draw image content
|
||||
dc.SetBrush(wxBrush(colour));
|
||||
dc.DrawCircle(h/2, h/2+1, h/2);
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
|
||||
// Finalize transparency with a mask
|
||||
wxMask *mask = new wxMask(bmp, magic);
|
||||
bmp.SetMask(mask);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Combobox dropped down");
|
||||
}
|
||||
|
||||
void BitmapComboBoxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Combobox closed up");
|
||||
}
|
||||
|
||||
#endif // wxUSE_BITMAPCOMBOBOX
|
||||
718
libs/wxWidgets-3.3.1/samples/widgets/button.cpp
Normal file
718
libs/wxWidgets-3.3.1/samples/widgets/button.cpp
Normal file
@@ -0,0 +1,718 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: button.cpp
|
||||
// Purpose: Part of the widgets sample showing wxButton
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 10.04.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bmpbuttn.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/commandlinkbutton.h"
|
||||
#include "wx/valnum.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/button.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
ButtonPage_Reset = wxID_HIGHEST,
|
||||
ButtonPage_ChangeLabel,
|
||||
ButtonPage_ChangeNote,
|
||||
ButtonPage_ChangeImageMargins,
|
||||
ButtonPage_Button
|
||||
};
|
||||
|
||||
// radio boxes
|
||||
enum
|
||||
{
|
||||
ButtonImagePos_Left,
|
||||
ButtonImagePos_Right,
|
||||
ButtonImagePos_Top,
|
||||
ButtonImagePos_Bottom
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ButtonHAlign_Left,
|
||||
ButtonHAlign_Centre,
|
||||
ButtonHAlign_Right
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ButtonVAlign_Top,
|
||||
ButtonVAlign_Centre,
|
||||
ButtonVAlign_Bottom
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ButtonWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ButtonWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
ButtonWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_button; }
|
||||
virtual void RecreateWidget() override { CreateButton(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnButton(wxCommandEvent& event);
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonChangeLabel(wxCommandEvent& event);
|
||||
void OnButtonChangeNote(wxCommandEvent& event);
|
||||
void OnButtonChangeImageMargins(wxCommandEvent& event);
|
||||
|
||||
// reset the wxButton parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the wxButton
|
||||
void CreateButton();
|
||||
|
||||
// helper function: create a bitmap bundle for wxBitmapButton
|
||||
wxBitmapBundle CreateBitmap(const wxString& label, const wxArtID& type);
|
||||
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the check/radio boxes for styles
|
||||
wxCheckBox *m_chkBitmapOnly,
|
||||
*m_chkTextAndBitmap,
|
||||
*m_chkFit,
|
||||
*m_chkAuthNeeded,
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
*m_chkCommandLink,
|
||||
#endif // wxUSE_COMMANDLINKBUTTON
|
||||
#if wxUSE_MARKUP
|
||||
*m_chkUseMarkup,
|
||||
#endif // wxUSE_MARKUP
|
||||
*m_chkDefault,
|
||||
*m_chkUseBitmapClass,
|
||||
*m_chkDisable;
|
||||
|
||||
// more checkboxes for wxBitmapButton only
|
||||
wxCheckBox *m_chkUsePressed,
|
||||
*m_chkUseFocused,
|
||||
*m_chkUseCurrent,
|
||||
*m_chkUseDisabled;
|
||||
|
||||
// and an image position choice used if m_chkTextAndBitmap is on
|
||||
wxRadioBox *m_radioImagePos;
|
||||
|
||||
wxRadioBox *m_radioHAlign,
|
||||
*m_radioVAlign;
|
||||
|
||||
// the button itself and the sizer it is in
|
||||
wxButton *m_button;
|
||||
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
// same as m_button or nullptr if not showing a command link button currently
|
||||
wxCommandLinkButton *m_cmdLnkButton;
|
||||
#endif // wxUSE_COMMANDLINKBUTTON
|
||||
|
||||
wxSizer *m_sizerButton;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_textLabel;
|
||||
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
wxTextCtrl *m_textNote;
|
||||
|
||||
// used to hide or show button for changing note
|
||||
wxSizer *m_sizerNote;
|
||||
#endif // wxUSE_COMMANDLINKBUTTON
|
||||
|
||||
// the text entries for image margins
|
||||
wxTextCtrl* m_textImageMarginH;
|
||||
wxTextCtrl* m_textImageMarginV;
|
||||
|
||||
int m_imageMarginH;
|
||||
int m_imageMarginV;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ButtonWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ButtonWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(ButtonPage_Button, ButtonWidgetsPage::OnButton)
|
||||
|
||||
EVT_BUTTON(ButtonPage_Reset, ButtonWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(ButtonPage_ChangeLabel, ButtonWidgetsPage::OnButtonChangeLabel)
|
||||
EVT_BUTTON(ButtonPage_ChangeNote, ButtonWidgetsPage::OnButtonChangeNote)
|
||||
EVT_BUTTON(ButtonPage_ChangeImageMargins, ButtonWidgetsPage::OnButtonChangeImageMargins)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ButtonWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, ButtonWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, "Button", FAMILY_CTRLS );
|
||||
|
||||
ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, button_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_chkBitmapOnly =
|
||||
m_chkTextAndBitmap =
|
||||
m_chkFit =
|
||||
m_chkAuthNeeded =
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_chkCommandLink =
|
||||
#endif // wxUSE_COMMANDLINKBUTTON
|
||||
#if wxUSE_MARKUP
|
||||
m_chkUseMarkup =
|
||||
#endif // wxUSE_MARKUP
|
||||
m_chkDefault =
|
||||
m_chkUseBitmapClass =
|
||||
m_chkDisable =
|
||||
m_chkUsePressed =
|
||||
m_chkUseFocused =
|
||||
m_chkUseCurrent =
|
||||
m_chkUseDisabled = nullptr;
|
||||
|
||||
m_radioImagePos =
|
||||
m_radioHAlign =
|
||||
m_radioVAlign = nullptr;
|
||||
|
||||
m_textLabel = nullptr;
|
||||
|
||||
m_textImageMarginH = nullptr;
|
||||
m_textImageMarginV = nullptr;
|
||||
|
||||
m_button = nullptr;
|
||||
m_sizerButton = nullptr;
|
||||
|
||||
m_imageMarginH = 0;
|
||||
m_imageMarginV = 0;
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only", wxID_ANY, sizerLeftBox);
|
||||
m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap", wxID_ANY, sizerLeftBox);
|
||||
m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit exactly", wxID_ANY, sizerLeftBox);
|
||||
m_chkAuthNeeded = CreateCheckBoxAndAddToSizer(sizerLeft, "Require a&uth", wxID_ANY, sizerLeftBox);
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_chkCommandLink = CreateCheckBoxAndAddToSizer(sizerLeft, "Use command &link button", wxID_ANY, sizerLeftBox);
|
||||
#endif
|
||||
#if wxUSE_MARKUP
|
||||
m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup", wxID_ANY, sizerLeftBox);
|
||||
#endif // wxUSE_MARKUP
|
||||
m_chkDefault = CreateCheckBoxAndAddToSizer(sizerLeft, "&Default", wxID_ANY, sizerLeftBox);
|
||||
|
||||
m_chkUseBitmapClass = CreateCheckBoxAndAddToSizer(sizerLeft,
|
||||
"Use wxBitmapButton", wxID_ANY, sizerLeftBox);
|
||||
m_chkUseBitmapClass->SetValue(true);
|
||||
|
||||
m_chkDisable = CreateCheckBoxAndAddToSizer(sizerLeft, "Disable", wxID_ANY, sizerLeftBox);
|
||||
|
||||
sizerLeft->AddSpacer(5);
|
||||
|
||||
wxStaticBoxSizer *sizerUseLabels =
|
||||
new wxStaticBoxSizer(wxVERTICAL, sizerLeftBox,
|
||||
"&Use the following bitmaps in addition to the normal one?");
|
||||
wxStaticBox* const sizerUseLabelsBox = sizerUseLabels->GetStaticBox();
|
||||
|
||||
m_chkUsePressed = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Pressed (small help icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
m_chkUseFocused = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Focused (small error icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
m_chkUseCurrent = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Current (small warning icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
m_chkUseDisabled = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Disabled (broken image icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
sizerLeft->Add(sizerUseLabels, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerLeft->AddSpacer(10);
|
||||
|
||||
static const wxString dirs[] =
|
||||
{
|
||||
"left", "right", "top", "bottom",
|
||||
};
|
||||
m_radioImagePos = new wxRadioBox(sizerLeftBox, wxID_ANY, "Image &position",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(dirs), dirs);
|
||||
sizerLeft->Add(m_radioImagePos, wxSizerFlags().Expand().Border());
|
||||
|
||||
wxStaticBoxSizer* sizerImageMargins = new wxStaticBoxSizer(wxVERTICAL, sizerLeftBox, "Image margins");
|
||||
wxStaticBox* const sizerImageMarginsBox = sizerImageMargins->GetStaticBox();
|
||||
wxSizer* sizerImageMarginsRow = CreateSizerWithTextAndButton(ButtonPage_ChangeImageMargins,
|
||||
"Horizontal and vertical", wxID_ANY, &m_textImageMarginH,
|
||||
sizerImageMarginsBox);
|
||||
wxIntegerValidator<int> validatorMargH;
|
||||
validatorMargH.SetRange(0, 100);
|
||||
m_textImageMarginH->SetValidator(validatorMargH);
|
||||
|
||||
wxIntegerValidator<int> validatorMargV;
|
||||
validatorMargV.SetRange(0, 100);
|
||||
m_textImageMarginV = new wxTextCtrl(sizerImageMarginsBox, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, validatorMargV);
|
||||
sizerImageMarginsRow->Add(m_textImageMarginV, wxSizerFlags(1).CentreVertical().Border(wxLEFT));
|
||||
|
||||
m_textImageMarginH->SetValue(wxString::Format("%d", m_imageMarginH));
|
||||
m_textImageMarginV->SetValue(wxString::Format("%d", m_imageMarginV));
|
||||
|
||||
sizerImageMargins->Add(sizerImageMarginsRow, wxSizerFlags().Border().Centre());
|
||||
sizerLeft->Add(sizerImageMargins, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerLeft->AddSpacer(15);
|
||||
|
||||
// should be in sync with enums Button[HV]Align!
|
||||
static const wxString halign[] =
|
||||
{
|
||||
"left",
|
||||
"centre",
|
||||
"right",
|
||||
};
|
||||
|
||||
static const wxString valign[] =
|
||||
{
|
||||
"top",
|
||||
"centre",
|
||||
"bottom",
|
||||
};
|
||||
|
||||
m_radioHAlign = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Horz alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(halign), halign);
|
||||
m_radioVAlign = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Vert alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(valign), valign);
|
||||
|
||||
sizerLeft->Add(m_radioHAlign, wxSizerFlags().Expand().Border());
|
||||
sizerLeft->Add(m_radioVAlign, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerLeft->AddSpacer(5);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, ButtonPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, wxSizerFlags().CentreHorizontal().TripleBorder(wxALL));
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Operations");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxSizer *sizerRow = CreateSizerWithTextAndButton(ButtonPage_ChangeLabel,
|
||||
"Change label",
|
||||
wxID_ANY,
|
||||
&m_textLabel,
|
||||
sizerMiddleBox);
|
||||
m_textLabel->SetValue("&Press me!");
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_sizerNote = CreateSizerWithTextAndButton(ButtonPage_ChangeNote,
|
||||
"Change note",
|
||||
wxID_ANY,
|
||||
&m_textNote,
|
||||
sizerMiddleBox);
|
||||
m_textNote->SetValue("Writes down button clicks in the log.");
|
||||
|
||||
sizerMiddle->Add(m_sizerNote, wxSizerFlags().Expand().Border());
|
||||
#endif
|
||||
|
||||
// right pane
|
||||
m_sizerButton = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizerButton->SetMinSize(FromDIP(150), 0);
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft,
|
||||
wxSizerFlags(0).Expand().DoubleBorder(wxALL & ~wxLEFT));
|
||||
sizerTop->Add(sizerMiddle,
|
||||
wxSizerFlags(1).Expand().DoubleBorder(wxALL));
|
||||
sizerTop->Add(m_sizerButton,
|
||||
wxSizerFlags(1).Expand().DoubleBorder((wxALL & ~wxRIGHT)));
|
||||
|
||||
// do create the main control
|
||||
Reset();
|
||||
CreateButton();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ButtonWidgetsPage::Reset()
|
||||
{
|
||||
m_chkBitmapOnly->SetValue(false);
|
||||
m_chkFit->SetValue(false);
|
||||
m_chkAuthNeeded->SetValue(false);
|
||||
m_chkTextAndBitmap->SetValue(false);
|
||||
m_chkDefault->SetValue(false);
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_chkCommandLink->SetValue(false);
|
||||
#endif
|
||||
#if wxUSE_MARKUP
|
||||
m_chkUseMarkup->SetValue(false);
|
||||
#endif // wxUSE_MARKUP
|
||||
m_chkUseBitmapClass->SetValue(true);
|
||||
m_chkDisable->SetValue(false);
|
||||
|
||||
m_chkUsePressed->SetValue(true);
|
||||
m_chkUseFocused->SetValue(true);
|
||||
m_chkUseCurrent->SetValue(true);
|
||||
m_chkUseDisabled->SetValue(true);
|
||||
|
||||
m_radioImagePos->SetSelection(ButtonImagePos_Left);
|
||||
m_radioHAlign->SetSelection(ButtonHAlign_Centre);
|
||||
m_radioVAlign->SetSelection(ButtonVAlign_Centre);
|
||||
|
||||
m_imageMarginH = 0;
|
||||
m_imageMarginV = 0;
|
||||
m_textImageMarginH->SetValue(wxString::Format("%d", m_imageMarginH));
|
||||
m_textImageMarginV->SetValue(wxString::Format("%d", m_imageMarginV));
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::CreateButton()
|
||||
{
|
||||
wxString label;
|
||||
if ( m_button )
|
||||
{
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
if ( m_cmdLnkButton )
|
||||
label = m_cmdLnkButton->GetMainLabel();
|
||||
else
|
||||
#endif
|
||||
label = m_button->GetLabel();
|
||||
|
||||
size_t count = m_sizerButton->GetChildren().GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
m_sizerButton->Remove( 0 );
|
||||
}
|
||||
|
||||
delete m_button;
|
||||
}
|
||||
|
||||
if ( label.empty() )
|
||||
{
|
||||
// creating for the first time or recreating a button after bitmap
|
||||
// button
|
||||
label = m_textLabel->GetValue();
|
||||
}
|
||||
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
switch ( m_radioHAlign->GetSelection() )
|
||||
{
|
||||
case ButtonHAlign_Left:
|
||||
flags |= wxBU_LEFT;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case ButtonHAlign_Centre:
|
||||
break;
|
||||
|
||||
case ButtonHAlign_Right:
|
||||
flags |= wxBU_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( m_radioVAlign->GetSelection() )
|
||||
{
|
||||
case ButtonVAlign_Top:
|
||||
flags |= wxBU_TOP;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case ButtonVAlign_Centre:
|
||||
// centre vertical alignment is the default (no style)
|
||||
break;
|
||||
|
||||
case ButtonVAlign_Bottom:
|
||||
flags |= wxBU_BOTTOM;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( m_chkFit->GetValue() )
|
||||
{
|
||||
flags |= wxBU_EXACTFIT;
|
||||
}
|
||||
|
||||
bool showsBitmap = false;
|
||||
if ( m_chkBitmapOnly->GetValue() )
|
||||
{
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_chkCommandLink->SetValue(false); // wxCommandLinkButton cannot be "Bitmap only"
|
||||
#endif
|
||||
|
||||
showsBitmap = true;
|
||||
|
||||
wxButton *bbtn;
|
||||
if ( m_chkUseBitmapClass->GetValue() )
|
||||
{
|
||||
bbtn = new wxBitmapButton(this, ButtonPage_Button,
|
||||
CreateBitmap("normal", wxART_INFORMATION),
|
||||
wxDefaultPosition, wxDefaultSize, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
bbtn = new wxButton(this, ButtonPage_Button);
|
||||
bbtn->SetBitmapLabel(CreateBitmap("normal", wxART_INFORMATION));
|
||||
}
|
||||
bbtn->SetBitmapMargins((wxCoord)m_imageMarginH, (wxCoord)m_imageMarginV);
|
||||
|
||||
if ( m_chkUsePressed->GetValue() )
|
||||
bbtn->SetBitmapPressed(CreateBitmap("pushed", wxART_HELP));
|
||||
if ( m_chkUseFocused->GetValue() )
|
||||
bbtn->SetBitmapFocus(CreateBitmap("focused", wxART_ERROR));
|
||||
if ( m_chkUseCurrent->GetValue() )
|
||||
bbtn->SetBitmapCurrent(CreateBitmap("hover", wxART_WARNING));
|
||||
if ( m_chkUseDisabled->GetValue() )
|
||||
bbtn->SetBitmapDisabled(CreateBitmap("disabled", wxART_MISSING_IMAGE));
|
||||
m_button = bbtn;
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_cmdLnkButton = nullptr;
|
||||
#endif
|
||||
}
|
||||
else // normal button
|
||||
{
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_cmdLnkButton = nullptr;
|
||||
|
||||
if ( m_chkCommandLink->GetValue() )
|
||||
{
|
||||
m_cmdLnkButton = new wxCommandLinkButton(this, ButtonPage_Button,
|
||||
label,
|
||||
m_textNote->GetValue(),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
flags);
|
||||
m_button = m_cmdLnkButton;
|
||||
}
|
||||
else
|
||||
#endif // wxUSE_COMMANDLINKBUTTON
|
||||
{
|
||||
m_button = new wxButton(this, ButtonPage_Button, label,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_sizerNote->Show(m_chkCommandLink->GetValue());
|
||||
#endif
|
||||
|
||||
NotifyWidgetRecreation(m_button);
|
||||
|
||||
if ( !showsBitmap && m_chkTextAndBitmap->GetValue() )
|
||||
{
|
||||
showsBitmap = true;
|
||||
|
||||
static const wxDirection positions[] =
|
||||
{
|
||||
wxLEFT, wxRIGHT, wxTOP, wxBOTTOM
|
||||
};
|
||||
|
||||
m_button->SetBitmap(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_BUTTON),
|
||||
positions[m_radioImagePos->GetSelection()]);
|
||||
|
||||
m_button->SetBitmapMargins((wxCoord)m_imageMarginH, (wxCoord)m_imageMarginV);
|
||||
|
||||
if ( m_chkUsePressed->GetValue() )
|
||||
m_button->SetBitmapPressed(wxArtProvider::GetIcon(wxART_HELP, wxART_BUTTON));
|
||||
if ( m_chkUseFocused->GetValue() )
|
||||
m_button->SetBitmapFocus(wxArtProvider::GetIcon(wxART_ERROR, wxART_BUTTON));
|
||||
if ( m_chkUseCurrent->GetValue() )
|
||||
m_button->SetBitmapCurrent(wxArtProvider::GetIcon(wxART_WARNING, wxART_BUTTON));
|
||||
if ( m_chkUseDisabled->GetValue() )
|
||||
m_button->SetBitmapDisabled(wxArtProvider::GetIcon(wxART_MISSING_IMAGE, wxART_BUTTON));
|
||||
}
|
||||
|
||||
m_chkTextAndBitmap->Enable(!m_chkBitmapOnly->IsChecked());
|
||||
m_chkBitmapOnly->Enable(!m_chkTextAndBitmap->IsChecked());
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_chkCommandLink->Enable(!m_chkBitmapOnly->IsChecked());
|
||||
#endif
|
||||
m_chkUseBitmapClass->Enable(showsBitmap);
|
||||
|
||||
m_chkUsePressed->Enable(showsBitmap);
|
||||
m_chkUseFocused->Enable(showsBitmap);
|
||||
m_chkUseCurrent->Enable(showsBitmap);
|
||||
m_chkUseDisabled->Enable(showsBitmap);
|
||||
m_radioImagePos->Enable(m_chkTextAndBitmap->IsChecked());
|
||||
m_textImageMarginH->Enable(showsBitmap);
|
||||
m_textImageMarginV->Enable(showsBitmap);
|
||||
wxWindow::FindWindowById(ButtonPage_ChangeImageMargins)->Enable(showsBitmap);
|
||||
|
||||
if ( m_chkAuthNeeded->GetValue() )
|
||||
m_button->SetAuthNeeded();
|
||||
|
||||
if ( m_chkDefault->GetValue() )
|
||||
m_button->SetDefault();
|
||||
|
||||
m_button->Enable(!m_chkDisable->IsChecked());
|
||||
|
||||
m_sizerButton->AddStretchSpacer();
|
||||
m_sizerButton->Add(m_button, wxSizerFlags().Centre().Border());
|
||||
m_sizerButton->AddStretchSpacer(2);
|
||||
|
||||
m_sizerButton->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ButtonWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateButton();
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateButton();
|
||||
Layout(); // make sure the text field for changing note displays correctly.
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::OnButtonChangeLabel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
const wxString labelText = m_textLabel->GetValue();
|
||||
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
if ( m_cmdLnkButton )
|
||||
m_cmdLnkButton->SetMainLabel(labelText);
|
||||
else
|
||||
#endif // wxUSE_COMMANDLINKBUTTON
|
||||
{
|
||||
#if wxUSE_MARKUP
|
||||
if ( m_chkUseMarkup->GetValue() )
|
||||
m_button->SetLabelMarkup(labelText);
|
||||
else
|
||||
#endif // wxUSE_MARKUP
|
||||
m_button->SetLabel(labelText);
|
||||
}
|
||||
|
||||
if ( m_chkBitmapOnly->IsChecked() )
|
||||
CreateButton();
|
||||
|
||||
m_sizerButton->Layout();
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::OnButtonChangeNote(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if wxUSE_COMMANDLINKBUTTON
|
||||
m_cmdLnkButton->SetNote(m_textNote->GetValue());
|
||||
|
||||
m_sizerButton->Layout();
|
||||
#endif // wxUSE_COMMANDLINKBUTTON
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::OnButtonChangeImageMargins(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long margH = 0;
|
||||
long margV = 0;
|
||||
if ( !m_textImageMarginH->GetValue().ToLong(&margH) ||
|
||||
!m_textImageMarginV->GetValue().ToLong(&margV) ||
|
||||
margH < 0 || margV < 0 )
|
||||
{
|
||||
wxLogWarning("Invalid margin values for bitmap.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_imageMarginH = (int)margH;
|
||||
m_imageMarginV = (int)margV;
|
||||
|
||||
m_button->SetBitmapMargins((wxCoord)m_imageMarginH, (wxCoord)m_imageMarginV);
|
||||
m_button->Refresh();
|
||||
m_sizerButton->Layout();
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::OnButton(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Test button clicked.");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// bitmap button stuff
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBitmapBundle
|
||||
ButtonWidgetsPage::CreateBitmap(const wxString& label, const wxArtID& type)
|
||||
{
|
||||
wxBitmap bmp(FromDIP(wxSize(180, 70))); // shouldn't hardcode but it's simpler like this
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(bmp);
|
||||
dc.SetFont(GetFont());
|
||||
dc.SetBackground(*wxCYAN_BRUSH);
|
||||
dc.Clear();
|
||||
dc.SetTextForeground(*wxBLACK);
|
||||
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + "\n"
|
||||
"(" + label + " state)",
|
||||
wxArtProvider::GetBitmap(type),
|
||||
wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20),
|
||||
wxALIGN_CENTRE);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
314
libs/wxWidgets-3.3.1/samples/widgets/checkbox.cpp
Normal file
314
libs/wxWidgets-3.3.1/samples/widgets/checkbox.cpp
Normal file
@@ -0,0 +1,314 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: checkbox.cpp
|
||||
// Purpose: Part of the widgets sample showing wxCheckBox
|
||||
// Author: Dimitri Schoolwerth, Vadim Zeitlin
|
||||
// Created: 27 Sep 2003
|
||||
// Copyright: (c) 2003 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
|
||||
#include "wx/sizer.h"
|
||||
#endif
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/checkbox.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
CheckboxPage_Reset = wxID_HIGHEST,
|
||||
CheckboxPage_ChangeLabel,
|
||||
CheckboxPage_Check,
|
||||
CheckboxPage_Uncheck,
|
||||
CheckboxPage_PartCheck,
|
||||
CheckboxPage_ChkRight,
|
||||
CheckboxPage_Checkbox
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CheckboxKind_2State,
|
||||
CheckboxKind_3State,
|
||||
CheckboxKind_3StateUser
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CheckBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class CheckBoxWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_checkbox; }
|
||||
virtual void RecreateWidget() override { CreateCheckbox(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnCheckBox(wxCommandEvent& event);
|
||||
|
||||
void OnStyleChange(wxCommandEvent& event);
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonChangeLabel(wxCommandEvent& event);
|
||||
|
||||
void OnButtonCheck(wxCommandEvent&) { m_checkbox->SetValue(true); }
|
||||
void OnButtonUncheck(wxCommandEvent&) { m_checkbox->SetValue(false); }
|
||||
void OnButtonPartCheck(wxCommandEvent&)
|
||||
{
|
||||
m_checkbox->Set3StateValue(wxCHK_UNDETERMINED);
|
||||
}
|
||||
|
||||
void Is3State(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( m_checkbox->Is3State() );
|
||||
}
|
||||
|
||||
|
||||
// reset the wxCheckBox parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the wxCheckBox
|
||||
void CreateCheckbox();
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the controls to choose the checkbox style
|
||||
wxCheckBox *m_chkRight;
|
||||
wxRadioBox *m_radioKind;
|
||||
|
||||
// the checkbox itself and the sizer it is in
|
||||
wxCheckBox *m_checkbox;
|
||||
wxSizer *m_sizerCheckbox;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_textLabel;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(CheckBoxWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(CheckBoxWidgetsPage, WidgetsPage)
|
||||
EVT_CHECKBOX(CheckboxPage_Checkbox, CheckBoxWidgetsPage::OnCheckBox)
|
||||
|
||||
EVT_BUTTON(CheckboxPage_Reset, CheckBoxWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(CheckboxPage_ChangeLabel, CheckBoxWidgetsPage::OnButtonChangeLabel)
|
||||
EVT_BUTTON(CheckboxPage_Check, CheckBoxWidgetsPage::OnButtonCheck)
|
||||
EVT_BUTTON(CheckboxPage_Uncheck, CheckBoxWidgetsPage::OnButtonUncheck)
|
||||
EVT_BUTTON(CheckboxPage_PartCheck, CheckBoxWidgetsPage::OnButtonPartCheck)
|
||||
|
||||
EVT_UPDATE_UI(CheckboxPage_PartCheck, CheckBoxWidgetsPage::Is3State)
|
||||
|
||||
EVT_RADIOBOX(wxID_ANY, CheckBoxWidgetsPage::OnStyleChange)
|
||||
EVT_CHECKBOX(CheckboxPage_ChkRight, CheckBoxWidgetsPage::OnStyleChange)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, "CheckBox", FAMILY_CTRLS );
|
||||
|
||||
CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, checkbox_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void CheckBoxWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkRight = CreateCheckBoxAndAddToSizer
|
||||
(
|
||||
sizerLeft,
|
||||
"&Right aligned",
|
||||
CheckboxPage_ChkRight,
|
||||
sizerLeftBox
|
||||
);
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
static const wxString kinds[] =
|
||||
{
|
||||
"usual &2-state checkbox",
|
||||
"&3rd state settable by program",
|
||||
"&user-settable 3rd state",
|
||||
};
|
||||
|
||||
m_radioKind = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Kind",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(kinds), kinds,
|
||||
1);
|
||||
sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
|
||||
wxButton *btn = new wxButton(sizerLeftBox, CheckboxPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Operations");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
sizerMiddle->Add(CreateSizerWithTextAndButton(CheckboxPage_ChangeLabel,
|
||||
"Change label",
|
||||
wxID_ANY,
|
||||
&m_textLabel,
|
||||
sizerMiddleBox),
|
||||
0, wxALL | wxGROW, 5);
|
||||
sizerMiddle->Add(new wxButton(sizerMiddleBox, CheckboxPage_Check, "&Check it"),
|
||||
0, wxALL | wxGROW, 5);
|
||||
sizerMiddle->Add(new wxButton(sizerMiddleBox, CheckboxPage_Uncheck, "&Uncheck it"),
|
||||
0, wxALL | wxGROW, 5);
|
||||
sizerMiddle->Add(new wxButton(sizerMiddleBox, CheckboxPage_PartCheck,
|
||||
"Put in &3rd state"),
|
||||
0, wxALL | wxGROW, 5);
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_checkbox = new wxCheckBox(this, CheckboxPage_Checkbox, "&Check me!");
|
||||
sizerRight->Add(0, 0, 1, wxCENTRE);
|
||||
sizerRight->Add(m_checkbox, 1, wxCENTRE);
|
||||
sizerRight->Add(0, 0, 1, wxCENTRE);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerCheckbox = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
void CheckBoxWidgetsPage::Reset()
|
||||
{
|
||||
m_chkRight->SetValue(false);
|
||||
m_radioKind->SetSelection(CheckboxKind_2State);
|
||||
}
|
||||
|
||||
void CheckBoxWidgetsPage::CreateCheckbox()
|
||||
{
|
||||
wxString label = m_checkbox->GetLabel();
|
||||
|
||||
size_t count = m_sizerCheckbox->GetChildren().GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
m_sizerCheckbox->Remove(0);
|
||||
}
|
||||
|
||||
delete m_checkbox;
|
||||
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
if ( m_chkRight->IsChecked() )
|
||||
flags |= wxALIGN_RIGHT;
|
||||
|
||||
switch ( m_radioKind->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case CheckboxKind_2State:
|
||||
flags |= wxCHK_2STATE;
|
||||
break;
|
||||
|
||||
case CheckboxKind_3StateUser:
|
||||
flags |= wxCHK_ALLOW_3RD_STATE_FOR_USER;
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case CheckboxKind_3State:
|
||||
flags |= wxCHK_3STATE;
|
||||
break;
|
||||
}
|
||||
|
||||
m_checkbox = new wxCheckBox(this, CheckboxPage_Checkbox, label,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_checkbox);
|
||||
|
||||
m_sizerCheckbox->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerCheckbox->Add(m_checkbox, 1, wxCENTRE);
|
||||
m_sizerCheckbox->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerCheckbox->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void CheckBoxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateCheckbox();
|
||||
}
|
||||
|
||||
void CheckBoxWidgetsPage::OnStyleChange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateCheckbox();
|
||||
}
|
||||
|
||||
void CheckBoxWidgetsPage::OnButtonChangeLabel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_checkbox->SetLabel(m_textLabel->GetValue());
|
||||
}
|
||||
|
||||
void CheckBoxWidgetsPage::OnCheckBox(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Test checkbox %schecked (value = %d).",
|
||||
event.IsChecked() ? "" : "un",
|
||||
(int)m_checkbox->Get3StateValue());
|
||||
}
|
||||
|
||||
434
libs/wxWidgets-3.3.1/samples/widgets/choice.cpp
Normal file
434
libs/wxWidgets-3.3.1/samples/widgets/choice.cpp
Normal file
@@ -0,0 +1,434 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: choice.cpp
|
||||
// Purpose: Part of the widgets sample showing wxChoice
|
||||
// Created: 23.07.07
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_CHOICE
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/choice.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "wx/checklst.h"
|
||||
|
||||
#include "itemcontainer.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/choice.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
ChoicePage_Reset = wxID_HIGHEST,
|
||||
ChoicePage_Add,
|
||||
ChoicePage_AddText,
|
||||
ChoicePage_AddSeveral,
|
||||
ChoicePage_AddMany,
|
||||
ChoicePage_Clear,
|
||||
ChoicePage_Change,
|
||||
ChoicePage_ChangeText,
|
||||
ChoicePage_Delete,
|
||||
ChoicePage_DeleteText,
|
||||
ChoicePage_DeleteSel,
|
||||
ChoicePage_Choice,
|
||||
ChoicePage_ContainerTests
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ChoiceWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ChoiceWidgetsPage : public ItemContainerWidgetsPage
|
||||
{
|
||||
public:
|
||||
ChoiceWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_choice; }
|
||||
virtual wxItemContainer* GetContainer() const override { return m_choice; }
|
||||
virtual void RecreateWidget() override { CreateChoice(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonChange(wxCommandEvent& event);
|
||||
void OnButtonDelete(wxCommandEvent& event);
|
||||
void OnButtonDeleteSel(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonAdd(wxCommandEvent& event);
|
||||
void OnButtonAddSeveral(wxCommandEvent& event);
|
||||
void OnButtonAddMany(wxCommandEvent& event);
|
||||
|
||||
void OnChoice(wxCommandEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIAddSeveral(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIClearButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
|
||||
// reset the choice parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the choice
|
||||
void CreateChoice();
|
||||
|
||||
// should it be sorted?
|
||||
bool m_sorted;
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the checkboxes
|
||||
wxCheckBox *m_chkSort;
|
||||
|
||||
// the choice itself and the sizer it is in
|
||||
wxChoice *m_choice;
|
||||
|
||||
wxSizer *m_sizerChoice;
|
||||
|
||||
// the text entries for "Add/change string" and "Delete" buttons
|
||||
wxTextCtrl *m_textAdd,
|
||||
*m_textChange,
|
||||
*m_textDelete;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ChoiceWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ChoiceWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(ChoicePage_Reset, ChoiceWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(ChoicePage_Change, ChoiceWidgetsPage::OnButtonChange)
|
||||
EVT_BUTTON(ChoicePage_Delete, ChoiceWidgetsPage::OnButtonDelete)
|
||||
EVT_BUTTON(ChoicePage_DeleteSel, ChoiceWidgetsPage::OnButtonDeleteSel)
|
||||
EVT_BUTTON(ChoicePage_Clear, ChoiceWidgetsPage::OnButtonClear)
|
||||
EVT_BUTTON(ChoicePage_Add, ChoiceWidgetsPage::OnButtonAdd)
|
||||
EVT_BUTTON(ChoicePage_AddSeveral, ChoiceWidgetsPage::OnButtonAddSeveral)
|
||||
EVT_BUTTON(ChoicePage_AddMany, ChoiceWidgetsPage::OnButtonAddMany)
|
||||
EVT_BUTTON(ChoicePage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
|
||||
|
||||
EVT_TEXT_ENTER(ChoicePage_AddText, ChoiceWidgetsPage::OnButtonAdd)
|
||||
EVT_TEXT_ENTER(ChoicePage_DeleteText, ChoiceWidgetsPage::OnButtonDelete)
|
||||
|
||||
EVT_UPDATE_UI(ChoicePage_Reset, ChoiceWidgetsPage::OnUpdateUIResetButton)
|
||||
EVT_UPDATE_UI(ChoicePage_AddSeveral, ChoiceWidgetsPage::OnUpdateUIAddSeveral)
|
||||
EVT_UPDATE_UI(ChoicePage_Clear, ChoiceWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ChoicePage_DeleteText, ChoiceWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ChoicePage_Delete, ChoiceWidgetsPage::OnUpdateUIDeleteButton)
|
||||
EVT_UPDATE_UI(ChoicePage_Change, ChoiceWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ChoicePage_ChangeText, ChoiceWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ChoicePage_DeleteSel, ChoiceWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
|
||||
EVT_CHOICE(ChoicePage_Choice, ChoiceWidgetsPage::OnChoice)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ChoiceWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, ChoiceWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ChoiceWidgetsPage, "Choice",
|
||||
FAMILY_CTRLS | WITH_ITEMS_CTRLS
|
||||
);
|
||||
|
||||
ChoiceWidgetsPage::ChoiceWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: ItemContainerWidgetsPage(book, imaglist, choice_xpm)
|
||||
{
|
||||
// init everything
|
||||
|
||||
m_chkSort = nullptr;
|
||||
|
||||
m_choice = nullptr;
|
||||
m_sizerChoice = nullptr;
|
||||
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::CreateContent()
|
||||
{
|
||||
/*
|
||||
What we create here is a frame having 3 panes: style pane is the
|
||||
leftmost one, in the middle the pane with buttons allowing to perform
|
||||
miscellaneous choice operations and the pane containing the choice
|
||||
itself to the right
|
||||
*/
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set choice parameters");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, "&Sort items", wxID_ANY, sizerLeftBox);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, ChoicePage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change choice contents");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_Add, "&Add this string");
|
||||
m_textAdd = new wxTextCtrl(sizerMiddleBox, ChoicePage_AddText, "test item 0");
|
||||
sizerRow->Add(btn, 0, wxRIGHT, 5);
|
||||
sizerRow->Add(m_textAdd, 1, wxLEFT, 5);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_AddSeveral, "&Insert a few strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_AddMany, "Add &many strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_Change, "C&hange current");
|
||||
m_textChange = new wxTextCtrl(sizerMiddleBox, ChoicePage_ChangeText, wxEmptyString);
|
||||
sizerRow->Add(btn, 0, wxRIGHT, 5);
|
||||
sizerRow->Add(m_textChange, 1, wxLEFT, 5);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_Delete, "&Delete this item");
|
||||
m_textDelete = new wxTextCtrl(sizerMiddleBox, ChoicePage_DeleteText, wxEmptyString);
|
||||
sizerRow->Add(btn, 0, wxRIGHT, 5);
|
||||
sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_DeleteSel, "Delete &selection");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_Clear, "&Clear");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ChoicePage_ContainerTests, "Run &tests");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
m_choice = new wxChoice(this, ChoicePage_Choice);
|
||||
sizerRight->Add(m_choice, 0, wxALL | wxGROW, 5);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerChoice = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ChoiceWidgetsPage::Reset()
|
||||
{
|
||||
m_chkSort->SetValue(false);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::CreateChoice()
|
||||
{
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkSort->GetValue() )
|
||||
flags |= wxCB_SORT;
|
||||
|
||||
wxArrayString items;
|
||||
if ( m_choice )
|
||||
{
|
||||
int count = m_choice->GetCount();
|
||||
for ( int n = 0; n < count; n++ )
|
||||
{
|
||||
items.Add(m_choice->GetString(n));
|
||||
}
|
||||
|
||||
m_sizerChoice->Detach( m_choice );
|
||||
delete m_choice;
|
||||
}
|
||||
|
||||
m_choice = new wxChoice(this, ChoicePage_Choice,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0, nullptr,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_choice);
|
||||
|
||||
m_choice->Set(items);
|
||||
m_sizerChoice->Add(m_choice, 0, wxGROW | wxALL, 5);
|
||||
m_sizerChoice->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateChoice();
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int selection = m_choice->GetSelection();
|
||||
if(selection != wxNOT_FOUND)
|
||||
{
|
||||
m_choice->SetString(selection, m_textChange->GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long n;
|
||||
if ( !m_textDelete->GetValue().ToULong(&n) ||
|
||||
(n >= (unsigned)m_choice->GetCount()) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_choice->Delete(n);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int selection = m_choice->GetSelection();
|
||||
if(selection != wxNOT_FOUND)
|
||||
{
|
||||
m_choice->Delete(selection);
|
||||
}
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_choice->Clear();
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
wxString s = m_textAdd->GetValue();
|
||||
if ( !m_textAdd->IsModified() )
|
||||
{
|
||||
// update the default string
|
||||
m_textAdd->SetValue(wxString::Format("test item %u", ++s_item));
|
||||
}
|
||||
|
||||
m_choice->Append(s);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// "many" means 1000 here
|
||||
wxArrayString strings;
|
||||
for ( unsigned int n = 0; n < 1000; n++ )
|
||||
{
|
||||
strings.Add(wxString::Format("item #%u", n));
|
||||
}
|
||||
m_choice->Append(strings);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxArrayString items;
|
||||
items.Add("First");
|
||||
items.Add("another one");
|
||||
items.Add("and the last (very very very very very very very very very very long) one");
|
||||
m_choice->Insert(items, 0);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( m_chkSort->GetValue() );
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
unsigned long n;
|
||||
event.Enable(m_textDelete->GetValue().ToULong(&n) &&
|
||||
(n < (unsigned)m_choice->GetCount()));
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
wxArrayInt selections;
|
||||
event.Enable(m_choice->GetSelection() != wxNOT_FOUND);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(m_choice->GetCount() != 0);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(!m_choice->HasFlag(wxCB_SORT));
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnChoice(wxCommandEvent& event)
|
||||
{
|
||||
long sel = event.GetSelection();
|
||||
m_textDelete->SetValue(wxString::Format("%ld", sel));
|
||||
|
||||
wxLogMessage("Choice item %ld selected", sel);
|
||||
}
|
||||
|
||||
void ChoiceWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateChoice();
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHOICE
|
||||
251
libs/wxWidgets-3.3.1/samples/widgets/clrpicker.cpp
Normal file
251
libs/wxWidgets-3.3.1/samples/widgets/clrpicker.cpp
Normal file
@@ -0,0 +1,251 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: clrpicker.cpp
|
||||
// Purpose: Shows wxColourPickerCtrl
|
||||
// Author: Francesco Montorsi
|
||||
// Created: 20/6/2006
|
||||
// Copyright: (c) 2006 Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_COLOURPICKERCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#include "wx/clrpicker.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/clrpicker.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
PickerPage_Reset = wxID_HIGHEST,
|
||||
PickerPage_Colour
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ColourPickerWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ColourPickerWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
ColourPickerWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_clrPicker; }
|
||||
virtual void RecreateWidget() override { RecreatePicker(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
|
||||
// called only once at first construction
|
||||
void CreatePicker();
|
||||
|
||||
// called to recreate an existing control
|
||||
void RecreatePicker();
|
||||
|
||||
// restore the checkboxes state to the initial values
|
||||
void Reset();
|
||||
|
||||
|
||||
void OnColourChange(wxColourPickerEvent &ev);
|
||||
void OnColourCurrentChanged(wxColourPickerEvent &ev);
|
||||
void OnColourDialogCancelled(wxColourPickerEvent &ev);
|
||||
|
||||
void OnCheckBox(wxCommandEvent &ev);
|
||||
void OnButtonReset(wxCommandEvent &ev);
|
||||
|
||||
// the picker
|
||||
wxColourPickerCtrl *m_clrPicker;
|
||||
|
||||
|
||||
// other controls
|
||||
// --------------
|
||||
|
||||
wxCheckBox *m_chkColourTextCtrl,
|
||||
*m_chkColourShowLabel,
|
||||
*m_chkColourShowAlpha;
|
||||
wxBoxSizer *m_sizer;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ColourPickerWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ColourPickerWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(PickerPage_Reset, ColourPickerWidgetsPage::OnButtonReset)
|
||||
|
||||
EVT_COLOURPICKER_CHANGED(PickerPage_Colour, ColourPickerWidgetsPage::OnColourChange)
|
||||
EVT_COLOURPICKER_CURRENT_CHANGED(PickerPage_Colour, ColourPickerWidgetsPage::OnColourCurrentChanged)
|
||||
EVT_COLOURPICKER_DIALOG_CANCELLED(PickerPage_Colour, ColourPickerWidgetsPage::OnColourDialogCancelled)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ColourPickerWidgetsPage::OnCheckBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ColourPickerWidgetsPage, "ColourPicker",
|
||||
PICKER_CTRLS | FAMILY_CTRLS);
|
||||
|
||||
ColourPickerWidgetsPage::ColourPickerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, clrpicker_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::CreateContent()
|
||||
{
|
||||
// left pane
|
||||
wxSizer *boxleft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxStaticBoxSizer *styleSizer = new wxStaticBoxSizer(wxVERTICAL, this, "&ColourPicker style");
|
||||
wxStaticBox* const styleSizerBox = styleSizer->GetStaticBox();
|
||||
|
||||
m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(styleSizer, "With textctrl", wxID_ANY, styleSizerBox);
|
||||
m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(styleSizer, "With label", wxID_ANY, styleSizerBox);
|
||||
m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(styleSizer, "With opacity", wxID_ANY, styleSizerBox);
|
||||
boxleft->Add(styleSizer, 0, wxALL|wxGROW, 5);
|
||||
|
||||
boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
|
||||
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
Reset(); // set checkboxes state
|
||||
|
||||
// create pickers
|
||||
m_clrPicker = nullptr;
|
||||
CreatePicker();
|
||||
|
||||
// right pane
|
||||
m_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer->Add(1, 1, 1, wxGROW | wxALL, 5); // spacer
|
||||
m_sizer->Add(m_clrPicker, 0, wxALIGN_CENTER|wxALL, 5);
|
||||
m_sizer->Add(1, 1, 1, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
// global pane
|
||||
wxSizer *sz = new wxBoxSizer(wxHORIZONTAL);
|
||||
sz->Add(boxleft, 0, wxGROW|wxALL, 5);
|
||||
sz->Add(m_sizer, 1, wxGROW|wxALL, 5);
|
||||
|
||||
SetSizer(sz);
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::CreatePicker()
|
||||
{
|
||||
delete m_clrPicker;
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkColourTextCtrl->GetValue() )
|
||||
style |= wxCLRP_USE_TEXTCTRL;
|
||||
|
||||
if ( m_chkColourShowLabel->GetValue() )
|
||||
style |= wxCLRP_SHOW_LABEL;
|
||||
|
||||
if ( m_chkColourShowAlpha->GetValue() )
|
||||
style |= wxCLRP_SHOW_ALPHA;
|
||||
|
||||
m_clrPicker = new wxColourPickerCtrl(this, PickerPage_Colour, *wxRED,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
|
||||
NotifyWidgetRecreation(m_clrPicker);
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::RecreatePicker()
|
||||
{
|
||||
m_sizer->Remove(1);
|
||||
CreatePicker();
|
||||
m_sizer->Insert(1, m_clrPicker, 0, wxALIGN_CENTER|wxALL, 5);
|
||||
|
||||
m_sizer->Layout();
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::Reset()
|
||||
{
|
||||
m_chkColourTextCtrl->SetValue((wxCLRP_DEFAULT_STYLE & wxCLRP_USE_TEXTCTRL) != 0);
|
||||
m_chkColourShowLabel->SetValue((wxCLRP_DEFAULT_STYLE & wxCLRP_SHOW_LABEL) != 0);
|
||||
m_chkColourShowAlpha->SetValue((wxCLRP_DEFAULT_STYLE & wxCLRP_SHOW_ALPHA) != 0);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ColourPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
RecreatePicker();
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::OnColourChange(wxColourPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("The colour changed to '%s' !",
|
||||
event.GetColour().GetAsString(wxC2S_CSS_SYNTAX));
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::OnColourCurrentChanged(wxColourPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("The currently selected colour changed to '%s'",
|
||||
event.GetColour().GetAsString(wxC2S_CSS_SYNTAX));
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::OnColourDialogCancelled(wxColourPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("Colour selection dialog cancelled, current colour is '%s'",
|
||||
event.GetColour().GetAsString(wxC2S_CSS_SYNTAX));
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::OnCheckBox(wxCommandEvent &event)
|
||||
{
|
||||
if (event.GetEventObject() == m_chkColourTextCtrl ||
|
||||
event.GetEventObject() == m_chkColourShowLabel ||
|
||||
event.GetEventObject() == m_chkColourShowAlpha)
|
||||
RecreatePicker();
|
||||
}
|
||||
|
||||
#endif // wxUSE_COLOURPICKERCTRL
|
||||
739
libs/wxWidgets-3.3.1/samples/widgets/combobox.cpp
Normal file
739
libs/wxWidgets-3.3.1/samples/widgets/combobox.cpp
Normal file
@@ -0,0 +1,739 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: combobox.cpp
|
||||
// Purpose: Part of the widgets sample showing wxComboBox
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 27.03.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_COMBOBOX
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "itemcontainer.h"
|
||||
#include "widgets.h"
|
||||
#include "icons/combobox.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
ComboPage_Reset = wxID_HIGHEST,
|
||||
ComboPage_Popup,
|
||||
ComboPage_Dismiss,
|
||||
ComboPage_SetCurrent,
|
||||
ComboPage_CurText,
|
||||
ComboPage_InsertionPointText,
|
||||
ComboPage_Insert,
|
||||
ComboPage_InsertText,
|
||||
ComboPage_Add,
|
||||
ComboPage_AddText,
|
||||
ComboPage_SetFirst,
|
||||
ComboPage_SetFirstText,
|
||||
ComboPage_AddSeveral,
|
||||
ComboPage_AddMany,
|
||||
ComboPage_Clear,
|
||||
ComboPage_Change,
|
||||
ComboPage_ChangeText,
|
||||
ComboPage_Delete,
|
||||
ComboPage_DeleteText,
|
||||
ComboPage_DeleteSel,
|
||||
ComboPage_SetValue,
|
||||
ComboPage_SetValueText,
|
||||
ComboPage_Combo,
|
||||
ComboPage_ContainerTests,
|
||||
ComboPage_Dynamic
|
||||
};
|
||||
|
||||
// kinds of comboboxes
|
||||
enum
|
||||
{
|
||||
ComboKind_Default,
|
||||
ComboKind_Simple,
|
||||
ComboKind_DropDown
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ComboboxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ComboboxWidgetsPage : public ItemContainerWidgetsPage
|
||||
{
|
||||
public:
|
||||
ComboboxWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_combobox; }
|
||||
virtual wxTextEntryBase *GetTextEntry() const override { return m_combobox; }
|
||||
virtual wxItemContainer* GetContainer() const override { return m_combobox; }
|
||||
virtual void RecreateWidget() override { CreateCombo(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonPopup(wxCommandEvent&) { m_combobox->Popup(); }
|
||||
void OnButtonDismiss(wxCommandEvent&) { m_combobox->Dismiss(); }
|
||||
void OnButtonChange(wxCommandEvent& event);
|
||||
void OnButtonDelete(wxCommandEvent& event);
|
||||
void OnButtonDeleteSel(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonInsert(wxCommandEvent &event);
|
||||
void OnButtonAdd(wxCommandEvent& event);
|
||||
void OnButtonSetFirst(wxCommandEvent& event);
|
||||
void OnButtonAddSeveral(wxCommandEvent& event);
|
||||
void OnButtonAddMany(wxCommandEvent& event);
|
||||
void OnButtonSetValue(wxCommandEvent& event);
|
||||
void OnButtonSetCurrent(wxCommandEvent& event);
|
||||
|
||||
void OnDropdown(wxCommandEvent& event);
|
||||
void OnCloseup(wxCommandEvent& event);
|
||||
void OnPopup(wxCommandEvent &event);
|
||||
void OnDismiss(wxCommandEvent &event);
|
||||
void OnComboBox(wxCommandEvent& event);
|
||||
void OnComboText(wxCommandEvent& event);
|
||||
void OnComboTextPasted(wxClipboardTextEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIInsertionPointText(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUIInsert(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIAddSeveral(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIClearButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUISetCurrent(wxUpdateUIEvent& event);
|
||||
|
||||
// reset the combobox parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the combobox
|
||||
void CreateCombo();
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the sel mode radiobox
|
||||
wxRadioBox *m_radioKind;
|
||||
|
||||
// the checkboxes for styles
|
||||
wxCheckBox *m_chkSort,
|
||||
*m_chkReadonly,
|
||||
*m_chkProcessEnter;
|
||||
|
||||
// the combobox itself and the sizer it is in
|
||||
wxComboBox *m_combobox, *m_combobox1;
|
||||
wxSizer *m_sizerCombo;
|
||||
|
||||
// the text entries for "Add/change string" and "Delete" buttons
|
||||
wxTextCtrl *m_textInsert,
|
||||
*m_textAdd,
|
||||
*m_textSetFirst,
|
||||
*m_textChange,
|
||||
*m_textSetValue,
|
||||
*m_textDelete,
|
||||
*m_textCur;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ComboboxWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ComboboxWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(ComboPage_Reset, ComboboxWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(ComboPage_Popup, ComboboxWidgetsPage::OnButtonPopup)
|
||||
EVT_BUTTON(ComboPage_Dismiss, ComboboxWidgetsPage::OnButtonDismiss)
|
||||
EVT_BUTTON(ComboPage_Change, ComboboxWidgetsPage::OnButtonChange)
|
||||
EVT_BUTTON(ComboPage_Delete, ComboboxWidgetsPage::OnButtonDelete)
|
||||
EVT_BUTTON(ComboPage_DeleteSel, ComboboxWidgetsPage::OnButtonDeleteSel)
|
||||
EVT_BUTTON(ComboPage_Clear, ComboboxWidgetsPage::OnButtonClear)
|
||||
EVT_BUTTON(ComboPage_Insert, ComboboxWidgetsPage::OnButtonInsert)
|
||||
EVT_BUTTON(ComboPage_Add, ComboboxWidgetsPage::OnButtonAdd)
|
||||
EVT_BUTTON(ComboPage_SetFirst, ComboboxWidgetsPage::OnButtonSetFirst)
|
||||
EVT_BUTTON(ComboPage_AddSeveral, ComboboxWidgetsPage::OnButtonAddSeveral)
|
||||
EVT_BUTTON(ComboPage_AddMany, ComboboxWidgetsPage::OnButtonAddMany)
|
||||
EVT_BUTTON(ComboPage_SetValue, ComboboxWidgetsPage::OnButtonSetValue)
|
||||
EVT_BUTTON(ComboPage_SetCurrent, ComboboxWidgetsPage::OnButtonSetCurrent)
|
||||
EVT_BUTTON(ComboPage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
|
||||
|
||||
EVT_TEXT_ENTER(ComboPage_InsertText, ComboboxWidgetsPage::OnButtonInsert)
|
||||
EVT_TEXT_ENTER(ComboPage_AddText, ComboboxWidgetsPage::OnButtonAdd)
|
||||
EVT_TEXT_ENTER(ComboPage_DeleteText, ComboboxWidgetsPage::OnButtonDelete)
|
||||
|
||||
EVT_UPDATE_UI(ComboPage_InsertionPointText, ComboboxWidgetsPage::OnUpdateUIInsertionPointText)
|
||||
|
||||
EVT_UPDATE_UI(ComboPage_Reset, ComboboxWidgetsPage::OnUpdateUIResetButton)
|
||||
EVT_UPDATE_UI(ComboPage_Insert, ComboboxWidgetsPage::OnUpdateUIInsert)
|
||||
EVT_UPDATE_UI(ComboPage_AddSeveral, ComboboxWidgetsPage::OnUpdateUIAddSeveral)
|
||||
EVT_UPDATE_UI(ComboPage_Clear, ComboboxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ComboPage_DeleteText, ComboboxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ComboPage_Delete, ComboboxWidgetsPage::OnUpdateUIDeleteButton)
|
||||
EVT_UPDATE_UI(ComboPage_Change, ComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ComboPage_ChangeText, ComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ComboPage_DeleteSel, ComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ComboPage_SetCurrent, ComboboxWidgetsPage::OnUpdateUISetCurrent)
|
||||
|
||||
EVT_COMBOBOX(ComboPage_Combo, ComboboxWidgetsPage::OnComboBox)
|
||||
EVT_COMBOBOX_DROPDOWN(ComboPage_Combo, ComboboxWidgetsPage::OnDropdown)
|
||||
EVT_COMBOBOX_CLOSEUP(ComboPage_Combo, ComboboxWidgetsPage::OnCloseup)
|
||||
EVT_TEXT(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
|
||||
EVT_TEXT_ENTER(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
|
||||
EVT_TEXT_PASTE(ComboPage_Combo, ComboboxWidgetsPage::OnComboTextPasted)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, "Combobox",
|
||||
FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
|
||||
);
|
||||
|
||||
ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: ItemContainerWidgetsPage(book, imaglist, combobox_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_chkSort =
|
||||
m_chkReadonly =
|
||||
m_chkProcessEnter = nullptr;
|
||||
|
||||
m_combobox = nullptr;
|
||||
m_sizerCombo = nullptr;
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::CreateContent()
|
||||
{
|
||||
/*
|
||||
What we create here is a frame having 3 panes: style pane is the
|
||||
leftmost one, in the middle the pane with buttons allowing to perform
|
||||
miscellaneous combobox operations and the pane containing the combobox
|
||||
itself to the right
|
||||
*/
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// upper left pane
|
||||
wxStaticBoxSizer *sizerLeftTop = new wxStaticBoxSizer(wxVERTICAL, this, "&Popup");
|
||||
wxStaticBox* const sizerLeftTopBox = sizerLeftTop->GetStaticBox();
|
||||
|
||||
sizerLeftTop->Add(new wxButton(sizerLeftTopBox, ComboPage_Popup, "&Show"),
|
||||
wxSizerFlags().Border().Centre());
|
||||
sizerLeftTop->Add(new wxButton(sizerLeftTopBox, ComboPage_Dismiss, "&Hide"),
|
||||
wxSizerFlags().Border().Centre());
|
||||
|
||||
// lower left pane
|
||||
|
||||
// should be in sync with ComboKind_XXX values
|
||||
static const wxString kinds[] =
|
||||
{
|
||||
"default",
|
||||
"simple",
|
||||
"drop down",
|
||||
};
|
||||
|
||||
wxStaticBoxSizer *sizerLeftBottom = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBottomBox = sizerLeftBottom->GetStaticBox();
|
||||
|
||||
m_radioKind = new wxRadioBox(sizerLeftBottomBox, wxID_ANY, "Combobox &kind:",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(kinds), kinds,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
|
||||
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeftBottom, "&Sort items", wxID_ANY, sizerLeftBottomBox);
|
||||
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeftBottom, "&Read only", wxID_ANY, sizerLeftBottomBox);
|
||||
m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeftBottom, "Process &Enter", wxID_ANY, sizerLeftBottomBox);
|
||||
|
||||
sizerLeftBottom->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
sizerLeftBottom->Add(m_radioKind, 0, wxGROW | wxALL, 5);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBottomBox, ComboPage_Reset, "&Reset");
|
||||
sizerLeftBottom->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
|
||||
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
sizerLeft->Add(sizerLeftTop);
|
||||
sizerLeft->AddSpacer(10);
|
||||
sizerLeft->Add(sizerLeftBottom, wxSizerFlags().Expand());
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change combobox contents");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxSizer *sizerRow;
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ComboPage_SetCurrent,
|
||||
"Current &selection",
|
||||
ComboPage_CurText,
|
||||
&m_textCur,
|
||||
sizerMiddleBox);
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
wxTextCtrl *text;
|
||||
sizerRow = CreateSizerWithTextAndLabel("Insertion Point",
|
||||
ComboPage_InsertionPointText,
|
||||
&text,
|
||||
sizerMiddleBox);
|
||||
text->SetEditable(false);
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ComboPage_Insert,
|
||||
"&Insert this string",
|
||||
ComboPage_InsertText,
|
||||
&m_textInsert,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ComboPage_Add,
|
||||
"&Add this string",
|
||||
ComboPage_AddText,
|
||||
&m_textAdd,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ComboPage_SetFirst,
|
||||
"Change &1st string",
|
||||
ComboPage_SetFirstText,
|
||||
&m_textSetFirst,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ComboPage_AddSeveral, "&Append a few strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ComboPage_AddMany, "Append &many strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ComboPage_Change,
|
||||
"C&hange current",
|
||||
ComboPage_ChangeText,
|
||||
&m_textChange,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ComboPage_Delete,
|
||||
"&Delete this item",
|
||||
ComboPage_DeleteText,
|
||||
&m_textDelete,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ComboPage_DeleteSel, "Delete &selection");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ComboPage_Clear, "&Clear");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ComboPage_SetValue,
|
||||
"SetValue",
|
||||
ComboPage_SetValueText,
|
||||
&m_textSetValue,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ComboPage_ContainerTests, "Run &tests");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0, nullptr,
|
||||
0);
|
||||
sizerRight->Add(m_combobox, 0, wxGROW | wxALL, 5);
|
||||
m_combobox1 = new wxComboBox( this, ComboPage_Dynamic );
|
||||
m_combobox1->Append( "Dynamic ComboBox Test - Click me!" );
|
||||
m_combobox1->SetSelection( 0 );
|
||||
sizerRight->Add( 20, 20, 0, wxEXPAND, 0 );
|
||||
sizerRight->Add( m_combobox1, 0, wxGROW | wxALL, 5 );
|
||||
m_combobox1->Bind( wxEVT_COMBOBOX_DROPDOWN, &ComboboxWidgetsPage::OnPopup, this );
|
||||
m_combobox1->Bind( wxEVT_COMBOBOX_CLOSEUP, &ComboboxWidgetsPage::OnDismiss, this );
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerCombo = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ComboboxWidgetsPage::Reset()
|
||||
{
|
||||
m_chkSort->SetValue(false);
|
||||
m_chkReadonly->SetValue(false);
|
||||
m_chkProcessEnter->SetValue(false);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::CreateCombo()
|
||||
{
|
||||
wxCHECK_RET( m_combobox, "No combo box exists" );
|
||||
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkSort->GetValue() )
|
||||
flags |= wxCB_SORT;
|
||||
if ( m_chkReadonly->GetValue() )
|
||||
flags |= wxCB_READONLY;
|
||||
if ( m_chkProcessEnter->GetValue() )
|
||||
flags |= wxTE_PROCESS_ENTER;
|
||||
|
||||
|
||||
switch ( m_radioKind->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( "unknown combo kind" );
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case ComboKind_Default:
|
||||
break;
|
||||
|
||||
case ComboKind_Simple:
|
||||
flags |= wxCB_SIMPLE;
|
||||
break;
|
||||
|
||||
case ComboKind_DropDown:
|
||||
flags |= wxCB_DROPDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
wxArrayString items;
|
||||
unsigned int count = m_combobox->GetCount();
|
||||
for ( unsigned int n = 0; n < count; n++ )
|
||||
{
|
||||
items.Add(m_combobox->GetString(n));
|
||||
}
|
||||
int selItem = m_combobox->GetSelection();
|
||||
|
||||
wxComboBox* newCb = new wxComboBox(this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
items,
|
||||
flags);
|
||||
|
||||
if ( selItem != wxNOT_FOUND )
|
||||
newCb->SetSelection(selItem);
|
||||
|
||||
m_sizerCombo->Replace(m_combobox, newCb);
|
||||
m_sizerCombo->Layout();
|
||||
|
||||
delete m_combobox;
|
||||
m_combobox = newCb;
|
||||
m_combobox->SetId(ComboPage_Combo);
|
||||
|
||||
NotifyWidgetRecreation(m_combobox);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateCombo();
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int sel = m_combobox->GetSelection();
|
||||
if ( sel != wxNOT_FOUND )
|
||||
{
|
||||
m_combobox->SetString(sel, m_textChange->GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long n;
|
||||
if ( !m_textDelete->GetValue().ToULong(&n) ||
|
||||
(n >= m_combobox->GetCount()) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_combobox->Delete(n);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int sel = m_combobox->GetSelection();
|
||||
if ( sel != wxNOT_FOUND )
|
||||
{
|
||||
m_combobox->Delete(sel);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString value = m_textSetValue->GetValue();
|
||||
m_combobox->SetValue( value );
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Clear();
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
wxString s = m_textInsert->GetValue();
|
||||
if ( !m_textInsert->IsModified() )
|
||||
{
|
||||
// update the default string
|
||||
m_textInsert->SetValue(wxString::Format("test item %u", ++s_item));
|
||||
}
|
||||
|
||||
if (m_combobox->GetSelection() >= 0)
|
||||
m_combobox->Insert(s, m_combobox->GetSelection());
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
wxString s = m_textAdd->GetValue();
|
||||
if ( !m_textAdd->IsModified() )
|
||||
{
|
||||
// update the default string
|
||||
m_textAdd->SetValue(wxString::Format("test item %u", ++s_item));
|
||||
}
|
||||
|
||||
m_combobox->Append(s);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonSetFirst(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( m_combobox->IsListEmpty() )
|
||||
{
|
||||
wxLogWarning("No string to change.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_combobox->SetString(0, m_textSetFirst->GetValue());
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// "many" means 1000 here
|
||||
for ( unsigned int n = 0; n < 1000; n++ )
|
||||
{
|
||||
m_combobox->Append(wxString::Format("item #%u", n));
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonSetCurrent(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long n;
|
||||
if ( !m_textCur->GetValue().ToLong(&n) )
|
||||
return;
|
||||
|
||||
m_combobox->SetSelection(n);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Append("First");
|
||||
m_combobox->Append("another one");
|
||||
m_combobox->Append("and the last (very very very very very very very very very very long) one");
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.SetText( wxString::Format("%ld", m_combobox->GetInsertionPoint()) );
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( m_chkSort->GetValue() ||
|
||||
m_chkReadonly->GetValue() ||
|
||||
m_chkProcessEnter->GetValue() );
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUIInsert(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
{
|
||||
bool enable = !(m_combobox->GetWindowStyle() & wxCB_SORT) &&
|
||||
(m_combobox->GetSelection() >= 0);
|
||||
|
||||
event.Enable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
{
|
||||
unsigned long n;
|
||||
event.Enable(m_textDelete->GetValue().ToULong(&n) &&
|
||||
(n < (unsigned)m_combobox->GetCount()));
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(m_combobox->GetSelection() != wxNOT_FOUND);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(m_combobox->GetCount() != 0);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(!(m_combobox->GetWindowStyle() & wxCB_SORT));
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnUpdateUISetCurrent(wxUpdateUIEvent& event)
|
||||
{
|
||||
long n;
|
||||
event.Enable( m_textCur->GetValue().ToLong(&n) &&
|
||||
(n == wxNOT_FOUND ||
|
||||
(n >= 0 && (unsigned)n < m_combobox->GetCount())) );
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
|
||||
{
|
||||
if (!m_combobox)
|
||||
return;
|
||||
|
||||
wxString s = event.GetString();
|
||||
|
||||
wxASSERT_MSG( s == m_combobox->GetValue(),
|
||||
"event and combobox values should be the same" );
|
||||
|
||||
if (event.GetEventType() == wxEVT_TEXT_ENTER)
|
||||
{
|
||||
wxLogMessage("Combobox enter pressed (now '%s')", s);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage("Combobox text changed (now '%s')", s);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnComboTextPasted(wxClipboardTextEvent& event)
|
||||
{
|
||||
wxLogMessage("Text pasted from clipboard.");
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
|
||||
{
|
||||
long sel = event.GetInt();
|
||||
const wxString selstr = wxString::Format("%ld", sel);
|
||||
m_textDelete->SetValue(selstr);
|
||||
m_textCur->SetValue(selstr);
|
||||
|
||||
wxLogMessage("Combobox item %ld selected", sel);
|
||||
|
||||
wxLogMessage("Combobox GetValue(): %s", m_combobox->GetValue() );
|
||||
|
||||
if ( event.GetString() != m_combobox->GetValue() )
|
||||
{
|
||||
wxLogMessage("ERROR: Event has different string \"%s\"",
|
||||
event.GetString());
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateCombo();
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnDropdown(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Combobox dropped down");
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnCloseup(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Combobox closed up");
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnPopup(wxCommandEvent &WXUNUSED(event))
|
||||
{
|
||||
m_combobox1->Clear();
|
||||
m_combobox1->Append( "Selection 1" );
|
||||
m_combobox1->Append( "Selection 2" );
|
||||
m_combobox1->Append( "Selection 3" );
|
||||
wxLogMessage("The number of items is %d", m_combobox1->GetCount());
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnDismiss(wxCommandEvent &WXUNUSED(event))
|
||||
{
|
||||
if ( m_combobox1->GetSelection() == wxNOT_FOUND )
|
||||
{
|
||||
m_combobox1->Clear();
|
||||
m_combobox1->Append( "Dynamic ComboBox Test - Click me!" );
|
||||
m_combobox1->SetSelection( 0 );
|
||||
}
|
||||
wxLogMessage("The number of items is %d", m_combobox1->GetCount());
|
||||
}
|
||||
|
||||
#endif // wxUSE_COMBOBOX
|
||||
372
libs/wxWidgets-3.3.1/samples/widgets/datepick.cpp
Normal file
372
libs/wxWidgets-3.3.1/samples/widgets/datepick.cpp
Normal file
@@ -0,0 +1,372 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: datepick.cpp
|
||||
// Purpose: Part of the widgets sample showing date picker
|
||||
// Author: Dimitri Schoolwerth, Vadim Zeitlin
|
||||
// Created: 27 Sep 2003
|
||||
// Copyright: (c) 2003 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_DATEPICKCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
|
||||
#include "wx/sizer.h"
|
||||
#endif
|
||||
|
||||
#include "wx/datectrl.h"
|
||||
#include "wx/dateevt.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/datepick.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
DatePickerPage_Reset = wxID_HIGHEST,
|
||||
DatePickerPage_Set,
|
||||
DatePickerPage_SetRange,
|
||||
DatePickerPage_SetNullText,
|
||||
DatePickerPage_Picker
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CheckBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class DatePickerWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
DatePickerWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_datePicker; }
|
||||
virtual void RecreateWidget() override { CreateDatePicker(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnDateChanged(wxDateEvent& event);
|
||||
|
||||
void OnButtonSet(wxCommandEvent& event);
|
||||
void OnButtonSetRange(wxCommandEvent& event);
|
||||
void OnButtonSetNullText(wxCommandEvent& event);
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
|
||||
// reset the date picker parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the date picker
|
||||
void CreateDatePicker();
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the checkbox itself and the sizer it is in
|
||||
wxDatePickerCtrl *m_datePicker;
|
||||
wxSizer *m_sizerDatePicker;
|
||||
|
||||
wxTextCtrl *m_textCur;
|
||||
wxTextCtrl *m_textMin;
|
||||
wxTextCtrl *m_textMax;
|
||||
wxTextCtrl *m_textNull;
|
||||
|
||||
wxRadioBox* m_radioKind;
|
||||
wxCheckBox* m_chkStyleCentury;
|
||||
wxCheckBox* m_chkStyleAllowNone;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_textLabel;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(DatePickerWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(DatePickerWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(DatePickerPage_Reset, DatePickerWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(DatePickerPage_Set, DatePickerWidgetsPage::OnButtonSet)
|
||||
EVT_BUTTON(DatePickerPage_SetRange, DatePickerWidgetsPage::OnButtonSetRange)
|
||||
EVT_BUTTON(DatePickerPage_SetNullText, DatePickerWidgetsPage::OnButtonSetNullText)
|
||||
|
||||
EVT_DATE_CHANGED(wxID_ANY, DatePickerWidgetsPage::OnDateChanged)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, "DatePicker",
|
||||
FAMILY_CTRLS | PICKER_CTRLS
|
||||
);
|
||||
|
||||
DatePickerWidgetsPage::DatePickerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
:WidgetsPage(book, imaglist, datepick_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void DatePickerWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane: style
|
||||
wxSizer* const sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
static const wxString kinds[] = { "&Default", "&Spin", "Drop do&wn" };
|
||||
m_radioKind = new wxRadioBox(this, wxID_ANY, "&Kind",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(kinds), kinds,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
sizerLeft->Add(m_radioKind, wxSizerFlags().Expand().Border());
|
||||
|
||||
wxStaticBoxSizer* const sizerStyle = new wxStaticBoxSizer(wxVERTICAL, this, "&Style");
|
||||
wxStaticBox* const sizerStyleBox = sizerStyle->GetStaticBox();
|
||||
|
||||
m_chkStyleCentury = CreateCheckBoxAndAddToSizer(sizerStyle, "Show ¢ury", wxID_ANY, sizerStyleBox);
|
||||
m_chkStyleAllowNone = CreateCheckBoxAndAddToSizer(sizerStyle, "Allow &no value", wxID_ANY, sizerStyleBox);
|
||||
|
||||
sizerLeft->Add(sizerStyle, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerLeft->Add(new wxButton(this, DatePickerPage_Reset, "&Recreate"),
|
||||
wxSizerFlags().Centre().Border());
|
||||
|
||||
|
||||
// middle pane: operations
|
||||
wxSizer* const sizerMiddle = new wxBoxSizer(wxVERTICAL);
|
||||
sizerMiddle->Add(CreateSizerWithTextAndButton
|
||||
(
|
||||
DatePickerPage_Set,
|
||||
"&Set date",
|
||||
wxID_ANY,
|
||||
&m_textCur
|
||||
),
|
||||
wxSizerFlags().Expand().Border());
|
||||
|
||||
m_textCur->SetMinSize(m_textCur->GetSizeFromText("9999-99-99"));
|
||||
|
||||
sizerMiddle->AddSpacer(10);
|
||||
|
||||
sizerMiddle->Add(CreateSizerWithTextAndLabel
|
||||
(
|
||||
"&Min date",
|
||||
wxID_ANY,
|
||||
&m_textMin
|
||||
),
|
||||
wxSizerFlags().Expand().Border());
|
||||
sizerMiddle->Add(CreateSizerWithTextAndLabel
|
||||
(
|
||||
"Ma&x date",
|
||||
wxID_ANY,
|
||||
&m_textMax
|
||||
),
|
||||
wxSizerFlags().Expand().Border());
|
||||
sizerMiddle->Add(new wxButton(this, DatePickerPage_SetRange, "Set &range"),
|
||||
wxSizerFlags().Centre().Border());
|
||||
|
||||
sizerMiddle->AddSpacer(10);
|
||||
|
||||
sizerMiddle->Add(CreateSizerWithTextAndLabel
|
||||
(
|
||||
"&Null text",
|
||||
wxID_ANY,
|
||||
&m_textNull
|
||||
),
|
||||
wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerMiddle->Add(new wxButton(this, DatePickerPage_SetNullText,
|
||||
"Set &null text"),
|
||||
wxSizerFlags().Centre().Border());
|
||||
|
||||
|
||||
// right pane: control itself
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_datePicker = new wxDatePickerCtrl(this, DatePickerPage_Picker);
|
||||
|
||||
sizerRight->Add(0, 0, 1, wxCENTRE);
|
||||
sizerRight->Add(m_datePicker, 1, wxCENTRE);
|
||||
sizerRight->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerDatePicker = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 0, (wxTOP | wxBOTTOM), 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
m_chkStyleCentury->SetValue(true);
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
void DatePickerWidgetsPage::Reset()
|
||||
{
|
||||
const wxDateTime today = wxDateTime::Today();
|
||||
|
||||
m_datePicker->SetValue(today);
|
||||
m_textCur->SetValue(today.FormatISODate());
|
||||
}
|
||||
|
||||
void DatePickerWidgetsPage::CreateDatePicker()
|
||||
{
|
||||
const wxDateTime value = m_datePicker->GetValue();
|
||||
|
||||
size_t count = m_sizerDatePicker->GetChildren().GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
m_sizerDatePicker->Remove(0);
|
||||
}
|
||||
|
||||
delete m_datePicker;
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
switch ( m_radioKind->GetSelection() )
|
||||
{
|
||||
case 0:
|
||||
style = wxDP_DEFAULT;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
style = wxDP_SPIN;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
style = wxDP_DROPDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( m_chkStyleCentury->GetValue() )
|
||||
style |= wxDP_SHOWCENTURY;
|
||||
if ( m_chkStyleAllowNone->GetValue() )
|
||||
style |= wxDP_ALLOWNONE;
|
||||
|
||||
m_datePicker = new wxDatePickerCtrl(this, DatePickerPage_Picker, value,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
|
||||
NotifyWidgetRecreation(m_datePicker);
|
||||
|
||||
m_sizerDatePicker->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerDatePicker->Add(m_datePicker, 1, wxCENTRE);
|
||||
m_sizerDatePicker->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerDatePicker->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void DatePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateDatePicker();
|
||||
}
|
||||
|
||||
static bool GetDateFromTextControl(wxDateTime& dt, const wxTextCtrl* text)
|
||||
{
|
||||
const wxString& value = text->GetValue();
|
||||
if ( !value.empty() )
|
||||
{
|
||||
wxString::const_iterator end;
|
||||
if ( !dt.ParseDate(value, &end) || end != value.end() )
|
||||
{
|
||||
wxLogError("Invalid date \"%s\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DatePickerWidgetsPage::OnButtonSet(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxDateTime dt;
|
||||
if ( GetDateFromTextControl(dt, m_textCur) )
|
||||
m_datePicker->SetValue(dt);
|
||||
}
|
||||
|
||||
void DatePickerWidgetsPage::OnButtonSetRange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxDateTime dt1, dt2;
|
||||
if ( !GetDateFromTextControl(dt1, m_textMin) ||
|
||||
!GetDateFromTextControl(dt2, m_textMax) )
|
||||
return;
|
||||
|
||||
m_datePicker->SetRange(dt1, dt2);
|
||||
|
||||
if ( !m_datePicker->GetRange(&dt1, &dt2) )
|
||||
{
|
||||
wxLogMessage("No range set");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textMin->SetValue(dt1.IsValid() ? dt1.FormatISODate() : wxString());
|
||||
m_textMax->SetValue(dt2.IsValid() ? dt2.FormatISODate() : wxString());
|
||||
|
||||
wxLogMessage("Date picker range updated");
|
||||
}
|
||||
}
|
||||
|
||||
void DatePickerWidgetsPage::OnButtonSetNullText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_datePicker->SetNullText(m_textNull->GetValue());
|
||||
}
|
||||
|
||||
// Helper function which has to be used here because the controls with
|
||||
// wxDP_ALLOWNONE style can have invalid date, both in the control itself and
|
||||
// in the event it generates.
|
||||
static wxString FormatPossiblyInvalidDate(const wxDateTime& dt)
|
||||
{
|
||||
return dt.IsValid() ? dt.FormatISOCombined() : wxString("[none]");
|
||||
}
|
||||
|
||||
void DatePickerWidgetsPage::OnDateChanged(wxDateEvent& event)
|
||||
{
|
||||
wxLogMessage("Date changed, now is %s (control value is %s).",
|
||||
FormatPossiblyInvalidDate(event.GetDate()),
|
||||
FormatPossiblyInvalidDate(m_datePicker->GetValue()));
|
||||
}
|
||||
|
||||
#endif // wxUSE_DATEPICKCTRL
|
||||
110
libs/wxWidgets-3.3.1/samples/widgets/descrip.mms
Normal file
110
libs/wxWidgets-3.3.1/samples/widgets/descrip.mms
Normal file
@@ -0,0 +1,110 @@
|
||||
#*****************************************************************************
|
||||
# *
|
||||
# Make file for VMS *
|
||||
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
|
||||
# Date : 9 November 2011 *
|
||||
# *
|
||||
#*****************************************************************************
|
||||
.first
|
||||
define wx [--.include.wx]
|
||||
|
||||
.ifdef __WXMOTIF__
|
||||
CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\
|
||||
/assume=(nostdnew,noglobal_array_new)
|
||||
.else
|
||||
.ifdef __WXGTK__
|
||||
CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
|
||||
/assume=(nostdnew,noglobal_array_new)
|
||||
.else
|
||||
.ifdef __WXGTK2__
|
||||
CXX_DEFINE = /define=(__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)/ieee=denorm\
|
||||
/assume=(nostdnew,noglobal_array_new)
|
||||
.else
|
||||
.ifdef __WXX11__
|
||||
CXX_DEFINE = /define=(__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\
|
||||
/name=(as_is,short)/assume=(nostdnew,noglobal_array_new)
|
||||
.else
|
||||
CXX_DEFINE =
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.suffixes : .cpp
|
||||
|
||||
.cpp.obj :
|
||||
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
|
||||
|
||||
all :
|
||||
.ifdef __WXMOTIF__
|
||||
$(MMS)$(MMSQUALIFIERS) widgets.exe
|
||||
.else
|
||||
.ifdef __WXGTK__
|
||||
$(MMS)$(MMSQUALIFIERS) widgets_gtk.exe
|
||||
.else
|
||||
.ifdef __WXGTK2__
|
||||
$(MMS)$(MMSQUALIFIERS) widgets_gtk2.exe
|
||||
.else
|
||||
.ifdef __WXX11__
|
||||
$(MMS)$(MMSQUALIFIERS) widgets_x11.exe
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
OBJS=bmpcombobox.obj,button.obj,checkbox.obj,choice.obj,clrpicker.obj,\
|
||||
combobox.obj,datepick.obj,dirctrl.obj,dirpicker.obj,editlbox.obj,\
|
||||
filectrl.obj,filepicker.obj,fontpicker.obj,gauge.obj,hyperlnk.obj,\
|
||||
itemcontainer.obj,listbox.obj,notebook.obj,odcombobox.obj,\
|
||||
radiobox.obj,searchctrl.obj,slider.obj,spinbtn.obj,statbmp.obj,\
|
||||
static.obj,textctrl.obj,toggle.obj,widgets.obj
|
||||
|
||||
.ifdef __WXMOTIF__
|
||||
widgets.exe : $(OBJS)
|
||||
cxxlink/exec=widgets.exe $(OBJS),[--.lib]vms/opt
|
||||
.else
|
||||
.ifdef __WXGTK__
|
||||
widgets_gtk.exe : $(OBJS)
|
||||
cxxlink/exec=widgets_gtk.exe $(OBJS),[--.lib]vms_gtk/opt
|
||||
.else
|
||||
.ifdef __WXGTK2__
|
||||
widgets_gtk2.exe : $(OBJS)
|
||||
cxxlink/exec=widgets_gtk2.exe $(OBJS),[--.lib]vms_gtk2/opt
|
||||
.else
|
||||
.ifdef __WXX11__
|
||||
widgets_x11.exe : $(OBJS)
|
||||
cxxlink/exec=widgets_x11.exe $(OBJS),[--.lib]vms_x11_univ/opt
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
bmpcombobox.obj : bmpcombobox.cpp
|
||||
button.obj : button.cpp
|
||||
checkbox.obj : checkbox.cpp
|
||||
choice.obj : choice.cpp
|
||||
clrpicker.obj : clrpicker.cpp
|
||||
combobox.obj : combobox.cpp
|
||||
datepick.obj : datepick.cpp
|
||||
dirctrl.obj : dirctrl.cpp
|
||||
dirpicker.obj : dirpicker.cpp
|
||||
editlbox.obj : editlbox.cpp
|
||||
filectrl.obj : filectrl.cpp
|
||||
filepicker.obj : filepicker.cpp
|
||||
fontpicker.obj : fontpicker.cpp
|
||||
gauge.obj : gauge.cpp
|
||||
hyperlnk.obj : hyperlnk.cpp
|
||||
itemcontainer.obj : itemcontainer.cpp
|
||||
listbox.obj : listbox.cpp
|
||||
notebook.obj : notebook.cpp
|
||||
odcombobox.obj : odcombobox.cpp
|
||||
radiobox.obj : radiobox.cpp
|
||||
searchctrl.obj : searchctrl.cpp
|
||||
slider.obj : slider.cpp
|
||||
spinbtn.obj : spinbtn.cpp
|
||||
statbmp.obj : statbmp.cpp
|
||||
static.obj : static.cpp
|
||||
textctrl.obj : textctrl.cpp
|
||||
toggle.obj : toggle.cpp
|
||||
widgets.obj : widgets.cpp
|
||||
cxx $(CXXFLAGS)$(CXX_DEFINE)/object=widgets.obj widgets.cpp
|
||||
417
libs/wxWidgets-3.3.1/samples/widgets/dirctrl.cpp
Normal file
417
libs/wxWidgets-3.3.1/samples/widgets/dirctrl.cpp
Normal file
@@ -0,0 +1,417 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: dirctrl.cpp
|
||||
// Purpose: Part of the widgets sample showing wxGenericDirCtrl
|
||||
// Author: Wlodzimierz 'ABX' Skiba
|
||||
// Created: 4 Oct 2006
|
||||
// Copyright: (c) 2006 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_DIRDLG
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/filedlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/generic/dirctrlg.h"
|
||||
|
||||
#include "wx/wupdlock.h"
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/dirctrl.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
DirCtrlPage_Reset = wxID_HIGHEST,
|
||||
DirCtrlPage_SetPath,
|
||||
DirCtrlPage_Ctrl
|
||||
};
|
||||
|
||||
static const wxString stdPaths[] =
|
||||
{
|
||||
"&none",
|
||||
"&config",
|
||||
"&data",
|
||||
"&documents",
|
||||
"&local data",
|
||||
"&plugins",
|
||||
"&resources",
|
||||
"&user config",
|
||||
"&user data",
|
||||
"&user local data"
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
stdPathUnknown = 0,
|
||||
stdPathConfig,
|
||||
stdPathData,
|
||||
stdPathDocuments,
|
||||
stdPathLocalData,
|
||||
stdPathPlugins,
|
||||
stdPathResources,
|
||||
stdPathUserConfig,
|
||||
stdPathUserData,
|
||||
stdPathUserLocalData,
|
||||
stdPathMax
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CheckBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class DirCtrlWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
DirCtrlWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
virtual ~DirCtrlWidgetsPage() {}
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_dirCtrl; }
|
||||
virtual void RecreateWidget() override { CreateDirCtrl(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonSetPath(wxCommandEvent& event);
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnStdPath(wxCommandEvent& event);
|
||||
void OnCheckBox(wxCommandEvent& event);
|
||||
void OnRadioBox(wxCommandEvent& event);
|
||||
void OnSelChanged(wxTreeEvent& event);
|
||||
void OnFileActivated(wxTreeEvent& event);
|
||||
|
||||
// reset the control parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the m_dirCtrl
|
||||
void CreateDirCtrl(bool defaultPath = false);
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the control itself and the sizer it is in
|
||||
wxGenericDirCtrl *m_dirCtrl;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_path;
|
||||
|
||||
wxRadioBox *m_radioStdPath;
|
||||
|
||||
// flags
|
||||
wxCheckBox *m_chkDirOnly,
|
||||
*m_chk3D,
|
||||
*m_chkFirst,
|
||||
*m_chkFilters,
|
||||
*m_chkLabels,
|
||||
*m_chkMulti;
|
||||
|
||||
// filters
|
||||
wxCheckBox *m_fltr[3];
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(DirCtrlWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(DirCtrlWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(DirCtrlPage_Reset, DirCtrlWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(DirCtrlPage_SetPath, DirCtrlWidgetsPage::OnButtonSetPath)
|
||||
EVT_CHECKBOX(wxID_ANY, DirCtrlWidgetsPage::OnCheckBox)
|
||||
EVT_RADIOBOX(wxID_ANY, DirCtrlWidgetsPage::OnRadioBox)
|
||||
EVT_DIRCTRL_SELECTIONCHANGED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnSelChanged)
|
||||
EVT_DIRCTRL_FILEACTIVATED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnFileActivated)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(DirCtrlWidgetsPage, "DirCtrl",
|
||||
GENERIC_CTRLS
|
||||
);
|
||||
|
||||
DirCtrlWidgetsPage::DirCtrlWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
:WidgetsPage(book, imaglist, dirctrl_xpm)
|
||||
{
|
||||
m_dirCtrl = nullptr;
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "Dir control details");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
sizerLeft->Add( CreateSizerWithTextAndButton( DirCtrlPage_SetPath , "Set &path", wxID_ANY, &m_path, sizerLeftBox),
|
||||
0, wxALL | wxALIGN_RIGHT , 5 );
|
||||
|
||||
wxStaticBoxSizer *sizerFlags = new wxStaticBoxSizer(wxVERTICAL, sizerLeftBox, "&Flags");
|
||||
wxStaticBox* const sizerFlagsBox = sizerFlags->GetStaticBox();
|
||||
|
||||
m_chkDirOnly = CreateCheckBoxAndAddToSizer(sizerFlags, "wxDIRCTRL_DIR_ONLY", wxID_ANY, sizerFlagsBox);
|
||||
m_chk3D = CreateCheckBoxAndAddToSizer(sizerFlags, "wxDIRCTRL_3D_INTERNAL", wxID_ANY, sizerFlagsBox);
|
||||
m_chkFirst = CreateCheckBoxAndAddToSizer(sizerFlags, "wxDIRCTRL_SELECT_FIRST", wxID_ANY, sizerFlagsBox);
|
||||
m_chkFilters = CreateCheckBoxAndAddToSizer(sizerFlags, "wxDIRCTRL_SHOW_FILTERS", wxID_ANY, sizerFlagsBox);
|
||||
m_chkLabels = CreateCheckBoxAndAddToSizer(sizerFlags, "wxDIRCTRL_EDIT_LABELS", wxID_ANY, sizerFlagsBox);
|
||||
m_chkMulti = CreateCheckBoxAndAddToSizer(sizerFlags, "wxDIRCTRL_MULTIPLE", wxID_ANY, sizerFlagsBox);
|
||||
sizerLeft->Add(sizerFlags, wxSizerFlags().Expand().Border());
|
||||
|
||||
wxStaticBoxSizer *sizerFilters = new wxStaticBoxSizer(wxVERTICAL, sizerLeftBox, "&Filters");
|
||||
wxStaticBox* const sizerFiltersBox = sizerFilters->GetStaticBox();
|
||||
|
||||
m_fltr[0] = CreateCheckBoxAndAddToSizer(sizerFilters, wxString::Format("all files (%s)|%s",
|
||||
wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
|
||||
wxID_ANY, sizerFiltersBox);
|
||||
m_fltr[1] = CreateCheckBoxAndAddToSizer(sizerFilters, "C++ files (*.cpp; *.h)|*.cpp;*.h", wxID_ANY, sizerFiltersBox);
|
||||
m_fltr[2] = CreateCheckBoxAndAddToSizer(sizerFilters, "PNG images (*.png)|*.png", wxID_ANY, sizerFiltersBox);
|
||||
sizerLeft->Add(sizerFilters, wxSizerFlags().Expand().Border());
|
||||
|
||||
wxButton *btn = new wxButton(sizerFiltersBox, DirCtrlPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// keep consistency between enum and labels of radiobox
|
||||
wxCOMPILE_TIME_ASSERT( stdPathMax == WXSIZEOF(stdPaths), EnumForRadioBoxMismatch);
|
||||
|
||||
// middle pane
|
||||
m_radioStdPath = new wxRadioBox(this, wxID_ANY, "Standard path",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(stdPaths), stdPaths, 1);
|
||||
|
||||
// right pane
|
||||
m_dirCtrl = new wxGenericDirCtrl(
|
||||
this,
|
||||
DirCtrlPage_Ctrl,
|
||||
wxDirDialogDefaultFolderStr,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
0
|
||||
);
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(m_radioStdPath, 0, wxGROW | wxALL , 10);
|
||||
sizerTop->Add(m_dirCtrl, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
SetSizer(sizerTop);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::Reset()
|
||||
{
|
||||
m_path->Clear();
|
||||
|
||||
m_chkDirOnly->SetValue(false);
|
||||
m_chk3D->SetValue(false);
|
||||
m_chkFirst->SetValue(false);
|
||||
m_chkFilters->SetValue(false);
|
||||
m_chkLabels->SetValue(false);
|
||||
m_chkMulti->SetValue(false);
|
||||
|
||||
m_radioStdPath->SetSelection(0);
|
||||
|
||||
for ( size_t i = 0; i < WXSIZEOF(m_fltr); ++i )
|
||||
m_fltr[i]->SetValue(false);
|
||||
|
||||
CreateDirCtrl(true);
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::CreateDirCtrl(bool defaultPath)
|
||||
{
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
if ( m_chkDirOnly->IsChecked() )
|
||||
style |= wxDIRCTRL_DIR_ONLY;
|
||||
if ( m_chk3D->IsChecked() )
|
||||
style |= wxDIRCTRL_3D_INTERNAL;
|
||||
if ( m_chkFirst->IsChecked() )
|
||||
style |= wxDIRCTRL_SELECT_FIRST;
|
||||
if ( m_chkFilters->IsChecked() )
|
||||
style |= wxDIRCTRL_SHOW_FILTERS;
|
||||
if ( m_chkLabels->IsChecked() )
|
||||
style |= wxDIRCTRL_EDIT_LABELS;
|
||||
if ( m_chkMulti->IsChecked() )
|
||||
style |= wxDIRCTRL_MULTIPLE;
|
||||
|
||||
|
||||
wxGenericDirCtrl *dirCtrl = new wxGenericDirCtrl(
|
||||
this,
|
||||
DirCtrlPage_Ctrl,
|
||||
defaultPath ? wxString(wxDirDialogDefaultFolderStr) : m_dirCtrl->GetPath(),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
style
|
||||
);
|
||||
|
||||
wxString filter;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (m_fltr[i]->IsChecked())
|
||||
{
|
||||
if (!filter.IsEmpty())
|
||||
filter += "|";
|
||||
filter += m_fltr[i]->GetLabel();
|
||||
}
|
||||
}
|
||||
dirCtrl->SetFilter(filter);
|
||||
|
||||
// update sizer's child window
|
||||
GetSizer()->Replace(m_dirCtrl, dirCtrl, true);
|
||||
|
||||
// update our pointer
|
||||
delete m_dirCtrl;
|
||||
m_dirCtrl = dirCtrl;
|
||||
|
||||
NotifyWidgetRecreation(m_dirCtrl);
|
||||
|
||||
// relayout the sizer
|
||||
GetSizer()->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void DirCtrlWidgetsPage::OnButtonSetPath(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_dirCtrl->SetPath(m_path->GetValue());
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateDirCtrl();
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::OnCheckBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateDirCtrl();
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::OnRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString path;
|
||||
|
||||
wxTheApp->SetAppName("widgets");
|
||||
wxStandardPathsBase& stdp = wxStandardPaths::Get();
|
||||
|
||||
switch ( m_radioStdPath->GetSelection() )
|
||||
{
|
||||
default:
|
||||
case stdPathUnknown:
|
||||
case stdPathMax:
|
||||
// leave path
|
||||
break;
|
||||
|
||||
case stdPathConfig:
|
||||
path = stdp.GetConfigDir();
|
||||
break;
|
||||
|
||||
case stdPathData:
|
||||
path = stdp.GetDataDir();
|
||||
break;
|
||||
|
||||
case stdPathDocuments:
|
||||
path = stdp.GetDocumentsDir();
|
||||
break;
|
||||
|
||||
case stdPathLocalData:
|
||||
path = stdp.GetLocalDataDir();
|
||||
break;
|
||||
|
||||
case stdPathPlugins:
|
||||
path = stdp.GetPluginsDir();
|
||||
break;
|
||||
|
||||
case stdPathResources:
|
||||
path = stdp.GetResourcesDir();
|
||||
break;
|
||||
|
||||
case stdPathUserConfig:
|
||||
path = stdp.GetUserConfigDir();
|
||||
break;
|
||||
|
||||
case stdPathUserData:
|
||||
path = stdp.GetUserDataDir();
|
||||
break;
|
||||
|
||||
case stdPathUserLocalData:
|
||||
path = stdp.GetUserLocalDataDir();
|
||||
break;
|
||||
}
|
||||
|
||||
m_dirCtrl->SetPath(path);
|
||||
|
||||
// Notice that we must use wxFileName comparison instead of simple wxString
|
||||
// comparison as the paths returned may differ by case only.
|
||||
if ( wxFileName(m_dirCtrl->GetPath()) != path )
|
||||
{
|
||||
wxLogMessage("Failed to go to \"%s\", the current path is \"%s\".",
|
||||
path, m_dirCtrl->GetPath());
|
||||
}
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::OnSelChanged(wxTreeEvent& event)
|
||||
{
|
||||
if ( m_dirCtrl )
|
||||
{
|
||||
wxLogMessage("Selection changed to \"%s\"",
|
||||
m_dirCtrl->GetPath(event.GetItem()));
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void DirCtrlWidgetsPage::OnFileActivated(wxTreeEvent& event)
|
||||
{
|
||||
if ( m_dirCtrl )
|
||||
{
|
||||
wxLogMessage("File activated \"%s\"",
|
||||
m_dirCtrl->GetPath(event.GetItem()));
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#endif // wxUSE_DIRDLG
|
||||
271
libs/wxWidgets-3.3.1/samples/widgets/dirpicker.cpp
Normal file
271
libs/wxWidgets-3.3.1/samples/widgets/dirpicker.cpp
Normal file
@@ -0,0 +1,271 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: dirpicker.cpp
|
||||
// Purpose: Shows wxDirPickerCtrl
|
||||
// Author: Francesco Montorsi
|
||||
// Created: 20/6/2006
|
||||
// Copyright: (c) 2006 Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_DIRPICKERCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#include "wx/filepicker.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/dirpicker.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
PickerPage_Reset = wxID_HIGHEST,
|
||||
PickerPage_Dir,
|
||||
PickerPage_SetDir
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// DirPickerWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class DirPickerWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
DirPickerWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_dirPicker; }
|
||||
virtual void RecreateWidget() override { RecreatePicker(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
|
||||
// called only once at first construction
|
||||
void CreatePicker();
|
||||
|
||||
// called to recreate an existing control
|
||||
void RecreatePicker();
|
||||
|
||||
// restore the checkboxes state to the initial values
|
||||
void Reset();
|
||||
|
||||
|
||||
void OnDirChange(wxFileDirPickerEvent &ev);
|
||||
void OnCheckBox(wxCommandEvent &ev);
|
||||
void OnButtonReset(wxCommandEvent &ev);
|
||||
void OnButtonSetDir(wxCommandEvent &ev);
|
||||
|
||||
|
||||
// the picker
|
||||
wxDirPickerCtrl *m_dirPicker;
|
||||
|
||||
|
||||
// other controls
|
||||
// --------------
|
||||
|
||||
wxCheckBox *m_chkDirTextCtrl,
|
||||
*m_chkDirChangeDir,
|
||||
*m_chkDirMustExist,
|
||||
*m_chkSmall;
|
||||
wxTextCtrl *m_textInitialDir;
|
||||
|
||||
wxBoxSizer *m_sizer;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(DirPickerWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(DirPickerWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(PickerPage_Reset, DirPickerWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(PickerPage_SetDir, DirPickerWidgetsPage::OnButtonSetDir)
|
||||
|
||||
EVT_DIRPICKER_CHANGED(PickerPage_Dir, DirPickerWidgetsPage::OnDirChange)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, DirPickerWidgetsPage::OnCheckBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(DirPickerWidgetsPage, "DirPicker",
|
||||
PICKER_CTRLS | FAMILY_CTRLS);
|
||||
|
||||
DirPickerWidgetsPage::DirPickerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, dirpicker_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void DirPickerWidgetsPage::CreateContent()
|
||||
{
|
||||
// left pane
|
||||
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxStaticBoxSizer *sizerStyle = new wxStaticBoxSizer(wxVERTICAL, this, "&DirPicker style");
|
||||
wxStaticBox* const sizerStyleBox = sizerStyle->GetStaticBox();
|
||||
|
||||
m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(sizerStyle, "With textctrl", wxID_ANY, sizerStyleBox);
|
||||
m_chkDirMustExist = CreateCheckBoxAndAddToSizer(sizerStyle, "Dir must exist", wxID_ANY, sizerStyleBox);
|
||||
m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(sizerStyle, "Change working dir", wxID_ANY, sizerStyleBox);
|
||||
m_chkSmall = CreateCheckBoxAndAddToSizer(sizerStyle, "&Small version", wxID_ANY, sizerStyleBox);
|
||||
sizerLeft->Add(sizerStyle, 0, wxALL|wxGROW, 5);
|
||||
|
||||
sizerLeft->Add(CreateSizerWithTextAndButton
|
||||
(
|
||||
PickerPage_SetDir,
|
||||
"&Initial directory",
|
||||
wxID_ANY,
|
||||
&m_textInitialDir
|
||||
), wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerLeft->AddSpacer(10);
|
||||
|
||||
sizerLeft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
|
||||
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
Reset(); // set checkboxes state
|
||||
|
||||
// create pickers
|
||||
m_dirPicker = nullptr;
|
||||
CreatePicker();
|
||||
|
||||
// right pane
|
||||
m_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer->Add(1, 1, 1, wxGROW | wxALL, 5); // spacer
|
||||
m_sizer->Add(m_dirPicker, 0, wxEXPAND|wxALL, 5);
|
||||
m_sizer->Add(1, 1, 1, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
// global pane
|
||||
wxSizer *sz = new wxBoxSizer(wxHORIZONTAL);
|
||||
sz->Add(sizerLeft, 0, wxGROW|wxALL, 5);
|
||||
sz->Add(m_sizer, 1, wxGROW|wxALL, 5);
|
||||
|
||||
SetSizer(sz);
|
||||
}
|
||||
|
||||
void DirPickerWidgetsPage::CreatePicker()
|
||||
{
|
||||
delete m_dirPicker;
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkDirTextCtrl->GetValue() )
|
||||
style |= wxDIRP_USE_TEXTCTRL;
|
||||
|
||||
if ( m_chkDirMustExist->GetValue() )
|
||||
style |= wxDIRP_DIR_MUST_EXIST;
|
||||
|
||||
if ( m_chkDirChangeDir->GetValue() )
|
||||
style |= wxDIRP_CHANGE_DIR;
|
||||
|
||||
if ( m_chkSmall->GetValue() )
|
||||
style |= wxDIRP_SMALL;
|
||||
|
||||
m_dirPicker = new wxDirPickerCtrl(this, PickerPage_Dir,
|
||||
wxGetHomeDir(), "Hello!",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
|
||||
NotifyWidgetRecreation(m_dirPicker);
|
||||
}
|
||||
|
||||
void DirPickerWidgetsPage::RecreatePicker()
|
||||
{
|
||||
m_sizer->Remove(1);
|
||||
CreatePicker();
|
||||
m_sizer->Insert(1, m_dirPicker, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
m_sizer->Layout();
|
||||
}
|
||||
|
||||
void DirPickerWidgetsPage::Reset()
|
||||
{
|
||||
m_chkDirTextCtrl->SetValue((wxDIRP_DEFAULT_STYLE & wxDIRP_USE_TEXTCTRL) != 0);
|
||||
m_chkDirMustExist->SetValue((wxDIRP_DEFAULT_STYLE & wxDIRP_DIR_MUST_EXIST) != 0);
|
||||
m_chkDirChangeDir->SetValue((wxDIRP_DEFAULT_STYLE & wxDIRP_CHANGE_DIR) != 0);
|
||||
m_chkSmall->SetValue((wxFLP_DEFAULT_STYLE & wxDIRP_SMALL) != 0);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void DirPickerWidgetsPage::OnButtonSetDir(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_dirPicker->SetInitialDirectory(m_textInitialDir->GetValue());
|
||||
}
|
||||
|
||||
void DirPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
RecreatePicker();
|
||||
}
|
||||
|
||||
void DirPickerWidgetsPage::OnDirChange(wxFileDirPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("The directory changed to '%s' (the control has '%s')."
|
||||
"The current working directory is '%s'",
|
||||
event.GetPath(),
|
||||
m_dirPicker->GetDirName().GetFullPath(),
|
||||
wxGetCwd());
|
||||
|
||||
wxLogMessage("The directory changed to '%s' ! The current working directory is '%s'",
|
||||
event.GetPath(), wxGetCwd());
|
||||
}
|
||||
|
||||
void DirPickerWidgetsPage::OnCheckBox(wxCommandEvent &event)
|
||||
{
|
||||
if (event.GetEventObject() == m_chkDirTextCtrl ||
|
||||
event.GetEventObject() == m_chkDirChangeDir ||
|
||||
event.GetEventObject() == m_chkDirMustExist ||
|
||||
event.GetEventObject() == m_chkSmall)
|
||||
RecreatePicker();
|
||||
}
|
||||
|
||||
#endif // wxUSE_DIRPICKERCTRL
|
||||
224
libs/wxWidgets-3.3.1/samples/widgets/editlbox.cpp
Normal file
224
libs/wxWidgets-3.3.1/samples/widgets/editlbox.cpp
Normal file
@@ -0,0 +1,224 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: editlbox.cpp
|
||||
// Purpose: Part of the widgets sample showing wxEditableListbox
|
||||
// Author: Francesco Montorsi
|
||||
// Created: 8/2/2009
|
||||
// Copyright: (c) 2009 Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_EDITABLELISTBOX
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/listbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/editlbox.h"
|
||||
#include "wx/listctrl.h"
|
||||
|
||||
#include "itemcontainer.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/listbox.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
EditableListboxPage_Reset = wxID_HIGHEST,
|
||||
EditableListboxPage_Listbox,
|
||||
EditableListboxPage_ContainerTests
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// EditableListboxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class EditableListboxWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
EditableListboxWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_lbox->GetListCtrl(); }
|
||||
virtual void RecreateWidget() override { CreateLbox(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnCheckBox(wxCommandEvent& event);
|
||||
|
||||
// reset the listbox parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the listbox
|
||||
void CreateLbox();
|
||||
|
||||
// the checkboxes
|
||||
wxCheckBox *m_chkAllowNew,
|
||||
*m_chkAllowEdit,
|
||||
*m_chkAllowDelete,
|
||||
*m_chkAllowNoReorder;
|
||||
|
||||
wxEditableListBox
|
||||
*m_lbox;
|
||||
|
||||
wxSizer *m_sizerLbox;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(EditableListboxWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(EditableListboxWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(EditableListboxPage_Reset, EditableListboxWidgetsPage::OnButtonReset)
|
||||
EVT_CHECKBOX(wxID_ANY, EditableListboxWidgetsPage::OnCheckBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(EditableListboxWidgetsPage, "EditableListbox", GENERIC_CTRLS);
|
||||
|
||||
EditableListboxWidgetsPage::EditableListboxWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, listbox_xpm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EditableListboxWidgetsPage::CreateContent()
|
||||
{
|
||||
/*
|
||||
What we create here is a frame having 2 panes: style pane is the
|
||||
leftmost one and the pane containing the listbox itself to the right
|
||||
*/
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set listbox parameters");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkAllowNew = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow new items", wxID_ANY, sizerLeftBox);
|
||||
m_chkAllowEdit = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow editing items", wxID_ANY, sizerLeftBox);
|
||||
m_chkAllowDelete = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow deleting items", wxID_ANY, sizerLeftBox);
|
||||
m_chkAllowNoReorder = CreateCheckBoxAndAddToSizer(sizerLeft, "Block user reordering", wxID_ANY, sizerLeftBox);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, EditableListboxPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
m_lbox = new wxEditableListBox(this, EditableListboxPage_Listbox,
|
||||
_("Match these wildcards:"),
|
||||
wxDefaultPosition, wxDefaultSize, 0);
|
||||
sizerRight->Add(m_lbox, 1, wxGROW | wxALL, 5);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerLbox = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void EditableListboxWidgetsPage::Reset()
|
||||
{
|
||||
m_chkAllowNew->SetValue(false);
|
||||
m_chkAllowEdit->SetValue(false);
|
||||
m_chkAllowDelete->SetValue(false);
|
||||
m_chkAllowNoReorder->SetValue(false);
|
||||
}
|
||||
|
||||
void EditableListboxWidgetsPage::CreateLbox()
|
||||
{
|
||||
long flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkAllowNew->GetValue() )
|
||||
flags |= wxEL_ALLOW_NEW;
|
||||
if ( m_chkAllowEdit->GetValue() )
|
||||
flags |= wxEL_ALLOW_EDIT;
|
||||
if ( m_chkAllowDelete->GetValue() )
|
||||
flags |= wxEL_ALLOW_DELETE;
|
||||
if ( m_chkAllowNoReorder->GetValue() )
|
||||
flags |= wxEL_NO_REORDER;
|
||||
|
||||
wxArrayString items;
|
||||
if ( m_lbox )
|
||||
{
|
||||
m_lbox->GetStrings(items);
|
||||
m_sizerLbox->Detach( m_lbox );
|
||||
delete m_lbox;
|
||||
}
|
||||
|
||||
m_lbox = new wxEditableListBox(this, EditableListboxPage_Listbox,
|
||||
_("Match these wildcards:"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_lbox);
|
||||
|
||||
m_lbox->SetStrings(items);
|
||||
m_sizerLbox->Add(m_lbox, 1, wxGROW | wxALL, 5);
|
||||
m_sizerLbox->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void EditableListboxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateLbox();
|
||||
}
|
||||
|
||||
void EditableListboxWidgetsPage::OnCheckBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateLbox();
|
||||
}
|
||||
|
||||
#endif // wxUSE_EDITABLELISTBOX
|
||||
341
libs/wxWidgets-3.3.1/samples/widgets/filectrl.cpp
Normal file
341
libs/wxWidgets-3.3.1/samples/widgets/filectrl.cpp
Normal file
@@ -0,0 +1,341 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: filectrl.cpp
|
||||
// Purpose: Part of the widgets sample showing wxFileCtrl
|
||||
// Author: Diaa M. Sami
|
||||
// Created: 28 Jul 2007
|
||||
// Copyright: (c) 2007 Diaa M. Sami
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_FILECTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/filectrl.h"
|
||||
|
||||
#include "wx/wupdlock.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
// TODO change this
|
||||
#include "icons/dirctrl.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
FileCtrlPage_Reset = wxID_HIGHEST,
|
||||
FileCtrlPage_SetDirectory,
|
||||
FileCtrlPage_SetPath,
|
||||
FileCtrlPage_SetFilename,
|
||||
FileCtrlPage_Ctrl
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FileCtrlMode_Open = 0,
|
||||
FileCtrlMode_Save
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CheckBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class FileCtrlWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
FileCtrlWidgetsPage( WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist );
|
||||
virtual ~FileCtrlWidgetsPage() {}
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_fileCtrl; }
|
||||
virtual void RecreateWidget() override { CreateFileCtrl(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonSetDirectory( wxCommandEvent& event );
|
||||
void OnButtonSetPath( wxCommandEvent& event );
|
||||
void OnButtonSetFilename( wxCommandEvent& event );
|
||||
void OnButtonReset( wxCommandEvent& event );
|
||||
void OnCheckBox( wxCommandEvent& event );
|
||||
void OnSwitchMode( wxCommandEvent& event );
|
||||
void OnFileCtrl( wxFileCtrlEvent& event );
|
||||
|
||||
// reset the control parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the m_fileCtrl
|
||||
void CreateFileCtrl();
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the control itself and the sizer it is in
|
||||
wxFileCtrl *m_fileCtrl;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_dir;
|
||||
wxTextCtrl *m_path;
|
||||
wxTextCtrl *m_filename;
|
||||
|
||||
// flags
|
||||
wxCheckBox *m_chkMultiple,
|
||||
*m_chkNoShowHidden;
|
||||
|
||||
wxRadioBox *m_radioFileCtrlMode;
|
||||
|
||||
// filters
|
||||
wxCheckBox *m_fltr[3];
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE( FileCtrlWidgetsPage )
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE( FileCtrlWidgetsPage, WidgetsPage )
|
||||
EVT_BUTTON( FileCtrlPage_Reset, FileCtrlWidgetsPage::OnButtonReset )
|
||||
EVT_BUTTON( FileCtrlPage_SetDirectory, FileCtrlWidgetsPage::OnButtonSetDirectory )
|
||||
EVT_BUTTON( FileCtrlPage_SetPath, FileCtrlWidgetsPage::OnButtonSetPath )
|
||||
EVT_BUTTON( FileCtrlPage_SetFilename, FileCtrlWidgetsPage::OnButtonSetFilename )
|
||||
EVT_CHECKBOX( wxID_ANY, FileCtrlWidgetsPage::OnCheckBox )
|
||||
EVT_RADIOBOX( wxID_ANY, FileCtrlWidgetsPage::OnSwitchMode )
|
||||
|
||||
EVT_FILECTRL_FILTERCHANGED( wxID_ANY, FileCtrlWidgetsPage::OnFileCtrl )
|
||||
EVT_FILECTRL_FOLDERCHANGED( wxID_ANY, FileCtrlWidgetsPage::OnFileCtrl )
|
||||
EVT_FILECTRL_SELECTIONCHANGED( wxID_ANY, FileCtrlWidgetsPage::OnFileCtrl )
|
||||
EVT_FILECTRL_FILEACTIVATED( wxID_ANY, FileCtrlWidgetsPage::OnFileCtrl )
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE( FileCtrlWidgetsPage, "FileCtrl",
|
||||
FAMILY_CTRLS );
|
||||
|
||||
FileCtrlWidgetsPage::FileCtrlWidgetsPage( WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist )
|
||||
: WidgetsPage( book, imaglist, dirctrl_xpm )
|
||||
{
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
// left pane
|
||||
wxSizer *sizerLeft = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
static const wxString mode[] = { "open", "save" };
|
||||
m_radioFileCtrlMode = new wxRadioBox( this, wxID_ANY, "wxFileCtrl mode",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF( mode ), mode );
|
||||
|
||||
sizerLeft->Add( m_radioFileCtrlMode,
|
||||
0, wxALL | wxEXPAND , 5 );
|
||||
|
||||
sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetDirectory , "Set &directory", wxID_ANY, &m_dir ),
|
||||
0, wxALL | wxEXPAND , 5 );
|
||||
sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetPath , "Set &path", wxID_ANY, &m_path ),
|
||||
0, wxALL | wxEXPAND , 5 );
|
||||
sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetFilename , "Set &filename", wxID_ANY, &m_filename ),
|
||||
0, wxALL | wxEXPAND , 5 );
|
||||
|
||||
wxStaticBoxSizer *sizerFlags = new wxStaticBoxSizer( wxVERTICAL, this, "&Flags");
|
||||
wxStaticBox* const sizerFlagsBox = sizerFlags->GetStaticBox();
|
||||
|
||||
m_chkMultiple = CreateCheckBoxAndAddToSizer( sizerFlags, "wxFC_MULTIPLE", wxID_ANY, sizerFlagsBox );
|
||||
m_chkNoShowHidden = CreateCheckBoxAndAddToSizer( sizerFlags, "wxFC_NOSHOWHIDDEN", wxID_ANY, sizerFlagsBox );
|
||||
sizerLeft->Add( sizerFlags, wxSizerFlags().Expand().Border() );
|
||||
|
||||
wxStaticBoxSizer *sizerFilters = new wxStaticBoxSizer( wxVERTICAL, this, "&Filters");
|
||||
wxStaticBox* const sizerFiltersBox = sizerFilters->GetStaticBox();
|
||||
|
||||
m_fltr[0] = CreateCheckBoxAndAddToSizer( sizerFilters, wxString::Format("all files (%s)|%s",
|
||||
wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ), wxID_ANY, sizerFiltersBox );
|
||||
m_fltr[1] = CreateCheckBoxAndAddToSizer( sizerFilters, "C++ files (*.cpp; *.h)|*.cpp;*.h", wxID_ANY, sizerFiltersBox );
|
||||
m_fltr[2] = CreateCheckBoxAndAddToSizer( sizerFilters, "PNG images (*.png)|*.png", wxID_ANY, sizerFiltersBox );
|
||||
sizerLeft->Add( sizerFilters, wxSizerFlags().Expand().Border() );
|
||||
|
||||
wxButton *btn = new wxButton( this, FileCtrlPage_Reset, "&Reset" );
|
||||
sizerLeft->Add( btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15 );
|
||||
|
||||
// right pane
|
||||
m_fileCtrl = new wxFileCtrl(
|
||||
this,
|
||||
FileCtrlPage_Ctrl,
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxFC_OPEN,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize
|
||||
);
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add( sizerLeft, 0, ( wxALL & ~wxLEFT ), 10 );
|
||||
sizerTop->Add( m_fileCtrl, 1, wxGROW | ( wxALL & ~wxRIGHT ), 10 );
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer( sizerTop );
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::Reset()
|
||||
{
|
||||
m_dir->SetValue( m_fileCtrl->GetDirectory() );
|
||||
m_radioFileCtrlMode->SetSelection( ( wxFC_DEFAULT_STYLE & wxFC_OPEN ) ?
|
||||
FileCtrlMode_Open : FileCtrlMode_Save );
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::CreateFileCtrl()
|
||||
{
|
||||
wxWindowUpdateLocker noUpdates( this );
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_radioFileCtrlMode->GetSelection() == FileCtrlMode_Open )
|
||||
{
|
||||
style |= wxFC_OPEN;
|
||||
m_chkMultiple->Enable();
|
||||
if ( m_chkMultiple->IsChecked() )
|
||||
style |= wxFC_MULTIPLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
style |= wxFC_SAVE;
|
||||
// wxFC_SAVE is incompatible with wxFC_MULTIPLE
|
||||
m_chkMultiple->SetValue(false);
|
||||
m_chkMultiple->Enable(false);
|
||||
}
|
||||
|
||||
if ( m_chkNoShowHidden->IsChecked() )
|
||||
style |= wxFC_NOSHOWHIDDEN;
|
||||
|
||||
wxFileCtrl *fileCtrl = new wxFileCtrl(
|
||||
this,
|
||||
FileCtrlPage_Ctrl,
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
style,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize
|
||||
);
|
||||
|
||||
wxString wildcard;
|
||||
for ( unsigned int i = 0; i < WXSIZEOF( m_fltr ); ++i )
|
||||
{
|
||||
if ( m_fltr[i]->IsChecked() )
|
||||
{
|
||||
if ( !wildcard.IsEmpty() )
|
||||
wildcard += "|";
|
||||
wildcard += m_fltr[i]->GetLabel();
|
||||
}
|
||||
}
|
||||
fileCtrl->SetWildcard( wildcard );
|
||||
|
||||
// update sizer's child window
|
||||
GetSizer()->Replace( m_fileCtrl, fileCtrl, true );
|
||||
|
||||
// update our pointer
|
||||
delete m_fileCtrl;
|
||||
m_fileCtrl = fileCtrl;
|
||||
|
||||
NotifyWidgetRecreation(m_fileCtrl);
|
||||
|
||||
// relayout the sizer
|
||||
GetSizer()->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void FileCtrlWidgetsPage::OnButtonSetDirectory( wxCommandEvent& WXUNUSED( event ) )
|
||||
{
|
||||
m_fileCtrl->SetDirectory( m_dir->GetValue() );
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::OnButtonSetPath( wxCommandEvent& WXUNUSED( event ) )
|
||||
{
|
||||
m_fileCtrl->SetPath( m_path->GetValue() );
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::OnButtonSetFilename( wxCommandEvent& WXUNUSED( event ) )
|
||||
{
|
||||
m_fileCtrl->SetFilename( m_filename->GetValue() );
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::OnButtonReset( wxCommandEvent& WXUNUSED( event ) )
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateFileCtrl();
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::OnCheckBox( wxCommandEvent& WXUNUSED( event ) )
|
||||
{
|
||||
CreateFileCtrl();
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::OnSwitchMode( wxCommandEvent& WXUNUSED( event ) )
|
||||
{
|
||||
CreateFileCtrl();
|
||||
}
|
||||
|
||||
void FileCtrlWidgetsPage::OnFileCtrl( wxFileCtrlEvent& event )
|
||||
{
|
||||
if ( event.GetEventType() == wxEVT_FILECTRL_FOLDERCHANGED )
|
||||
{
|
||||
wxLogMessage("Folder changed event, new folder: %s", event.GetDirectory());
|
||||
}
|
||||
else if ( event.GetEventType() == wxEVT_FILECTRL_FILEACTIVATED )
|
||||
{
|
||||
wxLogMessage("File activated event: %s", wxJoin(event.GetFiles(), ' '));
|
||||
}
|
||||
else if ( event.GetEventType() == wxEVT_FILECTRL_SELECTIONCHANGED )
|
||||
{
|
||||
wxLogMessage("Selection changed event: %s", wxJoin(event.GetFiles(), ' '));
|
||||
}
|
||||
else if ( event.GetEventType() == wxEVT_FILECTRL_FILTERCHANGED )
|
||||
{
|
||||
wxLogMessage("Filter changed event: filter %d selected",
|
||||
event.GetFilterIndex() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_FILECTRL
|
||||
344
libs/wxWidgets-3.3.1/samples/widgets/filepicker.cpp
Normal file
344
libs/wxWidgets-3.3.1/samples/widgets/filepicker.cpp
Normal file
@@ -0,0 +1,344 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: filepicker.cpp
|
||||
// Purpose: Part of the widgets sample showing wx*PickerCtrl
|
||||
// Author: Francesco Montorsi
|
||||
// Created: 20/6/2006
|
||||
// Copyright: (c) 2006 Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_FILEPICKERCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#include "wx/filepicker.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/filepicker.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
enum
|
||||
{
|
||||
FilePickerMode_Open = 0,
|
||||
FilePickerMode_Save
|
||||
};
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
PickerPage_Reset = wxID_HIGHEST,
|
||||
PickerPage_File,
|
||||
PickerPage_SetDir,
|
||||
PickerPage_CurrentPath
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// FilePickerWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class FilePickerWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
FilePickerWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_filePicker; }
|
||||
virtual void RecreateWidget() override { RecreatePicker(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
|
||||
// called only once at first construction
|
||||
void CreatePicker();
|
||||
|
||||
// called to recreate an existing control
|
||||
void RecreatePicker();
|
||||
|
||||
// restore the checkboxes state to the initial values
|
||||
void Reset();
|
||||
|
||||
// update filepicker radiobox
|
||||
void UpdateFilePickerMode();
|
||||
|
||||
// the pickers and the relative event handlers
|
||||
void OnFileChange(wxFileDirPickerEvent &ev);
|
||||
void OnCheckBox(wxCommandEvent &ev);
|
||||
void OnButtonReset(wxCommandEvent &ev);
|
||||
void OnButtonSetDir(wxCommandEvent &ev);
|
||||
void OnUpdatePath(wxUpdateUIEvent &ev);
|
||||
|
||||
|
||||
// the picker
|
||||
wxFilePickerCtrl *m_filePicker;
|
||||
|
||||
|
||||
// other controls
|
||||
// --------------
|
||||
|
||||
wxCheckBox *m_chkFileTextCtrl,
|
||||
*m_chkFileOverwritePrompt,
|
||||
*m_chkFileMustExist,
|
||||
*m_chkFileChangeDir,
|
||||
*m_chkSmall;
|
||||
wxRadioBox *m_radioFilePickerMode;
|
||||
wxStaticText *m_labelPath;
|
||||
wxTextCtrl *m_textInitialDir;
|
||||
|
||||
wxBoxSizer *m_sizer;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(FilePickerWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(FilePickerWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(PickerPage_Reset, FilePickerWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(PickerPage_SetDir, FilePickerWidgetsPage::OnButtonSetDir)
|
||||
|
||||
EVT_FILEPICKER_CHANGED(PickerPage_File, FilePickerWidgetsPage::OnFileChange)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, FilePickerWidgetsPage::OnCheckBox)
|
||||
EVT_RADIOBOX(wxID_ANY, FilePickerWidgetsPage::OnCheckBox)
|
||||
|
||||
EVT_UPDATE_UI(PickerPage_CurrentPath, FilePickerWidgetsPage::OnUpdatePath)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(FilePickerWidgetsPage, "FilePicker",
|
||||
PICKER_CTRLS | FAMILY_CTRLS);
|
||||
|
||||
FilePickerWidgetsPage::FilePickerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, filepicker_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::CreateContent()
|
||||
{
|
||||
// left pane
|
||||
wxSizer *leftSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
static const wxString mode[] = { "open", "save" };
|
||||
m_radioFilePickerMode = new wxRadioBox(this, wxID_ANY, "wxFilePicker mode",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(mode), mode);
|
||||
leftSizer->Add(m_radioFilePickerMode, 0, wxALL|wxGROW, 5);
|
||||
|
||||
wxStaticBoxSizer *styleSizer = new wxStaticBoxSizer(wxVERTICAL, this, "&FilePicker style");
|
||||
wxStaticBox* const styleSizerBox = styleSizer->GetStaticBox();
|
||||
|
||||
m_chkFileTextCtrl = CreateCheckBoxAndAddToSizer(styleSizer, "With textctrl", wxID_ANY, styleSizerBox);
|
||||
m_chkFileOverwritePrompt = CreateCheckBoxAndAddToSizer(styleSizer, "Overwrite prompt", wxID_ANY, styleSizerBox);
|
||||
m_chkFileMustExist = CreateCheckBoxAndAddToSizer(styleSizer, "File must exist", wxID_ANY, styleSizerBox);
|
||||
m_chkFileChangeDir = CreateCheckBoxAndAddToSizer(styleSizer, "Change working dir", wxID_ANY, styleSizerBox);
|
||||
m_chkSmall = CreateCheckBoxAndAddToSizer(styleSizer, "&Small version", wxID_ANY, styleSizerBox);
|
||||
|
||||
leftSizer->Add(styleSizer, 0, wxALL|wxGROW, 5);
|
||||
|
||||
leftSizer->Add(CreateSizerWithTextAndButton
|
||||
(
|
||||
PickerPage_SetDir,
|
||||
"&Initial directory",
|
||||
wxID_ANY,
|
||||
&m_textInitialDir
|
||||
), wxSizerFlags().Expand().Border());
|
||||
|
||||
leftSizer->AddSpacer(10);
|
||||
|
||||
leftSizer->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
|
||||
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
Reset(); // set checkboxes state
|
||||
|
||||
// create the picker and the static text displaying its current value
|
||||
m_labelPath = new wxStaticText(this, PickerPage_CurrentPath, "");
|
||||
|
||||
m_filePicker = nullptr;
|
||||
CreatePicker();
|
||||
|
||||
// right pane
|
||||
m_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer->AddStretchSpacer();
|
||||
m_sizer->Add(m_filePicker, wxSizerFlags().Expand().Border());
|
||||
m_sizer->AddStretchSpacer();
|
||||
m_sizer->Add(m_labelPath, wxSizerFlags().Expand().Border());
|
||||
m_sizer->AddStretchSpacer();
|
||||
|
||||
// global pane
|
||||
wxSizer *sz = new wxBoxSizer(wxHORIZONTAL);
|
||||
sz->Add(leftSizer, 0, wxGROW|wxALL, 5);
|
||||
sz->Add(m_sizer, 1, wxGROW|wxALL, 5);
|
||||
|
||||
SetSizer(sz);
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::CreatePicker()
|
||||
{
|
||||
delete m_filePicker;
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkFileTextCtrl->GetValue() )
|
||||
style |= wxFLP_USE_TEXTCTRL;
|
||||
|
||||
if ( m_chkFileOverwritePrompt->GetValue() )
|
||||
style |= wxFLP_OVERWRITE_PROMPT;
|
||||
|
||||
if ( m_chkFileMustExist->GetValue() )
|
||||
style |= wxFLP_FILE_MUST_EXIST;
|
||||
|
||||
if ( m_chkFileChangeDir->GetValue() )
|
||||
style |= wxFLP_CHANGE_DIR;
|
||||
|
||||
if ( m_chkSmall->GetValue() )
|
||||
style |= wxFLP_SMALL;
|
||||
|
||||
if (m_radioFilePickerMode->GetSelection() == FilePickerMode_Open)
|
||||
style |= wxFLP_OPEN;
|
||||
else
|
||||
style |= wxFLP_SAVE;
|
||||
|
||||
// pass an empty string as initial file
|
||||
m_filePicker = new wxFilePickerCtrl(this, PickerPage_File,
|
||||
wxEmptyString,
|
||||
"Hello!", "*",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
|
||||
NotifyWidgetRecreation(m_filePicker);
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::RecreatePicker()
|
||||
{
|
||||
m_sizer->Remove(1);
|
||||
CreatePicker();
|
||||
m_sizer->Insert(1, m_filePicker, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
m_sizer->Layout();
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::Reset()
|
||||
{
|
||||
m_radioFilePickerMode->SetSelection((wxFLP_DEFAULT_STYLE & wxFLP_OPEN) ?
|
||||
FilePickerMode_Open : FilePickerMode_Save);
|
||||
m_chkFileTextCtrl->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_USE_TEXTCTRL) != 0);
|
||||
m_chkFileOverwritePrompt->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_OVERWRITE_PROMPT) != 0);
|
||||
m_chkFileMustExist->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_FILE_MUST_EXIST) != 0);
|
||||
m_chkFileChangeDir->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_CHANGE_DIR) != 0);
|
||||
m_chkSmall->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_SMALL) != 0);
|
||||
|
||||
UpdateFilePickerMode();
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::UpdateFilePickerMode()
|
||||
{
|
||||
switch (m_radioFilePickerMode->GetSelection())
|
||||
{
|
||||
case FilePickerMode_Open:
|
||||
m_chkFileOverwritePrompt->SetValue(false);
|
||||
m_chkFileOverwritePrompt->Disable();
|
||||
m_chkFileMustExist->Enable();
|
||||
break;
|
||||
case FilePickerMode_Save:
|
||||
m_chkFileMustExist->SetValue(false);
|
||||
m_chkFileMustExist->Disable();
|
||||
m_chkFileOverwritePrompt->Enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void FilePickerWidgetsPage::OnButtonSetDir(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
const wxString& dir = m_textInitialDir->GetValue();
|
||||
m_filePicker->SetInitialDirectory(dir);
|
||||
wxLogMessage("Initial directory set to \"%s\"", dir);
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
RecreatePicker();
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::OnFileChange(wxFileDirPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("The file changed to '%s' (the control has '%s')."
|
||||
"The current working directory is '%s'",
|
||||
event.GetPath(),
|
||||
m_filePicker->GetFileName().GetFullPath(),
|
||||
wxGetCwd());
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::OnCheckBox(wxCommandEvent &event)
|
||||
{
|
||||
if (event.GetEventObject() == m_chkFileTextCtrl ||
|
||||
event.GetEventObject() == m_chkFileOverwritePrompt ||
|
||||
event.GetEventObject() == m_chkFileMustExist ||
|
||||
event.GetEventObject() == m_chkFileChangeDir ||
|
||||
event.GetEventObject() == m_chkSmall)
|
||||
RecreatePicker();
|
||||
|
||||
if (event.GetEventObject() == m_radioFilePickerMode)
|
||||
{
|
||||
UpdateFilePickerMode();
|
||||
RecreatePicker();
|
||||
}
|
||||
}
|
||||
|
||||
void FilePickerWidgetsPage::OnUpdatePath(wxUpdateUIEvent& ev)
|
||||
{
|
||||
ev.SetText( "Current path: " + m_filePicker->GetPath() );
|
||||
}
|
||||
|
||||
#endif // wxUSE_FILEPICKERCTRL
|
||||
234
libs/wxWidgets-3.3.1/samples/widgets/fontpicker.cpp
Normal file
234
libs/wxWidgets-3.3.1/samples/widgets/fontpicker.cpp
Normal file
@@ -0,0 +1,234 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: fontpicker.cpp
|
||||
// Purpose: Shows wxFontPickerCtrl
|
||||
// Author: Francesco Montorsi
|
||||
// Created: 20/6/2006
|
||||
// Copyright: (c) 2006 Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_FONTPICKERCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#include "wx/fontpicker.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/fontpicker.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
PickerPage_Reset = wxID_HIGHEST,
|
||||
PickerPage_Font
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// FontPickerWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class FontPickerWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
FontPickerWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_fontPicker; }
|
||||
virtual void RecreateWidget() override { RecreatePicker(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
|
||||
// called only once at first construction
|
||||
void CreatePicker();
|
||||
|
||||
// called to recreate an existing control
|
||||
void RecreatePicker();
|
||||
|
||||
// restore the checkboxes state to the initial values
|
||||
void Reset();
|
||||
|
||||
|
||||
void OnFontChange(wxFontPickerEvent &ev);
|
||||
void OnCheckBox(wxCommandEvent &ev);
|
||||
void OnButtonReset(wxCommandEvent &ev);
|
||||
|
||||
// the picker
|
||||
wxFontPickerCtrl *m_fontPicker;
|
||||
|
||||
|
||||
// other controls
|
||||
// --------------
|
||||
|
||||
wxCheckBox *m_chkFontTextCtrl,
|
||||
*m_chkFontDescAsLabel,
|
||||
*m_chkFontUseFontForLabel;
|
||||
wxBoxSizer *m_sizer;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(FontPickerWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(FontPickerWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(PickerPage_Reset, FontPickerWidgetsPage::OnButtonReset)
|
||||
|
||||
EVT_FONTPICKER_CHANGED(PickerPage_Font, FontPickerWidgetsPage::OnFontChange)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, FontPickerWidgetsPage::OnCheckBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(FontPickerWidgetsPage, "FontPicker",
|
||||
PICKER_CTRLS | FAMILY_CTRLS);
|
||||
|
||||
FontPickerWidgetsPage::FontPickerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, fontpicker_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void FontPickerWidgetsPage::CreateContent()
|
||||
{
|
||||
// left pane
|
||||
wxSizer *leftSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxStaticBoxSizer *styleSizer = new wxStaticBoxSizer(wxVERTICAL, this, "&FontPicker style");
|
||||
wxStaticBox* const styleSizerBox = styleSizer->GetStaticBox();
|
||||
|
||||
m_chkFontTextCtrl = CreateCheckBoxAndAddToSizer(styleSizer, "With textctrl", wxID_ANY, styleSizerBox);
|
||||
m_chkFontDescAsLabel = CreateCheckBoxAndAddToSizer(styleSizer, "Font desc as btn label", wxID_ANY, styleSizerBox);
|
||||
m_chkFontUseFontForLabel = CreateCheckBoxAndAddToSizer(styleSizer, "Use font for label", wxID_ANY, styleSizerBox);
|
||||
leftSizer->Add(styleSizer, 0, wxALL|wxGROW, 5);
|
||||
|
||||
leftSizer->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
|
||||
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
Reset(); // set checkboxes state
|
||||
|
||||
// create pickers
|
||||
m_fontPicker = nullptr;
|
||||
CreatePicker();
|
||||
|
||||
// right pane
|
||||
m_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer->Add(1, 1, 1, wxGROW | wxALL, 5); // spacer
|
||||
m_sizer->Add(m_fontPicker, 0, wxALIGN_CENTER|wxALL, 5);
|
||||
m_sizer->Add(1, 1, 1, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
// global pane
|
||||
wxSizer *sz = new wxBoxSizer(wxHORIZONTAL);
|
||||
sz->Add(leftSizer, 0, wxGROW|wxALL, 5);
|
||||
sz->Add(m_sizer, 1, wxGROW|wxALL, 5);
|
||||
|
||||
SetSizer(sz);
|
||||
}
|
||||
|
||||
void FontPickerWidgetsPage::CreatePicker()
|
||||
{
|
||||
delete m_fontPicker;
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkFontTextCtrl->GetValue() )
|
||||
style |= wxFNTP_USE_TEXTCTRL;
|
||||
|
||||
if ( m_chkFontUseFontForLabel->GetValue() )
|
||||
style |= wxFNTP_USEFONT_FOR_LABEL;
|
||||
|
||||
if ( m_chkFontDescAsLabel->GetValue() )
|
||||
style |= wxFNTP_FONTDESC_AS_LABEL;
|
||||
|
||||
m_fontPicker = new wxFontPickerCtrl(this, PickerPage_Font,
|
||||
*wxSWISS_FONT,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
|
||||
NotifyWidgetRecreation(m_fontPicker);
|
||||
}
|
||||
|
||||
void FontPickerWidgetsPage::RecreatePicker()
|
||||
{
|
||||
m_sizer->Remove(1);
|
||||
CreatePicker();
|
||||
m_sizer->Insert(1, m_fontPicker, 0, wxALIGN_CENTER|wxALL, 5);
|
||||
|
||||
m_sizer->Layout();
|
||||
}
|
||||
|
||||
void FontPickerWidgetsPage::Reset()
|
||||
{
|
||||
m_chkFontTextCtrl->SetValue((wxFNTP_DEFAULT_STYLE & wxFNTP_USE_TEXTCTRL) != 0);
|
||||
m_chkFontUseFontForLabel->SetValue((wxFNTP_DEFAULT_STYLE & wxFNTP_USEFONT_FOR_LABEL) != 0);
|
||||
m_chkFontDescAsLabel->SetValue((wxFNTP_DEFAULT_STYLE & wxFNTP_FONTDESC_AS_LABEL) != 0);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void FontPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
RecreatePicker();
|
||||
}
|
||||
|
||||
void FontPickerWidgetsPage::OnFontChange(wxFontPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("The font changed to '%s' with size %d !",
|
||||
event.GetFont().GetFaceName(), event.GetFont().GetPointSize());
|
||||
}
|
||||
|
||||
void FontPickerWidgetsPage::OnCheckBox(wxCommandEvent &event)
|
||||
{
|
||||
if (event.GetEventObject() == m_chkFontTextCtrl ||
|
||||
event.GetEventObject() == m_chkFontDescAsLabel ||
|
||||
event.GetEventObject() == m_chkFontUseFontForLabel)
|
||||
RecreatePicker();
|
||||
}
|
||||
|
||||
#endif // wxUSE_FONTPICKERCTRL
|
||||
479
libs/wxWidgets-3.3.1/samples/widgets/gauge.cpp
Normal file
479
libs/wxWidgets-3.3.1/samples/widgets/gauge.cpp
Normal file
@@ -0,0 +1,479 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: gauge.cpp
|
||||
// Purpose: Part of the widgets sample showing wxGauge
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 27.03.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/timer.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/gauge.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "widgets.h"
|
||||
#if wxUSE_GAUGE
|
||||
#include "icons/gauge.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
GaugePage_Reset = wxID_HIGHEST,
|
||||
GaugePage_Progress,
|
||||
GaugePage_IndeterminateProgress,
|
||||
GaugePage_Clear,
|
||||
GaugePage_SetValue,
|
||||
GaugePage_SetRange,
|
||||
GaugePage_CurValueText,
|
||||
GaugePage_ValueText,
|
||||
GaugePage_RangeText,
|
||||
GaugePage_Timer,
|
||||
GaugePage_IndeterminateTimer,
|
||||
GaugePage_Gauge
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GaugeWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class GaugeWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
GaugeWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
virtual ~GaugeWidgetsPage();
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_gauge; }
|
||||
virtual void RecreateWidget() override { CreateGauge(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonProgress(wxCommandEvent& event);
|
||||
void OnButtonIndeterminateProgress(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonSetValue(wxCommandEvent& event);
|
||||
void OnButtonSetRange(wxCommandEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIValueButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIRangeButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUICurValueText(wxUpdateUIEvent& event);
|
||||
|
||||
void OnProgressTimer(wxTimerEvent& event);
|
||||
void OnIndeterminateProgressTimer(wxTimerEvent& event);
|
||||
|
||||
// reset the gauge parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the gauge
|
||||
void CreateGauge();
|
||||
|
||||
// start progress timer
|
||||
void StartTimer(wxButton*);
|
||||
|
||||
// stop the progress timer
|
||||
void StopTimer(wxButton*);
|
||||
|
||||
// the gauge range
|
||||
unsigned long m_range;
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the checkboxes for styles
|
||||
wxCheckBox *m_chkVert,
|
||||
*m_chkSmooth,
|
||||
*m_chkProgress;
|
||||
|
||||
// the gauge itself and the sizer it is in
|
||||
wxGauge *m_gauge;
|
||||
wxSizer *m_sizerGauge;
|
||||
|
||||
// the text entries for set value/range
|
||||
wxTextCtrl *m_textValue,
|
||||
*m_textRange;
|
||||
|
||||
// the timer for simulating gauge progress
|
||||
wxTimer *m_timer;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(GaugeWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(GaugeWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(GaugePage_Reset, GaugeWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(GaugePage_Progress, GaugeWidgetsPage::OnButtonProgress)
|
||||
EVT_BUTTON(GaugePage_IndeterminateProgress, GaugeWidgetsPage::OnButtonIndeterminateProgress)
|
||||
EVT_BUTTON(GaugePage_Clear, GaugeWidgetsPage::OnButtonClear)
|
||||
EVT_BUTTON(GaugePage_SetValue, GaugeWidgetsPage::OnButtonSetValue)
|
||||
EVT_BUTTON(GaugePage_SetRange, GaugeWidgetsPage::OnButtonSetRange)
|
||||
|
||||
EVT_UPDATE_UI(GaugePage_SetValue, GaugeWidgetsPage::OnUpdateUIValueButton)
|
||||
EVT_UPDATE_UI(GaugePage_SetRange, GaugeWidgetsPage::OnUpdateUIRangeButton)
|
||||
EVT_UPDATE_UI(GaugePage_Reset, GaugeWidgetsPage::OnUpdateUIResetButton)
|
||||
|
||||
EVT_UPDATE_UI(GaugePage_CurValueText, GaugeWidgetsPage::OnUpdateUICurValueText)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, GaugeWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, GaugeWidgetsPage::OnCheckOrRadioBox)
|
||||
|
||||
EVT_TIMER(GaugePage_Timer, GaugeWidgetsPage::OnProgressTimer)
|
||||
EVT_TIMER(GaugePage_IndeterminateTimer, GaugeWidgetsPage::OnIndeterminateProgressTimer)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, "Gauge", FAMILY_CTRLS );
|
||||
|
||||
GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
:WidgetsPage(book, imaglist, gauge_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_range = 100;
|
||||
|
||||
m_timer = nullptr;
|
||||
|
||||
m_chkVert =
|
||||
m_chkSmooth =
|
||||
m_chkProgress = nullptr;
|
||||
|
||||
m_gauge = nullptr;
|
||||
m_sizerGauge = nullptr;
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical", wxID_ANY, sizerLeftBox);
|
||||
m_chkSmooth = CreateCheckBoxAndAddToSizer(sizerLeft, "&Smooth", wxID_ANY, sizerLeftBox);
|
||||
m_chkProgress = CreateCheckBoxAndAddToSizer(sizerLeft, "&Progress", wxID_ANY, sizerLeftBox);
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, GaugePage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change gauge value");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxTextCtrl *text;
|
||||
wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value",
|
||||
GaugePage_CurValueText,
|
||||
&text,
|
||||
sizerMiddleBox);
|
||||
text->SetEditable(false);
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(GaugePage_SetValue,
|
||||
"Set &value",
|
||||
GaugePage_ValueText,
|
||||
&m_textValue,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(GaugePage_SetRange,
|
||||
"Set &range",
|
||||
GaugePage_RangeText,
|
||||
&m_textRange,
|
||||
sizerMiddleBox);
|
||||
m_textRange->SetValue( wxString::Format("%lu", m_range) );
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, GaugePage_Progress, "Simulate &progress");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, GaugePage_IndeterminateProgress,
|
||||
"Simulate &indeterminate job");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, GaugePage_Clear, "&Clear");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_gauge = new wxGauge(this, GaugePage_Gauge, m_range);
|
||||
sizerRight->Add(m_gauge, 1, wxCENTRE | wxALL, 5);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerGauge = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
GaugeWidgetsPage::~GaugeWidgetsPage()
|
||||
{
|
||||
delete m_timer;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void GaugeWidgetsPage::Reset()
|
||||
{
|
||||
m_chkVert->SetValue(false);
|
||||
m_chkSmooth->SetValue(false);
|
||||
m_chkProgress->SetValue(false);
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::CreateGauge()
|
||||
{
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkVert->GetValue() )
|
||||
flags |= wxGA_VERTICAL;
|
||||
else
|
||||
flags |= wxGA_HORIZONTAL;
|
||||
|
||||
if ( m_chkSmooth->GetValue() )
|
||||
flags |= wxGA_SMOOTH;
|
||||
|
||||
if ( m_chkProgress->GetValue() )
|
||||
flags |= wxGA_PROGRESS;
|
||||
|
||||
int val = 0;
|
||||
if ( m_gauge )
|
||||
{
|
||||
val = m_gauge->GetValue();
|
||||
|
||||
m_sizerGauge->Detach( m_gauge );
|
||||
delete m_gauge;
|
||||
}
|
||||
|
||||
m_gauge = new wxGauge(this, GaugePage_Gauge, m_range,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_gauge);
|
||||
|
||||
m_gauge->SetValue(val);
|
||||
|
||||
if ( flags & wxGA_VERTICAL )
|
||||
m_sizerGauge->Add(m_gauge, 0, wxGROW | wxALL, 5);
|
||||
else
|
||||
m_sizerGauge->Add(m_gauge, 1, wxCENTRE | wxALL, 5);
|
||||
|
||||
m_sizerGauge->Layout();
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::StartTimer(wxButton *clicked)
|
||||
{
|
||||
static const int INTERVAL = 300;
|
||||
|
||||
wxLogMessage("Launched progress timer (interval = %d ms)", INTERVAL);
|
||||
|
||||
m_timer = new wxTimer(this,
|
||||
clicked->GetId() == GaugePage_Progress ? GaugePage_Timer : GaugePage_IndeterminateTimer);
|
||||
m_timer->Start(INTERVAL);
|
||||
|
||||
clicked->SetLabel("&Stop timer");
|
||||
|
||||
if (clicked->GetId() == GaugePage_Progress)
|
||||
FindWindow(GaugePage_IndeterminateProgress)->Disable();
|
||||
else
|
||||
FindWindow(GaugePage_Progress)->Disable();
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::StopTimer(wxButton *clicked)
|
||||
{
|
||||
wxCHECK_RET( m_timer, "shouldn't be called" );
|
||||
|
||||
m_timer->Stop();
|
||||
wxDELETE(m_timer);
|
||||
|
||||
if (clicked->GetId() == GaugePage_Progress)
|
||||
{
|
||||
clicked->SetLabel("Simulate &progress");
|
||||
FindWindow(GaugePage_IndeterminateProgress)->Enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
clicked->SetLabel("Simulate indeterminate job");
|
||||
FindWindow(GaugePage_Progress)->Enable();
|
||||
}
|
||||
|
||||
wxLogMessage("Progress finished.");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void GaugeWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateGauge();
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnButtonProgress(wxCommandEvent& event)
|
||||
{
|
||||
wxButton *b = (wxButton *)event.GetEventObject();
|
||||
if ( !m_timer )
|
||||
{
|
||||
StartTimer(b);
|
||||
}
|
||||
else // stop the running timer
|
||||
{
|
||||
StopTimer(b);
|
||||
|
||||
wxLogMessage("Stopped the timer.");
|
||||
}
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnButtonIndeterminateProgress(wxCommandEvent& event)
|
||||
{
|
||||
wxButton *b = (wxButton *)event.GetEventObject();
|
||||
if ( !m_timer )
|
||||
{
|
||||
StartTimer(b);
|
||||
}
|
||||
else // stop the running timer
|
||||
{
|
||||
StopTimer(b);
|
||||
|
||||
m_gauge->SetValue(0);
|
||||
|
||||
wxLogMessage("Stopped the timer.");
|
||||
}
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_gauge->SetValue(0);
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnButtonSetRange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long val;
|
||||
if ( !m_textRange->GetValue().ToULong(&val) )
|
||||
return;
|
||||
|
||||
m_range = val;
|
||||
m_gauge->SetRange(val);
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long val;
|
||||
if ( !m_textValue->GetValue().ToULong(&val) )
|
||||
return;
|
||||
|
||||
m_gauge->SetValue(val);
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnUpdateUIValueButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
unsigned long val;
|
||||
event.Enable( m_textValue->GetValue().ToULong(&val) && (val <= m_range) );
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnUpdateUIRangeButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
unsigned long val;
|
||||
event.Enable( m_textRange->GetValue().ToULong(&val) );
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( m_chkVert->GetValue() || m_chkSmooth->GetValue() ||
|
||||
m_chkProgress->GetValue() );
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateGauge();
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnProgressTimer(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
int val = m_gauge->GetValue();
|
||||
if ( (unsigned)val < m_range )
|
||||
{
|
||||
m_gauge->SetValue(val + 1);
|
||||
}
|
||||
else // reached the end
|
||||
{
|
||||
wxButton *btn = (wxButton *)FindWindow(GaugePage_Progress);
|
||||
wxCHECK_RET( btn, "no progress button?" );
|
||||
|
||||
StopTimer(btn);
|
||||
}
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnIndeterminateProgressTimer(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
m_gauge->Pulse();
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.SetText( wxString::Format("%d", m_gauge->GetValue()));
|
||||
}
|
||||
|
||||
#endif
|
||||
// wxUSE_GAUGE
|
||||
335
libs/wxWidgets-3.3.1/samples/widgets/headerctrl.cpp
Normal file
335
libs/wxWidgets-3.3.1/samples/widgets/headerctrl.cpp
Normal file
@@ -0,0 +1,335 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: headerctrl.cpp
|
||||
// Purpose: Part of the widgets sample showing wxHeaderCtrl
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2016-04-17
|
||||
// Copyright: (c) 2016 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_HEADERCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/stattext.h"
|
||||
#endif
|
||||
|
||||
#include "wx/headerctrl.h"
|
||||
|
||||
#include "wx/artprov.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/header.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// HeaderCtrlWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define NUMBER_OF_COLUMNS 4
|
||||
|
||||
class HeaderCtrlWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
HeaderCtrlWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, header_xpm)
|
||||
{
|
||||
m_header = nullptr;
|
||||
m_sizerHeader = nullptr;
|
||||
}
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_header; }
|
||||
virtual void RecreateWidget() override;
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnStyleCheckOrRadioBox(wxCommandEvent& evt);
|
||||
void OnResetButton(wxCommandEvent& evt);
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& evt);
|
||||
void OnResizing(wxHeaderCtrlEvent& evt);
|
||||
void OnBeginResize(wxHeaderCtrlEvent& evt);
|
||||
void OnEndResize(wxHeaderCtrlEvent& evt);
|
||||
|
||||
// reset the header style
|
||||
void ResetHeaderStyle();
|
||||
// compose header style flags based on selections
|
||||
long GetHeaderStyleFlags() const;
|
||||
// reset column style
|
||||
void ResetColumnStyle(int col);
|
||||
// compose column style flags based on selections
|
||||
int GetColumnStyleFlags(int col) const;
|
||||
// get column alignment flags based on selection
|
||||
wxAlignment GetColumnAlignmentFlag(int col) const;
|
||||
|
||||
// the control itself and the sizer it is in
|
||||
wxHeaderCtrlSimple *m_header;
|
||||
wxStaticBoxSizer *m_sizerHeader;
|
||||
// the check boxes for header styles
|
||||
wxCheckBox *m_chkAllowReorder;
|
||||
wxCheckBox *m_chkAllowHide;
|
||||
wxCheckBox *m_chkBitmapOnRight;
|
||||
// The check boxes for column styles
|
||||
struct
|
||||
{
|
||||
wxCheckBox *chkAllowResize;
|
||||
wxCheckBox *chkAllowReorder;
|
||||
wxCheckBox *chkAllowSort;
|
||||
wxCheckBox *chkAllowHide;
|
||||
wxCheckBox *chkWithBitmap;
|
||||
wxRadioBox *rbAlignments;
|
||||
} m_colSettings[NUMBER_OF_COLUMNS];
|
||||
|
||||
private:
|
||||
DECLARE_WIDGETS_PAGE(HeaderCtrlWidgetsPage)
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||
#define HEADER_CTRL_FAMILY NATIVE_CTRLS
|
||||
#else
|
||||
#define HEADER_CTRL_FAMILY GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(HeaderCtrlWidgetsPage, "Header", HEADER_CTRL_FAMILY);
|
||||
|
||||
static const wxString gs_colAlignments[] = { "none", "left", "centre", "right" };
|
||||
static const wxAlignment gs_colAlignFlags[] = { wxALIGN_NOT, wxALIGN_LEFT, wxALIGN_CENTRE, wxALIGN_RIGHT };
|
||||
#define COL_WITH_BITMAP_DEFAULT false
|
||||
#define COL_ALIGNMENT_FLAG_DEFAULT wxALIGN_NOT
|
||||
#define COL_ALIGNMENT_INDEX_DEFAULT 0
|
||||
|
||||
void HeaderCtrlWidgetsPage::CreateContent()
|
||||
{
|
||||
// top pane
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// header style
|
||||
wxStaticBoxSizer *styleSizer = new wxStaticBoxSizer(wxVERTICAL, this, "&Header style");
|
||||
wxStaticBox* const styleSizerBox = styleSizer->GetStaticBox();
|
||||
|
||||
m_chkAllowReorder = CreateCheckBoxAndAddToSizer(styleSizer, "Allow &reorder", wxID_ANY, styleSizerBox);
|
||||
m_chkAllowHide = CreateCheckBoxAndAddToSizer(styleSizer, "Alow &hide", wxID_ANY, styleSizerBox);
|
||||
m_chkBitmapOnRight = CreateCheckBoxAndAddToSizer(styleSizer, "&Bitmap on right", wxID_ANY, styleSizerBox);
|
||||
ResetHeaderStyle();
|
||||
|
||||
styleSizer->AddStretchSpacer();
|
||||
wxButton* btnReset = new wxButton(styleSizerBox, wxID_ANY, "&Reset");
|
||||
styleSizer->Add(btnReset, wxSizerFlags().CenterHorizontal().Border());
|
||||
sizerTop->Add(styleSizer, wxSizerFlags().Expand());
|
||||
|
||||
// column flags
|
||||
for ( int i = 0; i < (int)WXSIZEOF(m_colSettings); i++ )
|
||||
{
|
||||
wxStaticBoxSizer* sizerCol = new wxStaticBoxSizer(wxVERTICAL, this, wxString::Format("Column %i style", i+1));
|
||||
wxStaticBox* const sizerColBox = sizerCol->GetStaticBox();
|
||||
|
||||
m_colSettings[i].chkAllowResize = CreateCheckBoxAndAddToSizer(sizerCol, "Allow resize", wxID_ANY, sizerColBox);
|
||||
m_colSettings[i].chkAllowReorder = CreateCheckBoxAndAddToSizer(sizerCol, "Allow reorder", wxID_ANY, sizerColBox);
|
||||
m_colSettings[i].chkAllowSort = CreateCheckBoxAndAddToSizer(sizerCol, "Allow sort", wxID_ANY, sizerColBox);
|
||||
m_colSettings[i].chkAllowHide = CreateCheckBoxAndAddToSizer(sizerCol, "Hidden", wxID_ANY, sizerColBox);
|
||||
m_colSettings[i].chkWithBitmap = CreateCheckBoxAndAddToSizer(sizerCol, "With bitmap", wxID_ANY, sizerColBox);
|
||||
m_colSettings[i].rbAlignments = new wxRadioBox(sizerColBox, wxID_ANY, "Alignment",
|
||||
wxDefaultPosition, wxDefaultSize, WXSIZEOF(gs_colAlignments), gs_colAlignments,
|
||||
2, wxRA_SPECIFY_COLS);
|
||||
sizerCol->Add(m_colSettings[i].rbAlignments, wxSizerFlags().Expand().Border());
|
||||
ResetColumnStyle(i);
|
||||
sizerTop->AddSpacer(15);
|
||||
sizerTop->Add(sizerCol, wxSizerFlags().Expand());
|
||||
}
|
||||
|
||||
// bottom pane
|
||||
m_sizerHeader = new wxStaticBoxSizer(wxVERTICAL, this, "Header");
|
||||
RecreateWidget();
|
||||
|
||||
// the 2 panes compose the window
|
||||
wxSizer* sizerAll = new wxBoxSizer(wxVERTICAL);
|
||||
sizerAll->Add(sizerTop, wxSizerFlags().Expand().Border());
|
||||
sizerAll->Add(m_sizerHeader, wxSizerFlags(1).Expand().Border());
|
||||
|
||||
SetSizer(sizerAll);
|
||||
|
||||
// Bind event handlers
|
||||
m_chkAllowReorder->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
m_chkAllowHide->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
m_chkBitmapOnRight->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
for ( int i = 0; i < (int)WXSIZEOF(m_colSettings); i++ )
|
||||
{
|
||||
m_colSettings[i].chkAllowResize->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
m_colSettings[i].chkAllowReorder->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
m_colSettings[i].chkAllowSort->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
m_colSettings[i].chkAllowHide->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
m_colSettings[i].chkWithBitmap->Bind(wxEVT_CHECKBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
m_colSettings[i].rbAlignments->Bind(wxEVT_RADIOBOX, &HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox, this);
|
||||
}
|
||||
btnReset->Bind(wxEVT_BUTTON, &HeaderCtrlWidgetsPage::OnResetButton, this);
|
||||
btnReset->Bind(wxEVT_UPDATE_UI, &HeaderCtrlWidgetsPage::OnUpdateUIResetButton, this);
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::RecreateWidget()
|
||||
{
|
||||
m_sizerHeader->Clear(true /* delete windows */);
|
||||
|
||||
long flags = GetAttrs().m_defaultFlags | GetHeaderStyleFlags();
|
||||
|
||||
m_header = new wxHeaderCtrlSimple(m_sizerHeader->GetStaticBox(), wxID_ANY,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_header);
|
||||
|
||||
m_header->Bind(wxEVT_HEADER_RESIZING, &HeaderCtrlWidgetsPage::OnResizing, this);
|
||||
m_header->Bind(wxEVT_HEADER_BEGIN_RESIZE, &HeaderCtrlWidgetsPage::OnBeginResize, this);
|
||||
m_header->Bind(wxEVT_HEADER_END_RESIZE, &HeaderCtrlWidgetsPage::OnEndResize, this);
|
||||
|
||||
for ( int i = 0; i < (int)WXSIZEOF(m_colSettings); i++ )
|
||||
{
|
||||
wxHeaderColumnSimple col(wxString::Format("Column %d", i + 1),
|
||||
FromDIP(100),
|
||||
GetColumnAlignmentFlag(i),
|
||||
GetColumnStyleFlags(i));
|
||||
if ( m_colSettings[i].chkWithBitmap->IsChecked() )
|
||||
{
|
||||
const wxArtID icons[] = { wxART_ERROR, wxART_QUESTION, wxART_WARNING, wxART_INFORMATION };
|
||||
col.SetBitmap(wxArtProvider::GetBitmapBundle(icons[i % WXSIZEOF(icons)], wxART_BUTTON));
|
||||
}
|
||||
m_header->AppendColumn(col);
|
||||
}
|
||||
|
||||
m_sizerHeader->AddStretchSpacer();
|
||||
m_sizerHeader->Add(m_header, wxSizerFlags().Expand());
|
||||
m_sizerHeader->AddStretchSpacer();
|
||||
m_sizerHeader->Layout();
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::ResetHeaderStyle()
|
||||
{
|
||||
m_chkAllowReorder->SetValue((wxHD_DEFAULT_STYLE & wxHD_ALLOW_REORDER) != 0);
|
||||
m_chkAllowHide->SetValue((wxHD_DEFAULT_STYLE & wxHD_ALLOW_HIDE) != 0);
|
||||
m_chkBitmapOnRight->SetValue((wxHD_DEFAULT_STYLE & wxHD_BITMAP_ON_RIGHT) != 0);
|
||||
}
|
||||
|
||||
long HeaderCtrlWidgetsPage::GetHeaderStyleFlags() const
|
||||
{
|
||||
long flags = 0;
|
||||
|
||||
if ( m_chkAllowReorder->IsChecked() )
|
||||
flags |= wxHD_ALLOW_REORDER;
|
||||
if ( m_chkAllowHide->IsChecked() )
|
||||
flags |= wxHD_ALLOW_HIDE;
|
||||
if ( m_chkBitmapOnRight->IsChecked() )
|
||||
flags |= wxHD_BITMAP_ON_RIGHT;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::ResetColumnStyle(int col)
|
||||
{
|
||||
wxASSERT(col < (int)WXSIZEOF(m_colSettings));
|
||||
m_colSettings[col].chkAllowResize->SetValue((wxCOL_DEFAULT_FLAGS & wxCOL_RESIZABLE) != 0);
|
||||
m_colSettings[col].chkAllowReorder->SetValue((wxCOL_DEFAULT_FLAGS & wxCOL_REORDERABLE) != 0);
|
||||
m_colSettings[col].chkAllowSort->SetValue((wxCOL_DEFAULT_FLAGS & wxCOL_SORTABLE) != 0);
|
||||
m_colSettings[col].chkAllowHide->SetValue((wxCOL_DEFAULT_FLAGS & wxCOL_HIDDEN) != 0);
|
||||
m_colSettings[col].chkWithBitmap->SetValue(COL_WITH_BITMAP_DEFAULT);
|
||||
m_colSettings[col].rbAlignments->SetSelection(COL_ALIGNMENT_INDEX_DEFAULT);
|
||||
}
|
||||
|
||||
int HeaderCtrlWidgetsPage::GetColumnStyleFlags(int col) const
|
||||
{
|
||||
wxASSERT(col < (int)WXSIZEOF(m_colSettings));
|
||||
int flags = 0;
|
||||
|
||||
if ( m_colSettings[col].chkAllowResize->IsChecked() )
|
||||
flags |= wxCOL_RESIZABLE;
|
||||
if ( m_colSettings[col].chkAllowReorder->IsChecked() )
|
||||
flags |= wxCOL_REORDERABLE;
|
||||
if ( m_colSettings[col].chkAllowSort->IsChecked() )
|
||||
flags |= wxCOL_SORTABLE;
|
||||
if ( m_colSettings[col].chkAllowHide->IsChecked() )
|
||||
flags |= wxCOL_HIDDEN;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
wxAlignment HeaderCtrlWidgetsPage::GetColumnAlignmentFlag(int col) const
|
||||
{
|
||||
wxASSERT(col < (int)WXSIZEOF(m_colSettings));
|
||||
wxASSERT(WXSIZEOF(gs_colAlignments) == WXSIZEOF(gs_colAlignFlags));
|
||||
int sel = m_colSettings[col].rbAlignments->GetSelection();
|
||||
return sel == wxNOT_FOUND ? COL_ALIGNMENT_FLAG_DEFAULT : gs_colAlignFlags[sel];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void HeaderCtrlWidgetsPage::OnStyleCheckOrRadioBox(wxCommandEvent& WXUNUSED(evt))
|
||||
{
|
||||
RecreateWidget();
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::OnResetButton(wxCommandEvent& WXUNUSED(evt))
|
||||
{
|
||||
ResetHeaderStyle();
|
||||
for ( int i = 0; i < (int)WXSIZEOF(m_colSettings); i++ )
|
||||
{
|
||||
ResetColumnStyle(i);
|
||||
}
|
||||
RecreateWidget();
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& evt)
|
||||
{
|
||||
bool enable = GetHeaderStyleFlags() != wxHD_DEFAULT_STYLE;
|
||||
for ( int i = 0; !enable && i < (int)WXSIZEOF(m_colSettings); i++ )
|
||||
{
|
||||
enable = enable || GetColumnStyleFlags(i) != wxCOL_DEFAULT_FLAGS
|
||||
|| m_colSettings[i].chkWithBitmap->IsChecked() != COL_WITH_BITMAP_DEFAULT
|
||||
|| m_colSettings[i].rbAlignments->GetSelection() != COL_ALIGNMENT_INDEX_DEFAULT;
|
||||
}
|
||||
evt.Enable(enable);
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::OnResizing(wxHeaderCtrlEvent& evt)
|
||||
{
|
||||
wxLogMessage("Column %i resizing, width = %i", evt.GetColumn() + 1, evt.GetWidth());
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::OnBeginResize(wxHeaderCtrlEvent& evt)
|
||||
{
|
||||
wxLogMessage("Column %i resize began, width = %i", evt.GetColumn() + 1, evt.GetWidth());
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
void HeaderCtrlWidgetsPage::OnEndResize(wxHeaderCtrlEvent& evt)
|
||||
{
|
||||
wxLogMessage("Column %i resize ended, width = %i", evt.GetColumn() + 1, evt.GetWidth());
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
#endif // wxUSE_HEADERCTRL
|
||||
396
libs/wxWidgets-3.3.1/samples/widgets/hyperlnk.cpp
Normal file
396
libs/wxWidgets-3.3.1/samples/widgets/hyperlnk.cpp
Normal file
@@ -0,0 +1,396 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: hyperlnk.cpp
|
||||
// Purpose: Part of the widgets sample showing wxHyperlinkCtrl
|
||||
// Author: Dimitri Schoolwerth, Vadim Zeitlin
|
||||
// Created: 27 Sep 2003
|
||||
// Copyright: (c) 2003 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_HYPERLINKCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/textctrl.h"
|
||||
|
||||
#include "wx/sizer.h"
|
||||
#endif
|
||||
|
||||
#include "wx/hyperlink.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/hyperlnk.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
HyperlinkPage_Reset = wxID_HIGHEST,
|
||||
HyperlinkPage_SetLabel,
|
||||
HyperlinkPage_SetURL,
|
||||
HyperlinkPage_Ctrl
|
||||
};
|
||||
|
||||
// alignment radiobox indices
|
||||
enum
|
||||
{
|
||||
Align_Left,
|
||||
Align_Centre,
|
||||
Align_Right,
|
||||
Align_Max
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CheckBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class HyperlinkWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
HyperlinkWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
virtual ~HyperlinkWidgetsPage() {}
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_hyperlink; }
|
||||
virtual Widgets GetWidgets() const override
|
||||
{
|
||||
Widgets widgets(WidgetsPage::GetWidgets());
|
||||
widgets.push_back(m_hyperlinkLong);
|
||||
return widgets;
|
||||
}
|
||||
|
||||
virtual void RecreateWidget() override { CreateHyperlink(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonSetLabel(wxCommandEvent& event);
|
||||
void OnButtonSetURL(wxCommandEvent& event);
|
||||
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnAlignment(wxCommandEvent& event);
|
||||
void OnGeneric(wxCommandEvent& event);
|
||||
|
||||
// reset the control parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the hyperctrl
|
||||
void CreateHyperlink();
|
||||
void CreateHyperlinkLong(long align);
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the checkbox itself and the sizer it is in
|
||||
wxGenericHyperlinkCtrl *m_hyperlink;
|
||||
wxGenericHyperlinkCtrl *m_hyperlinkLong;
|
||||
|
||||
wxTextCtrl *m_label;
|
||||
wxTextCtrl *m_url;
|
||||
|
||||
wxStaticText *m_visit;
|
||||
wxStaticText *m_fun;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_textLabel;
|
||||
|
||||
wxRadioBox *m_radioAlignMode;
|
||||
wxCheckBox *m_checkGeneric;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(HyperlinkWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(HyperlinkWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(HyperlinkPage_Reset, HyperlinkWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(HyperlinkPage_SetLabel, HyperlinkWidgetsPage::OnButtonSetLabel)
|
||||
EVT_BUTTON(HyperlinkPage_SetURL, HyperlinkWidgetsPage::OnButtonSetURL)
|
||||
|
||||
EVT_RADIOBOX(wxID_ANY, HyperlinkWidgetsPage::OnAlignment)
|
||||
EVT_CHECKBOX(wxID_ANY, HyperlinkWidgetsPage::OnGeneric)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(HyperlinkWidgetsPage, "Hyperlink",
|
||||
GENERIC_CTRLS
|
||||
);
|
||||
|
||||
HyperlinkWidgetsPage::HyperlinkWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
:WidgetsPage(book, imaglist, hyperlnk_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "Hyperlink details");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetLabel , "Set &Label", wxID_ANY, &m_label, sizerLeftBox ),
|
||||
0, wxALL | wxALIGN_RIGHT , 5 );
|
||||
|
||||
sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetURL , "Set &URL", wxID_ANY, &m_url, sizerLeftBox ),
|
||||
0, wxALL | wxALIGN_RIGHT , 5 );
|
||||
|
||||
static const wxString alignments[] =
|
||||
{
|
||||
"&left",
|
||||
"¢re",
|
||||
"&right"
|
||||
};
|
||||
wxCOMPILE_TIME_ASSERT( WXSIZEOF(alignments) == Align_Max,
|
||||
AlignMismatch );
|
||||
|
||||
m_radioAlignMode = new wxRadioBox(sizerLeftBox, wxID_ANY, "alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(alignments), alignments);
|
||||
m_radioAlignMode->SetSelection(1); // start with "centre" selected since
|
||||
// wxHL_DEFAULT_STYLE contains wxHL_ALIGN_CENTRE
|
||||
sizerLeft->Add(m_radioAlignMode, 0, wxALL|wxGROW, 5);
|
||||
|
||||
m_checkGeneric = new wxCheckBox(sizerLeftBox, wxID_ANY, "Use generic version",
|
||||
wxDefaultPosition, wxDefaultSize);
|
||||
sizerLeft->Add(m_checkGeneric, 0, wxALL|wxGROW, 5);
|
||||
|
||||
// right pane
|
||||
wxSizer *szHyperlinkLong = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer *szHyperlink = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_visit = new wxStaticText(this, wxID_ANY, "Visit ");
|
||||
|
||||
if (m_checkGeneric->IsChecked())
|
||||
{
|
||||
m_hyperlink = new wxGenericHyperlinkCtrl(this,
|
||||
HyperlinkPage_Ctrl,
|
||||
"wxWidgets website",
|
||||
"www.wxwidgets.org");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hyperlink = new wxHyperlinkCtrl(this,
|
||||
HyperlinkPage_Ctrl,
|
||||
"wxWidgets website",
|
||||
"www.wxwidgets.org");
|
||||
}
|
||||
|
||||
m_fun = new wxStaticText(this, wxID_ANY, " for fun!");
|
||||
|
||||
szHyperlink->Add(0, 0, 1, wxCENTRE);
|
||||
szHyperlink->Add(m_visit, 0, wxCENTRE);
|
||||
szHyperlink->Add(m_hyperlink, 0, wxCENTRE);
|
||||
szHyperlink->Add(m_fun, 0, wxCENTRE);
|
||||
szHyperlink->Add(0, 0, 1, wxCENTRE);
|
||||
szHyperlink->SetMinSize(150, 0);
|
||||
|
||||
if (m_checkGeneric->IsChecked())
|
||||
{
|
||||
m_hyperlinkLong = new wxGenericHyperlinkCtrl(this,
|
||||
wxID_ANY,
|
||||
"This is a long hyperlink",
|
||||
"www.wxwidgets.org");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hyperlinkLong = new wxHyperlinkCtrl(this,
|
||||
wxID_ANY,
|
||||
"This is a long hyperlink",
|
||||
"www.wxwidgets.org");
|
||||
}
|
||||
|
||||
szHyperlinkLong->Add(0, 0, 1, wxCENTRE);
|
||||
szHyperlinkLong->Add(szHyperlink, 0, wxCENTRE|wxGROW);
|
||||
szHyperlinkLong->Add(0, 0, 1, wxCENTRE);
|
||||
szHyperlinkLong->Add(m_hyperlinkLong, 0, wxGROW);
|
||||
szHyperlinkLong->Add(0, 0, 1, wxCENTRE);
|
||||
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(szHyperlinkLong, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::Reset()
|
||||
{
|
||||
m_label->SetValue(m_hyperlink->GetLabel());
|
||||
m_url->SetValue(m_hyperlink->GetURL());
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::CreateHyperlink()
|
||||
{
|
||||
const wxString label = m_hyperlink->GetLabel();
|
||||
const wxString url = m_hyperlink->GetURL();
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
style |= wxHL_DEFAULT_STYLE & ~wxBORDER_MASK;
|
||||
|
||||
wxGenericHyperlinkCtrl *hyp;
|
||||
if (m_checkGeneric->IsChecked())
|
||||
{
|
||||
hyp = new wxGenericHyperlinkCtrl(this,
|
||||
HyperlinkPage_Ctrl,
|
||||
label,
|
||||
url,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
style);
|
||||
}
|
||||
else
|
||||
{
|
||||
hyp = new wxHyperlinkCtrl(this,
|
||||
HyperlinkPage_Ctrl,
|
||||
label,
|
||||
url,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
style);
|
||||
}
|
||||
|
||||
// update sizer's child window
|
||||
GetSizer()->Replace(m_hyperlink, hyp, true);
|
||||
|
||||
// update our pointer
|
||||
delete m_hyperlink;
|
||||
m_hyperlink = hyp;
|
||||
|
||||
NotifyWidgetRecreation(m_hyperlink);
|
||||
|
||||
// relayout the sizer
|
||||
GetSizer()->Layout();
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::CreateHyperlinkLong(long align)
|
||||
{
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
style |= align;
|
||||
style |= wxHL_DEFAULT_STYLE & ~(wxHL_ALIGN_CENTRE | wxBORDER_MASK);
|
||||
|
||||
wxGenericHyperlinkCtrl *hyp;
|
||||
if (m_checkGeneric->IsChecked())
|
||||
{
|
||||
hyp = new wxGenericHyperlinkCtrl(this,
|
||||
wxID_ANY,
|
||||
"This is a long hyperlink",
|
||||
"www.wxwidgets.org",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
style);
|
||||
}
|
||||
else
|
||||
{
|
||||
hyp = new wxHyperlinkCtrl(this,
|
||||
wxID_ANY,
|
||||
"This is a long hyperlink",
|
||||
"www.wxwidgets.org",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
style);
|
||||
}
|
||||
|
||||
// update sizer's child window
|
||||
GetSizer()->Replace(m_hyperlinkLong, hyp, true);
|
||||
|
||||
// update our pointer
|
||||
delete m_hyperlinkLong;
|
||||
m_hyperlinkLong = hyp;
|
||||
|
||||
// relayout the sizer
|
||||
GetSizer()->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void HyperlinkWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateHyperlink();
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::OnButtonSetLabel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_hyperlink->SetLabel(m_label->GetValue());
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::OnButtonSetURL(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_hyperlink->SetURL(m_url->GetValue());
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::OnAlignment(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long addstyle;
|
||||
switch ( m_radioAlignMode->GetSelection() )
|
||||
{
|
||||
default:
|
||||
case Align_Max:
|
||||
wxFAIL_MSG( "unknown alignment" );
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case Align_Left:
|
||||
addstyle = wxHL_ALIGN_LEFT;
|
||||
break;
|
||||
|
||||
case Align_Centre:
|
||||
addstyle = wxHL_ALIGN_CENTRE;
|
||||
break;
|
||||
|
||||
case Align_Right:
|
||||
addstyle = wxHL_ALIGN_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
CreateHyperlinkLong(addstyle);
|
||||
}
|
||||
|
||||
void HyperlinkWidgetsPage::OnGeneric(wxCommandEvent& event)
|
||||
{
|
||||
CreateHyperlink();
|
||||
OnAlignment(event);
|
||||
}
|
||||
|
||||
#endif // wxUSE_HYPERLINKCTRL
|
||||
278
libs/wxWidgets-3.3.1/samples/widgets/icons/activityindicator.xpm
Normal file
278
libs/wxWidgets-3.3.1/samples/widgets/icons/activityindicator.xpm
Normal file
@@ -0,0 +1,278 @@
|
||||
/* XPM */
|
||||
static const char *const activityindicator_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2 ",
|
||||
" c None",
|
||||
". c gray93",
|
||||
"X c gray93",
|
||||
"o c gray93",
|
||||
"O c gray93",
|
||||
"+ c gray93",
|
||||
"@ c #D5D6D6",
|
||||
"# c #828587",
|
||||
"$ c #828587",
|
||||
"% c #D6D6D7",
|
||||
"& c gray93",
|
||||
"* c gray93",
|
||||
"= c gray93",
|
||||
"- c gray93",
|
||||
"; c gray93",
|
||||
": c gray93",
|
||||
"> c gray93",
|
||||
", c gray93",
|
||||
"< c #E9E9E9",
|
||||
"1 c #DDDDDD",
|
||||
"2 c #ECECEC",
|
||||
"3 c gray93",
|
||||
"4 c #ABACAE",
|
||||
"5 c #747779",
|
||||
"6 c #747779",
|
||||
"7 c #ABACAE",
|
||||
"8 c gray93",
|
||||
"9 c #ECECEC",
|
||||
"0 c #D4D5D6",
|
||||
"q c #E7E7E8",
|
||||
"w c gray93",
|
||||
"e c gray93",
|
||||
"r c gray93",
|
||||
"t c #E9E9E9",
|
||||
"y c #9A9C9D",
|
||||
"u c #8C8F90",
|
||||
"i c #ABADAE",
|
||||
"p c gray93",
|
||||
"a c #CACACB",
|
||||
"s c #76797B",
|
||||
"d c #76797B",
|
||||
"f c #CACACB",
|
||||
"g c gray93",
|
||||
"h c #8A8D8E",
|
||||
"j c #5C6162",
|
||||
"k c #717676",
|
||||
"l c gray91",
|
||||
"z c gray93",
|
||||
"x c gray93",
|
||||
"c c gray87",
|
||||
"v c #8C8F90",
|
||||
"b c #8C8F90",
|
||||
"n c #929596",
|
||||
"m c gray93",
|
||||
"M c gray93",
|
||||
"N c #E1E1E2",
|
||||
"B c #E1E1E2",
|
||||
"V c gray93",
|
||||
"C c gray93",
|
||||
"Z c #646869",
|
||||
"A c #5C6162",
|
||||
"S c #5C6162",
|
||||
"D c #D7D8D8",
|
||||
"F c gray93",
|
||||
"G c gray93",
|
||||
"H c #ECECEC",
|
||||
"J c #ACAEAF",
|
||||
"K c #929596",
|
||||
"L c #BFC0C1",
|
||||
"P c gray93",
|
||||
"I c gray93",
|
||||
"U c gray93",
|
||||
"Y c gray93",
|
||||
"T c gray93",
|
||||
"R c gray93",
|
||||
"E c #A7A9AA",
|
||||
"W c #64696A",
|
||||
"Q c #8C8F90",
|
||||
"! c #ECECEC",
|
||||
"~ c gray93",
|
||||
"^ c gray93",
|
||||
"/ c gray93",
|
||||
"( c gray93",
|
||||
") c gray93",
|
||||
"_ c gray93",
|
||||
"` c gray93",
|
||||
"' c gray93",
|
||||
"] c gray93",
|
||||
"[ c gray93",
|
||||
"{ c gray93",
|
||||
"} c gray93",
|
||||
"| c gray93",
|
||||
" . c gray93",
|
||||
".. c gray93",
|
||||
"X. c gray93",
|
||||
"o. c gray93",
|
||||
"O. c #DFDFDF",
|
||||
"+. c #C4C5C6",
|
||||
"@. c #D8D8D9",
|
||||
"#. c gray93",
|
||||
"$. c gray93",
|
||||
"%. c gray93",
|
||||
"&. c gray93",
|
||||
"*. c gray93",
|
||||
"=. c gray93",
|
||||
"-. c gray93",
|
||||
";. c gray93",
|
||||
":. c gray93",
|
||||
">. c gray93",
|
||||
",. c #BCBDBE",
|
||||
"<. c #8E9192",
|
||||
"1. c #CCCDCD",
|
||||
"2. c #ACAEAF",
|
||||
"3. c #A4A6A7",
|
||||
"4. c #A5A7A8",
|
||||
"5. c #E6E7E7",
|
||||
"6. c gray93",
|
||||
"7. c gray93",
|
||||
"8. c gray93",
|
||||
"9. c gray93",
|
||||
"0. c gray93",
|
||||
"q. c gray93",
|
||||
"w. c gray93",
|
||||
"e. c gray93",
|
||||
"r. c #DDDEDE",
|
||||
"t. c #464B4D",
|
||||
"y. c #44494B",
|
||||
"u. c #585D5F",
|
||||
"i. c #ADAFAF",
|
||||
"p. c #A4A6A7",
|
||||
"a. c #A5A7A8",
|
||||
"s. c #E6E7E7",
|
||||
"d. c gray93",
|
||||
"f. c gray93",
|
||||
"g. c gray93",
|
||||
"h. c gray93",
|
||||
"j. c gray93",
|
||||
"k. c gray93",
|
||||
"l. c gray93",
|
||||
"z. c gray93",
|
||||
"x. c #DDDEDE",
|
||||
"c. c #474B4D",
|
||||
"v. c #44494B",
|
||||
"b. c #585D5F",
|
||||
"n. c #DFDFE0",
|
||||
"m. c #C5C6C6",
|
||||
"M. c #D8D8D9",
|
||||
"N. c gray93",
|
||||
"B. c gray93",
|
||||
"V. c gray93",
|
||||
"C. c gray93",
|
||||
"Z. c gray93",
|
||||
"A. c gray93",
|
||||
"S. c gray93",
|
||||
"D. c gray93",
|
||||
"F. c gray93",
|
||||
"G. c gray93",
|
||||
"H. c #BCBDBE",
|
||||
"J. c #8F9293",
|
||||
"K. c #CFD0D0",
|
||||
"L. c gray93",
|
||||
"P. c gray93",
|
||||
"I. c gray93",
|
||||
"U. c gray93",
|
||||
"Y. c gray93",
|
||||
"T. c gray93",
|
||||
"R. c gray93",
|
||||
"E. c gray93",
|
||||
"W. c gray93",
|
||||
"Q. c gray93",
|
||||
"!. c gray93",
|
||||
"~. c gray93",
|
||||
"^. c gray93",
|
||||
"/. c gray93",
|
||||
"(. c gray93",
|
||||
"). c gray93",
|
||||
"_. c gray93",
|
||||
"`. c gray93",
|
||||
"'. c #CBCDCD",
|
||||
"]. c #BEC0C0",
|
||||
"[. c #D5D6D6",
|
||||
"{. c gray93",
|
||||
"}. c gray93",
|
||||
"|. c gray93",
|
||||
" X c gray93",
|
||||
".X c gray93",
|
||||
"XX c gray93",
|
||||
"oX c #929596",
|
||||
"OX c #3F4445",
|
||||
"+X c #717576",
|
||||
"@X c #ECECEC",
|
||||
"#X c gray93",
|
||||
"$X c gray93",
|
||||
"%X c #E5E6E6",
|
||||
"&X c #BCBEBE",
|
||||
"*X c #BCBEBE",
|
||||
"=X c #BEC0C0",
|
||||
"-X c gray93",
|
||||
";X c gray93",
|
||||
":X c #EAEAEB",
|
||||
">X c #EAEAEB",
|
||||
",X c gray93",
|
||||
"<X c gray93",
|
||||
"1X c #3F4546",
|
||||
"2X c #353B3C",
|
||||
"3X c #353B3C",
|
||||
"4X c #D1D2D2",
|
||||
"5X c gray93",
|
||||
"6X c gray93",
|
||||
"7X c #EBECEC",
|
||||
"8X c #C3C5C5",
|
||||
"9X c #BCBEBE",
|
||||
"0X c #CCCDCD",
|
||||
"qX c gray93",
|
||||
"wX c #E6E6E6",
|
||||
"eX c #D5D5D6",
|
||||
"rX c #D5D5D6",
|
||||
"tX c #E6E6E6",
|
||||
"yX c gray93",
|
||||
"uX c #707475",
|
||||
"iX c #353B3C",
|
||||
"pX c #515657",
|
||||
"aX c #E7E7E7",
|
||||
"sX c gray93",
|
||||
"dX c gray93",
|
||||
"fX c gray93",
|
||||
"gX c gray92",
|
||||
"hX c gray90",
|
||||
"jX c gray93",
|
||||
"kX c gray93",
|
||||
"lX c #DFDFE0",
|
||||
"zX c #D4D4D5",
|
||||
"xX c #D4D4D5",
|
||||
"cX c #DFDFE0",
|
||||
"vX c gray93",
|
||||
"bX c #ECECEC",
|
||||
"nX c #CFD0D0",
|
||||
"mX c #E7E7E7",
|
||||
"MX c gray93",
|
||||
"NX c gray93",
|
||||
"BX c gray93",
|
||||
"VX c gray93",
|
||||
"CX c gray93",
|
||||
"ZX c gray93",
|
||||
"AX c gray93",
|
||||
"SX c gray93",
|
||||
"DX c gray91",
|
||||
"FX c #D7D7D8",
|
||||
"GX c #D7D7D8",
|
||||
"HX c #E8E8E9",
|
||||
"JX c gray93",
|
||||
"KX c gray93",
|
||||
"LX c gray93",
|
||||
"PX c gray93",
|
||||
"IX c gray93",
|
||||
"UX c gray93",
|
||||
/* pixels */
|
||||
" @ # $ % ",
|
||||
" < 1 4 5 6 7 0 ",
|
||||
" t y u i a s d f h j k ",
|
||||
" c v b n N B Z A S D ",
|
||||
" J K L E W Q ",
|
||||
" ",
|
||||
"O.+.@. ,.<.1.",
|
||||
"2.3.4.5. r.t.y.u.",
|
||||
"i.p.a.s. x.c.v.b.",
|
||||
"n.m.M. G.H.J.K.",
|
||||
" ",
|
||||
" .'.].[. oXOX+X@X ",
|
||||
" %X&X*X=X 1X2X3X4X ",
|
||||
" X8X9X0X XeXrXtX uXiXpXaX ",
|
||||
" XhXjX lXzXxXcX bXnXmX ",
|
||||
" XFXGXHX "
|
||||
};
|
||||
37
libs/wxWidgets-3.3.1/samples/widgets/icons/bmpbtn.xpm
Normal file
37
libs/wxWidgets-3.3.1/samples/widgets/icons/bmpbtn.xpm
Normal file
@@ -0,0 +1,37 @@
|
||||
/* XPM */
|
||||
static const char *const magick[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 15 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c #808080",
|
||||
"$ c none",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" $$$$$$$$$$$$$$ ",
|
||||
" $$$# #$$$# #$ ",
|
||||
" $$$ $ $$$ $$ $ ",
|
||||
" $# $ $$$ $$ $ ",
|
||||
" $ $ $ $# #$ ",
|
||||
" $ $ $ $ $$$$$ ",
|
||||
" $# $$ $ $$$$$ ",
|
||||
" $ $ ",
|
||||
" $$$ $$ $$$$$$$ ",
|
||||
" $$$ $ $$ $ $ ",
|
||||
" $$$ $ $ $$ $$$ ",
|
||||
" $$ $ $$$ ",
|
||||
" $ $$$$$$$$$ ",
|
||||
" "
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/bmpcombobox.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/bmpcombobox.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const bmpcombobox_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"## ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## :%%%%:&&&&:====: ::::: ##",
|
||||
"## :%%%%:&&&&:====: ::: ##",
|
||||
"## :%%%%:&&&&:====: : ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### : :::::::: ::::::::: ##",
|
||||
"#### : %%% : :::::: :::: :::: ##",
|
||||
"#### : %%% :: : : : ::: ::: ##",
|
||||
"#### : %%% ::: : :: :: :: ##",
|
||||
"#### : :::::::: ::::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### : :::::::: ##",
|
||||
"#### : &&& : : : :: ::::::::: ##",
|
||||
"#### : &&& :: :: :: ::::::::: ##",
|
||||
"#### : &&& : : : :: ::::::::: ##",
|
||||
"#### : :::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### : :::::::: ::::::::: ##",
|
||||
"#### : === :: :: :: :: :: ##",
|
||||
"#### : === : :: : ::: ::: ##",
|
||||
"#### : === :: :: :: :::: :::: ##",
|
||||
"#### : :::::::: ::::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### ##",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/button.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/button.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const button_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"##### #####",
|
||||
"#### :::::::::::::::::::::: ####",
|
||||
"### :::::::::::::::::::::::$ ###",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"## ::######################$$ ##",
|
||||
"### $$$$$$$$$$$$$$$$$$$$$$$$ ###",
|
||||
"#### $$$$$$$$$$$$$$$$$$$$$$ ####",
|
||||
"##### #####",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/checkbox.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/checkbox.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const checkbox_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"#####$$$$$$$$$$$$$$$$$$$$$$#####",
|
||||
"####$ #:####",
|
||||
"####$ ::::::::::::::::::::#:####",
|
||||
"####$ ::::::::::::::::::::#:####",
|
||||
"####$ ::::::::::::::::::::#:####",
|
||||
"####$ ::: :::::::::: :::#:####",
|
||||
"####$ ::: :::::::: :::#:####",
|
||||
"####$ :::: :::::: ::::#:####",
|
||||
"####$ ::::: :::: :::::#:####",
|
||||
"####$ :::::: :: ::::::#:####",
|
||||
"####$ ::::::: :::::::#:####",
|
||||
"####$ :::::::: ::::::::#:####",
|
||||
"####$ :::::::: ::::::::#:####",
|
||||
"####$ ::::::: :::::::#:####",
|
||||
"####$ :::::: :: ::::::#:####",
|
||||
"####$ ::::: :::: :::::#:####",
|
||||
"####$ :::: :::::: ::::#:####",
|
||||
"####$ ::: :::::::: :::#:####",
|
||||
"####$ ::: :::::::::: :::#:####",
|
||||
"####$ ::::::::::::::::::::#:####",
|
||||
"####$ ::::::::::::::::::::#:####",
|
||||
"####$ ::::::::::::::::::::#:####",
|
||||
"####$ #####################:####",
|
||||
"#####::::::::::::::::::::::#####",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
27
libs/wxWidgets-3.3.1/samples/widgets/icons/choice.xpm
Normal file
27
libs/wxWidgets-3.3.1/samples/widgets/icons/choice.xpm
Normal file
@@ -0,0 +1,27 @@
|
||||
/* XPM */
|
||||
static const char *const choice_xpm[] = {
|
||||
/* width height ncolors chars_per_pixel */
|
||||
"16 16 5 1",
|
||||
/* colors */
|
||||
" s None c None",
|
||||
". c #000000",
|
||||
"+ c #c0c0c0",
|
||||
"@ c #808080",
|
||||
"# c #ffffff",
|
||||
/* pixels */
|
||||
"@@@@@@@@@@@@@@@@",
|
||||
"@..............@",
|
||||
"@.########+++++@",
|
||||
"@.########.....@",
|
||||
"@.########+...+@",
|
||||
"@.########++.++@",
|
||||
"@.+++++++++++++@",
|
||||
"@@@@@@@@@@@@@@@@",
|
||||
" ##############",
|
||||
" ..............",
|
||||
" .#########+.+.",
|
||||
" .#########....",
|
||||
" .#########+++.",
|
||||
" .#########....",
|
||||
" .#########+.+.",
|
||||
" .............."};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/choicebk.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/choicebk.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const choicebk_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"## ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## :::::::::::::::: ::::: ##",
|
||||
"## :::::::::::::::: ::: ##",
|
||||
"## :::::::::::::::: : ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## ##",
|
||||
"################################",
|
||||
"######$$$$$$$$$$$$$$$$$$$$$$$$##",
|
||||
"######$::::::::::::::::::::::$##",
|
||||
"####$$$$$$$$$$$$$$$$$$$$$$$$:$##",
|
||||
"####$::::::::::::::::::::::$:$##",
|
||||
"## :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$$$##",
|
||||
"## :::::::::::::::::::::: :$####",
|
||||
"## :::::::::::::::::::::: $$####",
|
||||
"## :::::::::::::::::::::: ######",
|
||||
"## ######",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
193
libs/wxWidgets-3.3.1/samples/widgets/icons/clrpicker.xpm
Normal file
193
libs/wxWidgets-3.3.1/samples/widgets/icons/clrpicker.xpm
Normal file
@@ -0,0 +1,193 @@
|
||||
/* XPM */
|
||||
static const char *const clrpicker_xpm[]={
|
||||
"32 32 158 2",
|
||||
" c None",
|
||||
"** c Black",
|
||||
"RR c Red",
|
||||
"BB c Blue",
|
||||
"GG c Green",
|
||||
"WW c White",
|
||||
"YY c Yellow",
|
||||
"MM c Magenta",
|
||||
"CC c Cyan",
|
||||
"G3 c #333333",
|
||||
"G9 c #999999",
|
||||
".P c #00a900",
|
||||
".q c #00aa01",
|
||||
".y c #00ab01",
|
||||
".r c #00ac01",
|
||||
".G c #00ad01",
|
||||
".j c #018700",
|
||||
".C c #018901",
|
||||
".L c #018d00",
|
||||
".Q c #01a901",
|
||||
".D c #029902",
|
||||
".O c #029b02",
|
||||
".F c #03ab03",
|
||||
".Y c #059a05",
|
||||
".u c #067706",
|
||||
".Z c #069905",
|
||||
".E c #06ab06",
|
||||
".W c #0d7e09",
|
||||
"#s c #0d8109",
|
||||
".T c #0f750e",
|
||||
".3 c #117611",
|
||||
"#b c #167616",
|
||||
".z c #16b116",
|
||||
".0 c #179716",
|
||||
".b c #198219",
|
||||
".9 c #1a7a16",
|
||||
".A c #1a7a19",
|
||||
".V c #1a8719",
|
||||
"#j c #1f821a",
|
||||
"#l c #217d1f",
|
||||
".f c #218b20",
|
||||
".x c #22b422",
|
||||
"#t c #267c23",
|
||||
".c c #278427",
|
||||
".s c #288428",
|
||||
".7 c #2a8e29",
|
||||
"#B c #2b712a",
|
||||
".m c #319231",
|
||||
"#. c #31a130",
|
||||
".M c #32bc32",
|
||||
".X c #349632",
|
||||
".H c #37bb37",
|
||||
"#h c #389635",
|
||||
".p c #3ebd3e",
|
||||
".8 c #3f923c",
|
||||
".I c #40ab40",
|
||||
".i c #52c152",
|
||||
".R c #52c353",
|
||||
".v c #5cc15c",
|
||||
"#A c #5e795f",
|
||||
".a c #5fa25f",
|
||||
".6 c #639064",
|
||||
"#u c #659a65",
|
||||
".B c #68a868",
|
||||
"an c #69696a",
|
||||
".w c #6bcb6c",
|
||||
"af c #6e6e6f",
|
||||
"#9 c #6e6e70",
|
||||
"#5 c #6f6f70",
|
||||
".K c #70ab70",
|
||||
"#0 c #717172",
|
||||
"#W c #727273",
|
||||
"aq c #737373",
|
||||
"#S c #737374",
|
||||
"#G c #747475",
|
||||
"## c #75bc74",
|
||||
".J c #77a876",
|
||||
"ao c #797979",
|
||||
".S c #7ece7e",
|
||||
".1 c #7fd27f",
|
||||
".k c #80b080",
|
||||
"ag c #818181",
|
||||
"ak c #838384",
|
||||
"aa c #878788",
|
||||
".d c #8ab88a",
|
||||
"#r c #8dbc8d",
|
||||
"#2 c #8e8e90",
|
||||
"#O c #8f8f90",
|
||||
"#J c #909091",
|
||||
"#D c #909092",
|
||||
"#e c #919192",
|
||||
".t c #92bd92",
|
||||
"al c #939395",
|
||||
".N c #93d893",
|
||||
"#C c #95b795",
|
||||
"#6 c #989899",
|
||||
"#m c #9abc9a",
|
||||
"#a c #9ecb9e",
|
||||
".e c #a5c8a5",
|
||||
".2 c #a5daa5",
|
||||
".o c #a9e0a9",
|
||||
"#k c #aad4a9",
|
||||
".g c #abddab",
|
||||
"#i c #accaab",
|
||||
"#H c #afafaf",
|
||||
"#M c #b0b0b0",
|
||||
"am c #b0b0b2",
|
||||
"a. c #b1b1b1",
|
||||
".n c #b4e3b4",
|
||||
".l c #b7d1b7",
|
||||
"aj c #bababc",
|
||||
"#g c #bbc9bc",
|
||||
"#d c #bcbcbc",
|
||||
"#v c #bdbdbd",
|
||||
".5 c #bebebe",
|
||||
"#I c #bfbfbf",
|
||||
".4 c #bfd2bf",
|
||||
"#N c #c0c0c0",
|
||||
"ai c #c0c0c3",
|
||||
"#T c #c1c1c1",
|
||||
"ah c #c5c5c8",
|
||||
"ar c #c8c8c8",
|
||||
"ac c #c8c8cb",
|
||||
"#c c #c8d8c8",
|
||||
"a# c #cbcbcb",
|
||||
".# c #cbdccb",
|
||||
"#1 c #cccccc",
|
||||
"ae c #cececf",
|
||||
"#8 c #cfcfd1",
|
||||
"#4 c #d0d0d2",
|
||||
"#f c #d0d0d3",
|
||||
"#Z c #d1d1d2",
|
||||
"#n c #d1d1d3",
|
||||
"#V c #d2d2d3",
|
||||
"#w c #d2d2d4",
|
||||
"#K c #d3d3d4",
|
||||
"#p c #d3d3d5",
|
||||
"#P c #d3d3d6",
|
||||
"#F c #d4d4d5",
|
||||
"#z c #d4d4d6",
|
||||
"#X c #d4d4d7",
|
||||
"#3 c #d5d5d8",
|
||||
"#U c #d8d8da",
|
||||
"#Q c #d9d9db",
|
||||
"#E c #d9d9dc",
|
||||
"ap c #dadada",
|
||||
"ad c #dadadb",
|
||||
"#x c #dadadc",
|
||||
"#q c #dadeda",
|
||||
"#o c #dbdbdd",
|
||||
"ab c #dddddf",
|
||||
".h c #ddf3dd",
|
||||
"#y c #e2e2e3",
|
||||
"#L c #e3e3e3",
|
||||
"#R c #e3e3e4",
|
||||
".U c #e3e8e3",
|
||||
"#Y c #e4e4e4",
|
||||
"#7 c #e5e5e5",
|
||||
" .#.a.b.c.d ",
|
||||
" .e.f.g.h.i.j.k",
|
||||
" .l.m.n.o.p.q.r.s",
|
||||
" .t.u.v.w.x.y.r.z.A",
|
||||
" .B.C.D.E.F.G.y.H.I.J",
|
||||
" .K.L.M.N.O.P.Q.R.S.T.U",
|
||||
" .V.W.X.Y.Z.0.1.2.3.4 ",
|
||||
" .5.6.7.8.9#.###a#b#c ",
|
||||
" #d#e#f#g#h#i#j#k#l#m ",
|
||||
" #d#e#n#o#p#q#r#s#t#u ",
|
||||
" #v#e#w#x#p#y#z#A#B#C ",
|
||||
" .5#D#w#E#p#y#F#G#H ",
|
||||
" #I#J#p#E#K#L#K#G#M ",
|
||||
" #N#O#P#Q#K#R#K#S#M ",
|
||||
" #T#e#P#U#K#R#V#W#M ",
|
||||
"************ **********#T#e#X#U#K#Y#Z#0#M ",
|
||||
"**G3G3G3G3** **G9G9G9#1#2#3#U#V#Y#4#5#M ",
|
||||
"**G3G3G3G3** **G9G9G9#6#X#n#K#7#8#9a.** ",
|
||||
"**G3G3G3G3** **G9G9a#aaabacadaeaf#HWW** ",
|
||||
"************ ******agahacaiajaf#H****** ",
|
||||
" akalamanaoap ",
|
||||
"************ ******#v#5aqar************ ",
|
||||
"**YYYYYYYY** **MMMMMMMM** **CCCCCCCC** ",
|
||||
"**YYYYYYYY** **MMMMMMMM** **CCCCCCCC** ",
|
||||
"**YYYYYYYY** **MMMMMMMM** **CCCCCCCC** ",
|
||||
"************ ************ ************ ",
|
||||
" ",
|
||||
"************ ************ ************ ",
|
||||
"**RRRRRRRR** **BBBBBBBB** **GGGGGGGG** ",
|
||||
"**RRRRRRRR** **BBBBBBBB** **GGGGGGGG** ",
|
||||
"**RRRRRRRR** **BBBBBBBB** **GGGGGGGG** ",
|
||||
"************ ************ ************ "};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/combobox.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/combobox.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const combobox_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"## ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## :::::::::::::::: ::::: ##",
|
||||
"## :::::::::::::::: ::: ##",
|
||||
"## :::::::::::::::: : ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### :::::::::::::: :::: :::: ##",
|
||||
"#### :::::::::::::: ::: ::: ##",
|
||||
"#### :: ::::: :: :: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### :: :::: ::::::::: ##",
|
||||
"#### :::::::::::::: ##",
|
||||
"#### :: ::: ::::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### :: :::: ::::::::: ##",
|
||||
"#### :::::::::::::: ##",
|
||||
"#### :: ::::: ::::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### :: :::: :: :: ##",
|
||||
"#### :::::::::::::: ::: ::: ##",
|
||||
"#### :::::::::::::: :::: :::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### ##",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
200
libs/wxWidgets-3.3.1/samples/widgets/icons/datepick.xpm
Normal file
200
libs/wxWidgets-3.3.1/samples/widgets/icons/datepick.xpm
Normal file
@@ -0,0 +1,200 @@
|
||||
/* XPM */
|
||||
static const char *const datepick_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 163 2",
|
||||
" c None",
|
||||
"f# c Gray0",
|
||||
"f. c #808000",
|
||||
"fX c #000080",
|
||||
"fo c #808080",
|
||||
"fO c #000000",
|
||||
"f+ c #808000",
|
||||
"f@ c #000080",
|
||||
"f$ c #808080",
|
||||
"f% c Red",
|
||||
"f& c Green",
|
||||
"f* c Yellow",
|
||||
"f= c Blue",
|
||||
"f- c Magenta",
|
||||
"f; c Cyan",
|
||||
"f: c Gray100",
|
||||
".P c #00a900",
|
||||
".q c #00aa01",
|
||||
".y c #00ab01",
|
||||
".r c #00ac01",
|
||||
".G c #00ad01",
|
||||
".j c #018700",
|
||||
".C c #018901",
|
||||
".L c #018d00",
|
||||
".Q c #01a901",
|
||||
".D c #029902",
|
||||
".O c #029b02",
|
||||
".F c #03ab03",
|
||||
".Y c #059a05",
|
||||
".u c #067706",
|
||||
".Z c #069905",
|
||||
".E c #06ab06",
|
||||
".W c #0d7e09",
|
||||
"#s c #0d8109",
|
||||
".T c #0f750e",
|
||||
".3 c #117611",
|
||||
"#b c #167616",
|
||||
".z c #16b116",
|
||||
".0 c #179716",
|
||||
".b c #198219",
|
||||
".9 c #1a7a16",
|
||||
".A c #1a7a19",
|
||||
".V c #1a8719",
|
||||
"#j c #1f821a",
|
||||
"#l c #217d1f",
|
||||
".f c #218b20",
|
||||
".x c #22b422",
|
||||
"#t c #267c23",
|
||||
".c c #278427",
|
||||
".s c #288428",
|
||||
".7 c #2a8e29",
|
||||
"#B c #2b712a",
|
||||
".m c #319231",
|
||||
"#. c #31a130",
|
||||
".M c #32bc32",
|
||||
".X c #349632",
|
||||
".H c #37bb37",
|
||||
"#h c #389635",
|
||||
".p c #3ebd3e",
|
||||
".8 c #3f923c",
|
||||
".I c #40ab40",
|
||||
".i c #52c152",
|
||||
".R c #52c353",
|
||||
".v c #5cc15c",
|
||||
"#A c #5e795f",
|
||||
".a c #5fa25f",
|
||||
".6 c #639064",
|
||||
"#u c #659a65",
|
||||
".B c #68a868",
|
||||
"an c #69696a",
|
||||
".w c #6bcb6c",
|
||||
"af c #6e6e6f",
|
||||
"#9 c #6e6e70",
|
||||
"#5 c #6f6f70",
|
||||
".K c #70ab70",
|
||||
"#0 c #717172",
|
||||
"#W c #727273",
|
||||
"aq c #737373",
|
||||
"#S c #737374",
|
||||
"#G c #747475",
|
||||
"## c #75bc74",
|
||||
".J c #77a876",
|
||||
"ao c #797979",
|
||||
".S c #7ece7e",
|
||||
".1 c #7fd27f",
|
||||
".k c #80b080",
|
||||
"ag c #818181",
|
||||
"ak c #838384",
|
||||
"aa c #878788",
|
||||
".d c #8ab88a",
|
||||
"#r c #8dbc8d",
|
||||
"#2 c #8e8e90",
|
||||
"#O c #8f8f90",
|
||||
"#J c #909091",
|
||||
"#D c #909092",
|
||||
"#e c #919192",
|
||||
".t c #92bd92",
|
||||
"al c #939395",
|
||||
".N c #93d893",
|
||||
"#C c #95b795",
|
||||
"#6 c #989899",
|
||||
"#m c #9abc9a",
|
||||
"#a c #9ecb9e",
|
||||
".e c #a5c8a5",
|
||||
".2 c #a5daa5",
|
||||
".o c #a9e0a9",
|
||||
"#k c #aad4a9",
|
||||
".g c #abddab",
|
||||
"#i c #accaab",
|
||||
"#H c #afafaf",
|
||||
"#M c #b0b0b0",
|
||||
"am c #b0b0b2",
|
||||
"a. c #b1b1b1",
|
||||
".n c #b4e3b4",
|
||||
".l c #b7d1b7",
|
||||
"aj c #bababc",
|
||||
"#g c #bbc9bc",
|
||||
"#d c #bcbcbc",
|
||||
"#v c #bdbdbd",
|
||||
".5 c #bebebe",
|
||||
"#I c #bfbfbf",
|
||||
".4 c #bfd2bf",
|
||||
"#N c #c0c0c0",
|
||||
"ai c #c0c0c3",
|
||||
"#T c #c1c1c1",
|
||||
"ah c #c5c5c8",
|
||||
"ar c #c8c8c8",
|
||||
"ac c #c8c8cb",
|
||||
"#c c #c8d8c8",
|
||||
"a# c #cbcbcb",
|
||||
".# c #cbdccb",
|
||||
"#1 c #cccccc",
|
||||
"ae c #cececf",
|
||||
"#8 c #cfcfd1",
|
||||
"#4 c #d0d0d2",
|
||||
"#f c #d0d0d3",
|
||||
"#Z c #d1d1d2",
|
||||
"#n c #d1d1d3",
|
||||
"#V c #d2d2d3",
|
||||
"#w c #d2d2d4",
|
||||
"#K c #d3d3d4",
|
||||
"#p c #d3d3d5",
|
||||
"#P c #d3d3d6",
|
||||
"#F c #d4d4d5",
|
||||
"#z c #d4d4d6",
|
||||
"#X c #d4d4d7",
|
||||
"#3 c #d5d5d8",
|
||||
"#U c #d8d8da",
|
||||
"#Q c #d9d9db",
|
||||
"#E c #d9d9dc",
|
||||
"ap c #dadada",
|
||||
"ad c #dadadb",
|
||||
"#x c #dadadc",
|
||||
"#q c #dadeda",
|
||||
"#o c #dbdbdd",
|
||||
"ab c #dddddf",
|
||||
".h c #ddf3dd",
|
||||
"#y c #e2e2e3",
|
||||
"#L c #e3e3e3",
|
||||
"#R c #e3e3e4",
|
||||
".U c #e3e8e3",
|
||||
"#Y c #e4e4e4",
|
||||
"#7 c #e5e5e5",
|
||||
/* pixels */
|
||||
" .#.a.b.c.d ",
|
||||
" .e.f.g.h.i.j.k",
|
||||
" .l.m.n.o.p.q.r.s",
|
||||
" .t.u.v.w.x.y.r.z.A",
|
||||
" .B.C.D.E.F.G.y.H.I.J",
|
||||
" .K.L.M.N.O.P.Q.R.S.T.U",
|
||||
" .V.W.X.Y.Z.0.1.2.3.4 ",
|
||||
" .5.6.7.8.9#.###a#b#c ",
|
||||
" #d#e#f#g#h#i#j#k#l#m ",
|
||||
" #d#e#n#o#p#q#r#s#t#u ",
|
||||
"f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f##v#e#w#x#p#y#z#A#B#Cf# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:f:f:f:f:f:f$.5#D#w#E#p#y#F#G#Hf:f:f# ",
|
||||
"f#f:f:f#f#f:f:f:f:f:f#f:f:f:f:#I#J#p#E#K#L#K#G#Mf:f#f:f# ",
|
||||
"f#f:f#f:f:f#f:f:f:f#f#f:f:f:#N#O#P#Q#K#R#K#S#Mf#f:f#f:f# ",
|
||||
"f#f:f#f:f:f#f:f:f#f:f#f:f:#T#e#P#U#K#R#V#W#Mf:f#f#f#f:f# ",
|
||||
"f#f:f#f:f:f#f:f:f:f:f#f:#T#e#X#U#K#Y#Z#0#Mf:f:f:f:f#f:f# ",
|
||||
"f#f:f:f#f#f:f:f:f:f:f##1#2#3#U#V#Y#4#5#Mf:f:f:f:f:f#f:f# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:f:#6#X#n#K#7#8#9a.f:f:f:f:f:f:f:f:f# ",
|
||||
"f#f#f#f#f#f#f#f#f#f#a#aaabacadaeaf#Hf#f#f#f#f#f#f#f#f#f# ",
|
||||
" agahacaiajaf#H ",
|
||||
"f#f#f#f#f#f#f#f#f#f#akalamanaoapf#f#f#f#f#f#f#f#f#f#f#f# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:#v#5aqarf:f:f:f:f:f:f:f:f:f:f:f:f:f# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f# ",
|
||||
"f#f:f:f#f#f:f:f#f#f:f:f$f#f:f:f$f$f:f:f#f#f:f:f%f-f:f:f# ",
|
||||
"f#f:f:f#f$f:f:f$f#f:f:f#f$f:f:f#f$f:f:f$f#f:f:f%f%f:f:f# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f# ",
|
||||
"f#f:f:f#f$f:f:f$f#f:f:f$f$f:f:f$f#f:f:f$f#f:f:f%f%f:f:f# ",
|
||||
"f#f:f:f$f#f:f:f#f$f:f:f#f#f:f:f#f$f:f:f#f#f:f:f-f%f:f:f# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f# ",
|
||||
"f#f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f:f# ",
|
||||
"f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f# "};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/dirctrl.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/dirctrl.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const dirctrl_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"# #",
|
||||
"# :::::::::::::::::::::::::::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$:::::: ::: :::::::::::::: #",
|
||||
"# :$::::: :: :: :::::::::::::: #",
|
||||
"# :$$$$:: :::::::::::::::::::: #",
|
||||
"# :$::::: :: :: :::::::::::::: #",
|
||||
"# :$:::::: ::: :::::::::::::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$::::::: : :: ::: :: :: #",
|
||||
"# :$:::::: :: :: :: ::::: :: : #",
|
||||
"# :$$$$:: ::: :: ::: ::: :: #",
|
||||
"# :$:::: :::: :: ::::: :: :: : #",
|
||||
"# :$::: :::::: ::: ::: :: : #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$::::: :: :: :: : ::: ::: #",
|
||||
"# :$::::: :: :: :: : : :: ::: #",
|
||||
"# :$$$$:::::::: :: : : : ::: #",
|
||||
"# :$::::: :: :: :: : : :: ::: #",
|
||||
"# :$::::: :: :: :: : ::: ::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :$:::::::::::::::::::::::::: #",
|
||||
"# :::::::::::::::::::::::::::: #",
|
||||
"# #",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
213
libs/wxWidgets-3.3.1/samples/widgets/icons/dirpicker.xpm
Normal file
213
libs/wxWidgets-3.3.1/samples/widgets/icons/dirpicker.xpm
Normal file
@@ -0,0 +1,213 @@
|
||||
/* XPM */
|
||||
static const char *const dirpicker_xpm[]={
|
||||
"32 32 178 2",
|
||||
" c None",
|
||||
"f6 c #9BACC2",
|
||||
"fw c #547B99",
|
||||
"f5 c #94A5BD",
|
||||
"f. c #376485",
|
||||
"f; c #F1F4F7",
|
||||
"fo c #7F99B4",
|
||||
"f2 c #D1D9E5",
|
||||
"f- c #EAEDF3",
|
||||
"fO c #718BA7",
|
||||
"f0 c #65839D",
|
||||
"f* c #DCE2EA",
|
||||
"f: c #F5F6F7",
|
||||
"f7 c #597B9A",
|
||||
"fX c #8DA0B9",
|
||||
"f+ c #467291",
|
||||
"fq c #305F81",
|
||||
"f& c #D6DFE7",
|
||||
"f3 c #6A89A2",
|
||||
"f1 c #A8B6CA",
|
||||
"f= c #E4E9ED",
|
||||
"f> c #F8F9FA",
|
||||
"f, c #FDFDFE",
|
||||
"f9 c #215579",
|
||||
"f8 c #7F97B0",
|
||||
"f@ c #B3BFD1",
|
||||
"f< c #7A90AC",
|
||||
"f$ c #C2CBDB",
|
||||
"f4 c #A2B3C5",
|
||||
"f% c #CAD6E1",
|
||||
"f# c #BBC4D6",
|
||||
".P c #00a900",
|
||||
".q c #00aa01",
|
||||
".y c #00ab01",
|
||||
".r c #00ac01",
|
||||
".G c #00ad01",
|
||||
".j c #018700",
|
||||
".C c #018901",
|
||||
".L c #018d00",
|
||||
".Q c #01a901",
|
||||
".D c #029902",
|
||||
".O c #029b02",
|
||||
".F c #03ab03",
|
||||
".Y c #059a05",
|
||||
".u c #067706",
|
||||
".Z c #069905",
|
||||
".E c #06ab06",
|
||||
".W c #0d7e09",
|
||||
"#s c #0d8109",
|
||||
".T c #0f750e",
|
||||
".3 c #117611",
|
||||
"#b c #167616",
|
||||
".z c #16b116",
|
||||
".0 c #179716",
|
||||
".b c #198219",
|
||||
".9 c #1a7a16",
|
||||
".A c #1a7a19",
|
||||
".V c #1a8719",
|
||||
"#j c #1f821a",
|
||||
"#l c #217d1f",
|
||||
".f c #218b20",
|
||||
".x c #22b422",
|
||||
"#t c #267c23",
|
||||
".c c #278427",
|
||||
".s c #288428",
|
||||
".7 c #2a8e29",
|
||||
"#B c #2b712a",
|
||||
".m c #319231",
|
||||
"#. c #31a130",
|
||||
".M c #32bc32",
|
||||
".X c #349632",
|
||||
".H c #37bb37",
|
||||
"#h c #389635",
|
||||
".p c #3ebd3e",
|
||||
".8 c #3f923c",
|
||||
".I c #40ab40",
|
||||
".i c #52c152",
|
||||
".R c #52c353",
|
||||
".v c #5cc15c",
|
||||
"#A c #5e795f",
|
||||
".a c #5fa25f",
|
||||
".6 c #639064",
|
||||
"#u c #659a65",
|
||||
".B c #68a868",
|
||||
"an c #69696a",
|
||||
".w c #6bcb6c",
|
||||
"af c #6e6e6f",
|
||||
"#9 c #6e6e70",
|
||||
"#5 c #6f6f70",
|
||||
".K c #70ab70",
|
||||
"#0 c #717172",
|
||||
"#W c #727273",
|
||||
"aq c #737373",
|
||||
"#S c #737374",
|
||||
"#G c #747475",
|
||||
"## c #75bc74",
|
||||
".J c #77a876",
|
||||
"ao c #797979",
|
||||
".S c #7ece7e",
|
||||
".1 c #7fd27f",
|
||||
".k c #80b080",
|
||||
"ag c #818181",
|
||||
"ak c #838384",
|
||||
"aa c #878788",
|
||||
".d c #8ab88a",
|
||||
"#r c #8dbc8d",
|
||||
"#2 c #8e8e90",
|
||||
"#O c #8f8f90",
|
||||
"#J c #909091",
|
||||
"#D c #909092",
|
||||
"#e c #919192",
|
||||
".t c #92bd92",
|
||||
"al c #939395",
|
||||
".N c #93d893",
|
||||
"#C c #95b795",
|
||||
"#6 c #989899",
|
||||
"#m c #9abc9a",
|
||||
"#a c #9ecb9e",
|
||||
".e c #a5c8a5",
|
||||
".2 c #a5daa5",
|
||||
".o c #a9e0a9",
|
||||
"#k c #aad4a9",
|
||||
".g c #abddab",
|
||||
"#i c #accaab",
|
||||
"#H c #afafaf",
|
||||
"#M c #b0b0b0",
|
||||
"am c #b0b0b2",
|
||||
"a. c #b1b1b1",
|
||||
".n c #b4e3b4",
|
||||
".l c #b7d1b7",
|
||||
"aj c #bababc",
|
||||
"#g c #bbc9bc",
|
||||
"#d c #bcbcbc",
|
||||
"#v c #bdbdbd",
|
||||
".5 c #bebebe",
|
||||
"#I c #bfbfbf",
|
||||
".4 c #bfd2bf",
|
||||
"#N c #c0c0c0",
|
||||
"ai c #c0c0c3",
|
||||
"#T c #c1c1c1",
|
||||
"ah c #c5c5c8",
|
||||
"ar c #c8c8c8",
|
||||
"ac c #c8c8cb",
|
||||
"#c c #c8d8c8",
|
||||
"a# c #cbcbcb",
|
||||
".# c #cbdccb",
|
||||
"#1 c #cccccc",
|
||||
"ae c #cececf",
|
||||
"#8 c #cfcfd1",
|
||||
"#4 c #d0d0d2",
|
||||
"#f c #d0d0d3",
|
||||
"#Z c #d1d1d2",
|
||||
"#n c #d1d1d3",
|
||||
"#V c #d2d2d3",
|
||||
"#w c #d2d2d4",
|
||||
"#K c #d3d3d4",
|
||||
"#p c #d3d3d5",
|
||||
"#P c #d3d3d6",
|
||||
"#F c #d4d4d5",
|
||||
"#z c #d4d4d6",
|
||||
"#X c #d4d4d7",
|
||||
"#3 c #d5d5d8",
|
||||
"#U c #d8d8da",
|
||||
"#Q c #d9d9db",
|
||||
"#E c #d9d9dc",
|
||||
"ap c #dadada",
|
||||
"ad c #dadadb",
|
||||
"#x c #dadadc",
|
||||
"#q c #dadeda",
|
||||
"#o c #dbdbdd",
|
||||
"ab c #dddddf",
|
||||
".h c #ddf3dd",
|
||||
"#y c #e2e2e3",
|
||||
"#L c #e3e3e3",
|
||||
"#R c #e3e3e4",
|
||||
".U c #e3e8e3",
|
||||
"#Y c #e4e4e4",
|
||||
"#7 c #e5e5e5",
|
||||
" .#.a.b.c.d ",
|
||||
" .e.f.g.h.i.j.k",
|
||||
" .l.m.n.o.p.q.r.s",
|
||||
" .t.u.v.w.x.y.r.z.A",
|
||||
" .B.C.D.E.F.G.y.H.I.J",
|
||||
" .K.L.M.N.O.P.Q.R.S.T.U",
|
||||
" .V.W.X.Y.Z.0.1.2.3.4 ",
|
||||
" .5.6.7.8.9#.###a#b#c ",
|
||||
" #d#e#f#g#h#i#j#k#l#m ",
|
||||
" #d#e#n#o#p#q#r#s#t#u ",
|
||||
" #v#e#w#x#p#y#z#A#B#C ",
|
||||
" .5#D#w#E#p#y#F#G#H ",
|
||||
" #I#J#p#E#K#L#K#G#M ",
|
||||
" #N#O#P#Q#K#R#K#S#M ",
|
||||
" #T#e#P#U#K#R#V#W#M ",
|
||||
" #T#e#X#U#K#Y#Z#0#M ",
|
||||
" #1#2#3#U#V#Y#4#5#M ",
|
||||
" #6#X#n#K#7#8#9a. ",
|
||||
" a#aaabacadaeaf#H ",
|
||||
"f.f.f.f.f. agahacaiajaf#H ",
|
||||
"f.fXfXfXfof. akalamanaoap ",
|
||||
"f.fXfXfXfXfOf.f.f.f.#v#5aqar ",
|
||||
"f.fXfXfXfXfXfXfXfXfXfXfXfXf. ",
|
||||
"f.fXfXfXfXfXfXfXfXfXfXfXfXf. ",
|
||||
"f.fXf+f+f+f+f+f+f+f+f+f+f+f+f+f+ ",
|
||||
"f.fXf+f@f#f$f%f&f*f=f-f;f:f>f,f+ ",
|
||||
"f.f<f.f1f@f#f$f%f2f*f=f-f;f:f2f3 ",
|
||||
"f.f.fXf4f1f@f#f$f%f2f*f=f-f;f3 ",
|
||||
"f.f.fXf5f6f1f@f#f$f%f2f*f=f-f3 ",
|
||||
"f.f7f8fXf5f6f1f@f#f$f%f2f*f%f3 ",
|
||||
"f9f0f<f8fXf5f6f1f@f#f$f%f2f3 ",
|
||||
"fqf+f+f+f+f+f+f+f+f+f+f+f+fw "};
|
||||
214
libs/wxWidgets-3.3.1/samples/widgets/icons/filepicker.xpm
Normal file
214
libs/wxWidgets-3.3.1/samples/widgets/icons/filepicker.xpm
Normal file
@@ -0,0 +1,214 @@
|
||||
/* XPM */
|
||||
static const char *const filepicker_xpm[]={
|
||||
"32 32 179 2",
|
||||
" c None",
|
||||
"f= c #97C4E7",
|
||||
"f: c #72A8D2",
|
||||
"f1 c #FFFFFF",
|
||||
"fw c #839CB5",
|
||||
"fX c #6B98B8",
|
||||
"f. c #5A89A6",
|
||||
"f@ c #3A749C",
|
||||
"f, c #D1E5F5",
|
||||
"f< c #67A1CF",
|
||||
"f> c #F1F4F7",
|
||||
"fe c #85A7BC",
|
||||
"f% c #C3DDF1",
|
||||
"f0 c #749BB4",
|
||||
"f2 c #7EA6C0",
|
||||
"f; c #5F9BC8",
|
||||
"fO c #538DB3",
|
||||
"f- c #85BBE2",
|
||||
"f$ c #D6DFE7",
|
||||
"f9 c #EFF6FC",
|
||||
"fo c #6591AE",
|
||||
"f4 c #F7FBFD",
|
||||
"f8 c #FAFCFE",
|
||||
"f6 c #DAEAF7",
|
||||
"f7 c #E9F3FA",
|
||||
"fq c #FDFDFE",
|
||||
"f3 c #E2EFF8",
|
||||
"f# c #8EA9BC",
|
||||
"f& c #B6D5EE",
|
||||
"f* c #A5CCEA",
|
||||
"f5 c #F4F9FD",
|
||||
"f+ c #4581AA",
|
||||
".P c #00a900",
|
||||
".q c #00aa01",
|
||||
".y c #00ab01",
|
||||
".r c #00ac01",
|
||||
".G c #00ad01",
|
||||
".j c #018700",
|
||||
".C c #018901",
|
||||
".L c #018d00",
|
||||
".Q c #01a901",
|
||||
".D c #029902",
|
||||
".O c #029b02",
|
||||
".F c #03ab03",
|
||||
".Y c #059a05",
|
||||
".u c #067706",
|
||||
".Z c #069905",
|
||||
".E c #06ab06",
|
||||
".W c #0d7e09",
|
||||
"#s c #0d8109",
|
||||
".T c #0f750e",
|
||||
".3 c #117611",
|
||||
"#b c #167616",
|
||||
".z c #16b116",
|
||||
".0 c #179716",
|
||||
".b c #198219",
|
||||
".9 c #1a7a16",
|
||||
".A c #1a7a19",
|
||||
".V c #1a8719",
|
||||
"#j c #1f821a",
|
||||
"#l c #217d1f",
|
||||
".f c #218b20",
|
||||
".x c #22b422",
|
||||
"#t c #267c23",
|
||||
".c c #278427",
|
||||
".s c #288428",
|
||||
".7 c #2a8e29",
|
||||
"#B c #2b712a",
|
||||
".m c #319231",
|
||||
"#. c #31a130",
|
||||
".M c #32bc32",
|
||||
".X c #349632",
|
||||
".H c #37bb37",
|
||||
"#h c #389635",
|
||||
".p c #3ebd3e",
|
||||
".8 c #3f923c",
|
||||
".I c #40ab40",
|
||||
".i c #52c152",
|
||||
".R c #52c353",
|
||||
".v c #5cc15c",
|
||||
"#A c #5e795f",
|
||||
".a c #5fa25f",
|
||||
".6 c #639064",
|
||||
"#u c #659a65",
|
||||
".B c #68a868",
|
||||
"an c #69696a",
|
||||
".w c #6bcb6c",
|
||||
"af c #6e6e6f",
|
||||
"#9 c #6e6e70",
|
||||
"#5 c #6f6f70",
|
||||
".K c #70ab70",
|
||||
"#0 c #717172",
|
||||
"#W c #727273",
|
||||
"aq c #737373",
|
||||
"#S c #737374",
|
||||
"#G c #747475",
|
||||
"## c #75bc74",
|
||||
".J c #77a876",
|
||||
"ao c #797979",
|
||||
".S c #7ece7e",
|
||||
".1 c #7fd27f",
|
||||
".k c #80b080",
|
||||
"ag c #818181",
|
||||
"ak c #838384",
|
||||
"aa c #878788",
|
||||
".d c #8ab88a",
|
||||
"#r c #8dbc8d",
|
||||
"#2 c #8e8e90",
|
||||
"#O c #8f8f90",
|
||||
"#J c #909091",
|
||||
"#D c #909092",
|
||||
"#e c #919192",
|
||||
".t c #92bd92",
|
||||
"al c #939395",
|
||||
".N c #93d893",
|
||||
"#C c #95b795",
|
||||
"#6 c #989899",
|
||||
"#m c #9abc9a",
|
||||
"#a c #9ecb9e",
|
||||
".e c #a5c8a5",
|
||||
".2 c #a5daa5",
|
||||
".o c #a9e0a9",
|
||||
"#k c #aad4a9",
|
||||
".g c #abddab",
|
||||
"#i c #accaab",
|
||||
"#H c #afafaf",
|
||||
"#M c #b0b0b0",
|
||||
"am c #b0b0b2",
|
||||
"a. c #b1b1b1",
|
||||
".n c #b4e3b4",
|
||||
".l c #b7d1b7",
|
||||
"aj c #bababc",
|
||||
"#g c #bbc9bc",
|
||||
"#d c #bcbcbc",
|
||||
"#v c #bdbdbd",
|
||||
".5 c #bebebe",
|
||||
"#I c #bfbfbf",
|
||||
".4 c #bfd2bf",
|
||||
"#N c #c0c0c0",
|
||||
"ai c #c0c0c3",
|
||||
"#T c #c1c1c1",
|
||||
"ah c #c5c5c8",
|
||||
"ar c #c8c8c8",
|
||||
"ac c #c8c8cb",
|
||||
"#c c #c8d8c8",
|
||||
"a# c #cbcbcb",
|
||||
".# c #cbdccb",
|
||||
"#1 c #cccccc",
|
||||
"ae c #cececf",
|
||||
"#8 c #cfcfd1",
|
||||
"#4 c #d0d0d2",
|
||||
"#f c #d0d0d3",
|
||||
"#Z c #d1d1d2",
|
||||
"#n c #d1d1d3",
|
||||
"#V c #d2d2d3",
|
||||
"#w c #d2d2d4",
|
||||
"#K c #d3d3d4",
|
||||
"#p c #d3d3d5",
|
||||
"#P c #d3d3d6",
|
||||
"#F c #d4d4d5",
|
||||
"#z c #d4d4d6",
|
||||
"#X c #d4d4d7",
|
||||
"#3 c #d5d5d8",
|
||||
"#U c #d8d8da",
|
||||
"#Q c #d9d9db",
|
||||
"#E c #d9d9dc",
|
||||
"ap c #dadada",
|
||||
"ad c #dadadb",
|
||||
"#x c #dadadc",
|
||||
"#q c #dadeda",
|
||||
"#o c #dbdbdd",
|
||||
"ab c #dddddf",
|
||||
".h c #ddf3dd",
|
||||
"#y c #e2e2e3",
|
||||
"#L c #e3e3e3",
|
||||
"#R c #e3e3e4",
|
||||
".U c #e3e8e3",
|
||||
"#Y c #e4e4e4",
|
||||
"#7 c #e5e5e5",
|
||||
" .#.a.b.c.d ",
|
||||
" .e.f.g.h.i.j.k",
|
||||
" .l.m.n.o.p.q.r.s",
|
||||
" .t.u.v.w.x.y.r.z.A",
|
||||
" .B.C.D.E.F.G.y.H.I.J",
|
||||
" .K.L.M.N.O.P.Q.R.S.T.U",
|
||||
" .V.W.X.Y.Z.0.1.2.3.4 ",
|
||||
" .5.6.7.8.9#.###a#b#c ",
|
||||
" #d#e#f#g#h#i#j#k#l#m ",
|
||||
" #d#e#n#o#p#q#r#s#t#u ",
|
||||
" #v#e#w#x#p#y#z#A#B#C ",
|
||||
" .5#D#w#E#p#y#F#G#H ",
|
||||
" #I#J#p#E#K#L#K#G#M ",
|
||||
" #N#O#P#Q#K#R#K#S#M ",
|
||||
" #T#e#P#U#K#R#V#W#M ",
|
||||
" #T#e#X#U#K#Y#Z#0#M ",
|
||||
" #1#2#3#U#V#Y#4#5#M ",
|
||||
"f.f.fXfofofOf+f@f#f$ #6#X#n#K#7#8#9a. ",
|
||||
"f.f%f%f&f*f=f-f;f:f;a#aaabacadaeaf#H ",
|
||||
"f.f,f,f%f&f*f=f<f1f=agahacaiajaf#H ",
|
||||
"f#f%f%f%f%f&f*f2f1f1akalamanaoap ",
|
||||
"f#f3f-f-f-f-f-f<fofX#v#5aqar ",
|
||||
"f#f3f4f5f6f,f%f&f*f=f-fO ",
|
||||
"f#f3f-f-f-f-f-f-f-f-f=fO ",
|
||||
"f#f3f5f5f7f3f6f,f%f&f*fo ",
|
||||
"f#f3f-f-f-f-f-f-f-f-f&fo ",
|
||||
"f#f3f8f4f5f9f7f3f6f,f%fX ",
|
||||
"f#f3f-f-f-f-f-f-f-f-f,f0 ",
|
||||
"f#f3f1fqf8f4f5f9f7f3f6f0 ",
|
||||
"f#f3f-f-f-f-f-f-f-f-f3fw ",
|
||||
"f#f3f1f1f1fqf8f4f5f9f7fe ",
|
||||
"f#f#f#f#f#f#f#f#f#f#fef# "};
|
||||
185
libs/wxWidgets-3.3.1/samples/widgets/icons/fontpicker.xpm
Normal file
185
libs/wxWidgets-3.3.1/samples/widgets/icons/fontpicker.xpm
Normal file
@@ -0,0 +1,185 @@
|
||||
/* XPM */
|
||||
static const char *const fontpicker_xpm[]={
|
||||
"32 32 150 2",
|
||||
" c None",
|
||||
"BB c Black",
|
||||
"-- c White",
|
||||
".P c #00a900",
|
||||
".q c #00aa01",
|
||||
".y c #00ab01",
|
||||
".r c #00ac01",
|
||||
".G c #00ad01",
|
||||
".j c #018700",
|
||||
".C c #018901",
|
||||
".L c #018d00",
|
||||
".Q c #01a901",
|
||||
".D c #029902",
|
||||
".O c #029b02",
|
||||
".F c #03ab03",
|
||||
".Y c #059a05",
|
||||
".u c #067706",
|
||||
".Z c #069905",
|
||||
".E c #06ab06",
|
||||
".W c #0d7e09",
|
||||
"#s c #0d8109",
|
||||
".T c #0f750e",
|
||||
".3 c #117611",
|
||||
"#b c #167616",
|
||||
".z c #16b116",
|
||||
".0 c #179716",
|
||||
".b c #198219",
|
||||
".9 c #1a7a16",
|
||||
".A c #1a7a19",
|
||||
".V c #1a8719",
|
||||
"#j c #1f821a",
|
||||
"#l c #217d1f",
|
||||
".f c #218b20",
|
||||
".x c #22b422",
|
||||
"#t c #267c23",
|
||||
".c c #278427",
|
||||
".s c #288428",
|
||||
".7 c #2a8e29",
|
||||
"#B c #2b712a",
|
||||
".m c #319231",
|
||||
"#. c #31a130",
|
||||
".M c #32bc32",
|
||||
".X c #349632",
|
||||
".H c #37bb37",
|
||||
"#h c #389635",
|
||||
".p c #3ebd3e",
|
||||
".8 c #3f923c",
|
||||
".I c #40ab40",
|
||||
".i c #52c152",
|
||||
".R c #52c353",
|
||||
".v c #5cc15c",
|
||||
"#A c #5e795f",
|
||||
".a c #5fa25f",
|
||||
".6 c #639064",
|
||||
"#u c #659a65",
|
||||
".B c #68a868",
|
||||
"an c #69696a",
|
||||
".w c #6bcb6c",
|
||||
"af c #6e6e6f",
|
||||
"#9 c #6e6e70",
|
||||
"#5 c #6f6f70",
|
||||
".K c #70ab70",
|
||||
"#0 c #717172",
|
||||
"#W c #727273",
|
||||
"aq c #737373",
|
||||
"#S c #737374",
|
||||
"#G c #747475",
|
||||
"## c #75bc74",
|
||||
".J c #77a876",
|
||||
"ao c #797979",
|
||||
".S c #7ece7e",
|
||||
".1 c #7fd27f",
|
||||
".k c #80b080",
|
||||
"ag c #818181",
|
||||
"ak c #838384",
|
||||
"aa c #878788",
|
||||
".d c #8ab88a",
|
||||
"#r c #8dbc8d",
|
||||
"#2 c #8e8e90",
|
||||
"#O c #8f8f90",
|
||||
"#J c #909091",
|
||||
"#D c #909092",
|
||||
"#e c #919192",
|
||||
".t c #92bd92",
|
||||
"al c #939395",
|
||||
".N c #93d893",
|
||||
"#C c #95b795",
|
||||
"#6 c #989899",
|
||||
"#m c #9abc9a",
|
||||
"#a c #9ecb9e",
|
||||
".e c #a5c8a5",
|
||||
".2 c #a5daa5",
|
||||
".o c #a9e0a9",
|
||||
"#k c #aad4a9",
|
||||
".g c #abddab",
|
||||
"#i c #accaab",
|
||||
"#H c #afafaf",
|
||||
"#M c #b0b0b0",
|
||||
"am c #b0b0b2",
|
||||
"a. c #b1b1b1",
|
||||
".n c #b4e3b4",
|
||||
".l c #b7d1b7",
|
||||
"aj c #bababc",
|
||||
"#g c #bbc9bc",
|
||||
"#d c #bcbcbc",
|
||||
"#v c #bdbdbd",
|
||||
".5 c #bebebe",
|
||||
"#I c #bfbfbf",
|
||||
".4 c #bfd2bf",
|
||||
"#N c #c0c0c0",
|
||||
"ai c #c0c0c3",
|
||||
"#T c #c1c1c1",
|
||||
"ah c #c5c5c8",
|
||||
"ar c #c8c8c8",
|
||||
"ac c #c8c8cb",
|
||||
"#c c #c8d8c8",
|
||||
"a# c #cbcbcb",
|
||||
".# c #cbdccb",
|
||||
"#1 c #cccccc",
|
||||
"ae c #cececf",
|
||||
"#8 c #cfcfd1",
|
||||
"#4 c #d0d0d2",
|
||||
"#f c #d0d0d3",
|
||||
"#Z c #d1d1d2",
|
||||
"#n c #d1d1d3",
|
||||
"#V c #d2d2d3",
|
||||
"#w c #d2d2d4",
|
||||
"#K c #d3d3d4",
|
||||
"#p c #d3d3d5",
|
||||
"#P c #d3d3d6",
|
||||
"#F c #d4d4d5",
|
||||
"#z c #d4d4d6",
|
||||
"#X c #d4d4d7",
|
||||
"#3 c #d5d5d8",
|
||||
"#U c #d8d8da",
|
||||
"#Q c #d9d9db",
|
||||
"#E c #d9d9dc",
|
||||
"ap c #dadada",
|
||||
"ad c #dadadb",
|
||||
"#x c #dadadc",
|
||||
"#q c #dadeda",
|
||||
"#o c #dbdbdd",
|
||||
"ab c #dddddf",
|
||||
".h c #ddf3dd",
|
||||
"#y c #e2e2e3",
|
||||
"#L c #e3e3e3",
|
||||
"#R c #e3e3e4",
|
||||
".U c #e3e8e3",
|
||||
"#Y c #e4e4e4",
|
||||
"#7 c #e5e5e5",
|
||||
" .#.a.b.c.d ",
|
||||
" .e.f.g.h.i.j.k",
|
||||
" .l.m.n.o.p.q.r.s",
|
||||
" .t.u.v.w.x.y.r.z.A",
|
||||
" .B.C.D.E.F.G.y.H.I.J",
|
||||
" .K.L.M.N.O.P.Q.R.S.T.U",
|
||||
" .V.W.X.Y.Z.0.1.2.3.4 ",
|
||||
" .5.6.7.8.9#.###a#b#c ",
|
||||
" #d#e#f#g#h#i#j#k#l#m ",
|
||||
" #d#e#n#o#p#q#r#s#t#u ",
|
||||
" #v#e#w#x#p#y#z#A#B#C ",
|
||||
" .5#D#w#E#p#y#F#G#H ",
|
||||
" #I#J#p#E#K#L#K#G#M ",
|
||||
"----------------------------#N#O#P#Q#K#R#K#S#M---------- ",
|
||||
"----------BBBBBBBB----BBBB#T#e#P#U#K#R#V#W#MBBBBBBBBBB-- ",
|
||||
"--------BB--------BB----#T#e#X#U#K#Y#Z#0#M----BB-------- ",
|
||||
"------BBBBBB----BB----#1#2#3#U#V#Y#4#5#M----BB---------- ",
|
||||
"----BB--------BB------#6#X#n#K#7#8#9a.----BB------------ ",
|
||||
"--BB----------BBBBBBa#aaabacadaeaf#H----BB-------------- ",
|
||||
"--------------------agahacaiajaf#H---------------------- ",
|
||||
"--BBBBBBBBBB----BBBBakalamanaoap----BBBB--BBBBBBBBBBBB-- ",
|
||||
"--BBBBBBBBBB--BBBBBB#v#5aqarBBBBBB--BBBB--BBBBBBBBBBBB-- ",
|
||||
"--BBBBBBBB----BBBB----BBBB--BBBBBBBBBBBB------BBBB------ ",
|
||||
"--BBBBBBBB----BBBBBBBBBBBB--BBBB--BBBBBB------BBBB------ ",
|
||||
"--BBBB----------BBBBBBBB----BBBB----BBBB------BBBB------ ",
|
||||
"-------------------------------------------------------- ",
|
||||
"--BBBBBBBB----BBBBBB----BB------BB--BBBBBBBBBB---------- ",
|
||||
"--BB--------BB------BB--BBBB----BB------BB-------------- ",
|
||||
"--BBBBBB----BB------BB--BB--BB--BB------BB-------------- ",
|
||||
"--BB--------BB------BB--BB----BBBB------BB-------------- ",
|
||||
"--BB----------BBBBBB----BB------BB------BB-------------- ",
|
||||
"-------------------------------------------------------- "};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/gauge.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/gauge.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const gauge_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"## ##",
|
||||
"## $$$$$$$$$$$$$$$$$::::::::: ##",
|
||||
"## $$$$$$$$$$$$$$$$$::::::::: ##",
|
||||
"## $$$$$$$$$$$$$$$$$::::::::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$ $$$$$ $$$$$ :::: :::: ##",
|
||||
"## $$$$$$$$$$$$$$$$$::::::::: ##",
|
||||
"## $$$$$$$$$$$$$$$$$::::::::: ##",
|
||||
"## $$$$$$$$$$$$$$$$$::::::::: ##",
|
||||
"## ##",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/header.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/header.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const header_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ############################## ",
|
||||
" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ",
|
||||
" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ",
|
||||
" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" ############################## ",
|
||||
" "
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/hyperlnk.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/hyperlnk.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const hyperlnk_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"#######################%######%#",
|
||||
"#######################%#####%%%",
|
||||
"#######################%######%#",
|
||||
"%###%#%###%#%###%####%%%##%%##%#",
|
||||
"%#%#%#%#%#%#%#%#%###%##%#%##%#%#",
|
||||
"%#%#%#%#%#%#%#%#%###%##%#%##%#%#",
|
||||
"#%#%###%#% #%#%##%##%%%##%%##%#",
|
||||
"######### :: ###################",
|
||||
"%%%%%%%%% :: %%%%%%%%%%%%%%%%%%%",
|
||||
"######### :: ###################",
|
||||
"######### :: ###################",
|
||||
"######### :: ###################",
|
||||
"######## :: #################",
|
||||
"####### : :: :: ##############",
|
||||
"###### :: :: :: :: ###########",
|
||||
"###### :: :: :: :: :: ##########",
|
||||
"###### :::::::: :: :: ##########",
|
||||
"###### ::::::::::: :: ##########",
|
||||
"###### :::::::::::::: ##########",
|
||||
"###### :::::::::::::: ##########",
|
||||
"###### :::::::::::::: ##########",
|
||||
"###### :::::::::::::: ##########",
|
||||
"###### ::::::::::::: ###########",
|
||||
"####### :::::::::::: ###########",
|
||||
"####### ::::::::::: ############",
|
||||
"####### ############",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/listbook.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/listbook.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const listbook_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"## ##",
|
||||
"## :::::::: :::::::: :::::::: ##",
|
||||
"## ::$$$$:: :$$::$$: ::$$$$:: ##",
|
||||
"## :$$$$$$: :::$$::: :$$::$$: ##",
|
||||
"## :::::::: :::::::: :::::::: ##",
|
||||
"## : : : : : : : : : ##",
|
||||
"## :::::::: :::::::: :::::::: ##",
|
||||
"## ##",
|
||||
"################################",
|
||||
"######$$$$$$$$$$$$$$$$$$$$$$$$##",
|
||||
"######$::::::::::::::::::::::$##",
|
||||
"####$$$$$$$$$$$$$$$$$$$$$$$$:$##",
|
||||
"####$::::::::::::::::::::::$:$##",
|
||||
"## :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$$$##",
|
||||
"## :::::::::::::::::::::: :$####",
|
||||
"## :::::::::::::::::::::: $$####",
|
||||
"## :::::::::::::::::::::: ######",
|
||||
"## ######",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/listbox.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/listbox.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const listbox_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"### ###",
|
||||
"### :::::::::::::: ::::::::: ###",
|
||||
"### :::::::::::::: ::::::::: ###",
|
||||
"### :: ::::::: :::: :::: ###",
|
||||
"### :::::::::::::: ::: ::: ###",
|
||||
"### :: ::::: :: :: ###",
|
||||
"### :::::::::::::: ::::::::: ###",
|
||||
"### :: :::: ::::::::: ###",
|
||||
"### :::::::::::::: ###",
|
||||
"### :: ::: ::::::::: ###",
|
||||
"### :::::::::::::: ::::::::: ###",
|
||||
"### :: :::: ###",
|
||||
"### :::::::::::::: ::::::::: ###",
|
||||
"### :: ::::: ::::::::: ###",
|
||||
"### :::::::::::::: :: :: ###",
|
||||
"### :: :::: ::: ::: ###",
|
||||
"### :::::::::::::: :::: :::: ###",
|
||||
"### :: ::::::: ::::::::: ###",
|
||||
"### :::::::::::::: ::::::::: ###",
|
||||
"### ###",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
81
libs/wxWidgets-3.3.1/samples/widgets/icons/native.xpm
Normal file
81
libs/wxWidgets-3.3.1/samples/widgets/icons/native.xpm
Normal file
@@ -0,0 +1,81 @@
|
||||
/* XPM */
|
||||
static const char *const native_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 59 1 ",
|
||||
" c #E40000",
|
||||
". c #E50000",
|
||||
"X c #E70000",
|
||||
"o c #EA0000",
|
||||
"O c #EB0000",
|
||||
"+ c #ED0000",
|
||||
"@ c #F10000",
|
||||
"# c #F20000",
|
||||
"$ c #F60000",
|
||||
"% c #FA0000",
|
||||
"& c #FB0000",
|
||||
"* c #FC0000",
|
||||
"= c #FC0001",
|
||||
"- c #FE0002",
|
||||
"; c #FF2C35",
|
||||
": c #FF4F4F",
|
||||
"> c #75ED00",
|
||||
", c #76ED00",
|
||||
"< c #76EE00",
|
||||
"1 c #76F000",
|
||||
"2 c #77F100",
|
||||
"3 c #79F600",
|
||||
"4 c #7AF700",
|
||||
"5 c #7BF700",
|
||||
"6 c #7AF900",
|
||||
"7 c #7BF900",
|
||||
"8 c #7CFB00",
|
||||
"9 c #7DFC00",
|
||||
"0 c #7EFE00",
|
||||
"q c #81FF04",
|
||||
"w c #82FF07",
|
||||
"e c #8AFF17",
|
||||
"r c #8CFF1B",
|
||||
"t c #8CFF1D",
|
||||
"y c #A7FF15",
|
||||
"u c #92FF26",
|
||||
"i c #92FF27",
|
||||
"p c #93FF29",
|
||||
"a c #9AFF37",
|
||||
"s c #9CFF3B",
|
||||
"d c #A1FF46",
|
||||
"f c #A1FF4D",
|
||||
"g c #AAFF56",
|
||||
"h c #A4FF5C",
|
||||
"j c #A2FF68",
|
||||
"k c #B0FF62",
|
||||
"l c #B6FF71",
|
||||
"z c #B8FF73",
|
||||
"x c #C5FF67",
|
||||
"c c #FFA6A6",
|
||||
"v c #FFB4B4",
|
||||
"b c #C0FF83",
|
||||
"n c #CBFF98",
|
||||
"m c #E2FFB3",
|
||||
"M c #B5D9FF",
|
||||
"N c #D2E6FF",
|
||||
"B c #D2E7FF",
|
||||
"V c #DBECFF",
|
||||
"C c None",
|
||||
/* pixels */
|
||||
"CCCCCCVVMNCCCCCC",
|
||||
"CCCBBBBBBBBBCCCC",
|
||||
"CNNNNNNNNNNNNNCC",
|
||||
"C-MMMMMMMMMMMMVC",
|
||||
"CXoMMMMMMMMMMjsC",
|
||||
"Co ;MMMMMh9>>qC",
|
||||
"C+X X%Mfq7>>>>iC",
|
||||
"C# y>57>>>>dC",
|
||||
"C$ Xy6pe>>>>gC",
|
||||
"C% X$%x3>3i2>>kC",
|
||||
"C:%%X y>>>>t7>lC",
|
||||
"Cco y>>>>>9tbC",
|
||||
"CCv+ y>>>>>2gCC",
|
||||
"CCCC# y>>>9zCCCC",
|
||||
"CCCCC%y>anCCCCCC",
|
||||
"CCCCCCmCCCCCCCCC"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/notebook.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/notebook.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const notebook_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"###################$$$$$$$######",
|
||||
"##################$:::::::$#####",
|
||||
"###########$$$$$$$$:::::::$#####",
|
||||
"##########$:::::::$:::::::$#####",
|
||||
"### $:::::::$:::::::$#####",
|
||||
"## ::::::: :::::::$:::::::$$$$##",
|
||||
"## ::::::: :::::::$::::::::::$##",
|
||||
"## ::::::: :::::::$$$$$$$$$$:$##",
|
||||
"## ::::::: ::::::::::::::::$:$##",
|
||||
"## ::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$:$##",
|
||||
"## :::::::::::::::::::::: :$$$##",
|
||||
"## :::::::::::::::::::::: :$####",
|
||||
"## :::::::::::::::::::::: $$####",
|
||||
"## :::::::::::::::::::::: ######",
|
||||
"## ######",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/odcombobox.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/odcombobox.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const odcombobox_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"## ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## :%%%%:&&&&:====: ::::: ##",
|
||||
"## :%%%%:&&&&:====: ::: ##",
|
||||
"## :%%%%:&&&&:====: : ##",
|
||||
"## :::::::::::::::: ##",
|
||||
"## ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### : : ::::::::: ##",
|
||||
"#### :: ::::::::::: :::: :::: ##",
|
||||
"#### :: : : : : ::: ::: ::: ##",
|
||||
"#### :: ::::::::::: :: :: ##",
|
||||
"#### :: : : : ::: ::::::::: ##",
|
||||
"#### :: : ::::::::: ::::::::: ##",
|
||||
"#### :: : : : ::::: ##",
|
||||
"#### :: : ::::::::: ::::::::: ##",
|
||||
"#### :: : : : : ::: ::::::::: ##",
|
||||
"#### :: ::::::::::: ::::::::: ##",
|
||||
"#### :: : : : : ::: ##",
|
||||
"#### :: ::::::::::: ::::::::: ##",
|
||||
"#### :: : : ::::: ::::::::: ##",
|
||||
"#### :::: ::::::::: :: :: ##",
|
||||
"#### :::: : : : ::: ::: ::: ##",
|
||||
"#### :::: ::::::::: :::: :::: ##",
|
||||
"#### :::: :: :: :: ::::::::: ##",
|
||||
"#### :::::::::::::: ::::::::: ##",
|
||||
"#### ##",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/radiobox.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/radiobox.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const radio_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"###########$$$$$$$$$#:##########",
|
||||
"#########$$$ $$#:#########",
|
||||
"########$$ $:::::: $::########",
|
||||
"#######$$ :::::::::::#$::#######",
|
||||
"######$$ :::::::::::::#$::######",
|
||||
"#####$$ :::::::::::::::#$::#####",
|
||||
"####$$ ::::::#####::::::#$:#####",
|
||||
"####$ $:::::$ $#:::::$#:####",
|
||||
"###$$ :::::$ $#::::$#:####",
|
||||
"###$ :::::$ $:::::$:####",
|
||||
"###$ ::::: #::::$:####",
|
||||
"###$ ::::: #::::$:####",
|
||||
"###$ ::::: #::::$:####",
|
||||
"###$ ::::: #::::$:####",
|
||||
"###$ ::::: #::::$:####",
|
||||
"###$ :::::$ $:::::$:####",
|
||||
"###$$ :::::$ $#::::$#:####",
|
||||
"####$ ::::::$ $#:::::$#:####",
|
||||
"####$$#::::::#####::::::$#:#####",
|
||||
"####:$$#:::::::::::::::$#:######",
|
||||
"#####:$$$:::::::::::::$#:#######",
|
||||
"######:$$$:::::::::::$#:########",
|
||||
"#######::$$$::::::$$$::#########",
|
||||
"#########:$$$$$$$$$::###########",
|
||||
"###########::::::::#############",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/scrolbar.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/scrolbar.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const magick[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"## ###",
|
||||
"## ############ ############ ###",
|
||||
"## ############ ############ ###",
|
||||
"## ############ ############ ###",
|
||||
"## ####### #### #### ####### ###",
|
||||
"## ###### #### #### ###### ###",
|
||||
"## ##### #### #### ##### ###",
|
||||
"## #### #### #### #### ###",
|
||||
"## ### #### #### ### ###",
|
||||
"## #### #### #### #### ###",
|
||||
"## ##### #### #### ##### ###",
|
||||
"## ###### #### #### ###### ###",
|
||||
"## ####### #### #### ####### ###",
|
||||
"## ############ ############ ###",
|
||||
"## ############ ############ ###",
|
||||
"## ############ ############ ###",
|
||||
"## ###",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/slider.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/slider.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const slider_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"####### ###################",
|
||||
"###### :::::$ ##################",
|
||||
"###### :####$ ##################",
|
||||
"###### :####$ ##################",
|
||||
"###### :####$ ##################",
|
||||
"###### :####$ ##################",
|
||||
"###### :####$ ##################",
|
||||
"## :####$ ##",
|
||||
"## $$$ :####$ $$$$$$$$$$$$$$$ ##",
|
||||
"## ### :####$ ############### ##",
|
||||
"## ### :####$ ############### ##",
|
||||
"## ### :####$ ############### ##",
|
||||
"###### :####$ ##################",
|
||||
"###### :####$ ##################",
|
||||
"###### :$$$$$ ##################",
|
||||
"####### ###################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
40
libs/wxWidgets-3.3.1/samples/widgets/icons/spinbtn.xpm
Normal file
40
libs/wxWidgets-3.3.1/samples/widgets/icons/spinbtn.xpm
Normal file
@@ -0,0 +1,40 @@
|
||||
/* XPM */
|
||||
static const char *const spinbtn_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 2 1",
|
||||
"$ c None",
|
||||
" c Black",
|
||||
/* pixels */
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$ $$$$",
|
||||
"$$ $$$$",
|
||||
"$$ $$$$$$$$$$ $$$$$$$$$$ $$$$",
|
||||
"$$ $$$$$$$$$$ $$$$$$$$$$ $$$$",
|
||||
"$$ $$$$$$ $$ $$ $$$$$$ $$$$",
|
||||
"$$ $$$$$$ $$ $$ $$$$$$ $$$$",
|
||||
"$$ $$$$ $$ $$ $$$$ $$$$",
|
||||
"$$ $$$$ $$ $$ $$$$ $$$$",
|
||||
"$$ $$ $$ $$ $$ $$$$",
|
||||
"$$ $$ $$ $$ $$ $$$$",
|
||||
"$$ $$$$ $$ $$ $$$$ $$$$",
|
||||
"$$ $$$$ $$ $$ $$$$ $$$$",
|
||||
"$$ $$$$$$ $$ $$ $$$$$$ $$$$",
|
||||
"$$ $$$$$$ $$ $$ $$$$$$ $$$$",
|
||||
"$$ $$$$$$$$$$ $$$$$$$$$$ $$$$",
|
||||
"$$ $$$$$$$$$$ $$$$$$$$$$ $$$$",
|
||||
"$$ $$$$",
|
||||
"$$ $$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
||||
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"
|
||||
};
|
||||
40
libs/wxWidgets-3.3.1/samples/widgets/icons/statbmp.xpm
Normal file
40
libs/wxWidgets-3.3.1/samples/widgets/icons/statbmp.xpm
Normal file
@@ -0,0 +1,40 @@
|
||||
/* XPM */
|
||||
static const char *statbmp_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 2 1",
|
||||
" c Gray0",
|
||||
"# c none",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ######### ########### ##",
|
||||
"## ######## ###### ########## ##",
|
||||
"## ####### ######## ######### ##",
|
||||
"## ######## ######## ######## ##",
|
||||
"## ######### ######## ####### ##",
|
||||
"## ########## ###### ######## ##",
|
||||
"## ########### #### ######### ##",
|
||||
"## ############ ########## ##",
|
||||
"## ########################## ##",
|
||||
"## ### ########### ##",
|
||||
"## ### ########## ########### ##",
|
||||
"## ### ########## ########### ##",
|
||||
"## ### ########## ########### ##",
|
||||
"## ### ########## ########### ##",
|
||||
"## ### ########## ########### ##",
|
||||
"## ### ########### ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ##",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/statbox.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/statbox.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const statbox_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"######## ### # ### # ########",
|
||||
"######## ### # ### #### ########",
|
||||
"######### # ### # #### #########",
|
||||
"## #### ##### #### #### ##",
|
||||
"## ###### # #### ### ######## ##",
|
||||
"## ##### ### ### ### ######## ##",
|
||||
"## ##### ### ### ### ##### ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ########################## ##",
|
||||
"## ##",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/stattext.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/stattext.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const stattext_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"############### ################",
|
||||
"############## ################",
|
||||
"############# ################",
|
||||
"############ ################",
|
||||
"###########$ ################",
|
||||
"##########$ # ################",
|
||||
"########## ## ######## # #",
|
||||
"######### ## ###### # ##",
|
||||
"########$ ### ###### ### ##",
|
||||
"#######$ #### ##### #### ##",
|
||||
"####### ##### #### ### ##",
|
||||
"######$ #### ### ###",
|
||||
"#####$ ###### ### #### ###",
|
||||
"####$ ####### ### ### ###",
|
||||
"#### ######## ### ### ####",
|
||||
"### ######## ### ## ####",
|
||||
"## ######### ## # ##",
|
||||
"# ##### # ## ###",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/text.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/text.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const text_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #808080",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"############################ ###",
|
||||
"############################ ###",
|
||||
"############### ########## ###",
|
||||
"############### ########## ###",
|
||||
"############### ########## ###",
|
||||
"############### ########## ###",
|
||||
"############### ########## ###",
|
||||
"############### ########## ###",
|
||||
"#### ### #### ###",
|
||||
"### ##### ## #### ### ###",
|
||||
"### ##### ## #### ### ###",
|
||||
"###### ## #### ### ###",
|
||||
"#### ## #### ### ###",
|
||||
"### #### ## #### ### ###",
|
||||
"### #### ## #### ### ###",
|
||||
"### #### ## #### ### ###",
|
||||
"### #### ## #### ### ###",
|
||||
"### #### ## #### ### ###",
|
||||
"### #### ## #### ### ###",
|
||||
"#### ## #### ###",
|
||||
"############################ ###",
|
||||
"############################ ###",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################",
|
||||
"################################"
|
||||
};
|
||||
207
libs/wxWidgets-3.3.1/samples/widgets/icons/timepick.xpm
Normal file
207
libs/wxWidgets-3.3.1/samples/widgets/icons/timepick.xpm
Normal file
@@ -0,0 +1,207 @@
|
||||
/* XPM */
|
||||
static const char *timepick_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 169 2",
|
||||
" c None",
|
||||
". c #067706",
|
||||
"X c #0F750E",
|
||||
"o c #0D7E09",
|
||||
"O c #117611",
|
||||
"+ c #167616",
|
||||
"@ c #1A7A16",
|
||||
"# c #1A7A19",
|
||||
"$ c #217D1F",
|
||||
"% c #267C23",
|
||||
"& c #2B712A",
|
||||
"* c #5E795F",
|
||||
"= c #69696A",
|
||||
"- c #6E6E6F",
|
||||
"; c #6E6E70",
|
||||
": c #6F6F70",
|
||||
"> c #717172",
|
||||
", c #727273",
|
||||
"< c #737373",
|
||||
"1 c #737374",
|
||||
"2 c #747475",
|
||||
"3 c #797979",
|
||||
"4 c #FF0000",
|
||||
"5 c #FF4800",
|
||||
"6 c #FF7400",
|
||||
"7 c #FF0048",
|
||||
"8 c #FF0074",
|
||||
"9 c #018700",
|
||||
"0 c #018901",
|
||||
"q c #018D00",
|
||||
"w c #0D8109",
|
||||
"e c #029902",
|
||||
"r c #029B02",
|
||||
"t c #069905",
|
||||
"y c #059A05",
|
||||
"u c #198219",
|
||||
"i c #1F821A",
|
||||
"p c #1A8719",
|
||||
"a c #179716",
|
||||
"s c #00A900",
|
||||
"d c #01A901",
|
||||
"f c #00AA01",
|
||||
"g c #00AB01",
|
||||
"h c #03AB03",
|
||||
"j c #00AC01",
|
||||
"k c #00AD01",
|
||||
"l c #06AB06",
|
||||
"z c #16B116",
|
||||
"x c #278427",
|
||||
"c c #218B20",
|
||||
"v c #288428",
|
||||
"b c #2A8E29",
|
||||
"n c #319231",
|
||||
"m c #349632",
|
||||
"M c #389635",
|
||||
"N c #3F923C",
|
||||
"B c #22B422",
|
||||
"V c #31A130",
|
||||
"C c #32BC32",
|
||||
"Z c #37BB37",
|
||||
"A c #3EBD3E",
|
||||
"S c #40AB40",
|
||||
"D c #5FA25F",
|
||||
"F c #639064",
|
||||
"G c #659A65",
|
||||
"H c #68A868",
|
||||
"J c #70AB70",
|
||||
"K c #77A876",
|
||||
"L c #75BC74",
|
||||
"P c #52C152",
|
||||
"I c #52C353",
|
||||
"U c #5CC15C",
|
||||
"Y c #6BCB6C",
|
||||
"T c #7ECE7E",
|
||||
"R c #7FD27F",
|
||||
"E c #FF9C48",
|
||||
"W c #FF9C74",
|
||||
"Q c #FFBF74",
|
||||
"! c #FF489C",
|
||||
"~ c #FF749C",
|
||||
"^ c #FF74BF",
|
||||
"/ c #808080",
|
||||
"( c #818181",
|
||||
") c #838384",
|
||||
"_ c #878788",
|
||||
"` c #8E8E90",
|
||||
"' c #8F8F90",
|
||||
"] c #909091",
|
||||
"[ c #909092",
|
||||
"{ c #919192",
|
||||
"} c #939395",
|
||||
"| c #989899",
|
||||
" . c #80B080",
|
||||
".. c #8AB88A",
|
||||
"X. c #8DBC8D",
|
||||
"o. c #95B795",
|
||||
"O. c #92BD92",
|
||||
"+. c #9ABC9A",
|
||||
"@. c #AFAFAF",
|
||||
"#. c #B0B0B0",
|
||||
"$. c #B1B1B1",
|
||||
"%. c #B0B0B2",
|
||||
"&. c #BABABC",
|
||||
"*. c #BCBCBC",
|
||||
"=. c #BDBDBD",
|
||||
"-. c #BEBEBE",
|
||||
";. c #BFBFBF",
|
||||
":. c #FF9C9C",
|
||||
">. c #FF9CBF",
|
||||
",. c #9ECB9E",
|
||||
"<. c #93D893",
|
||||
"1. c #A5C8A5",
|
||||
"2. c #ACCAAB",
|
||||
"3. c #A5DAA5",
|
||||
"4. c #AAD4A9",
|
||||
"5. c #ABDDAB",
|
||||
"6. c #BBC9BC",
|
||||
"7. c #B7D1B7",
|
||||
"8. c #BFD2BF",
|
||||
"9. c #A9E0A9",
|
||||
"0. c #B4E3B4",
|
||||
"q. c #FFDF9C",
|
||||
"w. c #FFFFBF",
|
||||
"e. c #FF9CDF",
|
||||
"r. c #FFBFFF",
|
||||
"t. c #C0C0C0",
|
||||
"y. c #C1C1C1",
|
||||
"u. c #C0C0C3",
|
||||
"i. c #C5C5C8",
|
||||
"p. c #C8C8C8",
|
||||
"a. c #C8C8CB",
|
||||
"s. c #CBCBCB",
|
||||
"d. c #CCCCCC",
|
||||
"f. c #CECECF",
|
||||
"g. c #C8D8C8",
|
||||
"h. c #CBDCCB",
|
||||
"j. c #CFCFD1",
|
||||
"k. c #D0D0D2",
|
||||
"l. c #D1D1D2",
|
||||
"z. c #D0D0D3",
|
||||
"x. c #D1D1D3",
|
||||
"c. c #D2D2D3",
|
||||
"v. c #D2D2D4",
|
||||
"b. c #D3D3D4",
|
||||
"n. c #D3D3D5",
|
||||
"m. c #D3D3D6",
|
||||
"M. c #D4D4D5",
|
||||
"N. c #D4D4D6",
|
||||
"B. c #D4D4D7",
|
||||
"V. c #D5D5D8",
|
||||
"C. c #D8D8DA",
|
||||
"Z. c #D9D9DB",
|
||||
"A. c #DADADA",
|
||||
"S. c #DADADB",
|
||||
"D. c #DADEDA",
|
||||
"F. c #D9D9DC",
|
||||
"G. c #DADADC",
|
||||
"H. c #DBDBDD",
|
||||
"J. c #DDDDDF",
|
||||
"K. c #DDF3DD",
|
||||
"L. c #FFFFDF",
|
||||
"P. c #FFDFFF",
|
||||
"I. c #E2E2E3",
|
||||
"U. c #E3E3E3",
|
||||
"Y. c #E3E3E4",
|
||||
"T. c #E4E4E4",
|
||||
"R. c #E5E5E5",
|
||||
"E. c #E3E8E3",
|
||||
"W. c #FFFFFF",
|
||||
/* pixels */
|
||||
" h.D u x .. ",
|
||||
" 1.c 5.K.P 9 .",
|
||||
" 7.n 0.9.A f j v ",
|
||||
" O.. U Y B f j z # ",
|
||||
" H 0 y h h j j Z S K ",
|
||||
" J q C <.r f f P T X E.",
|
||||
" p o m y y a R 3.O 8. ",
|
||||
" ;.F b N @ V L ,.+ g. ",
|
||||
" *.] m.6.M 2.i 4.$ +. ",
|
||||
" ;.] z.H.b.D.X.w % G ",
|
||||
" ;.] m.G.b.U.b.* & o. ",
|
||||
" / ;.' m.G.b.I.B.2 @. ",
|
||||
" ;.' m.G.m.U.b.1 #. ",
|
||||
" y.' m.C.z.U.b.1 #. ",
|
||||
" y.{ m.C.b.T.z.< #. ",
|
||||
" y.{ B.C.b.T.z.< #. ",
|
||||
" d.' B.C.b.T.z.- #. ",
|
||||
" | B.z.b.T.z.- #. ",
|
||||
" d._ J.p.C.z.- #. ",
|
||||
" / i.s.u.&.- #. ",
|
||||
" ) } #.= 3 C. ",
|
||||
" W.W.W.W.W.W.W.W.W.;.: < p.W.W.W.W.W.W.W.W.W.W.W.W.W. ",
|
||||
" W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W. ",
|
||||
" W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W. ",
|
||||
" W.W.W.W.6 e.W.E 4 7 P.W.W.Q 4 7 P.W.q.8 W.W.W.W.W.W. ",
|
||||
" W.W.W.Q :.e.W.W.W.Q r.Q e.W.W.Q r.L.~ :.W.W.W.W.W.W. ",
|
||||
" W.W.W.W.q.e.W.W.w.! W.W.W.w.4 ! W.W P.:.W.W.W.W.W.W. ",
|
||||
" W.W.W.W.q.e.W.w.8 W.W.W.W.W.W.q.>.5 4 4 ! W.W.W.W.W. ",
|
||||
" W.W.W.Q 4 4 e.E 4 4 ^ Q e.E 4 7 P.W.W.:.W.W.W.W.W.W. ",
|
||||
" W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W. ",
|
||||
" W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W. ",
|
||||
" "
|
||||
};
|
||||
54
libs/wxWidgets-3.3.1/samples/widgets/icons/toggle.xpm
Normal file
54
libs/wxWidgets-3.3.1/samples/widgets/icons/toggle.xpm
Normal file
@@ -0,0 +1,54 @@
|
||||
/* XPM */
|
||||
static const char *const toggle_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 16 1",
|
||||
" c Gray0",
|
||||
". c #808000",
|
||||
"X c #000080",
|
||||
"o c #c0c0c0",
|
||||
"O c #000000",
|
||||
"+ c #808000",
|
||||
"@ c #000080",
|
||||
"# c none",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"################################",
|
||||
"#### ##############",
|
||||
"### :::::::::::::: #############",
|
||||
"## :::::::::::::::$ ############",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"# ::oooooooooooooo$$ ###########",
|
||||
"## $$$$$$$$$$$$$$$$ ############",
|
||||
"### $$$$$$$$$$$$$$ #############",
|
||||
"#### ##############",
|
||||
"################################",
|
||||
"################################",
|
||||
"############## ####",
|
||||
"############# $$$$$$$$$$$$$$ ###",
|
||||
"############ $$$$$$$$$$$$$$$: ##",
|
||||
"########### $$:o:o:o:o:o:o:o:: #",
|
||||
"########### $$o:o:o:o:o:o:o::: #",
|
||||
"########### $$:o:o:o:o:o:o:o:: #",
|
||||
"########### $$o:o:o:o:o:o:o::: #",
|
||||
"########### $$:o:o:o:o:o:o:o:: #",
|
||||
"########### $$o:o:o:o:o:o:o::: #",
|
||||
"########### $$:o:o:o:o:o:o:o:: #",
|
||||
"########### $$o:o:o:o:o:o:o::: #",
|
||||
"############ :::::::::::::::: ##",
|
||||
"############# :::::::::::::: ###",
|
||||
"############## ####",
|
||||
"################################"
|
||||
};
|
||||
304
libs/wxWidgets-3.3.1/samples/widgets/itemcontainer.cpp
Normal file
304
libs/wxWidgets-3.3.1/samples/widgets/itemcontainer.cpp
Normal file
@@ -0,0 +1,304 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: itemcontainer.cpp
|
||||
// Purpose: Part of the widgets sample showing wxComboBox
|
||||
// Created: 20.07.07
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/event.h"
|
||||
#endif
|
||||
|
||||
#include "wx/ctrlsub.h"
|
||||
#include "itemcontainer.h"
|
||||
|
||||
|
||||
// Help track client data objects in wxItemContainer instances.
|
||||
class TrackedClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
|
||||
TrackedClientData(ItemContainerWidgetsPage* tracker, int value)
|
||||
: m_tracker(tracker),
|
||||
m_value(value)
|
||||
{
|
||||
m_tracker->StartTrackingData();
|
||||
}
|
||||
TrackedClientData(const TrackedClientData&) = delete;
|
||||
TrackedClientData& operator=(const TrackedClientData&) = delete;
|
||||
|
||||
virtual ~TrackedClientData()
|
||||
{
|
||||
m_tracker->StopTrackingData();
|
||||
}
|
||||
|
||||
int GetValue() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
private:
|
||||
ItemContainerWidgetsPage *m_tracker;
|
||||
int m_value;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
ItemContainerWidgetsPage::ItemContainerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist,
|
||||
const char *const icon[])
|
||||
: WidgetsPage(book, imaglist, icon)
|
||||
#if defined(__WXMSW__) || defined(__WXGTK__)
|
||||
// Reference data needs to be sorted in a dictionary order
|
||||
// since control's items are sorted in this order too.
|
||||
, m_itemsSorted(wxDictionaryStringSortAscending)
|
||||
#endif // __WXMSW__ || __WXGTK__
|
||||
, m_trackedDataObjects(0)
|
||||
{
|
||||
m_items.Add("This");
|
||||
m_items.Add("is");
|
||||
m_items.Add("a");
|
||||
m_items.Add("List");
|
||||
m_items.Add("of");
|
||||
m_items.Add("strings");
|
||||
m_itemsSorted = m_items;
|
||||
}
|
||||
|
||||
ItemContainerWidgetsPage::~ItemContainerWidgetsPage()
|
||||
{
|
||||
}
|
||||
|
||||
wxClientData* ItemContainerWidgetsPage::CreateClientData(int value)
|
||||
{
|
||||
return new TrackedClientData(this, value);
|
||||
}
|
||||
|
||||
void ItemContainerWidgetsPage::StartTrackingData()
|
||||
{
|
||||
++m_trackedDataObjects;
|
||||
}
|
||||
|
||||
void ItemContainerWidgetsPage::StopTrackingData()
|
||||
{
|
||||
--m_trackedDataObjects;
|
||||
}
|
||||
|
||||
bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed()
|
||||
{
|
||||
if ( m_trackedDataObjects )
|
||||
{
|
||||
wxString message = "Bug in managing wxClientData: ";
|
||||
if ( m_trackedDataObjects > 0 )
|
||||
message << m_trackedDataObjects << " lost objects";
|
||||
else
|
||||
message << (-m_trackedDataObjects) << " extra deletes";
|
||||
wxFAIL_MSG(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ItemContainerWidgetsPage::StartTest(const wxString& label)
|
||||
{
|
||||
m_container->Clear();
|
||||
wxLogMessage("Test - %s:", label);
|
||||
}
|
||||
|
||||
void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
|
||||
{
|
||||
const unsigned count = m_container->GetCount();
|
||||
|
||||
bool ok = count == items.GetCount();
|
||||
if ( !ok )
|
||||
{
|
||||
wxFAIL_MSG("Item count does not match.");
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( unsigned i = 0; i < count; ++i )
|
||||
{
|
||||
wxString str = m_container->GetString(i);
|
||||
if ( str != items[i] )
|
||||
{
|
||||
wxFAIL_MSG(wxString::Format(
|
||||
"Wrong string \"%s\" at position %d (expected \"%s\")",
|
||||
str, i, items[i]));
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( m_container->HasClientUntypedData() )
|
||||
{
|
||||
void *data = m_container->GetClientData(i);
|
||||
if ( data && !VerifyClientData((wxUIntPtr)data, str) )
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( m_container->HasClientObjectData() )
|
||||
{
|
||||
TrackedClientData* obj = (TrackedClientData*)m_container->GetClientObject(i);
|
||||
if ( obj && !VerifyClientData(obj->GetValue(), str) )
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
wxLogMessage(DumpContainerData(items));
|
||||
}
|
||||
}
|
||||
|
||||
m_container->Clear();
|
||||
ok &= VerifyAllClientDataDestroyed();
|
||||
|
||||
wxLogMessage("...%s", ok ? "passed" : "failed");
|
||||
}
|
||||
|
||||
wxString
|
||||
ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const
|
||||
{
|
||||
wxString str;
|
||||
str << "Current content:\n";
|
||||
|
||||
unsigned i;
|
||||
for ( i = 0; i < m_container->GetCount(); ++i )
|
||||
{
|
||||
str << " - " << m_container->GetString(i) << " [";
|
||||
if ( m_container->HasClientObjectData() )
|
||||
{
|
||||
TrackedClientData *
|
||||
obj = (TrackedClientData*)m_container->GetClientObject(i);
|
||||
if ( obj )
|
||||
str << obj->GetValue();
|
||||
}
|
||||
else if ( m_container->HasClientUntypedData() )
|
||||
{
|
||||
void *data = m_container->GetClientData(i);
|
||||
if ( data )
|
||||
str << (wxUIntPtr)data;
|
||||
}
|
||||
str << "]\n";
|
||||
}
|
||||
|
||||
str << "Expected content:\n";
|
||||
for ( i = 0; i < expected.GetCount(); ++i )
|
||||
{
|
||||
const wxString& item = expected[i];
|
||||
str << " - " << item << "[";
|
||||
for( unsigned j = 0; j < m_items.GetCount(); ++j )
|
||||
{
|
||||
if ( m_items[j] == item )
|
||||
str << j;
|
||||
}
|
||||
str << "]\n";
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
bool ItemContainerWidgetsPage::VerifyClientData(wxUIntPtr i, const wxString& str)
|
||||
{
|
||||
if ( i > m_items.GetCount() || m_items[i] != str )
|
||||
{
|
||||
wxLogMessage("Client data for '%s' does not match.", str);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxArrayString
|
||||
ItemContainerWidgetsPage::MakeArray(const wxSortedArrayString& sorted)
|
||||
{
|
||||
wxArrayString a;
|
||||
|
||||
const size_t count = sorted.size();
|
||||
a.reserve(count);
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
a.push_back(sorted[n]);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
|
||||
{
|
||||
m_container = GetContainer();
|
||||
wxASSERT_MSG(m_container, "Widget must have a test widget");
|
||||
|
||||
wxLogMessage("wxItemContainer test for %s, %s:",
|
||||
GetWidget()->GetClassInfo()->GetClassName(),
|
||||
(m_container->IsSorted() ? "Sorted" : "Unsorted"));
|
||||
|
||||
const wxArrayString
|
||||
expected_result = m_container->IsSorted() ? MakeArray(m_itemsSorted)
|
||||
: m_items;
|
||||
|
||||
StartTest("Append one item");
|
||||
wxString item = m_items[0];
|
||||
m_container->Append(item);
|
||||
EndTest(wxArrayString(1, &item));
|
||||
|
||||
StartTest("Append some items");
|
||||
m_container->Append(m_items);
|
||||
EndTest(expected_result);
|
||||
|
||||
StartTest("Append some items with data objects");
|
||||
wxClientData **objects = new wxClientData *[m_items.GetCount()];
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
objects[i] = CreateClientData(i);
|
||||
m_container->Append(m_items, objects);
|
||||
EndTest(expected_result);
|
||||
delete[] objects;
|
||||
|
||||
StartTest("Append some items with data");
|
||||
void **data = new void *[m_items.GetCount()];
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
data[i] = wxUIntToPtr(i);
|
||||
m_container->Append(m_items, data);
|
||||
EndTest(expected_result);
|
||||
delete[] data;
|
||||
|
||||
StartTest("Append some items with data, one by one");
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
m_container->Append(m_items[i], wxUIntToPtr(i));
|
||||
EndTest(expected_result);
|
||||
|
||||
StartTest("Append some items with data objects, one by one");
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
m_container->Append(m_items[i], CreateClientData(i));
|
||||
EndTest(expected_result);
|
||||
|
||||
if ( !m_container->IsSorted() )
|
||||
{
|
||||
StartTest("Insert in reverse order with data, one by one");
|
||||
for ( unsigned i = m_items.GetCount(); i; --i )
|
||||
m_container->Insert(m_items[i - 1], 0, wxUIntToPtr(i - 1));
|
||||
EndTest(expected_result);
|
||||
}
|
||||
}
|
||||
|
||||
51
libs/wxWidgets-3.3.1/samples/widgets/itemcontainer.h
Normal file
51
libs/wxWidgets-3.3.1/samples/widgets/itemcontainer.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: itemcontainer.h
|
||||
// Purpose: Part of the widgets sample showing wxComboBox
|
||||
// Created: 20.07.07
|
||||
// License: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_
|
||||
#define _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
class ItemContainerWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
ItemContainerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist,
|
||||
const char *const icon[]);
|
||||
virtual ~ItemContainerWidgetsPage();
|
||||
|
||||
void OnButtonTestItemContainer(wxCommandEvent& event);
|
||||
|
||||
virtual wxItemContainer* GetContainer() const = 0;
|
||||
|
||||
private:
|
||||
void StartTest(const wxString& label);
|
||||
void EndTest(const wxArrayString& result);
|
||||
|
||||
// Track client data in wxItemContainer instances
|
||||
wxClientData* CreateClientData(int value);
|
||||
void StartTrackingData();
|
||||
void StopTrackingData();
|
||||
friend class TrackedClientData;
|
||||
|
||||
bool VerifyAllClientDataDestroyed();
|
||||
bool VerifyClientData(wxUIntPtr i, const wxString& str);
|
||||
|
||||
wxString DumpContainerData(const wxArrayString& expected) const;
|
||||
|
||||
static wxArrayString MakeArray(const wxSortedArrayString& sorted);
|
||||
|
||||
wxArrayString m_items;
|
||||
wxSortedArrayString m_itemsSorted;
|
||||
int m_trackedDataObjects;
|
||||
|
||||
// holds pointer to the widget being tested
|
||||
wxItemContainer *m_container;
|
||||
};
|
||||
|
||||
#endif // _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_
|
||||
731
libs/wxWidgets-3.3.1/samples/widgets/listbox.cpp
Normal file
731
libs/wxWidgets-3.3.1/samples/widgets/listbox.cpp
Normal file
@@ -0,0 +1,731 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: listbox.cpp
|
||||
// Purpose: Part of the widgets sample showing wxListbox
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 27.03.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_LISTBOX
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/listbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "wx/checklst.h"
|
||||
#include "wx/rearrangectrl.h"
|
||||
|
||||
#include "itemcontainer.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/listbox.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
ListboxPage_Reset = wxID_HIGHEST,
|
||||
ListboxPage_Add,
|
||||
ListboxPage_AddText,
|
||||
ListboxPage_AddSeveral,
|
||||
ListboxPage_AddMany,
|
||||
ListboxPage_Clear,
|
||||
ListboxPage_Change,
|
||||
ListboxPage_ChangeText,
|
||||
ListboxPage_Delete,
|
||||
ListboxPage_DeleteText,
|
||||
ListboxPage_DeleteSel,
|
||||
ListboxPage_Listbox,
|
||||
ListboxPage_EnsureVisible,
|
||||
ListboxPage_EnsureVisibleText,
|
||||
ListboxPage_ContainerTests,
|
||||
ListboxPage_GetTopItem,
|
||||
ListboxPage_GetCountPerPage,
|
||||
ListboxPage_MoveUp,
|
||||
ListboxPage_MoveDown,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ListboxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ListboxWidgetsPage : public ItemContainerWidgetsPage
|
||||
{
|
||||
public:
|
||||
ListboxWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_lbox; }
|
||||
virtual wxItemContainer* GetContainer() const override { return m_lbox; }
|
||||
virtual void RecreateWidget() override { CreateLbox(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonChange(wxCommandEvent& event);
|
||||
void OnButtonEnsureVisible(wxCommandEvent& event);
|
||||
void OnButtonDelete(wxCommandEvent& event);
|
||||
void OnButtonDeleteSel(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonAdd(wxCommandEvent& event);
|
||||
void OnButtonAddSeveral(wxCommandEvent& event);
|
||||
void OnButtonAddMany(wxCommandEvent& event);
|
||||
void OnButtonTopItem(wxCommandEvent& event);
|
||||
void OnButtonPageCount(wxCommandEvent& event);
|
||||
void OnButtonMoveUp(wxCommandEvent& evt);
|
||||
void OnButtonMoveDown(wxCommandEvent& evt);
|
||||
|
||||
void OnListbox(wxCommandEvent& event);
|
||||
void OnListboxDClick(wxCommandEvent& event);
|
||||
void OnCheckListbox(wxCommandEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIAddSeveral(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIClearButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIEnsureVisibleButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIMoveButtons(wxUpdateUIEvent& evt);
|
||||
|
||||
// reset the listbox parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the listbox
|
||||
void CreateLbox();
|
||||
|
||||
// read the value of a listbox item index from the given control, return
|
||||
// false if it's invalid
|
||||
bool GetValidIndexFromText(const wxTextCtrl *text, int *n = nullptr) const;
|
||||
|
||||
|
||||
// listbox parameters
|
||||
// ------------------
|
||||
|
||||
// the selection mode
|
||||
enum LboxSelection
|
||||
{
|
||||
LboxSel_Single,
|
||||
LboxSel_Extended,
|
||||
LboxSel_Multiple
|
||||
} m_lboxSelMode;
|
||||
|
||||
// the list type
|
||||
enum LboxType
|
||||
{
|
||||
LboxType_ListBox,
|
||||
LboxType_CheckListBox,
|
||||
LboxType_RearrangeList
|
||||
};
|
||||
|
||||
// should it be sorted?
|
||||
bool m_sorted;
|
||||
|
||||
// should it have horz scroll/vert scrollbar permanently shown?
|
||||
bool m_horzScroll,
|
||||
m_vertScrollAlways;
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the sel mode radiobox
|
||||
wxRadioBox *m_radioSelMode;
|
||||
|
||||
// List type selection radiobox
|
||||
wxRadioBox *m_radioListType;
|
||||
|
||||
// the checkboxes
|
||||
wxCheckBox *m_chkVScroll,
|
||||
*m_chkHScroll,
|
||||
*m_chkSort,
|
||||
*m_chkOwnerDraw;
|
||||
|
||||
// the listbox itself and the sizer it is in
|
||||
wxListBox *m_lbox;
|
||||
|
||||
wxSizer *m_sizerLbox;
|
||||
|
||||
// the text entries for "Add/change string" and "Delete" buttons
|
||||
wxTextCtrl *m_textAdd,
|
||||
*m_textChange,
|
||||
*m_textEnsureVisible,
|
||||
*m_textDelete;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ListboxWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ListboxWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(ListboxPage_Reset, ListboxWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(ListboxPage_Change, ListboxWidgetsPage::OnButtonChange)
|
||||
EVT_BUTTON(ListboxPage_Delete, ListboxWidgetsPage::OnButtonDelete)
|
||||
EVT_BUTTON(ListboxPage_DeleteSel, ListboxWidgetsPage::OnButtonDeleteSel)
|
||||
EVT_BUTTON(ListboxPage_EnsureVisible, ListboxWidgetsPage::OnButtonEnsureVisible)
|
||||
EVT_BUTTON(ListboxPage_Clear, ListboxWidgetsPage::OnButtonClear)
|
||||
EVT_BUTTON(ListboxPage_Add, ListboxWidgetsPage::OnButtonAdd)
|
||||
EVT_BUTTON(ListboxPage_AddSeveral, ListboxWidgetsPage::OnButtonAddSeveral)
|
||||
EVT_BUTTON(ListboxPage_AddMany, ListboxWidgetsPage::OnButtonAddMany)
|
||||
EVT_BUTTON(ListboxPage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
|
||||
EVT_BUTTON(ListboxPage_GetTopItem, ListboxWidgetsPage::OnButtonTopItem)
|
||||
EVT_BUTTON(ListboxPage_GetCountPerPage, ListboxWidgetsPage::OnButtonPageCount)
|
||||
EVT_BUTTON(ListboxPage_MoveUp, ListboxWidgetsPage::OnButtonMoveUp)
|
||||
EVT_BUTTON(ListboxPage_MoveDown, ListboxWidgetsPage::OnButtonMoveDown)
|
||||
|
||||
EVT_TEXT_ENTER(ListboxPage_AddText, ListboxWidgetsPage::OnButtonAdd)
|
||||
EVT_TEXT_ENTER(ListboxPage_DeleteText, ListboxWidgetsPage::OnButtonDelete)
|
||||
EVT_TEXT_ENTER(ListboxPage_EnsureVisibleText, ListboxWidgetsPage::OnButtonEnsureVisible)
|
||||
|
||||
EVT_UPDATE_UI(ListboxPage_Reset, ListboxWidgetsPage::OnUpdateUIResetButton)
|
||||
EVT_UPDATE_UI(ListboxPage_AddSeveral, ListboxWidgetsPage::OnUpdateUIAddSeveral)
|
||||
EVT_UPDATE_UI(ListboxPage_Clear, ListboxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ListboxPage_DeleteText, ListboxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ListboxPage_Delete, ListboxWidgetsPage::OnUpdateUIDeleteButton)
|
||||
EVT_UPDATE_UI(ListboxPage_Change, ListboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ListboxPage_ChangeText, ListboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ListboxPage_DeleteSel, ListboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ListboxPage_EnsureVisible, ListboxWidgetsPage::OnUpdateUIEnsureVisibleButton)
|
||||
EVT_UPDATE_UI_RANGE(ListboxPage_MoveUp, ListboxPage_MoveDown, ListboxWidgetsPage::OnUpdateUIMoveButtons)
|
||||
|
||||
EVT_LISTBOX(ListboxPage_Listbox, ListboxWidgetsPage::OnListbox)
|
||||
EVT_LISTBOX_DCLICK(ListboxPage_Listbox, ListboxWidgetsPage::OnListboxDClick)
|
||||
EVT_CHECKLISTBOX(ListboxPage_Listbox, ListboxWidgetsPage::OnCheckListbox)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, "Listbox",
|
||||
FAMILY_CTRLS | WITH_ITEMS_CTRLS
|
||||
);
|
||||
|
||||
ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: ItemContainerWidgetsPage(book, imaglist, listbox_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_radioSelMode = nullptr;
|
||||
m_radioListType = nullptr;
|
||||
|
||||
m_chkVScroll =
|
||||
m_chkHScroll =
|
||||
m_chkSort =
|
||||
m_chkOwnerDraw = nullptr;
|
||||
|
||||
m_lbox = nullptr;
|
||||
m_sizerLbox = nullptr;
|
||||
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::CreateContent()
|
||||
{
|
||||
/*
|
||||
What we create here is a frame having 3 panes: style pane is the
|
||||
leftmost one, in the middle the pane with buttons allowing to perform
|
||||
miscellaneous listbox operations and the pane containing the listbox
|
||||
itself to the right
|
||||
*/
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set listbox parameters");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkVScroll = CreateCheckBoxAndAddToSizer
|
||||
(
|
||||
sizerLeft,
|
||||
"Always show &vertical scrollbar",
|
||||
wxID_ANY, sizerLeftBox
|
||||
);
|
||||
m_chkHScroll = CreateCheckBoxAndAddToSizer
|
||||
(
|
||||
sizerLeft,
|
||||
"Show &horizontal scrollbar",
|
||||
wxID_ANY, sizerLeftBox
|
||||
);
|
||||
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, "&Sort items", wxID_ANY, sizerLeftBox);
|
||||
m_chkOwnerDraw = CreateCheckBoxAndAddToSizer(sizerLeft, "&Owner drawn", wxID_ANY, sizerLeftBox);
|
||||
|
||||
static const wxString modes[] =
|
||||
{
|
||||
"single",
|
||||
"extended",
|
||||
"multiple",
|
||||
};
|
||||
|
||||
m_radioSelMode = new wxRadioBox(sizerLeftBox, wxID_ANY, "Selection &mode:",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(modes), modes,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
|
||||
static const wxString listTypes[] =
|
||||
{
|
||||
"list box"
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
, "check list box"
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
#if wxUSE_REARRANGECTRL
|
||||
, "rearrange list"
|
||||
#endif // wxUSE_REARRANGECTRL
|
||||
};
|
||||
m_radioListType = new wxRadioBox(sizerLeftBox, wxID_ANY, "&List type:",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(listTypes), listTypes,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5);
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
sizerLeft->Add(m_radioListType, 0, wxGROW | wxALL, 5);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, ListboxPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change listbox contents");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_Add, "&Add this string");
|
||||
m_textAdd = new wxTextCtrl(sizerMiddleBox, ListboxPage_AddText, "test item \t0");
|
||||
sizerRow->Add(btn, 0, wxRIGHT, 5);
|
||||
sizerRow->Add(m_textAdd, 1, wxLEFT, 5);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_AddSeveral, "&Insert a few strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_AddMany, "Add &many strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_Change, "C&hange current");
|
||||
m_textChange = new wxTextCtrl(sizerMiddleBox, ListboxPage_ChangeText, wxEmptyString);
|
||||
sizerRow->Add(btn, 0, wxRIGHT, 5);
|
||||
sizerRow->Add(m_textChange, 1, wxLEFT, 5);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_EnsureVisible, "Make item &visible");
|
||||
m_textEnsureVisible = new wxTextCtrl(sizerMiddleBox, ListboxPage_EnsureVisibleText, wxEmptyString);
|
||||
sizerRow->Add(btn, 0, wxRIGHT, 5);
|
||||
sizerRow->Add(m_textEnsureVisible, 1, wxLEFT, 5);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_Delete, "&Delete this item");
|
||||
m_textDelete = new wxTextCtrl(sizerMiddleBox, ListboxPage_DeleteText, wxEmptyString);
|
||||
sizerRow->Add(btn, 0, wxRIGHT, 5);
|
||||
sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_DeleteSel, "Delete &selection");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_Clear, "&Clear");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_MoveUp, "Move item &up");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_MoveDown, "Move item &down");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_GetTopItem, "Get top item");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_GetCountPerPage, "Get count per page");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ListboxPage_ContainerTests, "Run &tests");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
m_lbox = new wxListBox(this, ListboxPage_Listbox,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0, nullptr,
|
||||
wxLB_HSCROLL);
|
||||
sizerRight->Add(m_lbox, 1, wxGROW | wxALL, 5);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerLbox = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ListboxWidgetsPage::Reset()
|
||||
{
|
||||
m_radioSelMode->SetSelection(LboxSel_Single);
|
||||
m_radioListType->SetSelection(LboxType_ListBox);
|
||||
m_chkVScroll->SetValue(false);
|
||||
m_chkHScroll->SetValue(true);
|
||||
m_chkSort->SetValue(false);
|
||||
m_chkOwnerDraw->SetValue(false);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::CreateLbox()
|
||||
{
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
switch ( m_radioSelMode->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( "unexpected radio box selection" );
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case LboxSel_Single: flags |= wxLB_SINGLE; break;
|
||||
case LboxSel_Extended: flags |= wxLB_EXTENDED; break;
|
||||
case LboxSel_Multiple: flags |= wxLB_MULTIPLE; break;
|
||||
}
|
||||
|
||||
if ( m_chkVScroll->GetValue() )
|
||||
flags |= wxLB_ALWAYS_SB;
|
||||
if ( m_chkHScroll->GetValue() )
|
||||
flags |= wxLB_HSCROLL;
|
||||
if ( m_chkSort->GetValue() )
|
||||
flags |= wxLB_SORT;
|
||||
if ( m_chkOwnerDraw->GetValue() )
|
||||
flags |= wxLB_OWNERDRAW;
|
||||
|
||||
wxArrayString items;
|
||||
wxArrayInt order;
|
||||
if ( m_lbox )
|
||||
{
|
||||
int count = m_lbox->GetCount();
|
||||
for ( int n = 0; n < count; n++ )
|
||||
{
|
||||
items.Add(m_lbox->GetString(n));
|
||||
}
|
||||
|
||||
order.reserve(count);
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
wxCheckListBox* cblist = wxDynamicCast(m_lbox, wxCheckListBox);
|
||||
if ( cblist )
|
||||
{
|
||||
for ( int n = 0; n < count; n++ )
|
||||
order.Add(cblist->IsChecked(n) ? n : ~n);
|
||||
}
|
||||
else
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
{
|
||||
for( int n = 0; n < count; n++ )
|
||||
order.Add(~n);
|
||||
}
|
||||
|
||||
m_sizerLbox->Detach( m_lbox );
|
||||
delete m_lbox;
|
||||
}
|
||||
|
||||
switch( m_radioListType->GetSelection() )
|
||||
{
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
case LboxType_CheckListBox:
|
||||
m_lbox = new wxCheckListBox(this, ListboxPage_Listbox,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
items,
|
||||
flags);
|
||||
{
|
||||
wxCheckListBox* cblist = wxDynamicCast(m_lbox, wxCheckListBox);
|
||||
for ( size_t n = 0; n < order.size(); n++ )
|
||||
cblist->Check(n, order[n] >= 0);
|
||||
}
|
||||
break;
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
#if wxUSE_REARRANGECTRL
|
||||
case LboxType_RearrangeList:
|
||||
m_lbox = new wxRearrangeList(this, ListboxPage_Listbox,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
order, items,
|
||||
flags);
|
||||
break;
|
||||
#endif // wxUSE_REARRANGECTRL
|
||||
case LboxType_ListBox:
|
||||
wxFALLTHROUGH;
|
||||
default:
|
||||
m_lbox = new wxListBox(this, ListboxPage_Listbox,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
items,
|
||||
flags);
|
||||
}
|
||||
|
||||
NotifyWidgetRecreation(m_lbox);
|
||||
|
||||
m_sizerLbox->Add(m_lbox, 1, wxGROW | wxALL, 5);
|
||||
m_sizerLbox->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// miscellaneous helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
ListboxWidgetsPage::GetValidIndexFromText(const wxTextCtrl *text, int *n) const
|
||||
{
|
||||
unsigned long idx;
|
||||
if ( !text->GetValue().ToULong(&idx) || (idx >= m_lbox->GetCount()) )
|
||||
{
|
||||
// don't give the warning if we're just testing but do give it if we
|
||||
// want to retrieve the value as this is only done in answer to a user
|
||||
// action
|
||||
if ( n )
|
||||
{
|
||||
wxLogWarning("Invalid index \"%s\"", text->GetValue());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( n )
|
||||
*n = idx;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ListboxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateLbox();
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxArrayInt selections;
|
||||
int count = m_lbox->GetSelections(selections);
|
||||
wxString s = m_textChange->GetValue();
|
||||
for ( int n = 0; n < count; n++ )
|
||||
{
|
||||
m_lbox->SetString(selections[n], s);
|
||||
}
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonEnsureVisible(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int n;
|
||||
if ( !GetValidIndexFromText(m_textEnsureVisible, &n) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_lbox->EnsureVisible(n);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int n;
|
||||
if ( !GetValidIndexFromText(m_textDelete, &n) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_lbox->Delete(n);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxArrayInt selections;
|
||||
int n = m_lbox->GetSelections(selections);
|
||||
while ( n > 0 )
|
||||
{
|
||||
m_lbox->Delete(selections[--n]);
|
||||
}
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_lbox->Clear();
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonTopItem(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int item = m_lbox->GetTopItem();
|
||||
wxLogMessage("Topmost visible item is: %d", item);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonPageCount(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int count = m_lbox->GetCountPerPage();
|
||||
wxLogMessage("%d items fit into this listbox.", count);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
wxString s = m_textAdd->GetValue();
|
||||
if ( !m_textAdd->IsModified() )
|
||||
{
|
||||
// update the default string
|
||||
m_textAdd->SetValue(wxString::Format("test item \t%u", ++s_item));
|
||||
}
|
||||
|
||||
m_lbox->Append(s);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// "many" means 1000 here
|
||||
for ( unsigned int n = 0; n < 1000; n++ )
|
||||
{
|
||||
m_lbox->Append(wxString::Format("item #%u", n));
|
||||
}
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxArrayString items;
|
||||
items.Add("First");
|
||||
items.Add("another one");
|
||||
items.Add("and the last (very very very very very very very very very very long) one");
|
||||
m_lbox->InsertItems(items, 0);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonMoveUp(wxCommandEvent& WXUNUSED(evt))
|
||||
{
|
||||
#if wxUSE_REARRANGECTRL
|
||||
wxRearrangeList* list = wxDynamicCast(m_lbox, wxRearrangeList);
|
||||
list->MoveCurrentUp();
|
||||
#endif // wxUSE_REARRANGECTRL
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonMoveDown(wxCommandEvent& WXUNUSED(evt))
|
||||
{
|
||||
#if wxUSE_REARRANGECTRL
|
||||
wxRearrangeList* list = wxDynamicCast(m_lbox, wxRearrangeList);
|
||||
list->MoveCurrentDown();
|
||||
#endif // wxUSE_REARRANGECTRL
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( (m_radioSelMode->GetSelection() != LboxSel_Single) ||
|
||||
m_chkSort->GetValue() ||
|
||||
m_chkOwnerDraw->GetValue() ||
|
||||
!m_chkHScroll->GetValue() ||
|
||||
m_chkVScroll->GetValue() );
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnUpdateUIEnsureVisibleButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(GetValidIndexFromText(m_textEnsureVisible));
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(GetValidIndexFromText(m_textDelete));
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
wxArrayInt selections;
|
||||
event.Enable(m_lbox->GetSelections(selections) != 0);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(m_lbox->GetCount() != 0);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(!(m_lbox->GetWindowStyle() & wxLB_SORT));
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnUpdateUIMoveButtons(wxUpdateUIEvent& evt)
|
||||
{
|
||||
evt.Enable(m_radioListType->GetSelection() == LboxType_RearrangeList);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnListbox(wxCommandEvent& event)
|
||||
{
|
||||
long sel = event.GetSelection();
|
||||
m_textDelete->SetValue(wxString::Format("%ld", sel));
|
||||
|
||||
if (event.IsSelection())
|
||||
{
|
||||
wxLogMessage("Listbox item %ld selected", sel);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage("Listbox item %ld deselected", sel);
|
||||
}
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage( "Listbox item %d double clicked", event.GetInt() );
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage( "Listbox item %d toggled", event.GetInt() );
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateLbox();
|
||||
}
|
||||
|
||||
#endif // wxUSE_LISTBOX
|
||||
352
libs/wxWidgets-3.3.1/samples/widgets/makefile.gcc
Normal file
352
libs/wxWidgets-3.3.1/samples/widgets/makefile.gcc
Normal file
@@ -0,0 +1,352 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.2.13 (http://www.bakefile.org)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
include ../../build/msw/config.gcc
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Do not modify the rest of this file!
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
### Variables: ###
|
||||
|
||||
CPPDEPS = -MT$@ -MF$@.d -MD -MP
|
||||
WX_RELEASE_NODOT = 33
|
||||
COMPILER_PREFIX = gcc
|
||||
OBJS = \
|
||||
$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
|
||||
LIBDIRNAME = \
|
||||
.\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
|
||||
SETUPHDIR = $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)
|
||||
WIDGETS_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
|
||||
-D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
|
||||
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
||||
-I$(SETUPHDIR) -I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_p) -W \
|
||||
-Wall -I. $(__DLLFLAG_p) -I.\..\..\samples -DNOPCH $(__RTTIFLAG_5) \
|
||||
$(__EXCEPTIONSFLAG_6) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
|
||||
WIDGETS_OBJECTS = \
|
||||
$(OBJS)\widgets_sample_rc.o \
|
||||
$(OBJS)\widgets_activityindicator.o \
|
||||
$(OBJS)\widgets_bmpcombobox.o \
|
||||
$(OBJS)\widgets_button.o \
|
||||
$(OBJS)\widgets_checkbox.o \
|
||||
$(OBJS)\widgets_choice.o \
|
||||
$(OBJS)\widgets_clrpicker.o \
|
||||
$(OBJS)\widgets_combobox.o \
|
||||
$(OBJS)\widgets_datepick.o \
|
||||
$(OBJS)\widgets_dirctrl.o \
|
||||
$(OBJS)\widgets_dirpicker.o \
|
||||
$(OBJS)\widgets_editlbox.o \
|
||||
$(OBJS)\widgets_filectrl.o \
|
||||
$(OBJS)\widgets_filepicker.o \
|
||||
$(OBJS)\widgets_fontpicker.o \
|
||||
$(OBJS)\widgets_gauge.o \
|
||||
$(OBJS)\widgets_headerctrl.o \
|
||||
$(OBJS)\widgets_hyperlnk.o \
|
||||
$(OBJS)\widgets_itemcontainer.o \
|
||||
$(OBJS)\widgets_listbox.o \
|
||||
$(OBJS)\widgets_native.o \
|
||||
$(OBJS)\widgets_notebook.o \
|
||||
$(OBJS)\widgets_odcombobox.o \
|
||||
$(OBJS)\widgets_radiobox.o \
|
||||
$(OBJS)\widgets_searchctrl.o \
|
||||
$(OBJS)\widgets_slider.o \
|
||||
$(OBJS)\widgets_spinbtn.o \
|
||||
$(OBJS)\widgets_static.o \
|
||||
$(OBJS)\widgets_statbmp.o \
|
||||
$(OBJS)\widgets_textctrl.o \
|
||||
$(OBJS)\widgets_timepick.o \
|
||||
$(OBJS)\widgets_toggle.o \
|
||||
$(OBJS)\widgets_widgets.o
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
ifeq ($(USE_GUI),0)
|
||||
PORTNAME = base
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
PORTNAME = msw$(TOOLKIT_VERSION)
|
||||
endif
|
||||
ifeq ($(OFFICIAL_BUILD),1)
|
||||
COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
WXDEBUGFLAG = d
|
||||
endif
|
||||
ifeq ($(WXUNIV),1)
|
||||
WXUNIVNAME = univ
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
WXDLLFLAG = dll
|
||||
endif
|
||||
ifeq ($(SHARED),0)
|
||||
LIBTYPE_SUFFIX = lib
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
LIBTYPE_SUFFIX = dll
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),0)
|
||||
EXTRALIBS_FOR_BASE =
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),1)
|
||||
EXTRALIBS_FOR_BASE =
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
__OPTIMIZEFLAG_2 = -O0
|
||||
endif
|
||||
ifeq ($(BUILD),release)
|
||||
__OPTIMIZEFLAG_2 = -O2
|
||||
endif
|
||||
ifeq ($(USE_RTTI),0)
|
||||
__RTTIFLAG_5 = -fno-rtti
|
||||
endif
|
||||
ifeq ($(USE_RTTI),1)
|
||||
__RTTIFLAG_5 =
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),0)
|
||||
__EXCEPTIONSFLAG_6 = -fno-exceptions
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),1)
|
||||
__EXCEPTIONSFLAG_6 =
|
||||
endif
|
||||
ifeq ($(WXUNIV),1)
|
||||
__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
|
||||
endif
|
||||
ifeq ($(WXUNIV),1)
|
||||
__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
|
||||
endif
|
||||
ifeq ($(DEBUG_FLAG),0)
|
||||
__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
|
||||
endif
|
||||
ifeq ($(DEBUG_FLAG),0)
|
||||
__DEBUG_DEFINE_p_1 = --define wxDEBUG_LEVEL=0
|
||||
endif
|
||||
ifeq ($(BUILD),release)
|
||||
__NDEBUG_DEFINE_p = -DNDEBUG
|
||||
endif
|
||||
ifeq ($(BUILD),release)
|
||||
__NDEBUG_DEFINE_p_1 = --define NDEBUG
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),0)
|
||||
__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),0)
|
||||
__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
|
||||
endif
|
||||
ifeq ($(USE_RTTI),0)
|
||||
__RTTI_DEFINE_p = -DwxNO_RTTI
|
||||
endif
|
||||
ifeq ($(USE_RTTI),0)
|
||||
__RTTI_DEFINE_p_1 = --define wxNO_RTTI
|
||||
endif
|
||||
ifeq ($(USE_THREADS),0)
|
||||
__THREAD_DEFINE_p = -DwxNO_THREADS
|
||||
endif
|
||||
ifeq ($(USE_THREADS),0)
|
||||
__THREAD_DEFINE_p_1 = --define wxNO_THREADS
|
||||
endif
|
||||
ifeq ($(USE_CAIRO),1)
|
||||
____CAIRO_INCLUDEDIR_FILENAMES_p = -I$(CAIRO_ROOT)\include\cairo
|
||||
endif
|
||||
ifeq ($(USE_CAIRO),1)
|
||||
__CAIRO_INCLUDEDIR_p = --include-dir $(CAIRO_ROOT)/include/cairo
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
__DLLFLAG_p = -DWXUSINGDLL
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
__DLLFLAG_p_1 = --define WXUSINGDLL
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),0)
|
||||
__WXLIB_CORE_p = \
|
||||
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),0)
|
||||
__WXLIB_BASE_p = -lwxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),1)
|
||||
__WXLIB_MONO_p = \
|
||||
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),1)
|
||||
ifeq ($(USE_STC),1)
|
||||
__LIB_SCINTILLA_IF_MONO_p = -lwxscintilla$(WXDEBUGFLAG)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),1)
|
||||
ifeq ($(USE_STC),1)
|
||||
__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(USE_STC),1)
|
||||
__LIB_LEXILLA_p = -lwxlexilla$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
__LIB_TIFF_p = -lwxtiff$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
__LIB_JPEG_p = -lwxjpeg$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
__LIB_PNG_p = -lwxpng$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
__LIB_WEBP_p = -lwxwebp$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(USE_CAIRO),1)
|
||||
__CAIRO_LIB_p = -lcairo
|
||||
endif
|
||||
ifeq ($(USE_CAIRO),1)
|
||||
____CAIRO_LIBDIR_FILENAMES_p = -L$(CAIRO_ROOT)\lib
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
ifeq ($(DEBUG_INFO),default)
|
||||
__DEBUGINFO = -g
|
||||
endif
|
||||
endif
|
||||
ifeq ($(BUILD),release)
|
||||
ifeq ($(DEBUG_INFO),default)
|
||||
__DEBUGINFO =
|
||||
endif
|
||||
endif
|
||||
ifeq ($(DEBUG_INFO),0)
|
||||
__DEBUGINFO =
|
||||
endif
|
||||
ifeq ($(DEBUG_INFO),1)
|
||||
__DEBUGINFO = -g
|
||||
endif
|
||||
ifeq ($(USE_THREADS),0)
|
||||
__THREADSFLAG =
|
||||
endif
|
||||
ifeq ($(USE_THREADS),1)
|
||||
__THREADSFLAG = -mthreads
|
||||
endif
|
||||
|
||||
|
||||
all: $(OBJS)
|
||||
$(OBJS):
|
||||
-if not exist $(OBJS) mkdir $(OBJS)
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\widgets.exe
|
||||
|
||||
clean:
|
||||
-if exist $(OBJS)\*.o del $(OBJS)\*.o
|
||||
-if exist $(OBJS)\*.d del $(OBJS)\*.d
|
||||
-if exist $(OBJS)\widgets.exe del $(OBJS)\widgets.exe
|
||||
|
||||
$(OBJS)\widgets.exe: $(WIDGETS_OBJECTS) $(OBJS)\widgets_sample_rc.o
|
||||
$(foreach f,$(subst \,/,$(WIDGETS_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
|
||||
@move /y $@.rsp.tmp $@.rsp >nul
|
||||
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lgdiplus -lmsimg32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
|
||||
@-del $@.rsp
|
||||
|
||||
$(OBJS)\widgets_sample_rc.o: ./../../samples/sample.rc
|
||||
$(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_1) --define wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST) --include-dir ./../../samples --define NOPCH
|
||||
|
||||
$(OBJS)\widgets_activityindicator.o: ./activityindicator.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_bmpcombobox.o: ./bmpcombobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_button.o: ./button.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_checkbox.o: ./checkbox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_choice.o: ./choice.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_clrpicker.o: ./clrpicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_combobox.o: ./combobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_datepick.o: ./datepick.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_dirctrl.o: ./dirctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_dirpicker.o: ./dirpicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_editlbox.o: ./editlbox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_filectrl.o: ./filectrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_filepicker.o: ./filepicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_fontpicker.o: ./fontpicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_gauge.o: ./gauge.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_headerctrl.o: ./headerctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_hyperlnk.o: ./hyperlnk.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_itemcontainer.o: ./itemcontainer.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_listbox.o: ./listbox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_native.o: ./native.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_notebook.o: ./notebook.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_odcombobox.o: ./odcombobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_radiobox.o: ./radiobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_searchctrl.o: ./searchctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_slider.o: ./slider.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_spinbtn.o: ./spinbtn.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_static.o: ./static.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_statbmp.o: ./statbmp.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_textctrl.o: ./textctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_timepick.o: ./timepick.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_toggle.o: ./toggle.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\widgets_widgets.o: ./widgets.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
||||
SHELL := $(COMSPEC)
|
||||
|
||||
# Dependencies tracking:
|
||||
-include $(OBJS)/*.d
|
||||
241
libs/wxWidgets-3.3.1/samples/widgets/makefile.unx
Normal file
241
libs/wxWidgets-3.3.1/samples/widgets/makefile.unx
Normal file
@@ -0,0 +1,241 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.2.13 (http://www.bakefile.org)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# These are configurable options:
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# C++ compiler
|
||||
CXX = `$(WX_CONFIG) --cxx`
|
||||
|
||||
# Standard flags for C++
|
||||
CXXFLAGS ?=
|
||||
|
||||
# Standard preprocessor flags (common for CC and CXX)
|
||||
CPPFLAGS ?=
|
||||
|
||||
# Standard linker flags
|
||||
LDFLAGS ?=
|
||||
|
||||
# Location and arguments of wx-config script
|
||||
WX_CONFIG ?= wx-config
|
||||
|
||||
# Port of the wx library to build against [gtk2,msw,x11,osx_cocoa,osx_carbon,dfb]
|
||||
WX_PORT ?= $(shell $(WX_CONFIG) --query-toolkit)
|
||||
|
||||
# Use DLL build of wx library to use? [0,1]
|
||||
WX_SHARED ?= $(shell if test -z `$(WX_CONFIG) --query-linkage`; then echo 1; else echo 0; fi)
|
||||
|
||||
# Compile Unicode build of wxWidgets? [0,1]
|
||||
WX_UNICODE ?= $(shell $(WX_CONFIG) --query-chartype | sed 's/unicode/1/;s/ansi/0/')
|
||||
|
||||
# Version of the wx library to build against.
|
||||
WX_VERSION ?= $(shell $(WX_CONFIG) --query-version | sed -e 's/\([0-9]*\)\.\([0-9]*\)/\1\2/')
|
||||
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Do not modify the rest of this file!
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
### Variables: ###
|
||||
|
||||
CPPDEPS = -MT$@ -MF`echo $@ | sed -e 's,\.o$$,.d,'` -MD -MP
|
||||
WX_VERSION_MAJOR = $(shell echo $(WX_VERSION) | cut -c1,1)
|
||||
WX_VERSION_MINOR = $(shell echo $(WX_VERSION) | cut -c2,2)
|
||||
WX_CONFIG_FLAGS = $(WX_CONFIG_UNICODE_FLAG) $(WX_CONFIG_SHARED_FLAG) \
|
||||
--toolkit=$(WX_PORT) --version=$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
|
||||
WIDGETS_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) \
|
||||
$(CXXFLAGS)
|
||||
WIDGETS_OBJECTS = \
|
||||
widgets_activityindicator.o \
|
||||
widgets_bmpcombobox.o \
|
||||
widgets_button.o \
|
||||
widgets_checkbox.o \
|
||||
widgets_choice.o \
|
||||
widgets_clrpicker.o \
|
||||
widgets_combobox.o \
|
||||
widgets_datepick.o \
|
||||
widgets_dirctrl.o \
|
||||
widgets_dirpicker.o \
|
||||
widgets_editlbox.o \
|
||||
widgets_filectrl.o \
|
||||
widgets_filepicker.o \
|
||||
widgets_fontpicker.o \
|
||||
widgets_gauge.o \
|
||||
widgets_headerctrl.o \
|
||||
widgets_hyperlnk.o \
|
||||
widgets_itemcontainer.o \
|
||||
widgets_listbox.o \
|
||||
widgets_native.o \
|
||||
widgets_notebook.o \
|
||||
widgets_odcombobox.o \
|
||||
widgets_radiobox.o \
|
||||
widgets_searchctrl.o \
|
||||
widgets_slider.o \
|
||||
widgets_spinbtn.o \
|
||||
widgets_static.o \
|
||||
widgets_statbmp.o \
|
||||
widgets_textctrl.o \
|
||||
widgets_timepick.o \
|
||||
widgets_toggle.o \
|
||||
widgets_widgets.o
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
ifeq ($(WX_UNICODE),0)
|
||||
WX_CONFIG_UNICODE_FLAG = --unicode=no
|
||||
endif
|
||||
ifeq ($(WX_UNICODE),1)
|
||||
WX_CONFIG_UNICODE_FLAG = --unicode=yes
|
||||
endif
|
||||
ifeq ($(WX_SHARED),0)
|
||||
WX_CONFIG_SHARED_FLAG = --static=yes
|
||||
endif
|
||||
ifeq ($(WX_SHARED),1)
|
||||
WX_CONFIG_SHARED_FLAG = --static=no
|
||||
endif
|
||||
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: test_for_selected_wxbuild widgets
|
||||
|
||||
install:
|
||||
|
||||
uninstall:
|
||||
|
||||
clean:
|
||||
rm -f ./*.o
|
||||
rm -f ./*.d
|
||||
rm -f widgets
|
||||
|
||||
test_for_selected_wxbuild:
|
||||
@$(WX_CONFIG) $(WX_CONFIG_FLAGS)
|
||||
|
||||
widgets: $(WIDGETS_OBJECTS)
|
||||
$(CXX) -o $@ $(WIDGETS_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs core,base`
|
||||
|
||||
widgets_activityindicator.o: ./activityindicator.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_bmpcombobox.o: ./bmpcombobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_button.o: ./button.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_checkbox.o: ./checkbox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_choice.o: ./choice.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_clrpicker.o: ./clrpicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_combobox.o: ./combobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_datepick.o: ./datepick.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_dirctrl.o: ./dirctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_dirpicker.o: ./dirpicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_editlbox.o: ./editlbox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_filectrl.o: ./filectrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_filepicker.o: ./filepicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_fontpicker.o: ./fontpicker.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_gauge.o: ./gauge.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_headerctrl.o: ./headerctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_hyperlnk.o: ./hyperlnk.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_itemcontainer.o: ./itemcontainer.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_listbox.o: ./listbox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_native.o: ./native.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_notebook.o: ./notebook.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_odcombobox.o: ./odcombobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_radiobox.o: ./radiobox.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_searchctrl.o: ./searchctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_slider.o: ./slider.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_spinbtn.o: ./spinbtn.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_static.o: ./static.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_statbmp.o: ./statbmp.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_textctrl.o: ./textctrl.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_timepick.o: ./timepick.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_toggle.o: ./toggle.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
widgets_widgets.o: ./widgets.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
||||
|
||||
widgets_native_wrapper.o: ./native_wrapper.mm ./native.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(OBJCXXFLAGS) ./native_wrapper.mm
|
||||
|
||||
ifeq ($(WX_PORT),osx_cocoa)
|
||||
WIDGETS_OBJECTS += widgets_native_wrapper.o
|
||||
|
||||
widgets: widgets_native_wrapper.o
|
||||
endif
|
||||
ifeq ($(WX_PORT),gtk2)
|
||||
widgets_native.o: CXXFLAGS=$(shell pkg-config --cflags gtk+-2.0)
|
||||
widgets: LDFLAGS=$(shell pkg-config --libs gtk+-2.0)
|
||||
endif
|
||||
ifeq ($(WX_PORT),gtk3)
|
||||
widgets_native.o: CXXFLAGS=$(shell pkg-config --cflags gtk+-3.0)
|
||||
widgets: LDFLAGS=$(shell pkg-config --libs gtk+-3.0)
|
||||
endif
|
||||
|
||||
# Dependencies tracking:
|
||||
-include ./*.d
|
||||
565
libs/wxWidgets-3.3.1/samples/widgets/makefile.vc
Normal file
565
libs/wxWidgets-3.3.1/samples/widgets/makefile.vc
Normal file
@@ -0,0 +1,565 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.2.13 (http://www.bakefile.org)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
!include <../../build/msw/config.vc>
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Do not modify the rest of this file!
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
### Variables: ###
|
||||
|
||||
WX_RELEASE_NODOT = 33
|
||||
COMPILER_PREFIX = vc
|
||||
OBJS = \
|
||||
$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
|
||||
LIBDIRNAME = \
|
||||
.\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG)
|
||||
SETUPHDIR = $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)
|
||||
WIDGETS_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
|
||||
$(__DEBUGINFO_0) /Fd$(OBJS)\widgets.pdb $(____DEBUGRUNTIME_3_p) \
|
||||
$(__OPTIMIZEFLAG_6) /D_CRT_SECURE_NO_DEPRECATE=1 \
|
||||
/D_CRT_NON_CONFORMING_SWPRINTFS=1 /D_SCL_SECURE_NO_WARNINGS=1 \
|
||||
$(__NO_VC_CRTDBG_p) $(__TARGET_CPU_COMPFLAG_p) /D__WXMSW__ \
|
||||
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
|
||||
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
||||
/I$(SETUPHDIR) /I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_p) /W4 /I. \
|
||||
$(__DLLFLAG_p) /D_WINDOWS /I.\..\..\samples /DNOPCH $(__RTTIFLAG_11) \
|
||||
$(__EXCEPTIONSFLAG_12) $(CPPFLAGS) $(CXXFLAGS)
|
||||
WIDGETS_OBJECTS = \
|
||||
$(OBJS)\widgets_activityindicator.obj \
|
||||
$(OBJS)\widgets_bmpcombobox.obj \
|
||||
$(OBJS)\widgets_button.obj \
|
||||
$(OBJS)\widgets_checkbox.obj \
|
||||
$(OBJS)\widgets_choice.obj \
|
||||
$(OBJS)\widgets_clrpicker.obj \
|
||||
$(OBJS)\widgets_combobox.obj \
|
||||
$(OBJS)\widgets_datepick.obj \
|
||||
$(OBJS)\widgets_dirctrl.obj \
|
||||
$(OBJS)\widgets_dirpicker.obj \
|
||||
$(OBJS)\widgets_editlbox.obj \
|
||||
$(OBJS)\widgets_filectrl.obj \
|
||||
$(OBJS)\widgets_filepicker.obj \
|
||||
$(OBJS)\widgets_fontpicker.obj \
|
||||
$(OBJS)\widgets_gauge.obj \
|
||||
$(OBJS)\widgets_headerctrl.obj \
|
||||
$(OBJS)\widgets_hyperlnk.obj \
|
||||
$(OBJS)\widgets_itemcontainer.obj \
|
||||
$(OBJS)\widgets_listbox.obj \
|
||||
$(OBJS)\widgets_native.obj \
|
||||
$(OBJS)\widgets_notebook.obj \
|
||||
$(OBJS)\widgets_odcombobox.obj \
|
||||
$(OBJS)\widgets_radiobox.obj \
|
||||
$(OBJS)\widgets_searchctrl.obj \
|
||||
$(OBJS)\widgets_slider.obj \
|
||||
$(OBJS)\widgets_spinbtn.obj \
|
||||
$(OBJS)\widgets_static.obj \
|
||||
$(OBJS)\widgets_statbmp.obj \
|
||||
$(OBJS)\widgets_textctrl.obj \
|
||||
$(OBJS)\widgets_timepick.obj \
|
||||
$(OBJS)\widgets_toggle.obj \
|
||||
$(OBJS)\widgets_widgets.obj
|
||||
WIDGETS_RESOURCES = \
|
||||
$(OBJS)\widgets_sample.res
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
!if "$(TARGET_CPU)" == "AMD64"
|
||||
ARCH_SUFFIX = _x64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "ARM"
|
||||
ARCH_SUFFIX = _arm
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "ARM64"
|
||||
ARCH_SUFFIX = _arm64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "IA64"
|
||||
ARCH_SUFFIX = _ia64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "X64"
|
||||
ARCH_SUFFIX = _x64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
|
||||
ARCH_SUFFIX = _x64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
|
||||
ARCH_SUFFIX = _x64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "amd64"
|
||||
ARCH_SUFFIX = _x64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "arm"
|
||||
ARCH_SUFFIX = _arm
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "arm64"
|
||||
ARCH_SUFFIX = _arm64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "ia64"
|
||||
ARCH_SUFFIX = _ia64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "x64"
|
||||
ARCH_SUFFIX = _x64
|
||||
!endif
|
||||
!if "$(USE_GUI)" == "0"
|
||||
PORTNAME = base
|
||||
!endif
|
||||
!if "$(USE_GUI)" == "1"
|
||||
PORTNAME = msw$(TOOLKIT_VERSION)
|
||||
!endif
|
||||
!if "$(OFFICIAL_BUILD)" == "1"
|
||||
COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
WXDEBUGFLAG = d
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
|
||||
WXDEBUGFLAG = d
|
||||
!endif
|
||||
!if "$(WXUNIV)" == "1"
|
||||
WXUNIVNAME = univ
|
||||
!endif
|
||||
!if "$(SHARED)" == "1"
|
||||
WXDLLFLAG = dll
|
||||
!endif
|
||||
!if "$(SHARED)" == "0"
|
||||
LIBTYPE_SUFFIX = lib
|
||||
!endif
|
||||
!if "$(SHARED)" == "1"
|
||||
LIBTYPE_SUFFIX = dll
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "AMD64"
|
||||
LINK_TARGET_CPU = /MACHINE:X64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "ARM"
|
||||
LINK_TARGET_CPU = /MACHINE:ARM
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "ARM64"
|
||||
LINK_TARGET_CPU = /MACHINE:ARM64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "IA64"
|
||||
LINK_TARGET_CPU = /MACHINE:IA64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "X64"
|
||||
LINK_TARGET_CPU = /MACHINE:X64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
|
||||
LINK_TARGET_CPU = /MACHINE:X64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
|
||||
LINK_TARGET_CPU = /MACHINE:X64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "amd64"
|
||||
LINK_TARGET_CPU = /MACHINE:X64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "arm"
|
||||
LINK_TARGET_CPU = /MACHINE:ARM
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "arm64"
|
||||
LINK_TARGET_CPU = /MACHINE:ARM64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "ia64"
|
||||
LINK_TARGET_CPU = /MACHINE:IA64
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "x64"
|
||||
LINK_TARGET_CPU = /MACHINE:X64
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "17.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
|
||||
!endif
|
||||
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "17.0"
|
||||
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
|
||||
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "0"
|
||||
EXTRALIBS_FOR_BASE =
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "1"
|
||||
EXTRALIBS_FOR_BASE =
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
|
||||
__DEBUGINFO_0 = /Zi
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
|
||||
__DEBUGINFO_0 =
|
||||
!endif
|
||||
!if "$(DEBUG_INFO)" == "0"
|
||||
__DEBUGINFO_0 =
|
||||
!endif
|
||||
!if "$(DEBUG_INFO)" == "1"
|
||||
__DEBUGINFO_0 = /Zi
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
|
||||
__DEBUGINFO_1 = /DEBUG
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
|
||||
__DEBUGINFO_1 =
|
||||
!endif
|
||||
!if "$(DEBUG_INFO)" == "0"
|
||||
__DEBUGINFO_1 =
|
||||
!endif
|
||||
!if "$(DEBUG_INFO)" == "1"
|
||||
__DEBUGINFO_1 = /DEBUG
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
|
||||
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
|
||||
__DEBUGINFO_2 =
|
||||
!endif
|
||||
!if "$(DEBUG_INFO)" == "0"
|
||||
__DEBUGINFO_2 =
|
||||
!endif
|
||||
!if "$(DEBUG_INFO)" == "1"
|
||||
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
____DEBUGRUNTIME_3_p = /D_DEBUG
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
____DEBUGRUNTIME_3_p =
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
____DEBUGRUNTIME_3_p =
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
|
||||
____DEBUGRUNTIME_3_p = /D_DEBUG
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
____DEBUGRUNTIME_3_p_1 =
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
____DEBUGRUNTIME_3_p_1 =
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
|
||||
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
__DEBUGRUNTIME_4 = d
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
__DEBUGRUNTIME_4 =
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
__DEBUGRUNTIME_4 =
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
|
||||
__DEBUGRUNTIME_4 = d
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
__DEBUGRUNTIME_5 =
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
|
||||
__DEBUGRUNTIME_5 =
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug"
|
||||
__OPTIMIZEFLAG_6 = /Od
|
||||
!endif
|
||||
!if "$(BUILD)" == "release"
|
||||
__OPTIMIZEFLAG_6 = /O2
|
||||
!endif
|
||||
!if "$(USE_THREADS)" == "0"
|
||||
__THREADSFLAG_9 = L
|
||||
!endif
|
||||
!if "$(USE_THREADS)" == "1"
|
||||
__THREADSFLAG_9 = T
|
||||
!endif
|
||||
!if "$(RUNTIME_LIBS)" == "dynamic"
|
||||
__RUNTIME_LIBS_10 = D
|
||||
!endif
|
||||
!if "$(RUNTIME_LIBS)" == "static"
|
||||
__RUNTIME_LIBS_10 = $(__THREADSFLAG_9)
|
||||
!endif
|
||||
!if "$(USE_RTTI)" == "0"
|
||||
__RTTIFLAG_11 = /GR-
|
||||
!endif
|
||||
!if "$(USE_RTTI)" == "1"
|
||||
__RTTIFLAG_11 = /GR
|
||||
!endif
|
||||
!if "$(USE_EXCEPTIONS)" == "0"
|
||||
__EXCEPTIONSFLAG_12 =
|
||||
!endif
|
||||
!if "$(USE_EXCEPTIONS)" == "1"
|
||||
__EXCEPTIONSFLAG_12 = /EHsc
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
|
||||
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
|
||||
!endif
|
||||
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
|
||||
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == ""
|
||||
__TARGET_CPU_COMPFLAG_p = /DTARGET_CPU_COMPFLAG=0
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
|
||||
__TARGET_CPU_COMPFLAG_p =
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
|
||||
__TARGET_CPU_COMPFLAG_p =
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == ""
|
||||
__TARGET_CPU_COMPFLAG_p_1 = /d TARGET_CPU_COMPFLAG=0
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
|
||||
__TARGET_CPU_COMPFLAG_p_1 =
|
||||
!endif
|
||||
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
|
||||
__TARGET_CPU_COMPFLAG_p_1 =
|
||||
!endif
|
||||
!if "$(WXUNIV)" == "1"
|
||||
__WXUNIV_DEFINE_p = /D__WXUNIVERSAL__
|
||||
!endif
|
||||
!if "$(WXUNIV)" == "1"
|
||||
__WXUNIV_DEFINE_p_1 = /d __WXUNIVERSAL__
|
||||
!endif
|
||||
!if "$(DEBUG_FLAG)" == "0"
|
||||
__DEBUG_DEFINE_p = /DwxDEBUG_LEVEL=0
|
||||
!endif
|
||||
!if "$(DEBUG_FLAG)" == "0"
|
||||
__DEBUG_DEFINE_p_1 = /d wxDEBUG_LEVEL=0
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
__NDEBUG_DEFINE_p = /DNDEBUG
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
__NDEBUG_DEFINE_p = /DNDEBUG
|
||||
!endif
|
||||
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
|
||||
__NDEBUG_DEFINE_p_1 = /d NDEBUG
|
||||
!endif
|
||||
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
|
||||
__NDEBUG_DEFINE_p_1 = /d NDEBUG
|
||||
!endif
|
||||
!if "$(USE_EXCEPTIONS)" == "0"
|
||||
__EXCEPTIONS_DEFINE_p = /DwxNO_EXCEPTIONS
|
||||
!endif
|
||||
!if "$(USE_EXCEPTIONS)" == "0"
|
||||
__EXCEPTIONS_DEFINE_p_1 = /d wxNO_EXCEPTIONS
|
||||
!endif
|
||||
!if "$(USE_RTTI)" == "0"
|
||||
__RTTI_DEFINE_p = /DwxNO_RTTI
|
||||
!endif
|
||||
!if "$(USE_RTTI)" == "0"
|
||||
__RTTI_DEFINE_p_1 = /d wxNO_RTTI
|
||||
!endif
|
||||
!if "$(USE_THREADS)" == "0"
|
||||
__THREAD_DEFINE_p = /DwxNO_THREADS
|
||||
!endif
|
||||
!if "$(USE_THREADS)" == "0"
|
||||
__THREAD_DEFINE_p_1 = /d wxNO_THREADS
|
||||
!endif
|
||||
!if "$(USE_CAIRO)" == "1"
|
||||
____CAIRO_INCLUDEDIR_FILENAMES_p = /I$(CAIRO_ROOT)\include\cairo
|
||||
!endif
|
||||
!if "$(USE_CAIRO)" == "1"
|
||||
____CAIRO_INCLUDEDIR_FILENAMES_1_p = /i $(CAIRO_ROOT)\include\cairo
|
||||
!endif
|
||||
!if "$(SHARED)" == "1"
|
||||
__DLLFLAG_p = /DWXUSINGDLL
|
||||
!endif
|
||||
!if "$(SHARED)" == "1"
|
||||
__DLLFLAG_p_1 = /d WXUSINGDLL
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "0"
|
||||
__WXLIB_CORE_p = \
|
||||
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "0"
|
||||
__WXLIB_BASE_p = \
|
||||
wxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "1"
|
||||
__WXLIB_MONO_p = \
|
||||
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "1" && "$(USE_STC)" == "1"
|
||||
__LIB_SCINTILLA_IF_MONO_p = wxscintilla$(WXDEBUGFLAG).lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "1" && "$(USE_STC)" == "1"
|
||||
__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
|
||||
!endif
|
||||
!if "$(USE_STC)" == "1"
|
||||
__LIB_LEXILLA_p = wxlexilla$(WXDEBUGFLAG).lib
|
||||
!endif
|
||||
!if "$(USE_GUI)" == "1"
|
||||
__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib
|
||||
!endif
|
||||
!if "$(USE_GUI)" == "1"
|
||||
__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib
|
||||
!endif
|
||||
!if "$(USE_GUI)" == "1"
|
||||
__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib
|
||||
!endif
|
||||
!if "$(USE_GUI)" == "1"
|
||||
__LIB_WEBP_p = wxwebp$(WXDEBUGFLAG).lib
|
||||
!endif
|
||||
!if "$(USE_CAIRO)" == "1"
|
||||
__CAIRO_LIB_p = cairo.lib
|
||||
!endif
|
||||
!if "$(USE_CAIRO)" == "1"
|
||||
____CAIRO_LIBDIR_FILENAMES_p = /LIBPATH:$(CAIRO_ROOT)\lib
|
||||
!endif
|
||||
|
||||
|
||||
all: $(OBJS)
|
||||
$(OBJS):
|
||||
-if not exist $(OBJS) mkdir $(OBJS)
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\widgets.exe
|
||||
|
||||
clean:
|
||||
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
|
||||
-if exist $(OBJS)\*.res del $(OBJS)\*.res
|
||||
-if exist $(OBJS)\*.pch del $(OBJS)\*.pch
|
||||
-if exist $(OBJS)\widgets.exe del $(OBJS)\widgets.exe
|
||||
-if exist $(OBJS)\widgets.ilk del $(OBJS)\widgets.ilk
|
||||
-if exist $(OBJS)\widgets.pdb del $(OBJS)\widgets.pdb
|
||||
|
||||
$(OBJS)\widgets.exe: $(WIDGETS_OBJECTS) $(OBJS)\widgets_sample.res
|
||||
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\widgets.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
|
||||
$(WIDGETS_OBJECTS) $(WIDGETS_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib gdiplus.lib msimg32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
|
||||
<<
|
||||
|
||||
$(OBJS)\widgets_sample.res: .\..\..\samples\sample.rc
|
||||
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_3_p_1) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_1) $(__TARGET_CPU_COMPFLAG_p_1) /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\samples /d NOPCH .\..\..\samples\sample.rc
|
||||
|
||||
$(OBJS)\widgets_activityindicator.obj: .\activityindicator.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\activityindicator.cpp
|
||||
|
||||
$(OBJS)\widgets_bmpcombobox.obj: .\bmpcombobox.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\bmpcombobox.cpp
|
||||
|
||||
$(OBJS)\widgets_button.obj: .\button.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\button.cpp
|
||||
|
||||
$(OBJS)\widgets_checkbox.obj: .\checkbox.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\checkbox.cpp
|
||||
|
||||
$(OBJS)\widgets_choice.obj: .\choice.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\choice.cpp
|
||||
|
||||
$(OBJS)\widgets_clrpicker.obj: .\clrpicker.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\clrpicker.cpp
|
||||
|
||||
$(OBJS)\widgets_combobox.obj: .\combobox.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\combobox.cpp
|
||||
|
||||
$(OBJS)\widgets_datepick.obj: .\datepick.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\datepick.cpp
|
||||
|
||||
$(OBJS)\widgets_dirctrl.obj: .\dirctrl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\dirctrl.cpp
|
||||
|
||||
$(OBJS)\widgets_dirpicker.obj: .\dirpicker.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\dirpicker.cpp
|
||||
|
||||
$(OBJS)\widgets_editlbox.obj: .\editlbox.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\editlbox.cpp
|
||||
|
||||
$(OBJS)\widgets_filectrl.obj: .\filectrl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\filectrl.cpp
|
||||
|
||||
$(OBJS)\widgets_filepicker.obj: .\filepicker.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\filepicker.cpp
|
||||
|
||||
$(OBJS)\widgets_fontpicker.obj: .\fontpicker.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\fontpicker.cpp
|
||||
|
||||
$(OBJS)\widgets_gauge.obj: .\gauge.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\gauge.cpp
|
||||
|
||||
$(OBJS)\widgets_headerctrl.obj: .\headerctrl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\headerctrl.cpp
|
||||
|
||||
$(OBJS)\widgets_hyperlnk.obj: .\hyperlnk.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\hyperlnk.cpp
|
||||
|
||||
$(OBJS)\widgets_itemcontainer.obj: .\itemcontainer.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\itemcontainer.cpp
|
||||
|
||||
$(OBJS)\widgets_listbox.obj: .\listbox.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\listbox.cpp
|
||||
|
||||
$(OBJS)\widgets_native.obj: .\native.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\native.cpp
|
||||
|
||||
$(OBJS)\widgets_notebook.obj: .\notebook.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\notebook.cpp
|
||||
|
||||
$(OBJS)\widgets_odcombobox.obj: .\odcombobox.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\odcombobox.cpp
|
||||
|
||||
$(OBJS)\widgets_radiobox.obj: .\radiobox.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\radiobox.cpp
|
||||
|
||||
$(OBJS)\widgets_searchctrl.obj: .\searchctrl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\searchctrl.cpp
|
||||
|
||||
$(OBJS)\widgets_slider.obj: .\slider.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\slider.cpp
|
||||
|
||||
$(OBJS)\widgets_spinbtn.obj: .\spinbtn.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\spinbtn.cpp
|
||||
|
||||
$(OBJS)\widgets_static.obj: .\static.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\static.cpp
|
||||
|
||||
$(OBJS)\widgets_statbmp.obj: .\statbmp.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\statbmp.cpp
|
||||
|
||||
$(OBJS)\widgets_textctrl.obj: .\textctrl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\textctrl.cpp
|
||||
|
||||
$(OBJS)\widgets_timepick.obj: .\timepick.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\timepick.cpp
|
||||
|
||||
$(OBJS)\widgets_toggle.obj: .\toggle.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\toggle.cpp
|
||||
|
||||
$(OBJS)\widgets_widgets.obj: .\widgets.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\widgets.cpp
|
||||
|
||||
339
libs/wxWidgets-3.3.1/samples/widgets/native.cpp
Normal file
339
libs/wxWidgets-3.3.1/samples/widgets/native.cpp
Normal file
@@ -0,0 +1,339 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: native.cpp
|
||||
// Purpose: Part of the widgets sample showing native control integration
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2015-07-30
|
||||
// Copyright: (c) 2015 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
// this file is included from native.mm which ensures that it is compiled as
|
||||
// Objective C++, but it's also still compiled by the makefiles directly as C++
|
||||
// source because we can't easily exclude it, so check for this and only
|
||||
// compile the rest of this file once
|
||||
#if !defined(__WXOSX_COCOA__) || defined(__OBJC__)
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/menu.h"
|
||||
#include "wx/sizer.h"
|
||||
#endif // !WX_PRECOMP
|
||||
|
||||
#include "wx/nativewin.h"
|
||||
|
||||
#ifdef wxHAS_NATIVE_WINDOW
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/native.xpm"
|
||||
|
||||
// Helper to create a menu to be shown in our button.
|
||||
//
|
||||
// The menu is supposed to be initially empty, don't call this more than once
|
||||
// for the same object.
|
||||
void BuildTestMenu(wxMenu *menu)
|
||||
{
|
||||
menu->Append(wxID_NEW, "Do it with a new file");
|
||||
menu->Append(wxID_OPEN, "Do it with an existing file");
|
||||
menu->AppendSeparator();
|
||||
menu->Append(wxID_ABOUT);
|
||||
}
|
||||
|
||||
// Create the native control in a -- necessarily -- platform-specific way.
|
||||
#ifdef __WXMSW__
|
||||
|
||||
#include "wx/msw/wrapcctl.h" // for BS_SPLITBUTTON
|
||||
|
||||
#ifndef BS_SPLITBUTTON
|
||||
#define BS_SPLITBUTTON 0x000c
|
||||
#endif // BS_SPLITBUTTON
|
||||
|
||||
#ifndef BCN_DROPDOWN
|
||||
#define BCN_DROPDOWN (-1248)
|
||||
#endif // defined(BCN_DROPDOWN)
|
||||
|
||||
// This duplicates the standard NMBCDROPDOWN struct which is not defined in
|
||||
// some old (up to at least 4.9.1) MinGW-w64 headers even though, annoyingly,
|
||||
// BCN_DROPDOWN is, so we can't even use as an indicator of whether the struct
|
||||
// is defined or not.
|
||||
struct wxNMBCDROPDOWN
|
||||
{
|
||||
NMHDR hdr;
|
||||
RECT rcButton;
|
||||
};
|
||||
|
||||
class NativeWindow : public wxNativeWindow
|
||||
{
|
||||
public:
|
||||
explicit NativeWindow(wxWindow* parent)
|
||||
: wxNativeWindow()
|
||||
{
|
||||
// When creating the native window, we must specify the valid parent
|
||||
// and while we don't have to specify any position if it's going to be
|
||||
// laid out by sizers, we do need the size.
|
||||
const wxSize size = FromDIP(wxSize(140, 30));
|
||||
|
||||
HWND hwnd = ::CreateWindow
|
||||
(
|
||||
TEXT("BUTTON"),
|
||||
TEXT("Press me to do it"),
|
||||
WS_CHILD | WS_VISIBLE | BS_SPLITBUTTON,
|
||||
0, 0, size.x, size.y,
|
||||
(HWND)parent->GetHWND(), 0, nullptr, nullptr
|
||||
);
|
||||
if ( !hwnd )
|
||||
{
|
||||
wxLogError("Creating split button failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
(void)Create(parent, wxID_ANY, hwnd);
|
||||
}
|
||||
|
||||
virtual ~NativeWindow()
|
||||
{
|
||||
// If you don't call this, you need to call DestroyWindow() later.
|
||||
//
|
||||
// Also notice that a HWND can't continue to exist under MSW if its
|
||||
// parent its destroyed, so you may also want to reparent it under some
|
||||
// other window if the parent of this window is also getting destroyed.
|
||||
Disown();
|
||||
}
|
||||
|
||||
protected:
|
||||
// Split buttons under MSW don't show the menu on their own, unlike their
|
||||
// equivalents under the other platforms, so do it manually here. This also
|
||||
// shows how to handle a native event in MSW (for the specific case of
|
||||
// WM_NOTIFY, more generally MSWHandleMessage() could be overridden).
|
||||
virtual bool
|
||||
MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override
|
||||
{
|
||||
const NMHDR* hdr = reinterpret_cast<NMHDR*>(lParam);
|
||||
if ( hdr->code != BCN_DROPDOWN )
|
||||
return wxNativeWindow::MSWOnNotify(idCtrl, lParam, result);
|
||||
|
||||
const wxNMBCDROPDOWN* dd = reinterpret_cast<wxNMBCDROPDOWN*>(lParam);
|
||||
|
||||
wxMenu menu;
|
||||
BuildTestMenu(&menu);
|
||||
PopupMenu(&menu, wxPoint(dd->rcButton.right, dd->rcButton.bottom));
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#elif defined(__WXGTK__)
|
||||
|
||||
// Avoid a bunch of warnings from gtk.h for some GTK+ versions.
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
wxGCC_WARNING_SUPPRESS(parentheses)
|
||||
#include <gtk/gtk.h>
|
||||
wxGCC_WARNING_RESTORE(parentheses)
|
||||
wxGCC_WARNING_RESTORE(deprecated-declarations)
|
||||
|
||||
class NativeWindow : public wxNativeWindow
|
||||
{
|
||||
public:
|
||||
explicit NativeWindow(wxWindow* parent)
|
||||
: wxNativeWindow()
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,6,0)
|
||||
BuildTestMenu(&m_menu);
|
||||
|
||||
GtkWidget* const widget = gtk_menu_button_new();
|
||||
gtk_menu_button_set_popup(GTK_MENU_BUTTON(widget), m_menu.m_menu);
|
||||
#else // GTK+ < 3.6
|
||||
// Menu buttons are only available since GTK+ 3.6, so use something
|
||||
// even simpler for earlier versions (including GTK+ 2) just as a
|
||||
// placeholder.
|
||||
GtkWidget* const widget = gtk_label_new("");
|
||||
gtk_label_set_markup
|
||||
(
|
||||
GTK_LABEL(widget),
|
||||
"<b>Sorry</b>, but your GTK+ is too old to have menu buttons."
|
||||
);
|
||||
#endif // GTK+ 3.6/earlier
|
||||
|
||||
wxGCC_WARNING_SUPPRESS(ignored-qualifiers)
|
||||
g_object_ref_sink(widget);
|
||||
wxGCC_WARNING_RESTORE(ignored-qualifiers)
|
||||
|
||||
(void)Create(parent, wxID_ANY, widget);
|
||||
}
|
||||
|
||||
virtual ~NativeWindow()
|
||||
{
|
||||
// If you don't call this, you need to call g_object_unref() on the
|
||||
// widget yourself. The advantage of this is that you don't necessarily
|
||||
// have to do it right now and could keep using the native widget and
|
||||
// destroy it later. But if you don't need it any longer, as is the
|
||||
// case here, it's simpler to just call Disown() to let it be destroyed
|
||||
// immediately.
|
||||
Disown();
|
||||
}
|
||||
|
||||
private:
|
||||
wxMenu m_menu;
|
||||
};
|
||||
|
||||
#elif defined(__WXOSX_COCOA__)
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
class NativeWindow : public wxNativeWindow
|
||||
{
|
||||
public:
|
||||
explicit NativeWindow(wxWindow* parent)
|
||||
: wxNativeWindow()
|
||||
{
|
||||
// Neither the position nor the size really matter: the former because
|
||||
// the window will be positioned by the sizers, the latter because its
|
||||
// "fitting" size will be used as the best size by default.
|
||||
NSPopUpButton* const v = [[NSPopUpButton alloc]
|
||||
initWithFrame:NSMakeRect(0, 0, 0, 0)
|
||||
pullsDown:YES];
|
||||
|
||||
wxMenu menu;
|
||||
BuildTestMenu(&menu);
|
||||
[v setMenu:(NSMenu*)menu.GetHMenu()];
|
||||
|
||||
// In a pull down (but not pop up) buttons, items start with 1 and the
|
||||
// 0-th one is used as title.
|
||||
[v insertItemWithTitle:@"Press me to do it" atIndex:0];
|
||||
|
||||
// By default the control would disable the button title because it
|
||||
// doesn't appear in the list of the menu items, prevent this from
|
||||
// happening.
|
||||
[v setAutoenablesItems:NO];
|
||||
|
||||
(void)Create(parent, wxID_ANY, v);
|
||||
}
|
||||
|
||||
virtual ~NativeWindow()
|
||||
{
|
||||
// If you don't call this, you need to call -release: on the button
|
||||
// manually (see the comment in wxGTK version above) if using manual
|
||||
// reference counting. If you build with ARC, you must *not* call
|
||||
// Disown() to let the native view be destroyed automatically.
|
||||
Disown();
|
||||
}
|
||||
};
|
||||
|
||||
#else // some other platform
|
||||
|
||||
// The sample should be updated if wxNativeCtrl is implemented for some new
|
||||
// platform in wx/nativectrl.h.
|
||||
#error "Native control creation not implemented for this platform"
|
||||
|
||||
#endif // platforms
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NativeWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class NativeWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
NativeWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_nativeWindow; }
|
||||
virtual void RecreateWidget() override;
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
private:
|
||||
void OnCheckExpand(wxCommandEvent& event);
|
||||
|
||||
wxCheckBox* m_chkExpand;
|
||||
|
||||
wxNativeWindow* m_nativeWindow;
|
||||
wxSizer* m_sizerCtrl;
|
||||
|
||||
DECLARE_WIDGETS_PAGE(NativeWidgetsPage)
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(NativeWidgetsPage, "Native", NATIVE_CTRLS);
|
||||
|
||||
NativeWidgetsPage::NativeWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, native_xpm)
|
||||
{
|
||||
m_nativeWindow = nullptr;
|
||||
}
|
||||
|
||||
void NativeWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer* const sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxSizer* const sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
m_chkExpand = new wxCheckBox(this, wxID_ANY, "&Expand to all available size");
|
||||
m_chkExpand->Bind(wxEVT_CHECKBOX, &NativeWidgetsPage::OnCheckExpand, this);
|
||||
sizerLeft->Add(m_chkExpand, wxSizerFlags().Border());
|
||||
sizerTop->Add(sizerLeft);
|
||||
|
||||
m_sizerCtrl = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
RecreateWidget();
|
||||
|
||||
sizerTop->Add(m_sizerCtrl, wxSizerFlags(1).Expand());
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void NativeWidgetsPage::RecreateWidget()
|
||||
{
|
||||
delete m_nativeWindow;
|
||||
m_nativeWindow = new NativeWindow(this);
|
||||
|
||||
NotifyWidgetRecreation(m_nativeWindow);
|
||||
|
||||
m_sizerCtrl->Clear();
|
||||
if ( m_chkExpand->IsChecked() )
|
||||
{
|
||||
m_sizerCtrl->Add(m_nativeWindow, wxSizerFlags(1).Expand().Border());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sizerCtrl->AddStretchSpacer();
|
||||
m_sizerCtrl->Add(m_nativeWindow, wxSizerFlags().Centre());
|
||||
m_sizerCtrl->AddStretchSpacer();
|
||||
}
|
||||
|
||||
m_sizerCtrl->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void NativeWidgetsPage::OnCheckExpand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
RecreateWidget();
|
||||
}
|
||||
|
||||
#endif // wxHAS_NATIVE_WINDOW
|
||||
|
||||
#endif // !OSX/Cocoa compilation as Objective C source file
|
||||
15
libs/wxWidgets-3.3.1/samples/widgets/native_wrapper.mm
Normal file
15
libs/wxWidgets-3.3.1/samples/widgets/native_wrapper.mm
Normal file
@@ -0,0 +1,15 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: native_wrapper.mm
|
||||
// Purpose: Helper to compile native.cpp as Objective C++ code
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2015-08-02
|
||||
// Copyright: (c) 2015 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// As explained in widgets.bkl, we need to compile native.cpp using Objective
|
||||
// C++ compiler, but there is no simple way to do it at the build system level,
|
||||
// so we just include that file from this file, which has .mm extension
|
||||
// ensuring that the correct compiler is used.
|
||||
#include "native.cpp"
|
||||
747
libs/wxWidgets-3.3.1/samples/widgets/notebook.cpp
Normal file
747
libs/wxWidgets-3.3.1/samples/widgets/notebook.cpp
Normal file
@@ -0,0 +1,747 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: notebook.cpp
|
||||
// Purpose: Part of the widgets sample showing book controls
|
||||
// Author: Vadim Zeitlin, Wlodzimierz ABX Skiba
|
||||
// Created: 06.04.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin, 2006 Wlodzimierz Skiba
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_BOOKCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/bookctrl.h"
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
BookPage_Reset = wxID_HIGHEST,
|
||||
BookPage_SelectPage,
|
||||
BookPage_AddPage,
|
||||
BookPage_InsertPage,
|
||||
BookPage_RemovePage,
|
||||
BookPage_DeleteAll,
|
||||
BookPage_InsertText,
|
||||
BookPage_RemoveText,
|
||||
BookPage_SelectText,
|
||||
BookPage_NumPagesText,
|
||||
BookPage_CurSelectText,
|
||||
BookPage_Book
|
||||
};
|
||||
|
||||
// book orientations
|
||||
enum Orient
|
||||
{
|
||||
Orient_Top,
|
||||
Orient_Bottom,
|
||||
Orient_Left,
|
||||
Orient_Right,
|
||||
Orient_Max
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BookWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class BookWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
BookWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist, const char *const icon[]);
|
||||
virtual ~BookWidgetsPage();
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_book; }
|
||||
virtual void RecreateWidget() override { RecreateBook(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonDeleteAll(wxCommandEvent& event);
|
||||
void OnButtonSelectPage(wxCommandEvent& event);
|
||||
void OnButtonAddPage(wxCommandEvent& event);
|
||||
void OnButtonInsertPage(wxCommandEvent& event);
|
||||
void OnButtonRemovePage(wxCommandEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUINumPagesText(wxUpdateUIEvent& event);
|
||||
void OnUpdateUICurSelectText(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUISelectButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIInsertButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIRemoveButton(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
|
||||
// reset book parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create book
|
||||
void RecreateBook();
|
||||
virtual wxBookCtrlBase *CreateBook(long flags) = 0;
|
||||
|
||||
// create or destroy the image list
|
||||
void CreateImageList();
|
||||
|
||||
// create a new page
|
||||
wxWindow *CreateNewPage();
|
||||
|
||||
// get the image index for the new page
|
||||
int GetIconIndex() const;
|
||||
|
||||
// get the numeric value of text ctrl
|
||||
int GetTextValue(wxTextCtrl *text) const;
|
||||
|
||||
// is the value in range?
|
||||
bool IsValidValue(int val) const
|
||||
{ return (val >= 0) && (val < (int) m_book->GetPageCount()); }
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the check/radio boxes for styles
|
||||
wxCheckBox *m_chkImages;
|
||||
wxRadioBox *m_radioOrient;
|
||||
|
||||
// the text controls containing input for various commands
|
||||
wxTextCtrl *m_textInsert,
|
||||
*m_textRemove,
|
||||
*m_textSelect;
|
||||
|
||||
// the book itself and the sizer it is in
|
||||
wxBookCtrlBase *m_book;
|
||||
wxSizer *m_sizerBook;
|
||||
|
||||
// the image list for our book
|
||||
wxImageList *m_imageList;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(BookWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(BookPage_Reset, BookWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(BookPage_SelectPage, BookWidgetsPage::OnButtonSelectPage)
|
||||
EVT_BUTTON(BookPage_AddPage, BookWidgetsPage::OnButtonAddPage)
|
||||
EVT_BUTTON(BookPage_InsertPage, BookWidgetsPage::OnButtonInsertPage)
|
||||
EVT_BUTTON(BookPage_RemovePage, BookWidgetsPage::OnButtonRemovePage)
|
||||
EVT_BUTTON(BookPage_DeleteAll, BookWidgetsPage::OnButtonDeleteAll)
|
||||
|
||||
EVT_UPDATE_UI(BookPage_NumPagesText, BookWidgetsPage::OnUpdateUINumPagesText)
|
||||
EVT_UPDATE_UI(BookPage_CurSelectText, BookWidgetsPage::OnUpdateUICurSelectText)
|
||||
|
||||
EVT_UPDATE_UI(BookPage_SelectPage, BookWidgetsPage::OnUpdateUISelectButton)
|
||||
EVT_UPDATE_UI(BookPage_InsertPage, BookWidgetsPage::OnUpdateUIInsertButton)
|
||||
EVT_UPDATE_UI(BookPage_RemovePage, BookWidgetsPage::OnUpdateUIRemoveButton)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist, const char *const icon[])
|
||||
:WidgetsPage(book, imaglist, icon)
|
||||
{
|
||||
// init everything
|
||||
m_chkImages = nullptr;
|
||||
m_imageList = nullptr;
|
||||
|
||||
m_book = nullptr;
|
||||
m_radioOrient = nullptr;
|
||||
m_sizerBook = nullptr;
|
||||
}
|
||||
|
||||
void BookWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
// must be in sync with Orient enum
|
||||
wxArrayString orientations;
|
||||
orientations.Add("&top");
|
||||
orientations.Add("&bottom");
|
||||
orientations.Add("&left");
|
||||
orientations.Add("&right");
|
||||
|
||||
wxASSERT_MSG( orientations.GetCount() == Orient_Max,
|
||||
"forgot to update something" );
|
||||
|
||||
m_chkImages = new wxCheckBox(sizerLeftBox, wxID_ANY, "Show &images");
|
||||
m_radioOrient = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Tab orientation",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
orientations, 1, wxRA_SPECIFY_COLS);
|
||||
|
||||
sizerLeft->Add(m_chkImages, 0, wxALL, 5);
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
sizerLeft->Add(m_radioOrient, 0, wxALL, 5);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, BookPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Contents");
|
||||
wxStaticBox* const sizerMidleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxTextCtrl *text;
|
||||
wxSizer *sizerRow = CreateSizerWithTextAndLabel("Number of pages: ",
|
||||
BookPage_NumPagesText,
|
||||
&text,
|
||||
sizerMidleBox);
|
||||
text->SetEditable(false);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Current selection: ",
|
||||
BookPage_CurSelectText,
|
||||
&text,
|
||||
sizerMidleBox);
|
||||
text->SetEditable(false);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage,
|
||||
"&Select page",
|
||||
BookPage_SelectText,
|
||||
&m_textSelect,
|
||||
sizerMidleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMidleBox, BookPage_AddPage, "&Add page");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage,
|
||||
"&Insert page at",
|
||||
BookPage_InsertText,
|
||||
&m_textInsert,
|
||||
sizerMidleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage,
|
||||
"&Remove page",
|
||||
BookPage_RemoveText,
|
||||
&m_textRemove,
|
||||
sizerMidleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMidleBox, BookPage_DeleteAll, "&Delete All");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
// right pane
|
||||
m_sizerBook = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// the 3 panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(m_sizerBook, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
RecreateBook();
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
CreateImageList();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
BookWidgetsPage::~BookWidgetsPage()
|
||||
{
|
||||
delete m_imageList;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void BookWidgetsPage::Reset()
|
||||
{
|
||||
m_chkImages->SetValue(true);
|
||||
m_radioOrient->SetSelection(Orient_Top);
|
||||
}
|
||||
|
||||
void BookWidgetsPage::CreateImageList()
|
||||
{
|
||||
if ( m_chkImages->GetValue() )
|
||||
{
|
||||
if ( !m_imageList )
|
||||
{
|
||||
// create a dummy image list with a few icons
|
||||
m_imageList = new wxImageList(32, 32);
|
||||
wxSize size(32, 32);
|
||||
m_imageList->Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, size));
|
||||
m_imageList->Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, size));
|
||||
m_imageList->Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, size));
|
||||
m_imageList->Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, size));
|
||||
}
|
||||
|
||||
if ( m_book )
|
||||
m_book->SetImageList(m_imageList);
|
||||
}
|
||||
else // no images
|
||||
{
|
||||
wxDELETE(m_imageList);
|
||||
}
|
||||
|
||||
// because of the bug in wxMSW we can't use SetImageList(nullptr) - although
|
||||
// it would be logical if this removed the image list from book, under
|
||||
// MSW it crashes instead - FIXME
|
||||
}
|
||||
|
||||
void BookWidgetsPage::RecreateBook()
|
||||
{
|
||||
// do not recreate anything in case page content was not prepared yet
|
||||
if(!m_radioOrient)
|
||||
return;
|
||||
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
switch ( m_radioOrient->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( "unknown orientation" );
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case Orient_Top:
|
||||
flags |= wxBK_TOP;
|
||||
break;
|
||||
|
||||
case Orient_Bottom:
|
||||
flags |= wxBK_BOTTOM;
|
||||
break;
|
||||
|
||||
case Orient_Left:
|
||||
flags |= wxBK_LEFT;
|
||||
break;
|
||||
|
||||
case Orient_Right:
|
||||
flags |= wxBK_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
wxBookCtrlBase *oldBook = m_book;
|
||||
|
||||
m_book = CreateBook(flags);
|
||||
|
||||
NotifyWidgetRecreation(m_book);
|
||||
|
||||
CreateImageList();
|
||||
|
||||
if ( oldBook )
|
||||
{
|
||||
const int sel = oldBook->GetSelection();
|
||||
|
||||
const int count = oldBook->GetPageCount();
|
||||
|
||||
// recreate the pages
|
||||
for ( int n = 0; n < count; n++ )
|
||||
{
|
||||
m_book->AddPage(CreateNewPage(),
|
||||
oldBook->GetPageText(n),
|
||||
false,
|
||||
m_chkImages->GetValue() ?
|
||||
GetIconIndex() : -1);
|
||||
}
|
||||
|
||||
m_sizerBook->Detach( oldBook );
|
||||
delete oldBook;
|
||||
|
||||
// restore selection
|
||||
if ( sel != -1 )
|
||||
{
|
||||
m_book->SetSelection(sel);
|
||||
}
|
||||
}
|
||||
|
||||
m_sizerBook->Add(m_book, 1, wxGROW | wxALL, 5);
|
||||
m_sizerBook->SetMinSize(150, 0);
|
||||
m_sizerBook->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int BookWidgetsPage::GetTextValue(wxTextCtrl *text) const
|
||||
{
|
||||
long pos = -1;
|
||||
|
||||
if ( !text || !text->GetValue().ToLong(&pos) )
|
||||
pos = -1;
|
||||
|
||||
return (int)pos;
|
||||
}
|
||||
|
||||
int BookWidgetsPage::GetIconIndex() const
|
||||
{
|
||||
if ( m_book )
|
||||
{
|
||||
const int nImages = m_book->GetImageCount();
|
||||
if ( nImages > 0 )
|
||||
{
|
||||
return m_book->GetPageCount() % nImages;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxWindow *BookWidgetsPage::CreateNewPage()
|
||||
{
|
||||
return new wxTextCtrl(m_book, wxID_ANY, "I'm a book page");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void BookWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
RecreateBook();
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_book->DeleteAllPages();
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int pos = GetTextValue(m_textSelect);
|
||||
wxCHECK_RET( IsValidValue(pos), "button should be disabled" );
|
||||
|
||||
m_book->SetSelection(pos);
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_book->AddPage(CreateNewPage(), "Added page", false,
|
||||
GetIconIndex());
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int pos = GetTextValue(m_textInsert);
|
||||
wxCHECK_RET( IsValidValue(pos), "button should be disabled" );
|
||||
|
||||
m_book->InsertPage(pos, CreateNewPage(), "Inserted page", false,
|
||||
GetIconIndex());
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int pos = GetTextValue(m_textRemove);
|
||||
wxCHECK_RET( IsValidValue(pos), "button should be disabled" );
|
||||
|
||||
m_book->DeletePage(pos);
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnUpdateUISelectButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( IsValidValue(GetTextValue(m_textSelect)) );
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnUpdateUIInsertButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( IsValidValue(GetTextValue(m_textInsert)) );
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnUpdateUIRemoveButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( IsValidValue(GetTextValue(m_textRemove)) );
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if(m_chkImages && m_radioOrient)
|
||||
event.Enable( !m_chkImages->GetValue() ||
|
||||
m_radioOrient->GetSelection() != wxBK_TOP );
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
|
||||
{
|
||||
if(m_book)
|
||||
event.SetText( wxString::Format("%u", unsigned(m_book->GetPageCount())) );
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
|
||||
{
|
||||
if(m_book)
|
||||
event.SetText( wxString::Format("%d", m_book->GetSelection()) );
|
||||
}
|
||||
|
||||
void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
RecreateBook();
|
||||
}
|
||||
|
||||
#if wxUSE_NOTEBOOK
|
||||
|
||||
#include "icons/notebook.xpm"
|
||||
#include "wx/notebook.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NotebookWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class NotebookWidgetsPage : public BookWidgetsPage
|
||||
{
|
||||
public:
|
||||
NotebookWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist)
|
||||
: BookWidgetsPage(book, imaglist, notebook_xpm)
|
||||
{
|
||||
RecreateBook();
|
||||
}
|
||||
virtual ~NotebookWidgetsPage() {}
|
||||
|
||||
protected:
|
||||
|
||||
// event handlers
|
||||
void OnPageChanging(wxNotebookEvent& event);
|
||||
void OnPageChanged(wxNotebookEvent& event);
|
||||
|
||||
// (re)create book
|
||||
virtual wxBookCtrlBase *CreateBook(long flags) override
|
||||
{
|
||||
return new wxNotebook(this, BookPage_Book,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
}
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(NotebookWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event table
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(NotebookWidgetsPage, BookWidgetsPage)
|
||||
EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, NotebookWidgetsPage::OnPageChanging)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, "Notebook",
|
||||
FAMILY_CTRLS | BOOK_CTRLS
|
||||
);
|
||||
|
||||
void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
|
||||
{
|
||||
wxLogMessage("Notebook page changing from %d to %d (currently %d).",
|
||||
event.GetOldSelection(),
|
||||
event.GetSelection(),
|
||||
m_book->GetSelection());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
|
||||
{
|
||||
wxLogMessage("Notebook page changed from %d to %d (currently %d).",
|
||||
event.GetOldSelection(),
|
||||
event.GetSelection(),
|
||||
m_book->GetSelection());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
||||
#if wxUSE_LISTBOOK
|
||||
|
||||
#include "icons/listbook.xpm"
|
||||
#include "wx/listbook.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ListbookWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ListbookWidgetsPage : public BookWidgetsPage
|
||||
{
|
||||
public:
|
||||
ListbookWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist)
|
||||
: BookWidgetsPage(book, imaglist, listbook_xpm)
|
||||
{
|
||||
RecreateBook();
|
||||
}
|
||||
virtual ~ListbookWidgetsPage() {}
|
||||
|
||||
protected:
|
||||
|
||||
// event handlers
|
||||
void OnPageChanging(wxListbookEvent& event);
|
||||
void OnPageChanged(wxListbookEvent& event);
|
||||
|
||||
// (re)create book
|
||||
virtual wxBookCtrlBase *CreateBook(long flags) override
|
||||
{
|
||||
return new wxListbook(this, BookPage_Book,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
}
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ListbookWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event table
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ListbookWidgetsPage, BookWidgetsPage)
|
||||
EVT_LISTBOOK_PAGE_CHANGING(wxID_ANY, ListbookWidgetsPage::OnPageChanging)
|
||||
EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, "Listbook",
|
||||
GENERIC_CTRLS | BOOK_CTRLS
|
||||
);
|
||||
|
||||
void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
|
||||
{
|
||||
wxLogMessage("Listbook page changing from %d to %d (currently %d).",
|
||||
event.GetOldSelection(),
|
||||
event.GetSelection(),
|
||||
m_book->GetSelection());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event)
|
||||
{
|
||||
wxLogMessage("Listbook page changed from %d to %d (currently %d).",
|
||||
event.GetOldSelection(),
|
||||
event.GetSelection(),
|
||||
m_book->GetSelection());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#endif // wxUSE_LISTBOOK
|
||||
|
||||
#if wxUSE_CHOICEBOOK
|
||||
|
||||
#include "icons/choicebk.xpm"
|
||||
#include "wx/choicebk.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ChoicebookWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ChoicebookWidgetsPage : public BookWidgetsPage
|
||||
{
|
||||
public:
|
||||
ChoicebookWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist)
|
||||
: BookWidgetsPage(book, imaglist, choicebk_xpm)
|
||||
{
|
||||
RecreateBook();
|
||||
}
|
||||
virtual ~ChoicebookWidgetsPage() {}
|
||||
|
||||
protected:
|
||||
|
||||
// event handlers
|
||||
void OnPageChanging(wxChoicebookEvent& event);
|
||||
void OnPageChanged(wxChoicebookEvent& event);
|
||||
|
||||
// (re)create book
|
||||
virtual wxBookCtrlBase *CreateBook(long flags) override
|
||||
{
|
||||
return new wxChoicebook(this, BookPage_Book,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
}
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ChoicebookWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event table
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ChoicebookWidgetsPage, BookWidgetsPage)
|
||||
EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, ChoicebookWidgetsPage::OnPageChanging)
|
||||
EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, "Choicebook",
|
||||
GENERIC_CTRLS | BOOK_CTRLS
|
||||
);
|
||||
|
||||
void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
|
||||
{
|
||||
wxLogMessage("Choicebook page changing from %d to %d (currently %d).",
|
||||
event.GetOldSelection(),
|
||||
event.GetSelection(),
|
||||
m_book->GetSelection());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event)
|
||||
{
|
||||
wxLogMessage("Choicebook page changed from %d to %d (currently %d).",
|
||||
event.GetOldSelection(),
|
||||
event.GetSelection(),
|
||||
m_book->GetSelection());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHOICEBOOK
|
||||
|
||||
#endif // wxUSE_BOOKCTRL
|
||||
866
libs/wxWidgets-3.3.1/samples/widgets/odcombobox.cpp
Normal file
866
libs/wxWidgets-3.3.1/samples/widgets/odcombobox.cpp
Normal file
@@ -0,0 +1,866 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: odcombobox.cpp
|
||||
// Purpose: Part of the widgets sample showing wxOwnerDrawnComboBox
|
||||
// Author: Jaakko Salli (based on combobox page by Vadim Zeitlin)
|
||||
// Created: Jul-28-2006
|
||||
// Copyright: (c) 2006 Jaakko Salli
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_ODCOMBOBOX
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dc.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/odcombo.h"
|
||||
|
||||
|
||||
#include "itemcontainer.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/odcombobox.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
ODComboPage_Reset = wxID_HIGHEST,
|
||||
ODComboPage_PopupMinWidth,
|
||||
ODComboPage_PopupHeight,
|
||||
ODComboPage_ButtonWidth,
|
||||
ODComboPage_ButtonHeight,
|
||||
ODComboPage_ButtonSpacing,
|
||||
ODComboPage_CurText,
|
||||
ODComboPage_InsertionPointText,
|
||||
ODComboPage_Insert,
|
||||
ODComboPage_InsertText,
|
||||
ODComboPage_Add,
|
||||
ODComboPage_AddText,
|
||||
ODComboPage_AddSeveral,
|
||||
ODComboPage_AddMany,
|
||||
ODComboPage_Clear,
|
||||
ODComboPage_Change,
|
||||
ODComboPage_ChangeText,
|
||||
ODComboPage_Delete,
|
||||
ODComboPage_DeleteText,
|
||||
ODComboPage_DeleteSel,
|
||||
ODComboPage_Combo,
|
||||
ODComboPage_ContainerTests
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ODComboboxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ODComboboxWidgetsPage : public ItemContainerWidgetsPage
|
||||
{
|
||||
public:
|
||||
ODComboboxWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_combobox; }
|
||||
virtual wxTextEntryBase *GetTextEntry() const override
|
||||
{ return m_combobox ? m_combobox->GetTextCtrl() : nullptr; }
|
||||
virtual wxItemContainer* GetContainer() const override { return m_combobox; }
|
||||
virtual void RecreateWidget() override { CreateCombo(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonChange(wxCommandEvent& event);
|
||||
void OnButtonDelete(wxCommandEvent& event);
|
||||
void OnButtonDeleteSel(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonInsert(wxCommandEvent &event);
|
||||
void OnButtonAdd(wxCommandEvent& event);
|
||||
void OnButtonAddSeveral(wxCommandEvent& event);
|
||||
void OnButtonAddMany(wxCommandEvent& event);
|
||||
|
||||
void OnComboBox(wxCommandEvent& event);
|
||||
void OnDropDown(wxCommandEvent& event);
|
||||
void OnCloseUp(wxCommandEvent& event);
|
||||
void OnComboText(wxCommandEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnTextPopupWidth(wxCommandEvent& event);
|
||||
void OnTextPopupHeight(wxCommandEvent& event);
|
||||
void OnTextButtonAll(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUICurText(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIInsertionPointText(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUIInsert(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIAddSeveral(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIClearButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
|
||||
// reset the odcombobox parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the odcombobox
|
||||
void CreateCombo();
|
||||
|
||||
// helper that gets all button values from controls and calls SetButtonPosition
|
||||
void GetButtonPosition();
|
||||
|
||||
// helper to create the button bitmap
|
||||
wxBitmap CreateBitmap(const wxColour& colour);
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the checkboxes for styles
|
||||
wxCheckBox *m_chkSort,
|
||||
*m_chkReadonly,
|
||||
*m_chkDclickcycles,
|
||||
*m_chkBitmapbutton,
|
||||
*m_chkStdbutton;
|
||||
|
||||
// the text entries for popup and button adjustment
|
||||
wxTextCtrl *m_textPopupMinWidth,
|
||||
*m_textPopupHeight,
|
||||
*m_textButtonWidth,
|
||||
*m_textButtonHeight,
|
||||
*m_textButtonSpacing;
|
||||
|
||||
// the checkboxes for same
|
||||
wxCheckBox *m_chkAlignpopupright,
|
||||
*m_chkAlignbutleft;
|
||||
|
||||
// the combobox itself and the sizer it is in
|
||||
wxOwnerDrawnComboBox *m_combobox;
|
||||
wxSizer *m_sizerCombo;
|
||||
|
||||
// the text entries for "Add/change string" and "Delete" buttons
|
||||
wxTextCtrl *m_textInsert,
|
||||
*m_textAdd,
|
||||
*m_textChange,
|
||||
*m_textDelete;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ODComboboxWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ODComboboxWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(ODComboPage_Reset, ODComboboxWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(ODComboPage_Change, ODComboboxWidgetsPage::OnButtonChange)
|
||||
EVT_BUTTON(ODComboPage_Delete, ODComboboxWidgetsPage::OnButtonDelete)
|
||||
EVT_BUTTON(ODComboPage_DeleteSel, ODComboboxWidgetsPage::OnButtonDeleteSel)
|
||||
EVT_BUTTON(ODComboPage_Clear, ODComboboxWidgetsPage::OnButtonClear)
|
||||
EVT_BUTTON(ODComboPage_Insert, ODComboboxWidgetsPage::OnButtonInsert)
|
||||
EVT_BUTTON(ODComboPage_Add, ODComboboxWidgetsPage::OnButtonAdd)
|
||||
EVT_BUTTON(ODComboPage_AddSeveral, ODComboboxWidgetsPage::OnButtonAddSeveral)
|
||||
EVT_BUTTON(ODComboPage_AddMany, ODComboboxWidgetsPage::OnButtonAddMany)
|
||||
EVT_BUTTON(ODComboPage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
|
||||
|
||||
EVT_TEXT_ENTER(ODComboPage_InsertText, ODComboboxWidgetsPage::OnButtonInsert)
|
||||
EVT_TEXT_ENTER(ODComboPage_AddText, ODComboboxWidgetsPage::OnButtonAdd)
|
||||
EVT_TEXT_ENTER(ODComboPage_DeleteText, ODComboboxWidgetsPage::OnButtonDelete)
|
||||
|
||||
EVT_TEXT(ODComboPage_PopupMinWidth, ODComboboxWidgetsPage::OnTextPopupWidth)
|
||||
EVT_TEXT(ODComboPage_PopupHeight, ODComboboxWidgetsPage::OnTextPopupHeight)
|
||||
EVT_TEXT(ODComboPage_ButtonWidth, ODComboboxWidgetsPage::OnTextButtonAll)
|
||||
EVT_TEXT(ODComboPage_ButtonHeight, ODComboboxWidgetsPage::OnTextButtonAll)
|
||||
EVT_TEXT(ODComboPage_ButtonSpacing, ODComboboxWidgetsPage::OnTextButtonAll)
|
||||
|
||||
EVT_UPDATE_UI(ODComboPage_CurText, ODComboboxWidgetsPage::OnUpdateUICurText)
|
||||
EVT_UPDATE_UI(ODComboPage_InsertionPointText, ODComboboxWidgetsPage::OnUpdateUIInsertionPointText)
|
||||
|
||||
EVT_UPDATE_UI(ODComboPage_Reset, ODComboboxWidgetsPage::OnUpdateUIResetButton)
|
||||
EVT_UPDATE_UI(ODComboPage_Insert, ODComboboxWidgetsPage::OnUpdateUIInsert)
|
||||
EVT_UPDATE_UI(ODComboPage_AddSeveral, ODComboboxWidgetsPage::OnUpdateUIAddSeveral)
|
||||
EVT_UPDATE_UI(ODComboPage_Clear, ODComboboxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ODComboPage_DeleteText, ODComboboxWidgetsPage::OnUpdateUIClearButton)
|
||||
EVT_UPDATE_UI(ODComboPage_Delete, ODComboboxWidgetsPage::OnUpdateUIDeleteButton)
|
||||
EVT_UPDATE_UI(ODComboPage_Change, ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ODComboPage_ChangeText, ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
EVT_UPDATE_UI(ODComboPage_DeleteSel, ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
|
||||
|
||||
EVT_COMBOBOX_DROPDOWN(ODComboPage_Combo, ODComboboxWidgetsPage::OnDropDown)
|
||||
EVT_COMBOBOX_CLOSEUP(ODComboPage_Combo, ODComboboxWidgetsPage::OnCloseUp)
|
||||
EVT_COMBOBOX(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboBox)
|
||||
EVT_TEXT(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboText)
|
||||
EVT_TEXT_ENTER(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboText)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ODComboboxWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, ODComboboxWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
//
|
||||
// wxOwnerDrawnComboBox needs to subclassed so that owner-drawing
|
||||
// callbacks can be implemented.
|
||||
class DemoODComboBox : public wxOwnerDrawnComboBox
|
||||
{
|
||||
public:
|
||||
virtual void OnDrawItem(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int item,
|
||||
int WXUNUSED(flags)) const override
|
||||
{
|
||||
if ( item == wxNOT_FOUND )
|
||||
return;
|
||||
|
||||
wxColour txtCol;
|
||||
int mod = item % 4;
|
||||
|
||||
if ( mod == 0 )
|
||||
txtCol = *wxBLACK;
|
||||
else if ( mod == 1 )
|
||||
txtCol = *wxRED;
|
||||
else if ( mod == 2 )
|
||||
txtCol = *wxGREEN;
|
||||
else
|
||||
txtCol = *wxBLUE;
|
||||
|
||||
dc.SetTextForeground(txtCol);
|
||||
|
||||
dc.DrawText(GetString(item),
|
||||
rect.x + 3,
|
||||
rect.y + ((rect.height - dc.GetCharHeight())/2)
|
||||
);
|
||||
}
|
||||
|
||||
virtual void OnDrawBackground(wxDC& dc, const wxRect& rect,
|
||||
int item, int flags ) const override
|
||||
{
|
||||
|
||||
// If item is selected or even, or we are painting the
|
||||
// combo control itself, use the default rendering.
|
||||
if ( (flags & (wxODCB_PAINTING_CONTROL|wxODCB_PAINTING_SELECTED)) ||
|
||||
(item & 1) == 0 )
|
||||
{
|
||||
wxOwnerDrawnComboBox::OnDrawBackground(dc,rect,item,flags);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, draw every other background with different colour.
|
||||
wxColour bgCol(240,240,250);
|
||||
dc.SetBrush(wxBrush(bgCol));
|
||||
dc.SetPen(wxPen(bgCol));
|
||||
dc.DrawRectangle(rect);
|
||||
}
|
||||
|
||||
virtual wxCoord OnMeasureItem(size_t WXUNUSED(item)) const override
|
||||
{
|
||||
return 48;
|
||||
}
|
||||
|
||||
virtual wxCoord OnMeasureItemWidth(size_t WXUNUSED(item)) const override
|
||||
{
|
||||
return -1; // default - will be measured from text width
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, "OwnerDrawnCombobox",
|
||||
GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
|
||||
);
|
||||
|
||||
ODComboboxWidgetsPage::ODComboboxWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: ItemContainerWidgetsPage(book, imaglist, odcombobox_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_chkSort =
|
||||
m_chkReadonly =
|
||||
m_chkDclickcycles = nullptr;
|
||||
|
||||
m_combobox = nullptr;
|
||||
m_sizerCombo = nullptr;
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::CreateContent()
|
||||
{
|
||||
/*
|
||||
What we create here is a frame having 3 panes: style pane is the
|
||||
leftmost one, in the middle the pane with buttons allowing to perform
|
||||
miscellaneous combobox operations and the pane containing the combobox
|
||||
itself to the right
|
||||
*/
|
||||
wxTextCtrl *text;
|
||||
wxSizer *sizerRow;
|
||||
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// left pane - style box
|
||||
wxStaticBoxSizer *sizerStyle = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerStyleBox = sizerStyle->GetStaticBox();
|
||||
|
||||
m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, "&Sort items", wxID_ANY, sizerStyleBox);
|
||||
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, "&Read only", wxID_ANY, sizerStyleBox);
|
||||
m_chkDclickcycles = CreateCheckBoxAndAddToSizer(sizerStyle, "&Double-click Cycles", wxID_ANY, sizerStyleBox);
|
||||
|
||||
sizerStyle->AddSpacer(4);
|
||||
|
||||
m_chkBitmapbutton = CreateCheckBoxAndAddToSizer(sizerStyle, "&Bitmap button", wxID_ANY, sizerStyleBox);
|
||||
m_chkStdbutton = CreateCheckBoxAndAddToSizer(sizerStyle, "B&lank button background", wxID_ANY, sizerStyleBox);
|
||||
|
||||
wxButton *btn = new wxButton(sizerStyleBox, ODComboPage_Reset, "&Reset");
|
||||
sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3);
|
||||
|
||||
sizerLeft->Add(sizerStyle, wxSizerFlags().Expand());
|
||||
|
||||
// left pane - popup adjustment box
|
||||
wxStaticBoxSizer *sizerPopupPos = new wxStaticBoxSizer(wxVERTICAL, this, "Adjust &popup");
|
||||
wxStaticBox* const sizerPopupPosBox = sizerPopupPos->GetStaticBox();
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Min. Width:",
|
||||
ODComboPage_PopupMinWidth,
|
||||
&m_textPopupMinWidth,
|
||||
sizerPopupPosBox);
|
||||
m_textPopupMinWidth->SetValue("-1");
|
||||
sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Max. Height:",
|
||||
ODComboPage_PopupHeight,
|
||||
&m_textPopupHeight,
|
||||
sizerPopupPosBox);
|
||||
m_textPopupHeight->SetValue("-1");
|
||||
sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
m_chkAlignpopupright = CreateCheckBoxAndAddToSizer(sizerPopupPos, "Align Right", wxID_ANY, sizerPopupPosBox);
|
||||
|
||||
sizerLeft->Add(sizerPopupPos, wxSizerFlags().Expand().Border(wxTOP, FromDIP(2)));
|
||||
|
||||
// left pane - button adjustment box
|
||||
wxStaticBoxSizer *sizerButtonPos = new wxStaticBoxSizer(wxVERTICAL, this, "Adjust &button");
|
||||
wxStaticBox* const sizerButtonPosBox = sizerButtonPos->GetStaticBox();
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Width:",
|
||||
ODComboPage_ButtonWidth,
|
||||
&m_textButtonWidth,
|
||||
sizerButtonPosBox);
|
||||
m_textButtonWidth->SetValue("-1");
|
||||
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("VSpacing:",
|
||||
ODComboPage_ButtonSpacing,
|
||||
&m_textButtonSpacing,
|
||||
sizerButtonPosBox);
|
||||
m_textButtonSpacing->SetValue("0");
|
||||
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Height:",
|
||||
ODComboPage_ButtonHeight,
|
||||
&m_textButtonHeight,
|
||||
sizerButtonPosBox);
|
||||
m_textButtonHeight->SetValue("-1");
|
||||
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
m_chkAlignbutleft = CreateCheckBoxAndAddToSizer(sizerButtonPos, "Align Left", wxID_ANY, sizerButtonPosBox);
|
||||
|
||||
sizerLeft->Add(sizerButtonPos, wxSizerFlags().Expand().Border(wxTOP, FromDIP(2)));
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change combobox contents");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ODComboPage_ContainerTests, "Run &tests");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Current selection",
|
||||
ODComboPage_CurText,
|
||||
&text,
|
||||
sizerMiddleBox);
|
||||
text->SetEditable(false);
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Insertion Point",
|
||||
ODComboPage_InsertionPointText,
|
||||
&text,
|
||||
sizerMiddleBox);
|
||||
text->SetEditable(false);
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Insert,
|
||||
"&Insert this string",
|
||||
ODComboPage_InsertText,
|
||||
&m_textInsert,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Add,
|
||||
"&Add this string",
|
||||
ODComboPage_AddText,
|
||||
&m_textAdd,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ODComboPage_AddSeveral, "&Append a few strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ODComboPage_AddMany, "Append &many strings");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Change,
|
||||
"C&hange current",
|
||||
ODComboPage_ChangeText,
|
||||
&m_textChange,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Delete,
|
||||
"&Delete this item",
|
||||
ODComboPage_DeleteText,
|
||||
&m_textDelete,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ODComboPage_DeleteSel, "Delete &selection");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
btn = new wxButton(sizerMiddleBox, ODComboPage_Clear, "&Clear");
|
||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
m_combobox = new DemoODComboBox();
|
||||
m_combobox->Create(this, ODComboPage_Combo, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0, nullptr,
|
||||
0);
|
||||
sizerRight->Add(m_combobox, 0, wxGROW | wxALL, 5);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerCombo = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 4, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 5, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 4, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ODComboboxWidgetsPage::Reset()
|
||||
{
|
||||
m_chkSort->SetValue(false);
|
||||
m_chkReadonly->SetValue(false);
|
||||
m_chkDclickcycles->SetValue(false);
|
||||
m_chkDclickcycles->Enable(false);
|
||||
m_chkBitmapbutton->SetValue(false);
|
||||
m_chkStdbutton->SetValue(false);
|
||||
m_chkStdbutton->Enable(false);
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::CreateCombo()
|
||||
{
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkSort->GetValue() )
|
||||
flags |= wxCB_SORT;
|
||||
if ( m_chkReadonly->GetValue() )
|
||||
flags |= wxCB_READONLY;
|
||||
if ( m_chkDclickcycles->GetValue() )
|
||||
flags |= wxODCB_DCLICK_CYCLES;
|
||||
|
||||
wxArrayString items;
|
||||
if ( m_combobox )
|
||||
{
|
||||
unsigned int count = m_combobox->GetCount();
|
||||
for ( unsigned int n = 0; n < count; n++ )
|
||||
{
|
||||
items.Add(m_combobox->GetString(n));
|
||||
}
|
||||
|
||||
m_sizerCombo->Detach( m_combobox );
|
||||
delete m_combobox;
|
||||
}
|
||||
|
||||
m_combobox = new DemoODComboBox();
|
||||
m_combobox->Create(this, ODComboPage_Combo, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0, nullptr,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_combobox);
|
||||
|
||||
unsigned int count = items.GetCount();
|
||||
for ( unsigned int n = 0; n < count; n++ )
|
||||
{
|
||||
m_combobox->Append(items[n]);
|
||||
}
|
||||
|
||||
// Update from controls that edit popup position etc.
|
||||
|
||||
wxUpdateUIEvent tempEvt;
|
||||
OnTextPopupWidth(tempEvt);
|
||||
OnTextPopupHeight(tempEvt);
|
||||
GetButtonPosition();
|
||||
|
||||
m_combobox->SetPopupAnchor( m_chkAlignpopupright->GetValue() ? wxRIGHT : wxLEFT );
|
||||
|
||||
if ( m_chkBitmapbutton->GetValue() )
|
||||
{
|
||||
wxBitmap bmpNormal = CreateBitmap(*wxBLUE);
|
||||
wxBitmap bmpPressed = CreateBitmap(wxColour(0,0,128));
|
||||
wxBitmap bmpHover = CreateBitmap(wxColour(128,128,255));
|
||||
m_combobox->SetButtonBitmaps(bmpNormal,m_chkStdbutton->GetValue(),bmpPressed,bmpHover);
|
||||
}
|
||||
|
||||
m_sizerCombo->Add(m_combobox, 0, wxGROW | wxALL, 5);
|
||||
m_sizerCombo->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateCombo();
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int sel = m_combobox->GetSelection();
|
||||
if ( sel != wxNOT_FOUND )
|
||||
{
|
||||
#ifndef __WXGTK__
|
||||
m_combobox->SetString(sel, m_textChange->GetValue());
|
||||
#else
|
||||
wxLogMessage("Not implemented in wxGTK");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long n;
|
||||
if ( !m_textDelete->GetValue().ToULong(&n) ||
|
||||
(n >= m_combobox->GetCount()) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_combobox->Delete(n);
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int sel = m_combobox->GetSelection();
|
||||
if ( sel != wxNOT_FOUND )
|
||||
{
|
||||
m_combobox->Delete(sel);
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Clear();
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
wxString s = m_textInsert->GetValue();
|
||||
if ( !m_textInsert->IsModified() )
|
||||
{
|
||||
// update the default string
|
||||
m_textInsert->SetValue(wxString::Format("test item %u", ++s_item));
|
||||
}
|
||||
|
||||
if (m_combobox->GetSelection() >= 0)
|
||||
m_combobox->Insert(s, m_combobox->GetSelection());
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
wxString s = m_textAdd->GetValue();
|
||||
if ( !m_textAdd->IsModified() )
|
||||
{
|
||||
// update the default string
|
||||
m_textAdd->SetValue(wxString::Format("test item %u", ++s_item));
|
||||
}
|
||||
|
||||
m_combobox->Append(s);
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// "many" means 1000 here
|
||||
for ( unsigned int n = 0; n < 1000; n++ )
|
||||
{
|
||||
m_combobox->Append(wxString::Format("item #%u", n));
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Append("First");
|
||||
m_combobox->Append("another one");
|
||||
m_combobox->Append("and the last (very very very very very very very very very very long) one");
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnTextPopupWidth(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long l = 0;
|
||||
|
||||
m_textPopupMinWidth->GetValue().ToLong(&l);
|
||||
|
||||
if (m_combobox && l > 0)
|
||||
{
|
||||
m_combobox->SetPopupMinWidth(l);
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnTextPopupHeight(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long l = 0;
|
||||
|
||||
m_textPopupHeight->GetValue().ToLong(&l);
|
||||
|
||||
if (m_combobox && l > 0)
|
||||
{
|
||||
m_combobox->SetPopupMaxHeight(l);
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::GetButtonPosition()
|
||||
{
|
||||
long w = -1;
|
||||
long h = -1;
|
||||
long spacing = 0;
|
||||
|
||||
m_textButtonWidth->GetValue().ToLong(&w);
|
||||
m_textButtonSpacing->GetValue().ToLong(&spacing);
|
||||
m_textButtonHeight->GetValue().ToLong(&h);
|
||||
int align = m_chkAlignbutleft->GetValue() ?
|
||||
wxLEFT : wxRIGHT;
|
||||
|
||||
m_combobox->SetButtonPosition(w,h,align,spacing);
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnTextButtonAll(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (m_combobox)
|
||||
{
|
||||
if ( m_chkBitmapbutton->GetValue() )
|
||||
CreateCombo();
|
||||
else
|
||||
GetButtonPosition();
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUICurText(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.SetText( wxString::Format("%d", m_combobox->GetSelection()) );
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.SetText( wxString::Format("%ld", m_combobox->GetInsertionPoint()) );
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable( m_chkSort->GetValue() || m_chkReadonly->GetValue() ||
|
||||
m_chkBitmapbutton->GetValue() );
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUIInsert(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
{
|
||||
bool enable = !(m_combobox->GetWindowStyle() & wxCB_SORT) &&
|
||||
(m_combobox->GetSelection() >= 0);
|
||||
|
||||
event.Enable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
{
|
||||
unsigned long n;
|
||||
event.Enable(m_textDelete->GetValue().ToULong(&n) &&
|
||||
(n < (unsigned)m_combobox->GetCount()));
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(m_combobox->GetSelection() != wxNOT_FOUND);
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(m_combobox->GetCount() != 0);
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_combobox)
|
||||
event.Enable(!(m_combobox->GetWindowStyle() & wxCB_SORT));
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
|
||||
{
|
||||
if (!m_combobox)
|
||||
return;
|
||||
|
||||
wxString s = event.GetString();
|
||||
|
||||
wxASSERT_MSG( s == m_combobox->GetValue(),
|
||||
"event and combobox values should be the same" );
|
||||
|
||||
if (event.GetEventType() == wxEVT_TEXT_ENTER)
|
||||
{
|
||||
wxLogMessage("OwnerDrawnCombobox enter pressed (now '%s')", s);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage("OwnerDrawnCombobox text changed (now '%s')", s);
|
||||
}
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
|
||||
{
|
||||
long sel = event.GetInt();
|
||||
m_textDelete->SetValue(wxString::Format("%ld", sel));
|
||||
|
||||
wxLogMessage("OwnerDrawnCombobox item %ld selected", sel);
|
||||
|
||||
wxLogMessage("OwnerDrawnCombobox GetValue(): %s", m_combobox->GetValue() );
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
{
|
||||
wxObject* ctrl = event.GetEventObject();
|
||||
|
||||
// Double-click cycles only applies to read-only combobox
|
||||
if ( ctrl == (wxObject*) m_chkReadonly )
|
||||
{
|
||||
m_chkDclickcycles->Enable( m_chkReadonly->GetValue() );
|
||||
}
|
||||
else if ( ctrl == (wxObject*) m_chkBitmapbutton )
|
||||
{
|
||||
m_chkStdbutton->Enable( m_chkBitmapbutton->GetValue() );
|
||||
}
|
||||
else if ( ctrl == (wxObject*) m_chkAlignbutleft )
|
||||
{
|
||||
wxUpdateUIEvent tempEvt;
|
||||
OnTextButtonAll(tempEvt);
|
||||
}
|
||||
|
||||
CreateCombo();
|
||||
}
|
||||
|
||||
wxBitmap ODComboboxWidgetsPage::CreateBitmap(const wxColour& colour)
|
||||
{
|
||||
int ch = m_combobox->GetClientSize().y - 1;
|
||||
int h0 = ch - 5;
|
||||
|
||||
long w = -1;
|
||||
long h = -1;
|
||||
|
||||
m_textButtonWidth->GetValue().ToLong(&w);
|
||||
m_textButtonHeight->GetValue().ToLong(&h);
|
||||
|
||||
if ( w <= 0 )
|
||||
w = h0 - 1;
|
||||
if ( h <= 0 )
|
||||
h = h0;
|
||||
if ( h > ch )
|
||||
h = ch;
|
||||
|
||||
wxMemoryDC dc;
|
||||
wxBitmap bmp(w,h);
|
||||
dc.SelectObject(bmp);
|
||||
|
||||
// Draw transparent background
|
||||
wxColour magic(255,0,255);
|
||||
wxBrush magicBrush(magic);
|
||||
dc.SetBrush(magicBrush);
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight());
|
||||
|
||||
// Draw image content
|
||||
dc.SetBrush(wxBrush(colour));
|
||||
dc.DrawCircle(h/2,h/2+1,(h/2));
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
|
||||
// Finalize transparency with a mask
|
||||
wxMask *mask = new wxMask(bmp, magic);
|
||||
bmp.SetMask(mask);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Combobox dropped down");
|
||||
}
|
||||
|
||||
void ODComboboxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Combobox closed up");
|
||||
}
|
||||
|
||||
#endif //wxUSE_ODCOMBOBOX
|
||||
501
libs/wxWidgets-3.3.1/samples/widgets/radiobox.cpp
Normal file
501
libs/wxWidgets-3.3.1/samples/widgets/radiobox.cpp
Normal file
@@ -0,0 +1,501 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: radiobox.cpp
|
||||
// Purpose: Part of the widgets sample showing wxRadioBox
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 15.04.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_RADIOBOX
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/radiobox.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
RadioPage_Reset = wxID_HIGHEST,
|
||||
RadioPage_Update,
|
||||
RadioPage_Selection,
|
||||
RadioPage_Label,
|
||||
RadioPage_LabelBtn,
|
||||
RadioPage_EnableItem,
|
||||
RadioPage_ShowItem,
|
||||
RadioPage_Radio
|
||||
};
|
||||
|
||||
// default values for the number of radiobox items
|
||||
static const unsigned int DEFAULT_NUM_ENTRIES = 12;
|
||||
static const unsigned int DEFAULT_MAJOR_DIM = 3;
|
||||
|
||||
// this item is enabled/disabled shown/hidden by the test checkboxes
|
||||
static const int TEST_BUTTON = 1;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RadioWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class RadioWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
RadioWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_radio; }
|
||||
virtual void RecreateWidget() override { CreateRadio(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
void OnRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonRecreate(wxCommandEvent& event);
|
||||
|
||||
void OnButtonSelection(wxCommandEvent& event);
|
||||
void OnButtonSetLabel(wxCommandEvent& event);
|
||||
|
||||
void OnEnableItem(wxCommandEvent& event);
|
||||
void OnShowItem(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIReset(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIUpdate(wxUpdateUIEvent& event);
|
||||
void OnUpdateUISelection(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIEnableItem(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIShowItem(wxUpdateUIEvent& event);
|
||||
|
||||
// reset the wxRadioBox parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the wxRadioBox
|
||||
void CreateRadio();
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the check/radio boxes for styles
|
||||
wxCheckBox *m_chkSpecifyRows;
|
||||
wxCheckBox *m_chkEnableItem;
|
||||
wxCheckBox *m_chkShowItem;
|
||||
|
||||
// the gauge itself and the sizer it is in
|
||||
wxRadioBox *m_radio;
|
||||
wxSizer *m_sizerRadio;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_textNumBtns,
|
||||
*m_textMajorDim,
|
||||
*m_textCurSel,
|
||||
*m_textSel,
|
||||
*m_textLabel,
|
||||
*m_textLabelBtns;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(RadioWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(RadioWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(RadioPage_Reset, RadioWidgetsPage::OnButtonReset)
|
||||
|
||||
EVT_BUTTON(RadioPage_Update, RadioWidgetsPage::OnButtonRecreate)
|
||||
EVT_BUTTON(RadioPage_LabelBtn, RadioWidgetsPage::OnButtonRecreate)
|
||||
|
||||
EVT_BUTTON(RadioPage_Selection, RadioWidgetsPage::OnButtonSelection)
|
||||
EVT_BUTTON(RadioPage_Label, RadioWidgetsPage::OnButtonSetLabel)
|
||||
|
||||
EVT_UPDATE_UI(RadioPage_Reset, RadioWidgetsPage::OnUpdateUIReset)
|
||||
EVT_UPDATE_UI(RadioPage_Update, RadioWidgetsPage::OnUpdateUIUpdate)
|
||||
EVT_UPDATE_UI(RadioPage_Selection, RadioWidgetsPage::OnUpdateUISelection)
|
||||
|
||||
EVT_RADIOBOX(RadioPage_Radio, RadioWidgetsPage::OnRadioBox)
|
||||
|
||||
EVT_CHECKBOX(RadioPage_EnableItem, RadioWidgetsPage::OnEnableItem)
|
||||
EVT_CHECKBOX(RadioPage_ShowItem, RadioWidgetsPage::OnShowItem)
|
||||
|
||||
EVT_UPDATE_UI(RadioPage_EnableItem, RadioWidgetsPage::OnUpdateUIEnableItem)
|
||||
EVT_UPDATE_UI(RadioPage_ShowItem, RadioWidgetsPage::OnUpdateUIShowItem)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, RadioWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, RadioWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, "Radio",
|
||||
FAMILY_CTRLS | WITH_ITEMS_CTRLS
|
||||
);
|
||||
|
||||
RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, radio_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_chkSpecifyRows = nullptr;
|
||||
m_chkEnableItem = nullptr;
|
||||
m_chkShowItem = nullptr;
|
||||
|
||||
m_textNumBtns =
|
||||
m_textLabelBtns =
|
||||
m_textLabel = nullptr;
|
||||
|
||||
m_radio = nullptr;
|
||||
m_sizerRadio = nullptr;
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerleftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkSpecifyRows = CreateCheckBoxAndAddToSizer
|
||||
(
|
||||
sizerLeft,
|
||||
"Major specifies &rows count",
|
||||
wxID_ANY,
|
||||
sizerleftBox
|
||||
);
|
||||
|
||||
wxSizer *sizerRow;
|
||||
sizerRow = CreateSizerWithTextAndLabel("&Major dimension:",
|
||||
wxID_ANY,
|
||||
&m_textMajorDim,
|
||||
sizerleftBox);
|
||||
sizerLeft->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("&Number of buttons:",
|
||||
wxID_ANY,
|
||||
&m_textNumBtns,
|
||||
sizerleftBox);
|
||||
sizerLeft->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
wxButton *btn;
|
||||
btn = new wxButton(sizerleftBox, RadioPage_Update, "&Update");
|
||||
sizerLeft->Add(btn, wxSizerFlags().CentreHorizontal().Border());
|
||||
|
||||
sizerLeft->AddSpacer(5);
|
||||
|
||||
btn = new wxButton(sizerleftBox, RadioPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, wxSizerFlags().CentreHorizontal().Border(wxALL, FromDIP(15)));
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change parameters");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
sizerRow = CreateSizerWithTextAndLabel("Current selection:",
|
||||
wxID_ANY,
|
||||
&m_textCurSel,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(RadioPage_Selection,
|
||||
"&Change selection:",
|
||||
wxID_ANY,
|
||||
&m_textSel,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(RadioPage_Label,
|
||||
"&Label for box:",
|
||||
wxID_ANY,
|
||||
&m_textLabel,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(RadioPage_LabelBtn,
|
||||
"&Label for buttons:",
|
||||
wxID_ANY,
|
||||
&m_textLabelBtns,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
m_chkEnableItem = CreateCheckBoxAndAddToSizer(sizerMiddle,
|
||||
"Disable &2nd item",
|
||||
RadioPage_EnableItem,
|
||||
sizerMiddleBox);
|
||||
m_chkShowItem = CreateCheckBoxAndAddToSizer(sizerMiddle,
|
||||
"Hide 2nd &item",
|
||||
RadioPage_ShowItem,
|
||||
sizerMiddleBox);
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_sizerRadio = sizerRight; // save it to modify it later
|
||||
|
||||
Reset();
|
||||
CreateRadio();
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft,
|
||||
wxSizerFlags(0).Expand().DoubleBorder((wxALL & ~wxLEFT)));
|
||||
sizerTop->Add(sizerMiddle,
|
||||
wxSizerFlags(1).Expand().DoubleBorder(wxALL));
|
||||
sizerTop->Add(sizerRight,
|
||||
wxSizerFlags(0).Expand().DoubleBorder((wxALL & ~wxRIGHT)));
|
||||
|
||||
// final initializations
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void RadioWidgetsPage::Reset()
|
||||
{
|
||||
m_textMajorDim->SetValue(wxString::Format("%u", DEFAULT_MAJOR_DIM));
|
||||
m_textNumBtns->SetValue(wxString::Format("%u", DEFAULT_NUM_ENTRIES));
|
||||
m_textLabel->SetValue("I'm a radiobox");
|
||||
m_textLabelBtns->SetValue("item");
|
||||
|
||||
m_chkSpecifyRows->SetValue(false);
|
||||
m_chkEnableItem->SetValue(true);
|
||||
m_chkShowItem->SetValue(true);
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::CreateRadio()
|
||||
{
|
||||
int sel;
|
||||
if ( m_radio )
|
||||
{
|
||||
sel = m_radio->GetSelection();
|
||||
|
||||
m_sizerRadio->Detach( m_radio );
|
||||
|
||||
delete m_radio;
|
||||
}
|
||||
else // first time creation, no old selection to preserve
|
||||
{
|
||||
sel = -1;
|
||||
}
|
||||
|
||||
unsigned long count;
|
||||
if ( !m_textNumBtns->GetValue().ToULong(&count) )
|
||||
{
|
||||
wxLogWarning("Should have a valid number for number of items.");
|
||||
|
||||
// fall back to default
|
||||
count = DEFAULT_NUM_ENTRIES;
|
||||
}
|
||||
|
||||
unsigned long majorDim;
|
||||
if ( !m_textMajorDim->GetValue().ToULong(&majorDim) )
|
||||
{
|
||||
wxLogWarning("Should have a valid major dimension number.");
|
||||
|
||||
// fall back to default
|
||||
majorDim = DEFAULT_MAJOR_DIM;
|
||||
}
|
||||
|
||||
wxArrayString items;
|
||||
|
||||
wxString labelBtn = m_textLabelBtns->GetValue();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
items.push_back(wxString::Format("%s %lu",
|
||||
labelBtn, (unsigned long)n + 1));
|
||||
}
|
||||
|
||||
int flags = m_chkSpecifyRows->GetValue() ? wxRA_SPECIFY_ROWS
|
||||
: wxRA_SPECIFY_COLS;
|
||||
|
||||
flags |= GetAttrs().m_defaultFlags;
|
||||
|
||||
m_radio = new wxRadioBox(this, RadioPage_Radio,
|
||||
m_textLabel->GetValue(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
items,
|
||||
majorDim,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_radio);
|
||||
|
||||
if ( sel >= 0 && (size_t)sel < count )
|
||||
{
|
||||
m_radio->SetSelection(sel);
|
||||
}
|
||||
|
||||
if ( count > TEST_BUTTON )
|
||||
{
|
||||
m_radio->Enable(TEST_BUTTON, m_chkEnableItem->IsChecked());
|
||||
m_radio->Show(TEST_BUTTON, m_chkShowItem->IsChecked());
|
||||
}
|
||||
|
||||
m_sizerRadio->Add(m_radio, wxSizerFlags(1).Expand());
|
||||
Layout();
|
||||
|
||||
m_chkEnableItem->Enable(count > TEST_BUTTON);
|
||||
m_chkShowItem->Enable(count > TEST_BUTTON);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void RadioWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateRadio();
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateRadio();
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnRadioBox(wxCommandEvent& event)
|
||||
{
|
||||
int sel = m_radio->GetSelection();
|
||||
int event_sel = event.GetSelection();
|
||||
wxUnusedVar(event_sel);
|
||||
|
||||
wxLogMessage("Radiobox selection changed, now %d", sel);
|
||||
|
||||
wxASSERT_MSG( sel == event_sel,
|
||||
"selection should be the same in event and radiobox" );
|
||||
|
||||
m_textCurSel->SetValue(wxString::Format("%d", sel));
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnButtonRecreate(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateRadio();
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnButtonSetLabel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_radio->wxControl::SetLabel(m_textLabel->GetValue());
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnButtonSelection(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long sel;
|
||||
if ( !m_textSel->GetValue().ToULong(&sel) ||
|
||||
(sel >= (size_t)m_radio->GetCount()) )
|
||||
{
|
||||
wxLogWarning("Invalid number specified as new selection.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_radio->SetSelection(sel);
|
||||
}
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnEnableItem(wxCommandEvent& event)
|
||||
{
|
||||
m_radio->Enable(TEST_BUTTON, event.IsChecked());
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnShowItem(wxCommandEvent& event)
|
||||
{
|
||||
m_radio->Show(TEST_BUTTON, event.IsChecked());
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnUpdateUIUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
unsigned long n;
|
||||
event.Enable( m_textNumBtns->GetValue().ToULong(&n) &&
|
||||
m_textMajorDim->GetValue().ToULong(&n) );
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnUpdateUISelection(wxUpdateUIEvent& event)
|
||||
{
|
||||
unsigned long n;
|
||||
event.Enable( m_textSel->GetValue().ToULong(&n) &&
|
||||
(n < (size_t)m_radio->GetCount()) );
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnUpdateUIReset(wxUpdateUIEvent& event)
|
||||
{
|
||||
// only enable it if something is not set to default
|
||||
bool enable = m_chkSpecifyRows->GetValue();
|
||||
|
||||
if ( !enable )
|
||||
{
|
||||
unsigned long numEntries;
|
||||
|
||||
enable = !m_textNumBtns->GetValue().ToULong(&numEntries) ||
|
||||
numEntries != DEFAULT_NUM_ENTRIES;
|
||||
|
||||
if ( !enable )
|
||||
{
|
||||
unsigned long majorDim;
|
||||
|
||||
enable = !m_textMajorDim->GetValue().ToULong(&majorDim) ||
|
||||
majorDim != DEFAULT_MAJOR_DIM;
|
||||
}
|
||||
}
|
||||
|
||||
event.Enable(enable);
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnUpdateUIEnableItem(wxUpdateUIEvent& event)
|
||||
{
|
||||
if ( m_radio->GetCount() <= TEST_BUTTON )
|
||||
return;
|
||||
|
||||
event.SetText(m_radio->IsItemEnabled(TEST_BUTTON) ? "Disable &2nd item"
|
||||
: "Enable &2nd item");
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnUpdateUIShowItem(wxUpdateUIEvent& event)
|
||||
{
|
||||
if ( m_radio->GetCount() <= TEST_BUTTON )
|
||||
return;
|
||||
|
||||
event.SetText(m_radio->IsItemShown(TEST_BUTTON) ? "Hide 2nd &item"
|
||||
: "Show 2nd &item");
|
||||
}
|
||||
|
||||
#endif // wxUSE_RADIOBOX
|
||||
263
libs/wxWidgets-3.3.1/samples/widgets/searchctrl.cpp
Normal file
263
libs/wxWidgets-3.3.1/samples/widgets/searchctrl.cpp
Normal file
@@ -0,0 +1,263 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: searchctrl.cpp
|
||||
// Purpose: Shows wxSearchCtrl
|
||||
// Author: Robin Dunn
|
||||
// Created: 9-Dec-2006
|
||||
// Copyright: (c) 2006
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_SEARCHCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/menu.h"
|
||||
|
||||
#include "wx/srchctrl.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/text.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
ID_SEARCH_CB = wxID_HIGHEST,
|
||||
ID_CANCEL_CB,
|
||||
ID_MENU_CB,
|
||||
|
||||
ID_SEARCHMENU,
|
||||
ID_SEARCHMENU_LAST = ID_SEARCHMENU + 5
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ColourPickerWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class SearchCtrlWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
SearchCtrlWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_srchCtrl; }
|
||||
virtual wxTextEntryBase *GetTextEntry() const override { return m_srchCtrl; }
|
||||
virtual void RecreateWidget() override;
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnToggleSearchButton(wxCommandEvent&);
|
||||
void OnToggleCancelButton(wxCommandEvent&);
|
||||
void OnToggleSearchMenu(wxCommandEvent&);
|
||||
|
||||
void OnText(wxCommandEvent& event);
|
||||
void OnTextEnter(wxCommandEvent& event);
|
||||
|
||||
void OnSearchMenu(wxCommandEvent& event);
|
||||
|
||||
void OnSearch(wxCommandEvent& event);
|
||||
void OnSearchCancel(wxCommandEvent& event);
|
||||
|
||||
wxMenu* CreateTestMenu();
|
||||
|
||||
// (re)create the control
|
||||
void CreateControl();
|
||||
|
||||
|
||||
wxSearchCtrl* m_srchCtrl;
|
||||
wxCheckBox* m_searchBtnCheck;
|
||||
wxCheckBox* m_cancelBtnCheck;
|
||||
wxCheckBox* m_menuBtnCheck;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(SearchCtrlWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(SearchCtrlWidgetsPage, WidgetsPage)
|
||||
EVT_CHECKBOX(ID_SEARCH_CB, SearchCtrlWidgetsPage::OnToggleSearchButton)
|
||||
EVT_CHECKBOX(ID_CANCEL_CB, SearchCtrlWidgetsPage::OnToggleCancelButton)
|
||||
EVT_CHECKBOX(ID_MENU_CB, SearchCtrlWidgetsPage::OnToggleSearchMenu)
|
||||
|
||||
EVT_TEXT(wxID_ANY, SearchCtrlWidgetsPage::OnText)
|
||||
EVT_TEXT_ENTER(wxID_ANY, SearchCtrlWidgetsPage::OnTextEnter)
|
||||
|
||||
EVT_MENU_RANGE(ID_SEARCHMENU, ID_SEARCHMENU_LAST,
|
||||
SearchCtrlWidgetsPage::OnSearchMenu)
|
||||
|
||||
EVT_SEARCH(wxID_ANY, SearchCtrlWidgetsPage::OnSearch)
|
||||
EVT_SEARCH_CANCEL(wxID_ANY, SearchCtrlWidgetsPage::OnSearchCancel)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXMAC__) || defined(__WXGTK__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(SearchCtrlWidgetsPage, "SearchCtrl",
|
||||
FAMILY_CTRLS | EDITABLE_CTRLS | ALL_CTRLS);
|
||||
|
||||
SearchCtrlWidgetsPage::SearchCtrlWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, text_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::CreateContent()
|
||||
{
|
||||
m_srchCtrl = nullptr;
|
||||
|
||||
CreateControl();
|
||||
|
||||
|
||||
wxStaticBoxSizer* sizerOptions = new wxStaticBoxSizer(wxVERTICAL, this, "Options");
|
||||
wxStaticBox* const sizerOptionsBox = sizerOptions->GetStaticBox();
|
||||
|
||||
m_searchBtnCheck = new wxCheckBox(sizerOptionsBox, ID_SEARCH_CB, "Search button");
|
||||
m_cancelBtnCheck = new wxCheckBox(sizerOptionsBox, ID_CANCEL_CB, "Cancel button");
|
||||
m_menuBtnCheck = new wxCheckBox(sizerOptionsBox, ID_MENU_CB, "Search menu");
|
||||
|
||||
m_searchBtnCheck->SetValue(true);
|
||||
|
||||
sizerOptions->Add(m_searchBtnCheck, wxSizerFlags().Border());
|
||||
sizerOptions->Add(m_cancelBtnCheck, wxSizerFlags().Border());
|
||||
sizerOptions->Add(m_menuBtnCheck, wxSizerFlags().Border());
|
||||
|
||||
wxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(sizerOptions, wxSizerFlags().Expand().TripleBorder());
|
||||
sizer->Add(m_srchCtrl, wxSizerFlags().Centre().TripleBorder());
|
||||
|
||||
SetSizer(sizer);
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::CreateControl()
|
||||
{
|
||||
if (m_srchCtrl)
|
||||
m_srchCtrl->Destroy();
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
m_srchCtrl = new wxSearchCtrl(this, -1, wxEmptyString, wxDefaultPosition,
|
||||
FromDIP(wxSize(150, -1)), style);
|
||||
|
||||
NotifyWidgetRecreation(m_srchCtrl);
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::RecreateWidget()
|
||||
{
|
||||
CreateControl();
|
||||
|
||||
GetSizer()->Add(m_srchCtrl, wxSizerFlags().Centre().TripleBorder());
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
|
||||
{
|
||||
wxMenu* menu = new wxMenu;
|
||||
wxMenuItem* menuItem = menu->Append(wxID_ANY, "Recent Searches", "", wxITEM_NORMAL);
|
||||
menuItem->Enable(false);
|
||||
for ( int i = 0; i < ID_SEARCHMENU_LAST - ID_SEARCHMENU; i++ )
|
||||
{
|
||||
wxString itemText = wxString::Format("item %i",i);
|
||||
wxString tipText = wxString::Format("tip %i",i);
|
||||
menu->Append(ID_SEARCHMENU+i, itemText, tipText, wxITEM_CHECK);
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void SearchCtrlWidgetsPage::OnToggleSearchButton(wxCommandEvent&)
|
||||
{
|
||||
m_srchCtrl->ShowSearchButton( m_searchBtnCheck->GetValue() );
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnToggleCancelButton(wxCommandEvent&)
|
||||
{
|
||||
m_srchCtrl->ShowCancelButton( m_cancelBtnCheck->GetValue() );
|
||||
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnToggleSearchMenu(wxCommandEvent&)
|
||||
{
|
||||
if ( m_menuBtnCheck->GetValue() )
|
||||
m_srchCtrl->SetMenu( CreateTestMenu() );
|
||||
else
|
||||
m_srchCtrl->SetMenu(nullptr);
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnText(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Search control: text changes, contents is \"%s\".",
|
||||
event.GetString());
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnTextEnter(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Search control: enter pressed, contents is \"%s\".",
|
||||
event.GetString());
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnSearchMenu(wxCommandEvent& event)
|
||||
{
|
||||
int id = event.GetId() - ID_SEARCHMENU;
|
||||
wxLogMessage("Search menu: \"item %i\" selected (%s).",
|
||||
id, event.IsChecked() ? "checked" : "unchecked");
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnSearch(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Search button: search for \"%s\".", event.GetString());
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnSearchCancel(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Cancel button pressed.");
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#endif // wxUSE_SEARCHCTRL
|
||||
863
libs/wxWidgets-3.3.1/samples/widgets/slider.cpp
Normal file
863
libs/wxWidgets-3.3.1/samples/widgets/slider.cpp
Normal file
@@ -0,0 +1,863 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: slider.cpp
|
||||
// Purpose: Part of the widgets sample showing wxSlider
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 16.04.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/slider.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
#include "wx/tooltip.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/slider.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
SliderPage_Reset = wxID_HIGHEST,
|
||||
SliderPage_Clear,
|
||||
SliderPage_SetValue,
|
||||
SliderPage_SetMinAndMax,
|
||||
SliderPage_SetRange,
|
||||
SliderPage_SetLineSize,
|
||||
SliderPage_SetPageSize,
|
||||
SliderPage_SetTickFreq,
|
||||
SliderPage_SetThumbLen,
|
||||
SliderPage_CurValueText,
|
||||
SliderPage_ValueText,
|
||||
SliderPage_MinText,
|
||||
SliderPage_MaxText,
|
||||
SliderPage_RangeMinText,
|
||||
SliderPage_RangeMaxText,
|
||||
SliderPage_LineSizeText,
|
||||
SliderPage_PageSizeText,
|
||||
SliderPage_TickFreqText,
|
||||
SliderPage_ThumbLenText,
|
||||
SliderPage_RadioSides,
|
||||
SliderPage_BothSides,
|
||||
SliderPage_SelectRange,
|
||||
SliderPage_Slider
|
||||
};
|
||||
|
||||
// sides radiobox values
|
||||
enum
|
||||
{
|
||||
SliderTicks_None,
|
||||
SliderTicks_Top,
|
||||
SliderTicks_Bottom,
|
||||
SliderTicks_Left,
|
||||
SliderTicks_Right
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SliderWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class SliderWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
SliderWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_slider; }
|
||||
virtual void RecreateWidget() override { CreateSlider(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonSetValue(wxCommandEvent& event);
|
||||
void OnButtonSetMinAndMax(wxCommandEvent& event);
|
||||
void OnButtonSetRange(wxCommandEvent& event);
|
||||
void OnButtonSetLineSize(wxCommandEvent& event);
|
||||
void OnButtonSetPageSize(wxCommandEvent& event);
|
||||
void OnButtonSetTickFreq(wxCommandEvent& event);
|
||||
void OnButtonSetThumbLen(wxCommandEvent& event);
|
||||
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnSliderScroll(wxScrollEvent& event);
|
||||
void OnSlider(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIValueButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIMinMaxButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIRangeButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUILineSize(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIPageSize(wxUpdateUIEvent& event);
|
||||
void OnUpdateUITickFreq(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIThumbLen(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIRadioSides(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIBothSides(wxUpdateUIEvent& event);
|
||||
void OnUpdateUISelectRange(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUICurValueText(wxUpdateUIEvent& event);
|
||||
|
||||
// reset the slider parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the slider
|
||||
void CreateSlider();
|
||||
|
||||
// set the line size from the text field value
|
||||
void DoSetLineSize();
|
||||
|
||||
// set the page size from the text field value
|
||||
void DoSetPageSize();
|
||||
|
||||
// set the tick frequency from the text field value
|
||||
void DoSetTickFreq();
|
||||
|
||||
// set the thumb len from the text field value
|
||||
void DoSetThumbLen();
|
||||
|
||||
// set the selection range from the text field values
|
||||
void DoSetSelectionRange();
|
||||
|
||||
// is this slider value in range?
|
||||
bool IsValidValue(int val) const
|
||||
{ return (val >= m_min) && (val <= m_max); }
|
||||
|
||||
static int ms_numSliderEvents;
|
||||
|
||||
// the slider range
|
||||
int m_min, m_max;
|
||||
|
||||
// the slider selection range
|
||||
int m_rangeMin, m_rangeMax;
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the check/radio boxes for styles
|
||||
wxCheckBox *m_chkMinMaxLabels,
|
||||
*m_chkValueLabel,
|
||||
*m_chkInverse,
|
||||
*m_chkTicks,
|
||||
*m_chkBothSides,
|
||||
*m_chkSelectRange;
|
||||
|
||||
wxRadioBox *m_radioSides;
|
||||
|
||||
// the slider itself and the sizer it is in
|
||||
wxSlider *m_slider;
|
||||
wxSizer *m_sizerSlider;
|
||||
|
||||
// the text entries for set value/range
|
||||
wxTextCtrl *m_textValue,
|
||||
*m_textMin,
|
||||
*m_textMax,
|
||||
*m_textRangeMin,
|
||||
*m_textRangeMax,
|
||||
*m_textLineSize,
|
||||
*m_textPageSize,
|
||||
*m_textTickFreq,
|
||||
*m_textThumbLen;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(SliderWidgetsPage)
|
||||
};
|
||||
|
||||
int SliderWidgetsPage::ms_numSliderEvents = 0;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(SliderWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(SliderPage_Reset, SliderWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(SliderPage_SetValue, SliderWidgetsPage::OnButtonSetValue)
|
||||
EVT_BUTTON(SliderPage_SetMinAndMax, SliderWidgetsPage::OnButtonSetMinAndMax)
|
||||
EVT_BUTTON(SliderPage_SetRange, SliderWidgetsPage::OnButtonSetRange)
|
||||
EVT_BUTTON(SliderPage_SetLineSize, SliderWidgetsPage::OnButtonSetLineSize)
|
||||
EVT_BUTTON(SliderPage_SetPageSize, SliderWidgetsPage::OnButtonSetPageSize)
|
||||
EVT_BUTTON(SliderPage_SetTickFreq, SliderWidgetsPage::OnButtonSetTickFreq)
|
||||
EVT_BUTTON(SliderPage_SetThumbLen, SliderWidgetsPage::OnButtonSetThumbLen)
|
||||
|
||||
EVT_UPDATE_UI(SliderPage_SetValue, SliderWidgetsPage::OnUpdateUIValueButton)
|
||||
EVT_UPDATE_UI(SliderPage_SetMinAndMax, SliderWidgetsPage::OnUpdateUIMinMaxButton)
|
||||
EVT_UPDATE_UI(SliderPage_SetRange, SliderWidgetsPage::OnUpdateUIRangeButton)
|
||||
EVT_UPDATE_UI(SliderPage_SetLineSize, SliderWidgetsPage::OnUpdateUILineSize)
|
||||
EVT_UPDATE_UI(SliderPage_SetPageSize, SliderWidgetsPage::OnUpdateUIPageSize)
|
||||
EVT_UPDATE_UI(SliderPage_SetTickFreq, SliderWidgetsPage::OnUpdateUITickFreq)
|
||||
EVT_UPDATE_UI(SliderPage_SetThumbLen, SliderWidgetsPage::OnUpdateUIThumbLen)
|
||||
EVT_UPDATE_UI(SliderPage_RadioSides, SliderWidgetsPage::OnUpdateUIRadioSides)
|
||||
EVT_UPDATE_UI(SliderPage_BothSides, SliderWidgetsPage::OnUpdateUIBothSides)
|
||||
EVT_UPDATE_UI(SliderPage_SelectRange, SliderWidgetsPage::OnUpdateUISelectRange)
|
||||
|
||||
EVT_UPDATE_UI(SliderPage_Reset, SliderWidgetsPage::OnUpdateUIResetButton)
|
||||
|
||||
EVT_UPDATE_UI(SliderPage_CurValueText, SliderWidgetsPage::OnUpdateUICurValueText)
|
||||
|
||||
EVT_COMMAND_SCROLL(SliderPage_Slider, SliderWidgetsPage::OnSliderScroll)
|
||||
EVT_SLIDER(SliderPage_Slider, SliderWidgetsPage::OnSlider)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, "Slider", FAMILY_CTRLS );
|
||||
|
||||
SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, slider_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_rangeMin = 20;
|
||||
m_rangeMax = 80;
|
||||
|
||||
m_chkInverse =
|
||||
m_chkTicks =
|
||||
m_chkMinMaxLabels =
|
||||
m_chkValueLabel =
|
||||
m_chkBothSides =
|
||||
m_chkSelectRange = nullptr;
|
||||
|
||||
m_radioSides = nullptr;
|
||||
|
||||
m_slider = nullptr;
|
||||
m_sizerSlider = nullptr;
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkInverse = CreateCheckBoxAndAddToSizer(sizerLeft, "&Inverse", wxID_ANY, sizerLeftBox);
|
||||
m_chkTicks = CreateCheckBoxAndAddToSizer(sizerLeft, "Show &ticks", wxID_ANY, sizerLeftBox);
|
||||
m_chkMinMaxLabels = CreateCheckBoxAndAddToSizer(sizerLeft, "Show min/max &labels", wxID_ANY, sizerLeftBox);
|
||||
m_chkValueLabel = CreateCheckBoxAndAddToSizer(sizerLeft, "Show &value label", wxID_ANY, sizerLeftBox);
|
||||
static const wxString sides[] =
|
||||
{
|
||||
"default",
|
||||
"top",
|
||||
"bottom",
|
||||
"left",
|
||||
"right",
|
||||
};
|
||||
m_radioSides = new wxRadioBox(sizerLeftBox, SliderPage_RadioSides, "&Label position",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(sides), sides,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
sizerLeft->Add(m_radioSides, wxSizerFlags().Expand().Border());
|
||||
m_chkBothSides = CreateCheckBoxAndAddToSizer
|
||||
(sizerLeft, "&Both sides", SliderPage_BothSides, sizerLeftBox);
|
||||
m_chkSelectRange = CreateCheckBoxAndAddToSizer
|
||||
(sizerLeft, "&Selection range", SliderPage_SelectRange, sizerLeftBox);
|
||||
#if wxUSE_TOOLTIPS
|
||||
m_chkBothSides->SetToolTip("\"Both sides\" is only supported \nin Universal");
|
||||
m_chkSelectRange->SetToolTip("\"Select range\" is only supported \nin wxMSW");
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
sizerLeft->AddSpacer(5);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, SliderPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, wxSizerFlags().CentreHorizontal().Border(wxALL, FromDIP(15)));
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change slider value");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxTextCtrl *text;
|
||||
wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value",
|
||||
SliderPage_CurValueText,
|
||||
&text,
|
||||
sizerMiddleBox);
|
||||
text->SetEditable(false);
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetValue,
|
||||
"Set &value",
|
||||
SliderPage_ValueText,
|
||||
&m_textValue,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetMinAndMax,
|
||||
"&Min and max",
|
||||
SliderPage_MinText,
|
||||
&m_textMin,
|
||||
sizerMiddleBox);
|
||||
|
||||
m_textMax = new wxTextCtrl(sizerMiddleBox, SliderPage_MaxText, wxEmptyString);
|
||||
sizerRow->Add(m_textMax, wxSizerFlags(1).CentreVertical().Border(wxLEFT));
|
||||
|
||||
m_textMin->SetValue( wxString::Format("%d", m_min) );
|
||||
m_textMax->SetValue( wxString::Format("%d", m_max) );
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetRange,
|
||||
"&Selection",
|
||||
SliderPage_RangeMinText,
|
||||
&m_textRangeMin,
|
||||
sizerMiddleBox);
|
||||
|
||||
m_textRangeMax = new wxTextCtrl(sizerMiddleBox, SliderPage_RangeMaxText, wxEmptyString);
|
||||
sizerRow->Add(m_textRangeMax, wxSizerFlags(1).CentreVertical().Border(wxLEFT));
|
||||
|
||||
m_textRangeMin->SetValue( wxString::Format("%d", m_rangeMin) );
|
||||
m_textRangeMax->SetValue( wxString::Format("%d", m_rangeMax) );
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetLineSize,
|
||||
"Li&ne size",
|
||||
SliderPage_LineSizeText,
|
||||
&m_textLineSize,
|
||||
sizerMiddleBox);
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetPageSize,
|
||||
"P&age size",
|
||||
SliderPage_PageSizeText,
|
||||
&m_textPageSize,
|
||||
sizerMiddleBox);
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetTickFreq,
|
||||
"Tick &frequency",
|
||||
SliderPage_TickFreqText,
|
||||
&m_textTickFreq,
|
||||
sizerMiddleBox);
|
||||
|
||||
m_textTickFreq->SetValue("10");
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetThumbLen,
|
||||
"Thumb &length",
|
||||
SliderPage_ThumbLenText,
|
||||
&m_textThumbLen,
|
||||
sizerMiddleBox);
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_sizerSlider = sizerRight; // save it to modify it later
|
||||
|
||||
Reset();
|
||||
CreateSlider();
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft,
|
||||
wxSizerFlags(0).Expand().DoubleBorder((wxALL & ~wxLEFT)));
|
||||
sizerTop->Add(sizerMiddle,
|
||||
wxSizerFlags(1).Expand().DoubleBorder(wxALL));
|
||||
sizerTop->Add(sizerRight,
|
||||
wxSizerFlags(1).Expand().DoubleBorder((wxALL & ~wxRIGHT)));
|
||||
|
||||
// final initializations
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void SliderWidgetsPage::Reset()
|
||||
{
|
||||
m_chkInverse->SetValue(false);
|
||||
m_chkTicks->SetValue(true);
|
||||
m_chkValueLabel->SetValue(true);
|
||||
m_chkMinMaxLabels->SetValue(true);
|
||||
m_chkBothSides->SetValue(false);
|
||||
m_chkSelectRange->SetValue(false);
|
||||
|
||||
m_radioSides->SetSelection(SliderTicks_None);
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::CreateSlider()
|
||||
{
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( m_chkInverse->GetValue() )
|
||||
{
|
||||
flags |= wxSL_INVERSE;
|
||||
}
|
||||
|
||||
if ( m_chkMinMaxLabels->GetValue() )
|
||||
{
|
||||
flags |= wxSL_MIN_MAX_LABELS;
|
||||
}
|
||||
|
||||
if ( m_chkValueLabel->GetValue() )
|
||||
{
|
||||
flags |= wxSL_VALUE_LABEL;
|
||||
}
|
||||
|
||||
if ( m_chkTicks->GetValue() )
|
||||
{
|
||||
flags |= wxSL_AUTOTICKS;
|
||||
}
|
||||
|
||||
// notice that the style names refer to the _ticks_ positions while we want
|
||||
// to allow the user to select the label(s) positions and the labels are on
|
||||
// the opposite side from the ticks, hence the apparent reversal below
|
||||
switch ( m_radioSides->GetSelection() )
|
||||
{
|
||||
case SliderTicks_None:
|
||||
break;
|
||||
|
||||
case SliderTicks_Top:
|
||||
flags |= wxSL_BOTTOM;
|
||||
break;
|
||||
|
||||
case SliderTicks_Left:
|
||||
flags |= wxSL_RIGHT | wxSL_VERTICAL;
|
||||
break;
|
||||
|
||||
case SliderTicks_Bottom:
|
||||
flags |= wxSL_TOP;
|
||||
break;
|
||||
|
||||
case SliderTicks_Right:
|
||||
flags |= wxSL_LEFT | wxSL_VERTICAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
}
|
||||
|
||||
if ( m_chkBothSides->GetValue() )
|
||||
{
|
||||
flags |= wxSL_BOTH;
|
||||
}
|
||||
|
||||
if ( m_chkSelectRange->GetValue() )
|
||||
{
|
||||
flags |= wxSL_SELRANGE;
|
||||
}
|
||||
|
||||
int val = m_min;
|
||||
if ( m_slider )
|
||||
{
|
||||
int valOld = m_slider->GetValue();
|
||||
if ( IsValidValue(valOld) )
|
||||
{
|
||||
val = valOld;
|
||||
}
|
||||
|
||||
m_sizerSlider->Detach( m_slider );
|
||||
|
||||
if ( m_sizerSlider->GetChildren().GetCount() )
|
||||
{
|
||||
// we have 2 spacers, remove them too
|
||||
m_sizerSlider->Remove( 0 );
|
||||
m_sizerSlider->Remove( 0 );
|
||||
}
|
||||
|
||||
delete m_slider;
|
||||
}
|
||||
|
||||
m_slider = new wxSlider(this, SliderPage_Slider,
|
||||
val, m_min, m_max,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
|
||||
NotifyWidgetRecreation(m_slider);
|
||||
|
||||
if ( m_slider->HasFlag(wxSL_VERTICAL) )
|
||||
{
|
||||
m_sizerSlider->AddStretchSpacer(1);
|
||||
m_sizerSlider->Add(m_slider, wxSizerFlags(0).Expand().Border());
|
||||
m_sizerSlider->AddStretchSpacer(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sizerSlider->Add(m_slider, wxSizerFlags(1).Centre().Border());
|
||||
}
|
||||
|
||||
m_textLineSize->SetValue(wxString::Format("%d", m_slider->GetLineSize()));
|
||||
m_textPageSize->SetValue(wxString::Format("%d", m_slider->GetPageSize()));
|
||||
m_textThumbLen->SetValue(wxString::Format("%d", m_slider->GetThumbLength()));
|
||||
|
||||
if ( m_chkTicks->GetValue() )
|
||||
{
|
||||
DoSetTickFreq();
|
||||
}
|
||||
|
||||
if ( m_chkSelectRange->GetValue() )
|
||||
{
|
||||
DoSetSelectionRange();
|
||||
}
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::DoSetLineSize()
|
||||
{
|
||||
long lineSize;
|
||||
if ( !m_textLineSize->GetValue().ToLong(&lineSize) )
|
||||
{
|
||||
wxLogWarning("Invalid slider line size");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_slider->SetLineSize(lineSize);
|
||||
|
||||
if ( m_slider->GetLineSize() != lineSize )
|
||||
{
|
||||
wxLogWarning("Invalid line size in slider.");
|
||||
}
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::DoSetPageSize()
|
||||
{
|
||||
long pageSize;
|
||||
if ( !m_textPageSize->GetValue().ToLong(&pageSize) )
|
||||
{
|
||||
wxLogWarning("Invalid slider page size");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_slider->SetPageSize(pageSize);
|
||||
|
||||
if ( m_slider->GetPageSize() != pageSize )
|
||||
{
|
||||
wxLogWarning("Invalid page size in slider.");
|
||||
}
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::DoSetTickFreq()
|
||||
{
|
||||
long freq;
|
||||
if ( !m_textTickFreq->GetValue().ToLong(&freq) )
|
||||
{
|
||||
wxLogWarning("Invalid slider tick frequency");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_slider->SetTickFreq(freq);
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::DoSetThumbLen()
|
||||
{
|
||||
long len;
|
||||
if ( !m_textThumbLen->GetValue().ToLong(&len) )
|
||||
{
|
||||
wxLogWarning("Invalid slider thumb length");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_slider->SetThumbLength(len);
|
||||
|
||||
if ( m_slider->GetThumbLength() != len )
|
||||
{
|
||||
wxLogWarning(wxString::Format("Invalid thumb length in slider: %d",
|
||||
m_slider->GetThumbLength()));
|
||||
}
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::DoSetSelectionRange()
|
||||
{
|
||||
long minNew,
|
||||
maxNew = 0; // init to suppress compiler warning
|
||||
if ( !m_textRangeMin->GetValue().ToLong(&minNew) ||
|
||||
!m_textRangeMax->GetValue().ToLong(&maxNew) ||
|
||||
minNew >= maxNew || minNew < m_min || maxNew > m_max )
|
||||
{
|
||||
wxLogWarning("Invalid selection range for the slider.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_rangeMin = minNew;
|
||||
m_rangeMax = maxNew;
|
||||
|
||||
m_slider->SetSelection(m_rangeMin, m_rangeMax);
|
||||
|
||||
if ( m_slider->GetSelStart() != m_rangeMin ||
|
||||
m_slider->GetSelEnd() != m_rangeMax )
|
||||
{
|
||||
wxLogWarning("Invalid selection range in slider.");
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void SliderWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateSlider();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnButtonSetLineSize(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
DoSetLineSize();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnButtonSetPageSize(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
DoSetPageSize();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnButtonSetTickFreq(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
DoSetTickFreq();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnButtonSetThumbLen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
DoSetThumbLen();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long minNew,
|
||||
maxNew = 0; // init to suppress compiler warning
|
||||
if ( !m_textMin->GetValue().ToLong(&minNew) ||
|
||||
!m_textMax->GetValue().ToLong(&maxNew) ||
|
||||
minNew >= maxNew )
|
||||
{
|
||||
wxLogWarning("Invalid min/max values for the slider.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_min = minNew;
|
||||
m_max = maxNew;
|
||||
|
||||
m_slider->SetRange(minNew, maxNew);
|
||||
|
||||
if ( m_slider->GetMin() != m_min ||
|
||||
m_slider->GetMax() != m_max )
|
||||
{
|
||||
wxLogWarning("Invalid range in slider.");
|
||||
}
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnButtonSetRange(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
DoSetSelectionRange();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long val;
|
||||
if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) )
|
||||
{
|
||||
wxLogWarning("Invalid slider value.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_slider->SetValue(val);
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIValueButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
long val;
|
||||
event.Enable( m_textValue->GetValue().ToLong(&val) && IsValidValue(val) );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUILineSize(wxUpdateUIEvent& event)
|
||||
{
|
||||
long lineSize;
|
||||
event.Enable( m_textLineSize->GetValue().ToLong(&lineSize) &&
|
||||
(lineSize > 0) && (lineSize <= m_max - m_min) );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIPageSize(wxUpdateUIEvent& event)
|
||||
{
|
||||
long pageSize;
|
||||
event.Enable( m_textPageSize->GetValue().ToLong(&pageSize) &&
|
||||
(pageSize > 0) && (pageSize <= m_max - m_min) );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUITickFreq(wxUpdateUIEvent& event)
|
||||
{
|
||||
long freq;
|
||||
event.Enable( m_chkTicks->GetValue() &&
|
||||
m_textTickFreq->GetValue().ToLong(&freq) &&
|
||||
(freq > 0) && (freq <= m_max - m_min) );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIThumbLen(wxUpdateUIEvent& event)
|
||||
{
|
||||
long val;
|
||||
event.Enable( m_textThumbLen->GetValue().ToLong(&val));
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIMinMaxButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
long mn, mx;
|
||||
event.Enable( m_textMin->GetValue().ToLong(&mn) &&
|
||||
m_textMax->GetValue().ToLong(&mx) &&
|
||||
mn < mx);
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIRangeButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
long mn, mx;
|
||||
event.Enable( m_chkSelectRange->GetValue() &&
|
||||
m_textRangeMin->GetValue().ToLong(&mn) &&
|
||||
m_textRangeMax->GetValue().ToLong(&mx) &&
|
||||
mn < mx &&
|
||||
mn >= m_min && mx <= m_max );
|
||||
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( m_chkInverse->GetValue() ||
|
||||
!m_chkTicks->GetValue() ||
|
||||
!m_chkValueLabel->GetValue() ||
|
||||
!m_chkMinMaxLabels->GetValue() ||
|
||||
m_chkBothSides->GetValue() ||
|
||||
m_chkSelectRange->GetValue() ||
|
||||
m_radioSides->GetSelection() != SliderTicks_None );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateSlider();
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.SetText( wxString::Format("%d", m_slider->GetValue()) );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIRadioSides(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( m_chkValueLabel->GetValue() || m_chkTicks->GetValue() );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUIBothSides(wxUpdateUIEvent& event)
|
||||
{
|
||||
#if defined(__WXMSW__) || defined(__WXUNIVERSAL__)
|
||||
event.Enable( true );
|
||||
#else
|
||||
event.Enable( false );
|
||||
#endif // defined(__WXMSW__) || defined(__WXUNIVERSAL__)
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnUpdateUISelectRange(wxUpdateUIEvent& event)
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
event.Enable( true );
|
||||
#else
|
||||
event.Enable( false );
|
||||
#endif // defined(__WXMSW__)
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnSliderScroll(wxScrollEvent& event)
|
||||
{
|
||||
wxASSERT_MSG( event.GetInt() == m_slider->GetValue(),
|
||||
"slider value should be the same" );
|
||||
|
||||
wxEventType eventType = event.GetEventType();
|
||||
|
||||
/*
|
||||
This array takes the EXACT order of the declarations in
|
||||
include/wx/event.h
|
||||
(section "wxScrollBar and wxSlider event identifiers")
|
||||
*/
|
||||
static const wxString eventNames[] =
|
||||
{
|
||||
"wxEVT_SCROLL_TOP",
|
||||
"wxEVT_SCROLL_BOTTOM",
|
||||
"wxEVT_SCROLL_LINEUP",
|
||||
"wxEVT_SCROLL_LINEDOWN",
|
||||
"wxEVT_SCROLL_PAGEUP",
|
||||
"wxEVT_SCROLL_PAGEDOWN",
|
||||
"wxEVT_SCROLL_THUMBTRACK",
|
||||
"wxEVT_SCROLL_THUMBRELEASE",
|
||||
"wxEVT_SCROLL_CHANGED"
|
||||
};
|
||||
|
||||
int index = eventType - wxEVT_SCROLL_TOP;
|
||||
|
||||
/*
|
||||
If this assert is triggered, there is an unknown slider event which
|
||||
should be added to the above eventNames array.
|
||||
*/
|
||||
wxASSERT_MSG(index >= 0 && (size_t)index < WXSIZEOF(eventNames),
|
||||
"Unknown slider event" );
|
||||
|
||||
wxLogMessage("Slider event #%d: %s (pos = %d, int value = %d)",
|
||||
ms_numSliderEvents++,
|
||||
eventNames[index],
|
||||
event.GetPosition(),
|
||||
event.GetInt());
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnSlider(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Slider event #%d: wxEVT_SLIDER (value = %d)",
|
||||
ms_numSliderEvents++, event.GetInt());
|
||||
}
|
||||
|
||||
#endif // wxUSE_SLIDER
|
||||
652
libs/wxWidgets-3.3.1/samples/widgets/spinbtn.cpp
Normal file
652
libs/wxWidgets-3.3.1/samples/widgets/spinbtn.cpp
Normal file
@@ -0,0 +1,652 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: spinbtn.cpp
|
||||
// Purpose: Part of the widgets sample showing wxSpinButton
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 16.04.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_SPINBTN
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/spinbutt.h"
|
||||
#include "wx/spinctrl.h"
|
||||
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/spinbtn.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
SpinBtnPage_Reset = wxID_HIGHEST,
|
||||
SpinBtnPage_Clear,
|
||||
SpinBtnPage_SetValue,
|
||||
SpinBtnPage_SetMinAndMax,
|
||||
SpinBtnPage_SetBase,
|
||||
SpinBtnPage_SetIncrement,
|
||||
SpinBtnPage_CurValueText,
|
||||
SpinBtnPage_ValueText,
|
||||
SpinBtnPage_MinText,
|
||||
SpinBtnPage_MaxText,
|
||||
SpinBtnPage_BaseText,
|
||||
SpinBtnPage_SetIncrementText,
|
||||
SpinBtnPage_SpinBtn,
|
||||
SpinBtnPage_SpinCtrl,
|
||||
SpinBtnPage_SpinCtrlDouble
|
||||
};
|
||||
|
||||
// alignment radiobox values
|
||||
enum
|
||||
{
|
||||
Align_Left,
|
||||
Align_Centre,
|
||||
Align_Right
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SpinBtnWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class SpinBtnWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
SpinBtnWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_spinbtn; }
|
||||
virtual Widgets GetWidgets() const override
|
||||
{
|
||||
Widgets widgets(WidgetsPage::GetWidgets());
|
||||
widgets.push_back(m_spinctrl);
|
||||
widgets.push_back(m_spinctrldbl);
|
||||
return widgets;
|
||||
}
|
||||
|
||||
virtual void RecreateWidget() override { CreateSpin(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonClear(wxCommandEvent& event);
|
||||
void OnButtonSetValue(wxCommandEvent& event);
|
||||
void OnButtonSetMinAndMax(wxCommandEvent& event);
|
||||
void OnButtonSetBase(wxCommandEvent& event);
|
||||
void OnButtonSetIncrement(wxCommandEvent &event);
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
void OnSpinBtn(wxSpinEvent& event);
|
||||
void OnSpinBtnUp(wxSpinEvent& event);
|
||||
void OnSpinBtnDown(wxSpinEvent& event);
|
||||
void OnSpinCtrl(wxSpinEvent& event);
|
||||
void OnSpinCtrlDouble(wxSpinDoubleEvent& event);
|
||||
void OnSpinText(wxCommandEvent& event);
|
||||
void OnSpinTextEnter(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUIValueButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIMinMaxButton(wxUpdateUIEvent& event);
|
||||
void OnUpdateUIBaseButton(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||
|
||||
void OnUpdateUICurValueText(wxUpdateUIEvent& event);
|
||||
|
||||
// reset the spinbtn parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the spinbtn
|
||||
void CreateSpin();
|
||||
|
||||
// is this spinbtn value in range?
|
||||
bool IsValidValue(int val) const
|
||||
{ return (val >= m_min) && (val <= m_max); }
|
||||
|
||||
// the spinbtn range
|
||||
int m_min, m_max;
|
||||
|
||||
// and numeric base
|
||||
int m_base;
|
||||
|
||||
// the increment
|
||||
int m_increment;
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the check/radio boxes for styles
|
||||
wxCheckBox *m_chkVert,
|
||||
*m_chkArrowKeys,
|
||||
*m_chkWrap,
|
||||
*m_chkProcessEnter;
|
||||
wxRadioBox *m_radioAlign;
|
||||
|
||||
// the spinbtn and the spinctrl and the sizer containing them
|
||||
wxSpinButton *m_spinbtn;
|
||||
wxSpinCtrl *m_spinctrl;
|
||||
wxSpinCtrlDouble *m_spinctrldbl;
|
||||
|
||||
wxSizer *m_sizerSpin;
|
||||
|
||||
// the text entries for set value/range
|
||||
wxTextCtrl *m_textValue,
|
||||
*m_textMin,
|
||||
*m_textMax,
|
||||
*m_textBase,
|
||||
*m_textIncrement;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(SpinBtnWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(SpinBtnWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(SpinBtnPage_Reset, SpinBtnWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(SpinBtnPage_SetValue, SpinBtnWidgetsPage::OnButtonSetValue)
|
||||
EVT_BUTTON(SpinBtnPage_SetMinAndMax, SpinBtnWidgetsPage::OnButtonSetMinAndMax)
|
||||
EVT_BUTTON(SpinBtnPage_SetBase, SpinBtnWidgetsPage::OnButtonSetBase)
|
||||
EVT_BUTTON(SpinBtnPage_SetIncrement, SpinBtnWidgetsPage::OnButtonSetIncrement)
|
||||
|
||||
EVT_UPDATE_UI(SpinBtnPage_SetValue, SpinBtnWidgetsPage::OnUpdateUIValueButton)
|
||||
EVT_UPDATE_UI(SpinBtnPage_SetMinAndMax, SpinBtnWidgetsPage::OnUpdateUIMinMaxButton)
|
||||
EVT_UPDATE_UI(SpinBtnPage_SetBase, SpinBtnWidgetsPage::OnUpdateUIBaseButton)
|
||||
|
||||
EVT_UPDATE_UI(SpinBtnPage_Reset, SpinBtnWidgetsPage::OnUpdateUIResetButton)
|
||||
|
||||
EVT_UPDATE_UI(SpinBtnPage_CurValueText, SpinBtnWidgetsPage::OnUpdateUICurValueText)
|
||||
|
||||
EVT_SPIN(SpinBtnPage_SpinBtn, SpinBtnWidgetsPage::OnSpinBtn)
|
||||
EVT_SPIN_UP(SpinBtnPage_SpinBtn, SpinBtnWidgetsPage::OnSpinBtnUp)
|
||||
EVT_SPIN_DOWN(SpinBtnPage_SpinBtn, SpinBtnWidgetsPage::OnSpinBtnDown)
|
||||
EVT_SPINCTRL(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinCtrl)
|
||||
EVT_SPINCTRLDOUBLE(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinCtrlDouble)
|
||||
EVT_TEXT(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinText)
|
||||
EVT_TEXT_ENTER(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinTextEnter)
|
||||
EVT_TEXT(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinText)
|
||||
EVT_TEXT_ENTER(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinTextEnter)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, "Spin",
|
||||
FAMILY_CTRLS | EDITABLE_CTRLS
|
||||
);
|
||||
|
||||
SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, spinbtn_xpm)
|
||||
{
|
||||
m_chkVert = nullptr;
|
||||
m_chkArrowKeys = nullptr;
|
||||
m_chkWrap = nullptr;
|
||||
m_chkProcessEnter = nullptr;
|
||||
m_radioAlign = nullptr;
|
||||
m_spinbtn = nullptr;
|
||||
m_spinctrl = nullptr;
|
||||
m_spinctrldbl = nullptr;
|
||||
m_textValue =
|
||||
m_textMin =
|
||||
m_textMax =
|
||||
m_textBase =
|
||||
m_textIncrement = nullptr;
|
||||
|
||||
m_min = 0;
|
||||
m_max = 10;
|
||||
|
||||
m_base = 10;
|
||||
m_increment = 1;
|
||||
|
||||
m_sizerSpin = nullptr;
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical", wxID_ANY, sizerLeftBox);
|
||||
m_chkArrowKeys = CreateCheckBoxAndAddToSizer(sizerLeft, "&Arrow Keys", wxID_ANY, sizerLeftBox);
|
||||
m_chkWrap = CreateCheckBoxAndAddToSizer(sizerLeft, "&Wrap", wxID_ANY, sizerLeftBox);
|
||||
m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeft,
|
||||
"Process &Enter",
|
||||
wxID_ANY, sizerLeftBox);
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
static const wxString halign[] =
|
||||
{
|
||||
"left",
|
||||
"centre",
|
||||
"right",
|
||||
};
|
||||
|
||||
m_radioAlign = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Text alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(halign), halign, 1);
|
||||
|
||||
sizerLeft->Add(m_radioAlign, 0, wxGROW | wxALL, 5);
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, SpinBtnPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change spinbtn value");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
wxTextCtrl *text;
|
||||
wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value",
|
||||
SpinBtnPage_CurValueText,
|
||||
&text,
|
||||
sizerMiddleBox);
|
||||
text->SetEditable(false);
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetValue,
|
||||
"Set &value",
|
||||
SpinBtnPage_ValueText,
|
||||
&m_textValue,
|
||||
sizerMiddleBox);
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetMinAndMax,
|
||||
"&Min and max",
|
||||
SpinBtnPage_MinText,
|
||||
&m_textMin,
|
||||
sizerMiddleBox);
|
||||
|
||||
m_textMax = new wxTextCtrl(sizerMiddleBox, SpinBtnPage_MaxText, wxEmptyString);
|
||||
sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
|
||||
|
||||
m_textMin->SetValue( wxString::Format("%d", m_min) );
|
||||
m_textMax->SetValue( wxString::Format("%d", m_max) );
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetBase,
|
||||
"Set &base",
|
||||
SpinBtnPage_BaseText,
|
||||
&m_textBase,
|
||||
sizerMiddleBox);
|
||||
m_textBase->SetValue("10");
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
sizerRow = CreateSizerWithTextAndButton( SpinBtnPage_SetIncrement,
|
||||
"Set Increment",
|
||||
SpinBtnPage_SetIncrementText,
|
||||
&m_textIncrement,
|
||||
sizerMiddleBox);
|
||||
m_textIncrement->SetValue( "1" );
|
||||
sizerMiddle->Add( sizerRow, 0, wxALL | wxGROW, 5 );
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerSpin = sizerRight; // save it to modify it later
|
||||
|
||||
Reset();
|
||||
CreateSpin();
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void SpinBtnWidgetsPage::Reset()
|
||||
{
|
||||
m_chkVert->SetValue(true);
|
||||
m_chkArrowKeys->SetValue(true);
|
||||
m_chkWrap->SetValue(false);
|
||||
m_chkProcessEnter->SetValue(false);
|
||||
m_radioAlign->SetSelection(Align_Right);
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::CreateSpin()
|
||||
{
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
bool isVert = m_chkVert->GetValue();
|
||||
if ( isVert )
|
||||
flags |= wxSP_VERTICAL;
|
||||
else
|
||||
flags |= wxSP_HORIZONTAL;
|
||||
|
||||
if ( m_chkArrowKeys->GetValue() )
|
||||
flags |= wxSP_ARROW_KEYS;
|
||||
|
||||
if ( m_chkWrap->GetValue() )
|
||||
flags |= wxSP_WRAP;
|
||||
|
||||
if ( m_chkProcessEnter->GetValue() )
|
||||
flags |= wxTE_PROCESS_ENTER;
|
||||
|
||||
int textFlags = 0;
|
||||
switch ( m_radioAlign->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case Align_Left:
|
||||
textFlags |= wxALIGN_LEFT; // no-op
|
||||
break;
|
||||
|
||||
case Align_Centre:
|
||||
textFlags |= wxALIGN_CENTRE_HORIZONTAL;
|
||||
break;
|
||||
|
||||
case Align_Right:
|
||||
textFlags |= wxALIGN_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
int val = m_min;
|
||||
if ( m_spinbtn )
|
||||
{
|
||||
int valOld = m_spinbtn->GetValue();
|
||||
if ( !IsValidValue(valOld) )
|
||||
{
|
||||
val = valOld;
|
||||
}
|
||||
|
||||
m_sizerSpin->Clear(true /* delete windows */);
|
||||
}
|
||||
|
||||
m_spinbtn = new wxSpinButton(this, SpinBtnPage_SpinBtn,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
m_spinbtn->SetValue(val);
|
||||
m_spinbtn->SetRange(m_min, m_max);
|
||||
|
||||
m_spinctrl = new wxSpinCtrl(this, SpinBtnPage_SpinCtrl,
|
||||
wxString::Format("%d", val),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags | textFlags,
|
||||
m_min, m_max, val);
|
||||
|
||||
m_spinctrldbl = new wxSpinCtrlDouble(this, SpinBtnPage_SpinCtrlDouble,
|
||||
wxString::Format("%d", val),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags | textFlags,
|
||||
m_min, m_max, val, 0.1);
|
||||
|
||||
NotifyWidgetRecreation(m_spinbtn);
|
||||
NotifyWidgetRecreation(m_spinctrl);
|
||||
NotifyWidgetRecreation(m_spinctrldbl);
|
||||
|
||||
// Add spacers, labels and spin controls to the sizer.
|
||||
m_sizerSpin->Add(0, 0, 1);
|
||||
m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinButton"),
|
||||
0, wxALIGN_CENTRE | wxALL, 5);
|
||||
m_sizerSpin->Add(m_spinbtn, 0, wxALIGN_CENTRE | wxALL, 5);
|
||||
m_sizerSpin->Add(0, 0, 1);
|
||||
m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinCtrl"),
|
||||
0, wxALIGN_CENTRE | wxALL, 5);
|
||||
m_sizerSpin->Add(m_spinctrl, 0, wxALIGN_CENTRE | wxALL, 5);
|
||||
m_sizerSpin->Add(0, 0, 1);
|
||||
m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinCtrlDouble"),
|
||||
0, wxALIGN_CENTRE | wxALL, 5);
|
||||
m_sizerSpin->Add(m_spinctrldbl, 0, wxALIGN_CENTRE | wxALL, 5);
|
||||
m_sizerSpin->Add(0, 0, 1);
|
||||
|
||||
m_sizerSpin->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void SpinBtnWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateSpin();
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long minNew,
|
||||
maxNew = 0; // init to suppress compiler warning
|
||||
if ( !m_textMin->GetValue().ToLong(&minNew) ||
|
||||
!m_textMax->GetValue().ToLong(&maxNew) ||
|
||||
minNew > maxNew )
|
||||
{
|
||||
wxLogWarning("Invalid min/max values for the spinbtn.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_min = minNew;
|
||||
m_max = maxNew;
|
||||
|
||||
m_spinbtn->SetRange(minNew, maxNew);
|
||||
m_spinctrl->SetRange(minNew, maxNew);
|
||||
m_spinctrldbl->SetRange(minNew, maxNew);
|
||||
|
||||
m_sizerSpin->Layout();
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnButtonSetBase(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
unsigned long base;
|
||||
if ( !m_textBase->GetValue().ToULong(&base) || !base )
|
||||
{
|
||||
wxLogWarning("Invalid base value.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_base = base;
|
||||
if ( !m_spinctrl->SetBase(m_base) )
|
||||
{
|
||||
wxLogWarning("Setting base %d failed.", m_base);
|
||||
}
|
||||
|
||||
m_sizerSpin->Layout();
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnButtonSetIncrement(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
int increment = wxAtoi( m_textIncrement->GetValue() );
|
||||
if ( !increment )
|
||||
{
|
||||
wxLogWarning("Invalid increment value.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_increment = increment;
|
||||
m_spinctrl->SetIncrement(m_increment);
|
||||
wxLogWarning("Setting increment to %d.", m_increment);
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( m_textValue->IsEmpty() )
|
||||
{
|
||||
m_spinctrl->SetValue( wxEmptyString );
|
||||
m_spinctrldbl->SetValue( wxEmptyString );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
long val;
|
||||
if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) )
|
||||
{
|
||||
wxLogWarning("Invalid spinbtn value.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_spinbtn->SetValue(val);
|
||||
m_spinctrl->SetValue(val);
|
||||
m_spinctrldbl->SetValue(val);
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnUpdateUIValueButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
long val;
|
||||
event.Enable( m_textValue->IsEmpty() ||
|
||||
( m_textValue->GetValue().ToLong(&val) && IsValidValue(val) ) );
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnUpdateUIMinMaxButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
long mn, mx;
|
||||
event.Enable( m_textMin->GetValue().ToLong(&mn) &&
|
||||
m_textMax->GetValue().ToLong(&mx) &&
|
||||
mn <= mx);
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnUpdateUIBaseButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
unsigned long base;
|
||||
event.Enable( m_textBase->GetValue().ToULong(&base) && base );
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable( !m_chkVert->GetValue() ||
|
||||
m_chkWrap->GetValue() ||
|
||||
m_chkProcessEnter->GetValue() );
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateSpin();
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.SetText( wxString::Format("%d", m_spinbtn->GetValue()));
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinBtn(wxSpinEvent& event)
|
||||
{
|
||||
int value = event.GetInt();
|
||||
|
||||
wxASSERT_MSG( value == m_spinbtn->GetValue(),
|
||||
"spinbtn value should be the same" );
|
||||
|
||||
wxLogMessage("Spin button value changed, now %d", value);
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinBtnUp(wxSpinEvent& event)
|
||||
{
|
||||
// Demonstrate that these events can be vetoed to prevent the control value
|
||||
// from changing.
|
||||
if ( event.GetInt() == 11 )
|
||||
{
|
||||
wxLogMessage("Spin button prevented from going up to 11 (still %d)",
|
||||
m_spinbtn->GetValue());
|
||||
event.Veto();
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogMessage( "Spin button value incremented, will be %d (was %d)",
|
||||
event.GetInt(), m_spinbtn->GetValue() );
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinBtnDown(wxSpinEvent& event)
|
||||
{
|
||||
// Also demonstrate that vetoing the event but then skipping the handler
|
||||
// doesn't actually apply the veto.
|
||||
if ( event.GetInt() == 0 )
|
||||
{
|
||||
wxLogMessage("Spin button change not effectively vetoed, will become 0");
|
||||
event.Veto();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
wxLogMessage( "Spin button value decremented, will be %d (was %d)",
|
||||
event.GetInt(), m_spinbtn->GetValue() );
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinCtrl(wxSpinEvent& event)
|
||||
{
|
||||
int value = event.GetInt();
|
||||
|
||||
wxASSERT_MSG( value == m_spinctrl->GetValue(),
|
||||
"spinctrl value should be the same" );
|
||||
|
||||
wxLogMessage("Spin control value changed, now %d", value);
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinCtrlDouble(wxSpinDoubleEvent& event)
|
||||
{
|
||||
double value = event.GetValue();
|
||||
|
||||
wxLogMessage("Spin control value changed, now %g", value);
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinText(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Text changed in spin control, now \"%s\"",
|
||||
event.GetString());
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinTextEnter(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("\"Enter\" pressed in spin control, text is \"%s\"",
|
||||
event.GetString());
|
||||
}
|
||||
|
||||
#endif // wxUSE_SPINBTN
|
||||
189
libs/wxWidgets-3.3.1/samples/widgets/statbmp.cpp
Normal file
189
libs/wxWidgets-3.3.1/samples/widgets/statbmp.cpp
Normal file
@@ -0,0 +1,189 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: statbmp.cpp
|
||||
// Purpose: Part of the widgets sample showing wxStaticBitmap
|
||||
// Author: Marcin Wojdyr
|
||||
// Created: 2008-06-19
|
||||
// Copyright: (c) 2008 Marcin Wojdyr
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/button.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbmp.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "wx/generic/statbmpg.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/filepicker.h"
|
||||
|
||||
#include "widgets.h"
|
||||
#include "icons/statbmp.xpm"
|
||||
|
||||
|
||||
class StatBmpWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
StatBmpWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, statbmp_xpm) {}
|
||||
|
||||
virtual void CreateContent() override;
|
||||
virtual wxWindow *GetWidget() const override { return m_statbmp; }
|
||||
virtual void RecreateWidget() override;
|
||||
|
||||
private:
|
||||
void OnFileChange(wxFileDirPickerEvent &WXUNUSED(ev)) { RecreateWidget(); }
|
||||
void OnRadioChange(wxCommandEvent &WXUNUSED(ev)) { RecreateWidget(); }
|
||||
|
||||
void OnMouseEvent(wxMouseEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("wxStaticBitmap clicked.");
|
||||
}
|
||||
|
||||
wxStaticBitmapBase *m_statbmp;
|
||||
wxFilePickerCtrl *m_filepicker;
|
||||
wxRadioBox *m_radio;
|
||||
wxRadioBox *m_scaleRadio;
|
||||
wxStaticBoxSizer *m_sbsizer;
|
||||
|
||||
DECLARE_WIDGETS_PAGE(StatBmpWidgetsPage)
|
||||
};
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(StatBmpWidgetsPage, "StaticBitmap",
|
||||
ALL_CTRLS);
|
||||
|
||||
void StatBmpWidgetsPage::CreateContent()
|
||||
{
|
||||
|
||||
static const wxString choices[] = { "native", "generic" };
|
||||
m_radio = new wxRadioBox(this, wxID_ANY, "Implementation",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(choices), choices);
|
||||
static const wxString scaleChoices[] = { "None", "Fill", "Aspect Fit", "Aspect Fill" };
|
||||
m_scaleRadio = new wxRadioBox(this, wxID_ANY, "Scale Mode",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(scaleChoices), scaleChoices);
|
||||
|
||||
wxString testImage;
|
||||
#if wxUSE_LIBPNG
|
||||
wxPathList pathlist;
|
||||
pathlist.Add(".");
|
||||
pathlist.Add("..");
|
||||
pathlist.Add("../image");
|
||||
pathlist.Add("../../../samples/image");
|
||||
|
||||
wxFileName fn(pathlist.FindValidPath("toucan.png"));
|
||||
if ( fn.FileExists() )
|
||||
testImage = fn.GetFullPath();
|
||||
#endif // wxUSE_LIBPNG
|
||||
m_filepicker = new wxFilePickerCtrl(this, wxID_ANY, testImage);
|
||||
|
||||
m_sbsizer = new wxStaticBoxSizer(wxVERTICAL, this, "wxStaticBitmap inside");
|
||||
|
||||
wxSizer *leftsizer = new wxBoxSizer(wxVERTICAL);
|
||||
leftsizer->Add(m_radio, wxSizerFlags().Expand().Border());
|
||||
leftsizer->Add(m_scaleRadio, wxSizerFlags().Expand().Border());
|
||||
leftsizer->Add(m_filepicker, wxSizerFlags().Expand().Border());
|
||||
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(leftsizer, wxSizerFlags().Border());
|
||||
sizer->Add(m_sbsizer, wxSizerFlags().Center());
|
||||
SetSizer(sizer);
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
Bind(wxEVT_FILEPICKER_CHANGED, &StatBmpWidgetsPage::OnFileChange, this);
|
||||
Bind(wxEVT_RADIOBOX, &StatBmpWidgetsPage::OnRadioChange, this);
|
||||
|
||||
m_statbmp = nullptr;
|
||||
RecreateWidget();
|
||||
}
|
||||
|
||||
void StatBmpWidgetsPage::RecreateWidget()
|
||||
{
|
||||
wxDELETE(m_statbmp);
|
||||
|
||||
wxBitmap bmp;
|
||||
|
||||
wxString filepath = m_filepicker->GetPath();
|
||||
if ( !filepath.empty() )
|
||||
{
|
||||
wxImage image(filepath);
|
||||
if ( image.IsOk() )
|
||||
{
|
||||
bmp = image;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage("Reading image from file '%s' failed.", filepath);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bmp.IsOk() )
|
||||
{
|
||||
// Show at least something.
|
||||
bmp = wxArtProvider::GetBitmap(wxART_MISSING_IMAGE);
|
||||
}
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
if (m_radio->GetSelection() == 0)
|
||||
{
|
||||
m_statbmp = new wxStaticBitmap(m_sbsizer->GetStaticBox(), wxID_ANY, bmp,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_statbmp = new wxGenericStaticBitmap(m_sbsizer->GetStaticBox(), wxID_ANY, bmp,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
}
|
||||
|
||||
NotifyWidgetRecreation(m_statbmp);
|
||||
|
||||
wxStaticBitmapBase::ScaleMode scaleMode = (wxStaticBitmapBase::ScaleMode) m_scaleRadio->GetSelection();
|
||||
m_statbmp->SetScaleMode(scaleMode);
|
||||
if ( m_statbmp->GetScaleMode() != scaleMode )
|
||||
wxLogError("Scale mode not supported by current implementation");
|
||||
wxSizerItem* sbsizerItem = GetSizer()->GetItem(m_sbsizer);
|
||||
if ( scaleMode == wxStaticBitmapBase::Scale_None )
|
||||
{
|
||||
sbsizerItem->SetProportion(0);
|
||||
sbsizerItem->SetFlag(wxCENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
sbsizerItem->SetProportion(1);
|
||||
sbsizerItem->SetFlag(wxEXPAND);
|
||||
}
|
||||
m_sbsizer->Add(m_statbmp, wxSizerFlags(1).Expand());
|
||||
GetSizer()->Layout();
|
||||
m_statbmp->Bind(wxEVT_LEFT_DOWN, &StatBmpWidgetsPage::OnMouseEvent, this);
|
||||
|
||||
// When switching from generic to native control on wxMSW under Wine,
|
||||
// the explicit Refresh() is necessary
|
||||
m_statbmp->Refresh();
|
||||
}
|
||||
|
||||
640
libs/wxWidgets-3.3.1/samples/widgets/static.cpp
Normal file
640
libs/wxWidgets-3.3.1/samples/widgets/static.cpp
Normal file
@@ -0,0 +1,640 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: static.cpp
|
||||
// Purpose: Part of the widgets sample showing various static controls
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 11.04.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "wx/statline.h"
|
||||
#include "wx/generic/stattextg.h"
|
||||
#include "wx/wupdlock.h"
|
||||
|
||||
#include "widgets.h"
|
||||
#include "icons/statbox.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// alignment radiobox values
|
||||
enum
|
||||
{
|
||||
StaticHAlign_Left,
|
||||
StaticHAlign_Centre,
|
||||
StaticHAlign_Right,
|
||||
StaticHAlign_Max
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
StaticVAlign_Top,
|
||||
StaticVAlign_Centre,
|
||||
StaticVAlign_Bottom,
|
||||
StaticVAlign_Max
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
StaticEllipsize_Start,
|
||||
StaticEllipsize_Middle,
|
||||
StaticEllipsize_End
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StaticWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class StaticWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
StaticWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_statText; }
|
||||
virtual Widgets GetWidgets() const override
|
||||
{
|
||||
Widgets widgets;
|
||||
widgets.push_back(m_sizerStatBox->GetStaticBox());
|
||||
widgets.push_back(m_statText);
|
||||
#if wxUSE_MARKUP
|
||||
widgets.push_back(m_statMarkup);
|
||||
#endif // wxUSE_MARKUP
|
||||
#if wxUSE_STATLINE
|
||||
widgets.push_back(m_statLine);
|
||||
#endif // wxUSE_STATLINE
|
||||
|
||||
return widgets;
|
||||
}
|
||||
virtual void RecreateWidget() override { CreateStatic(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnRecreate(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateStatic();
|
||||
}
|
||||
|
||||
void OnCheckEllipsize(wxCommandEvent& event);
|
||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
void OnBoxCheckBox(wxCommandEvent& event);
|
||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonBoxText(wxCommandEvent& event);
|
||||
void OnButtonLabelText(wxCommandEvent& event);
|
||||
#if wxUSE_MARKUP
|
||||
void OnButtonLabelWithMarkupText(wxCommandEvent& event);
|
||||
#endif // wxUSE_MARKUP
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
|
||||
// reset all parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create all controls
|
||||
void CreateStatic();
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the check/radio boxes for styles
|
||||
wxCheckBox *m_chkVert,
|
||||
*m_chkGeneric,
|
||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
*m_chkBoxWithCheck,
|
||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
*m_chkAutoResize,
|
||||
*m_chkEllipsize;
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
wxCheckBox *m_chkMarkup,
|
||||
*m_chkGreen;
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
wxRadioBox *m_radioHAlign,
|
||||
*m_radioVAlign,
|
||||
*m_radioEllipsize;
|
||||
|
||||
// the controls and the sizer containing them
|
||||
wxStaticBoxSizer *m_sizerStatBox;
|
||||
wxStaticTextBase *m_statText;
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
wxStaticTextBase *m_statMarkup;
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
#if wxUSE_STATLINE
|
||||
wxStaticLine *m_statLine;
|
||||
#endif // wxUSE_STATLINE
|
||||
wxSizer *m_sizerStatic;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_textBox,
|
||||
*m_textLabel;
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
wxTextCtrl *m_textLabelWithMarkup;
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
private:
|
||||
DECLARE_WIDGETS_PAGE(StaticWidgetsPage)
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, "Static",
|
||||
(int)wxPlatform(GENERIC_CTRLS).If(wxOS_WINDOWS,NATIVE_CTRLS)
|
||||
);
|
||||
|
||||
StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, statbox_xpm)
|
||||
{
|
||||
// init everything
|
||||
m_chkVert =
|
||||
m_chkAutoResize =
|
||||
m_chkGeneric =
|
||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
m_chkBoxWithCheck =
|
||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
#if wxUSE_MARKUP
|
||||
m_chkGreen =
|
||||
#endif // wxUSE_MARKUP
|
||||
nullptr;
|
||||
|
||||
m_radioHAlign =
|
||||
m_radioVAlign = nullptr;
|
||||
|
||||
m_statText = nullptr;
|
||||
#if wxUSE_STATLINE
|
||||
m_statLine = nullptr;
|
||||
#endif // wxUSE_STATLINE
|
||||
#if wxUSE_MARKUP
|
||||
m_statMarkup = nullptr;
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
m_sizerStatBox = nullptr;
|
||||
m_sizerStatic = nullptr;
|
||||
|
||||
m_textBox =
|
||||
m_textLabel =
|
||||
#if wxUSE_MARKUP
|
||||
m_textLabelWithMarkup =
|
||||
#endif // wxUSE_MARKUP
|
||||
nullptr;
|
||||
}
|
||||
|
||||
void StaticWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkGeneric = CreateCheckBoxAndAddToSizer(sizerLeft,
|
||||
"&Generic wxStaticText",
|
||||
wxID_ANY, sizerLeftBox);
|
||||
m_chkGeneric->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
|
||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
m_chkBoxWithCheck = CreateCheckBoxAndAddToSizer(sizerLeft, "Checkable &box", wxID_ANY, sizerLeftBox);
|
||||
m_chkBoxWithCheck->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
|
||||
m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical line", wxID_ANY, sizerLeftBox);
|
||||
m_chkVert->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
|
||||
m_chkAutoResize = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit to text", wxID_ANY, sizerLeftBox);
|
||||
m_chkAutoResize->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
static const wxString halign[] =
|
||||
{
|
||||
"left",
|
||||
"centre",
|
||||
"right",
|
||||
};
|
||||
|
||||
static const wxString valign[] =
|
||||
{
|
||||
"top",
|
||||
"centre",
|
||||
"bottom",
|
||||
};
|
||||
|
||||
m_radioHAlign = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Horz alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(halign), halign, 3);
|
||||
m_radioHAlign->Bind(wxEVT_RADIOBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
|
||||
m_radioVAlign = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Vert alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(valign), valign, 3);
|
||||
m_radioVAlign->SetToolTip("Relevant for Generic wxStaticText only");
|
||||
m_radioVAlign->Bind(wxEVT_RADIOBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
|
||||
sizerLeft->Add(m_radioHAlign, 0, wxGROW | wxALL, 5);
|
||||
sizerLeft->Add(m_radioVAlign, 0, wxGROW | wxALL, 5);
|
||||
|
||||
|
||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||
|
||||
m_chkEllipsize = CreateCheckBoxAndAddToSizer(sizerLeft, "&Ellipsize", wxID_ANY, sizerLeftBox);
|
||||
m_chkEllipsize->Bind(wxEVT_CHECKBOX,
|
||||
&StaticWidgetsPage::OnCheckEllipsize, this);
|
||||
|
||||
static const wxString ellipsizeMode[] =
|
||||
{
|
||||
"&start",
|
||||
"&middle",
|
||||
"&end",
|
||||
};
|
||||
|
||||
m_radioEllipsize = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Ellipsize mode",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(ellipsizeMode), ellipsizeMode,
|
||||
3);
|
||||
m_radioEllipsize->Bind(wxEVT_RADIOBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
|
||||
sizerLeft->Add(m_radioEllipsize, 0, wxGROW | wxALL, 5);
|
||||
|
||||
wxButton *b0 = new wxButton(sizerLeftBox, wxID_ANY, "&Reset");
|
||||
b0->Bind(wxEVT_BUTTON, &StaticWidgetsPage::OnButtonReset, this);
|
||||
sizerLeft->Add(b0, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Change labels");
|
||||
wxStaticBox* const sizerMiddleBox = sizerMiddle->GetStaticBox();
|
||||
|
||||
m_textBox = new wxTextCtrl(sizerMiddleBox, wxID_ANY, wxEmptyString);
|
||||
wxButton *b1 = new wxButton(sizerMiddleBox, wxID_ANY, "Change &box label");
|
||||
b1->Bind(wxEVT_BUTTON, &StaticWidgetsPage::OnButtonBoxText, this);
|
||||
sizerMiddle->Add(m_textBox, 0, wxEXPAND|wxALL, 5);
|
||||
sizerMiddle->Add(b1, 0, wxLEFT|wxBOTTOM, 5);
|
||||
|
||||
m_textLabel = new wxTextCtrl(sizerMiddleBox, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxHSCROLL);
|
||||
wxButton *b2 = new wxButton(sizerMiddleBox, wxID_ANY, "Change &text label");
|
||||
b2->Bind(wxEVT_BUTTON, &StaticWidgetsPage::OnButtonLabelText, this);
|
||||
sizerMiddle->Add(m_textLabel, 0, wxEXPAND|wxALL, 5);
|
||||
sizerMiddle->Add(b2, 0, wxLEFT|wxBOTTOM, 5);
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
m_textLabelWithMarkup = new wxTextCtrl(sizerMiddleBox, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxHSCROLL);
|
||||
|
||||
wxButton *b3 = new wxButton(sizerMiddleBox, wxID_ANY, "Change decorated text label");
|
||||
b3->Bind(wxEVT_BUTTON, &StaticWidgetsPage::OnButtonLabelWithMarkupText, this);
|
||||
sizerMiddle->Add(m_textLabelWithMarkup, 0, wxEXPAND|wxALL, 5);
|
||||
sizerMiddle->Add(b3, 0, wxLEFT|wxBOTTOM, 5);
|
||||
|
||||
m_chkGreen = CreateCheckBoxAndAddToSizer(sizerMiddle,
|
||||
"Decorated label on g&reen",
|
||||
wxID_ANY, sizerMiddleBox);
|
||||
m_chkGreen->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
// final initializations
|
||||
// NB: must be done _before_ calling CreateStatic()
|
||||
Reset();
|
||||
|
||||
m_textBox->SetValue("This is a &box");
|
||||
m_textLabel->SetValue("And this is a\n\tlabel inside the box with a &mnemonic.\n"
|
||||
"Only this text is affected by the ellipsize settings.");
|
||||
#if wxUSE_MARKUP
|
||||
m_textLabelWithMarkup->SetValue("Another label, this time <b>decorated</b> "
|
||||
"with <u>markup</u>; here you need entities "
|
||||
"for the symbols: < > && ' " "
|
||||
" but you can still use &mnemonics too");
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
// right pane
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizerRight->SetMinSize(150, 0);
|
||||
m_sizerStatic = sizerRight;
|
||||
|
||||
CreateStatic();
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void StaticWidgetsPage::Reset()
|
||||
{
|
||||
m_chkGeneric->SetValue(false);
|
||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
m_chkBoxWithCheck->SetValue(false);
|
||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
m_chkVert->SetValue(false);
|
||||
m_chkAutoResize->SetValue(true);
|
||||
m_chkEllipsize->SetValue(true);
|
||||
|
||||
m_radioHAlign->SetSelection(StaticHAlign_Left);
|
||||
m_radioVAlign->SetSelection(StaticVAlign_Top);
|
||||
}
|
||||
|
||||
void StaticWidgetsPage::CreateStatic()
|
||||
{
|
||||
wxWindowUpdateLocker lock(this);
|
||||
|
||||
bool isVert = m_chkVert->GetValue();
|
||||
|
||||
if ( m_sizerStatBox )
|
||||
{
|
||||
// delete m_sizerStatBox; -- deleted by Remove()
|
||||
m_sizerStatic->Remove(m_sizerStatBox);
|
||||
delete m_statText;
|
||||
#if wxUSE_MARKUP
|
||||
delete m_statMarkup;
|
||||
#endif // wxUSE_MARKUP
|
||||
#if wxUSE_STATLINE
|
||||
delete m_statLine;
|
||||
#endif // wxUSE_STATLINE
|
||||
}
|
||||
|
||||
int flagsBox = 0,
|
||||
flagsText = GetAttrs().m_defaultFlags,
|
||||
flagsDummyText = GetAttrs().m_defaultFlags;
|
||||
|
||||
if ( !m_chkAutoResize->GetValue() )
|
||||
{
|
||||
flagsText |= wxST_NO_AUTORESIZE;
|
||||
flagsDummyText |= wxST_NO_AUTORESIZE;
|
||||
}
|
||||
|
||||
int align = 0;
|
||||
switch ( m_radioHAlign->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case StaticHAlign_Left:
|
||||
align |= wxALIGN_LEFT;
|
||||
break;
|
||||
|
||||
case StaticHAlign_Centre:
|
||||
align |= wxALIGN_CENTRE_HORIZONTAL;
|
||||
break;
|
||||
|
||||
case StaticHAlign_Right:
|
||||
align |= wxALIGN_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( m_radioVAlign->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case StaticVAlign_Top:
|
||||
align |= wxALIGN_TOP;
|
||||
break;
|
||||
|
||||
case StaticVAlign_Centre:
|
||||
align |= wxALIGN_CENTRE_VERTICAL;
|
||||
break;
|
||||
|
||||
case StaticVAlign_Bottom:
|
||||
align |= wxALIGN_BOTTOM;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( m_chkEllipsize->GetValue() )
|
||||
{
|
||||
switch ( m_radioEllipsize->GetSelection() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case StaticEllipsize_Start:
|
||||
flagsDummyText |= wxST_ELLIPSIZE_START;
|
||||
break;
|
||||
|
||||
case StaticEllipsize_Middle:
|
||||
flagsDummyText |= wxST_ELLIPSIZE_MIDDLE;
|
||||
break;
|
||||
|
||||
case StaticEllipsize_End:
|
||||
flagsDummyText |= wxST_ELLIPSIZE_END;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flagsDummyText |= align;
|
||||
flagsText |= align;
|
||||
flagsBox |= align;
|
||||
|
||||
wxStaticBox *staticBox;
|
||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
if ( m_chkBoxWithCheck->GetValue() )
|
||||
{
|
||||
wxCheckBox* const label = new wxCheckBox(this, wxID_ANY,
|
||||
m_textBox->GetValue());
|
||||
label->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnBoxCheckBox, this);
|
||||
|
||||
staticBox = new wxStaticBox(this, wxID_ANY,
|
||||
label,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flagsBox);
|
||||
}
|
||||
else // normal static box
|
||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
{
|
||||
staticBox = new wxStaticBox(this, wxID_ANY,
|
||||
m_textBox->GetValue(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flagsBox);
|
||||
}
|
||||
|
||||
m_sizerStatBox = new wxStaticBoxSizer(staticBox, isVert ? wxHORIZONTAL
|
||||
: wxVERTICAL);
|
||||
|
||||
if ( m_chkGeneric->GetValue() )
|
||||
{
|
||||
m_statText = new wxGenericStaticText(staticBox, wxID_ANY,
|
||||
m_textLabel->GetValue(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flagsDummyText);
|
||||
#if wxUSE_MARKUP
|
||||
m_statMarkup = new wxGenericStaticText(staticBox, wxID_ANY,
|
||||
wxString(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flagsText);
|
||||
#endif // wxUSE_MARKUP
|
||||
}
|
||||
else // use native versions
|
||||
{
|
||||
m_statText = new wxStaticText(staticBox, wxID_ANY,
|
||||
m_textLabel->GetValue(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flagsDummyText);
|
||||
#if wxUSE_MARKUP
|
||||
m_statMarkup = new wxStaticText(staticBox, wxID_ANY,
|
||||
wxString(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flagsText);
|
||||
#endif // wxUSE_MARKUP
|
||||
}
|
||||
|
||||
|
||||
m_statText->SetToolTip("Tooltip for a label inside the box");
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue());
|
||||
|
||||
if ( m_chkGreen->GetValue() )
|
||||
m_statMarkup->SetBackgroundColour(*wxGREEN);
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
#if wxUSE_STATLINE
|
||||
m_statLine = new wxStaticLine(staticBox, wxID_ANY,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
isVert ? wxLI_VERTICAL : wxLI_HORIZONTAL);
|
||||
#endif // wxUSE_STATLINE
|
||||
|
||||
m_sizerStatBox->Add(m_statText, 0, wxGROW);
|
||||
#if wxUSE_STATLINE
|
||||
m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxTOP | wxBOTTOM, 10);
|
||||
#endif // wxUSE_STATLINE
|
||||
#if wxUSE_MARKUP
|
||||
m_sizerStatBox->Add(m_statMarkup);
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
NotifyWidgetRecreation(m_statText);
|
||||
#if wxUSE_MARKUP
|
||||
NotifyWidgetRecreation(m_statMarkup);
|
||||
#endif
|
||||
#if wxUSE_STATLINE
|
||||
NotifyWidgetRecreation(m_statLine);
|
||||
#endif
|
||||
|
||||
m_sizerStatic->Add(m_sizerStatBox, 0, wxGROW);
|
||||
|
||||
m_sizerStatic->Layout();
|
||||
|
||||
m_statText->Bind(wxEVT_LEFT_UP, &StaticWidgetsPage::OnMouseEvent, this);
|
||||
staticBox->Bind(wxEVT_LEFT_UP, &StaticWidgetsPage::OnMouseEvent, this);
|
||||
|
||||
SetUpWidget();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void StaticWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateStatic();
|
||||
}
|
||||
|
||||
void StaticWidgetsPage::OnCheckEllipsize(wxCommandEvent& event)
|
||||
{
|
||||
m_radioEllipsize->Enable(event.IsChecked());
|
||||
|
||||
CreateStatic();
|
||||
}
|
||||
|
||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
void StaticWidgetsPage::OnBoxCheckBox(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Box check box has been %schecked",
|
||||
event.IsChecked() ? "": "un");
|
||||
}
|
||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||
|
||||
void StaticWidgetsPage::OnButtonBoxText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_sizerStatBox->GetStaticBox()->SetLabel(m_textBox->GetValue());
|
||||
}
|
||||
|
||||
void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_statText->SetLabel(m_textLabel->GetValue());
|
||||
|
||||
// test GetLabel() and GetLabelText(); the first should return the
|
||||
// label as it is written in the relative text control; the second should
|
||||
// return the label as it's shown in the wxStaticText
|
||||
wxLogMessage("The original label should be '%s'",
|
||||
m_statText->GetLabel());
|
||||
wxLogMessage("The label text is '%s'",
|
||||
m_statText->GetLabelText());
|
||||
}
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue());
|
||||
|
||||
// test GetLabel() and GetLabelText(); the first should return the
|
||||
// label as it is written in the relative text control; the second should
|
||||
// return the label as it's shown in the wxStaticText
|
||||
wxLogMessage("The original label should be '%s'",
|
||||
m_statMarkup->GetLabel());
|
||||
wxLogMessage("The label text is '%s'",
|
||||
m_statMarkup->GetLabelText());
|
||||
}
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
void StaticWidgetsPage::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
if ( event.GetEventObject() == m_statText )
|
||||
{
|
||||
wxLogMessage("Clicked on static text");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage("Clicked on static box");
|
||||
}
|
||||
}
|
||||
|
||||
1073
libs/wxWidgets-3.3.1/samples/widgets/textctrl.cpp
Normal file
1073
libs/wxWidgets-3.3.1/samples/widgets/textctrl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
241
libs/wxWidgets-3.3.1/samples/widgets/timepick.cpp
Normal file
241
libs/wxWidgets-3.3.1/samples/widgets/timepick.cpp
Normal file
@@ -0,0 +1,241 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: timepick.cpp
|
||||
// Purpose: Part of the widgets sample showing time picker
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2011-12-20
|
||||
// Copyright: (c) 2011 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_TIMEPICKCTRL
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/crt.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/button.h"
|
||||
#include "wx/textctrl.h"
|
||||
|
||||
#include "wx/sizer.h"
|
||||
#endif
|
||||
|
||||
#include "wx/timectrl.h"
|
||||
#include "wx/dateevt.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
#include "icons/timepick.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
TimePickerPage_Reset = wxID_HIGHEST,
|
||||
TimePickerPage_Set,
|
||||
TimePickerPage_Picker
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CheckBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class TimePickerWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
TimePickerWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_timePicker; }
|
||||
virtual void RecreateWidget() override { CreateTimePicker(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnTimeChanged(wxDateEvent& event);
|
||||
|
||||
void OnButtonSet(wxCommandEvent& event);
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
|
||||
// reset the time picker parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the time picker
|
||||
void CreateTimePicker();
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
// the checkbox itself and the sizer it is in
|
||||
wxTimePickerCtrl *m_timePicker;
|
||||
wxSizer *m_sizerTimePicker;
|
||||
|
||||
wxTextCtrl *m_textCur;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(TimePickerWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(TimePickerWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(TimePickerPage_Reset, TimePickerWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(TimePickerPage_Set, TimePickerWidgetsPage::OnButtonSet)
|
||||
|
||||
EVT_TIME_CHANGED(wxID_ANY, TimePickerWidgetsPage::OnTimeChanged)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS GENERIC_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(TimePickerWidgetsPage, "TimePicker",
|
||||
FAMILY_CTRLS | PICKER_CTRLS
|
||||
);
|
||||
|
||||
TimePickerWidgetsPage::TimePickerWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
: WidgetsPage(book, imaglist, timepick_xpm)
|
||||
{
|
||||
}
|
||||
|
||||
void TimePickerWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxSizer* const sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
sizerLeft->Add(new wxButton(this, TimePickerPage_Reset, "&Reset"),
|
||||
wxSizerFlags().Centre().Border());
|
||||
|
||||
|
||||
// middle pane: operations
|
||||
wxSizer* const sizerMiddle = new wxBoxSizer(wxVERTICAL);
|
||||
sizerMiddle->Add(CreateSizerWithTextAndButton
|
||||
(
|
||||
TimePickerPage_Set,
|
||||
"&Set time",
|
||||
wxID_ANY,
|
||||
&m_textCur
|
||||
),
|
||||
wxSizerFlags().Expand().Border());
|
||||
|
||||
m_textCur->SetMinSize(m_textCur->GetSizeFromText("00:00:00 AM"));
|
||||
|
||||
|
||||
// right pane: control itself
|
||||
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_timePicker = new wxTimePickerCtrl(this, TimePickerPage_Picker);
|
||||
|
||||
sizerRight->Add(0, 0, 1, wxCENTRE);
|
||||
sizerRight->Add(m_timePicker, 1, wxCENTRE);
|
||||
sizerRight->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerTimePicker = sizerRight; // save it to modify it later
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft, 0, (wxALL & ~wxLEFT), 10);
|
||||
sizerTop->Add(sizerMiddle, 0, (wxTOP | wxBOTTOM), 10);
|
||||
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
||||
|
||||
// final initializations
|
||||
Reset();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
void TimePickerWidgetsPage::Reset()
|
||||
{
|
||||
const wxDateTime today = wxDateTime::Today();
|
||||
|
||||
m_timePicker->SetValue(today);
|
||||
m_textCur->SetValue(today.FormatISOTime());
|
||||
}
|
||||
|
||||
void TimePickerWidgetsPage::CreateTimePicker()
|
||||
{
|
||||
const wxDateTime value = m_timePicker->GetValue();
|
||||
|
||||
size_t count = m_sizerTimePicker->GetChildren().GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
m_sizerTimePicker->Remove(0);
|
||||
}
|
||||
|
||||
delete m_timePicker;
|
||||
|
||||
long style = GetAttrs().m_defaultFlags;
|
||||
|
||||
m_timePicker = new wxTimePickerCtrl(this, TimePickerPage_Picker, value,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
|
||||
NotifyWidgetRecreation(m_timePicker);
|
||||
|
||||
m_sizerTimePicker->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerTimePicker->Add(m_timePicker, 1, wxCENTRE);
|
||||
m_sizerTimePicker->Add(0, 0, 1, wxCENTRE);
|
||||
m_sizerTimePicker->Layout();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void TimePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateTimePicker();
|
||||
}
|
||||
|
||||
void TimePickerWidgetsPage::OnButtonSet(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int h, m, s;
|
||||
if ( wxSscanf(m_textCur->GetValue(), "%d:%d:%d", &h, &m, &s) != 3 )
|
||||
{
|
||||
wxLogError("Invalid time, please use HH:MM:SS format.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_timePicker->SetTime(h, m, s);
|
||||
}
|
||||
|
||||
void TimePickerWidgetsPage::OnTimeChanged(wxDateEvent& event)
|
||||
{
|
||||
int h, m, s;
|
||||
m_timePicker->GetTime(&h, &m, &s);
|
||||
|
||||
wxLogMessage("Time changed, now is %s (control value is %02d:%02d:%02d).",
|
||||
event.GetDate().FormatISOTime(), h, m, s);
|
||||
}
|
||||
|
||||
#endif // wxUSE_TIMEPICKCTRL
|
||||
586
libs/wxWidgets-3.3.1/samples/widgets/toggle.cpp
Normal file
586
libs/wxWidgets-3.3.1/samples/widgets/toggle.cpp
Normal file
@@ -0,0 +1,586 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: toggle.cpp
|
||||
// Purpose: Part of the widgets sample showing toggle control
|
||||
// Author: Dimitri Schoolwerth, Vadim Zeitlin
|
||||
// Created: 27 Sep 2003
|
||||
// Copyright: (c) 2006 Wlodzmierz Skiba
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#if wxUSE_TOGGLEBTN
|
||||
|
||||
#include "wx/tglbtn.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "icons/toggle.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control ids
|
||||
enum
|
||||
{
|
||||
TogglePage_Reset = wxID_HIGHEST,
|
||||
TogglePage_ChangeLabel,
|
||||
TogglePage_Picker
|
||||
};
|
||||
|
||||
// radio boxes
|
||||
enum
|
||||
{
|
||||
ToggleImagePos_Left,
|
||||
ToggleImagePos_Right,
|
||||
ToggleImagePos_Top,
|
||||
ToggleImagePos_Bottom
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ToggleHAlign_Left,
|
||||
ToggleHAlign_Centre,
|
||||
ToggleHAlign_Right
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ToggleVAlign_Top,
|
||||
ToggleVAlign_Centre,
|
||||
ToggleVAlign_Bottom
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CheckBoxWidgetsPage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ToggleWidgetsPage : public WidgetsPage
|
||||
{
|
||||
public:
|
||||
ToggleWidgetsPage(WidgetsBookCtrl *book, wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
virtual wxWindow *GetWidget() const override { return m_toggle; }
|
||||
virtual void RecreateWidget() override { CreateToggle(); }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() override;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnCheckOrRadioBox(wxCommandEvent& event);
|
||||
|
||||
// event handlers
|
||||
void OnButtonReset(wxCommandEvent& event);
|
||||
void OnButtonChangeLabel(wxCommandEvent& event);
|
||||
|
||||
void OnToggled(wxCommandEvent& event);
|
||||
|
||||
// reset the toggle parameters
|
||||
void Reset();
|
||||
|
||||
// (re)create the toggle
|
||||
void CreateToggle();
|
||||
|
||||
// add m_button to m_sizerButton using current value of m_chkFit
|
||||
void AddButtonToSizer();
|
||||
|
||||
// helper function: create a bitmap for wxBitmapToggleButton
|
||||
wxBitmap CreateBitmap(const wxString& label, const wxArtID& type);
|
||||
|
||||
// the controls
|
||||
// ------------
|
||||
|
||||
wxCheckBox *m_chkFit,
|
||||
*m_chkDisable;
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
wxCheckBox *m_chkUseMarkup;
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
// the check/radio boxes for styles
|
||||
wxCheckBox *m_chkBitmapOnly,
|
||||
*m_chkTextAndBitmap,
|
||||
*m_chkUseBitmapClass;
|
||||
|
||||
// more checkboxes for wxBitmapToggleButton only
|
||||
wxCheckBox *m_chkUsePressed,
|
||||
*m_chkUseFocused,
|
||||
*m_chkUseCurrent,
|
||||
*m_chkUseDisabled;
|
||||
|
||||
// and an image position choice used if m_chkTextAndBitmap is on
|
||||
wxRadioBox *m_radioImagePos;
|
||||
|
||||
wxRadioBox *m_radioHAlign,
|
||||
*m_radioVAlign;
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
|
||||
// the checkbox itself and the sizer it is in
|
||||
wxToggleButton *m_toggle;
|
||||
wxSizer *m_sizerToggle;
|
||||
|
||||
// the text entries for command parameters
|
||||
wxTextCtrl *m_textLabel;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
DECLARE_WIDGETS_PAGE(ToggleWidgetsPage)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ToggleWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(TogglePage_Reset, ToggleWidgetsPage::OnButtonReset)
|
||||
EVT_BUTTON(TogglePage_ChangeLabel, ToggleWidgetsPage::OnButtonChangeLabel)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ToggleWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, ToggleWidgetsPage::OnCheckOrRadioBox)
|
||||
|
||||
EVT_TOGGLEBUTTON(wxID_ANY, ToggleWidgetsPage::OnToggled)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
||||
#else
|
||||
#define FAMILY_CTRLS NATIVE_CTRLS
|
||||
#endif
|
||||
|
||||
IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, "ToggleButton",
|
||||
FAMILY_CTRLS
|
||||
);
|
||||
|
||||
ToggleWidgetsPage::ToggleWidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist)
|
||||
:WidgetsPage(book, imaglist, toggle_xpm)
|
||||
{
|
||||
m_chkFit =
|
||||
m_chkDisable = nullptr;
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
m_chkUseMarkup = nullptr;
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
// init everything
|
||||
m_chkBitmapOnly =
|
||||
m_chkTextAndBitmap =
|
||||
m_chkUseBitmapClass =
|
||||
m_chkUsePressed =
|
||||
m_chkUseFocused =
|
||||
m_chkUseCurrent =
|
||||
m_chkUseDisabled = nullptr;
|
||||
|
||||
m_radioImagePos =
|
||||
m_radioHAlign =
|
||||
m_radioVAlign = nullptr;
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
|
||||
m_textLabel = nullptr;
|
||||
|
||||
m_toggle = nullptr;
|
||||
m_sizerToggle = nullptr;
|
||||
}
|
||||
|
||||
void ToggleWidgetsPage::CreateContent()
|
||||
{
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "Styles");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only", wxID_ANY, sizerLeftBox);
|
||||
m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap", wxID_ANY, sizerLeftBox);
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup", wxID_ANY, sizerLeftBox);
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit exactly", wxID_ANY, sizerLeftBox);
|
||||
m_chkDisable = CreateCheckBoxAndAddToSizer(sizerLeft, "Disable", wxID_ANY, sizerLeftBox);
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
m_chkUseBitmapClass = CreateCheckBoxAndAddToSizer(sizerLeft,
|
||||
"Use wxBitmapToggleButton", wxID_ANY, sizerLeftBox);
|
||||
m_chkUseBitmapClass->SetValue(true);
|
||||
|
||||
|
||||
sizerLeft->AddSpacer(5);
|
||||
|
||||
wxStaticBoxSizer *sizerUseLabels =
|
||||
new wxStaticBoxSizer(wxVERTICAL, sizerLeftBox,
|
||||
"&Use the following bitmaps in addition to the normal one?");
|
||||
wxStaticBox* const sizerUseLabelsBox = sizerUseLabels->GetStaticBox();
|
||||
|
||||
m_chkUsePressed = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Pressed (small help icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
m_chkUseFocused = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Focused (small error icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
m_chkUseCurrent = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Current (small warning icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
m_chkUseDisabled = CreateCheckBoxAndAddToSizer(sizerUseLabels,
|
||||
"&Disabled (broken image icon)", wxID_ANY, sizerUseLabelsBox);
|
||||
sizerLeft->Add(sizerUseLabels, wxSizerFlags().Expand().Border());
|
||||
|
||||
sizerLeft->AddSpacer(10);
|
||||
|
||||
static const wxString dirs[] =
|
||||
{
|
||||
"left", "right", "top", "bottom",
|
||||
};
|
||||
m_radioImagePos = new wxRadioBox(sizerLeftBox, wxID_ANY, "Image &position",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(dirs), dirs);
|
||||
sizerLeft->Add(m_radioImagePos, wxSizerFlags().Expand().Border());
|
||||
sizerLeft->AddSpacer(15);
|
||||
|
||||
// should be in sync with enums Toggle[HV]Align!
|
||||
static const wxString halign[] =
|
||||
{
|
||||
"left",
|
||||
"centre",
|
||||
"right",
|
||||
};
|
||||
|
||||
static const wxString valign[] =
|
||||
{
|
||||
"top",
|
||||
"centre",
|
||||
"bottom",
|
||||
};
|
||||
|
||||
m_radioHAlign = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Horz alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(halign), halign);
|
||||
m_radioVAlign = new wxRadioBox(sizerLeftBox, wxID_ANY, "&Vert alignment",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
WXSIZEOF(valign), valign);
|
||||
|
||||
sizerLeft->Add(m_radioHAlign, wxSizerFlags().Expand().Border());
|
||||
sizerLeft->Add(m_radioVAlign, wxSizerFlags().Expand().Border());
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
|
||||
sizerLeft->AddSpacer(5);
|
||||
|
||||
wxButton *btn = new wxButton(sizerLeftBox, TogglePage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, wxSizerFlags().CentreHorizontal().Border(wxALL, FromDIP(15)));
|
||||
|
||||
// middle pane
|
||||
wxStaticBoxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this, "&Operations");
|
||||
|
||||
wxSizer *sizerRow = CreateSizerWithTextAndButton(TogglePage_ChangeLabel,
|
||||
"Change label",
|
||||
wxID_ANY,
|
||||
&m_textLabel,
|
||||
sizerMiddle->GetStaticBox());
|
||||
m_textLabel->SetValue("&Toggle me!");
|
||||
|
||||
sizerMiddle->Add(sizerRow, wxSizerFlags().Expand().Border());
|
||||
|
||||
// right pane
|
||||
m_sizerToggle = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_sizerToggle->SetMinSize(FromDIP(150), 0);
|
||||
|
||||
// the 3 panes panes compose the window
|
||||
sizerTop->Add(sizerLeft,
|
||||
wxSizerFlags(0).Expand().DoubleBorder((wxALL & ~wxLEFT)));
|
||||
sizerTop->Add(sizerMiddle,
|
||||
wxSizerFlags(1).Expand().DoubleBorder(wxALL));
|
||||
sizerTop->Add(m_sizerToggle,
|
||||
wxSizerFlags(1).Expand().DoubleBorder((wxALL & ~wxRIGHT)));
|
||||
|
||||
// do create the main control
|
||||
Reset();
|
||||
CreateToggle();
|
||||
|
||||
SetSizer(sizerTop);
|
||||
}
|
||||
|
||||
void ToggleWidgetsPage::Reset()
|
||||
{
|
||||
|
||||
m_chkFit->SetValue(true);
|
||||
m_chkDisable->SetValue(false);
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
m_chkUseMarkup->SetValue(false);
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
m_chkBitmapOnly->SetValue(false);
|
||||
m_chkTextAndBitmap->SetValue(false);
|
||||
m_chkUseBitmapClass->SetValue(true);
|
||||
|
||||
m_chkUsePressed->SetValue(true);
|
||||
m_chkUseFocused->SetValue(true);
|
||||
m_chkUseCurrent->SetValue(true);
|
||||
m_chkUseDisabled->SetValue(true);
|
||||
|
||||
m_radioImagePos->SetSelection(ToggleImagePos_Left);
|
||||
m_radioHAlign->SetSelection(ToggleHAlign_Centre);
|
||||
m_radioVAlign->SetSelection(ToggleVAlign_Centre);
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
|
||||
if ( m_toggle )
|
||||
{
|
||||
m_toggle->SetValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ToggleWidgetsPage::CreateToggle()
|
||||
{
|
||||
wxString label;
|
||||
bool value = false;
|
||||
|
||||
if ( m_toggle )
|
||||
{
|
||||
label = m_toggle->GetLabel();
|
||||
value = m_toggle->GetValue();
|
||||
size_t count = m_sizerToggle->GetChildren().GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
m_sizerToggle->Remove(0);
|
||||
}
|
||||
|
||||
delete m_toggle;
|
||||
}
|
||||
|
||||
if ( label.empty() )
|
||||
{
|
||||
// creating for the first time or recreating a toggle button after bitmap
|
||||
// button
|
||||
label = m_textLabel->GetValue();
|
||||
}
|
||||
|
||||
int flags = GetAttrs().m_defaultFlags;
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
switch ( m_radioHAlign->GetSelection() )
|
||||
{
|
||||
case ToggleHAlign_Left:
|
||||
flags |= wxBU_LEFT;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case ToggleHAlign_Centre:
|
||||
break;
|
||||
|
||||
case ToggleHAlign_Right:
|
||||
flags |= wxBU_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( m_radioVAlign->GetSelection() )
|
||||
{
|
||||
case ToggleVAlign_Top:
|
||||
flags |= wxBU_TOP;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("unexpected radiobox selection");
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case ToggleVAlign_Centre:
|
||||
// centre vertical alignment is the default (no style)
|
||||
break;
|
||||
|
||||
case ToggleVAlign_Bottom:
|
||||
flags |= wxBU_BOTTOM;
|
||||
break;
|
||||
}
|
||||
|
||||
bool showsBitmap = false;
|
||||
if ( m_chkBitmapOnly->GetValue() )
|
||||
{
|
||||
showsBitmap = true;
|
||||
|
||||
wxToggleButton *btgl;
|
||||
if ( m_chkUseBitmapClass->GetValue() )
|
||||
{
|
||||
btgl = new wxBitmapToggleButton(this, TogglePage_Picker,
|
||||
CreateBitmap("normal", wxART_INFORMATION));
|
||||
}
|
||||
else
|
||||
{
|
||||
btgl = new wxToggleButton(this, TogglePage_Picker, "");
|
||||
btgl->SetBitmapLabel(CreateBitmap("normal", wxART_INFORMATION));
|
||||
}
|
||||
if ( m_chkUsePressed->GetValue() )
|
||||
btgl->SetBitmapPressed(CreateBitmap("pushed", wxART_HELP));
|
||||
if ( m_chkUseFocused->GetValue() )
|
||||
btgl->SetBitmapFocus(CreateBitmap("focused", wxART_ERROR));
|
||||
if ( m_chkUseCurrent->GetValue() )
|
||||
btgl->SetBitmapCurrent(CreateBitmap("hover", wxART_WARNING));
|
||||
if ( m_chkUseDisabled->GetValue() )
|
||||
btgl->SetBitmapDisabled(CreateBitmap("disabled", wxART_MISSING_IMAGE));
|
||||
m_toggle = btgl;
|
||||
}
|
||||
else // normal button
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
{
|
||||
m_toggle = new wxToggleButton(this, TogglePage_Picker, label,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
}
|
||||
|
||||
NotifyWidgetRecreation(m_toggle);
|
||||
|
||||
m_toggle->SetValue(value);
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
if ( !showsBitmap && m_chkTextAndBitmap->GetValue() )
|
||||
{
|
||||
showsBitmap = true;
|
||||
|
||||
static const wxDirection positions[] =
|
||||
{
|
||||
wxLEFT, wxRIGHT, wxTOP, wxBOTTOM
|
||||
};
|
||||
|
||||
m_toggle->SetBitmap(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_BUTTON),
|
||||
positions[m_radioImagePos->GetSelection()]);
|
||||
|
||||
if ( m_chkUsePressed->GetValue() )
|
||||
m_toggle->SetBitmapPressed(wxArtProvider::GetIcon(wxART_HELP, wxART_BUTTON));
|
||||
if ( m_chkUseFocused->GetValue() )
|
||||
m_toggle->SetBitmapFocus(wxArtProvider::GetIcon(wxART_ERROR, wxART_BUTTON));
|
||||
if ( m_chkUseCurrent->GetValue() )
|
||||
m_toggle->SetBitmapCurrent(wxArtProvider::GetIcon(wxART_WARNING, wxART_BUTTON));
|
||||
if ( m_chkUseDisabled->GetValue() )
|
||||
m_toggle->SetBitmapDisabled(wxArtProvider::GetIcon(wxART_MISSING_IMAGE, wxART_BUTTON));
|
||||
}
|
||||
|
||||
m_chkUseBitmapClass->Enable(showsBitmap);
|
||||
m_chkTextAndBitmap->Enable(!m_chkBitmapOnly->IsChecked());
|
||||
|
||||
m_chkUsePressed->Enable(showsBitmap);
|
||||
m_chkUseFocused->Enable(showsBitmap);
|
||||
m_chkUseCurrent->Enable(showsBitmap);
|
||||
m_chkUseDisabled->Enable(showsBitmap);
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
|
||||
m_toggle->Enable(!m_chkDisable->IsChecked());
|
||||
|
||||
AddButtonToSizer();
|
||||
|
||||
m_sizerToggle->Layout();
|
||||
}
|
||||
|
||||
void ToggleWidgetsPage::AddButtonToSizer()
|
||||
{
|
||||
if ( m_chkFit->GetValue() )
|
||||
{
|
||||
m_sizerToggle->AddStretchSpacer(1);
|
||||
m_sizerToggle->Add(m_toggle, wxSizerFlags(0).Centre().Border());
|
||||
m_sizerToggle->AddStretchSpacer(1);
|
||||
}
|
||||
else // take up the entire space
|
||||
{
|
||||
m_sizerToggle->Add(m_toggle, wxSizerFlags(1).Expand().Border());
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ToggleWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Reset();
|
||||
|
||||
CreateToggle();
|
||||
}
|
||||
|
||||
void ToggleWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateToggle();
|
||||
}
|
||||
|
||||
void ToggleWidgetsPage::OnButtonChangeLabel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
const wxString labelText = m_textLabel->GetValue();
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
if ( m_chkUseMarkup->GetValue() )
|
||||
m_toggle->SetLabelMarkup(labelText);
|
||||
else
|
||||
#endif // wxUSE_MARKUP
|
||||
m_toggle->SetLabel(labelText);
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
if ( m_chkBitmapOnly->IsChecked() )
|
||||
CreateToggle();
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
}
|
||||
|
||||
void ToggleWidgetsPage::OnToggled(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage("Button toggled, currently %s (event) or %s (control)",
|
||||
event.IsChecked() ? "on" : "off",
|
||||
m_toggle->GetValue() ? "on" : "off");
|
||||
}
|
||||
|
||||
#ifdef wxHAS_BITMAPTOGGLEBUTTON
|
||||
// ----------------------------------------------------------------------------
|
||||
// bitmap toggle button stuff
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBitmap ToggleWidgetsPage::CreateBitmap(const wxString& label, const wxArtID& type)
|
||||
{
|
||||
wxBitmap bmp(FromDIP(wxSize(180, 70))); // shouldn't hardcode but it's simpler like this
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(bmp);
|
||||
dc.SetFont(GetFont());
|
||||
dc.SetBackground(*wxCYAN_BRUSH);
|
||||
dc.Clear();
|
||||
dc.SetTextForeground(*wxBLACK);
|
||||
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + "\n"
|
||||
"(" + label + " state)",
|
||||
wxArtProvider::GetBitmap(type),
|
||||
wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20),
|
||||
wxALIGN_CENTRE);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||
|
||||
#endif // wxUSE_TOGGLEBTN
|
||||
86
libs/wxWidgets-3.3.1/samples/widgets/widgets.bkl
Normal file
86
libs/wxWidgets-3.3.1/samples/widgets/widgets.bkl
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" ?>
|
||||
<makefile>
|
||||
|
||||
<include file="../../build/bakefiles/common_samples.bkl"/>
|
||||
|
||||
<!--
|
||||
The source file using native controls uses Cocoa under OS X, so it must
|
||||
be compiled as Objective C++ which means it must have .mm extension.
|
||||
But this would make it uncompilable under the other platforms and we
|
||||
don't want to have two files with identical contents. Hence this hack:
|
||||
we have native.mm which just includes native.cpp under OS X, while
|
||||
elsewhere we just compile native.cpp directly.
|
||||
-->
|
||||
<set var="NATIVE_OBJCPP_SRC">
|
||||
<if cond="OUT_OF_TREE_MAKEFILES=='1'">
|
||||
<!--
|
||||
We can't determine if we're using Cocoa or not at generation
|
||||
time, so deal with it in the makefile fragment below.
|
||||
-->
|
||||
</if>
|
||||
<if cond="TOOLKIT=='OSX_COCOA' and WXUNIV=='0'">
|
||||
native_wrapper.mm
|
||||
</if>
|
||||
</set>
|
||||
|
||||
<fragment format="gnu">
|
||||
widgets_native_wrapper.o: ./native_wrapper.mm ./native.cpp
|
||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(OBJCXXFLAGS) ./native_wrapper.mm
|
||||
|
||||
ifeq ($(WX_PORT),osx_cocoa)
|
||||
WIDGETS_OBJECTS += widgets_native_wrapper.o
|
||||
|
||||
widgets: widgets_native_wrapper.o
|
||||
endif
|
||||
ifeq ($(WX_PORT),gtk2)
|
||||
widgets_native.o: CXXFLAGS=$(shell pkg-config --cflags gtk+-2.0)
|
||||
widgets: LDFLAGS=$(shell pkg-config --libs gtk+-2.0)
|
||||
endif
|
||||
ifeq ($(WX_PORT),gtk3)
|
||||
widgets_native.o: CXXFLAGS=$(shell pkg-config --cflags gtk+-3.0)
|
||||
widgets: LDFLAGS=$(shell pkg-config --libs gtk+-3.0)
|
||||
endif
|
||||
</fragment>
|
||||
|
||||
<exe id="widgets" template="wx_sample" template_append="wx_append">
|
||||
<sources>
|
||||
activityindicator.cpp
|
||||
bmpcombobox.cpp
|
||||
button.cpp
|
||||
checkbox.cpp
|
||||
choice.cpp
|
||||
clrpicker.cpp
|
||||
combobox.cpp
|
||||
datepick.cpp
|
||||
dirctrl.cpp
|
||||
dirpicker.cpp
|
||||
editlbox.cpp
|
||||
filectrl.cpp
|
||||
filepicker.cpp
|
||||
fontpicker.cpp
|
||||
gauge.cpp
|
||||
headerctrl.cpp
|
||||
hyperlnk.cpp
|
||||
itemcontainer.cpp
|
||||
listbox.cpp
|
||||
$(NATIVE_OBJCPP_SRC)
|
||||
native.cpp
|
||||
notebook.cpp
|
||||
odcombobox.cpp
|
||||
radiobox.cpp
|
||||
searchctrl.cpp
|
||||
slider.cpp
|
||||
spinbtn.cpp
|
||||
static.cpp
|
||||
statbmp.cpp
|
||||
textctrl.cpp
|
||||
timepick.cpp
|
||||
toggle.cpp
|
||||
widgets.cpp
|
||||
</sources>
|
||||
<headers>widgets.h itemcontainer.h</headers>
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
</exe>
|
||||
|
||||
</makefile>
|
||||
1540
libs/wxWidgets-3.3.1/samples/widgets/widgets.cpp
Normal file
1540
libs/wxWidgets-3.3.1/samples/widgets/widgets.cpp
Normal file
File diff suppressed because it is too large
Load Diff
257
libs/wxWidgets-3.3.1/samples/widgets/widgets.h
Normal file
257
libs/wxWidgets-3.3.1/samples/widgets/widgets.h
Normal file
@@ -0,0 +1,257 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Program: wxWidgets Widgets Sample
|
||||
// Name: widgets.h
|
||||
// Purpose: Common stuff for all widgets project files
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 27.03.01
|
||||
// Copyright: (c) 2001 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SAMPLE_WIDGETS_H_
|
||||
#define _WX_SAMPLE_WIDGETS_H_
|
||||
|
||||
#if wxUSE_TREEBOOK
|
||||
#include "wx/treebook.h"
|
||||
#define USE_TREEBOOK 1
|
||||
#define WidgetsBookCtrl wxTreebook
|
||||
#define WidgetsBookCtrlEvent wxTreebookEvent
|
||||
#define EVT_WIDGETS_PAGE_CHANGING(id,func) EVT_TREEBOOK_PAGE_CHANGING(id,func)
|
||||
#define wxEVT_COMMAND_WIDGETS_PAGE_CHANGED wxEVT_TREEBOOK_PAGE_CHANGED
|
||||
#define wxWidgetsbookEventHandler(func) wxTreebookEventHandler(func)
|
||||
#else
|
||||
#include "wx/bookctrl.h"
|
||||
#define USE_TREEBOOK 0
|
||||
#define WidgetsBookCtrl wxBookCtrl
|
||||
#define WidgetsBookCtrlEvent wxBookCtrlEvent
|
||||
#define EVT_WIDGETS_PAGE_CHANGING(id,func) EVT_BOOKCTRL_PAGE_CHANGING(id,func)
|
||||
#define wxEVT_COMMAND_WIDGETS_PAGE_CHANGED wxEVT_BOOKCTRL_PAGE_CHANGED
|
||||
#define wxWidgetsbookEventHandler(func) wxBookCtrlEventHandler(func)
|
||||
#endif
|
||||
|
||||
#if wxUSE_LOG
|
||||
#define USE_LOG 1
|
||||
#else
|
||||
#define USE_LOG 0
|
||||
#endif
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxCheckBox;
|
||||
class WXDLLIMPEXP_FWD_CORE wxSizer;
|
||||
class WXDLLIMPEXP_FWD_CORE wxImageList;
|
||||
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
|
||||
class WXDLLIMPEXP_FWD_CORE wxTextEntryBase;
|
||||
class WXDLLIMPEXP_FWD_CORE WidgetsBookCtrl;
|
||||
|
||||
class WidgetsPageInfo;
|
||||
|
||||
#include "wx/scrolwin.h"
|
||||
#include "wx/vector.h"
|
||||
|
||||
// INTRODUCING NEW PAGES DON'T FORGET TO ADD ENTRIES TO 'WidgetsCategories'
|
||||
enum
|
||||
{
|
||||
// In wxUniversal-based builds 'native' means 'made with wxUniv port
|
||||
// renderer'
|
||||
NATIVE_PAGE = 0,
|
||||
UNIVERSAL_PAGE = NATIVE_PAGE,
|
||||
GENERIC_PAGE,
|
||||
PICKER_PAGE,
|
||||
COMBO_PAGE,
|
||||
WITH_ITEMS_PAGE,
|
||||
EDITABLE_PAGE,
|
||||
BOOK_PAGE,
|
||||
ALL_PAGE,
|
||||
MAX_PAGES
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NATIVE_CTRLS = 1 << NATIVE_PAGE,
|
||||
UNIVERSAL_CTRLS = NATIVE_CTRLS,
|
||||
GENERIC_CTRLS = 1 << GENERIC_PAGE,
|
||||
PICKER_CTRLS = 1 << PICKER_PAGE,
|
||||
COMBO_CTRLS = 1 << COMBO_PAGE,
|
||||
WITH_ITEMS_CTRLS = 1 << WITH_ITEMS_PAGE,
|
||||
EDITABLE_CTRLS = 1 << EDITABLE_PAGE,
|
||||
BOOK_CTRLS = 1 << BOOK_PAGE,
|
||||
ALL_CTRLS = 1 << ALL_PAGE
|
||||
};
|
||||
|
||||
typedef wxVector<wxWindow *> Widgets;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WidgetsPage: a book page demonstrating some widget
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// struct to store common widget attributes
|
||||
struct WidgetAttributes
|
||||
{
|
||||
WidgetAttributes()
|
||||
{
|
||||
#if wxUSE_TOOLTIPS
|
||||
m_tooltip = "This is a tooltip";
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
m_enabled = true;
|
||||
m_show = true;
|
||||
m_dir = wxLayout_Default;
|
||||
m_variant = wxWINDOW_VARIANT_NORMAL;
|
||||
m_cursor = wxNullCursor;
|
||||
m_defaultFlags = wxBORDER_DEFAULT;
|
||||
}
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
wxString m_tooltip;
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
#if wxUSE_FONTDLG
|
||||
wxFont m_font;
|
||||
#endif // wxUSE_FONTDLG
|
||||
wxColour m_colFg;
|
||||
wxColour m_colBg;
|
||||
wxColour m_colPageBg;
|
||||
bool m_enabled;
|
||||
bool m_show;
|
||||
wxLayoutDirection m_dir;
|
||||
wxWindowVariant m_variant;
|
||||
wxCursor m_cursor;
|
||||
// the default flags, currently only contains border flags
|
||||
long m_defaultFlags;
|
||||
};
|
||||
|
||||
class WidgetsPage : public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
WidgetsPage(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist,
|
||||
const char *const icon[]);
|
||||
|
||||
// return the control shown by this page
|
||||
virtual wxWindow *GetWidget() const = 0;
|
||||
|
||||
// return the control shown by this page, if it supports text entry interface
|
||||
virtual wxTextEntryBase *GetTextEntry() const { return nullptr; }
|
||||
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() = 0;
|
||||
|
||||
// some pages show additional controls, in this case override this one to
|
||||
// return all of them (including the one returned by GetWidget())
|
||||
virtual Widgets GetWidgets() const
|
||||
{
|
||||
Widgets widgets;
|
||||
widgets.push_back(GetWidget());
|
||||
return widgets;
|
||||
}
|
||||
|
||||
// recreate the control shown by this page
|
||||
//
|
||||
// this is currently used only to take into account the border flags
|
||||
virtual void RecreateWidget() = 0;
|
||||
|
||||
// notify the main window about the widget recreation if it didn't happen
|
||||
// due to a call to RecreateWidget()
|
||||
void NotifyWidgetRecreation(wxWindow* widget);
|
||||
|
||||
// enable notifications about the widget recreation disabled initially
|
||||
void EnableRecreationNotifications() { m_notifyRecreate = true; }
|
||||
|
||||
// apply current attributes to the widget(s)
|
||||
void SetUpWidget();
|
||||
|
||||
// the default attributes for the widget
|
||||
static WidgetAttributes& GetAttrs();
|
||||
|
||||
// return true if we're showing logs in the log window (always the case
|
||||
// except during startup and shutdown)
|
||||
static bool IsUsingLogWindow();
|
||||
|
||||
static wxBitmapBundle CreateBitmapBundle(const char* const icon[]);
|
||||
|
||||
protected:
|
||||
// several helper functions for page creation
|
||||
|
||||
// create a horz sizer containing the given control and the text ctrl
|
||||
// (pointer to which will be saved in the provided variable if not null)
|
||||
// with the specified id
|
||||
wxSizer *CreateSizerWithText(wxControl *control,
|
||||
wxWindowID id = wxID_ANY,
|
||||
wxTextCtrl **ppText = nullptr);
|
||||
|
||||
// create a sizer containing a label and a text ctrl
|
||||
wxSizer *CreateSizerWithTextAndLabel(const wxString& label,
|
||||
wxWindowID id = wxID_ANY,
|
||||
wxTextCtrl **ppText = nullptr,
|
||||
wxWindow* statBoxParent = nullptr);
|
||||
|
||||
// create a sizer containing a button and a text ctrl
|
||||
wxSizer *CreateSizerWithTextAndButton(wxWindowID idBtn,
|
||||
const wxString& labelBtn,
|
||||
wxWindowID id = wxID_ANY,
|
||||
wxTextCtrl **ppText = nullptr,
|
||||
wxWindow* statBoxParent = nullptr);
|
||||
|
||||
// create a checkbox and add it to the sizer
|
||||
wxCheckBox *CreateCheckBoxAndAddToSizer(wxSizer *sizer,
|
||||
const wxString& label,
|
||||
wxWindowID id = wxID_ANY,
|
||||
wxWindow* statBoxParent = nullptr);
|
||||
|
||||
public:
|
||||
// the head of the linked list containinginfo about all pages
|
||||
static WidgetsPageInfo *ms_widgetPages;
|
||||
|
||||
private:
|
||||
bool m_notifyRecreate = false;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// dynamic WidgetsPage creation helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WidgetsPageInfo
|
||||
{
|
||||
public:
|
||||
typedef WidgetsPage *(*Constructor)(WidgetsBookCtrl *book,
|
||||
wxVector<wxBitmapBundle>& imaglist);
|
||||
|
||||
// our ctor
|
||||
WidgetsPageInfo(Constructor ctor, const wxString& label, int categories);
|
||||
|
||||
// accessors
|
||||
const wxString& GetLabel() const { return m_label; }
|
||||
int GetCategories() const { return m_categories; }
|
||||
Constructor GetCtor() const { return m_ctor; }
|
||||
WidgetsPageInfo *GetNext() const { return m_next; }
|
||||
|
||||
void SetNext(WidgetsPageInfo *next) { m_next = next; }
|
||||
|
||||
private:
|
||||
// the label of the page
|
||||
wxString m_label;
|
||||
|
||||
// the list (flags) for sharing page between categories
|
||||
int m_categories;
|
||||
|
||||
// the function to create this page
|
||||
Constructor m_ctor;
|
||||
|
||||
// next node in the linked list or nullptr
|
||||
WidgetsPageInfo *m_next;
|
||||
};
|
||||
|
||||
// to declare a page, this macro must be used in the class declaration
|
||||
#define DECLARE_WIDGETS_PAGE(classname) \
|
||||
private: \
|
||||
static WidgetsPageInfo ms_info##classname; \
|
||||
public: \
|
||||
const WidgetsPageInfo *GetPageInfo() const \
|
||||
{ return &ms_info##classname; }
|
||||
|
||||
// and this one must be inserted somewhere in the source file
|
||||
#define IMPLEMENT_WIDGETS_PAGE(classname, label, categories) \
|
||||
WidgetsPage *wxCtorFor##classname(WidgetsBookCtrl *book, \
|
||||
wxVector<wxBitmapBundle>& imaglist) \
|
||||
{ return new classname(book, imaglist); } \
|
||||
WidgetsPageInfo classname:: \
|
||||
ms_info##classname(wxCtorFor##classname, label, ALL_CTRLS | categories)
|
||||
|
||||
#endif // _WX_SAMPLE_WIDGETS_H_
|
||||
481
libs/wxWidgets-3.3.1/samples/widgets/widgets.vcxproj
Normal file
481
libs/wxWidgets-3.3.1/samples/widgets/widgets.vcxproj
Normal file
@@ -0,0 +1,481 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Debug|Win32">
|
||||
<Configuration>DLL Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Debug|x64">
|
||||
<Configuration>DLL Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Release|Win32">
|
||||
<Configuration>DLL Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Release|x64">
|
||||
<Configuration>DLL Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{EBEB60A6-51E1-453C-A147-E9E2284D073F}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\build\msw\wx_config.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="..\..\build\msw\wx_setup.props" />
|
||||
<Import Project="..\..\build\msw\wx_local.props" Condition="Exists('..\..\build\msw\wx_local.props')" />
|
||||
<Import Project="..\samples.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>14.0.24720.0</_ProjectFileVersion>
|
||||
<OutDir>$(wxIntRootDir)</OutDir>
|
||||
<IntDir>$(wxIntRootDir)$(ProjectName)\</IntDir>
|
||||
<GenerateManifest>true</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Bscmake>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="activityindicator.cpp" />
|
||||
<ClCompile Include="bmpcombobox.cpp" />
|
||||
<ClCompile Include="button.cpp" />
|
||||
<ClCompile Include="checkbox.cpp" />
|
||||
<ClCompile Include="choice.cpp" />
|
||||
<ClCompile Include="clrpicker.cpp" />
|
||||
<ClCompile Include="combobox.cpp" />
|
||||
<ClCompile Include="datepick.cpp" />
|
||||
<ClCompile Include="dirctrl.cpp" />
|
||||
<ClCompile Include="dirpicker.cpp" />
|
||||
<ClCompile Include="editlbox.cpp" />
|
||||
<ClCompile Include="filectrl.cpp" />
|
||||
<ClCompile Include="filepicker.cpp" />
|
||||
<ClCompile Include="fontpicker.cpp" />
|
||||
<ClCompile Include="gauge.cpp" />
|
||||
<ClCompile Include="headerctrl.cpp" />
|
||||
<ClCompile Include="hyperlnk.cpp" />
|
||||
<ClCompile Include="itemcontainer.cpp" />
|
||||
<ClCompile Include="listbox.cpp" />
|
||||
<ClCompile Include="native.cpp" />
|
||||
<ClCompile Include="notebook.cpp" />
|
||||
<ClCompile Include="odcombobox.cpp" />
|
||||
<ClCompile Include="radiobox.cpp" />
|
||||
<ClCompile Include="searchctrl.cpp" />
|
||||
<ClCompile Include="slider.cpp" />
|
||||
<ClCompile Include="spinbtn.cpp" />
|
||||
<ClCompile Include="statbmp.cpp" />
|
||||
<ClCompile Include="static.cpp" />
|
||||
<ClCompile Include="textctrl.cpp" />
|
||||
<ClCompile Include="timepick.cpp" />
|
||||
<ClCompile Include="toggle.cpp" />
|
||||
<ClCompile Include="widgets.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\sample.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
116
libs/wxWidgets-3.3.1/samples/widgets/widgets.vcxproj.filters
Normal file
116
libs/wxWidgets-3.3.1/samples/widgets/widgets.vcxproj.filters
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="widgets.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="activityindicator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bmpcombobox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="button.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="checkbox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="choice.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="clrpicker.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="combobox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="datepick.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dirctrl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dirpicker.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="editlbox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="filectrl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="filepicker.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="fontpicker.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="gauge.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="headerctrl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="hyperlnk.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="itemcontainer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="listbox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="native.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="notebook.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="odcombobox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="radiobox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="searchctrl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="slider.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="spinbtn.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="statbmp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="static.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textctrl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="timepick.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="toggle.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\sample.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user