initial commit

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
2025-10-31 23:37:30 +01:00
commit bf6b52fd94
9654 changed files with 4035664 additions and 0 deletions

View File

@@ -0,0 +1,208 @@
# =========================================================================
# 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
EVENT_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)
EVENT_OBJECTS = \
$(__event___win32rc) \
event_event.o \
event_gestures.o \
event_chessboard.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___event___os2_emxbindcmd = $(NM) event$(EXEEXT) | if grep -q \
pmwin.763 ; then emxbind -ep event$(EXEEXT) ; fi
@COND_PLATFORM_OS2_1@__event___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___event___os2_emxbindcmd)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
@COND_PLATFORM_WIN32_1@__event___win32rc = event_sample_rc.o
@COND_PLATFORM_MACOSX_1@__event_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1@ = event.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@__event_bundle___depname = event_bundle
@COND_TOOLKIT_MAC@____event_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ $(__event_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____event_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_CARBON@ = $(__event_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_COCOA@____event_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_COCOA@ = $(__event_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____event_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = $(__event_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_COCOA@____event_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__event_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_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: event$(EXEEXT) $(__event_bundle___depname)
install:
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f event$(EXEEXT)
rm -rf event.app
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
event$(EXEEXT): $(EVENT_OBJECTS) $(__event___win32rc)
$(CXX) -o $@ $(EVENT_OBJECTS) -L$(LIBDIRNAME) $(DYLIB_RPATH_FLAG) $(LDFLAGS_GUI) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(__event___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@event.app/Contents/PkgInfo: event$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1@ mkdir -p event.app/Contents
@COND_PLATFORM_MACOSX_1@ mkdir -p event.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1@ mkdir -p event.app/Contents/Resources
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ sed -e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.event/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/event/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/event/" \
@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}/event 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 >event.app/Contents/Info.plist
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >event.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ ln -f event$(EXEEXT) event.app/Contents/MacOS/event
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns event.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1@event_bundle: $(____event_BUNDLE_TGT_REF_DEP)
event_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
event_event.o: $(srcdir)/event.cpp
$(CXXC) -c -o $@ $(EVENT_CXXFLAGS) $(srcdir)/event.cpp
event_gestures.o: $(srcdir)/gestures.cpp
$(CXXC) -c -o $@ $(EVENT_CXXFLAGS) $(srcdir)/gestures.cpp
event_chessboard.o: $(srcdir)/chessboard.cpp
$(CXXC) -c -o $@ $(EVENT_CXXFLAGS) $(srcdir)/chessboard.cpp
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean event_bundle

View File

@@ -0,0 +1,232 @@
/////////////////////////////////////////////////////////////////////////////
// Name: samples/event/chessboard.cpp
// Purpose: Part of wxWidgets event sample, shows how to create a new wxEvent class
// Author: PB <pbfordev@gmail.com>
// Created: 2019-10-29
// Copyright: (c) 2019 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "chessboard.h"
//
// ChessBoardEvent
//
// Define new event types associated with ChessBoardEvent
wxDEFINE_EVENT(myEVT_CHESSBOARD_CLICKED, ChessBoardEvent);
wxDEFINE_EVENT(myEVT_CHESSBOARD_DRAGGED, ChessBoardEvent);
//
// ChessBoard
//
class ChessBoard : public wxPanel
{
public:
ChessBoard(wxWindow* parent);
private:
static const wxUint8 SquaresPerSide = 8;
static const int SquareSizeInDIPs = 40;
// square on which mouse left button was pressed
char m_fileLeftMDown;
wxUint8 m_rankLeftMDown;
bool ConvertMousePosToFileAndRank(const wxPoint& pos,
char& file, wxUint8& rank) const;
void OnPaint(wxPaintEvent& event);
void OnMouseLeftDown(wxMouseEvent& event);
void OnMouseLeftUp(wxMouseEvent& event);
void OnSetCursor(wxSetCursorEvent& event);
virtual wxSize DoGetBestClientSize() const override;
};
ChessBoard::ChessBoard(wxWindow* parent)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_RAISED),
m_fileLeftMDown('a'), m_rankLeftMDown(1)
{
SetCursor(wxCursor(wxCURSOR_HAND));
SetBackgroundColour(*wxWHITE);
Bind(wxEVT_PAINT, &ChessBoard::OnPaint, this);
Bind(wxEVT_LEFT_DOWN, &ChessBoard::OnMouseLeftDown, this);
Bind(wxEVT_LEFT_UP, &ChessBoard::OnMouseLeftUp, this);
Bind(wxEVT_SET_CURSOR, &ChessBoard::OnSetCursor, this);
}
bool ChessBoard::ConvertMousePosToFileAndRank(const wxPoint& pos,
char& file, wxUint8& rank) const
{
static const char FileLetters[SquaresPerSide] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
const int squareSizeInPx = FromDIP(SquareSizeInDIPs);
const int colIdx = pos.x / squareSizeInPx;
const int rowIdx = pos.y / squareSizeInPx;
if ( colIdx < 0 || colIdx >= SquaresPerSide
|| rowIdx < 0 || rowIdx >= SquaresPerSide )
{
return false; // not on a square
}
file = FileLetters[colIdx];
// convert rowIdx (top to down 0 to 7) to rank (top to down 8 to 1)
rank = static_cast<wxUint8>(SquaresPerSide - rowIdx);
return true;
}
// Background is already painted white,
// so we need to draw only the black squares over it.
void ChessBoard::OnPaint(wxPaintEvent& WXUNUSED(event))
{
const int squareSizeInPx = FromDIP(SquareSizeInDIPs);
wxPaintDC dc(this);
wxDCPenChanger penChanger(dc, *wxTRANSPARENT_PEN);
wxDCBrushChanger brushChanger(dc, *wxBLACK_BRUSH);
wxRect squareRect(wxSize(squareSizeInPx, squareSizeInPx));
// draw from top to down, left to right
for ( size_t rank = SquaresPerSide; rank >= 1; --rank )
{
if ( rank % 2 )
squareRect.SetLeft(0); // odd ranks start with a black square
else
squareRect.SetLeft(squareSizeInPx); // even ranks start with a white square
for ( size_t file = 0; file < SquaresPerSide / 2; ++file )
{
dc.DrawRectangle(squareRect);
squareRect.Offset(2 * squareSizeInPx, 0);
}
squareRect.Offset(0, squareSizeInPx);
}
}
void ChessBoard::OnMouseLeftDown(wxMouseEvent& event)
{
char file;
wxUint8 rank;
event.Skip();
if ( !ConvertMousePosToFileAndRank(event.GetPosition(), file, rank) )
return; // mouse cursor not on a square
m_fileLeftMDown = file;
m_rankLeftMDown = rank;
CaptureMouse();
}
void ChessBoard::OnMouseLeftUp(wxMouseEvent& event)
{
event.Skip();
if ( !HasCapture() )
return; // capture lost or mouse left down was not on a square
const wxRect clientRect = GetClientRect();
char file;
wxUint8 rank;
ReleaseMouse();
if ( !clientRect.Contains(event.GetPosition()) ||
!ConvertMousePosToFileAndRank(event.GetPosition(), file, rank) )
{
return; // mouse cursor not on a square
}
ChessBoardEvent chessBoardEvent;
chessBoardEvent.SetId(GetId());
chessBoardEvent.SetEventObject(this);
chessBoardEvent.SetFile(m_fileLeftMDown);
chessBoardEvent.SetRank(m_rankLeftMDown);
if ( file == m_fileLeftMDown && rank == m_rankLeftMDown )
{ // mouse left and down on the same square, consider it a click
chessBoardEvent.SetEventType(myEVT_CHESSBOARD_CLICKED);
}
else
{ // mouse dragged from one square to another
chessBoardEvent.SetEventType(myEVT_CHESSBOARD_DRAGGED);
chessBoardEvent.SetFileTo(file);
chessBoardEvent.SetRankTo(rank);
}
ProcessWindowEvent(chessBoardEvent);
}
void ChessBoard::OnSetCursor(wxSetCursorEvent& event)
{
char file;
wxUint8 rank;
if ( !ConvertMousePosToFileAndRank(event.GetPosition(), file, rank) )
return; // mouse cursor not on a square
// Set question cursor on white squares, just for testing: for the other
// ones we use our default (hand) cursor.
if ((file - 'a') % 2 == (rank % 2))
event.SetCursor(wxCursor(wxCURSOR_QUESTION_ARROW));
else
event.Skip();
}
wxSize ChessBoard::DoGetBestClientSize() const
{
const int boardSideSizeInPx = SquaresPerSide * FromDIP(SquareSizeInDIPs);
return wxSize(boardSideSizeInPx, boardSideSizeInPx);
}
//
// MyChessBoardDialog implementation
//
// For demonstration, event table is used for myEVT_CHESSBOARD_CLICKED
// while Bind() is used for myEVT_CHESSBOARD_DRAGGED.
wxBEGIN_EVENT_TABLE(MyChessBoardDialog, wxDialog)
EVT_CHESSBOARD_CLICKED(wxID_ANY, MyChessBoardDialog::OnChessBoardClicked)
wxEND_EVENT_TABLE()
MyChessBoardDialog::MyChessBoardDialog(wxWindow* parent)
: wxDialog(parent, wxID_ANY, "New event class demonstration")
{
wxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->Add(
new wxStaticText(this, wxID_ANY, "Click or drag the mouse over the chessboard"),
wxSizerFlags().Border().CenterHorizontal());
mainSizer->Add(new ChessBoard(this),
wxSizerFlags().TripleBorder().CenterHorizontal());
mainSizer->Add(CreateStdDialogButtonSizer(wxCLOSE),
wxSizerFlags().Expand().Border());
SetSizerAndFit(mainSizer);
Bind(myEVT_CHESSBOARD_DRAGGED, &MyChessBoardDialog::OnChessBoardDragged, this);
}
void MyChessBoardDialog::OnChessBoardClicked(ChessBoardEvent& event)
{
wxLogMessage("myEVT_CHESSBOARD_CLICKED: %c%hhu",
event.GetFile(), event.GetRank());
}
void MyChessBoardDialog::OnChessBoardDragged(ChessBoardEvent& event)
{
wxLogMessage("myEVT_CHESSBOARD_DRAGGED: from %c%hhu to %c%hhu",
event.GetFile(), event.GetRank(),
event.GetFileTo(), event.GetRankTo());
}

View File

@@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////
// Name: samples/event/chessboard.h
// Purpose: Part of wxWidgets event sample, shows how to create a new wxEvent class
// Author: PB <pbfordev@gmail.com>
// Created: 2019-10-29
// Copyright: (c) 2019 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHESSBOARD_H_
#include "wx/wx.h"
// A chessboard consists of 8x8 squares organized
// in columns (called files) and rows (called ranks).
// In a 2D view, files are labeled from left to right
// 'a' to 'h' while ranks are numbered from bottom to
// top 1 to 8.
// ChessBoardEvent tells us something happened on
// the chessboard. Either a square was clicked
// (myEVT_CHESSBOARD_CLICKED) or the mouse cursor was dragged
// from one square to another (myEVT_CHESSBOARD_DRAGGED).
class ChessBoardEvent : public wxCommandEvent
{
public:
ChessBoardEvent(wxEventType commandEventType = wxEVT_NULL, int id = 0)
: wxCommandEvent(commandEventType, id),
m_file('a'), m_rank(1), m_fileTo('a'), m_rankTo(1)
{}
// myEVT_CHESSBOARD_CLICKED: Returns File/Rank for the square clicked.
// myEVT_CHESSBOARD_DRAGGED: Returns File/Rank for the square
// the mouse cursor was dragged from.
char GetFile() const { return m_file; }
wxUint8 GetRank() const { return m_rank; }
// Valid only for myEVT_CHESSBOARD_DRAGGED,
// returns File/Rank for the square where the mouse cursor was dragged to.
char GetFileTo() const { return m_fileTo; }
wxUint8 GetRankTo() const { return m_rankTo; }
void SetFile(char file) { m_file = file; }
void SetRank(wxUint8 rank) { m_rank = rank; }
void SetFileTo(char file) { m_fileTo = file; }
void SetRankTo(wxUint8 rank) { m_rankTo = rank; }
virtual wxEvent* Clone() const override { return new ChessBoardEvent(*this); }
private:
char m_file;
wxUint8 m_rank;
char m_fileTo;
wxUint8 m_rankTo;
};
// Declare new event types,
// the matching definitions are in chessboard.cpp.
wxDECLARE_EVENT(myEVT_CHESSBOARD_CLICKED, ChessBoardEvent);
wxDECLARE_EVENT(myEVT_CHESSBOARD_DRAGGED, ChessBoardEvent);
// The following typedef and macro are needed only when the new event
// class is to be used with event table macros or the legacy Connect(),
// to cast the type of a function handling it to the type expected by
// the event table machinery, see its use in EVT_CHESSBOARD_xxx below.
// I.e., when only Bind() is going to be used you do not need them.
typedef void (wxEvtHandler::*ChessBoardEventFunction)(ChessBoardEvent&);
#define ChessBoardEventHandler(func) wxEVENT_HANDLER_CAST(ChessBoardEventFunction, func)
// These defines are needed only if the new event is to be used with
// event tables, i.e., when only Bind() is going to be used you do not need them.
#define EVT_CHESSBOARD_CLICKED(id, func) \
wx__DECLARE_EVT1(myEVT_CHESSBOARD_CLICKED, id, ChessBoardEventHandler(func))
#define EVT_CHESSBOARD_DRAGGED(id, func) \
wx__DECLARE_EVT1(myEVT_CHESSBOARD_DRAGGED, id, ChessBoardEventHandler(func))
// Dialog displaying the chessboard
// and handling ChessBoardEvents
class MyChessBoardDialog : public wxDialog
{
public:
MyChessBoardDialog(wxWindow* parent);
private:
void OnChessBoardClicked(ChessBoardEvent& event);
void OnChessBoardDragged(ChessBoardEvent& event);
// Just for demonstration, we will use an event table
// for myEVT_CHESSBOARD_CLICKED.
wxDECLARE_EVENT_TABLE();
};
#endif // #ifndef _WX_CHESSBOARD_H_

View File

@@ -0,0 +1,79 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 19 November 2019 *
# *
#*****************************************************************************
.first
define wx [--.include.wx]
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)/incl=([],[-])
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)/incl=([],[-])
.else
.ifdef __WXGTK2__
CXX_DEFINE = /define=(__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)/incl=([],[-])
.else
.ifdef __WXX11__
CXX_DEFINE = /define=(__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\
/name=(as_is,short)/assume=(nostdnew,noglobal_array_new)/incl=([],[-])
.else
CXX_DEFINE =
.endif
.endif
.endif
.endif
.suffixes : .cpp
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
all :
.ifdef __WXMOTIF__
$(MMS)$(MMSQUALIFIERS) event.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) event_gtk.exe
.else
.ifdef __WXGTK2__
$(MMS)$(MMSQUALIFIERS) event_gtk2.exe
.else
.ifdef __WXX11__
$(MMS)$(MMSQUALIFIERS) event_x11.exe
.endif
.endif
.endif
.endif
OBJS=event.obj,gestures.obj,chessboard.obj
.ifdef __WXMOTIF__
event.exe : $(OBJS)
cxxlink $(OBJS),[--.lib]vms/opt
.else
.ifdef __WXGTK__
event_gtk.exe : $(OBJS)
cxxlink/exec=event_gtk.exe $(OBJS),[--.lib]vms_gtk/opt
.else
.ifdef __WXGTK2__
event_gtk2.exe : $(OBJS)
cxxlink/exec=event_gtk2.exe $(OBJS),[--.lib]vms_gtk2/opt
.else
.ifdef __WXX11__
event_x11.exe : $(OBJS)
cxxlink/exec=event_x11.exe $(OBJS),[--.lib]vms_x11_univ/opt
.endif
.endif
.endif
.endif
event.obj : event.cpp
gestures.obj : gestures.cpp
chessboard.obj : chessboard.cpp

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<makefile>
<include file="../../build/bakefiles/common_samples.bkl"/>
<exe id="event" template="wx_sample" template_append="wx_append">
<sources> event.cpp gestures.cpp chessboard.cpp</sources>
<headers> gestures.h chessboard.h</headers>
<wx-lib>core</wx-lib>
<wx-lib>base</wx-lib>
</exe>
</makefile>

View File

@@ -0,0 +1,629 @@
/////////////////////////////////////////////////////////////////////////////
// Name: event.cpp
// Purpose: wxWidgets sample demonstrating different event usage
// Author: Vadim Zeitlin
// Created: 31.01.01
// Copyright: (c) 2001-2009 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
#endif
#include <wx/statline.h>
#include <wx/log.h>
#include "gestures.h"
#include "chessboard.h"
// ----------------------------------------------------------------------------
// event constants
// ----------------------------------------------------------------------------
// define a custom event type (we don't need a separate declaration here but
// usually you would use a matching wxDECLARE_EVENT in a header)
wxDEFINE_EVENT(wxEVT_MY_CUSTOM_COMMAND, wxCommandEvent);
// it may also be convenient to define an event table macro for this event type
#define EVT_MY_CUSTOM_COMMAND(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
wxEVT_MY_CUSTOM_COMMAND, id, wxID_ANY, \
wxCommandEventHandler(fn), \
nullptr \
),
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// Define a new application type, each program should derive a class from wxApp
class MyApp : public wxApp
{
public:
// override base class virtuals
// ----------------------------
// this one is called on application startup and is a good place for the app
// initialization (doing it here and not in the ctor allows to have an error
// return: if OnInit() returns false, the application terminates)
virtual bool OnInit() override;
// these are regular event handlers used to highlight the events handling
// order
void OnClickDynamicHandlerApp(wxCommandEvent& event);
void OnClickStaticHandlerApp(wxCommandEvent& event);
// we override wxAppConsole::FilterEvent used to highlight the events
// handling order
virtual int FilterEvent(wxEvent& event) override;
private:
wxDECLARE_EVENT_TABLE();
};
// Define a custom button used to highlight the events handling order
class MyEvtTestButton : public wxButton
{
public:
static long BUTTON_ID;
MyEvtTestButton(wxWindow *parent, const wxString& label)
: wxButton(parent, BUTTON_ID, label)
{
// Add a dynamic handler for this button event to button itself
Bind(wxEVT_BUTTON, &MyEvtTestButton::OnClickDynamicHandler, this);
}
private:
void OnClickDynamicHandler(wxCommandEvent& event)
{
wxLogMessage("Step 3 in \"How Events are Processed\":\n"
"Button::ownDynamicHandler");
event.Skip();
}
void OnClickStaticHandler(wxCommandEvent& event)
{
wxLogMessage("Step 4 in \"How Events are Processed\":\n"
"Button::ownStaticHandler");
event.Skip();
}
wxDECLARE_EVENT_TABLE();
};
long MyEvtTestButton::BUTTON_ID = wxNewId();
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
{
public:
// ctor(s)
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
virtual ~MyFrame();
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnBind(wxCommandEvent& event);
void OnConnect(wxCommandEvent& event);
void OnDynamic(wxCommandEvent& event);
void OnPushEventHandler(wxCommandEvent& event);
void OnPopEventHandler(wxCommandEvent& event);
void OnTest(wxCommandEvent& event);
void OnFireCustom(wxCommandEvent& event);
void OnProcessCustom(wxCommandEvent& event);
void OnUpdateUIPop(wxUpdateUIEvent& event);
// regular event handlers used to highlight the events handling order
void OnClickDynamicHandlerFrame(wxCommandEvent& event);
void OnClickDynamicHandlerButton(wxCommandEvent& event);
void OnClickStaticHandlerFrame(wxCommandEvent& event);
// Gesture
void OnGesture(wxCommandEvent& event);
// Demonstrates using a new event class
void OnNewEventClass(wxCommandEvent& event);
private:
// symbolic names for the status bar fields
enum
{
Status_Main = 0,
Status_Dynamic,
Status_Push
};
void UpdateDynamicStatus(bool on)
{
#if wxUSE_STATUSBAR
if ( on )
{
SetStatusText("You can now use \"Dynamic\" item in the menu");
SetStatusText("Dynamic: on", Status_Dynamic);
}
else
{
SetStatusText("You can no more use \"Dynamic\" item in the menu");
SetStatusText("Dynamic: off", Status_Dynamic);
}
#endif // wxUSE_STATUSBAR
}
// number of pushed event handlers
unsigned m_nPush;
// the button to whose event we connect dynamically
wxButton *m_btnDynamic;
// the button used to highlight the event handlers execution order
MyEvtTestButton *m_testBtn;
wxWindowRef m_gestureFrame;
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
};
// Define a custom event handler
class MyEvtHandler : public wxEvtHandler
{
public:
MyEvtHandler(size_t level) { m_level = level; }
void OnTest(wxCommandEvent& event)
{
wxLogMessage("This is the pushed test event handler #%u", m_level);
// if we don't skip the event, the other event handlers won't get it:
// try commenting out this line and see what changes
event.Skip();
}
private:
unsigned m_level;
wxDECLARE_EVENT_TABLE();
};
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// IDs for the controls and the menu commands
enum
{
// menu items
Event_Quit = 1,
Event_About,
Event_Bind,
Event_Connect,
Event_Dynamic,
Event_Push,
Event_Pop,
Event_Custom,
Event_Test,
Event_Gesture,
Event_NewEventClass
};
// ----------------------------------------------------------------------------
// event tables and other macros for wxWidgets
// ----------------------------------------------------------------------------
// The event tables connect the wxWidgets events with the functions (event
// handlers) which process them.
wxBEGIN_EVENT_TABLE(MyApp, wxApp)
// Add a static handler for button Click event in the app
EVT_BUTTON(MyEvtTestButton::BUTTON_ID, MyApp::OnClickStaticHandlerApp)
wxEND_EVENT_TABLE()
wxBEGIN_EVENT_TABLE(MyEvtTestButton, wxButton)
// Add a static handler to this button itself for its own event
EVT_BUTTON(BUTTON_ID, MyEvtTestButton::OnClickStaticHandler)
wxEND_EVENT_TABLE()
// This can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Event_Quit, MyFrame::OnQuit)
EVT_MENU(Event_About, MyFrame::OnAbout)
EVT_MENU(Event_Bind, MyFrame::OnBind)
EVT_MENU(Event_Connect, MyFrame::OnConnect)
EVT_MENU(Event_Custom, MyFrame::OnFireCustom)
EVT_MENU(Event_Test, MyFrame::OnTest)
EVT_MENU(Event_Push, MyFrame::OnPushEventHandler)
EVT_MENU(Event_Pop, MyFrame::OnPopEventHandler)
EVT_MENU(Event_Gesture, MyFrame::OnGesture)
EVT_MENU(Event_NewEventClass, MyFrame::OnNewEventClass)
EVT_UPDATE_UI(Event_Pop, MyFrame::OnUpdateUIPop)
EVT_MY_CUSTOM_COMMAND(wxID_ANY, MyFrame::OnProcessCustom)
// the line below would also work if OnProcessCustom() were defined as
// taking a wxEvent (as required by EVT_CUSTOM) and not wxCommandEvent
//EVT_CUSTOM(wxEVT_MY_CUSTOM_COMMAND, wxID_ANY, MyFrame::OnProcessCustom)
// Add a static handler in the parent frame for button event
EVT_BUTTON(MyEvtTestButton::BUTTON_ID, MyFrame::OnClickStaticHandlerFrame)
wxEND_EVENT_TABLE()
wxBEGIN_EVENT_TABLE(MyEvtHandler, wxEvtHandler)
EVT_MENU(Event_Test, MyEvtHandler::OnTest)
wxEND_EVENT_TABLE()
// Create a new application object: this macro will allow wxWidgets to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
wxIMPLEMENT_APP(MyApp);
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// the application class
// ----------------------------------------------------------------------------
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
// create the main application window
MyFrame *frame = new MyFrame("Event wxWidgets Sample",
wxPoint(50, 50), wxSize(600, 340));
// and show it (the frames, unlike simple controls, are not shown when
// created initially)
frame->Show(true);
// Add a dynamic handler at the application level for the test button
Bind(wxEVT_BUTTON, &MyApp::OnClickDynamicHandlerApp, this,
MyEvtTestButton::BUTTON_ID);
// 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;
}
// This is always the first to handle an event !
int MyApp::FilterEvent(wxEvent& event)
{
if ( event.GetEventType() == wxEVT_BUTTON &&
event.GetId() == MyEvtTestButton::BUTTON_ID )
{
wxLogMessage("Step 0 in \"How Events are Processed\":\n"
"App::FilterEvent");
}
return wxApp::FilterEvent(event);
}
void MyApp::OnClickDynamicHandlerApp(wxCommandEvent& event)
{
wxLogMessage("Step 7, 3 in \"How Events are Processed\":\n"
"App::DynamicHandler_InAppTable");
event.Skip();
}
void MyApp::OnClickStaticHandlerApp(wxCommandEvent& event)
{
wxLogMessage("Step 7, 4 in \"How Events are Processed\":\n"
"App::StaticHandler_InAppTable");
wxLogMessage("Button click processed, there should be no more messages "
"about handling events from the button.\n\n"
"The log below shows the order in which the handlers "
"were executed.");
wxLog::FlushActive();
event.Skip();
}
// ----------------------------------------------------------------------------
// main frame
// ----------------------------------------------------------------------------
// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(nullptr, wxID_ANY, title, pos, size)
{
SetIcon(wxICON(sample));
// init members
m_nPush = 0;
m_btnDynamic = nullptr;
// create a menu bar
wxMenu *menuFile = new wxMenu;
menuFile->Append(Event_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator();
menuFile->Append(Event_Quit, "E&xit\tAlt-X", "Quit this program");
wxMenu *menuEvent = new wxMenu;
menuEvent->AppendCheckItem(Event_Bind, "&Bind\tCtrl-B",
"Bind or unbind a dynamic event handler");
menuEvent->AppendCheckItem(Event_Connect, "&Connect\tCtrl-C",
"Connect or disconnect the dynamic event handler");
menuEvent->Append(Event_Dynamic, "&Dynamic event\tCtrl-D",
"Dynamic event sample - only works after Connect");
menuEvent->AppendSeparator();
menuEvent->Append(Event_Push, "&Push event handler\tCtrl-P",
"Push event handler for test event");
menuEvent->Append(Event_Pop, "P&op event handler\tCtrl-O",
"Pop event handler for test event");
menuEvent->Append(Event_Test, "Test event\tCtrl-T",
"Test event processed by pushed event handler");
menuEvent->AppendSeparator();
menuEvent->Append(Event_Custom, "Fire c&ustom event\tCtrl-U",
"Generate a custom event");
menuEvent->Append(Event_Gesture, "&Gesture events\tCtrl-G",
"Gesture event");
menuEvent->Append(Event_NewEventClass, "&New wxEvent class demo\tCtrl-N",
"Demonstrates a new wxEvent-derived class");
// now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, "&File");
menuBar->Append(menuEvent, "&Event");
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
CreateStatusBar(3);
SetStatusText("Welcome to wxWidgets event sample");
SetStatusText("Dynamic: off", Status_Dynamic);
SetStatusText("Push count: 0", Status_Push);
#endif // wxUSE_STATUSBAR
wxPanel * const panel = new wxPanel(this);
wxSizer * const mainSizer = new wxBoxSizer(wxVERTICAL);
wxSizer * const sizer = new wxBoxSizer(wxHORIZONTAL);
const wxSizerFlags centreY(wxSizerFlags().Centre().Border());
sizer->Add(new wxStaticText(panel, wxID_ANY,
"This button will only work if its handler is dynamically connected"),
centreY);
m_btnDynamic = new wxButton(panel, Event_Dynamic, "&Dynamic button");
sizer->Add(m_btnDynamic, centreY);
mainSizer->Add(sizer, 1, wxEXPAND);
mainSizer->Add(new wxStaticLine(panel), 0, wxEXPAND);
mainSizer->Add(new wxStaticLine(panel), 0, wxEXPAND);
m_testBtn = new MyEvtTestButton(panel, "Test Event Handlers Execution Order");
// After being created, an instance of MyEvtTestButton already has its own
// event handlers (see class definition);
// Add a dynamic handler for this button event in the parent frame
Bind(wxEVT_BUTTON, &MyFrame::OnClickDynamicHandlerFrame, this,
m_testBtn->GetId());
// Bind a method of this frame (notice "this" argument!) to the button
// itself
m_testBtn->Bind(wxEVT_BUTTON, &MyFrame::OnClickDynamicHandlerButton, this);
mainSizer->Add(m_testBtn);
panel->SetSizer(mainSizer);
}
MyFrame::~MyFrame()
{
// we must pop any remaining event handlers to avoid memory leaks and
// crashes!
while ( m_nPush-- != 0 )
{
PopEventHandler(true /* delete handler */);
}
}
// ----------------------------------------------------------------------------
// standard event handlers
// ----------------------------------------------------------------------------
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
if ( m_gestureFrame )
m_gestureFrame->Close(true);
Close(true);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox("Event sample shows different ways of using events\n"
"(c) 2001-2009 Vadim Zeitlin",
"About wxWidgets Event Sample",
wxOK | wxICON_INFORMATION, this);
}
void MyFrame::OnClickStaticHandlerFrame(wxCommandEvent& event)
{
wxLogMessage("Step 6, 4 in \"How Events are Processed\":\n"
"parentWin::StaticHandler_InFrameTable");
event.Skip();
}
// ----------------------------------------------------------------------------
// dynamic event handling stuff
// ----------------------------------------------------------------------------
void MyFrame::OnClickDynamicHandlerFrame(wxCommandEvent& event)
{
wxLogMessage("Step 6, 3 in \"How Events are Processed\":\n"
"parentWin::DynamicHandler_InFrameTable");
event.Skip();
}
void MyFrame::OnClickDynamicHandlerButton(wxCommandEvent& event)
{
wxLogMessage("Step 3 in \"How Events are Processed\":\n"
"parentWin::DynamicHandler_InButtonTable");
event.Skip();
}
void MyFrame::OnDynamic(wxCommandEvent& event)
{
wxString origin;
if ( event.GetEventObject() == this )
origin = "menu item";
else if ( event.GetEventObject() == m_btnDynamic )
origin = "button";
else
origin = "unknown event source";
wxMessageBox
(
"This message box is shown from the dynamically connected "
"event handler in response to event generated by " + origin,
"wxWidgets Event Sample", wxOK | wxICON_INFORMATION, this
);
}
void MyFrame::OnBind(wxCommandEvent& event)
{
if ( event.IsChecked() )
{
// as we bind directly to the button, there is no need to use an id
// here: the button will only ever get its own events
m_btnDynamic->Bind(wxEVT_BUTTON, &MyFrame::OnDynamic,
this);
// but we do need the id for the menu command as the frame gets all of
// them
Bind(wxEVT_MENU, &MyFrame::OnDynamic, this,
Event_Dynamic);
}
else // disconnect
{
m_btnDynamic->Unbind(wxEVT_BUTTON,
&MyFrame::OnDynamic, this);
Unbind(wxEVT_MENU, &MyFrame::OnDynamic, this,
Event_Dynamic);
}
UpdateDynamicStatus(event.IsChecked());
}
void MyFrame::OnConnect(wxCommandEvent& event)
{
if ( event.IsChecked() )
{
m_btnDynamic->Bind(wxEVT_BUTTON, &MyFrame::OnDynamic, this);
Bind(wxEVT_MENU, &MyFrame::OnDynamic, this, Event_Dynamic);
}
else // disconnect
{
m_btnDynamic->Unbind(wxEVT_BUTTON, &MyFrame::OnDynamic, this);
Unbind(wxEVT_MENU, &MyFrame::OnDynamic, this, Event_Dynamic);
}
UpdateDynamicStatus(event.IsChecked());
}
// ----------------------------------------------------------------------------
// push/pop event handlers support
// ----------------------------------------------------------------------------
void MyFrame::OnPushEventHandler(wxCommandEvent& WXUNUSED(event))
{
PushEventHandler(new MyEvtHandler(++m_nPush));
#if wxUSE_STATUSBAR
SetStatusText(wxString::Format("Push count: %u", m_nPush), Status_Push);
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
{
wxCHECK_RET( m_nPush, "this command should be disabled!" );
PopEventHandler(true /* delete handler */);
m_nPush--;
#if wxUSE_STATUSBAR
SetStatusText(wxString::Format("Push count: %u", m_nPush), Status_Push);
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnGesture(wxCommandEvent& WXUNUSED(event))
{
if ( m_gestureFrame )
{
m_gestureFrame->Raise();
}
else
{
m_gestureFrame = new MyGestureFrame();
m_gestureFrame->Show(true);
}
}
void MyFrame::OnNewEventClass(wxCommandEvent& WXUNUSED(event))
{
MyChessBoardDialog dlg(this);
dlg.ShowModal();
}
void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))
{
wxLogMessage("This is the test event handler in the main frame");
}
void MyFrame::OnUpdateUIPop(wxUpdateUIEvent& event)
{
event.Enable( m_nPush > 0 );
}
// ----------------------------------------------------------------------------
// custom event methods
// ----------------------------------------------------------------------------
void MyFrame::OnFireCustom(wxCommandEvent& WXUNUSED(event))
{
wxCommandEvent eventCustom(wxEVT_MY_CUSTOM_COMMAND);
wxPostEvent(this, eventCustom);
}
void MyFrame::OnProcessCustom(wxCommandEvent& WXUNUSED(event))
{
wxLogMessage("Got a custom event!");
}

View File

@@ -0,0 +1,452 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DLL Debug|Win32">
<Configuration>DLL Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DLL Debug|x64">
<Configuration>DLL Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DLL Release|Win32">
<Configuration>DLL Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DLL Release|x64">
<Configuration>DLL Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{77F14BA7-0EFE-4657-B144-8D8942467056}</ProjectGuid>
</PropertyGroup>
<Import Project="..\..\build\msw\wx_config.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="..\..\build\msw\wx_setup.props" />
<Import Project="..\..\build\msw\wx_local.props" Condition="Exists('..\..\build\msw\wx_local.props')" />
<Import Project="..\samples.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>14.0.24720.0</_ProjectFileVersion>
<OutDir>$(wxIntRootDir)</OutDir>
<IntDir>$(wxIntRootDir)$(ProjectName)\</IntDir>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">
<Midl>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">
<Midl>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>.\..\..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxwebp$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>./../../include/wx/msw/wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="chessboard.cpp" />
<ClCompile Include="event.cpp" />
<ClCompile Include="gestures.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\sample.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="event.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="chessboard.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gestures.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\sample.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,248 @@
#include "gestures.h"
#include "wx/dcgraph.h"
#include "wx/dcbuffer.h"
#include "../image/horse.xpm"
MyGestureFrame::MyGestureFrame()
: wxFrame(nullptr, wxID_ANY, "Multi-touch Gestures", wxDefaultPosition, wxSize(800, 600))
{
// Create controls
MyGesturePanel *myPanel = new MyGesturePanel(this);
m_logText = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize(wxDefaultCoord, 100), wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH);
// Add controls to sizer
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(myPanel, wxSizerFlags(1).Expand());
sizer->Add(m_logText, wxSizerFlags().Expand());
SetSizer(sizer);
// Set a minimum size for the frame
wxSize dsplySz = wxGetDisplaySize();
SetSizeHints(wxMin(800,dsplySz.GetWidth()), wxMin(600,dsplySz.GetHeight()));
// Log to the text control
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logText));
// Bind all gestures to the same event handler, which must run before
// the other handlers, to clear the log window
myPanel->Bind(wxEVT_GESTURE_PAN, &MyGestureFrame::OnGesture, this);
myPanel->Bind(wxEVT_GESTURE_ZOOM, &MyGestureFrame::OnGesture, this);
myPanel->Bind(wxEVT_GESTURE_ROTATE, &MyGestureFrame::OnGesture, this);
myPanel->Bind(wxEVT_TWO_FINGER_TAP, &MyGestureFrame::OnGesture, this);
myPanel->Bind(wxEVT_LONG_PRESS, &MyGestureFrame::OnGesture, this);
myPanel->Bind(wxEVT_PRESS_AND_TAP, &MyGestureFrame::OnGesture, this);
Bind(wxEVT_CLOSE_WINDOW, &MyGestureFrame::OnQuit, this);
}
MyGesturePanel::MyGesturePanel(MyGestureFrame *parent)
: wxPanel(parent, wxID_ANY),
m_bitmap(horse_xpm)
{
SetBackgroundStyle(wxBG_STYLE_PAINT);
Bind(wxEVT_PAINT, &MyGesturePanel::OnPaint, this);
if ( !EnableTouchEvents(wxTOUCH_ALL_GESTURES) )
{
wxLogError("Failed to enable touch events");
// Still bind event handlers just in case they still work?
}
// Event handlers
Bind(wxEVT_GESTURE_PAN, &MyGesturePanel::OnPan, this);
Bind(wxEVT_GESTURE_ZOOM, &MyGesturePanel::OnZoom, this);
Bind(wxEVT_GESTURE_ROTATE, &MyGesturePanel::OnRotate, this);
Bind(wxEVT_TWO_FINGER_TAP, &MyGesturePanel::OnTwoFingerTap, this);
Bind(wxEVT_LONG_PRESS, &MyGesturePanel::OnLongPress, this);
Bind(wxEVT_PRESS_AND_TAP, &MyGesturePanel::OnPressAndTap, this);
m_lastZoomFactor = 1.0;
}
void MyGestureFrame::OnQuit(wxCloseEvent& WXUNUSED(event))
{
delete wxLog::SetActiveTarget(m_logOld);
Destroy();
}
void MyGestureFrame::OnGesture(wxGestureEvent& event)
{
if ( event.IsGestureStart() )
m_logText->Clear();
event.Skip();
}
void MyGesturePanel::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxAutoBufferedPaintDC paintDC(this);
paintDC.Clear();
wxGCDC dc(paintDC);
dc.SetTransformMatrix(m_affineMatrix);
dc.DrawBitmap(m_bitmap, 0, 0);
}
void MyGesturePanel::OnPan(wxPanGestureEvent& event)
{
if ( event.IsGestureStart() )
{
wxLogMessage("Pan gesture started");
}
const wxPoint delta = event.GetDelta();
wxLogMessage("Pan gesture performed with delta = (%d,%d), "
"with current position (%d,%d)",
delta.x, delta.y,
event.GetPosition().x, event.GetPosition().y);
// Transform the distance using the transpose of the matrix,
// in order to translate the image to match the screen coordinates
wxMatrix2D m;
wxPoint2DDouble tr;
m_affineMatrix.Get(&m, &tr);
tr += event.GetDelta();
m_affineMatrix.Set(m, tr);
if ( event.IsGestureEnd() )
{
wxLogMessage("Pan gesture ended");
}
Refresh();
}
void MyGesturePanel::OnZoom(wxZoomGestureEvent& event)
{
if ( event.IsGestureStart() )
{
wxLogMessage("Zoom gesture started");
m_lastZoomFactor = 1.0;
m_lastGesturePos = event.GetPosition();
}
wxLogMessage("Zoom gesture performed with zoom center at (%d, %d) and zoom Factor = %f",
event.GetPosition().x, event.GetPosition().y, event.GetZoomFactor());
const wxPoint &evtPos = event.GetPosition();
double factor = event.GetZoomFactor() / m_lastZoomFactor;
wxMatrix2D m;
wxPoint2DDouble tr;
m_affineMatrix.Get(&m, &tr);
tr -= m_lastGesturePos;
wxAffineMatrix2D inv = m_affineMatrix;
inv.Invert();
tr = inv.TransformDistance(tr);
m_affineMatrix.Scale(factor, factor);
tr = m_affineMatrix.TransformDistance(tr);
tr += evtPos;
m_affineMatrix.Get(&m, nullptr);
m_affineMatrix.Set(m, tr);
if ( event.IsGestureEnd() )
{
wxLogMessage("Zoom gesture ended");
}
m_lastZoomFactor = event.GetZoomFactor();
m_lastGesturePos = evtPos;
Refresh();
}
void MyGesturePanel::OnRotate(wxRotateGestureEvent& event)
{
if ( event.IsGestureStart() )
{
wxLogMessage("Rotate gesture started");
m_lastRotationAngle = 0.0;
}
wxLogMessage("Rotate gesture performed with rotation center at (%d, %d) and cumulative rotation angle = %f",
event.GetPosition().x, event.GetPosition().y, event.GetRotationAngle());
const wxPoint& evtPos = event.GetPosition();
wxMatrix2D m;
wxPoint2DDouble tr;
m_affineMatrix.Get(&m, &tr);
tr -= evtPos;
wxAffineMatrix2D inv = m_affineMatrix;
inv.Invert();
tr = inv.TransformDistance(tr);
m_affineMatrix.Rotate(event.GetRotationAngle() - m_lastRotationAngle);
tr = m_affineMatrix.TransformDistance(tr);
tr += evtPos;
m_affineMatrix.Get(&m, nullptr);
m_affineMatrix.Set(m, tr);
if ( event.IsGestureEnd() )
{
wxLogMessage("Rotate gesture ended");
}
m_lastRotationAngle = event.GetRotationAngle();
Refresh();
}
void MyGesturePanel::OnTwoFingerTap(wxTwoFingerTapEvent& event)
{
if ( event.IsGestureStart() )
{
wxLogMessage("Two Finger Tap gesture gesture started");
}
wxLogMessage("Two Finger Tap gesture performed at (%d, %d)", event.GetPosition().x, event.GetPosition().y);
if ( event.IsGestureEnd() )
{
wxLogMessage("Two Finger Tap gesture ended");
}
}
void MyGesturePanel::OnLongPress(wxLongPressEvent& event)
{
if ( event.IsGestureStart() )
{
wxLogMessage("Long Press gesture started");
}
wxLogMessage("Long Press gesture performed at (%d,%d)", event.GetPosition().x, event.GetPosition().y);
if ( event.IsGestureEnd() )
{
wxLogMessage("Long Press gesture ended");
}
}
void MyGesturePanel::OnPressAndTap(wxPressAndTapEvent& event)
{
if ( event.IsGestureStart() )
{
wxLogMessage("Press and Tap gesture started");
}
wxLogMessage("Press and Tap gesture performed at (%d,%d)", event.GetPosition().x, event.GetPosition().y);
if ( event.IsGestureEnd() )
{
wxLogMessage("Press and Tap gesture ended");
}
}

View File

@@ -0,0 +1,41 @@
#ifndef _WX_GESTURES_H_
#define _WX_GESTURES_H_
#include "wx/wx.h"
class MyGestureFrame : public wxFrame
{
public:
MyGestureFrame();
void OnGesture(wxGestureEvent& event);
void OnQuit(wxCloseEvent& event);
private:
wxLog *m_logOld;
wxTextCtrl *m_logText;
};
class MyGesturePanel : public wxPanel
{
public:
MyGesturePanel(MyGestureFrame* parent);
void OnPaint(wxPaintEvent& event);
void OnPan(wxPanGestureEvent& event);
void OnZoom(wxZoomGestureEvent& event);
void OnRotate(wxRotateGestureEvent& event);
void OnTwoFingerTap(wxTwoFingerTapEvent& event);
void OnLongPress(wxLongPressEvent& event);
void OnPressAndTap(wxPressAndTapEvent& event);
private:
wxBitmap m_bitmap;
wxPoint2DDouble m_translateDistance;
wxAffineMatrix2D m_affineMatrix;
double m_lastZoomFactor;
double m_lastRotationAngle;
wxPoint m_lastGesturePos;
};
#endif // _WX_GESTURES_H_

View File

@@ -0,0 +1,236 @@
# =========================================================================
# 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)
EVENT_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)
EVENT_OBJECTS = \
$(OBJS)\event_sample_rc.o \
$(OBJS)\event_event.o \
$(OBJS)\event_gestures.o \
$(OBJS)\event_chessboard.o
### Conditionally set variables: ###
ifeq ($(USE_GUI),0)
PORTNAME = base
endif
ifeq ($(USE_GUI),1)
PORTNAME = msw$(TOOLKIT_VERSION)
endif
ifeq ($(OFFICIAL_BUILD),1)
COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
endif
ifeq ($(BUILD),debug)
WXDEBUGFLAG = d
endif
ifeq ($(WXUNIV),1)
WXUNIVNAME = univ
endif
ifeq ($(SHARED),1)
WXDLLFLAG = dll
endif
ifeq ($(SHARED),0)
LIBTYPE_SUFFIX = lib
endif
ifeq ($(SHARED),1)
LIBTYPE_SUFFIX = dll
endif
ifeq ($(MONOLITHIC),0)
EXTRALIBS_FOR_BASE =
endif
ifeq ($(MONOLITHIC),1)
EXTRALIBS_FOR_BASE =
endif
ifeq ($(BUILD),debug)
__OPTIMIZEFLAG_2 = -O0
endif
ifeq ($(BUILD),release)
__OPTIMIZEFLAG_2 = -O2
endif
ifeq ($(USE_RTTI),0)
__RTTIFLAG_5 = -fno-rtti
endif
ifeq ($(USE_RTTI),1)
__RTTIFLAG_5 =
endif
ifeq ($(USE_EXCEPTIONS),0)
__EXCEPTIONSFLAG_6 = -fno-exceptions
endif
ifeq ($(USE_EXCEPTIONS),1)
__EXCEPTIONSFLAG_6 =
endif
ifeq ($(WXUNIV),1)
__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
endif
ifeq ($(WXUNIV),1)
__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
endif
ifeq ($(DEBUG_FLAG),0)
__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
endif
ifeq ($(DEBUG_FLAG),0)
__DEBUG_DEFINE_p_1 = --define wxDEBUG_LEVEL=0
endif
ifeq ($(BUILD),release)
__NDEBUG_DEFINE_p = -DNDEBUG
endif
ifeq ($(BUILD),release)
__NDEBUG_DEFINE_p_1 = --define NDEBUG
endif
ifeq ($(USE_EXCEPTIONS),0)
__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
endif
ifeq ($(USE_EXCEPTIONS),0)
__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
endif
ifeq ($(USE_RTTI),0)
__RTTI_DEFINE_p = -DwxNO_RTTI
endif
ifeq ($(USE_RTTI),0)
__RTTI_DEFINE_p_1 = --define wxNO_RTTI
endif
ifeq ($(USE_THREADS),0)
__THREAD_DEFINE_p = -DwxNO_THREADS
endif
ifeq ($(USE_THREADS),0)
__THREAD_DEFINE_p_1 = --define wxNO_THREADS
endif
ifeq ($(USE_CAIRO),1)
____CAIRO_INCLUDEDIR_FILENAMES_p = -I$(CAIRO_ROOT)\include\cairo
endif
ifeq ($(USE_CAIRO),1)
__CAIRO_INCLUDEDIR_p = --include-dir $(CAIRO_ROOT)/include/cairo
endif
ifeq ($(SHARED),1)
__DLLFLAG_p = -DWXUSINGDLL
endif
ifeq ($(SHARED),1)
__DLLFLAG_p_1 = --define WXUSINGDLL
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_CORE_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_BASE_p = -lwxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
endif
ifeq ($(MONOLITHIC),1)
__WXLIB_MONO_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
endif
ifeq ($(MONOLITHIC),1)
ifeq ($(USE_STC),1)
__LIB_SCINTILLA_IF_MONO_p = -lwxscintilla$(WXDEBUGFLAG)
endif
endif
ifeq ($(MONOLITHIC),1)
ifeq ($(USE_STC),1)
__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
endif
endif
ifeq ($(USE_STC),1)
__LIB_LEXILLA_p = -lwxlexilla$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_TIFF_p = -lwxtiff$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_JPEG_p = -lwxjpeg$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_PNG_p = -lwxpng$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_WEBP_p = -lwxwebp$(WXDEBUGFLAG)
endif
ifeq ($(USE_CAIRO),1)
__CAIRO_LIB_p = -lcairo
endif
ifeq ($(USE_CAIRO),1)
____CAIRO_LIBDIR_FILENAMES_p = -L$(CAIRO_ROOT)\lib
endif
ifeq ($(BUILD),debug)
ifeq ($(DEBUG_INFO),default)
__DEBUGINFO = -g
endif
endif
ifeq ($(BUILD),release)
ifeq ($(DEBUG_INFO),default)
__DEBUGINFO =
endif
endif
ifeq ($(DEBUG_INFO),0)
__DEBUGINFO =
endif
ifeq ($(DEBUG_INFO),1)
__DEBUGINFO = -g
endif
ifeq ($(USE_THREADS),0)
__THREADSFLAG =
endif
ifeq ($(USE_THREADS),1)
__THREADSFLAG = -mthreads
endif
all: $(OBJS)
$(OBJS):
-if not exist $(OBJS) mkdir $(OBJS)
### Targets: ###
all: $(OBJS)\event.exe
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
-if exist $(OBJS)\*.d del $(OBJS)\*.d
-if exist $(OBJS)\event.exe del $(OBJS)\event.exe
$(OBJS)\event.exe: $(EVENT_OBJECTS) $(OBJS)\event_sample_rc.o
$(foreach f,$(subst \,/,$(EVENT_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lgdiplus -lmsimg32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
@-del $@.rsp
$(OBJS)\event_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)\event_event.o: ./event.cpp
$(CXX) -c -o $@ $(EVENT_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\event_gestures.o: ./gestures.cpp
$(CXX) -c -o $@ $(EVENT_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\event_chessboard.o: ./chessboard.cpp
$(CXX) -c -o $@ $(EVENT_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all clean
SHELL := $(COMSPEC)
# Dependencies tracking:
-include $(OBJS)/*.d

View 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)
EVENT_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) \
$(CXXFLAGS)
EVENT_OBJECTS = \
event_event.o \
event_gestures.o \
event_chessboard.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 event
install:
uninstall:
clean:
rm -f ./*.o
rm -f ./*.d
rm -f event
test_for_selected_wxbuild:
@$(WX_CONFIG) $(WX_CONFIG_FLAGS)
event: $(EVENT_OBJECTS)
$(CXX) -o $@ $(EVENT_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs core,base`
event_event.o: ./event.cpp
$(CXX) -c -o $@ $(EVENT_CXXFLAGS) $(CPPDEPS) $<
event_gestures.o: ./gestures.cpp
$(CXX) -c -o $@ $(EVENT_CXXFLAGS) $(CPPDEPS) $<
event_chessboard.o: ./chessboard.cpp
$(CXX) -c -o $@ $(EVENT_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all install uninstall clean
# Dependencies tracking:
-include ./*.d

View File

@@ -0,0 +1,449 @@
# =========================================================================
# 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)
EVENT_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
$(__DEBUGINFO_0) /Fd$(OBJS)\event.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)
EVENT_OBJECTS = \
$(OBJS)\event_event.obj \
$(OBJS)\event_gestures.obj \
$(OBJS)\event_chessboard.obj
EVENT_RESOURCES = \
$(OBJS)\event_sample.res
### Conditionally set variables: ###
!if "$(TARGET_CPU)" == "AMD64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "ARM"
ARCH_SUFFIX = _arm
!endif
!if "$(TARGET_CPU)" == "ARM64"
ARCH_SUFFIX = _arm64
!endif
!if "$(TARGET_CPU)" == "IA64"
ARCH_SUFFIX = _ia64
!endif
!if "$(TARGET_CPU)" == "X64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "amd64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "arm"
ARCH_SUFFIX = _arm
!endif
!if "$(TARGET_CPU)" == "arm64"
ARCH_SUFFIX = _arm64
!endif
!if "$(TARGET_CPU)" == "ia64"
ARCH_SUFFIX = _ia64
!endif
!if "$(TARGET_CPU)" == "x64"
ARCH_SUFFIX = _x64
!endif
!if "$(USE_GUI)" == "0"
PORTNAME = base
!endif
!if "$(USE_GUI)" == "1"
PORTNAME = msw$(TOOLKIT_VERSION)
!endif
!if "$(OFFICIAL_BUILD)" == "1"
COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
WXDEBUGFLAG = d
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
WXDEBUGFLAG = d
!endif
!if "$(WXUNIV)" == "1"
WXUNIVNAME = univ
!endif
!if "$(SHARED)" == "1"
WXDLLFLAG = dll
!endif
!if "$(SHARED)" == "0"
LIBTYPE_SUFFIX = lib
!endif
!if "$(SHARED)" == "1"
LIBTYPE_SUFFIX = dll
!endif
!if "$(TARGET_CPU)" == "AMD64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "ARM"
LINK_TARGET_CPU = /MACHINE:ARM
!endif
!if "$(TARGET_CPU)" == "ARM64"
LINK_TARGET_CPU = /MACHINE:ARM64
!endif
!if "$(TARGET_CPU)" == "IA64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(TARGET_CPU)" == "X64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "amd64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "arm"
LINK_TARGET_CPU = /MACHINE:ARM
!endif
!if "$(TARGET_CPU)" == "arm64"
LINK_TARGET_CPU = /MACHINE:ARM64
!endif
!if "$(TARGET_CPU)" == "ia64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(TARGET_CPU)" == "x64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "17.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "17.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(MONOLITHIC)" == "0"
EXTRALIBS_FOR_BASE =
!endif
!if "$(MONOLITHIC)" == "1"
EXTRALIBS_FOR_BASE =
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_0 = /Zi
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_0 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_0 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_0 = /Zi
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_1 = /DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_1 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_1 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_1 = /DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_2 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_2 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p = /D_DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
____DEBUGRUNTIME_3_p =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
____DEBUGRUNTIME_3_p = /D_DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p_1 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
____DEBUGRUNTIME_3_p_1 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_4 = d
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_4 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__DEBUGRUNTIME_4 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
__DEBUGRUNTIME_4 = d
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_5 =
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
__DEBUGRUNTIME_5 =
!endif
!if "$(BUILD)" == "debug"
__OPTIMIZEFLAG_6 = /Od
!endif
!if "$(BUILD)" == "release"
__OPTIMIZEFLAG_6 = /O2
!endif
!if "$(USE_THREADS)" == "0"
__THREADSFLAG_9 = L
!endif
!if "$(USE_THREADS)" == "1"
__THREADSFLAG_9 = T
!endif
!if "$(RUNTIME_LIBS)" == "dynamic"
__RUNTIME_LIBS_10 = D
!endif
!if "$(RUNTIME_LIBS)" == "static"
__RUNTIME_LIBS_10 = $(__THREADSFLAG_9)
!endif
!if "$(USE_RTTI)" == "0"
__RTTIFLAG_11 = /GR-
!endif
!if "$(USE_RTTI)" == "1"
__RTTIFLAG_11 = /GR
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONSFLAG_12 =
!endif
!if "$(USE_EXCEPTIONS)" == "1"
__EXCEPTIONSFLAG_12 = /EHsc
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
!endif
!if "$(TARGET_CPU)" == ""
__TARGET_CPU_COMPFLAG_p = /DTARGET_CPU_COMPFLAG=0
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
__TARGET_CPU_COMPFLAG_p =
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
__TARGET_CPU_COMPFLAG_p =
!endif
!if "$(TARGET_CPU)" == ""
__TARGET_CPU_COMPFLAG_p_1 = /d TARGET_CPU_COMPFLAG=0
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
__TARGET_CPU_COMPFLAG_p_1 =
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
__TARGET_CPU_COMPFLAG_p_1 =
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p = /D__WXUNIVERSAL__
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p_1 = /d __WXUNIVERSAL__
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p = /DwxDEBUG_LEVEL=0
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p_1 = /d wxDEBUG_LEVEL=0
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__NDEBUG_DEFINE_p = /DNDEBUG
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__NDEBUG_DEFINE_p = /DNDEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__NDEBUG_DEFINE_p_1 = /d NDEBUG
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__NDEBUG_DEFINE_p_1 = /d NDEBUG
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p = /DwxNO_EXCEPTIONS
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p_1 = /d wxNO_EXCEPTIONS
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p = /DwxNO_RTTI
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p_1 = /d wxNO_RTTI
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p = /DwxNO_THREADS
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p_1 = /d wxNO_THREADS
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES_p = /I$(CAIRO_ROOT)\include\cairo
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES_1_p = /i $(CAIRO_ROOT)\include\cairo
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p = /DWXUSINGDLL
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p_1 = /d WXUSINGDLL
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_CORE_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_BASE_p = \
wxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(MONOLITHIC)" == "1"
__WXLIB_MONO_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(MONOLITHIC)" == "1" && "$(USE_STC)" == "1"
__LIB_SCINTILLA_IF_MONO_p = wxscintilla$(WXDEBUGFLAG).lib
!endif
!if "$(MONOLITHIC)" == "1" && "$(USE_STC)" == "1"
__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
!endif
!if "$(USE_STC)" == "1"
__LIB_LEXILLA_p = wxlexilla$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_WEBP_p = wxwebp$(WXDEBUGFLAG).lib
!endif
!if "$(USE_CAIRO)" == "1"
__CAIRO_LIB_p = cairo.lib
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_LIBDIR_FILENAMES_p = /LIBPATH:$(CAIRO_ROOT)\lib
!endif
all: $(OBJS)
$(OBJS):
-if not exist $(OBJS) mkdir $(OBJS)
### Targets: ###
all: $(OBJS)\event.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)\event.exe del $(OBJS)\event.exe
-if exist $(OBJS)\event.ilk del $(OBJS)\event.ilk
-if exist $(OBJS)\event.pdb del $(OBJS)\event.pdb
$(OBJS)\event.exe: $(EVENT_OBJECTS) $(OBJS)\event_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\event.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(EVENT_OBJECTS) $(EVENT_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib gdiplus.lib msimg32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
<<
$(OBJS)\event_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)\event_event.obj: .\event.cpp
$(CXX) /c /nologo /TP /Fo$@ $(EVENT_CXXFLAGS) .\event.cpp
$(OBJS)\event_gestures.obj: .\gestures.cpp
$(CXX) /c /nologo /TP /Fo$@ $(EVENT_CXXFLAGS) .\gestures.cpp
$(OBJS)\event_chessboard.obj: .\chessboard.cpp
$(CXX) /c /nologo /TP /Fo$@ $(EVENT_CXXFLAGS) .\chessboard.cpp