added wxAnimationCtrl (patch 1570325)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
209
samples/animate/Makefile.in
Normal file
209
samples/animate/Makefile.in
Normal file
@@ -0,0 +1,209 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.2.0 (http://bakefile.sourceforge.net)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
|
||||
@MAKE_SET@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
INSTALL = @INSTALL@
|
||||
EXEEXT = @EXEEXT@
|
||||
WINDRES = @WINDRES@
|
||||
REZ = @REZ@
|
||||
SETFILE = @SETFILE@
|
||||
NM = @NM@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS_GUI = @LDFLAGS_GUI@
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
|
||||
TOOLKIT = @TOOLKIT@
|
||||
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
|
||||
TOOLKIT_VERSION = @TOOLKIT_VERSION@
|
||||
TOOLCHAIN_FULLNAME = @TOOLCHAIN_FULLNAME@
|
||||
EXTRALIBS = @EXTRALIBS@
|
||||
EXTRALIBS_GUI = @EXTRALIBS_GUI@
|
||||
EXTRALIBS_SDL = @EXTRALIBS_SDL@
|
||||
HOST_SUFFIX = @HOST_SUFFIX@
|
||||
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
|
||||
SAMPLES_RPATH_POSTLINK = @SAMPLES_RPATH_POSTLINK@
|
||||
|
||||
### Variables: ###
|
||||
|
||||
DESTDIR =
|
||||
WX_RELEASE = 2.7
|
||||
WX_VERSION = $(WX_RELEASE).0
|
||||
LIBDIRNAME = $(top_builddir)lib
|
||||
ANITEST_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
||||
-I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples $(CPPFLAGS) $(CXXFLAGS)
|
||||
ANITEST_OBJECTS = \
|
||||
$(__anitest_os2_lib_res) \
|
||||
anitest_anitest.o \
|
||||
$(__anitest___win32rc)
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@COND_DEPS_TRACKING_0@CXXC = $(CXX)
|
||||
@COND_DEPS_TRACKING_1@CXXC = $(top_builddir)./bk-deps $(CXX)
|
||||
@COND_USE_PLUGINS_0@PLUGIN_ADV_EXTRALIBS = $(EXTRALIBS_SDL)
|
||||
@COND_USE_GUI_0@PORTNAME = base
|
||||
@COND_USE_GUI_1@PORTNAME = $(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
|
||||
@COND_TOOLKIT_MAC@WXBASEPORT = _carbon
|
||||
@COND_BUILD_DEBUG_DEBUG_FLAG_DEFAULT@WXDEBUGFLAG = d
|
||||
@COND_DEBUG_FLAG_1@WXDEBUGFLAG = d
|
||||
@COND_UNICODE_1@WXUNICODEFLAG = u
|
||||
@COND_WXUNIV_1@WXUNIVNAME = univ
|
||||
@COND_MONOLITHIC_0@EXTRALIBS_FOR_BASE = $(EXTRALIBS)
|
||||
@COND_MONOLITHIC_1@EXTRALIBS_FOR_BASE = $(EXTRALIBS) $(EXTRALIBS_GUI)
|
||||
@COND_MONOLITHIC_0@EXTRALIBS_FOR_GUI = $(EXTRALIBS_GUI)
|
||||
@COND_MONOLITHIC_1@EXTRALIBS_FOR_GUI =
|
||||
@COND_PLATFORM_MAC_1@__anitest___mac_setfilecmd = \
|
||||
@COND_PLATFORM_MAC_1@ $(SETFILE) -a C anitest$(EXEEXT)
|
||||
@COND_PLATFORM_MAC_1@__anitest___mac_rezcmd = $(__MACOSX_RESOURCES_p_1)
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_1 = -d __WXUNIVERSAL__
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_2 = --define __WXUNIVERSAL__
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_1 = -d wxNO_EXCEPTIONS
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_2 = --define wxNO_EXCEPTIONS
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p_1 = -d wxNO_RTTI
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p_2 = --define wxNO_RTTI
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p_1 = -d wxNO_THREADS
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p_2 = --define wxNO_THREADS
|
||||
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
|
||||
@COND_SHARED_1@__DLLFLAG_p_1 = -d WXUSINGDLL
|
||||
@COND_SHARED_1@__DLLFLAG_p_2 = --define WXUSINGDLL
|
||||
COND_PLATFORM_OS2_1___anitest___os2_emxbindcmd = $(NM) anitest$(EXEEXT) | if \
|
||||
grep -q pmwin.763 ; then emxbind -ep anitest$(EXEEXT) ; fi
|
||||
@COND_PLATFORM_OS2_1@__anitest___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___anitest___os2_emxbindcmd)
|
||||
@COND_TOOLKIT_MSW@__RCDEFDIR_p = -i \
|
||||
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
|
||||
@COND_TOOLKIT_MSW@__RCDEFDIR_p_1 = --include-dir \
|
||||
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
|
||||
@COND_PLATFORM_OS2_1@__anitest_os2_lib_res = \
|
||||
@COND_PLATFORM_OS2_1@ $(top_srcdir)/include/wx/os2/wx.res
|
||||
@COND_PLATFORM_MACOSX_1@__anitest_bundle___depname = anitest_bundle
|
||||
@COND_TOOLKIT_COCOA@____anitest_BUNDLE_TGT_REF_DEP = \
|
||||
@COND_TOOLKIT_COCOA@ anitest.app/Contents/PkgInfo
|
||||
@COND_TOOLKIT_MAC@____anitest_BUNDLE_TGT_REF_DEP = \
|
||||
@COND_TOOLKIT_MAC@ anitest.app/Contents/PkgInfo
|
||||
COND_MONOLITHIC_0___WXLIB_ADV_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_ADV_p = $(COND_MONOLITHIC_0___WXLIB_ADV_p)
|
||||
COND_MONOLITHIC_0___WXLIB_CORE_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(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)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
|
||||
@COND_PLATFORM_WIN32_1@__anitest___win32rc = anitest_sample_rc.o
|
||||
COND_MONOLITHIC_1___WXLIB_MONO_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)
|
||||
@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_WXUSE_ZLIB_BUILTIN@__LIB_ZLIB_p = \
|
||||
@COND_WXUSE_ZLIB_BUILTIN@ -lwxzlib$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_WXUSE_ODBC_BUILTIN@__LIB_ODBC_p = \
|
||||
@COND_WXUSE_ODBC_BUILTIN@ -lwxodbc$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
COND_WXUSE_REGEX_BUILTIN___LIB_REGEX_p = \
|
||||
-lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_WXUSE_REGEX_BUILTIN@__LIB_REGEX_p = $(COND_WXUSE_REGEX_BUILTIN___LIB_REGEX_p)
|
||||
@COND_WXUSE_EXPAT_BUILTIN@__LIB_EXPAT_p = \
|
||||
@COND_WXUSE_EXPAT_BUILTIN@ -lwxexpat$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1 = $(REZ) -d __DARWIN__ -t APPL -d \
|
||||
__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) \
|
||||
$(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) -i $(srcdir) $(__DLLFLAG_p_1) -i \
|
||||
$(srcdir)/../../samples $(__RCDEFDIR_p) -i $(top_srcdir)/include -o \
|
||||
anitest$(EXEEXT) Carbon.r sample.r
|
||||
@COND_TOOLKIT_MAC@__MACOSX_RESOURCES_p_1 = $(COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1)
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: anitest$(EXEEXT) $(__anitest_bundle___depname) catalog
|
||||
|
||||
install: all
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip: install
|
||||
|
||||
clean:
|
||||
rm -rf ./.deps ./.pch
|
||||
rm -f ./*.o
|
||||
rm -f anitest$(EXEEXT)
|
||||
rm -rf anitest.app
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
|
||||
|
||||
anitest$(EXEEXT): $(ANITEST_OBJECTS) $(__anitest___win32rc)
|
||||
$(CXX) -o $@ $(ANITEST_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_ADV_p) $(PLUGIN_ADV_EXTRALIBS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_ODBC_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE)
|
||||
$(__anitest___mac_rezcmd)
|
||||
$(__anitest___mac_setfilecmd)
|
||||
$(__anitest___os2_emxbindcmd)
|
||||
$(SAMPLES_RPATH_POSTLINK)
|
||||
|
||||
anitest.app/Contents/PkgInfo: anitest$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns
|
||||
mkdir -p anitest.app/Contents
|
||||
mkdir -p anitest.app/Contents/MacOS
|
||||
mkdir -p anitest.app/Contents/Resources
|
||||
|
||||
|
||||
sed -e "s/IDENTIFIER/`echo $(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`/" \
|
||||
-e "s/EXECUTABLE/anitest/" \
|
||||
-e "s/VERSION/$(WX_VERSION)/" \
|
||||
$(top_srcdir)/src/mac/carbon/Info.plist.in >anitest.app/Contents/Info.plist
|
||||
|
||||
|
||||
echo -n "APPL????" >anitest.app/Contents/PkgInfo
|
||||
|
||||
|
||||
ln -f anitest$(EXEEXT) anitest.app/Contents/MacOS/anitest
|
||||
|
||||
|
||||
cp -f $(top_srcdir)/src/mac/carbon/wxmac.icns anitest.app/Contents/Resources/wxmac.icns
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@anitest_bundle: $(____anitest_BUNDLE_TGT_REF_DEP)
|
||||
|
||||
catalog:
|
||||
@mkdir -p .
|
||||
@for f in throbber.gif hourglass.ani; do \
|
||||
if test ! -f ./$$f -a ! -d ./$$f ; \
|
||||
then x=yep ; \
|
||||
else x=`find $(srcdir)/$$f -newer ./$$f -print` ; \
|
||||
fi; \
|
||||
case "$$x" in ?*) \
|
||||
cp -pRf $(srcdir)/$$f . ;; \
|
||||
esac; \
|
||||
done
|
||||
|
||||
anitest_anitest.o: $(srcdir)/anitest.cpp
|
||||
$(CXXC) -c -o $@ $(ANITEST_CXXFLAGS) $(srcdir)/anitest.cpp
|
||||
|
||||
anitest_sample_rc.o: $(srcdir)/../sample.rc
|
||||
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) $(__EXCEPTIONS_DEFINE_p_2) $(__RTTI_DEFINE_p_2) $(__THREAD_DEFINE_p_2) --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_1) --include-dir $(top_srcdir)/include
|
||||
|
||||
|
||||
# Include dependency info, if present:
|
||||
@IF_GNU_MAKE@-include .deps/*.d
|
||||
|
||||
.PHONY: all install uninstall clean distclean anitest_bundle catalog
|
20
samples/animate/anitest.bkl
Normal file
20
samples/animate/anitest.bkl
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" ?>
|
||||
<makefile>
|
||||
|
||||
<include file="../../../build/bakefiles/common_samples.bkl"/>
|
||||
|
||||
<exe id="anitest" template="wx_sample" template_append="wx_append">
|
||||
<sources>
|
||||
anitest.cpp
|
||||
</sources>
|
||||
<wx-lib>adv</wx-lib>
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
<win32-res>../sample.rc</win32-res>
|
||||
</exe>
|
||||
|
||||
<wx-data id="catalog">
|
||||
<files>throbber.gif hourglass.ani</files>
|
||||
</wx-data>
|
||||
|
||||
</makefile>
|
266
samples/animate/anitest.cpp
Normal file
266
samples/animate/anitest.cpp
Normal file
@@ -0,0 +1,266 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: anitest.cpp
|
||||
// Purpose: Animation sample
|
||||
// Author: Julian Smart
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 02/07/2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ===========================================================================
|
||||
// declarations
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#ifndef __WXMSW__
|
||||
#include "mondrian.xpm"
|
||||
#endif
|
||||
|
||||
#include "anitest.h"
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
enum
|
||||
{
|
||||
wxID_PLAY
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(wxID_PLAY, MyFrame::OnPlay)
|
||||
EVT_MENU(wxID_STOP, MyFrame::OnStop)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
||||
#if wxUSE_FILEDLG
|
||||
EVT_MENU(wxID_OPEN, MyFrame::OnOpen)
|
||||
#endif // wxUSE_FILEDLG
|
||||
|
||||
EVT_SIZE(MyFrame::OnSize)
|
||||
EVT_UPDATE_UI(wxID_ANY, MyFrame::OnUpdateUI)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// MyApp
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Initialise this in OnInit, not statically
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
// Create the main frame window
|
||||
|
||||
MyFrame* frame = new MyFrame((wxFrame *)NULL, -1, _T("Animation Demo"),
|
||||
wxPoint(-1, -1), wxSize(500, 400),
|
||||
wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
// Give it an icon
|
||||
#ifdef __WXMSW__
|
||||
frame->SetIcon(wxIcon(_T("mdi_icn")));
|
||||
#else
|
||||
frame->SetIcon(wxIcon( mondrian_xpm ));
|
||||
#endif
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
file_menu->Append(wxID_OPEN, _T("&Open Animation...\tCtrl+O"), _T("Loads an animation"));
|
||||
#endif // wxUSE_FILEDLG
|
||||
file_menu->Append(wxID_EXIT);
|
||||
|
||||
wxMenu *play_menu = new wxMenu;
|
||||
play_menu->Append(wxID_PLAY, _T("Play\tCtrl+P"), _T("Play the animation"));
|
||||
play_menu->Append(wxID_STOP, _T("Stop\tCtrl+P"), _T("Stop the animation"));
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(wxID_ABOUT);
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, _T("&File"));
|
||||
menu_bar->Append(play_menu, _T("&Animation"));
|
||||
menu_bar->Append(help_menu, _T("&Help"));
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
frame->CreateStatusBar();
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
frame->Show(true);
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// MyFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame(wxWindow *parent,
|
||||
const wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const long style)
|
||||
: wxFrame(parent, id, title, pos, size,
|
||||
style | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
//m_canvas = new MyCanvas(this, wxPoint(0, 0), wxDefaultSize);
|
||||
|
||||
//wxSizer *sz = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY, wxNullAnimation,
|
||||
wxPoint(0,0),wxSize(100,100));
|
||||
if (m_animationCtrl->LoadFile(wxT("throbber.gif")))
|
||||
m_animationCtrl->Play();
|
||||
|
||||
//sz->Add(m_animationCtrl, 1, wxGROW);
|
||||
|
||||
//SetSizer(sz);
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame()
|
||||
{
|
||||
}
|
||||
|
||||
void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (!m_animationCtrl->Play())
|
||||
wxLogError(wxT("Invalid animation"));
|
||||
}
|
||||
|
||||
void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_animationCtrl->Stop();
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
/*
|
||||
|
||||
FIXME: on wxGTK at least using File->About command it shows
|
||||
the message dialog but does not focus it
|
||||
|
||||
*/
|
||||
|
||||
(void)wxMessageBox(_T("wxWidgets 2 Animation Demo\n")
|
||||
_T("Author: Julian Smart (c) 2001\n"),
|
||||
_T("About Animation Demo"));
|
||||
}
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxFileDialog dialog(this, _T("Please choose an animation"),
|
||||
wxEmptyString, wxEmptyString, wxT("*.gif;*.ani"), wxFD_OPEN);
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
wxString filename(dialog.GetPath());
|
||||
|
||||
// enable one of the two chunk of codes to test different parts of wxAnimation/wxAnimationCtrl
|
||||
#if 0
|
||||
if (m_animationCtrl->LoadFile(filename))
|
||||
m_animationCtrl->Play();
|
||||
else
|
||||
wxMessageBox(_T("Sorry, this animation is not a valid format for wxAnimation."));
|
||||
#else
|
||||
#if 0
|
||||
wxAnimation temp;
|
||||
if (!temp.LoadFile(filename))
|
||||
{
|
||||
wxLogError(wxT("Sorry, this animation is not a valid format for wxAnimation."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_animationCtrl->SetAnimation(temp);
|
||||
m_animationCtrl->Play();
|
||||
#else
|
||||
wxFileInputStream stream(filename);
|
||||
if (!stream.Ok())
|
||||
{
|
||||
wxLogError(wxT("Sorry, this animation is not a valid format for wxAnimation."));
|
||||
return;
|
||||
}
|
||||
|
||||
wxAnimation temp;
|
||||
if (!temp.Load(stream))
|
||||
{
|
||||
wxLogError(wxT("Sorry, this animation is not a valid format for wxAnimation."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_animationCtrl->SetAnimation(temp);
|
||||
m_animationCtrl->Play();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_FILEDLG
|
||||
|
||||
void MyFrame::OnUpdateUI(wxUpdateUIEvent& WXUNUSED(event) )
|
||||
{
|
||||
GetMenuBar()->FindItem(wxID_STOP)->Enable(m_animationCtrl->IsPlaying());
|
||||
GetMenuBar()->FindItem(wxID_PLAY)->Enable(!m_animationCtrl->IsPlaying());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// MyCanvas
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||
//EVT_PAINT(MyCanvas::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
|
||||
: wxScrolledWindow(parent, -1, pos, size,
|
||||
wxSUNKEN_BORDER |
|
||||
wxNO_FULL_REPAINT_ON_RESIZE |
|
||||
wxVSCROLL | wxHSCROLL)
|
||||
{
|
||||
SetBackgroundColour(wxColour(_T("YELLOW")));
|
||||
}
|
||||
|
||||
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
//wxPaintDC dc(this);
|
||||
|
||||
//dc.DrawRotatedText(wxT("Background"),
|
||||
}
|
61
samples/animate/anitest.h
Normal file
61
samples/animate/anitest.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: anitest.cpp
|
||||
// Purpose: anitest sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 02/07/2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/animate.h"
|
||||
|
||||
// Define a new application
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
};
|
||||
|
||||
class MyCanvas : public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Define a new frame
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
|
||||
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, const long style);
|
||||
~MyFrame();
|
||||
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
|
||||
void OnPlay(wxCommandEvent& event);
|
||||
void OnStop(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUI(wxUpdateUIEvent& event);
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
void OnOpen(wxCommandEvent& event);
|
||||
#endif // wxUSE_FILEDLG
|
||||
|
||||
MyCanvas* GetCanvas() const { return m_canvas; }
|
||||
wxAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; }
|
||||
|
||||
protected:
|
||||
MyCanvas* m_canvas;
|
||||
wxAnimationCtrl* m_animationCtrl;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
3
samples/animate/anitest.rc
Normal file
3
samples/animate/anitest.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
mondrian ICON "mondrian.ico"
|
||||
#include "wx/msw/wx.rc"
|
||||
|
BIN
samples/animate/hourglass.ani
Normal file
BIN
samples/animate/hourglass.ani
Normal file
Binary file not shown.
BIN
samples/animate/mondrian.ico
Normal file
BIN
samples/animate/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
44
samples/animate/mondrian.xpm
Normal file
44
samples/animate/mondrian.xpm
Normal file
@@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char *mondrian_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 6 1",
|
||||
" c black",
|
||||
". c blue",
|
||||
"X c #00BF00",
|
||||
"o c red",
|
||||
"O c yellow",
|
||||
"+ c gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" "
|
||||
};
|
BIN
samples/animate/throbber.gif
Normal file
BIN
samples/animate/throbber.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Reference in New Issue
Block a user