initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
211
libs/wxWidgets-3.3.1/samples/xti/Makefile.in
Normal file
211
libs/wxWidgets-3.3.1/samples/xti/Makefile.in
Normal file
@@ -0,0 +1,211 @@
|
||||
# =========================================================================
|
||||
# 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@
|
||||
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
|
||||
XTI_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)
|
||||
XTI_OBJECTS = \
|
||||
$(__xti___win32rc) \
|
||||
xti_xti.o \
|
||||
xti_classlist.o \
|
||||
xti_codereadercallback.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___xti___os2_emxbindcmd = $(NM) xti$(EXEEXT) | if grep -q \
|
||||
pmwin.763 ; then emxbind -ep xti$(EXEEXT) ; fi
|
||||
@COND_PLATFORM_OS2_1@__xti___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___xti___os2_emxbindcmd)
|
||||
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
|
||||
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
|
||||
@COND_PLATFORM_WIN32_1@__xti___win32rc = xti_sample_rc.o
|
||||
@COND_PLATFORM_MACOSX_1@__xti_app_Contents_PkgInfo___depname \
|
||||
@COND_PLATFORM_MACOSX_1@ = xti.app/Contents/PkgInfo
|
||||
@COND_PLATFORM_MACOSX_1@__xti_bundle___depname = xti_bundle
|
||||
@COND_TOOLKIT_MAC@____xti_BUNDLE_TGT_REF_DEP = \
|
||||
@COND_TOOLKIT_MAC@ $(__xti_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_OSX_CARBON@____xti_BUNDLE_TGT_REF_DEP \
|
||||
@COND_TOOLKIT_OSX_CARBON@ = $(__xti_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_OSX_COCOA@____xti_BUNDLE_TGT_REF_DEP \
|
||||
@COND_TOOLKIT_OSX_COCOA@ = $(__xti_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_OSX_IPHONE@____xti_BUNDLE_TGT_REF_DEP \
|
||||
@COND_TOOLKIT_OSX_IPHONE@ = $(__xti_app_Contents_PkgInfo___depname)
|
||||
@COND_TOOLKIT_COCOA@____xti_BUNDLE_TGT_REF_DEP = \
|
||||
@COND_TOOLKIT_COCOA@ $(__xti_app_Contents_PkgInfo___depname)
|
||||
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_XML_p = \
|
||||
-lwx_base$(WXBASEPORT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_XML_p = $(COND_MONOLITHIC_0___WXLIB_XML_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: xti$(EXEEXT) $(__xti_bundle___depname)
|
||||
|
||||
install:
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip: install
|
||||
|
||||
clean:
|
||||
rm -rf ./.deps ./.pch
|
||||
rm -f ./*.o
|
||||
rm -f xti$(EXEEXT)
|
||||
rm -rf xti.app
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
|
||||
|
||||
xti$(EXEEXT): $(XTI_OBJECTS) $(__xti___win32rc)
|
||||
$(CXX) -o $@ $(XTI_OBJECTS) -L$(LIBDIRNAME) $(DYLIB_RPATH_FLAG) $(LDFLAGS_GUI) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__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)
|
||||
$(__xti___os2_emxbindcmd)
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@xti.app/Contents/PkgInfo: xti$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
|
||||
@COND_PLATFORM_MACOSX_1@ mkdir -p xti.app/Contents
|
||||
@COND_PLATFORM_MACOSX_1@ mkdir -p xti.app/Contents/MacOS
|
||||
@COND_PLATFORM_MACOSX_1@ mkdir -p xti.app/Contents/Resources
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ sed -e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.xti/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/xti/" \
|
||||
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/xti/" \
|
||||
@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}/xti 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 >xti.app/Contents/Info.plist
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >xti.app/Contents/PkgInfo
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ ln -f xti$(EXEEXT) xti.app/Contents/MacOS/xti
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@
|
||||
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns xti.app/Contents/Resources/wxmac.icns
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@xti_bundle: $(____xti_BUNDLE_TGT_REF_DEP)
|
||||
|
||||
xti_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
|
||||
|
||||
xti_xti.o: $(srcdir)/xti.cpp
|
||||
$(CXXC) -c -o $@ $(XTI_CXXFLAGS) $(srcdir)/xti.cpp
|
||||
|
||||
xti_classlist.o: $(srcdir)/classlist.cpp
|
||||
$(CXXC) -c -o $@ $(XTI_CXXFLAGS) $(srcdir)/classlist.cpp
|
||||
|
||||
xti_codereadercallback.o: $(srcdir)/codereadercallback.cpp
|
||||
$(CXXC) -c -o $@ $(XTI_CXXFLAGS) $(srcdir)/codereadercallback.cpp
|
||||
|
||||
|
||||
# Include dependency info, if present:
|
||||
@IF_GNU_MAKE@-include ./.deps/*.d
|
||||
|
||||
.PHONY: all install uninstall clean distclean xti_bundle
|
||||
555
libs/wxWidgets-3.3.1/samples/xti/classlist.cpp
Normal file
555
libs/wxWidgets-3.3.1/samples/xti/classlist.cpp
Normal file
@@ -0,0 +1,555 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: classlist.cpp
|
||||
// Purpose: ClassListDialog implementation
|
||||
// Author: Francesco Montorsi
|
||||
// Created: 03/06/2007 14:49:55
|
||||
// Copyright: (c) 2007 Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "classlist.h"
|
||||
|
||||
#if !wxUSE_EXTENDED_RTTI
|
||||
#error This sample requires XTI (eXtended RTTI) enabled
|
||||
#endif
|
||||
|
||||
// wxIMPLEMENT_DYNAMIC_CLASS(ClassListDialog, wxDialog); -- see the header
|
||||
wxBEGIN_EVENT_TABLE( ClassListDialog, wxDialog )
|
||||
EVT_LISTBOX( ID_LISTBOX, ClassListDialog::OnListboxSelected )
|
||||
EVT_TREE_SEL_CHANGED( ID_TREECTRL, ClassListDialog::OnTreectrlSelChanged )
|
||||
EVT_CHOICEBOOK_PAGE_CHANGED( ID_LISTMODE, ClassListDialog::OnChoiceBookPageChange )
|
||||
|
||||
EVT_CHECKBOX( ID_SHOW_ONLY_XTI, ClassListDialog::OnShowOnlyXTICheckbox )
|
||||
EVT_CHECKBOX( ID_SHOW_PROPERTIES_RECURSIVELY, ClassListDialog::OnShowRecursiveInfoCheckbox )
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// defined later
|
||||
wxString DumpClassInfo(const wxClassInfo*, bool recursive);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ClassListDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ClassListDialog::ClassListDialog()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ClassListDialog::ClassListDialog( wxWindow* parent, wxWindowID id,
|
||||
const wxString& caption, const wxPoint& pos,
|
||||
const wxSize& size, long style )
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, caption, pos, size, style);
|
||||
}
|
||||
|
||||
bool ClassListDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption,
|
||||
const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||
|
||||
CreateControls();
|
||||
if (GetSizer())
|
||||
{
|
||||
GetSizer()->SetSizeHints(this);
|
||||
}
|
||||
Centre();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ClassListDialog::~ClassListDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void ClassListDialog::Init()
|
||||
{
|
||||
m_pClassCountText = nullptr;
|
||||
m_pRawListBox = nullptr;
|
||||
m_pParentTreeCtrl = nullptr;
|
||||
m_pSizeListBox = nullptr;
|
||||
m_pTextCtrl = nullptr;
|
||||
}
|
||||
|
||||
void ClassListDialog::CreateControls()
|
||||
{
|
||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
||||
this->SetSizer(itemBoxSizer2);
|
||||
|
||||
wxStaticText* itemStaticText3 = new wxStaticText( this, wxID_STATIC, _("This is the list of wxWidgets classes registered in the XTI system.\nNote that not all wxWidgets classes are registered nor all registered classes are completely _described_ using XTI metadata."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
// filters
|
||||
wxBoxSizer* filters = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer2->Add(filters, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
filters->Add(new wxCheckBox(this, ID_SHOW_ONLY_XTI,
|
||||
"Show only classes with eXtended infos"));
|
||||
filters->AddSpacer(10);
|
||||
filters->Add(new wxCheckBox(this, ID_SHOW_PROPERTIES_RECURSIVELY,
|
||||
"Show properties of parent classes"));
|
||||
|
||||
// show how many have we filtered out
|
||||
m_pClassCountText = new wxStaticText( this, wxID_STATIC,
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pClassCountText->SetFont(wxFontInfo(8).Family(wxFONTFAMILY_SWISS).Bold());
|
||||
itemBoxSizer2->Add(m_pClassCountText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer2->Add(itemBoxSizer5, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook = new wxChoicebook( this, ID_LISTMODE, wxDefaultPosition, wxDefaultSize, wxCHB_DEFAULT );
|
||||
|
||||
// raw-list page
|
||||
wxPanel* itemPanel7 = new wxPanel( m_pChoiceBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemPanel7->SetSizer(itemBoxSizer8);
|
||||
|
||||
wxArrayString m_pRawListBoxStrings;
|
||||
m_pRawListBox = new wxListBox( itemPanel7, ID_LISTBOX, wxDefaultPosition, wxDefaultSize, m_pRawListBoxStrings, wxLB_SINGLE );
|
||||
itemBoxSizer8->Add(m_pRawListBox, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook->AddPage(itemPanel7, _("Raw list"));
|
||||
|
||||
// by-size page
|
||||
wxPanel* itemPanel13 = new wxPanel( m_pChoiceBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemPanel13->SetSizer(itemBoxSizer14);
|
||||
|
||||
wxArrayString m_pSizeListBoxStrings;
|
||||
m_pSizeListBox = new wxListBox( itemPanel13, ID_LISTBOX, wxDefaultPosition, wxDefaultSize, m_pSizeListBoxStrings, wxLB_SINGLE );
|
||||
itemBoxSizer14->Add(m_pSizeListBox, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook->AddPage(itemPanel13, _("Classes by size"));
|
||||
|
||||
// tree page
|
||||
wxPanel* itemPanel10 = new wxPanel( m_pChoiceBook, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
|
||||
itemPanel10->SetSizer(itemBoxSizer11);
|
||||
|
||||
m_pParentTreeCtrl = new wxTreeCtrl( itemPanel10, ID_TREECTRL, wxDefaultPosition, wxSize(100, 100), wxTR_HAS_BUTTONS |wxTR_SINGLE );
|
||||
itemBoxSizer11->Add(m_pParentTreeCtrl, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook->AddPage(itemPanel10, _("Classes by parent"));
|
||||
|
||||
|
||||
itemBoxSizer5->Add(m_pChoiceBook, 0, wxGROW|wxALL, 5);
|
||||
|
||||
m_pTextCtrl = new wxTextCtrl( this, ID_TEXTCTRL, "", wxDefaultPosition, wxSize(500, -1), wxTE_MULTILINE|wxTE_READONLY );
|
||||
itemBoxSizer5->Add(m_pTextCtrl, 3, wxGROW|wxALL, 5);
|
||||
|
||||
wxStdDialogButtonSizer* itemStdDialogButtonSizer17 = new wxStdDialogButtonSizer;
|
||||
|
||||
itemBoxSizer2->Add(itemStdDialogButtonSizer17, 0, wxGROW|wxALL, 5);
|
||||
wxButton* itemButton18 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemStdDialogButtonSizer17->AddButton(itemButton18);
|
||||
|
||||
wxButton* itemButton19 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemStdDialogButtonSizer17->AddButton(itemButton19);
|
||||
|
||||
itemStdDialogButtonSizer17->Realize();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
int ClassListDialog::AddClassesWithParent(const wxClassInfo *parent, const wxTreeItemId &id)
|
||||
{
|
||||
const wxClassInfo *ci = wxClassInfo::GetFirst();
|
||||
int count = 0;
|
||||
while (ci)
|
||||
{
|
||||
// is this class derived from the given parent?
|
||||
if (wxString(ci->GetBaseClassName1()) == parent->GetClassName() ||
|
||||
wxString(ci->GetBaseClassName2()) == parent->GetClassName())
|
||||
{
|
||||
wxTreeItemId child = m_pParentTreeCtrl->AppendItem(id, ci->GetClassName());
|
||||
|
||||
// update the name of this child with the count of the children classes
|
||||
int ret = AddClassesWithParent(ci, child);
|
||||
m_pParentTreeCtrl->SetItemText(child,
|
||||
m_pParentTreeCtrl->GetItemText(child) +
|
||||
wxString::Format(" [%d]", ret));
|
||||
count += ret+1;
|
||||
}
|
||||
|
||||
ci = ci->GetNext();
|
||||
}
|
||||
|
||||
// reorder all the children we've just added
|
||||
m_pParentTreeCtrl->SortChildren(id);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int GetSizeOfClass(const wxString &cn)
|
||||
{
|
||||
const wxClassInfo *ci = wxClassInfo::FindClass(cn);
|
||||
if (ci)
|
||||
return ci->GetSize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CompareClassSizes(const wxString &class1, const wxString &class2)
|
||||
{
|
||||
return GetSizeOfClass(class1) - GetSizeOfClass(class2);
|
||||
}
|
||||
|
||||
void ClassListDialog::InitControls()
|
||||
{
|
||||
// create a wxArrayString with the names of all classes:
|
||||
const wxClassInfo *ci = wxClassInfo::GetFirst();
|
||||
wxArrayString arr;
|
||||
while (ci)
|
||||
{
|
||||
arr.Add(ci->GetClassName());
|
||||
ci = ci->GetNext();
|
||||
}
|
||||
|
||||
arr.Sort(); // sort alphabetically
|
||||
|
||||
// now add it to the raw-mode listbox
|
||||
for (unsigned int i=0; i<arr.GetCount(); i++)
|
||||
if (!IsToDiscard(arr[i]))
|
||||
m_pRawListBox->Append(arr[i]);
|
||||
m_nCount = m_pRawListBox->GetCount();
|
||||
|
||||
// sort again using size as sortkey
|
||||
arr.Sort((wxArrayString::CompareFunction)CompareClassSizes);
|
||||
|
||||
// now add it to the size-mode listbox
|
||||
for (unsigned int i=0; i<arr.GetCount(); i++)
|
||||
if (!IsToDiscard(arr[i]))
|
||||
m_pSizeListBox->Append(arr[i]);
|
||||
|
||||
// add root item to parent-mode treectrl
|
||||
wxTreeItemId id = m_pParentTreeCtrl->AddRoot("wxObject");
|
||||
|
||||
// recursively add all leaves to the treectrl
|
||||
int count = AddClassesWithParent(CLASSINFO(wxObject), id);
|
||||
m_pParentTreeCtrl->SetItemText(id, m_pParentTreeCtrl->GetItemText(id) +
|
||||
wxString::Format(" [%d]", count));
|
||||
|
||||
// initially expand the root item
|
||||
m_pParentTreeCtrl->Expand(id);
|
||||
|
||||
m_nTotalCount = arr.GetCount();
|
||||
UpdateFilterText();
|
||||
|
||||
// don't leave blank the XTI info display
|
||||
m_pChoiceBook->ChangeSelection(0);
|
||||
m_pRawListBox->Select(0);
|
||||
UpdateClassInfo(m_pRawListBox->GetStringSelection());
|
||||
}
|
||||
|
||||
bool ClassListDialog::IsToDiscard(const wxString &classname) const
|
||||
{
|
||||
wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_ONLY_XTI));
|
||||
if (!cb || !cb->IsChecked())
|
||||
return false;
|
||||
|
||||
// check if this class has XTI infos
|
||||
wxClassInfo *info = wxClassInfo::FindClass(classname);
|
||||
if (!info)
|
||||
return false;
|
||||
if (info->GetFirstProperty() != nullptr || info->GetFirstHandler() != nullptr)
|
||||
return false; // has XTI info
|
||||
return true; // no XTI info
|
||||
}
|
||||
|
||||
void ClassListDialog::UpdateFilterText()
|
||||
{
|
||||
// tell the user how many registered classes are present and
|
||||
// how many are we showing
|
||||
m_pClassCountText->SetLabel(
|
||||
wxString::Format(
|
||||
"Showing %d classes on a total of %d registered classes in wxXTI.",
|
||||
m_nCount, m_nTotalCount));
|
||||
}
|
||||
|
||||
void ClassListDialog::UpdateClassInfo(const wxString &itemName)
|
||||
{
|
||||
wxString classname = itemName.BeforeFirst(' ');
|
||||
wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY));
|
||||
|
||||
m_pTextCtrl->SetValue(
|
||||
DumpClassInfo(wxClassInfo::FindClass(classname), cb->IsChecked()));
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ClassListDialog - event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ClassListDialog::OnShowOnlyXTICheckbox( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
m_pRawListBox->Clear();
|
||||
m_pParentTreeCtrl->DeleteAllItems();
|
||||
m_pSizeListBox->Clear();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
void ClassListDialog::OnShowRecursiveInfoCheckbox( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
m_pRawListBox->Clear();
|
||||
m_pParentTreeCtrl->DeleteAllItems();
|
||||
m_pSizeListBox->Clear();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
void ClassListDialog::OnListboxSelected( wxCommandEvent& event )
|
||||
{
|
||||
UpdateClassInfo(event.GetString());
|
||||
}
|
||||
|
||||
void ClassListDialog::OnTreectrlSelChanged( wxTreeEvent& event )
|
||||
{
|
||||
UpdateClassInfo(m_pParentTreeCtrl->GetItemText(event.GetItem()));
|
||||
}
|
||||
|
||||
void ClassListDialog::OnChoiceBookPageChange( wxChoicebookEvent& event )
|
||||
{
|
||||
switch (event.GetSelection())
|
||||
{
|
||||
case 0:
|
||||
if (m_pRawListBox->GetCount())
|
||||
{
|
||||
m_pRawListBox->Select(0);
|
||||
UpdateClassInfo(m_pRawListBox->GetStringSelection());
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (m_pSizeListBox->GetCount())
|
||||
{
|
||||
m_pSizeListBox->Select(0);
|
||||
UpdateClassInfo(m_pSizeListBox->GetStringSelection());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
wxTreeItemId root = m_pParentTreeCtrl->GetRootItem();
|
||||
if (root.IsOk())
|
||||
{
|
||||
m_pParentTreeCtrl->SelectItem(root);
|
||||
UpdateClassInfo(m_pParentTreeCtrl->GetItemText(root));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// dump functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxString DumpStr(const wxString &str)
|
||||
{
|
||||
if (str.empty())
|
||||
return "none";
|
||||
return str;
|
||||
}
|
||||
|
||||
wxString DumpTypeInfo(const wxTypeInfo *ti)
|
||||
{
|
||||
if (!ti)
|
||||
return "none";
|
||||
|
||||
return DumpStr(ti->GetTypeName());
|
||||
}
|
||||
|
||||
wxString DumpPropertyAccessor(const wxPropertyAccessor *acc, int indent)
|
||||
{
|
||||
wxString ind = "\n" + wxString(indent, ' ');
|
||||
wxString infostr;
|
||||
|
||||
if (!acc)
|
||||
return ind + "no property accessors";
|
||||
|
||||
if (acc->HasSetter())
|
||||
infostr << ind << "setter name: " << acc->GetSetterName();
|
||||
if (acc->HasCollectionGetter())
|
||||
infostr << ind << "collection getter name: " << acc->GetCollectionGetterName();
|
||||
if (acc->HasGetter())
|
||||
infostr << ind << "getter name: " << acc->GetGetterName();
|
||||
if (acc->HasAdder())
|
||||
infostr << ind << "adder name: " << acc->GetAdderName();
|
||||
|
||||
return infostr;
|
||||
}
|
||||
|
||||
wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
|
||||
{
|
||||
wxString ind = "\n" + wxString(indent, ' ');
|
||||
wxString infostr;
|
||||
|
||||
if (!prop)
|
||||
return ind + "none";
|
||||
|
||||
infostr << ind << "flags: ";
|
||||
if (prop->GetFlags() & wxPROP_DEPRECATED)
|
||||
infostr << "wxPROP_DEPRECATED,";
|
||||
if (prop->GetFlags() & wxPROP_OBJECT_GRAPH)
|
||||
infostr << "wxPROP_OBJECT_GRAPH,";
|
||||
if (prop->GetFlags() & wxPROP_ENUM_STORE_LONG)
|
||||
infostr << "wxPROP_ENUM_STORE_LONG,";
|
||||
if (prop->GetFlags() & wxPROP_DONT_STREAM)
|
||||
infostr << "wxPROP_DONT_STREAM,";
|
||||
|
||||
if (prop->GetFlags() == 0)
|
||||
infostr << "none";
|
||||
else
|
||||
infostr.RemoveLast(); // remove last comma
|
||||
|
||||
infostr << ind << "help string: " << DumpStr(prop->GetHelpString());
|
||||
infostr << ind << "group string: " << DumpStr(prop->GetGroupString());
|
||||
|
||||
infostr << ind << "collection element type: " << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
|
||||
infostr << ind << "type: " << DumpTypeInfo(prop->GetTypeInfo());
|
||||
|
||||
infostr << ind << "default value: " << DumpStr(wxAnyGetAsString(prop->GetDefaultValue()));
|
||||
infostr << DumpPropertyAccessor(prop->GetAccessor(), indent+1);
|
||||
|
||||
return infostr;
|
||||
}
|
||||
|
||||
wxString DumpHandlerInfo(const wxHandlerInfo *phdlr, int indent)
|
||||
{
|
||||
wxString ind = "\n" + wxString(indent, ' ');
|
||||
wxString infostr;
|
||||
|
||||
if (!phdlr)
|
||||
return ind + "none";
|
||||
|
||||
infostr << ind << "event class: " <<
|
||||
(phdlr->GetEventClassInfo() ? wxString(phdlr->GetEventClassInfo()->GetClassName()) : "none");
|
||||
|
||||
return infostr;
|
||||
}
|
||||
|
||||
int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
{
|
||||
const wxPropertyInfo *prop;
|
||||
int pcount;
|
||||
for (prop = info->GetFirstProperty(), pcount = 0;
|
||||
prop;
|
||||
prop = prop->GetNext(), pcount++)
|
||||
{
|
||||
infostr << "\n\n [" << pcount+1 << "] Property: " << prop->GetName();
|
||||
infostr << DumpPropertyInfo(prop, 4);
|
||||
}
|
||||
|
||||
if (pcount == 0)
|
||||
infostr << "\n None";
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
const wxClassInfo **parent = info->GetParents();
|
||||
wxString str;
|
||||
|
||||
for (int i=0; parent[i] != nullptr; i++)
|
||||
{
|
||||
int ppcount = DumpProperties(parent[i], str, recursive);
|
||||
if (ppcount)
|
||||
{
|
||||
pcount += ppcount;
|
||||
infostr << "\n\n " << parent[i]->GetClassName() << " PARENT'S PROPERTIES:";
|
||||
infostr << str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pcount;
|
||||
}
|
||||
|
||||
int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
{
|
||||
const wxHandlerInfo *h;
|
||||
int hcount;
|
||||
for (h = info->GetFirstHandler(), hcount = 0;
|
||||
h;
|
||||
h = h->GetNext(), hcount++)
|
||||
{
|
||||
infostr << "\n\n [" << hcount+1 << "] Handler: " << h->GetName();
|
||||
infostr << DumpHandlerInfo(h, 4);
|
||||
}
|
||||
|
||||
if (hcount == 0)
|
||||
infostr << "\n None";
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
const wxClassInfo **parent = info->GetParents();
|
||||
wxString str;
|
||||
|
||||
for (int i=0; parent[i] != nullptr; i++)
|
||||
{
|
||||
int hhcount = DumpHandlers(parent[i], str, recursive);
|
||||
if (hhcount)
|
||||
{
|
||||
hcount += hhcount;
|
||||
infostr << "\n\n " << parent[i]->GetClassName() << " PARENT'S HANDLERS:";
|
||||
infostr << str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hcount;
|
||||
}
|
||||
|
||||
wxString DumpClassInfo(const wxClassInfo *info, bool recursive)
|
||||
{
|
||||
wxString infostr;
|
||||
|
||||
if (!info)
|
||||
return wxEmptyString;
|
||||
|
||||
// basic stuff:
|
||||
|
||||
infostr << "\n BASIC RTTI INFO ABOUT " << info->GetClassName();
|
||||
infostr << "\n =================================================";
|
||||
infostr << "\n Base class #1: " << DumpStr(info->GetBaseClassName1());
|
||||
infostr << "\n Base class #2: " << DumpStr(info->GetBaseClassName2());
|
||||
infostr << "\n Include file: " << DumpStr(info->GetIncludeName());
|
||||
infostr << "\n Size: " << info->GetSize();
|
||||
infostr << "\n Dynamic: " << (info->IsDynamic() ? "true" : "false");
|
||||
|
||||
|
||||
// advanced stuff:
|
||||
|
||||
infostr << "\n\n\n ADVANCED RTTI INFO ABOUT " << info->GetClassName();
|
||||
infostr << "\n =================================================\n";
|
||||
infostr << "\n PROPERTIES";
|
||||
infostr << "\n -----------------------------------------";
|
||||
int pcount = DumpProperties(info, infostr, recursive);
|
||||
infostr << "\n\n HANDLERS";
|
||||
infostr << "\n -----------------------------------------";
|
||||
int hcount = DumpHandlers(info, infostr, recursive);
|
||||
|
||||
if (pcount+hcount == 0)
|
||||
infostr << "\n\n no advanced info\n";
|
||||
else
|
||||
{
|
||||
infostr << "\n\n Total count of properties: " << pcount;
|
||||
infostr << "\n Total count of handlers: " << hcount << "\n";
|
||||
}
|
||||
|
||||
return infostr;
|
||||
}
|
||||
106
libs/wxWidgets-3.3.1/samples/xti/classlist.h
Normal file
106
libs/wxWidgets-3.3.1/samples/xti/classlist.h
Normal file
@@ -0,0 +1,106 @@
|
||||
////////////////////////////////////////////////////
|
||||
// Name: classlist.h
|
||||
// Purpose: ClassListDialog definition
|
||||
// Author: Francesco Montorsi
|
||||
// Created: 03/06/2007 14:49:55
|
||||
// Copyright: (c) 2007 Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CLASSLIST_H_
|
||||
#define _CLASSLIST_H_
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// includes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/choicebk.h"
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IDs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define ID_LISTMODE 10006
|
||||
#define ID_LISTBOX 10003
|
||||
#define ID_PANEL 10007
|
||||
#define ID_TREECTRL 10008
|
||||
#define ID_TEXTCTRL 10004
|
||||
#define ID_SHOW_ONLY_XTI 10005
|
||||
#define ID_SHOW_PROPERTIES_RECURSIVELY 10002
|
||||
#define SYMBOL_CLASSLISTDIALOG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
|
||||
#define SYMBOL_CLASSLISTDIALOG_TITLE _("wxWidgets class list")
|
||||
#define SYMBOL_CLASSLISTDIALOG_IDNAME wxID_ANY
|
||||
#define SYMBOL_CLASSLISTDIALOG_SIZE wxSize(400, 300)
|
||||
#define SYMBOL_CLASSLISTDIALOG_POSITION wxDefaultPosition
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ClassListDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ClassListDialog: public wxDialog
|
||||
{
|
||||
// we explicitly don't want to use the following macro:
|
||||
// wxDECLARE_DYNAMIC_CLASS( ClassListDialog );
|
||||
// as otherwise the ClassListDialog class would appear in the list
|
||||
// shown by this dialog!
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
ClassListDialog();
|
||||
ClassListDialog( wxWindow* parent, wxWindowID id = SYMBOL_CLASSLISTDIALOG_IDNAME,
|
||||
const wxString& caption = SYMBOL_CLASSLISTDIALOG_TITLE,
|
||||
const wxPoint& pos = SYMBOL_CLASSLISTDIALOG_POSITION,
|
||||
const wxSize& size = SYMBOL_CLASSLISTDIALOG_SIZE,
|
||||
long style = SYMBOL_CLASSLISTDIALOG_STYLE );
|
||||
|
||||
// Creation
|
||||
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CLASSLISTDIALOG_IDNAME,
|
||||
const wxString& caption = SYMBOL_CLASSLISTDIALOG_TITLE,
|
||||
const wxPoint& pos = SYMBOL_CLASSLISTDIALOG_POSITION,
|
||||
const wxSize& size = SYMBOL_CLASSLISTDIALOG_SIZE,
|
||||
long style = SYMBOL_CLASSLISTDIALOG_STYLE );
|
||||
|
||||
// Destructor
|
||||
~ClassListDialog();
|
||||
|
||||
public: // misc
|
||||
|
||||
void Init();
|
||||
void CreateControls();
|
||||
void InitControls();
|
||||
|
||||
void UpdateClassInfo(const wxString &itemName);
|
||||
void UpdateFilterText();
|
||||
bool IsToDiscard(const wxString &classname) const;
|
||||
|
||||
int AddClassesWithParent(const wxClassInfo *parent, const wxTreeItemId &id);
|
||||
|
||||
public: // event handlers
|
||||
|
||||
void OnListboxSelected( wxCommandEvent& event );
|
||||
void OnTreectrlSelChanged( wxTreeEvent& event );
|
||||
void OnChoiceBookPageChange( wxChoicebookEvent& event );
|
||||
void OnShowOnlyXTICheckbox( wxCommandEvent& event );
|
||||
void OnShowRecursiveInfoCheckbox( wxCommandEvent& event );
|
||||
|
||||
// Should we show tooltips?
|
||||
static bool ShowToolTips();
|
||||
|
||||
protected:
|
||||
wxChoicebook* m_pChoiceBook;
|
||||
wxStaticText* m_pClassCountText;
|
||||
wxListBox* m_pRawListBox;
|
||||
wxTreeCtrl* m_pParentTreeCtrl;
|
||||
wxListBox* m_pSizeListBox;
|
||||
wxTextCtrl* m_pTextCtrl;
|
||||
|
||||
int m_nTotalCount; // number of classes in wxXTI system
|
||||
int m_nCount; // number of shown classes
|
||||
};
|
||||
|
||||
#endif
|
||||
// _CLASSLIST_H_
|
||||
323
libs/wxWidgets-3.3.1/samples/xti/codereadercallback.cpp
Normal file
323
libs/wxWidgets-3.3.1/samples/xti/codereadercallback.cpp
Normal file
@@ -0,0 +1,323 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/xtistrm.cpp
|
||||
// Purpose: streaming runtime metadata information
|
||||
// Author: Stefan Csomor
|
||||
// Created: 27/07/03
|
||||
// Copyright: (c) 2003 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#include "wx/xtistrm.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/event.h"
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "wx/tokenzr.h"
|
||||
#include "wx/txtstrm.h"
|
||||
#include "codereadercallback.h"
|
||||
|
||||
#if !wxUSE_EXTENDED_RTTI
|
||||
#error This sample requires XTI (eXtended RTTI) enabled
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxObjectCodeReaderCallback - depersisting to code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct wxObjectCodeReaderCallback::wxObjectCodeReaderCallbackInternal
|
||||
{
|
||||
map<int,wstring> m_objectNames;
|
||||
|
||||
void SetObjectName(int objectID, const wxString &name )
|
||||
{
|
||||
if ( m_objectNames.find(objectID) != m_objectNames.end() )
|
||||
{
|
||||
wxLogError( _("Passing an already registered object to SetObjectName") );
|
||||
return ;
|
||||
}
|
||||
m_objectNames[objectID] = (const wxChar *)name;
|
||||
}
|
||||
|
||||
wxString GetObjectName( int objectID )
|
||||
{
|
||||
if ( objectID == wxNullObjectID )
|
||||
return "NULL";
|
||||
|
||||
if ( m_objectNames.find(objectID) == m_objectNames.end() )
|
||||
{
|
||||
wxLogError( _("Passing an unknown object to GetObject") );
|
||||
return wxEmptyString;
|
||||
}
|
||||
return wxString( m_objectNames[objectID].c_str() );
|
||||
}
|
||||
};
|
||||
|
||||
wxObjectCodeReaderCallback::wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source)
|
||||
: m_headerincludes(headerincludes),m_source(source)
|
||||
{
|
||||
m_data = new wxObjectCodeReaderCallbackInternal;
|
||||
}
|
||||
|
||||
wxObjectCodeReaderCallback::~wxObjectCodeReaderCallback()
|
||||
{
|
||||
delete m_data;
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo,
|
||||
wxStringToAnyHashMap &WXUNUSED(metadata))
|
||||
{
|
||||
if ( classInfo->GetIncludeName() != wxEmptyString)
|
||||
{
|
||||
// add corresponding header if not already included
|
||||
wxString include;
|
||||
include.Printf("#include \"%s\"\n",classInfo->GetIncludeName());
|
||||
if ( m_headerincludes.Find(include) == wxNOT_FOUND)
|
||||
m_headerincludes += include;
|
||||
}
|
||||
|
||||
wxString objectName = wxString::Format( "LocalObject_%d", objectID );
|
||||
m_source += ( wxString::Format( "\t%s *%s = new %s;\n",
|
||||
classInfo->GetClassName(),
|
||||
objectName,
|
||||
classInfo->GetClassName()) );
|
||||
m_data->SetObjectName( objectID, objectName );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
|
||||
{
|
||||
m_source += ( wxString::Format( "\tdelete %s;\n",
|
||||
m_data->GetObjectName( objectID) ) );
|
||||
}
|
||||
|
||||
class WXDLLIMPEXP_BASE wxObjectConstructorWriter: public wxObjectWriterFunctor
|
||||
{
|
||||
public:
|
||||
wxObjectConstructorWriter(const wxClassTypeInfo* cti,
|
||||
wxObjectCodeReaderCallback* writer) :
|
||||
m_cti(cti),m_writer(writer)
|
||||
{}
|
||||
|
||||
virtual void operator()(const wxObject *vobj)
|
||||
{
|
||||
const wxClassInfo* ci = m_cti->GetClassInfo();
|
||||
|
||||
for ( int i = 0; i < ci->GetCreateParamCount(); ++i )
|
||||
{
|
||||
wxString name = ci->GetCreateParamName(i);
|
||||
const wxPropertyInfo* prop = ci->FindPropertyInfo(name);
|
||||
if ( i > 0 )
|
||||
m_constructor += ", ";
|
||||
wxAny value;
|
||||
prop->GetAccessor()->GetProperty(vobj, value);
|
||||
m_constructor+= m_writer->ValueAsCode(value);
|
||||
}
|
||||
}
|
||||
|
||||
const wxString& GetConstructorString() const { return m_constructor;}
|
||||
private:
|
||||
const wxClassTypeInfo* m_cti;
|
||||
wxObjectCodeReaderCallback* m_writer;
|
||||
wxString m_constructor;
|
||||
};
|
||||
|
||||
wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m )
|
||||
{
|
||||
wxString value;
|
||||
|
||||
const wxTypeInfo* type = param.GetTypeInfo();
|
||||
if ( type->GetKind() == wxT_CUSTOM )
|
||||
{
|
||||
const wxCustomTypeInfo* cti = wx_dynamic_cast(const wxCustomTypeInfo*, type);
|
||||
if ( cti )
|
||||
{
|
||||
value.Printf( "%s(%s)", cti->GetTypeName(),
|
||||
wxAnyGetAsString(param) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError ( "Internal error, illegal wxCustomTypeInfo" );
|
||||
}
|
||||
}
|
||||
else if ( type->GetKind() == wxT_STRING )
|
||||
{
|
||||
value.Printf( "\"%s\"", wxAnyGetAsString(param) );
|
||||
}
|
||||
else if ( type->GetKind() == wxT_OBJECT )
|
||||
{
|
||||
const wxClassTypeInfo* ctype = wx_dynamic_cast(const wxClassTypeInfo*,type);
|
||||
const wxClassInfo* ci = ctype->GetClassInfo();
|
||||
if( ci->NeedsDirectConstruction())
|
||||
{
|
||||
wxObjectConstructorWriter cw(ctype,this);
|
||||
|
||||
ci->CallOnAny(param,&cw);
|
||||
|
||||
value.Printf( "%s(%s)", ctype->GetClassInfo()->GetClassName(),
|
||||
cw.GetConstructorString() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value.Printf( "%s", wxAnyGetAsString(param) );
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::CreateObject(int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
int paramCount,
|
||||
wxAny *params,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **WXUNUSED(objectClassInfos),
|
||||
wxStringToAnyHashMap &WXUNUSED(metadata)
|
||||
)
|
||||
{
|
||||
int i;
|
||||
m_source += ( wxString::Format( "\t%s->Create(",
|
||||
m_data->GetObjectName(objectID) ) );
|
||||
for (i = 0; i < paramCount; i++)
|
||||
{
|
||||
if ( objectIDValues[i] != wxInvalidObjectID )
|
||||
{
|
||||
wxString str =
|
||||
wxString::Format( "%s",
|
||||
m_data->GetObjectName( objectIDValues[i] ) );
|
||||
m_source += ( str );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_source += (
|
||||
wxString::Format( "%s", ValueAsCode(params[i]) ) );
|
||||
}
|
||||
if (i < paramCount - 1)
|
||||
m_source += ( ", ");
|
||||
}
|
||||
m_source += ( ");\n" );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
int paramCount,
|
||||
wxAny *params,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **WXUNUSED(objectClassInfos),
|
||||
wxStringToAnyHashMap &WXUNUSED(metadata)
|
||||
)
|
||||
{
|
||||
wxString objectName = wxString::Format( "LocalObject_%d", objectID );
|
||||
m_source += ( wxString::Format( "\t%s *%s = new %s(",
|
||||
classInfo->GetClassName(),
|
||||
objectName,
|
||||
classInfo->GetClassName()) );
|
||||
m_data->SetObjectName( objectID, objectName );
|
||||
|
||||
int i;
|
||||
for (i = 0; i < paramCount; i++)
|
||||
{
|
||||
if ( objectIDValues[i] != wxInvalidObjectID )
|
||||
m_source += ( wxString::Format( "%s",
|
||||
m_data->GetObjectName( objectIDValues[i] ) ) );
|
||||
else
|
||||
{
|
||||
m_source += (
|
||||
wxString::Format( "%s", ValueAsCode(params[i]) ) );
|
||||
}
|
||||
if (i < paramCount - 1)
|
||||
m_source += ( ", " );
|
||||
}
|
||||
m_source += ( ");\n" );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::SetProperty(int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxAny &value)
|
||||
{
|
||||
m_source += ( wxString::Format( "\t%s->%s(%s);\n",
|
||||
m_data->GetObjectName(objectID),
|
||||
propertyInfo->GetAccessor()->GetSetterName(),
|
||||
ValueAsCode(value)) );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
int valueObjectId)
|
||||
{
|
||||
if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT )
|
||||
m_source += ( wxString::Format( "\t%s->%s(*%s);\n",
|
||||
m_data->GetObjectName(objectID),
|
||||
propertyInfo->GetAccessor()->GetSetterName(),
|
||||
m_data->GetObjectName( valueObjectId) ) );
|
||||
else
|
||||
m_source += ( wxString::Format( "\t%s->%s(%s);\n",
|
||||
m_data->GetObjectName(objectID),
|
||||
propertyInfo->GetAccessor()->GetSetterName(),
|
||||
m_data->GetObjectName( valueObjectId) ) );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxAny &value)
|
||||
{
|
||||
m_source += ( wxString::Format( "\t%s->%s(%s);\n",
|
||||
m_data->GetObjectName(objectID),
|
||||
propertyInfo->GetAccessor()->GetAdderName(),
|
||||
ValueAsCode(value)) );
|
||||
}
|
||||
|
||||
// sets the corresponding property (value is an object)
|
||||
void wxObjectCodeReaderCallback::
|
||||
AddToPropertyCollectionAsObject(int WXUNUSED(objectID),
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* WXUNUSED(propertyInfo),
|
||||
int WXUNUSED(valueObjectId))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::SetConnect(int eventSourceObjectID,
|
||||
const wxClassInfo *WXUNUSED(eventSourceClassInfo),
|
||||
const wxPropertyInfo *delegateInfo,
|
||||
const wxClassInfo *eventSinkClassInfo,
|
||||
const wxHandlerInfo* handlerInfo,
|
||||
int eventSinkObjectID )
|
||||
{
|
||||
wxString ehsource = m_data->GetObjectName( eventSourceObjectID );
|
||||
wxString ehsink = m_data->GetObjectName(eventSinkObjectID);
|
||||
wxString ehsinkClass = eventSinkClassInfo->GetClassName();
|
||||
const wxEventSourceTypeInfo *delegateTypeInfo =
|
||||
wx_dynamic_cast(const wxEventSourceTypeInfo*, delegateInfo->GetTypeInfo());
|
||||
if ( delegateTypeInfo )
|
||||
{
|
||||
int eventType = delegateTypeInfo->GetEventType();
|
||||
wxString handlerName = handlerInfo->GetName();
|
||||
|
||||
wxString code =
|
||||
wxString::Format(
|
||||
"\t%s->Connect( %s->GetId(), %d, "
|
||||
"(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );",
|
||||
ehsource, ehsource, eventType, ehsinkClass,
|
||||
handlerName, ehsink );
|
||||
|
||||
m_source += ( code );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError(_("delegate has no type info"));
|
||||
}
|
||||
}
|
||||
110
libs/wxWidgets-3.3.1/samples/xti/codereadercallback.h
Normal file
110
libs/wxWidgets-3.3.1/samples/xti/codereadercallback.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/xtistrm.h
|
||||
// Purpose: streaming runtime metadata information (extended class info)
|
||||
// Author: Stefan Csomor
|
||||
// Created: 27/07/03
|
||||
// Copyright: (c) 2003 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CODEDEPERSISTER_
|
||||
#define _CODEDEPERSISTER_
|
||||
|
||||
#if wxUSE_EXTENDED_RTTI
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/sstream.h"
|
||||
|
||||
/*
|
||||
wxObjectCodeReaderCallback implements the callbacks that will depersist
|
||||
an object into a C++ initialization function.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_BASE wxTextOutputStream;
|
||||
|
||||
class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectReaderCallback
|
||||
{
|
||||
private:
|
||||
struct wxObjectCodeReaderCallbackInternal;
|
||||
wxObjectCodeReaderCallbackInternal * m_data;
|
||||
wxString& m_headerincludes;
|
||||
wxString& m_source;
|
||||
|
||||
public:
|
||||
wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source);
|
||||
virtual ~wxObjectCodeReaderCallback();
|
||||
|
||||
// allocate the new object on the heap, that object will have the passed in ID
|
||||
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
|
||||
wxStringToAnyHashMap &metadata);
|
||||
|
||||
// initialize the already allocated object having the ID objectID
|
||||
// with the Create method creation parameters which are objects are
|
||||
// having their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
|
||||
|
||||
virtual void CreateObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
int paramCount,
|
||||
wxAny *variantValues,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **objectClassInfos,
|
||||
wxStringToAnyHashMap &metadata
|
||||
);
|
||||
|
||||
// construct the new object on the heap, that object will have the
|
||||
// passed in ID (for objects that don't support allocate-create type
|
||||
// of creation) creation parameters which are objects are having their
|
||||
// Ids passed in objectIDValues having objectId <> wxInvalidObjectID
|
||||
|
||||
virtual void ConstructObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
int paramCount,
|
||||
wxAny *VariantValues,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **objectClassInfos,
|
||||
wxStringToAnyHashMap &metadata);
|
||||
|
||||
// destroy the heap-allocated object having the ID objectID, this may
|
||||
// be used if an object is embedded in another object and set via value
|
||||
// semantics, so the intermediate object can be destroyed after safely
|
||||
virtual void DestroyObject(int objectID, wxClassInfo *classInfo);
|
||||
|
||||
// set the corresponding property
|
||||
virtual void SetProperty(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxAny &variantValue);
|
||||
|
||||
// sets the corresponding property (value is an object)
|
||||
virtual void SetPropertyAsObject(int objectId,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
int valueObjectId);
|
||||
|
||||
// adds an element to a property collection
|
||||
virtual void AddToPropertyCollection( int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxAny &VariantValue);
|
||||
|
||||
// sets the corresponding property (value is an object)
|
||||
virtual void AddToPropertyCollectionAsObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
int valueObjectId);
|
||||
|
||||
// sets the corresponding event handler
|
||||
virtual void SetConnect(int eventSourceObjectID,
|
||||
const wxClassInfo *eventSourceClassInfo,
|
||||
const wxPropertyInfo *delegateInfo,
|
||||
const wxClassInfo *eventSinkClassInfo,
|
||||
const wxHandlerInfo* handlerInfo,
|
||||
int eventSinkObjectID );
|
||||
|
||||
// utility function exposed for callbacks
|
||||
wxString ValueAsCode( const wxAny ¶m );
|
||||
};
|
||||
|
||||
#endif // wxUSE_EXTENDED_RTTI
|
||||
|
||||
#endif
|
||||
240
libs/wxWidgets-3.3.1/samples/xti/makefile.gcc
Normal file
240
libs/wxWidgets-3.3.1/samples/xti/makefile.gcc
Normal file
@@ -0,0 +1,240 @@
|
||||
# =========================================================================
|
||||
# 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)
|
||||
XTI_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)
|
||||
XTI_OBJECTS = \
|
||||
$(OBJS)\xti_sample_rc.o \
|
||||
$(OBJS)\xti_xti.o \
|
||||
$(OBJS)\xti_classlist.o \
|
||||
$(OBJS)\xti_codereadercallback.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_XML_p = \
|
||||
-lwxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml
|
||||
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)\xti.exe
|
||||
|
||||
clean:
|
||||
-if exist $(OBJS)\*.o del $(OBJS)\*.o
|
||||
-if exist $(OBJS)\*.d del $(OBJS)\*.d
|
||||
-if exist $(OBJS)\xti.exe del $(OBJS)\xti.exe
|
||||
|
||||
$(OBJS)\xti.exe: $(XTI_OBJECTS) $(OBJS)\xti_sample_rc.o
|
||||
$(foreach f,$(subst \,/,$(XTI_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_XML_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)\xti_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)\xti_xti.o: ./xti.cpp
|
||||
$(CXX) -c -o $@ $(XTI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\xti_classlist.o: ./classlist.cpp
|
||||
$(CXX) -c -o $@ $(XTI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\xti_codereadercallback.o: ./codereadercallback.cpp
|
||||
$(CXX) -c -o $@ $(XTI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
||||
SHELL := $(COMSPEC)
|
||||
|
||||
# Dependencies tracking:
|
||||
-include $(OBJS)/*.d
|
||||
108
libs/wxWidgets-3.3.1/samples/xti/makefile.unx
Normal file
108
libs/wxWidgets-3.3.1/samples/xti/makefile.unx
Normal file
@@ -0,0 +1,108 @@
|
||||
# =========================================================================
|
||||
# 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)
|
||||
XTI_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) \
|
||||
$(CXXFLAGS)
|
||||
XTI_OBJECTS = \
|
||||
xti_xti.o \
|
||||
xti_classlist.o \
|
||||
xti_codereadercallback.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 xti
|
||||
|
||||
install:
|
||||
|
||||
uninstall:
|
||||
|
||||
clean:
|
||||
rm -f ./*.o
|
||||
rm -f ./*.d
|
||||
rm -f xti
|
||||
|
||||
test_for_selected_wxbuild:
|
||||
@$(WX_CONFIG) $(WX_CONFIG_FLAGS)
|
||||
|
||||
xti: $(XTI_OBJECTS)
|
||||
$(CXX) -o $@ $(XTI_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs core,xml,base`
|
||||
|
||||
xti_xti.o: ./xti.cpp
|
||||
$(CXX) -c -o $@ $(XTI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
xti_classlist.o: ./classlist.cpp
|
||||
$(CXX) -c -o $@ $(XTI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
xti_codereadercallback.o: ./codereadercallback.cpp
|
||||
$(CXX) -c -o $@ $(XTI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
||||
|
||||
# Dependencies tracking:
|
||||
-include ./*.d
|
||||
453
libs/wxWidgets-3.3.1/samples/xti/makefile.vc
Normal file
453
libs/wxWidgets-3.3.1/samples/xti/makefile.vc
Normal file
@@ -0,0 +1,453 @@
|
||||
# =========================================================================
|
||||
# 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)
|
||||
XTI_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
|
||||
$(__DEBUGINFO_0) /Fd$(OBJS)\xti.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)
|
||||
XTI_OBJECTS = \
|
||||
$(OBJS)\xti_xti.obj \
|
||||
$(OBJS)\xti_classlist.obj \
|
||||
$(OBJS)\xti_codereadercallback.obj
|
||||
XTI_RESOURCES = \
|
||||
$(OBJS)\xti_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_XML_p = \
|
||||
wxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml.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)\xti.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)\xti.exe del $(OBJS)\xti.exe
|
||||
-if exist $(OBJS)\xti.ilk del $(OBJS)\xti.ilk
|
||||
-if exist $(OBJS)\xti.pdb del $(OBJS)\xti.pdb
|
||||
|
||||
$(OBJS)\xti.exe: $(XTI_OBJECTS) $(OBJS)\xti_sample.res
|
||||
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\xti.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
|
||||
$(XTI_OBJECTS) $(XTI_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_XML_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)\xti_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)\xti_xti.obj: .\xti.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(XTI_CXXFLAGS) .\xti.cpp
|
||||
|
||||
$(OBJS)\xti_classlist.obj: .\classlist.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(XTI_CXXFLAGS) .\classlist.cpp
|
||||
|
||||
$(OBJS)\xti_codereadercallback.obj: .\codereadercallback.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(XTI_CXXFLAGS) .\codereadercallback.cpp
|
||||
|
||||
15
libs/wxWidgets-3.3.1/samples/xti/xti.bkl
Normal file
15
libs/wxWidgets-3.3.1/samples/xti/xti.bkl
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<makefile>
|
||||
|
||||
<include file="../../build/bakefiles/common_samples.bkl"/>
|
||||
|
||||
<exe id="xti" template="wx_sample" template_append="wx_append">
|
||||
<sources>xti.cpp classlist.cpp codereadercallback.cpp</sources>
|
||||
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>xml</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
</exe>
|
||||
|
||||
</makefile>
|
||||
741
libs/wxWidgets-3.3.1/samples/xti/xti.cpp
Normal file
741
libs/wxWidgets-3.3.1/samples/xti/xti.cpp
Normal file
@@ -0,0 +1,741 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xti.cpp
|
||||
// Purpose: eXtended RTTI support sample
|
||||
// Author: Stefan Csomor, Francesco Montorsi
|
||||
// Created: 13/5/2007
|
||||
// Copyright: (c) Stefan Csomor, Francesco Montorsi
|
||||
// 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 (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWidgets headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/variant.h"
|
||||
#include "wx/xml/xml.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/spinbutt.h"
|
||||
#include "wx/spinctrl.h"
|
||||
|
||||
#include "wx/xtistrm.h"
|
||||
#include "wx/xtixml.h"
|
||||
#include "wx/txtstrm.h"
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/sstream.h"
|
||||
#include "wx/spinctrl.h"
|
||||
|
||||
#include "classlist.h"
|
||||
#include "codereadercallback.h"
|
||||
|
||||
#if !wxUSE_EXTENDED_RTTI
|
||||
#error This sample requires XTI (eXtended RTTI) enabled
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// resources
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef wxHAS_IMAGES_IN_RESOURCES
|
||||
#include "../sample.xpm"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Define a new application type, each program should derive a class from wxApp
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
|
||||
// Define a new frame type: this is going to be our main frame
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
// ctor(s)
|
||||
MyFrame(const wxString& title);
|
||||
|
||||
void OnPersist(wxCommandEvent& event);
|
||||
void OnDepersist(wxCommandEvent& event);
|
||||
void OnGenerateCode(wxCommandEvent& event);
|
||||
void OnDumpClasses(wxCommandEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
// any class wishing to process wxWidgets events must use this macro
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// IDs for the controls and the menu commands
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
Minimal_Persist = wxID_HIGHEST,
|
||||
Minimal_Depersist,
|
||||
Minimal_GenerateCode,
|
||||
Minimal_DumpClasses,
|
||||
Minimal_Quit = wxID_EXIT,
|
||||
Minimal_About = wxID_ABOUT
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables and other macros for wxWidgets
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Persist, MyFrame::OnPersist)
|
||||
EVT_MENU(Minimal_Depersist, MyFrame::OnDepersist)
|
||||
EVT_MENU(Minimal_GenerateCode, MyFrame::OnGenerateCode)
|
||||
EVT_MENU(Minimal_DumpClasses, MyFrame::OnDumpClasses)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
wxIMPLEMENT_APP(MyApp);
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
void RegisterFrameRTTI();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
if ( !wxApp::OnInit() )
|
||||
return false;
|
||||
|
||||
RegisterFrameRTTI();
|
||||
|
||||
// create the main application window
|
||||
MyFrame *frame = new MyFrame("Extended RTTI sample");
|
||||
|
||||
// and show it (the frames, unlike simple controls, are not shown when
|
||||
// created initially)
|
||||
frame->Show(true);
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned false here, the
|
||||
// application would exit immediately.
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// main frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
MyFrame::MyFrame(const wxString& title)
|
||||
: wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(300, 200))
|
||||
{
|
||||
// set the frame icon
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// create a menu bar
|
||||
wxMenu *fileMenu = new wxMenu;
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(Minimal_About, "&About\tF1", "Show about dialog");
|
||||
|
||||
fileMenu->Append(Minimal_Persist, "Persist a wxFrame to XML...",
|
||||
"Creates a wxFrame using wxXTI and saves its description as XML");
|
||||
fileMenu->Append(Minimal_Depersist, "Depersist XML file...",
|
||||
"Loads the description of wxFrame from XML");
|
||||
fileMenu->Append(Minimal_GenerateCode, "Generate code for a wxFrame saved to XML...",
|
||||
"Generates the C++ code which belong to a persisted wxFrame");
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(Minimal_DumpClasses, "Dump registered classes...",
|
||||
"Dumps the description of all wxWidgets classes registered in XTI");
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI sample code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// this is the kind of source code that would end up being generated by a
|
||||
// designer corresponding to the information we are setting up via RTTI
|
||||
// in the CreateFrameRTTI function:
|
||||
//
|
||||
// class MyXTIFrame : public wxFrame
|
||||
// {
|
||||
// public:
|
||||
// // construction
|
||||
// MyXTIFrame()
|
||||
// {
|
||||
// Init();
|
||||
// m_button = nullptr;
|
||||
// }
|
||||
//
|
||||
// bool Create(wxWindow *parent,
|
||||
// wxWindowID id,
|
||||
// const wxString& title,
|
||||
// const wxPoint& pos = wxDefaultPosition,
|
||||
// const wxSize& size = wxDefaultSize,
|
||||
// long style = wxDEFAULT_FRAME_STYLE,
|
||||
// const wxString& name = wxFrameNameStr)
|
||||
// {
|
||||
// return wxFrame::Create( parent, id, title, pos, size, style, name );
|
||||
// }
|
||||
//
|
||||
// void SetButton( wxButton * button ) { m_button = button; }
|
||||
// wxButton* GetButton() const { return m_button; }
|
||||
//
|
||||
// void ButtonClickHandler( wxEvent & WXUNUSED(event) )
|
||||
// {
|
||||
// wxMessageBox( "Button Clicked ", "Hi!", wxOK );
|
||||
// }
|
||||
//
|
||||
// protected:
|
||||
// wxButton* m_button;
|
||||
//
|
||||
// wxDECLARE_EVENT_TABLE();
|
||||
// wxDECLARE_DYNAMIC_CLASS_NO_COPY(MyXTIFrame);
|
||||
// };
|
||||
//
|
||||
// wxIMPLEMENT_DYNAMIC_CLASS_XTI(MyXTIFrame, MyXTIFrame, "x.h");
|
||||
//
|
||||
// WX_BEGIN_PROPERTIES_TABLE(MyXTIFrame)
|
||||
// WX_PROPERTY( Button, wxButton*, SetButton, GetButton, )
|
||||
// WX_END_PROPERTIES_TABLE()
|
||||
//
|
||||
// WX_BEGIN_HANDLERS_TABLE(MyXTIFrame)
|
||||
// WX_HANDLER( ButtonClickHandler, wxCommandEvent )
|
||||
// WX_END_HANDLERS_TABLE()
|
||||
//
|
||||
// WX_CONSTRUCTOR_5( MyXTIFrame, wxWindow*, Parent, wxWindowID, Id,
|
||||
// wxString, Title, wxPoint, Position, wxSize, Size )
|
||||
//
|
||||
// wxBEGIN_EVENT_TABLE(MyXTIFrame, wxFrame)
|
||||
// wxEND_EVENT_TABLE()
|
||||
|
||||
// the following class "persists" (i.e. saves) a wxFrame into a wxObjectWriter
|
||||
|
||||
class MyDesignerPersister : public wxObjectWriterCallback
|
||||
{
|
||||
public:
|
||||
MyDesignerPersister( wxDynamicObject * frame)
|
||||
{
|
||||
m_frame = frame;
|
||||
}
|
||||
|
||||
virtual bool BeforeWriteDelegate( wxObjectWriter *WXUNUSED(writer),
|
||||
const wxObject *object,
|
||||
const wxClassInfo* WXUNUSED(classInfo),
|
||||
const wxPropertyInfo *propInfo,
|
||||
const wxObject *&eventSink,
|
||||
const wxHandlerInfo* &handlerInfo )
|
||||
{
|
||||
// this approach would be used if the handler would not
|
||||
// be connected really in the designer, so we have to supply
|
||||
// the information
|
||||
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty("Button") );
|
||||
if ( object == but &&
|
||||
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo("OnClick") )
|
||||
{
|
||||
eventSink = m_frame;
|
||||
handlerInfo = m_frame->GetClassInfo()->
|
||||
FindHandlerInfo("ButtonClickHandler");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
wxDynamicObject *m_frame;
|
||||
};
|
||||
|
||||
// sometimes linkers (at least MSVC and GCC ones) optimize the final EXE
|
||||
// even in debug mode pruning the object files which he "thinks" are useless;
|
||||
// thus the classes defined in those files won't be available in the XTI
|
||||
// table and the program will fail to allocate them.
|
||||
// The following macro implements a simple hack to ensure that a given
|
||||
// class is linked in.
|
||||
//
|
||||
// TODO: in wx/link.h there are already similar macros (also more "optimized":
|
||||
// don't need the creation of fake object) which however require to use
|
||||
// the wxFORCE_LINK_THIS_MODULE() macro inside the source files corresponding
|
||||
// to the class being discarded.
|
||||
//
|
||||
#define wxENSURE_CLASS_IS_LINKED(x) { x test; }
|
||||
|
||||
void RegisterFrameRTTI()
|
||||
{
|
||||
// set up the RTTI info for a class (MyXTIFrame) which
|
||||
// is not defined anywhere in this program
|
||||
wxDynamicClassInfo *dyninfo =
|
||||
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass("MyXTIFrame"));
|
||||
if ( dyninfo == nullptr )
|
||||
{
|
||||
dyninfo = new wxDynamicClassInfo("myxtiframe.h",
|
||||
"MyXTIFrame",
|
||||
CLASSINFO(wxFrame) );
|
||||
|
||||
// this class has a property named "Button" and the relative handler:
|
||||
dyninfo->AddProperty("Button", wxGetTypeInfo((wxButton**) nullptr));
|
||||
dyninfo->AddHandler("ButtonClickHandler",
|
||||
nullptr /* no instance of the handler method */, CLASSINFO( wxEvent ) );
|
||||
}
|
||||
}
|
||||
|
||||
wxDynamicObject* CreateFrameRTTI()
|
||||
{
|
||||
int baseID = wxID_HIGHEST;
|
||||
wxAny Params[10];
|
||||
|
||||
// the class is now part of XTI internal table so that we can
|
||||
// get a pointer to it just searching it like any other class:
|
||||
wxFrame* frame;
|
||||
wxClassInfo *info = wxClassInfo::FindClass("MyXTIFrame");
|
||||
wxASSERT( info );
|
||||
wxDynamicObject* frameWrapper =
|
||||
wx_dynamic_cast(wxDynamicObject*, info->CreateObject() );
|
||||
Params[0] = wxAny((wxWindow*)(nullptr));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("This is a frame created from XTI"));
|
||||
Params[3] = wxAny(wxPoint(-1,-1));
|
||||
Params[4] = wxAny(wxSize(400,300));
|
||||
Params[5] = wxAny((long)wxDEFAULT_FRAME_STYLE);
|
||||
wxASSERT( info->Create(frameWrapper, 6, Params ));
|
||||
frame = wx_dynamic_cast(wxFrame*, frameWrapper->GetSuperClassInstance());
|
||||
|
||||
#if 1
|
||||
// now build a notebook inside it:
|
||||
wxNotebook* notebook;
|
||||
info = wxClassInfo::FindClass("wxNotebook");
|
||||
wxASSERT( info );
|
||||
notebook = wxDynamicCast( info->CreateObject(), wxNotebook );
|
||||
Params[0] = wxAny((wxWindow*)frame);
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxPoint( 10, 10 ));
|
||||
Params[3] = wxAny(wxDefaultSize);
|
||||
Params[4] = wxAny((long)0);
|
||||
wxASSERT( info->Create(notebook, 5, Params ));
|
||||
|
||||
// button page
|
||||
|
||||
wxPanel* panel;
|
||||
info = wxClassInfo::FindClass("wxPanel");
|
||||
wxASSERT( info );
|
||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||
Params[0] = wxAny((wxWindow*)(notebook));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxPoint(-1,-1));
|
||||
Params[3] = wxAny(wxSize(-1,-1));
|
||||
Params[4] = wxAny((long)0);
|
||||
Params[5] = wxAny(wxString("Hello"));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Buttons" );
|
||||
|
||||
wxButton* button;
|
||||
info = wxClassInfo::FindClass("wxButton");
|
||||
wxASSERT( info );
|
||||
button = wxDynamicCast( info->CreateObject(), wxButton );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("Click Me!"));
|
||||
Params[3] = wxAny(wxPoint( 10, 10 ));
|
||||
Params[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
wxASSERT( info->Create(button, 6, Params ));
|
||||
frameWrapper->SetProperty( "Button", wxAny( button ) );
|
||||
|
||||
// other controls page
|
||||
|
||||
info = wxClassInfo::FindClass("wxPanel");
|
||||
wxASSERT( info );
|
||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||
Params[0] = wxAny((wxWindow*)(notebook));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxPoint(-1,-1));
|
||||
Params[3] = wxAny(wxSize(-1,-1));
|
||||
Params[4] = wxAny((long)0);
|
||||
Params[5] = wxAny(wxString("Hello"));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Other Standard controls" );
|
||||
|
||||
wxControl* control;
|
||||
info = wxClassInfo::FindClass("wxCheckBox");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("A Checkbox"));
|
||||
Params[3] = wxAny(wxPoint( 10, 10 ));
|
||||
Params[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxRadioButton");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("A Radiobutton"));
|
||||
Params[3] = wxAny(wxPoint( 10, 30 ));
|
||||
Params[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("Another One"));
|
||||
Params[3] = wxAny(wxPoint( 10, 50 ));
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxStaticText");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("A Static Text!"));
|
||||
Params[3] = wxAny(wxPoint( 10, 70 ));
|
||||
Params[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxStaticBox");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("A Static Box"));
|
||||
Params[3] = wxAny(wxPoint( 10, 90 ));
|
||||
Params[4] = wxAny(wxSize(100,80));
|
||||
Params[5] = wxAny((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxTextCtrl");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("A Text Control"));
|
||||
Params[3] = wxAny(wxPoint( 10, 200 ));
|
||||
Params[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
// spins and gauges page
|
||||
|
||||
info = wxClassInfo::FindClass("wxPanel");
|
||||
wxASSERT( info );
|
||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||
Params[0] = wxAny((wxWindow*)(notebook));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxPoint(-1,-1));
|
||||
Params[3] = wxAny(wxSize(-1,-1));
|
||||
Params[4] = wxAny((long)0);
|
||||
Params[5] = wxAny(wxString("Hello"));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Spins and Sliders" );
|
||||
|
||||
wxENSURE_CLASS_IS_LINKED(wxSpinButton);
|
||||
|
||||
info = wxClassInfo::FindClass("wxSpinButton");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxPoint( 10, 10 ));
|
||||
Params[3] = wxAny(wxSize(-1,-1));
|
||||
Params[4] = wxAny((long)wxSP_VERTICAL | wxSP_ARROW_KEYS);
|
||||
wxASSERT( info->Create(control, 5, Params ));
|
||||
|
||||
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl);
|
||||
|
||||
info = wxClassInfo::FindClass("wxSpinCtrl");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString("20"));
|
||||
Params[3] = wxAny(wxPoint( 40, 10 ));
|
||||
Params[4] = wxAny(wxSize(40,-1));
|
||||
Params[5] = wxAny((long) wxSP_ARROW_KEYS);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
// MSVC likes to exclude from link wxGauge...
|
||||
wxENSURE_CLASS_IS_LINKED(wxGauge)
|
||||
wxENSURE_CLASS_IS_LINKED(wxCheckBox)
|
||||
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl)
|
||||
|
||||
info = wxClassInfo::FindClass("wxGauge");
|
||||
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny((int) 100);
|
||||
Params[3] = wxAny(wxPoint( 10, 50 ));
|
||||
Params[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long) wxGA_HORIZONTAL);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
wx_dynamic_cast(wxGauge*, control)->SetValue(20);
|
||||
|
||||
#endif
|
||||
return frameWrapper;
|
||||
}
|
||||
|
||||
bool SaveFrameRTTI(const wxString &testFileName, wxDynamicObject *frame)
|
||||
{
|
||||
// setup the XML document
|
||||
wxXmlDocument xml;
|
||||
wxXmlNode *root = new wxXmlNode(wxXML_ELEMENT_NODE,
|
||||
"TestXTI", "This is the content");
|
||||
xml.SetRoot(root);
|
||||
|
||||
// setup the XTI writer and persister
|
||||
wxObjectXmlWriter writer(root);
|
||||
MyDesignerPersister persister(frame);
|
||||
|
||||
// write the given wxObject into the XML document
|
||||
wxStringToAnyHashMap empty;
|
||||
writer.WriteObject( frame, frame->GetClassInfo(), &persister,
|
||||
wxString("myTestFrame"), empty );
|
||||
|
||||
return xml.Save(testFileName);
|
||||
}
|
||||
|
||||
wxDynamicObject* LoadFrameRTTI(const wxString &fileName)
|
||||
{
|
||||
// load the XML document
|
||||
wxXmlDocument xml;
|
||||
if (!xml.Load(fileName))
|
||||
return nullptr;
|
||||
|
||||
wxXmlNode *root = xml.GetRoot();
|
||||
if (root->GetName() != "TestXTI")
|
||||
return nullptr;
|
||||
|
||||
// now depersist the wxFrame we saved into it using wxObjectRuntimeReaderCallback
|
||||
wxObjectRuntimeReaderCallback Callbacks;
|
||||
wxObjectXmlReader Reader( root );
|
||||
int obj = Reader.ReadObject( wxString("myTestFrame"), &Callbacks );
|
||||
return (wxDynamicObject*)Callbacks.GetObject( obj );
|
||||
}
|
||||
|
||||
bool GenerateFrameRTTICode(const wxString &inFileName, const wxString &outFileName)
|
||||
{
|
||||
// is loading the streamed out component from xml and writing code that
|
||||
// will create the same component
|
||||
|
||||
wxFFileOutputStream fos( outFileName );
|
||||
wxTextOutputStream tos( fos );
|
||||
if (!fos.IsOk())
|
||||
return false;
|
||||
|
||||
wxXmlDocument xml;
|
||||
if (!xml.Load(inFileName))
|
||||
return false;
|
||||
|
||||
wxXmlNode *root = xml.GetRoot();
|
||||
if (root->GetName() != "TestXTI")
|
||||
return false;
|
||||
|
||||
// read the XML file using the wxObjectCodeReaderCallback
|
||||
|
||||
wxString headerincludes;
|
||||
wxString sourcecode;
|
||||
wxObjectCodeReaderCallback Callbacks(headerincludes,sourcecode);
|
||||
wxObjectXmlReader Reader(root);
|
||||
|
||||
// ReadObject will return the ID of the object read??
|
||||
Reader.ReadObject( wxString("myTestFrame"), &Callbacks );
|
||||
|
||||
// header preamble
|
||||
tos <<
|
||||
"#include \"wx/wxprec.h\" \n#ifndef WX_PRECOMP\n#include \"wx/wx.h\" \n#endif\n\n";
|
||||
// add object includes
|
||||
tos.WriteString( headerincludes );
|
||||
|
||||
tos << "\n\nvoid test()\n{";
|
||||
tos.WriteString( sourcecode );
|
||||
tos << "}";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MyFrame event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// first create a frame using XTI calls
|
||||
wxDynamicObject *frame = CreateFrameRTTI();
|
||||
if (!frame)
|
||||
{
|
||||
wxLogError("Cannot create the XTI frame!");
|
||||
return;
|
||||
}
|
||||
|
||||
// show the frame we're going to save to the user
|
||||
wxFrame *trueFrame = wx_dynamic_cast(wxFrame *, frame->GetSuperClassInstance() );
|
||||
trueFrame->Show();
|
||||
|
||||
// ask the user where to save it
|
||||
wxFileDialog dlg(this, "Where should the frame be saved?",
|
||||
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
|
||||
wxFD_SAVE);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
// then save it to a test XML file
|
||||
if (!SaveFrameRTTI(dlg.GetPath(), frame))
|
||||
{
|
||||
wxLogError("Cannot save the XTI frame into '%s'", dlg.GetPath());
|
||||
return;
|
||||
}
|
||||
|
||||
// now simply delete it
|
||||
delete frame;
|
||||
}
|
||||
|
||||
void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg(this, "Which file contains the frame to depersist?",
|
||||
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
|
||||
wxFD_OPEN);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
wxObject *frame = LoadFrameRTTI(dlg.GetPath());
|
||||
if (!frame)
|
||||
{
|
||||
wxLogError("Could not depersist the wxFrame from '%s'", dlg.GetPath());
|
||||
return;
|
||||
}
|
||||
|
||||
wxFrame *trueFrame = wx_dynamic_cast(wxFrame*, frame );
|
||||
if ( !trueFrame )
|
||||
{
|
||||
wxDynamicObject* dyno = wx_dynamic_cast(wxDynamicObject*, frame );
|
||||
if ( dyno )
|
||||
trueFrame = wx_dynamic_cast(wxFrame *, dyno->GetSuperClassInstance() );
|
||||
}
|
||||
|
||||
if ( trueFrame )
|
||||
trueFrame->Show();
|
||||
else
|
||||
wxLogError("Could not show the frame");
|
||||
}
|
||||
|
||||
void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg(this, "Which file contains the frame to work on?",
|
||||
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
|
||||
wxFD_OPEN);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg2(this, "Where should the C++ code be saved?",
|
||||
wxEmptyString, "test.cpp", "Source files (*.cpp)|*.cpp",
|
||||
wxFD_SAVE);
|
||||
if (dlg2.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
// do generate code
|
||||
if (!GenerateFrameRTTICode(dlg.GetPath(), dlg2.GetPath()))
|
||||
{
|
||||
wxLogError("Could not generate the code for the frame!");
|
||||
return;
|
||||
}
|
||||
|
||||
// show the generated code
|
||||
{
|
||||
wxFileInputStream f(dlg2.GetPath());
|
||||
wxStringOutputStream str;
|
||||
f.Read(str);
|
||||
|
||||
wxDialog dlg3(this, wxID_ANY, "Generated code",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE);
|
||||
wxPanel *panel = new wxPanel(&dlg3);
|
||||
wxSizer *sz = new wxBoxSizer(wxVERTICAL);
|
||||
sz->Add(new wxTextCtrl(panel, wxID_ANY, str.GetString(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxTE_READONLY|wxTE_DONTWRAP),
|
||||
1, wxGROW|wxALL, 5);
|
||||
sz->Add(new wxButton(panel, wxID_OK), 0, wxALIGN_RIGHT|wxALL, 5);
|
||||
panel->SetSizerAndFit(sz);
|
||||
dlg3.ShowModal();
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnDumpClasses(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
ClassListDialog dlg(this);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// true is to force the frame to close
|
||||
Close(true);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxString::Format(
|
||||
"Welcome to %s!\n"
|
||||
"\n"
|
||||
"This sample demonstrates wxWidgets eXtended RTTI (XTI) system.",
|
||||
wxVERSION_STRING
|
||||
),
|
||||
"About wxWidgets XTI sample",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
Reference in New Issue
Block a user