gtk
motif
win32
+univ
+univ-debug
+univ-release
base-debug
gtk-debug
motif-debug
motif-release
win32-release
*tags
+log
+univtags.cmd
########################### Paths #################################
srcdir = @srcdir@
+top_srcdir = @top_srcdir@
-VP1 = @top_srcdir@/src/common
-VP2 = @top_srcdir@/src/@TOOLKIT_DIR@
-VP3 = @top_srcdir@/src/motif/xmcombo
-VP4 = @top_srcdir@/src/generic
-VP5 = @top_srcdir@/src/unix
-VP6 = @top_srcdir@/src/html
-VP7 = @top_srcdir@/src/png
-VP8 = @top_srcdir@/src/jpeg
-VP9 = @top_srcdir@/src/tiff
-VP10 = @top_srcdir@/src/zlib
-VP11 = @top_srcdir@/src/iodbc
-VP12 = @top_srcdir@/src/msw/ole
-
-FTVP01 = @top_srcdir@/src/freetype/unix
-FTVP02 = @top_srcdir@/src/freetype/autohint
-FTVP03 = @top_srcdir@/src/freetype/base
-FTVP04 = @top_srcdir@/src/freetype/cff
-FTVP05 = @top_srcdir@/src/freetype/cid
-FTVP06 = @top_srcdir@/src/freetype/macfond
-FTVP07 = @top_srcdir@/src/freetype/otlayout
-FTVP08 = @top_srcdir@/src/freetype/psnames
-FTVP09 = @top_srcdir@/src/freetype/raster1
-FTVP10 = @top_srcdir@/src/freetype/sfnt
-FTVP11 = @top_srcdir@/src/freetype/smooth
-FTVP12 = @top_srcdir@/src/freetype/truetype
-FTVP13 = @top_srcdir@/src/freetype/type1
-FTVP14 = @top_srcdir@/src/freetype/type1z
-FTVP15 = @top_srcdir@/src/freetype/winfonts
-
-VP13 = $(FTVP01)@PATH_IFS@$(FTVP02)@PATH_IFS@$(FTVP03)@PATH_IFS@$(FTVP04)@PATH_IFS@$(FTVP05)@PATH_IFS@$(FTVP06)@PATH_IFS@$(FTVP07)@PATH_IFS@$(FTVP08)@PATH_IFS@
-VP14 = $(FTVP09)@PATH_IFS@$(FTVP10)@PATH_IFS@$(FTVP11)@PATH_IFS@$(FTVP12)@PATH_IFS@$(FTVP13)@PATH_IFS@$(FTVP14)@PATH_IFS@$(FTVP15)@PATH_IFS@
+VP1 = @TOOLKIT_VPATH@
+VP2 = @top_srcdir@/src/common
+VP3 = @top_srcdir@/src/generic
+VP4 = @top_srcdir@/src/unix
+VP5 = @top_srcdir@/src/html
+VP6 = @top_srcdir@/src/png
+VP7 = @top_srcdir@/src/jpeg
+VP8 = @top_srcdir@/src/tiff
+VP9 = @top_srcdir@/src/zlib
+VP10 = @top_srcdir@/src/iodbc
+VP11 = @top_srcdir@/src/msw/ole
+VP12 = $(FTVP01)@PATH_IFS@$(FTVP02)@PATH_IFS@$(FTVP03)@PATH_IFS@$(FTVP04)@PATH_IFS@$(FTVP05)@PATH_IFS@$(FTVP06)@PATH_IFS@$(FTVP07)@PATH_IFS@$(FTVP08)@PATH_IFS@
+VP13 = $(FTVP09)@PATH_IFS@$(FTVP10)@PATH_IFS@$(FTVP11)@PATH_IFS@$(FTVP12)@PATH_IFS@$(FTVP13)@PATH_IFS@$(FTVP14)@PATH_IFS@$(FTVP15)@PATH_IFS@
# the comment at the end of the next line is needed because otherwise autoconf
# would remove this line completely - it contains a built-in hack to remove
# any VPATH assignment not containing ':'
-VPATH = $(VP1)@PATH_IFS@$(VP2)@PATH_IFS@$(VP3)@PATH_IFS@$(VP4)@PATH_IFS@$(VP5)@PATH_IFS@$(VP6)@PATH_IFS@$(VP7)@PATH_IFS@$(VP8)@PATH_IFS@$(VP9)@PATH_IFS@$(VP10)@PATH_IFS@$(VP11)@PATH_IFS@$(VP12)@PATH_IFS@$(VP13)@PATH_IFS@$(VP14) # ':' for autoconf
+VPATH = $(VP1)@PATH_IFS@$(VP2)@PATH_IFS@$(VP3)@PATH_IFS@$(VP4)@PATH_IFS@$(VP5)@PATH_IFS@$(VP6)@PATH_IFS@$(VP7)@PATH_IFS@$(VP8)@PATH_IFS@$(VP9)@PATH_IFS@$(VP10)@PATH_IFS@$(VP11)@PATH_IFS@$(VP12)@PATH_IFS@$(VP13) # ':' for autoconf
-top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
mkdir $(DISTDIR)/src/tiff
mkdir $(DISTDIR)/src/iodbc
mkdir $(DISTDIR)/src/unix
- cp $(WXDIR)/@PORT_FILES@ $(DISTDIR)/@PORT_FILES@
+ cp $(WXDIR)/@PORT_FILES@ $(DISTDIR)
cp $(SRCDIR)/*.in $(DISTDIR)/src
cp $(COMMDIR)/*.cpp $(DISTDIR)/src/common
cp $(COMMDIR)/*.c $(DISTDIR)/src/common
mkdir $(DISTDIR)/include/wx/unix
mkdir $(DISTDIR)/src/common
mkdir $(DISTDIR)/src/unix
- cp $(WXDIR)/@PORT_FILES@ $(DISTDIR)/@PORT_FILES@
+ cp $(WXDIR)/@PORT_FILES@ $(DISTDIR)
cp $(WXDIR)/@RPM_FILES@ $(DISTDIR)/@RPM_FILES@
cp $(WXDIR)/@RPM_SPEC@ $(DISTDIR)/@RPM_SPEC@
cp $(WXDIR)/wxBase*.ds[pw] $(DISTDIR)
# Any additions from configure.in:
ac_help="$ac_help
--enable-gui use GUI classes"
+ac_help="$ac_help
+--enable-universal use wxWindows GUI controls instead of native ones"
ac_help="$ac_help
--with-gtk use GTK+"
ac_help="$ac_help
--with-mingw use GCC Minimal MS-Windows"
ac_help="$ac_help
--with-pm use OS/2 Presentation Manager"
+ac_help="$ac_help
+ --with-mgl use MGL"
ac_help="$ac_help
--with-gtk-prefix=PFX Prefix where GTK is installed"
ac_help="$ac_help
ac_help="$ac_help
--enable-ipc use interprocess communication (wxSocket etc.)"
ac_help="$ac_help
+--enable-cmdline use wxCmdLineParser class"
+ac_help="$ac_help
+--enable-datetime use wxDateTime class"
+ac_help="$ac_help
+--enable-timedate use obsolete wxDate/wxTime classes"
+ac_help="$ac_help
+--enable-stopwatch use wxStopWatch class"
+ac_help="$ac_help
--enable-dialupman use dialup network classes"
ac_help="$ac_help
--enable-apple_ieee use the Apple IEEE codec"
ac_help="$ac_help
---enable-timedate use date/time classes"
+--enable-timer use wxTimer class"
ac_help="$ac_help
--enable-wave use wxWave class"
ac_help="$ac_help
ac_help="$ac_help
--enable-file use wxFile classes"
ac_help="$ac_help
+--enable-ffile use wxFFile classes"
+ac_help="$ac_help
--enable-textfile use wxTextFile classes"
ac_help="$ac_help
+--enable-fontmap use font encodings conversion classes"
+ac_help="$ac_help
--enable-unicode compile wxString with Unicode support"
ac_help="$ac_help
--enable-wcsrtombs use wcsrtombs instead of buggy (GNU libc1/Linux libc5) wcstombs"
ac_help="$ac_help
--enable-snglinst use wxSingleInstanceChecker class"
ac_help="$ac_help
+--enable-mimetypes use wxMimeTypesManager"
+ac_help="$ac_help
--enable-threads use threads"
ac_help="$ac_help
--enable-serial use class serialization"
ac_help="$ac_help
--enable-mdi use multiple document interface architecture"
ac_help="$ac_help
+--enable-loggui use standard GUI logger"
+ac_help="$ac_help
+--enable-logwin use wxLogWindow"
+ac_help="$ac_help
--enable-postscript use wxPostscriptDC device context (default for gtk+)"
ac_help="$ac_help
--enable-prologio use Prolog IO library"
ac_help="$ac_help
--enable-accel use accelerators"
ac_help="$ac_help
---enable-caret use wxCaret class"
+--enable-button use wxButton class"
ac_help="$ac_help
--enable-bmpbutton use wxBitmapButton class"
ac_help="$ac_help
+--enable-calendar use wxCalendarCtrl class"
+ac_help="$ac_help
+--enable-caret use wxCaret class"
+ac_help="$ac_help
--enable-checkbox use wxCheckBox class"
ac_help="$ac_help
--enable-checklst use wxCheckListBox (listbox with checkboxes) class"
ac_help="$ac_help
--enable-statline use wxStaticLine class"
ac_help="$ac_help
+--enable-stattext use wxStaticText class"
+ac_help="$ac_help
--enable-statusbar use wxStatusBar class"
ac_help="$ac_help
--enable-tabdialog use wxTabControl class"
ac_help="$ac_help
+--enable-textctrl use wxTextCtrl class"
+ac_help="$ac_help
--enable-togglebtn use wxToggleButton class"
ac_help="$ac_help
--enable-toolbar use wxToolBar class"
ac_help="$ac_help
--enable-commondlg use common dialogs (wxDirDialog, wxProgressDialog, wxTextDialog, ...)"
ac_help="$ac_help
+--enable-choicedlg use wxChoiceDialog"
+ac_help="$ac_help
+--enable-coldlg use wxColourDialog"
+ac_help="$ac_help
+--enable-filedlg use wxFileDialog"
+ac_help="$ac_help
+--enable-fontdlg use wxFontDialog"
+ac_help="$ac_help
--enable-dirdlg use wxDirDialog"
ac_help="$ac_help
+--enable-msgdlg use wxMessageDialog"
+ac_help="$ac_help
+--enable-numberdlg use wxNumberEntryDialog"
+ac_help="$ac_help
--enable-textdlg use wxTextDialog"
ac_help="$ac_help
--enable-tipdlg use startup tips"
ac_help="$ac_help
--enable-progressdlg use wxProgressDialog"
ac_help="$ac_help
+--enable-menus use wxMenu/wxMenuBar/wxMenuItem classes"
+ac_help="$ac_help
--enable-miniframe use wxMiniFrame class"
ac_help="$ac_help
--enable-html use wxHTML sub-library"
ac_help="$ac_help
--enable-joystick compile in joystick support (Linux only)"
ac_help="$ac_help
+--enable-metafiles use wxMetaFile (Windows only)"
+ac_help="$ac_help
--enable-image use wxImage class"
ac_help="$ac_help
--enable-gif use gif images (GIF file format)"
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:870: checking host system type" >&5
+echo "configure:916: checking host system type" >&5
host_alias=$host
case "$host_alias" in
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:891: checking target system type" >&5
+echo "configure:937: checking target system type" >&5
target_alias=$target
case "$target_alias" in
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:909: checking build system type" >&5
+echo "configure:955: checking build system type" >&5
build_alias=$build
case "$build_alias" in
NEEDS_D_REENTRANT_FOR_R_FUNCS=0
-ALL_TOOLKITS="CYGWIN GTK MINGW MOTIF MAC WINE PM"
+ALL_TOOLKITS="CYGWIN GTK MAC MGL MINGW MOTIF PM WINE"
DEFAULT_wxUSE_GTK=0
+DEFAULT_wxUSE_MAC=0
+DEFAULT_wxUSE_MGL=0
DEFAULT_wxUSE_MOTIF=0
DEFAULT_wxUSE_MSW=0
-DEFAULT_wxUSE_MAC=0
-DEFAULT_wxUSE_WINE=0
DEFAULT_wxUSE_PM=0
+DEFAULT_wxUSE_WINE=0
DEFAULT_DEFAULT_wxUSE_GTK=0
+DEFAULT_DEFAULT_wxUSE_MAC=0
+DEFAULT_DEFAULT_wxUSE_MGL=0
DEFAULT_DEFAULT_wxUSE_MOTIF=0
DEFAULT_DEFAULT_wxUSE_MSW=0
-DEFAULT_DEFAULT_wxUSE_MAC=0
-DEFAULT_DEFAULT_wxUSE_WINE=0
DEFAULT_DEFAULT_wxUSE_PM=0
+DEFAULT_DEFAULT_wxUSE_WINE=0
PROGRAM_EXT=
if test "$USE_LINUX" = 1; then
echo $ac_n "checking for gettext in -lc""... $ac_c" 1>&6
-echo "configure:1254: checking for gettext in -lc" >&5
+echo "configure:1302: checking for gettext in -lc" >&5
ac_lib_var=`echo c'_'gettext | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1262 "configure"
+#line 1310 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
gettext()
; return 0; }
EOF
-if { (eval echo configure:1273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
DEBUG_CONFIGURE=0
if test $DEBUG_CONFIGURE = 1; then
+ DEFAULT_wxUSE_UNIVERSAL=no
+
DEFAULT_wxUSE_THREADS=yes
DEFAULT_wxUSE_SHARED=yes
DEFAULT_wxUSE_BURNT_NAME=no
- DEFAULT_wxUSE_OPTIMISE=yes
+ DEFAULT_wxUSE_OPTIMISE=no
DEFAULT_wxUSE_PROFILE=no
DEFAULT_wxUSE_NO_DEPS=no
DEFAULT_wxUSE_NO_RTTI=no
DEFAULT_wxUSE_APPLE_IEEE=no
DEFAULT_wxUSE_LOG=yes
+ DEFAULT_wxUSE_LOGWINDOW=no
+ DEFAULT_wxUSE_LOGGUI=no
DEFAULT_wxUSE_GUI=yes
+ DEFAULT_wxUSE_CONTROLS=no
DEFAULT_wxUSE_ZLIB=no
DEFAULT_wxUSE_LIBPNG=no
DEFAULT_wxUSE_ON_FATAL_EXCEPTION=no
DEFAULT_wxUSE_SNGLINST_CHECKER=no
DEFAULT_wxUSE_STD_IOSTREAM=no
+ DEFAULT_wxUSE_CMDLINE_PARSER=no
+ DEFAULT_wxUSE_DATETIME=no
+ DEFAULT_wxUSE_TIMEDATE=no
+ DEFAULT_wxUSE_TIMER=no
+ DEFAULT_wxUSE_STOPWATCH=no
DEFAULT_wxUSE_FILE=no
+ DEFAULT_wxUSE_FFILE=no
DEFAULT_wxUSE_TEXTFILE=no
- DEFAULT_wxUSE_TIMEDATE=no
DEFAULT_wxUSE_WAVE=no
DEFAULT_wxUSE_INTL=no
DEFAULT_wxUSE_CONFIG=no
+ DEFAULT_wxUSE_FONTMAP=no
DEFAULT_wxUSE_STREAMS=no
DEFAULT_wxUSE_SOCKETS=no
DEFAULT_wxUSE_DIALUP_MANAGER=no
DEFAULT_wxUSE_HELP=no
DEFAULT_wxUSE_WXTREE=no
DEFAULT_wxUSE_METAFILE=no
+ DEFAULT_wxUSE_MIMETYPE=no
DEFAULT_wxUSE_COMMONDLGS=no
+ DEFAULT_wxUSE_CHOICEDLG=no
+ DEFAULT_wxUSE_COLOURDLG=no
DEFAULT_wxUSE_DIRDLG=no
+ DEFAULT_wxUSE_FILEDLG=no
+ DEFAULT_wxUSE_FONTDLG=no
+ DEFAULT_wxUSE_MSGDLG=no
+ DEFAULT_wxUSE_NUMBERDLG=no
DEFAULT_wxUSE_TEXTDLG=no
DEFAULT_wxUSE_STARTUP_TIPS=no
DEFAULT_wxUSE_PROGRESSDLG=no
+ DEFAULT_wxUSE_MENUS=no
DEFAULT_wxUSE_MINIFRAME=no
DEFAULT_wxUSE_HTML=no
DEFAULT_wxUSE_FILESYSTEM=no
DEFAULT_wxUSE_FS_ZIP=no
DEFAULT_wxUSE_BUSYINFO=no
DEFAULT_wxUSE_ZIPSTREAM=no
- DEFAULT_wxUSE_VALIDATORS=yes
+ DEFAULT_wxUSE_VALIDATORS=no
DEFAULT_wxUSE_ACCEL=no
- DEFAULT_wxUSE_CARET=no
+ DEFAULT_wxUSE_BUTTON=no
DEFAULT_wxUSE_BMPBUTTON=no
+ DEFAULT_wxUSE_CALCTRL=no
+ DEFAULT_wxUSE_CARET=no
DEFAULT_wxUSE_CHECKBOX=no
DEFAULT_wxUSE_CHECKLST=no
- DEFAULT_wxUSE_CHOICE=yes
+ DEFAULT_wxUSE_CHOICE=no
DEFAULT_wxUSE_COMBOBOX=no
DEFAULT_wxUSE_GAUGE=no
DEFAULT_wxUSE_GRID=no
DEFAULT_wxUSE_STATBMP=no
DEFAULT_wxUSE_STATBOX=no
DEFAULT_wxUSE_STATLINE=no
+ DEFAULT_wxUSE_STATTEXT=no
DEFAULT_wxUSE_STATUSBAR=yes
DEFAULT_wxUSE_TABDIALOG=no
+ DEFAULT_wxUSE_TEXTCTRL=no
DEFAULT_wxUSE_TOGGLEBTN=no
DEFAULT_wxUSE_TOOLBAR=no
DEFAULT_wxUSE_TOOLBAR_NATIVE=no
DEFAULT_wxUSE_PNM=no
DEFAULT_wxUSE_XPM=no
else
+ DEFAULT_wxUSE_UNIVERSAL=no
+
DEFAULT_wxUSE_THREADS=yes
DEFAULT_wxUSE_SHARED=yes
DEFAULT_wxUSE_ON_FATAL_EXCEPTION=yes
DEFAULT_wxUSE_SNGLINST_CHECKER=yes
DEFAULT_wxUSE_STD_IOSTREAM=no
+ DEFAULT_wxUSE_CMDLINE_PARSER=yes
+ DEFAULT_wxUSE_DATETIME=yes
+ DEFAULT_wxUSE_TIMEDATE=no
+ DEFAULT_wxUSE_TIMER=yes
+ DEFAULT_wxUSE_STOPWATCH=yes
DEFAULT_wxUSE_FILE=yes
+ DEFAULT_wxUSE_FFILE=yes
DEFAULT_wxUSE_TEXTFILE=yes
- DEFAULT_wxUSE_TIMEDATE=yes
DEFAULT_wxUSE_WAVE=no
DEFAULT_wxUSE_INTL=yes
DEFAULT_wxUSE_CONFIG=yes
+ DEFAULT_wxUSE_FONTMAP=yes
DEFAULT_wxUSE_STREAMS=yes
DEFAULT_wxUSE_SOCKETS=yes
DEFAULT_wxUSE_DIALUP_MANAGER=yes
DEFAULT_wxUSE_HELP=yes
DEFAULT_wxUSE_WXTREE=yes
DEFAULT_wxUSE_METAFILE=yes
+ DEFAULT_wxUSE_MIMETYPE=yes
DEFAULT_wxUSE_COMMONDLGS=yes
+ DEFAULT_wxUSE_CHOICEDLG=yes
+ DEFAULT_wxUSE_COLOURDLG=yes
DEFAULT_wxUSE_DIRDLG=yes
+ DEFAULT_wxUSE_FILEDLG=yes
+ DEFAULT_wxUSE_FONTDLG=yes
+ DEFAULT_wxUSE_MSGDLG=yes
+ DEFAULT_wxUSE_NUMBERDLG=yes
DEFAULT_wxUSE_TEXTDLG=yes
DEFAULT_wxUSE_STARTUP_TIPS=yes
DEFAULT_wxUSE_PROGRESSDLG=yes
+ DEFAULT_wxUSE_MENUS=yes
DEFAULT_wxUSE_MINIFRAME=yes
DEFAULT_wxUSE_HTML=yes
DEFAULT_wxUSE_FILESYSTEM=yes
DEFAULT_wxUSE_VALIDATORS=yes
DEFAULT_wxUSE_ACCEL=yes
- DEFAULT_wxUSE_CARET=yes
+ DEFAULT_wxUSE_BUTTON=yes
DEFAULT_wxUSE_BMPBUTTON=yes
+ DEFAULT_wxUSE_CALCTRL=yes
+ DEFAULT_wxUSE_CARET=yes
DEFAULT_wxUSE_CHECKBOX=yes
DEFAULT_wxUSE_CHECKLST=yes
DEFAULT_wxUSE_CHOICE=yes
DEFAULT_wxUSE_STATBMP=yes
DEFAULT_wxUSE_STATBOX=yes
DEFAULT_wxUSE_STATLINE=yes
+ DEFAULT_wxUSE_STATTEXT=yes
DEFAULT_wxUSE_STATUSBAR=yes
DEFAULT_wxUSE_TABDIALOG=no
+ DEFAULT_wxUSE_TEXTCTRL=yes
DEFAULT_wxUSE_TOGGLEBTN=yes
DEFAULT_wxUSE_TOOLBAR=yes
DEFAULT_wxUSE_TOOLBAR_NATIVE=yes
echo $ac_n "checking for --enable-gui""... $ac_c" 1>&6
-echo "configure:1577: checking for --enable-gui" >&5
+echo "configure:1668: checking for --enable-gui" >&5
no_cache=0
# Check whether --enable-gui or --disable-gui was given.
if test "${enable_gui+set}" = set; then
if test "$wxUSE_GUI" = "yes"; then
+
+ echo $ac_n "checking for --enable-universal""... $ac_c" 1>&6
+echo "configure:1710: checking for --enable-universal" >&5
+ no_cache=0
+ # Check whether --enable-universal or --disable-universal was given.
+if test "${enable_universal+set}" = set; then
+ enableval="$enable_universal"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_universal='wxUSE_UNIVERSAL=yes'
+ else
+ ac_cv_use_universal='wxUSE_UNIVERSAL=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_UNIVERSAL" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_universal='wxUSE_UNIVERSAL='$DEFAULT_wxUSE_UNIVERSAL
+
+fi
+
+
+ eval "$ac_cv_use_universal"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_universal >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_UNIVERSAL" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
# Check whether --with-gtk or --without-gtk was given.
if test "${with_gtk+set}" = set; then
withval="$with_gtk"
wxUSE_PM="$withval" CACHE_PM=1 TOOLKIT_GIVEN=1
fi
+# Check whether --with-mgl or --without-mgl was given.
+if test "${with_mgl+set}" = set; then
+ withval="$with_mgl"
+ wxUSE_MGL="$withval" CACHE_MGL=1 TOOLKIT_GIVEN=1
+fi
+
# Check whether --with-gtk-prefix or --without-gtk-prefix was given.
if test "${with_gtk_prefix+set}" = set; then
echo $ac_n "checking for --with-libpng""... $ac_c" 1>&6
-echo "configure:1679: checking for --with-libpng" >&5
+echo "configure:1815: checking for --with-libpng" >&5
no_cache=0
# Check whether --with-libpng or --without-libpng was given.
if test "${with_libpng+set}" = set; then
echo $ac_n "checking for --with-libjpeg""... $ac_c" 1>&6
-echo "configure:1726: checking for --with-libjpeg" >&5
+echo "configure:1862: checking for --with-libjpeg" >&5
no_cache=0
# Check whether --with-libjpeg or --without-libjpeg was given.
if test "${with_libjpeg+set}" = set; then
echo $ac_n "checking for --with-libtiff""... $ac_c" 1>&6
-echo "configure:1773: checking for --with-libtiff" >&5
+echo "configure:1909: checking for --with-libtiff" >&5
no_cache=0
# Check whether --with-libtiff or --without-libtiff was given.
if test "${with_libtiff+set}" = set; then
echo $ac_n "checking for --with-freetype""... $ac_c" 1>&6
-echo "configure:1820: checking for --with-freetype" >&5
+echo "configure:1956: checking for --with-freetype" >&5
no_cache=0
# Check whether --with-freetype or --without-freetype was given.
if test "${with_freetype+set}" = set; then
echo $ac_n "checking for --with-opengl""... $ac_c" 1>&6
-echo "configure:1867: checking for --with-opengl" >&5
+echo "configure:2003: checking for --with-opengl" >&5
no_cache=0
# Check whether --with-opengl or --without-opengl was given.
if test "${with_opengl+set}" = set; then
echo $ac_n "checking for --with-dmalloc""... $ac_c" 1>&6
-echo "configure:1909: checking for --with-dmalloc" >&5
+echo "configure:2045: checking for --with-dmalloc" >&5
no_cache=0
# Check whether --with-dmalloc or --without-dmalloc was given.
if test "${with_dmalloc+set}" = set; then
echo $ac_n "checking for --with-zlib""... $ac_c" 1>&6
-echo "configure:1948: checking for --with-zlib" >&5
+echo "configure:2084: checking for --with-zlib" >&5
no_cache=0
# Check whether --with-zlib or --without-zlib was given.
if test "${with_zlib+set}" = set; then
echo $ac_n "checking for --with-odbc""... $ac_c" 1>&6
-echo "configure:1995: checking for --with-odbc" >&5
+echo "configure:2131: checking for --with-odbc" >&5
no_cache=0
# Check whether --with-odbc or --without-odbc was given.
if test "${with_odbc+set}" = set; then
echo $ac_n "checking for --enable-shared""... $ac_c" 1>&6
-echo "configure:2037: checking for --enable-shared" >&5
+echo "configure:2173: checking for --enable-shared" >&5
no_cache=0
# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
echo $ac_n "checking for --enable-burnt_name""... $ac_c" 1>&6
-echo "configure:2076: checking for --enable-burnt_name" >&5
+echo "configure:2212: checking for --enable-burnt_name" >&5
no_cache=0
# Check whether --enable-burnt_name or --disable-burnt_name was given.
if test "${enable_burnt_name+set}" = set; then
echo $ac_n "checking for --enable-optimise""... $ac_c" 1>&6
-echo "configure:2115: checking for --enable-optimise" >&5
+echo "configure:2251: checking for --enable-optimise" >&5
no_cache=0
# Check whether --enable-optimise or --disable-optimise was given.
if test "${enable_optimise+set}" = set; then
echo $ac_n "checking for --enable-debug""... $ac_c" 1>&6
-echo "configure:2154: checking for --enable-debug" >&5
+echo "configure:2290: checking for --enable-debug" >&5
no_cache=0
# Check whether --enable-debug or --disable-debug was given.
if test "${enable_debug+set}" = set; then
echo $ac_n "checking for --enable-debug_flag""... $ac_c" 1>&6
-echo "configure:2202: checking for --enable-debug_flag" >&5
+echo "configure:2338: checking for --enable-debug_flag" >&5
no_cache=0
# Check whether --enable-debug_flag or --disable-debug_flag was given.
if test "${enable_debug_flag+set}" = set; then
echo $ac_n "checking for --enable-debug_info""... $ac_c" 1>&6
-echo "configure:2241: checking for --enable-debug_info" >&5
+echo "configure:2377: checking for --enable-debug_info" >&5
no_cache=0
# Check whether --enable-debug_info or --disable-debug_info was given.
if test "${enable_debug_info+set}" = set; then
echo $ac_n "checking for --enable-debug_gdb""... $ac_c" 1>&6
-echo "configure:2280: checking for --enable-debug_gdb" >&5
+echo "configure:2416: checking for --enable-debug_gdb" >&5
no_cache=0
# Check whether --enable-debug_gdb or --disable-debug_gdb was given.
if test "${enable_debug_gdb+set}" = set; then
echo $ac_n "checking for --enable-debug_cntxt""... $ac_c" 1>&6
-echo "configure:2319: checking for --enable-debug_cntxt" >&5
+echo "configure:2455: checking for --enable-debug_cntxt" >&5
no_cache=0
# Check whether --enable-debug_cntxt or --disable-debug_cntxt was given.
if test "${enable_debug_cntxt+set}" = set; then
echo $ac_n "checking for --enable-mem_tracing""... $ac_c" 1>&6
-echo "configure:2358: checking for --enable-mem_tracing" >&5
+echo "configure:2494: checking for --enable-mem_tracing" >&5
no_cache=0
# Check whether --enable-mem_tracing or --disable-mem_tracing was given.
if test "${enable_mem_tracing+set}" = set; then
echo $ac_n "checking for --enable-profile""... $ac_c" 1>&6
-echo "configure:2397: checking for --enable-profile" >&5
+echo "configure:2533: checking for --enable-profile" >&5
no_cache=0
# Check whether --enable-profile or --disable-profile was given.
if test "${enable_profile+set}" = set; then
echo $ac_n "checking for --enable-no_rtti""... $ac_c" 1>&6
-echo "configure:2436: checking for --enable-no_rtti" >&5
+echo "configure:2572: checking for --enable-no_rtti" >&5
no_cache=0
# Check whether --enable-no_rtti or --disable-no_rtti was given.
if test "${enable_no_rtti+set}" = set; then
echo $ac_n "checking for --enable-no_exceptions""... $ac_c" 1>&6
-echo "configure:2475: checking for --enable-no_exceptions" >&5
+echo "configure:2611: checking for --enable-no_exceptions" >&5
no_cache=0
# Check whether --enable-no_exceptions or --disable-no_exceptions was given.
if test "${enable_no_exceptions+set}" = set; then
echo $ac_n "checking for --enable-permissive""... $ac_c" 1>&6
-echo "configure:2514: checking for --enable-permissive" >&5
+echo "configure:2650: checking for --enable-permissive" >&5
no_cache=0
# Check whether --enable-permissive or --disable-permissive was given.
if test "${enable_permissive+set}" = set; then
echo $ac_n "checking for --enable-no_deps""... $ac_c" 1>&6
-echo "configure:2553: checking for --enable-no_deps" >&5
+echo "configure:2689: checking for --enable-no_deps" >&5
no_cache=0
# Check whether --enable-no_deps or --disable-no_deps was given.
if test "${enable_no_deps+set}" = set; then
echo $ac_n "checking for --enable-intl""... $ac_c" 1>&6
-echo "configure:2594: checking for --enable-intl" >&5
+echo "configure:2730: checking for --enable-intl" >&5
no_cache=0
# Check whether --enable-intl or --disable-intl was given.
if test "${enable_intl+set}" = set; then
echo $ac_n "checking for --enable-config""... $ac_c" 1>&6
-echo "configure:2633: checking for --enable-config" >&5
+echo "configure:2769: checking for --enable-config" >&5
no_cache=0
# Check whether --enable-config or --disable-config was given.
if test "${enable_config+set}" = set; then
echo $ac_n "checking for --enable-sockets""... $ac_c" 1>&6
-echo "configure:2673: checking for --enable-sockets" >&5
+echo "configure:2809: checking for --enable-sockets" >&5
no_cache=0
# Check whether --enable-sockets or --disable-sockets was given.
if test "${enable_sockets+set}" = set; then
echo $ac_n "checking for --enable-ipc""... $ac_c" 1>&6
-echo "configure:2713: checking for --enable-ipc" >&5
+echo "configure:2849: checking for --enable-ipc" >&5
no_cache=0
# Check whether --enable-ipc or --disable-ipc was given.
if test "${enable_ipc+set}" = set; then
+ echo $ac_n "checking for --enable-cmdline""... $ac_c" 1>&6
+echo "configure:2889: checking for --enable-cmdline" >&5
+ no_cache=0
+ # Check whether --enable-cmdline or --disable-cmdline was given.
+if test "${enable_cmdline+set}" = set; then
+ enableval="$enable_cmdline"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_cmdline='wxUSE_CMDLINE_PARSER=yes'
+ else
+ ac_cv_use_cmdline='wxUSE_CMDLINE_PARSER=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_CMDLINE_PARSER" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_cmdline='wxUSE_CMDLINE_PARSER='$DEFAULT_wxUSE_CMDLINE_PARSER
+
+fi
+
+
+ eval "$ac_cv_use_cmdline"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_cmdline >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_CMDLINE_PARSER" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-datetime""... $ac_c" 1>&6
+echo "configure:2928: checking for --enable-datetime" >&5
+ no_cache=0
+ # Check whether --enable-datetime or --disable-datetime was given.
+if test "${enable_datetime+set}" = set; then
+ enableval="$enable_datetime"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_datetime='wxUSE_DATETIME=yes'
+ else
+ ac_cv_use_datetime='wxUSE_DATETIME=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_DATETIME" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_datetime='wxUSE_DATETIME='$DEFAULT_wxUSE_DATETIME
+
+fi
+
+
+ eval "$ac_cv_use_datetime"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_datetime >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_DATETIME" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-timedate""... $ac_c" 1>&6
+echo "configure:2967: checking for --enable-timedate" >&5
+ no_cache=0
+ # Check whether --enable-timedate or --disable-timedate was given.
+if test "${enable_timedate+set}" = set; then
+ enableval="$enable_timedate"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_timedate='wxUSE_TIMEDATE=yes'
+ else
+ ac_cv_use_timedate='wxUSE_TIMEDATE=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_TIMEDATE" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_timedate='wxUSE_TIMEDATE='$DEFAULT_wxUSE_TIMEDATE
+
+fi
+
+
+ eval "$ac_cv_use_timedate"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_timedate >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_TIMEDATE" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-stopwatch""... $ac_c" 1>&6
+echo "configure:3006: checking for --enable-stopwatch" >&5
+ no_cache=0
+ # Check whether --enable-stopwatch or --disable-stopwatch was given.
+if test "${enable_stopwatch+set}" = set; then
+ enableval="$enable_stopwatch"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_stopwatch='wxUSE_STOPWATCH=yes'
+ else
+ ac_cv_use_stopwatch='wxUSE_STOPWATCH=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_STOPWATCH" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_stopwatch='wxUSE_STOPWATCH='$DEFAULT_wxUSE_STOPWATCH
+
+fi
+
+
+ eval "$ac_cv_use_stopwatch"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_stopwatch >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_STOPWATCH" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
echo $ac_n "checking for --enable-dialupman""... $ac_c" 1>&6
-echo "configure:2753: checking for --enable-dialupman" >&5
+echo "configure:3045: checking for --enable-dialupman" >&5
no_cache=0
# Check whether --enable-dialupman or --disable-dialupman was given.
if test "${enable_dialupman+set}" = set; then
echo $ac_n "checking for --enable-apple_ieee""... $ac_c" 1>&6
-echo "configure:2792: checking for --enable-apple_ieee" >&5
+echo "configure:3084: checking for --enable-apple_ieee" >&5
no_cache=0
# Check whether --enable-apple_ieee or --disable-apple_ieee was given.
if test "${enable_apple_ieee+set}" = set; then
fi
- echo $ac_n "checking for --enable-timedate""... $ac_c" 1>&6
-echo "configure:2831: checking for --enable-timedate" >&5
+ echo $ac_n "checking for --enable-timer""... $ac_c" 1>&6
+echo "configure:3123: checking for --enable-timer" >&5
no_cache=0
- # Check whether --enable-timedate or --disable-timedate was given.
-if test "${enable_timedate+set}" = set; then
- enableval="$enable_timedate"
+ # Check whether --enable-timer or --disable-timer was given.
+if test "${enable_timer+set}" = set; then
+ enableval="$enable_timer"
if test "$enableval" = yes; then
- ac_cv_use_timedate='wxUSE_TIMEDATE=yes'
+ ac_cv_use_timer='wxUSE_TIMER=yes'
else
- ac_cv_use_timedate='wxUSE_TIMEDATE=no'
+ ac_cv_use_timer='wxUSE_TIMER=no'
fi
else
- LINE=`grep "wxUSE_TIMEDATE" ${wx_arg_cache_file}`
+ LINE=`grep "wxUSE_TIMER" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
- ac_cv_use_timedate='wxUSE_TIMEDATE='$DEFAULT_wxUSE_TIMEDATE
+ ac_cv_use_timer='wxUSE_TIMER='$DEFAULT_wxUSE_TIMER
fi
- eval "$ac_cv_use_timedate"
+ eval "$ac_cv_use_timer"
if test "$no_cache" != 1; then
- echo $ac_cv_use_timedate >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_timer >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_TIMEDATE" = yes; then
+ if test "$wxUSE_TIMER" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for --enable-wave""... $ac_c" 1>&6
-echo "configure:2870: checking for --enable-wave" >&5
+echo "configure:3162: checking for --enable-wave" >&5
no_cache=0
# Check whether --enable-wave or --disable-wave was given.
if test "${enable_wave+set}" = set; then
echo $ac_n "checking for --enable-fraction""... $ac_c" 1>&6
-echo "configure:2909: checking for --enable-fraction" >&5
+echo "configure:3201: checking for --enable-fraction" >&5
no_cache=0
# Check whether --enable-fraction or --disable-fraction was given.
if test "${enable_fraction+set}" = set; then
echo $ac_n "checking for --enable-dynlib""... $ac_c" 1>&6
-echo "configure:2948: checking for --enable-dynlib" >&5
+echo "configure:3240: checking for --enable-dynlib" >&5
no_cache=0
# Check whether --enable-dynlib or --disable-dynlib was given.
if test "${enable_dynlib+set}" = set; then
echo $ac_n "checking for --enable-longlong""... $ac_c" 1>&6
-echo "configure:2987: checking for --enable-longlong" >&5
+echo "configure:3279: checking for --enable-longlong" >&5
no_cache=0
# Check whether --enable-longlong or --disable-longlong was given.
if test "${enable_longlong+set}" = set; then
echo $ac_n "checking for --enable-geometry""... $ac_c" 1>&6
-echo "configure:3026: checking for --enable-geometry" >&5
+echo "configure:3318: checking for --enable-geometry" >&5
no_cache=0
# Check whether --enable-geometry or --disable-geometry was given.
if test "${enable_geometry+set}" = set; then
echo $ac_n "checking for --enable-log""... $ac_c" 1>&6
-echo "configure:3065: checking for --enable-log" >&5
+echo "configure:3357: checking for --enable-log" >&5
no_cache=0
# Check whether --enable-log or --disable-log was given.
if test "${enable_log+set}" = set; then
echo $ac_n "checking for --enable-streams""... $ac_c" 1>&6
-echo "configure:3104: checking for --enable-streams" >&5
+echo "configure:3396: checking for --enable-streams" >&5
no_cache=0
# Check whether --enable-streams or --disable-streams was given.
if test "${enable_streams+set}" = set; then
echo $ac_n "checking for --enable-file""... $ac_c" 1>&6
-echo "configure:3143: checking for --enable-file" >&5
+echo "configure:3435: checking for --enable-file" >&5
no_cache=0
# Check whether --enable-file or --disable-file was given.
if test "${enable_file+set}" = set; then
fi
- echo $ac_n "checking for --enable-textfile""... $ac_c" 1>&6
-echo "configure:3182: checking for --enable-textfile" >&5
+ echo $ac_n "checking for --enable-ffile""... $ac_c" 1>&6
+echo "configure:3474: checking for --enable-ffile" >&5
no_cache=0
- # Check whether --enable-textfile or --disable-textfile was given.
-if test "${enable_textfile+set}" = set; then
- enableval="$enable_textfile"
+ # Check whether --enable-ffile or --disable-ffile was given.
+if test "${enable_ffile+set}" = set; then
+ enableval="$enable_ffile"
if test "$enableval" = yes; then
- ac_cv_use_textfile='wxUSE_TEXTFILE=yes'
+ ac_cv_use_ffile='wxUSE_FFILE=yes'
else
- ac_cv_use_textfile='wxUSE_TEXTFILE=no'
+ ac_cv_use_ffile='wxUSE_FFILE=no'
fi
else
- LINE=`grep "wxUSE_TEXTFILE" ${wx_arg_cache_file}`
+ LINE=`grep "wxUSE_FFILE" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
- ac_cv_use_textfile='wxUSE_TEXTFILE='$DEFAULT_wxUSE_TEXTFILE
+ ac_cv_use_ffile='wxUSE_FFILE='$DEFAULT_wxUSE_FFILE
fi
- eval "$ac_cv_use_textfile"
+ eval "$ac_cv_use_ffile"
if test "$no_cache" != 1; then
- echo $ac_cv_use_textfile >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_ffile >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_TEXTFILE" = yes; then
+ if test "$wxUSE_FFILE" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- echo $ac_n "checking for --enable-unicode""... $ac_c" 1>&6
-echo "configure:3221: checking for --enable-unicode" >&5
+ echo $ac_n "checking for --enable-textfile""... $ac_c" 1>&6
+echo "configure:3513: checking for --enable-textfile" >&5
no_cache=0
- # Check whether --enable-unicode or --disable-unicode was given.
-if test "${enable_unicode+set}" = set; then
- enableval="$enable_unicode"
+ # Check whether --enable-textfile or --disable-textfile was given.
+if test "${enable_textfile+set}" = set; then
+ enableval="$enable_textfile"
if test "$enableval" = yes; then
- ac_cv_use_unicode='wxUSE_UNICODE=yes'
+ ac_cv_use_textfile='wxUSE_TEXTFILE=yes'
else
- ac_cv_use_unicode='wxUSE_UNICODE=no'
+ ac_cv_use_textfile='wxUSE_TEXTFILE=no'
fi
else
- LINE=`grep "wxUSE_UNICODE" ${wx_arg_cache_file}`
+ LINE=`grep "wxUSE_TEXTFILE" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
- ac_cv_use_unicode='wxUSE_UNICODE='$DEFAULT_wxUSE_UNICODE
+ ac_cv_use_textfile='wxUSE_TEXTFILE='$DEFAULT_wxUSE_TEXTFILE
fi
- eval "$ac_cv_use_unicode"
+ eval "$ac_cv_use_textfile"
if test "$no_cache" != 1; then
- echo $ac_cv_use_unicode >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_textfile >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_UNICODE" = yes; then
+ if test "$wxUSE_TEXTFILE" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- echo $ac_n "checking for --enable-wcsrtombs""... $ac_c" 1>&6
-echo "configure:3260: checking for --enable-wcsrtombs" >&5
+ echo $ac_n "checking for --enable-fontmap""... $ac_c" 1>&6
+echo "configure:3552: checking for --enable-fontmap" >&5
no_cache=0
- # Check whether --enable-wcsrtombs or --disable-wcsrtombs was given.
-if test "${enable_wcsrtombs+set}" = set; then
- enableval="$enable_wcsrtombs"
+ # Check whether --enable-fontmap or --disable-fontmap was given.
+if test "${enable_fontmap+set}" = set; then
+ enableval="$enable_fontmap"
if test "$enableval" = yes; then
- ac_cv_use_wcsrtombs='wxUSE_WCSRTOMBS=yes'
+ ac_cv_use_fontmap='wxUSE_FONTMAP=yes'
else
- ac_cv_use_wcsrtombs='wxUSE_WCSRTOMBS=no'
+ ac_cv_use_fontmap='wxUSE_FONTMAP=no'
fi
else
- LINE=`grep "wxUSE_WCSRTOMBS" ${wx_arg_cache_file}`
+ LINE=`grep "wxUSE_FONTMAP" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
- ac_cv_use_wcsrtombs='wxUSE_WCSRTOMBS='$DEFAULT_wxUSE_WCSRTOMBS
+ ac_cv_use_fontmap='wxUSE_FONTMAP='$DEFAULT_wxUSE_FONTMAP
fi
- eval "$ac_cv_use_wcsrtombs"
+ eval "$ac_cv_use_fontmap"
if test "$no_cache" != 1; then
- echo $ac_cv_use_wcsrtombs >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_fontmap >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_WCSRTOMBS" = yes; then
+ if test "$wxUSE_FONTMAP" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- echo $ac_n "checking for --enable-wxprintfv""... $ac_c" 1>&6
-echo "configure:3299: checking for --enable-wxprintfv" >&5
+ echo $ac_n "checking for --enable-unicode""... $ac_c" 1>&6
+echo "configure:3591: checking for --enable-unicode" >&5
no_cache=0
- # Check whether --enable-wxprintfv or --disable-wxprintfv was given.
-if test "${enable_wxprintfv+set}" = set; then
- enableval="$enable_wxprintfv"
-
- if test "$enableval" = yes; then
+ # Check whether --enable-unicode or --disable-unicode was given.
+if test "${enable_unicode+set}" = set; then
+ enableval="$enable_unicode"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_unicode='wxUSE_UNICODE=yes'
+ else
+ ac_cv_use_unicode='wxUSE_UNICODE=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_UNICODE" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_unicode='wxUSE_UNICODE='$DEFAULT_wxUSE_UNICODE
+
+fi
+
+
+ eval "$ac_cv_use_unicode"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_unicode >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_UNICODE" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-wcsrtombs""... $ac_c" 1>&6
+echo "configure:3630: checking for --enable-wcsrtombs" >&5
+ no_cache=0
+ # Check whether --enable-wcsrtombs or --disable-wcsrtombs was given.
+if test "${enable_wcsrtombs+set}" = set; then
+ enableval="$enable_wcsrtombs"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_wcsrtombs='wxUSE_WCSRTOMBS=yes'
+ else
+ ac_cv_use_wcsrtombs='wxUSE_WCSRTOMBS=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_WCSRTOMBS" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_wcsrtombs='wxUSE_WCSRTOMBS='$DEFAULT_wxUSE_WCSRTOMBS
+
+fi
+
+
+ eval "$ac_cv_use_wcsrtombs"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_wcsrtombs >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_WCSRTOMBS" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-wxprintfv""... $ac_c" 1>&6
+echo "configure:3669: checking for --enable-wxprintfv" >&5
+ no_cache=0
+ # Check whether --enable-wxprintfv or --disable-wxprintfv was given.
+if test "${enable_wxprintfv+set}" = set; then
+ enableval="$enable_wxprintfv"
+
+ if test "$enableval" = yes; then
ac_cv_use_wxprintfv='wxUSE_EXPERIMENTAL_PRINTF=yes'
else
ac_cv_use_wxprintfv='wxUSE_EXPERIMENTAL_PRINTF=no'
echo $ac_n "checking for --enable-std_iostreams""... $ac_c" 1>&6
-echo "configure:3338: checking for --enable-std_iostreams" >&5
+echo "configure:3708: checking for --enable-std_iostreams" >&5
no_cache=0
# Check whether --enable-std_iostreams or --disable-std_iostreams was given.
if test "${enable_std_iostreams+set}" = set; then
echo $ac_n "checking for --enable-filesystem""... $ac_c" 1>&6
-echo "configure:3377: checking for --enable-filesystem" >&5
+echo "configure:3747: checking for --enable-filesystem" >&5
no_cache=0
# Check whether --enable-filesystem or --disable-filesystem was given.
if test "${enable_filesystem+set}" = set; then
echo $ac_n "checking for --enable-fs_inet""... $ac_c" 1>&6
-echo "configure:3416: checking for --enable-fs_inet" >&5
+echo "configure:3786: checking for --enable-fs_inet" >&5
no_cache=0
# Check whether --enable-fs_inet or --disable-fs_inet was given.
if test "${enable_fs_inet+set}" = set; then
echo $ac_n "checking for --enable-fs_zip""... $ac_c" 1>&6
-echo "configure:3455: checking for --enable-fs_zip" >&5
+echo "configure:3825: checking for --enable-fs_zip" >&5
no_cache=0
# Check whether --enable-fs_zip or --disable-fs_zip was given.
if test "${enable_fs_zip+set}" = set; then
echo $ac_n "checking for --enable-zipstream""... $ac_c" 1>&6
-echo "configure:3494: checking for --enable-zipstream" >&5
+echo "configure:3864: checking for --enable-zipstream" >&5
no_cache=0
# Check whether --enable-zipstream or --disable-zipstream was given.
if test "${enable_zipstream+set}" = set; then
echo $ac_n "checking for --enable-catch_segvs""... $ac_c" 1>&6
-echo "configure:3534: checking for --enable-catch_segvs" >&5
+echo "configure:3904: checking for --enable-catch_segvs" >&5
no_cache=0
# Check whether --enable-catch_segvs or --disable-catch_segvs was given.
if test "${enable_catch_segvs+set}" = set; then
echo $ac_n "checking for --enable-snglinst""... $ac_c" 1>&6
-echo "configure:3573: checking for --enable-snglinst" >&5
+echo "configure:3943: checking for --enable-snglinst" >&5
no_cache=0
# Check whether --enable-snglinst or --disable-snglinst was given.
if test "${enable_snglinst+set}" = set; then
+ echo $ac_n "checking for --enable-mimetype""... $ac_c" 1>&6
+echo "configure:3983: checking for --enable-mimetype" >&5
+ no_cache=0
+ # Check whether --enable-mimetype or --disable-mimetype was given.
+if test "${enable_mimetype+set}" = set; then
+ enableval="$enable_mimetype"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_mimetype='wxUSE_MIMETYPE=yes'
+ else
+ ac_cv_use_mimetype='wxUSE_MIMETYPE=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_MIMETYPE" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_mimetype='wxUSE_MIMETYPE='$DEFAULT_wxUSE_MIMETYPE
+
+fi
+
+
+ eval "$ac_cv_use_mimetype"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_mimetype >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_MIMETYPE" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+
echo $ac_n "checking for --enable-threads""... $ac_c" 1>&6
-echo "configure:3614: checking for --enable-threads" >&5
+echo "configure:4024: checking for --enable-threads" >&5
no_cache=0
# Check whether --enable-threads or --disable-threads was given.
if test "${enable_threads+set}" = set; then
echo $ac_n "checking for --enable-serial""... $ac_c" 1>&6
-echo "configure:3653: checking for --enable-serial" >&5
+echo "configure:4063: checking for --enable-serial" >&5
no_cache=0
# Check whether --enable-serial or --disable-serial was given.
if test "${enable_serial+set}" = set; then
echo $ac_n "checking for --enable-docview""... $ac_c" 1>&6
-echo "configure:3696: checking for --enable-docview" >&5
+echo "configure:4106: checking for --enable-docview" >&5
no_cache=0
# Check whether --enable-docview or --disable-docview was given.
if test "${enable_docview+set}" = set; then
echo $ac_n "checking for --enable-help""... $ac_c" 1>&6
-echo "configure:3735: checking for --enable-help" >&5
+echo "configure:4145: checking for --enable-help" >&5
no_cache=0
# Check whether --enable-help or --disable-help was given.
if test "${enable_help+set}" = set; then
echo $ac_n "checking for --enable-constraints""... $ac_c" 1>&6
-echo "configure:3774: checking for --enable-constraints" >&5
+echo "configure:4184: checking for --enable-constraints" >&5
no_cache=0
# Check whether --enable-constraints or --disable-constraints was given.
if test "${enable_constraints+set}" = set; then
echo $ac_n "checking for --enable-printarch""... $ac_c" 1>&6
-echo "configure:3813: checking for --enable-printarch" >&5
+echo "configure:4223: checking for --enable-printarch" >&5
no_cache=0
# Check whether --enable-printarch or --disable-printarch was given.
if test "${enable_printarch+set}" = set; then
echo $ac_n "checking for --enable-mdi""... $ac_c" 1>&6
-echo "configure:3852: checking for --enable-mdi" >&5
+echo "configure:4262: checking for --enable-mdi" >&5
no_cache=0
# Check whether --enable-mdi or --disable-mdi was given.
if test "${enable_mdi+set}" = set; then
fi
+ echo $ac_n "checking for --enable-loggui""... $ac_c" 1>&6
+echo "configure:4301: checking for --enable-loggui" >&5
+ no_cache=0
+ # Check whether --enable-loggui or --disable-loggui was given.
+if test "${enable_loggui+set}" = set; then
+ enableval="$enable_loggui"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_loggui='wxUSE_LOGGUI=yes'
+ else
+ ac_cv_use_loggui='wxUSE_LOGGUI=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_LOGGUI" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_loggui='wxUSE_LOGGUI='$DEFAULT_wxUSE_LOGGUI
+
+fi
+
+
+ eval "$ac_cv_use_loggui"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_loggui >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_LOGGUI" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-logwin""... $ac_c" 1>&6
+echo "configure:4340: checking for --enable-logwin" >&5
+ no_cache=0
+ # Check whether --enable-logwin or --disable-logwin was given.
+if test "${enable_logwin+set}" = set; then
+ enableval="$enable_logwin"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_logwin='wxUSE_LOGWINDOW=yes'
+ else
+ ac_cv_use_logwin='wxUSE_LOGWINDOW=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_LOGWINDOW" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_logwin='wxUSE_LOGWINDOW='$DEFAULT_wxUSE_LOGWINDOW
+
+fi
+
+
+ eval "$ac_cv_use_logwin"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_logwin >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_LOGWINDOW" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
echo $ac_n "checking for --enable-postscript""... $ac_c" 1>&6
-echo "configure:3892: checking for --enable-postscript" >&5
+echo "configure:4380: checking for --enable-postscript" >&5
no_cache=0
# Check whether --enable-postscript or --disable-postscript was given.
if test "${enable_postscript+set}" = set; then
+
echo $ac_n "checking for --enable-prologio""... $ac_c" 1>&6
-echo "configure:3933: checking for --enable-prologio" >&5
+echo "configure:4422: checking for --enable-prologio" >&5
no_cache=0
# Check whether --enable-prologio or --disable-prologio was given.
if test "${enable_prologio+set}" = set; then
echo $ac_n "checking for --enable-resources""... $ac_c" 1>&6
-echo "configure:3972: checking for --enable-resources" >&5
+echo "configure:4461: checking for --enable-resources" >&5
no_cache=0
# Check whether --enable-resources or --disable-resources was given.
if test "${enable_resources+set}" = set; then
echo $ac_n "checking for --enable-xresources""... $ac_c" 1>&6
-echo "configure:4012: checking for --enable-xresources" >&5
+echo "configure:4501: checking for --enable-xresources" >&5
no_cache=0
# Check whether --enable-xresources or --disable-xresources was given.
if test "${enable_xresources+set}" = set; then
echo $ac_n "checking for --enable-clipboard""... $ac_c" 1>&6
-echo "configure:4053: checking for --enable-clipboard" >&5
+echo "configure:4542: checking for --enable-clipboard" >&5
no_cache=0
# Check whether --enable-clipboard or --disable-clipboard was given.
if test "${enable_clipboard+set}" = set; then
echo $ac_n "checking for --enable-dnd""... $ac_c" 1>&6
-echo "configure:4092: checking for --enable-dnd" >&5
+echo "configure:4581: checking for --enable-dnd" >&5
no_cache=0
# Check whether --enable-dnd or --disable-dnd was given.
if test "${enable_dnd+set}" = set; then
echo $ac_n "checking for --enable-metafile""... $ac_c" 1>&6
-echo "configure:4131: checking for --enable-metafile" >&5
+echo "configure:4620: checking for --enable-metafile" >&5
no_cache=0
# Check whether --enable-metafile or --disable-metafile was given.
if test "${enable_metafile+set}" = set; then
echo $ac_n "checking for --enable-wxtree""... $ac_c" 1>&6
-echo "configure:4171: checking for --enable-wxtree" >&5
+echo "configure:4660: checking for --enable-wxtree" >&5
no_cache=0
# Check whether --enable-wxtree or --disable-wxtree was given.
if test "${enable_wxtree+set}" = set; then
echo $ac_n "checking for --enable-controls""... $ac_c" 1>&6
-echo "configure:4212: checking for --enable-controls" >&5
+echo "configure:4701: checking for --enable-controls" >&5
no_cache=0
# Check whether --enable-controls or --disable-controls was given.
if test "${enable_controls+set}" = set; then
if test "$wxUSE_CONTROLS" = "yes"; then
DEFAULT_wxUSE_ACCEL=yes
+ DEFAULT_wxUSE_BMPBUTTON=yes
+ DEFAULT_wxUSE_BUTTON=yes
+ DEFAULT_wxUSE_CALCTRL=no
DEFAULT_wxUSE_CARET=yes
DEFAULT_wxUSE_COMBOBOX=yes
- DEFAULT_wxUSE_BMPBUTTON=yes
DEFAULT_wxUSE_CHECKBOX=yes
DEFAULT_wxUSE_CHECKLISTBOX=yes
DEFAULT_wxUSE_CHOICE=yes
DEFAULT_wxUSE_TREECTRL=yes
elif test "$wxUSE_CONTROLS" = "no"; then
DEFAULT_wxUSE_ACCEL=no
+ DEFAULT_wxUSE_BMPBUTTON=no
+ DEFAULT_wxUSE_BUTTON=no
+ DEFAULT_wxUSE_CALCTRL=no
DEFAULT_wxUSE_CARET=no
DEFAULT_wxUSE_COMBOBOX=no
- DEFAULT_wxUSE_BMPBUTTON=no
DEFAULT_wxUSE_CHECKBOX=no
DEFAULT_wxUSE_CHECKLISTBOX=no
DEFAULT_wxUSE_CHOICE=no
echo $ac_n "checking for --enable-accel""... $ac_c" 1>&6
-echo "configure:4322: checking for --enable-accel" >&5
+echo "configure:4815: checking for --enable-accel" >&5
no_cache=0
# Check whether --enable-accel or --disable-accel was given.
if test "${enable_accel+set}" = set; then
fi
- echo $ac_n "checking for --enable-caret""... $ac_c" 1>&6
-echo "configure:4361: checking for --enable-caret" >&5
+ echo $ac_n "checking for --enable-button""... $ac_c" 1>&6
+echo "configure:4854: checking for --enable-button" >&5
no_cache=0
- # Check whether --enable-caret or --disable-caret was given.
-if test "${enable_caret+set}" = set; then
- enableval="$enable_caret"
+ # Check whether --enable-button or --disable-button was given.
+if test "${enable_button+set}" = set; then
+ enableval="$enable_button"
if test "$enableval" = yes; then
- ac_cv_use_caret='wxUSE_CARET=yes'
+ ac_cv_use_button='wxUSE_BUTTON=yes'
else
- ac_cv_use_caret='wxUSE_CARET=no'
+ ac_cv_use_button='wxUSE_BUTTON=no'
fi
else
- LINE=`grep "wxUSE_CARET" ${wx_arg_cache_file}`
+ LINE=`grep "wxUSE_BUTTON" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
- ac_cv_use_caret='wxUSE_CARET='$DEFAULT_wxUSE_CARET
+ ac_cv_use_button='wxUSE_BUTTON='$DEFAULT_wxUSE_BUTTON
fi
- eval "$ac_cv_use_caret"
+ eval "$ac_cv_use_button"
if test "$no_cache" != 1; then
- echo $ac_cv_use_caret >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_button >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_CARET" = yes; then
+ if test "$wxUSE_BUTTON" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for --enable-bmpbutton""... $ac_c" 1>&6
-echo "configure:4400: checking for --enable-bmpbutton" >&5
+echo "configure:4893: checking for --enable-bmpbutton" >&5
no_cache=0
# Check whether --enable-bmpbutton or --disable-bmpbutton was given.
if test "${enable_bmpbutton+set}" = set; then
fi
+ echo $ac_n "checking for --enable-calendar""... $ac_c" 1>&6
+echo "configure:4932: checking for --enable-calendar" >&5
+ no_cache=0
+ # Check whether --enable-calendar or --disable-calendar was given.
+if test "${enable_calendar+set}" = set; then
+ enableval="$enable_calendar"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_calendar='wxUSE_CALCTRL=yes'
+ else
+ ac_cv_use_calendar='wxUSE_CALCTRL=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_CALCTRL" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_calendar='wxUSE_CALCTRL='$DEFAULT_wxUSE_CALCTRL
+
+fi
+
+
+ eval "$ac_cv_use_calendar"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_calendar >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_CALCTRL" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-caret""... $ac_c" 1>&6
+echo "configure:4971: checking for --enable-caret" >&5
+ no_cache=0
+ # Check whether --enable-caret or --disable-caret was given.
+if test "${enable_caret+set}" = set; then
+ enableval="$enable_caret"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_caret='wxUSE_CARET=yes'
+ else
+ ac_cv_use_caret='wxUSE_CARET=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_CARET" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_caret='wxUSE_CARET='$DEFAULT_wxUSE_CARET
+
+fi
+
+
+ eval "$ac_cv_use_caret"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_caret >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_CARET" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
echo $ac_n "checking for --enable-checkbox""... $ac_c" 1>&6
-echo "configure:4439: checking for --enable-checkbox" >&5
+echo "configure:5010: checking for --enable-checkbox" >&5
no_cache=0
# Check whether --enable-checkbox or --disable-checkbox was given.
if test "${enable_checkbox+set}" = set; then
echo $ac_n "checking for --enable-checklst""... $ac_c" 1>&6
-echo "configure:4478: checking for --enable-checklst" >&5
+echo "configure:5049: checking for --enable-checklst" >&5
no_cache=0
# Check whether --enable-checklst or --disable-checklst was given.
if test "${enable_checklst+set}" = set; then
echo $ac_n "checking for --enable-choice""... $ac_c" 1>&6
-echo "configure:4517: checking for --enable-choice" >&5
+echo "configure:5088: checking for --enable-choice" >&5
no_cache=0
# Check whether --enable-choice or --disable-choice was given.
if test "${enable_choice+set}" = set; then
echo $ac_n "checking for --enable-combobox""... $ac_c" 1>&6
-echo "configure:4556: checking for --enable-combobox" >&5
+echo "configure:5127: checking for --enable-combobox" >&5
no_cache=0
# Check whether --enable-combobox or --disable-combobox was given.
if test "${enable_combobox+set}" = set; then
echo $ac_n "checking for --enable-gauge""... $ac_c" 1>&6
-echo "configure:4595: checking for --enable-gauge" >&5
+echo "configure:5166: checking for --enable-gauge" >&5
no_cache=0
# Check whether --enable-gauge or --disable-gauge was given.
if test "${enable_gauge+set}" = set; then
echo $ac_n "checking for --enable-grid""... $ac_c" 1>&6
-echo "configure:4634: checking for --enable-grid" >&5
+echo "configure:5205: checking for --enable-grid" >&5
no_cache=0
# Check whether --enable-grid or --disable-grid was given.
if test "${enable_grid+set}" = set; then
echo $ac_n "checking for --enable-newgrid""... $ac_c" 1>&6
-echo "configure:4673: checking for --enable-newgrid" >&5
+echo "configure:5244: checking for --enable-newgrid" >&5
no_cache=0
# Check whether --enable-newgrid or --disable-newgrid was given.
if test "${enable_newgrid+set}" = set; then
echo $ac_n "checking for --enable-imaglist""... $ac_c" 1>&6
-echo "configure:4712: checking for --enable-imaglist" >&5
+echo "configure:5283: checking for --enable-imaglist" >&5
no_cache=0
# Check whether --enable-imaglist or --disable-imaglist was given.
if test "${enable_imaglist+set}" = set; then
echo $ac_n "checking for --enable-listbox""... $ac_c" 1>&6
-echo "configure:4751: checking for --enable-listbox" >&5
+echo "configure:5322: checking for --enable-listbox" >&5
no_cache=0
# Check whether --enable-listbox or --disable-listbox was given.
if test "${enable_listbox+set}" = set; then
echo $ac_n "checking for --enable-listctrl""... $ac_c" 1>&6
-echo "configure:4790: checking for --enable-listctrl" >&5
+echo "configure:5361: checking for --enable-listctrl" >&5
no_cache=0
# Check whether --enable-listctrl or --disable-listctrl was given.
if test "${enable_listctrl+set}" = set; then
echo $ac_n "checking for --enable-notebook""... $ac_c" 1>&6
-echo "configure:4829: checking for --enable-notebook" >&5
+echo "configure:5400: checking for --enable-notebook" >&5
no_cache=0
# Check whether --enable-notebook or --disable-notebook was given.
if test "${enable_notebook+set}" = set; then
echo $ac_n "checking for --enable-radiobox""... $ac_c" 1>&6
-echo "configure:4868: checking for --enable-radiobox" >&5
+echo "configure:5439: checking for --enable-radiobox" >&5
no_cache=0
# Check whether --enable-radiobox or --disable-radiobox was given.
if test "${enable_radiobox+set}" = set; then
echo $ac_n "checking for --enable-radiobtn""... $ac_c" 1>&6
-echo "configure:4907: checking for --enable-radiobtn" >&5
+echo "configure:5478: checking for --enable-radiobtn" >&5
no_cache=0
# Check whether --enable-radiobtn or --disable-radiobtn was given.
if test "${enable_radiobtn+set}" = set; then
echo $ac_n "checking for --enable-sash""... $ac_c" 1>&6
-echo "configure:4946: checking for --enable-sash" >&5
+echo "configure:5517: checking for --enable-sash" >&5
no_cache=0
# Check whether --enable-sash or --disable-sash was given.
if test "${enable_sash+set}" = set; then
echo $ac_n "checking for --enable-scrollbar""... $ac_c" 1>&6
-echo "configure:4985: checking for --enable-scrollbar" >&5
+echo "configure:5556: checking for --enable-scrollbar" >&5
no_cache=0
# Check whether --enable-scrollbar or --disable-scrollbar was given.
if test "${enable_scrollbar+set}" = set; then
echo $ac_n "checking for --enable-slider""... $ac_c" 1>&6
-echo "configure:5024: checking for --enable-slider" >&5
+echo "configure:5595: checking for --enable-slider" >&5
no_cache=0
# Check whether --enable-slider or --disable-slider was given.
if test "${enable_slider+set}" = set; then
echo $ac_n "checking for --enable-spinbtn""... $ac_c" 1>&6
-echo "configure:5063: checking for --enable-spinbtn" >&5
+echo "configure:5634: checking for --enable-spinbtn" >&5
no_cache=0
# Check whether --enable-spinbtn or --disable-spinbtn was given.
if test "${enable_spinbtn+set}" = set; then
echo $ac_n "checking for --enable-spinctrl""... $ac_c" 1>&6
-echo "configure:5102: checking for --enable-spinctrl" >&5
+echo "configure:5673: checking for --enable-spinctrl" >&5
no_cache=0
# Check whether --enable-spinctrl or --disable-spinctrl was given.
if test "${enable_spinctrl+set}" = set; then
echo $ac_n "checking for --enable-splitter""... $ac_c" 1>&6
-echo "configure:5141: checking for --enable-splitter" >&5
+echo "configure:5712: checking for --enable-splitter" >&5
no_cache=0
# Check whether --enable-splitter or --disable-splitter was given.
if test "${enable_splitter+set}" = set; then
echo $ac_n "checking for --enable-statbmp""... $ac_c" 1>&6
-echo "configure:5180: checking for --enable-statbmp" >&5
+echo "configure:5751: checking for --enable-statbmp" >&5
no_cache=0
# Check whether --enable-statbmp or --disable-statbmp was given.
if test "${enable_statbmp+set}" = set; then
echo $ac_n "checking for --enable-statbox""... $ac_c" 1>&6
-echo "configure:5219: checking for --enable-statbox" >&5
+echo "configure:5790: checking for --enable-statbox" >&5
no_cache=0
# Check whether --enable-statbox or --disable-statbox was given.
if test "${enable_statbox+set}" = set; then
echo $ac_n "checking for --enable-statline""... $ac_c" 1>&6
-echo "configure:5258: checking for --enable-statline" >&5
+echo "configure:5829: checking for --enable-statline" >&5
no_cache=0
# Check whether --enable-statline or --disable-statline was given.
if test "${enable_statline+set}" = set; then
fi
+ echo $ac_n "checking for --enable-stattext""... $ac_c" 1>&6
+echo "configure:5868: checking for --enable-stattext" >&5
+ no_cache=0
+ # Check whether --enable-stattext or --disable-stattext was given.
+if test "${enable_stattext+set}" = set; then
+ enableval="$enable_stattext"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_stattext='wxUSE_STATTEXT=yes'
+ else
+ ac_cv_use_stattext='wxUSE_STATTEXT=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_STATTEXT" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_stattext='wxUSE_STATTEXT='$DEFAULT_wxUSE_STATTEXT
+
+fi
+
+
+ eval "$ac_cv_use_stattext"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_stattext >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_STATTEXT" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
echo $ac_n "checking for --enable-statusbar""... $ac_c" 1>&6
-echo "configure:5297: checking for --enable-statusbar" >&5
+echo "configure:5907: checking for --enable-statusbar" >&5
no_cache=0
# Check whether --enable-statusbar or --disable-statusbar was given.
if test "${enable_statusbar+set}" = set; then
echo $ac_n "checking for --enable-tabdialog""... $ac_c" 1>&6
-echo "configure:5336: checking for --enable-tabdialog" >&5
+echo "configure:5946: checking for --enable-tabdialog" >&5
no_cache=0
# Check whether --enable-tabdialog or --disable-tabdialog was given.
if test "${enable_tabdialog+set}" = set; then
fi
+ echo $ac_n "checking for --enable-textctrl""... $ac_c" 1>&6
+echo "configure:5985: checking for --enable-textctrl" >&5
+ no_cache=0
+ # Check whether --enable-textctrl or --disable-textctrl was given.
+if test "${enable_textctrl+set}" = set; then
+ enableval="$enable_textctrl"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_textctrl='wxUSE_TEXTCTRL=yes'
+ else
+ ac_cv_use_textctrl='wxUSE_TEXTCTRL=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_TEXTCTRL" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_textctrl='wxUSE_TEXTCTRL='$DEFAULT_wxUSE_TEXTCTRL
+
+fi
+
+
+ eval "$ac_cv_use_textctrl"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_textctrl >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_TEXTCTRL" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
echo $ac_n "checking for --enable-togglebtn""... $ac_c" 1>&6
-echo "configure:5375: checking for --enable-togglebtn" >&5
+echo "configure:6024: checking for --enable-togglebtn" >&5
no_cache=0
# Check whether --enable-togglebtn or --disable-togglebtn was given.
if test "${enable_togglebtn+set}" = set; then
echo $ac_n "checking for --enable-toolbar""... $ac_c" 1>&6
-echo "configure:5414: checking for --enable-toolbar" >&5
+echo "configure:6063: checking for --enable-toolbar" >&5
no_cache=0
# Check whether --enable-toolbar or --disable-toolbar was given.
if test "${enable_toolbar+set}" = set; then
echo $ac_n "checking for --enable-tbarnative""... $ac_c" 1>&6
-echo "configure:5453: checking for --enable-tbarnative" >&5
+echo "configure:6102: checking for --enable-tbarnative" >&5
no_cache=0
# Check whether --enable-tbarnative or --disable-tbarnative was given.
if test "${enable_tbarnative+set}" = set; then
echo $ac_n "checking for --enable-tbarsmpl""... $ac_c" 1>&6
-echo "configure:5492: checking for --enable-tbarsmpl" >&5
+echo "configure:6141: checking for --enable-tbarsmpl" >&5
no_cache=0
# Check whether --enable-tbarsmpl or --disable-tbarsmpl was given.
if test "${enable_tbarsmpl+set}" = set; then
echo $ac_n "checking for --enable-treectrl""... $ac_c" 1>&6
-echo "configure:5531: checking for --enable-treectrl" >&5
+echo "configure:6180: checking for --enable-treectrl" >&5
no_cache=0
# Check whether --enable-treectrl or --disable-treectrl was given.
if test "${enable_treectrl+set}" = set; then
fi
- eval "$ac_cv_use_treectrl"
+ eval "$ac_cv_use_treectrl"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_treectrl >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_TREECTRL" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+
+
+ echo $ac_n "checking for --enable-commondlg""... $ac_c" 1>&6
+echo "configure:6221: checking for --enable-commondlg" >&5
+ no_cache=0
+ # Check whether --enable-commondlg or --disable-commondlg was given.
+if test "${enable_commondlg+set}" = set; then
+ enableval="$enable_commondlg"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_commondlg='wxUSE_COMMONDLGS=yes'
+ else
+ ac_cv_use_commondlg='wxUSE_COMMONDLGS=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_COMMONDLGS" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_commondlg='wxUSE_COMMONDLGS='$DEFAULT_wxUSE_COMMONDLGS
+
+fi
+
+
+ eval "$ac_cv_use_commondlg"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_commondlg >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_COMMONDLGS" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-choicedlg""... $ac_c" 1>&6
+echo "configure:6260: checking for --enable-choicedlg" >&5
+ no_cache=0
+ # Check whether --enable-choicedlg or --disable-choicedlg was given.
+if test "${enable_choicedlg+set}" = set; then
+ enableval="$enable_choicedlg"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_choicedlg='wxUSE_CHOICEDLG=yes'
+ else
+ ac_cv_use_choicedlg='wxUSE_CHOICEDLG=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_CHOICEDLG" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_choicedlg='wxUSE_CHOICEDLG='$DEFAULT_wxUSE_CHOICEDLG
+
+fi
+
+
+ eval "$ac_cv_use_choicedlg"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_choicedlg >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_CHOICEDLG" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-coldlg""... $ac_c" 1>&6
+echo "configure:6299: checking for --enable-coldlg" >&5
+ no_cache=0
+ # Check whether --enable-coldlg or --disable-coldlg was given.
+if test "${enable_coldlg+set}" = set; then
+ enableval="$enable_coldlg"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_coldlg='wxUSE_COLOURDLG=yes'
+ else
+ ac_cv_use_coldlg='wxUSE_COLOURDLG=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_COLOURDLG" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_coldlg='wxUSE_COLOURDLG='$DEFAULT_wxUSE_COLOURDLG
+
+fi
+
+
+ eval "$ac_cv_use_coldlg"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_coldlg >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_COLOURDLG" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-filedlg""... $ac_c" 1>&6
+echo "configure:6338: checking for --enable-filedlg" >&5
+ no_cache=0
+ # Check whether --enable-filedlg or --disable-filedlg was given.
+if test "${enable_filedlg+set}" = set; then
+ enableval="$enable_filedlg"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_filedlg='wxUSE_FILEDLG=yes'
+ else
+ ac_cv_use_filedlg='wxUSE_FILEDLG=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_FILEDLG" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_filedlg='wxUSE_FILEDLG='$DEFAULT_wxUSE_FILEDLG
+
+fi
+
+
+ eval "$ac_cv_use_filedlg"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_filedlg >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_FILEDLG" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-fontdlg""... $ac_c" 1>&6
+echo "configure:6377: checking for --enable-fontdlg" >&5
+ no_cache=0
+ # Check whether --enable-fontdlg or --disable-fontdlg was given.
+if test "${enable_fontdlg+set}" = set; then
+ enableval="$enable_fontdlg"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_fontdlg='wxUSE_FONTDLG=yes'
+ else
+ ac_cv_use_fontdlg='wxUSE_FONTDLG=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_FONTDLG" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_fontdlg='wxUSE_FONTDLG='$DEFAULT_wxUSE_FONTDLG
+
+fi
+
+
+ eval "$ac_cv_use_fontdlg"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_fontdlg >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_FONTDLG" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
+ echo $ac_n "checking for --enable-dirdlg""... $ac_c" 1>&6
+echo "configure:6416: checking for --enable-dirdlg" >&5
+ no_cache=0
+ # Check whether --enable-dirdlg or --disable-dirdlg was given.
+if test "${enable_dirdlg+set}" = set; then
+ enableval="$enable_dirdlg"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_dirdlg='wxUSE_DIRDLG=yes'
+ else
+ ac_cv_use_dirdlg='wxUSE_DIRDLG=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_DIRDLG" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_dirdlg='wxUSE_DIRDLG='$DEFAULT_wxUSE_DIRDLG
+
+fi
+
+
+ eval "$ac_cv_use_dirdlg"
if test "$no_cache" != 1; then
- echo $ac_cv_use_treectrl >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_dirdlg >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_TREECTRL" = yes; then
+ if test "$wxUSE_DIRDLG" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
-
-
- echo $ac_n "checking for --enable-commondlg""... $ac_c" 1>&6
-echo "configure:5572: checking for --enable-commondlg" >&5
+ echo $ac_n "checking for --enable-msgdlg""... $ac_c" 1>&6
+echo "configure:6455: checking for --enable-msgdlg" >&5
no_cache=0
- # Check whether --enable-commondlg or --disable-commondlg was given.
-if test "${enable_commondlg+set}" = set; then
- enableval="$enable_commondlg"
+ # Check whether --enable-msgdlg or --disable-msgdlg was given.
+if test "${enable_msgdlg+set}" = set; then
+ enableval="$enable_msgdlg"
if test "$enableval" = yes; then
- ac_cv_use_commondlg='wxUSE_COMMONDLGS=yes'
+ ac_cv_use_msgdlg='wxUSE_MSGDLG=yes'
else
- ac_cv_use_commondlg='wxUSE_COMMONDLGS=no'
+ ac_cv_use_msgdlg='wxUSE_MSGDLG=no'
fi
else
- LINE=`grep "wxUSE_COMMONDLGS" ${wx_arg_cache_file}`
+ LINE=`grep "wxUSE_MSGDLG" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
- ac_cv_use_commondlg='wxUSE_COMMONDLGS='$DEFAULT_wxUSE_COMMONDLGS
+ ac_cv_use_msgdlg='wxUSE_MSGDLG='$DEFAULT_wxUSE_MSGDLG
fi
- eval "$ac_cv_use_commondlg"
+ eval "$ac_cv_use_msgdlg"
if test "$no_cache" != 1; then
- echo $ac_cv_use_commondlg >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_msgdlg >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_COMMONDLGS" = yes; then
+ if test "$wxUSE_MSGDLG" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- echo $ac_n "checking for --enable-dirdlg""... $ac_c" 1>&6
-echo "configure:5611: checking for --enable-dirdlg" >&5
+ echo $ac_n "checking for --enable-numberdlg""... $ac_c" 1>&6
+echo "configure:6494: checking for --enable-numberdlg" >&5
no_cache=0
- # Check whether --enable-dirdlg or --disable-dirdlg was given.
-if test "${enable_dirdlg+set}" = set; then
- enableval="$enable_dirdlg"
+ # Check whether --enable-numberdlg or --disable-numberdlg was given.
+if test "${enable_numberdlg+set}" = set; then
+ enableval="$enable_numberdlg"
if test "$enableval" = yes; then
- ac_cv_use_dirdlg='wxUSE_DIRDLG=yes'
+ ac_cv_use_numberdlg='wxUSE_NUMBERDLG=yes'
else
- ac_cv_use_dirdlg='wxUSE_DIRDLG=no'
+ ac_cv_use_numberdlg='wxUSE_NUMBERDLG=no'
fi
else
- LINE=`grep "wxUSE_DIRDLG" ${wx_arg_cache_file}`
+ LINE=`grep "wxUSE_NUMBERDLG" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
- ac_cv_use_dirdlg='wxUSE_DIRDLG='$DEFAULT_wxUSE_DIRDLG
+ ac_cv_use_numberdlg='wxUSE_NUMBERDLG='$DEFAULT_wxUSE_NUMBERDLG
fi
- eval "$ac_cv_use_dirdlg"
+ eval "$ac_cv_use_numberdlg"
if test "$no_cache" != 1; then
- echo $ac_cv_use_dirdlg >> ${wx_arg_cache_file}.tmp
+ echo $ac_cv_use_numberdlg >> ${wx_arg_cache_file}.tmp
fi
- if test "$wxUSE_DIRDLG" = yes; then
+ if test "$wxUSE_NUMBERDLG" = yes; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for --enable-textdlg""... $ac_c" 1>&6
-echo "configure:5650: checking for --enable-textdlg" >&5
+echo "configure:6533: checking for --enable-textdlg" >&5
no_cache=0
# Check whether --enable-textdlg or --disable-textdlg was given.
if test "${enable_textdlg+set}" = set; then
echo $ac_n "checking for --enable-tipdlg""... $ac_c" 1>&6
-echo "configure:5689: checking for --enable-tipdlg" >&5
+echo "configure:6572: checking for --enable-tipdlg" >&5
no_cache=0
# Check whether --enable-tipdlg or --disable-tipdlg was given.
if test "${enable_tipdlg+set}" = set; then
echo $ac_n "checking for --enable-progressdlg""... $ac_c" 1>&6
-echo "configure:5728: checking for --enable-progressdlg" >&5
+echo "configure:6611: checking for --enable-progressdlg" >&5
no_cache=0
# Check whether --enable-progressdlg or --disable-progressdlg was given.
if test "${enable_progressdlg+set}" = set; then
fi
+ echo $ac_n "checking for --enable-menus""... $ac_c" 1>&6
+echo "configure:6650: checking for --enable-menus" >&5
+ no_cache=0
+ # Check whether --enable-menus or --disable-menus was given.
+if test "${enable_menus+set}" = set; then
+ enableval="$enable_menus"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_menus='wxUSE_MENUS=yes'
+ else
+ ac_cv_use_menus='wxUSE_MENUS=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_MENUS" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_menus='wxUSE_MENUS='$DEFAULT_wxUSE_MENUS
+
+fi
+
+
+ eval "$ac_cv_use_menus"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_menus >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_MENUS" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
echo $ac_n "checking for --enable-miniframe""... $ac_c" 1>&6
-echo "configure:5767: checking for --enable-miniframe" >&5
+echo "configure:6689: checking for --enable-miniframe" >&5
no_cache=0
# Check whether --enable-miniframe or --disable-miniframe was given.
if test "${enable_miniframe+set}" = set; then
echo $ac_n "checking for --enable-html""... $ac_c" 1>&6
-echo "configure:5806: checking for --enable-html" >&5
+echo "configure:6728: checking for --enable-html" >&5
no_cache=0
# Check whether --enable-html or --disable-html was given.
if test "${enable_html+set}" = set; then
echo $ac_n "checking for --enable-tooltips""... $ac_c" 1>&6
-echo "configure:5845: checking for --enable-tooltips" >&5
+echo "configure:6767: checking for --enable-tooltips" >&5
no_cache=0
# Check whether --enable-tooltips or --disable-tooltips was given.
if test "${enable_tooltips+set}" = set; then
echo $ac_n "checking for --enable-splines""... $ac_c" 1>&6
-echo "configure:5884: checking for --enable-splines" >&5
+echo "configure:6806: checking for --enable-splines" >&5
no_cache=0
# Check whether --enable-splines or --disable-splines was given.
if test "${enable_splines+set}" = set; then
echo $ac_n "checking for --enable-validators""... $ac_c" 1>&6
-echo "configure:5923: checking for --enable-validators" >&5
+echo "configure:6845: checking for --enable-validators" >&5
no_cache=0
# Check whether --enable-validators or --disable-validators was given.
if test "${enable_validators+set}" = set; then
echo $ac_n "checking for --enable-busyinfo""... $ac_c" 1>&6
-echo "configure:5962: checking for --enable-busyinfo" >&5
+echo "configure:6884: checking for --enable-busyinfo" >&5
no_cache=0
# Check whether --enable-busyinfo or --disable-busyinfo was given.
if test "${enable_busyinfo+set}" = set; then
echo $ac_n "checking for --enable-joystick""... $ac_c" 1>&6
-echo "configure:6001: checking for --enable-joystick" >&5
+echo "configure:6923: checking for --enable-joystick" >&5
no_cache=0
# Check whether --enable-joystick or --disable-joystick was given.
if test "${enable_joystick+set}" = set; then
fi
+ echo $ac_n "checking for --enable-metafile""... $ac_c" 1>&6
+echo "configure:6962: checking for --enable-metafile" >&5
+ no_cache=0
+ # Check whether --enable-metafile or --disable-metafile was given.
+if test "${enable_metafile+set}" = set; then
+ enableval="$enable_metafile"
+
+ if test "$enableval" = yes; then
+ ac_cv_use_metafile='wxUSE_METAFILE=yes'
+ else
+ ac_cv_use_metafile='wxUSE_METAFILE=no'
+ fi
+
+else
+
+ LINE=`grep "wxUSE_METAFILE" ${wx_arg_cache_file}`
+ if test "x$LINE" != x ; then
+ eval "DEFAULT_$LINE"
+ else
+ no_cache=1
+ fi
+
+ ac_cv_use_metafile='wxUSE_METAFILE='$DEFAULT_wxUSE_METAFILE
+
+fi
+
+
+ eval "$ac_cv_use_metafile"
+ if test "$no_cache" != 1; then
+ echo $ac_cv_use_metafile >> ${wx_arg_cache_file}.tmp
+ fi
+
+ if test "$wxUSE_METAFILE" = yes; then
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+
+
echo $ac_n "checking for --enable-image""... $ac_c" 1>&6
-echo "configure:6042: checking for --enable-image" >&5
+echo "configure:7003: checking for --enable-image" >&5
no_cache=0
# Check whether --enable-image or --disable-image was given.
if test "${enable_image+set}" = set; then
echo $ac_n "checking for --enable-gif""... $ac_c" 1>&6
-echo "configure:6081: checking for --enable-gif" >&5
+echo "configure:7042: checking for --enable-gif" >&5
no_cache=0
# Check whether --enable-gif or --disable-gif was given.
if test "${enable_gif+set}" = set; then
echo $ac_n "checking for --enable-pcx""... $ac_c" 1>&6
-echo "configure:6120: checking for --enable-pcx" >&5
+echo "configure:7081: checking for --enable-pcx" >&5
no_cache=0
# Check whether --enable-pcx or --disable-pcx was given.
if test "${enable_pcx+set}" = set; then
echo $ac_n "checking for --enable-pnm""... $ac_c" 1>&6
-echo "configure:6159: checking for --enable-pnm" >&5
+echo "configure:7120: checking for --enable-pnm" >&5
no_cache=0
# Check whether --enable-pnm or --disable-pnm was given.
if test "${enable_pnm+set}" = set; then
echo $ac_n "checking for --enable-pnm""... $ac_c" 1>&6
-echo "configure:6198: checking for --enable-pnm" >&5
+echo "configure:7159: checking for --enable-pnm" >&5
no_cache=0
# Check whether --enable-pnm or --disable-pnm was given.
if test "${enable_pnm+set}" = set; then
echo $ac_n "checking for toolkit""... $ac_c" 1>&6
-echo "configure:6245: checking for toolkit" >&5
+echo "configure:7206: checking for toolkit" >&5
if test "$wxUSE_GUI" = "yes"; then
done
fi
-NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MAC:-0} + ${wxUSE_WINE:-0} + ${wxUSE_MINGW:-0} + ${wxUSE_CYGWIN:-0}`
+NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MAC:-0} + ${wxUSE_WINE:-0} + ${wxUSE_MINGW:-0} + ${wxUSE_CYGWIN:-0} + ${wxUSE_MGL:-0}`
case "${host}" in
*-pc-os2_emx )
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6378: checking for $ac_word" >&5
+echo "configure:7339: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6408: checking for $ac_word" >&5
+echo "configure:7369: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6459: checking for $ac_word" >&5
+echo "configure:7420: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:6491: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:7452: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 6502 "configure"
+#line 7463 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:6507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:6533: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:7494: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:6538: checking whether we are using GNU C" >&5
+echo "configure:7499: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:6547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:7508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:6566: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:7527: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
CFLAGS=`echo "$CFLAGS" | sed 's/-g//g'`
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:6601: checking how to run the C preprocessor" >&5
+echo "configure:7562: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 6616 "configure"
+#line 7577 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6622: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 6633 "configure"
+#line 7594 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 6650 "configure"
+#line 7611 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:6683: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:7644: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 6689 "configure"
+#line 7650 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 6707 "configure"
+#line 7668 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6743: checking for $ac_word" >&5
+echo "configure:7704: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:6775: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:7736: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 6786 "configure"
+#line 7747 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
-if { (eval echo configure:6791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:6817: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:7778: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:6822: checking whether we are using GNU C++" >&5
+echo "configure:7783: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:6831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:7792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:6850: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:7811: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:6883: checking how to run the C++ preprocessor" >&5
+echo "configure:7844: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 6896 "configure"
+#line 7857 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6939: checking for $ac_word" >&5
+echo "configure:7900: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6970: checking for $ac_word" >&5
+echo "configure:7931: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:7010: checking for a BSD compatible install" >&5
+echo "configure:7971: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7066: checking for $ac_word" >&5
+echo "configure:8027: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking make for VPATH support""... $ac_c" 1>&6
-echo "configure:7095: checking make for VPATH support" >&5
+echo "configure:8056: checking make for VPATH support" >&5
cat - << EOF > confMake
check : file
cp \$? \$@
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7132: checking for $ac_word" >&5
+echo "configure:8093: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "flex", so it can be a program name with args.
set dummy flex; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7166: checking for $ac_word" >&5
+echo "configure:8127: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
*) ac_lib=l ;;
esac
echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:7200: checking for yywrap in -l$ac_lib" >&5
+echo "configure:8161: checking for yywrap in -l$ac_lib" >&5
ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$ac_lib $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7208 "configure"
+#line 8169 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
yywrap()
; return 0; }
EOF
-if { (eval echo configure:7219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:7243: checking whether ln -s works" >&5
+echo "configure:8204: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
AFMINSTALL=
if test "$wxUSE_GUI" = "yes"; then
+ USE_GUI=1
-USE_GUI=1
-
-TOOLKIT=
-TOOLKIT_INCLUDE=
+ TOOLKIT=
+ TOOLKIT_INCLUDE=
-GUI_TK_LIBRARY=
-GUI_TK_LINK=
+ GUI_TK_LIBRARY=
+ GUI_TK_LINK=
-WXGTK12=
-WXGTK127=
-WXGTK20=
+ WXGTK12=
+ WXGTK127=
+ WXGTK20=
-WXWINE=
+ WXWINE=
-if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then
- if test "$cross_compiling" = "yes" ; then
- echo "configure: warning: skipping windows.h check for cross-compilation" 1>&2
- else
- echo $ac_n "checking for Windows headers""... $ac_c" 1>&6
-echo "configure:7407: checking for Windows headers" >&5
-
+ if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then
+ if test "$cross_compiling" = "yes" ; then
+ echo "configure: warning: skipping windows.h check for cross-compilation" 1>&2
+ else
+ echo $ac_n "checking for Windows headers""... $ac_c" 1>&6
+echo "configure:8367: checking for Windows headers" >&5
+
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
do
fi
done
- if test "$ac_find_includes" != "" ; then
- echo "$ac_t""found $ac_find_includes" 1>&6
- TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
- else
- echo "$ac_t""no" 1>&6
- { echo "configure: error: please set CFLAGS to contain the location of windows.h" 1>&2; exit 1; }
+ if test "$ac_find_includes" != "" ; then
+ echo "$ac_t""found $ac_find_includes" 1>&6
+ TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+ else
+ echo "$ac_t""no" 1>&6
+ { echo "configure: error: please set CFLAGS to contain the location of windows.h" 1>&2; exit 1; }
+ fi
fi
- fi
-
- INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
- LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
- if test "$wxUSE_ODBC" = "yes" ; then
- LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
- fi
+ INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
+ LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
- if test "$wxUSE_MINGW" = 1; then
- LDFLAGS="$LDFLAGS -mwindows"
- fi
+ if test "$wxUSE_ODBC" = "yes" ; then
+ LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
+ fi
- TOOLKIT=MSW
- GUIDIST=MSW_DIST
+ if test "$wxUSE_MINGW" = 1; then
+ LDFLAGS="$LDFLAGS -mwindows"
+ fi
- RCINCSWITCH="--include-dir"
- RCDEFSWITCH="--define"
- RCPREPROCESSOR="--preprocessor \"\$(CC) -c -E -xc-header -DRC_INVOKED\""
- RCINPUTSWITCH="-i"
- RCOUTPUTSWITCH="-o"
- RESFLAGS="$RCPREPROCESSOR $RCINCSWITCH \$(top_srcdir)/include $RCINCSWITCH \$(top_srcdir)/\$(program_dir) $RCDEFSWITCH __WIN32__ $RCDEFSWITCH __WIN95__ $RCDEFSWITCH __GNUWIN32__"
+ TOOLKIT=MSW
+ GUIDIST=MSW_DIST
- RESPROGRAM="\$(RES_PROGRAM)"
+ RCINCSWITCH="--include-dir"
+ RCDEFSWITCH="--define"
+ RCPREPROCESSOR="--preprocessor \"\$(CC) -c -E -xc-header -DRC_INVOKED\""
+ RCINPUTSWITCH="-i"
+ RCOUTPUTSWITCH="-o"
+ RESFLAGS="$RCPREPROCESSOR $RCINCSWITCH \$(top_srcdir)/include $RCINCSWITCH \$(top_srcdir)/\$(program_dir) $RCDEFSWITCH __WIN32__ $RCDEFSWITCH __WIN95__ $RCDEFSWITCH __GNUWIN32__"
-fi
+ RESPROGRAM="\$(RES_PROGRAM)"
+ fi
-if test "$wxUSE_GTK" = 1; then
- # Check whether --with-gtk-prefix or --without-gtk-prefix was given.
+ if test "$wxUSE_GTK" = 1; then
+ # Check whether --with-gtk-prefix or --without-gtk-prefix was given.
if test "${with_gtk_prefix+set}" = set; then
withval="$with_gtk_prefix"
gtk_config_prefix="$withval"
# Extract the first word of "gtk-config-2.0", so it can be a program name with args.
set dummy gtk-config-2.0; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7503: checking for $ac_word" >&5
+echo "configure:8462: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG_2_0'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
min_gtk_version=1.3.1
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:7538: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:8497: checking for GTK - version >= $min_gtk_version" >&5
no_gtk=""
if test "$GTK_CONFIG_2_0" = "no" ; then
no_gtk=yes
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 7561 "configure"
+#line 8520 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
}
EOF
-if { (eval echo configure:7639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7673 "configure"
+#line 8632 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
; return 0; }
EOF
-if { (eval echo configure:7683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GTK or finding the wrong"
GTK_CFLAGS=""
GTK_LIBS=""
-
+
if test x$gtk_config_exec_prefix != x ; then
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
if test x${GTK_CONFIG+set} != xset ; then
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7733: checking for $ac_word" >&5
+echo "configure:8692: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
min_gtk_version=1.2.7
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:7768: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:8727: checking for GTK - version >= $min_gtk_version" >&5
no_gtk=""
if test "$GTK_CONFIG" != "no" ; then
GTK_CFLAGS=`$GTK_CONFIG --cflags`
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 7781 "configure"
+#line 8740 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
}
EOF
-if { (eval echo configure:7814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
-
+
if test x$gtk_config_exec_prefix != x ; then
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
if test x${GTK_CONFIG+set} != xset ; then
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7860: checking for $ac_word" >&5
+echo "configure:8819: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
min_gtk_version=1.2.3
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:7895: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:8854: checking for GTK - version >= $min_gtk_version" >&5
no_gtk=""
if test "$GTK_CONFIG" != "no" ; then
GTK_CFLAGS=`$GTK_CONFIG --cflags`
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 7908 "configure"
+#line 8867 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
}
EOF
-if { (eval echo configure:7941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
-
+
fi
rm -f conf.gtktest
- if test "$WXGTK12" != 1 -a "$WXGTK20" != 1; then
- { echo "configure: error:
- Please check that gtk-config is in path, the directory
- where GTK+ libraries are installed (returned by
- 'gtk-config --libs' command) is in LD_LIBRARY_PATH or
- equivalent variable and GTK+ is version 1.2.3 or above.
- " 1>&2; exit 1; }
- fi
-
- TOOLKIT_INCLUDE="$GTK_CFLAGS"
-
+ if test "$WXGTK12" != 1 -a "$WXGTK20" != 1; then
+ { echo "configure: error:
+ Please check that gtk-config is in path, the directory
+ where GTK+ libraries are installed (returned by
+ 'gtk-config --libs' command) is in LD_LIBRARY_PATH or
+ equivalent variable and GTK+ is version 1.2.3 or above.
+ " 1>&2; exit 1; }
+ fi
- GUI_TK_LIBRARY="$GTK_LIBS"
+ TOOLKIT_INCLUDE="$GTK_CFLAGS"
+
+ GUI_TK_LIBRARY="$GTK_LIBS"
- AFMINSTALL=afminstall
- TOOLKIT=GTK
- GUIDIST=GTK_DIST
+
+ AFMINSTALL=afminstall
+ TOOLKIT=GTK
+ GUIDIST=GTK_DIST
- echo $ac_n "checking for gdk_im_open in -lgdk""... $ac_c" 1>&6
-echo "configure:7997: checking for gdk_im_open in -lgdk" >&5
+ echo $ac_n "checking for gdk_im_open in -lgdk""... $ac_c" 1>&6
+echo "configure:8956: checking for gdk_im_open in -lgdk" >&5
ac_lib_var=`echo gdk'_'gdk_im_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lgdk $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8005 "configure"
+#line 8964 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
gdk_im_open()
; return 0; }
EOF
-if { (eval echo configure:8016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$ac_t""no" 1>&6
fi
-fi
+ fi
-if test "$wxUSE_WINE" = 1; then
- echo $ac_n "checking for WINE includes""... $ac_c" 1>&6
-echo "configure:8043: checking for WINE includes" >&5
-
+ if test "$wxUSE_MGL" = 1; then
+
+ echo $ac_n "checking for SciTech MGL library""... $ac_c" 1>&6
+echo "configure:9003: checking for SciTech MGL library" >&5
+ if test "x$MGL_ROOT" = x ; then
+ echo "$ac_t""not found" 1>&6
+ { echo "configure: error: Cannot find MGL library. Make sure MGL_ROOT is set." 1>&2; exit 1; }
+ else
+ echo "$ac_t""$MGL_ROOT" 1>&6
+ fi
+
+ MGL_OS=linux/gcc/glibc
+ MGL_LIB_TYPE=""
+
+ if test "$wxUSE_DEBUG_FLAG" = yes ; then
+ if test -f $MGL_ROOT/lib/debug/$MGL_OS/libmgl.a ; then
+ MGL_LIB_TYPE=debug
+ fi
+ fi
+ if test "x$MGL_LIB_TYPE" = x ; then
+ if test -f $MGL_ROOT/lib/release/$MGL_OS/libmgl.a ; then
+ MGL_LIB_TYPE=release
+ else
+ { echo "configure: error: Cannot find MGL libraries, make sure they are compiled." 1>&2; exit 1; }
+ fi
+ fi
+
+ TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
+ GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$MGL_LIB_TYPE/$MGL_OS -lmgl -lmglcpp -lpm"
+
+ AFMINSTALL=afminstall
+ TOOLKIT=MGL
+ GUIDIST=MGL_DIST
+ fi
+
+ if test "$wxUSE_WINE" = 1; then
+ echo $ac_n "checking for WINE includes""... $ac_c" 1>&6
+echo "configure:9037: checking for WINE includes" >&5
+
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
do
fi
done
- if test "$ac_find_includes" != "" ; then
- echo "$ac_t""found $ac_find_includes" 1>&6
- TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
- else
- echo "$ac_t""no" 1>&6
- { echo "configure: error: please set CFLAGS to contain the location of windows.h" 1>&2; exit 1; }
- fi
+ if test "$ac_find_includes" != "" ; then
+ echo "$ac_t""found $ac_find_includes" 1>&6
+ TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+ else
+ echo "$ac_t""no" 1>&6
+ { echo "configure: error: please set CFLAGS to contain the location of windows.h" 1>&2; exit 1; }
+ fi
- XPM_LINK=""
- echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
-echo "configure:8064: checking for Xpm library" >&5
-
+ XPM_LINK=""
+ echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
+echo "configure:9058: checking for Xpm library" >&5
+
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
do
done
done
- if test "$ac_find_libraries" != "" ; then
- GUI_TK_LIBRARY="-L$ac_find_libraries"
- XPM_LINK="-lXpm"
- cat >> confdefs.h <<\EOF
+ if test "$ac_find_libraries" != "" ; then
+ GUI_TK_LIBRARY="-L$ac_find_libraries"
+ XPM_LINK="-lXpm"
+ cat >> confdefs.h <<\EOF
#define wxHAVE_LIB_XPM 1
EOF
- echo "$ac_t""found at $ac_find_libraries" 1>&6
- else
- echo "$ac_t""no" 1>&6
- echo "configure: warning: library will be compiled without support for images in XPM format" 1>&2
- fi
+ echo "$ac_t""found at $ac_find_libraries" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ echo "configure: warning: library will be compiled without support for images in XPM format" 1>&2
+ fi
- MESA_LINK=""
- echo $ac_n "checking for Mesa library""... $ac_c" 1>&6
-echo "configure:8092: checking for Mesa library" >&5
-
+ MESA_LINK=""
+ echo $ac_n "checking for Mesa library""... $ac_c" 1>&6
+echo "configure:9086: checking for Mesa library" >&5
+
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
do
done
done
- if test "$ac_find_libraries" != "" ; then
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
- MESA_LINK="-lMesaGL"
- echo "$ac_t""found at $ac_find_libraries" 1>&6
- else
- { echo "configure: error: no" 1>&2; exit 1; }
- fi
-
- GUI_TK_LINK="-lwine $MESA_LINK $XPM_LINK -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses"
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
- WXWINE=1
- TOOLKIT=MSW
- GUIDIST=MSW_DIST
-fi
+ if test "$ac_find_libraries" != "" ; then
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
+ MESA_LINK="-lMesaGL"
+ echo "$ac_t""found at $ac_find_libraries" 1>&6
+ else
+ { echo "configure: error: no" 1>&2; exit 1; }
+ fi
+ GUI_TK_LINK="-lwine $MESA_LINK $XPM_LINK -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
+ WXWINE=1
+ TOOLKIT=MSW
+ GUIDIST=MSW_DIST
+ fi
-# If we find X, set shell vars x_includes and x_libraries to the
+
+ # If we find X, set shell vars x_includes and x_libraries to the
# paths, otherwise set no_x=yes.
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:8126: checking for X" >&5
+echo "configure:9120: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 8188 "configure"
+#line 9182 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8262 "configure"
+#line 9256 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:8269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:8375: checking whether -R must be followed by a space" >&5
+echo "configure:9369: checking whether -R must be followed by a space" >&5
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 8378 "configure"
+#line 9372 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:8385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 8401 "configure"
+#line 9395 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:8408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:8440: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:9434: checking for dnet_ntoa in -ldnet" >&5
ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8448 "configure"
+#line 9442 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:8459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:8481: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:9475: checking for dnet_ntoa in -ldnet_stub" >&5
ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8489 "configure"
+#line 9483 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:8500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# The nsl library prevents programs from opening the X display
# on Irix 5.2, according to dickey@clark.net.
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:8529: checking for gethostbyname" >&5
+echo "configure:9523: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8534 "configure"
+#line 9528 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
; return 0; }
EOF
-if { (eval echo configure:8557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:8578: checking for gethostbyname in -lnsl" >&5
+echo "configure:9572: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8586 "configure"
+#line 9580 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:8597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:8627: checking for connect" >&5
+echo "configure:9621: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8632 "configure"
+#line 9626 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
; return 0; }
EOF
-if { (eval echo configure:8655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:8676: checking for connect in -lsocket" >&5
+echo "configure:9670: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8684 "configure"
+#line 9678 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
connect()
; return 0; }
EOF
-if { (eval echo configure:8695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:8719: checking for remove" >&5
+echo "configure:9713: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8724 "configure"
+#line 9718 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
; return 0; }
EOF
-if { (eval echo configure:8747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:8768: checking for remove in -lposix" >&5
+echo "configure:9762: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8776 "configure"
+#line 9770 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
remove()
; return 0; }
EOF
-if { (eval echo configure:8787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:8811: checking for shmat" >&5
+echo "configure:9805: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8816 "configure"
+#line 9810 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
; return 0; }
EOF
-if { (eval echo configure:8839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:8860: checking for shmat in -lipc" >&5
+echo "configure:9854: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8868 "configure"
+#line 9862 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
shmat()
; return 0; }
EOF
-if { (eval echo configure:8879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:8912: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:9906: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8920 "configure"
+#line 9914 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:8931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
-CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-LDFLAGS="$LDFLAGS $X_LIBS"
+ CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+ LDFLAGS="$LDFLAGS $X_LIBS"
-if test "$wxUSE_MOTIF" = 1; then
- if test "$no_x" = "yes"; then
- { echo "configure: error: X11 not found" 1>&2; exit 1; }
- fi
+ if test "$wxUSE_MOTIF" = 1; then
+ if test "$no_x" = "yes"; then
+ { echo "configure: error: X11 not found" 1>&2; exit 1; }
+ fi
- GUI_TK_LIBRARY="$X_LIBS"
- TOOLKIT_INCLUDE="$X_CFLAGS"
+ GUI_TK_LIBRARY="$X_LIBS"
+ TOOLKIT_INCLUDE="$X_CFLAGS"
- AFMINSTALL=afminstall
+ AFMINSTALL=afminstall
-
- COMPILED_X_PROGRAM=0
+
+ COMPILED_X_PROGRAM=0
- echo $ac_n "checking for Motif/Lesstif headers""... $ac_c" 1>&6
-echo "configure:8972: checking for Motif/Lesstif headers" >&5
-
+ echo $ac_n "checking for Motif/Lesstif headers""... $ac_c" 1>&6
+echo "configure:9966: checking for Motif/Lesstif headers" >&5
+
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
do
fi
done
- if test "$ac_find_includes" != "" ; then
- echo "$ac_t""found $ac_find_includes" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
-#line 8987 "configure"
+ if test "$ac_find_includes" != "" ; then
+ echo "$ac_t""found $ac_find_includes" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+#line 9981 "configure"
#include "confdefs.h"
- #include <Xm/Xm.h>
-
+ #include <Xm/Xm.h>
+
int main() {
- int version;
+ int version;
- version = xmUseVersion;
-
+ version = xmUseVersion;
+
; return 0; }
EOF
-if { (eval echo configure:9000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- echo "$ac_t""found in default search path" 1>&6
- COMPILED_X_PROGRAM=1
-
+ echo "$ac_t""found in default search path" 1>&6
+ COMPILED_X_PROGRAM=1
+
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- echo "$ac_t""no" 1>&6
- { echo "configure: error: please set CFLAGS to contain the location of Xm/Xm.h" 1>&2; exit 1; }
+ echo "$ac_t""no" 1>&6
+ { echo "configure: error: please set CFLAGS to contain the location of Xm/Xm.h" 1>&2; exit 1; }
+
-
fi
rm -f conftest*
- fi
+ fi
- if test "$COMPILED_X_PROGRAM" = 0; then
- echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6
-echo "configure:9021: checking for Motif/Lesstif library" >&5
-
+ if test "$COMPILED_X_PROGRAM" = 0; then
+ echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6
+echo "configure:10015: checking for Motif/Lesstif library" >&5
+
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
do
done
done
- if test "$ac_find_libraries" != "" ; then
-
+ if test "$ac_find_libraries" != "" ; then
+
ac_path_to_include=$ac_find_includes
echo "$TOOLKIT_INCLUDE" | grep "\-I$ac_find_includes" > /dev/null
result=$?
ac_path_to_include="-I$ac_find_includes"
fi
-
+
echo "$GUI_TK_LIBRARY" | grep "\-L$ac_find_libraries" > /dev/null
result=$?
if test $result = 0; then
fi
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
- TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
- echo "$ac_t""found at $ac_find_libraries" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
-#line 9060 "configure"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+ TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+ echo "$ac_t""found at $ac_find_libraries" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+#line 10054 "configure"
#include "confdefs.h"
- #include <Xm/Xm.h>
-
+ #include <Xm/Xm.h>
+
int main() {
- int version;
+ int version;
- version = xmUseVersion;
-
+ version = xmUseVersion;
+
; return 0; }
EOF
-if { (eval echo configure:9073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- echo "$ac_t""found in default search path" 1>&6
- COMPILED_X_PROGRAM=1
-
+ echo "$ac_t""found in default search path" 1>&6
+ COMPILED_X_PROGRAM=1
+
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- echo "$ac_t""no" 1>&6
- { echo "configure: error: please set LDFLAGS to contain the location of libXm" 1>&2; exit 1; }
+ echo "$ac_t""no" 1>&6
+ { echo "configure: error: please set LDFLAGS to contain the location of libXm" 1>&2; exit 1; }
+
-
fi
rm -f conftest*
+ fi
fi
- fi
-
- XPM_LINK=""
- echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
-echo "configure:9096: checking for Xpm library" >&5
-
+
+ XPM_LINK=""
+ echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
+echo "configure:10090: checking for Xpm library" >&5
+
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
do
done
done
- if test "$ac_find_libraries" != "" ; then
-
+ if test "$ac_find_libraries" != "" ; then
+
echo "$GUI_TK_LIBRARY" | grep "\-L$ac_find_libraries" > /dev/null
result=$?
if test $result = 0; then
ac_path_to_link="-L$ac_find_libraries"
fi
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
- XPM_LINK="-lXpm "
- cat >> confdefs.h <<\EOF
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+ XPM_LINK="-lXpm "
+ cat >> confdefs.h <<\EOF
#define wxHAVE_LIB_XPM 1
EOF
- echo "$ac_t""found at $ac_find_libraries" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
-#line 9128 "configure"
+ echo "$ac_t""found at $ac_find_libraries" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+#line 10122 "configure"
#include "confdefs.h"
- #include <X11/xpm.h>
-
+ #include <X11/xpm.h>
+
int main() {
- int version;
+ int version;
- version = XpmLibraryVersion();
-
+ version = XpmLibraryVersion();
+
; return 0; }
EOF
-if { (eval echo configure:9141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- XPM_LINK="-lXpm "
- cat >> confdefs.h <<\EOF
+ XPM_LINK="-lXpm "
+ cat >> confdefs.h <<\EOF
#define wxHAVE_LIB_XPM 1
EOF
- echo "$ac_t""found in default search path" 1>&6
- COMPILED_X_PROGRAM=0
-
+ echo "$ac_t""found in default search path" 1>&6
+ COMPILED_X_PROGRAM=0
+
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- echo "$ac_t""no" 1>&6
- echo "configure: warning: library will be compiled without support for images in XPM format" 1>&2
+ echo "$ac_t""no" 1>&6
+ echo "configure: warning: library will be compiled without support for images in XPM format" 1>&2
+
-
fi
rm -f conftest*
+ fi
+
+ GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXext -lXt -lX11"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
+ TOOLKIT=MOTIF
+ GUIDIST=MOTIF_DIST
fi
- GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXext -lXt -lX11"
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
- TOOLKIT=MOTIF
- GUIDIST=MOTIF_DIST
-fi
+ if test "$wxUSE_MAC" = 1; then
+ TOOLKIT=MAC
+ GUIDIST=MACX_DIST
+ fi
-if test "$wxUSE_MAC" = 1; then
- TOOLKIT=MAC
- GUIDIST=MACX_DIST
-fi
+ if test "$wxUSE_PM" = 1; then
+ TOOLKIT=PM
+ GUIDIST=GTK_DIST
+ fi
-if test "$wxUSE_PM" = 1; then
- TOOLKIT=PM
- GUIDIST=GTK_DIST
-fi
+ if test "$TOOLKIT" != "PM" ; then
+ TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[A-Z]" "[a-z]"`
+ else
+ TOOLKIT_DIR="os2"
+ fi
-if test "$TOOLKIT" != "PM" ; then
- TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[A-Z]" "[a-z]"`
-else
- TOOLKIT_DIR="os2"
-fi
+ TOOLKIT_NAME="${TOOLKIT_DIR}"
- if test "$wxUSE_DEBUG_FLAG" = "yes"; then
- TOOLKIT_NAME="${TOOLKIT_DIR}d"
+ TOOLKIT_VPATH="\${top_srcdir}/src/${TOOLKIT_DIR}"
+
+ if test "$TOOLKIT_NAME" = "motif"; then
+ TOOLKIT_VPATH="${TOOLKIT_VPATH}${PATH_IFS}\${top_srcdir}/src/motif/xmcombo"
+ fi
+
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ TOOLKIT_NAME="${TOOLKIT_NAME}univ"
+ UNIV_VPATH="\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes"
+ TOOLKIT_VPATH="${UNIV_VPATH}${PATH_IFS}${TOOLKIT_VPATH}"
+ SETUPH_DIR="univ"
else
- TOOLKIT_NAME="${TOOLKIT_DIR}"
+ SETUPH_DIR="${TOOLKIT_DIR}"
+ fi
+
+ if test "$wxUSE_DEBUG_FLAG" = "yes"; then
+ TOOLKIT_NAME="${TOOLKIT_NAME}d"
fi
TOOLKIT_DEF="-D__WX${TOOLKIT}__"
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXUNIVERSAL__"
+ fi
WX_LIBRARY="wx_${TOOLKIT_NAME}"
- ALL_OBJECTS="\$(GUIOBJS) \$(COMMONOBJS) \$(GENERICOBJS) \$(UNIXOBJS) \$(HTMLOBJS) \$(OGLOBJS)"
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ ALL_OBJECTS="\$(GUI_LOWLEVEL_OBJS) \${UNIVOBJS}"
+ else
+ ALL_OBJECTS="\$(GUIOBJS)"
+ fi
+
+ ALL_OBJECTS="${ALL_OBJECTS} \$(COMMONOBJS) \$(GENERICOBJS)"
+
+ if test "$TOOLKIT" != "MSW"; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(UNIXOBJS)"
+ fi
+
+ if test "$wxUSE_HTML" = "yes"; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(HTMLOBJS)"
+ fi
- if test "$TOOLKIT" != "MSW" -a "$wxUSE_ODBC" = "yes" ; then
- ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
+ if test "$TOOLKIT" != "MSW"; then
+ if test "$wxUSE_ODBC" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
+ fi
fi
if test "$wxUSE_LIBJPEG" = "yes" ; then
if test "$wxUSE_FREETYPE" = "yes" ; then
ALL_OBJECTS="${ALL_OBJECTS} \$(FREETYPEOBJS)"
fi
- ALL_DEPFILES="\$(GUIDEPS) \$(COMMONDEPS) \$(GENERICDEPS) \$(UNIXDEPS) \$(HTMLDEPS) \$(OGLDEPS)"
- PORT_FILES="src/\$(TOOLKITDIR)/files.lst"
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ ALL_DEPFILES="\$(GUI_LOWLEVEL_DEPS) \$(UNIVDEPS)"
+ else
+ ALL_DEPFILES="\$(GUIDEPS)"
+ fi
+
+ ALL_DEPFILES="${ALL_DEPFILES} \$(COMMONDEPS) \$(GENERICDEPS)"
+
+ if test "$TOOLKIT" != "MSW"; then
+ ALL_DEPFILES="${ALL_DEPFILES} \$(UNIXDEPS)"
+ fi
+
+ if test "$wxUSE_HTML" = "yes"; then
+ ALL_DEPFILES="${ALL_DEPFILES} \$(HTMLDEPS)"
+ fi
+
+ PORT_FILES="src/\$(TOOLKITDIR)/files.lst"
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ PORT_FILES="${PORT_FILES} \${top_srcdir}/src/univ/files.lst"
+ fi
RPM_FILES="src/\$(TOOLKITDIR)/rpmfiles.lst"
RPM_SPEC="wx\$(TOOLKIT).spec"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
- WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
- WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
- WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
- WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
- WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
- WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
- WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
- WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
- WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
+ WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
+ WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+ WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+ WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
+ WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
+ WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
+ WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
+ WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
+ WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
;;
*-*-osf* )
SHARED_LD="${CXX} -shared -o"
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9472: checking for $ac_hdr" >&5
+echo "configure:10518: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9477 "configure"
+#line 10523 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9512: checking for $ac_hdr" >&5
+echo "configure:10558: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9517 "configure"
+#line 10563 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9552: checking for $ac_hdr" >&5
+echo "configure:10598: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9557 "configure"
+#line 10603 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9592: checking for $ac_hdr" >&5
+echo "configure:10638: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9597 "configure"
+#line 10643 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9632: checking for $ac_hdr" >&5
+echo "configure:10678: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9637 "configure"
+#line 10683 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9672: checking for $ac_hdr" >&5
+echo "configure:10718: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9677 "configure"
+#line 10723 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9712: checking for $ac_hdr" >&5
+echo "configure:10758: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9717 "configure"
+#line 10763 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10768: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9752: checking for $ac_hdr" >&5
+echo "configure:10798: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9757 "configure"
+#line 10803 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9795: checking for $ac_hdr" >&5
+echo "configure:10841: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9800 "configure"
+#line 10846 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:9836: checking for ANSI C header files" >&5
+echo "configure:10882: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9841 "configure"
+#line 10887 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 9866 "configure"
+#line 10912 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 9884 "configure"
+#line 10930 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 9905 "configure"
+#line 10951 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:9916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
fi
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:9940: checking for mode_t" >&5
+echo "configure:10986: checking for mode_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9945 "configure"
+#line 10991 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:9973: checking for off_t" >&5
+echo "configure:11019: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9978 "configure"
+#line 11024 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:10006: checking for pid_t" >&5
+echo "configure:11052: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10011 "configure"
+#line 11057 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:10039: checking for size_t" >&5
+echo "configure:11085: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10044 "configure"
+#line 11090 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:10072: checking for uid_t in sys/types.h" >&5
+echo "configure:11118: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10077 "configure"
+#line 11123 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
echo $ac_n "checking for wchar_t""... $ac_c" 1>&6
-echo "configure:10107: checking for wchar_t" >&5
+echo "configure:11153: checking for wchar_t" >&5
if eval "test \"`echo '$''{'wx_cv_type_wchar_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10113 "configure"
+#line 11159 "configure"
#include "confdefs.h"
#include <wchar.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:10124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_wchar_t=yes
else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 10132 "configure"
+#line 11178 "configure"
#include "confdefs.h"
#include <stdlib.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:10143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_wchar_t=yes
else
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking if size_t is unsigned int""... $ac_c" 1>&6
-echo "configure:10177: checking if size_t is unsigned int" >&5
+echo "configure:11223: checking if size_t is unsigned int" >&5
if eval "test \"`echo '$''{'wx_cv_size_t_is_uint'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10182 "configure"
+#line 11228 "configure"
#include "confdefs.h"
#include <stddef.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:10195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11241: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_size_t_is_uint=no
else
else
echo $ac_n "checking if size_t is unsigned long""... $ac_c" 1>&6
-echo "configure:10218: checking if size_t is unsigned long" >&5
+echo "configure:11264: checking if size_t is unsigned long" >&5
if eval "test \"`echo '$''{'wx_cv_size_t_is_ulong'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10223 "configure"
+#line 11269 "configure"
#include "confdefs.h"
#include <stddef.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:10236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_size_t_is_ulong=no
else
echo $ac_n "checking for pw_gecos in struct passwd""... $ac_c" 1>&6
-echo "configure:10270: checking for pw_gecos in struct passwd" >&5
+echo "configure:11316: checking for pw_gecos in struct passwd" >&5
if eval "test \"`echo '$''{'wx_cv_struct_pw_gecos'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10276 "configure"
+#line 11322 "configure"
#include "confdefs.h"
#include <pwd.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:10287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11333: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_struct_pw_gecos=yes
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:10317: checking for working const" >&5
+echo "configure:11363: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10322 "configure"
+#line 11368 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:10371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:10392: checking for inline" >&5
+echo "configure:11438: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 10399 "configure"
+#line 11445 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:10406: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
echo $ac_n "checking size of char""... $ac_c" 1>&6
-echo "configure:10433: checking size of char" >&5
+echo "configure:11479: checking size of char" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_sizeof_char=1
else
cat > conftest.$ac_ext <<EOF
-#line 10441 "configure"
+#line 11487 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:10452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_char=`cat conftestval`
else
echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:10472: checking size of short" >&5
+echo "configure:11518: checking size of short" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_sizeof_short=2
else
cat > conftest.$ac_ext <<EOF
-#line 10480 "configure"
+#line 11526 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:10491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_short=`cat conftestval`
else
echo $ac_n "checking size of int *""... $ac_c" 1>&6
-echo "configure:10511: checking size of int *" >&5
+echo "configure:11557: checking size of int *" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int_p'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_sizeof_int_p=4
else
cat > conftest.$ac_ext <<EOF
-#line 10519 "configure"
+#line 11565 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:10530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int_p=`cat conftestval`
else
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:10550: checking size of int" >&5
+echo "configure:11596: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_sizeof_int=4
else
cat > conftest.$ac_ext <<EOF
-#line 10558 "configure"
+#line 11604 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:10569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:10589: checking size of long" >&5
+echo "configure:11635: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_sizeof_long=4
else
cat > conftest.$ac_ext <<EOF
-#line 10597 "configure"
+#line 11643 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:10608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:10628: checking size of long long" >&5
+echo "configure:11674: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_sizeof_long_long=0
else
cat > conftest.$ac_ext <<EOF
-#line 10636 "configure"
+#line 11682 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:10647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
echo $ac_n "checking size of wchar_t""... $ac_c" 1>&6
-echo "configure:10668: checking size of wchar_t" >&5
+echo "configure:11714: checking size of wchar_t" >&5
if eval "test \"`echo '$''{'wx_cv_sizeof_wchar_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
wx_cv_sizeof_wchar_t=4
-
+
else
cat > conftest.$ac_ext <<EOF
-#line 10678 "configure"
+#line 11724 "configure"
#include "confdefs.h"
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #ifdef HAVE_STDLIB_H
- # include <stdlib.h>
- #endif
- #include <stdio.h>
- int main()
- {
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%i", sizeof(wchar_t));
- exit(0);
- }
+ #ifdef HAVE_WCHAR_H
+ # include <wchar.h>
+ #endif
+ #ifdef HAVE_STDLIB_H
+ # include <stdlib.h>
+ #endif
+ #include <stdio.h>
+ int main()
+ {
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%i", sizeof(wchar_t));
+ exit(0);
+ }
EOF
-if { (eval echo configure:10697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
wx_cv_sizeof_wchar_t=`cat conftestval`
else
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:10721: checking whether byte ordering is bigendian" >&5
+echo "configure:11767: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 10728 "configure"
+#line 11774 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:10739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 10743 "configure"
+#line 11789 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:10754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
ac_cv_c_bigendian=unknown
else
cat > conftest.$ac_ext <<EOF
-#line 10774 "configure"
+#line 11820 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:10787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:11833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10834: checking for $ac_hdr" >&5
+echo "configure:11880: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10839 "configure"
+#line 11885 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking if C++ compiler supports bool""... $ac_c" 1>&6
-echo "configure:10892: checking if C++ compiler supports bool" >&5
+echo "configure:11938: checking if C++ compiler supports bool" >&5
if eval "test \"`echo '$''{'wx_cv_cpp_bool'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10907 "configure"
+#line 11953 "configure"
#include "confdefs.h"
; return 0; }
EOF
-if { (eval echo configure:10919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_cpp_bool=yes
echo $ac_n "checking if you need GNU extensions""... $ac_c" 1>&6
-echo "configure:10957: checking if you need GNU extensions" >&5
+echo "configure:12003: checking if you need GNU extensions" >&5
if eval "test \"`echo '$''{'wx_cv_gnu_extensions'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10963 "configure"
+#line 12009 "configure"
#include "confdefs.h"
#include <features.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:10976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_gnu_extensions=yes
else
echo $ac_n "checking for wcslen in -lc""... $ac_c" 1>&6
-echo "configure:11001: checking for wcslen in -lc" >&5
+echo "configure:12047: checking for wcslen in -lc" >&5
ac_lib_var=`echo c'_'wcslen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11009 "configure"
+#line 12055 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
wcslen()
; return 0; }
EOF
-if { (eval echo configure:11020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for wcslen in -lw""... $ac_c" 1>&6
-echo "configure:11046: checking for wcslen in -lw" >&5
+echo "configure:12092: checking for wcslen in -lw" >&5
ac_lib_var=`echo w'_'wcslen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lw $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11054 "configure"
+#line 12100 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
wcslen()
; return 0; }
EOF
-if { (eval echo configure:11065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:11096: checking for vprintf" >&5
+echo "configure:12142: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11101 "configure"
+#line 12147 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:11124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:11148: checking for _doprnt" >&5
+echo "configure:12194: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11153 "configure"
+#line 12199 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:11176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
-echo "configure:11207: checking for vsnprintf" >&5
+echo "configure:12253: checking for vsnprintf" >&5
if eval "test \"`echo '$''{'wx_cv_func_vsnprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11213 "configure"
+#line 12259 "configure"
#include "confdefs.h"
#include <stdio.h>
; return 0; }
EOF
-if { (eval echo configure:11238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12284: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_func_vsnprintf=yes
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 11249 "configure"
+#line 12295 "configure"
#include "confdefs.h"
#include <stdio.h>
; return 0; }
EOF
-if { (eval echo configure:11274: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_func_vsnprintf=yes
fi
echo $ac_n "checking for vsscanf""... $ac_c" 1>&6
-echo "configure:11306: checking for vsscanf" >&5
+echo "configure:12352: checking for vsscanf" >&5
if eval "test \"`echo '$''{'wx_cv_func_vsscanf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11312 "configure"
+#line 12358 "configure"
#include "confdefs.h"
#include <stdio.h>
; return 0; }
EOF
-if { (eval echo configure:11335: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_func_vsscanf=yes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking if iconv() takes char**""... $ac_c" 1>&6
-echo "configure:11373: checking if iconv() takes char**" >&5
+echo "configure:12419: checking if iconv() takes char**" >&5
if eval "test \"`echo '$''{'wx_cv_iconv_takes_char'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11379 "configure"
+#line 12425 "configure"
#include "confdefs.h"
#include <iconv.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:11391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_iconv_takes_char=yes
else
for ac_func in sigaction
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11424: checking for $ac_func" >&5
+echo "configure:12470: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11429 "configure"
+#line 12475 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for sa_handler type""... $ac_c" 1>&6
-echo "configure:11493: checking for sa_handler type" >&5
+echo "configure:12539: checking for sa_handler type" >&5
if eval "test \"`echo '$''{'wx_cv_type_sa_handler'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11499 "configure"
+#line 12545 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:11511: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_sa_handler=int
for ac_func in vfork
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11548: checking for $ac_func" >&5
+echo "configure:12594: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11553 "configure"
+#line 12599 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in fcntl flock
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11605: checking for $ac_func" >&5
+echo "configure:12651: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11610 "configure"
+#line 12656 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in timegm
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11667: checking for $ac_func" >&5
+echo "configure:12713: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11672 "configure"
+#line 12718 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in putenv setenv
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11723: checking for $ac_func" >&5
+echo "configure:12769: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11728 "configure"
+#line 12774 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in nanosleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11798: checking for $ac_func" >&5
+echo "configure:12844: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11803 "configure"
+#line 12849 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6
-echo "configure:11851: checking for nanosleep in -lposix4" >&5
+echo "configure:12897: checking for nanosleep in -lposix4" >&5
ac_lib_var=`echo posix4'_'nanosleep | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11859 "configure"
+#line 12905 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
nanosleep()
; return 0; }
EOF
-if { (eval echo configure:11870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in usleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11898: checking for $ac_func" >&5
+echo "configure:12944: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11903 "configure"
+#line 12949 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in uname gethostname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:11969: checking for $ac_func" >&5
+echo "configure:13015: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11974 "configure"
+#line 13020 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:11997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in strtok_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:12034: checking for $ac_func" >&5
+echo "configure:13080: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12039 "configure"
+#line 13085 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:12065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in inet_addr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:12102: checking for $ac_func" >&5
+echo "configure:13148: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12107 "configure"
+#line 13153 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:12130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for inet_addr in -lnsl""... $ac_c" 1>&6
-echo "configure:12155: checking for inet_addr in -lnsl" >&5
+echo "configure:13201: checking for inet_addr in -lnsl" >&5
ac_lib_var=`echo nsl'_'inet_addr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12163 "configure"
+#line 13209 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
inet_addr()
; return 0; }
EOF
-if { (eval echo configure:12174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for inet_addr in -lresolv""... $ac_c" 1>&6
-echo "configure:12193: checking for inet_addr in -lresolv" >&5
+echo "configure:13239: checking for inet_addr in -lresolv" >&5
ac_lib_var=`echo resolv'_'inet_addr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12201 "configure"
+#line 13247 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
inet_addr()
; return 0; }
EOF
-if { (eval echo configure:12212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in inet_aton
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:12245: checking for $ac_func" >&5
+echo "configure:13291: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12250 "configure"
+#line 13296 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:12273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for inet_aton in -l$INET_LINK""... $ac_c" 1>&6
-echo "configure:12298: checking for inet_aton in -l$INET_LINK" >&5
+echo "configure:13344: checking for inet_aton in -l$INET_LINK" >&5
ac_lib_var=`echo $INET_LINK'_'inet_aton | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$INET_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12306 "configure"
+#line 13352 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
inet_aton()
; return 0; }
EOF
-if { (eval echo configure:12317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for pthread_create in -l$THREADS_LIB""... $ac_c" 1>&6
-echo "configure:12430: checking for pthread_create in -l$THREADS_LIB" >&5
+echo "configure:13476: checking for pthread_create in -l$THREADS_LIB" >&5
ac_lib_var=`echo $THREADS_LIB'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LIB $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12438 "configure"
+#line 13484 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:12449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:12472: checking for pthread_create in -lc_r" >&5
+echo "configure:13518: checking for pthread_create in -lc_r" >&5
ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lc_r $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12480 "configure"
+#line 13526 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:12491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6
-echo "configure:12515: checking for sys/prctl.h" >&5
+echo "configure:13561: checking for sys/prctl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12520 "configure"
+#line 13566 "configure"
#include "confdefs.h"
#include <sys/prctl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:12525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:13571: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
for ac_func in thr_setconcurrency
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:12565: checking for $ac_func" >&5
+echo "configure:13611: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12570 "configure"
+#line 13616 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:12593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:12623: checking for $ac_hdr" >&5
+echo "configure:13669: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12628 "configure"
+#line 13674 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:12633: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:13679: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for sched_yield in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:12661: checking for sched_yield in -l$THREADS_LINK" >&5
+echo "configure:13707: checking for sched_yield in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12669 "configure"
+#line 13715 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:12680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:12702: checking for sched_yield in -lposix4" >&5
+echo "configure:13748: checking for sched_yield in -lposix4" >&5
ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12710 "configure"
+#line 13756 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:12721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
HAVE_PRIOR_FUNCS=0
echo $ac_n "checking for pthread_attr_getschedpolicy in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:12752: checking for pthread_attr_getschedpolicy in -l$THREADS_LINK" >&5
+echo "configure:13798: checking for pthread_attr_getschedpolicy in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'pthread_attr_getschedpolicy | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12760 "configure"
+#line 13806 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_attr_getschedpolicy()
; return 0; }
EOF
-if { (eval echo configure:12771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for pthread_attr_setschedparam in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:12787: checking for pthread_attr_setschedparam in -l$THREADS_LINK" >&5
+echo "configure:13833: checking for pthread_attr_setschedparam in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'pthread_attr_setschedparam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12795 "configure"
+#line 13841 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_attr_setschedparam()
; return 0; }
EOF
-if { (eval echo configure:12806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for sched_get_priority_max in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:12822: checking for sched_get_priority_max in -l$THREADS_LINK" >&5
+echo "configure:13868: checking for sched_get_priority_max in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'sched_get_priority_max | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12830 "configure"
+#line 13876 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_get_priority_max()
; return 0; }
EOF
-if { (eval echo configure:12841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_get_priority_max in -lposix4""... $ac_c" 1>&6
-echo "configure:12860: checking for sched_get_priority_max in -lposix4" >&5
+echo "configure:13906: checking for sched_get_priority_max in -lposix4" >&5
ac_lib_var=`echo posix4'_'sched_get_priority_max | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12868 "configure"
+#line 13914 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_get_priority_max()
; return 0; }
EOF
-if { (eval echo configure:12879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for pthread_cancel in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:12926: checking for pthread_cancel in -l$THREADS_LINK" >&5
+echo "configure:13972: checking for pthread_cancel in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'pthread_cancel | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12934 "configure"
+#line 13980 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_cancel()
; return 0; }
EOF
-if { (eval echo configure:12945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for pthread_cleanup_push/pop""... $ac_c" 1>&6
-echo "configure:12971: checking for pthread_cleanup_push/pop" >&5
+echo "configure:14017: checking for pthread_cleanup_push/pop" >&5
if eval "test \"`echo '$''{'wx_cv_func_pthread_cleanup_push'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12977 "configure"
+#line 14023 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:12987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:14033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_func_pthread_cleanup_push=yes
echo $ac_n "checking for pthread_mutexattr_t""... $ac_c" 1>&6
-echo "configure:13015: checking for pthread_mutexattr_t" >&5
+echo "configure:14061: checking for pthread_mutexattr_t" >&5
if eval "test \"`echo '$''{'wx_cv_type_pthread_mutexattr_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13021 "configure"
+#line 14067 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:13031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:14077: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_pthread_mutexattr_t=yes
else
echo $ac_n "checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER""... $ac_c" 1>&6
-echo "configure:13058: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER" >&5
+echo "configure:14104: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER" >&5
if eval "test \"`echo '$''{'wx_cv_type_pthread_rec_mutex_init'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13064 "configure"
+#line 14110 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:13073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:14119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_pthread_rec_mutex_init=yes
else
if test "$ac_cv_func_strtok_r" = "yes"; then
echo $ac_n "checking if -D_REENTRANT is needed""... $ac_c" 1>&6
-echo "configure:13128: checking if -D_REENTRANT is needed" >&5
+echo "configure:14174: checking if -D_REENTRANT is needed" >&5
if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then
CFLAGS="${CFLAGS} -D_REENTRANT"
CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
# Extract the first word of "Rez", so it can be a program name with args.
set dummy Rez; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13172: checking for $ac_word" >&5
+echo "configure:14218: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_REZ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "Derez", so it can be a program name with args.
set dummy Derez; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13202: checking for $ac_word" >&5
+echo "configure:14248: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DEREZ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ZLIB_LINK=
ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for zlib.h""... $ac_c" 1>&6
-echo "configure:13339: checking for zlib.h" >&5
+echo "configure:14385: checking for zlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13344 "configure"
+#line 14390 "configure"
#include "confdefs.h"
#include <zlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:13349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:13366: checking for deflate in -lz" >&5
+echo "configure:14412: checking for deflate in -lz" >&5
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13374 "configure"
+#line 14420 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
deflate()
; return 0; }
EOF
-if { (eval echo configure:13385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
PNG_LINK=
ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for png.h""... $ac_c" 1>&6
-echo "configure:13432: checking for png.h" >&5
+echo "configure:14478: checking for png.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13437 "configure"
+#line 14483 "configure"
#include "confdefs.h"
#include <png.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:13442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for png_check_sig in -lpng""... $ac_c" 1>&6
-echo "configure:13459: checking for png_check_sig in -lpng" >&5
+echo "configure:14505: checking for png_check_sig in -lpng" >&5
ac_lib_var=`echo png'_'png_check_sig | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpng -lz -lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13467 "configure"
+#line 14513 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
png_check_sig()
; return 0; }
EOF
-if { (eval echo configure:13478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
JPEG_LINK=
ac_safe=`echo "jpeglib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6
-echo "configure:13523: checking for jpeglib.h" >&5
+echo "configure:14569: checking for jpeglib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13528 "configure"
+#line 14574 "configure"
#include "confdefs.h"
#include <jpeglib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:13533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14579: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for jpeg_read_header in -ljpeg""... $ac_c" 1>&6
-echo "configure:13550: checking for jpeg_read_header in -ljpeg" >&5
+echo "configure:14596: checking for jpeg_read_header in -ljpeg" >&5
ac_lib_var=`echo jpeg'_'jpeg_read_header | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ljpeg $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13558 "configure"
+#line 14604 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
jpeg_read_header()
; return 0; }
EOF
-if { (eval echo configure:13569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
TIFF_LINK=
ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6
-echo "configure:13611: checking for tiffio.h" >&5
+echo "configure:14657: checking for tiffio.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13616 "configure"
+#line 14662 "configure"
#include "confdefs.h"
#include <tiffio.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:13621: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for TIFFError in -ltiff""... $ac_c" 1>&6
-echo "configure:13638: checking for TIFFError in -ltiff" >&5
+echo "configure:14684: checking for TIFFError in -ltiff" >&5
ac_lib_var=`echo tiff'_'TIFFError | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ltiff -lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13646 "configure"
+#line 14692 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
TIFFError()
; return 0; }
EOF
-if { (eval echo configure:13657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
FREETYPE_LINK=
ac_safe=`echo "freetype.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for freetype.h""... $ac_c" 1>&6
-echo "configure:13699: checking for freetype.h" >&5
+echo "configure:14745: checking for freetype.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13704 "configure"
+#line 14750 "configure"
#include "confdefs.h"
#include <freetype.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:13709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for FT_Render_Glyph in -lfreetype""... $ac_c" 1>&6
-echo "configure:13726: checking for FT_Render_Glyph in -lfreetype" >&5
+echo "configure:14772: checking for FT_Render_Glyph in -lfreetype" >&5
ac_lib_var=`echo freetype'_'FT_Render_Glyph | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lfreetype -lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13734 "configure"
+#line 14780 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
FT_Render_Glyph()
; return 0; }
EOF
-if { (eval echo configure:13745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test "$wxUSE_OPENGL" = "yes"; then
ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6
-echo "configure:13779: checking for GL/gl.h" >&5
+echo "configure:14825: checking for GL/gl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13784 "configure"
+#line 14830 "configure"
#include "confdefs.h"
#include <GL/gl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:13789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:14835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
EOF
echo $ac_n "checking for glFlush in -lGL""... $ac_c" 1>&6
-echo "configure:13815: checking for glFlush in -lGL" >&5
+echo "configure:14861: checking for glFlush in -lGL" >&5
ac_lib_var=`echo GL'_'glFlush | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lGL $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13823 "configure"
+#line 14869 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
glFlush()
; return 0; }
EOF
-if { (eval echo configure:13834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for glFlush in -lMesaGL""... $ac_c" 1>&6
-echo "configure:13856: checking for glFlush in -lMesaGL" >&5
+echo "configure:14902: checking for glFlush in -lMesaGL" >&5
ac_lib_var=`echo MesaGL'_'glFlush | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lMesaGL $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13864 "configure"
+#line 14910 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
glFlush()
; return 0; }
EOF
-if { (eval echo configure:13875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
+if test "$wxUSE_TIMER" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_TIMER 1
+EOF
+
+fi
+
if test "$wxUSE_WAVE" = "yes"; then
cat >> confdefs.h <<\EOF
#define wxUSE_WAVE 1
fi
+if test "$wxUSE_CMDLINE_PARSER" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_CMDLINE_PARSER 1
+EOF
+
+fi
+
+if test "$wxUSE_STOPWATCH" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_STOPWATCH 1
+EOF
+
+fi
+
+if test "$wxUSE_DATETIME" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_DATETIME 1
+EOF
+
+fi
+
+if test "$wxUSE_TIMEDATE" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_TIMEDATE 1
+EOF
+
+fi
+
if test "$wxUSE_FILE" = "yes"; then
cat >> confdefs.h <<\EOF
#define wxUSE_FILE 1
fi
+if test "$wxUSE_FFILE" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_FFILE 1
+EOF
+
+fi
+
if test "$wxUSE_FILESYSTEM" = "yes"; then
cat >> confdefs.h <<\EOF
#define wxUSE_FILESYSTEM 1
fi
-if test "$wxUSE_TIMEDATE" = "yes"; then
+if test "$wxUSE_DATETIME" = "yes"; then
for ac_func in strptime
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14085: checking for $ac_func" >&5
+echo "configure:15173: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14090 "configure"
+#line 15178 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for timezone variable in <time.h>""... $ac_c" 1>&6
-echo "configure:14139: checking for timezone variable in <time.h>" >&5
+echo "configure:15227: checking for timezone variable in <time.h>" >&5
if eval "test \"`echo '$''{'wx_cv_var_timezone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14145 "configure"
+#line 15233 "configure"
#include "confdefs.h"
#include <time.h>
; return 0; }
EOF
-if { (eval echo configure:14157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_var_timezone=__timezone
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 14168 "configure"
+#line 15256 "configure"
#include "confdefs.h"
#include <time.h>
; return 0; }
EOF
-if { (eval echo configure:14180: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_var_timezone=_timezone
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 14191 "configure"
+#line 15279 "configure"
#include "confdefs.h"
#include <time.h>
; return 0; }
EOF
-if { (eval echo configure:14203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_var_timezone=timezone
for ac_func in localtime
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14238: checking for $ac_func" >&5
+echo "configure:15326: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14243 "configure"
+#line 15331 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
if test "$ac_cv_func_localtime" = "yes"; then
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:14293: checking for tm_gmtoff in struct tm" >&5
+echo "configure:15381: checking for tm_gmtoff in struct tm" >&5
if eval "test \"`echo '$''{'wx_cv_struct_tm_has_gmtoff'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14299 "configure"
+#line 15387 "configure"
#include "confdefs.h"
#include <time.h>
; return 0; }
EOF
-if { (eval echo configure:14311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_struct_tm_has_gmtoff=yes
for ac_func in gettimeofday ftime
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14340: checking for $ac_func" >&5
+echo "configure:15428: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14345 "configure"
+#line 15433 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
if test "$ac_cv_func_gettimeofday" = "yes"; then
echo $ac_n "checking whether gettimeofday takes two arguments""... $ac_c" 1>&6
-echo "configure:14395: checking whether gettimeofday takes two arguments" >&5
+echo "configure:15483: checking whether gettimeofday takes two arguments" >&5
if eval "test \"`echo '$''{'wx_cv_func_gettimeofday_has_2_args'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14410 "configure"
+#line 15498 "configure"
#include "confdefs.h"
#include <sys/time.h>
; return 0; }
EOF
-if { (eval echo configure:14424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_func_gettimeofday_has_2_args=yes
else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 14432 "configure"
+#line 15520 "configure"
#include "confdefs.h"
#include <sys/time.h>
; return 0; }
EOF
-if { (eval echo configure:14445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_func_gettimeofday_has_2_args=no
else
if test "$wxUSE_SOCKETS" = "yes"; then
echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:14491: checking for socket" >&5
+echo "configure:15579: checking for socket" >&5
if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14496 "configure"
+#line 15584 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char socket(); below. */
; return 0; }
EOF
-if { (eval echo configure:14519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_socket=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:14537: checking for socket in -lsocket" >&5
+echo "configure:15625: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 14545 "configure"
+#line 15633 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
socket()
; return 0; }
EOF
-if { (eval echo configure:14556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test "$wxUSE_SOCKETS" = "yes" ; then
echo $ac_n "checking what is the type of the third argument of getsockname""... $ac_c" 1>&6
-echo "configure:14589: checking what is the type of the third argument of getsockname" >&5
+echo "configure:15677: checking what is the type of the third argument of getsockname" >&5
if eval "test \"`echo '$''{'wx_cv_type_getsockname3'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14604 "configure"
+#line 15692 "configure"
#include "confdefs.h"
#include <sys/types.h>
; return 0; }
EOF
-if { (eval echo configure:14617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15705: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_getsockname3=socklen_t
else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 14625 "configure"
+#line 15713 "configure"
#include "confdefs.h"
#include <sys/types.h>
; return 0; }
EOF
-if { (eval echo configure:14638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_getsockname3=size_t
else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 14646 "configure"
+#line 15734 "configure"
#include "confdefs.h"
#include <sys/types.h>
; return 0; }
EOF
-if { (eval echo configure:14659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wx_cv_type_getsockname3=int
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:14721: checking for $ac_hdr" >&5
+echo "configure:15809: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14726 "configure"
+#line 15814 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:14731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
for ac_func in dlopen
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14787: checking for $ac_func" >&5
+echo "configure:15875: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14792 "configure"
+#line 15880 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:14843: checking for dlopen in -ldl" >&5
+echo "configure:15931: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 14851 "configure"
+#line 15939 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dlopen()
; return 0; }
EOF
-if { (eval echo configure:14862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in shl_load
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14891: checking for $ac_func" >&5
+echo "configure:15979: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14896 "configure"
+#line 15984 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dld in -lshl_load""... $ac_c" 1>&6
-echo "configure:14947: checking for dld in -lshl_load" >&5
+echo "configure:16035: checking for dld in -lshl_load" >&5
ac_lib_var=`echo shl_load'_'dld | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lshl_load $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 14955 "configure"
+#line 16043 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dld()
; return 0; }
EOF
-if { (eval echo configure:14966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in dlerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15005: checking for $ac_func" >&5
+echo "configure:16093: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15010 "configure"
+#line 16098 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:15033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlerror in -ldl""... $ac_c" 1>&6
-echo "configure:15058: checking for dlerror in -ldl" >&5
+echo "configure:16146: checking for dlerror in -ldl" >&5
ac_lib_var=`echo dl'_'dlerror | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 15066 "configure"
+#line 16154 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dlerror()
; return 0; }
EOF
-if { (eval echo configure:15077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
+if test "$wxUSE_FONTMAP" = "yes" ; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_FONTMAP 1
+EOF
+
+fi
+
if test "$wxUSE_UNICODE" = "yes" ; then
cat >> confdefs.h <<\EOF
#define wxUSE_UNICODE 1
if test "$wxUSE_CLIPBOARD" = "yes"; then
cat >> confdefs.h <<\EOF
#define wxUSE_CLIPBOARD 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define wxUSE_DATAOBJ 1
EOF
fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:15306: checking for $ac_hdr" >&5
+echo "configure:16405: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15311 "configure"
+#line 16410 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15316: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16415: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
fi
+USES_CONTROLS=0
+if test "$wxUSE_CONTROLS" = "yes"; then
+ USES_CONTROLS=1
+fi
+
if test "$wxUSE_ACCEL" = "yes"; then
cat >> confdefs.h <<\EOF
#define wxUSE_ACCEL 1
EOF
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_BUTTON" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_BUTTON 1
+EOF
+
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_BMPBUTTON" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_BMPBUTTON 1
+EOF
+
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_CALCTRL" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_CALENDARCTRL 1
+EOF
+
+ USES_CONTROLS=1
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS calendar"
fi
if test "$wxUSE_CARET" = "yes"; then
#define wxUSE_CARET 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS caret"
fi
#define wxUSE_COMBOBOX 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_CHOICE" = "yes"; then
#define wxUSE_CHOICE 1
EOF
-fi
-
-if test "$wxUSE_BMPBUTTON" = "yes"; then
- cat >> confdefs.h <<\EOF
-#define wxUSE_BMPBUTTON 1
-EOF
-
+ USES_CONTROLS=1
fi
if test "$wxUSE_CHECKBOX" = "yes"; then
#define wxUSE_CHECKBOX 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_CHECKLST" = "yes"; then
#define wxUSE_CHECKLISTBOX 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS checklst"
fi
#define wxUSE_GAUGE 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_NEW_GRID" = "yes"; then
#define wxUSE_NEW_GRID 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS newgrid"
fi
#define wxUSE_GRID 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS grid"
fi
#define wxUSE_LISTBOX 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_LISTCTRL" = "yes"; then
#define wxUSE_LISTCTRL 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS listctrl"
else
echo "configure: warning: wxListCtrl requires wxImageList and won't be compiled without it" 1>&2
#define wxUSE_NOTEBOOK 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
fi
#define wxUSE_RADIOBOX 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_RADIOBTN" = "yes"; then
#define wxUSE_RADIOBTN 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_SASH" = "yes"; then
#define wxUSE_SCROLLBAR 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll scrollsub"
fi
#define wxUSE_SLIDER 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_SPINBTN" = "yes"; then
#define wxUSE_SPINBTN 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_SPINCTRL" = "yes"; then
#define wxUSE_SPINCTRL 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_SPLITTER" = "yes"; then
#define wxUSE_STATBMP 1
EOF
+ USES_CONTROLS=1
fi
if test "$wxUSE_STATBOX" = "yes"; then
#define wxUSE_STATBOX 1
EOF
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_STATTEXT" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_STATTEXT 1
+EOF
+
+ USES_CONTROLS=1
fi
if test "$wxUSE_STATLINE" = "yes"; then
#define wxUSE_STATLINE 1
EOF
+ USES_CONTROLS=1
fi
fi
#define wxUSE_STATUSBAR 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar"
fi
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS tab"
fi
+if test "$wxUSE_TEXTCTRL" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_TEXTCTRL 1
+EOF
+
+ USES_CONTROLS=1
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS text"
+fi
+
if test "$wxUSE_TOGGLEBTN" = "yes"; then
if test "$wxUSE_MAC" = 1; then
echo "configure: warning: Toggle button is not yet supported under Mac OS X" 1>&2
#define wxUSE_TOGGLEBTN 1
EOF
+ USES_CONTROLS=1
fi
fi
EOF
wxUSE_TOOLBAR="yes"
+ USES_CONTROLS=1
fi
if test "$wxUSE_TOOLBAR" = "yes"; then
#define wxUSE_TOOLBAR 1
EOF
+ USES_CONTROLS=1
if test "$wxUSE_TOOLBAR_SIMPLE" != "yes"; then
wxUSE_TOOLBAR_NATIVE="yes"
fi
- SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
-fi
-
-if test "$wxUSE_TOOLBAR_NATIVE" = "yes"; then
- cat >> confdefs.h <<\EOF
+ if test "$wxUSE_TOOLBAR_NATIVE" = "yes"; then
+ cat >> confdefs.h <<\EOF
#define wxUSE_TOOLBAR_NATIVE 1
EOF
+ USES_CONTROLS=1
+ fi
+
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
fi
if test "$wxUSE_TOOLTIPS" = "yes"; then
#define wxUSE_TREECTRL 1
EOF
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treectrl"
else
echo "configure: warning: wxTreeCtrl requires wxImageList and won't be compiled without it" 1>&2
fi
fi
-
-
-if test "$wxUSE_DIRDLG" = "yes"; then
- if test "$wxUSE_CONSTRAINTS" != "yes"; then
- echo "configure: warning: wxDirDialog requires constraints so it won't be compiled without them" 1>&2
- else
- if test "$wxUSE_TREECTRL" != "yes"; then
- echo "configure: warning: wxDirDialog requires wxTreeCtrl so it won't be compiled without it" 1>&2
- else
- cat >> confdefs.h <<\EOF
-#define wxUSE_DIRDLG 1
+if test "$USES_CONTROLS" = 1; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_CONTROLS 1
EOF
- fi
- fi
fi
-if test "$wxUSE_TEXTDLG" = "yes"; then
+
+
+if test "$wxUSE_MENUS" = "yes"; then
cat >> confdefs.h <<\EOF
-#define wxUSE_TEXTDLG 1
+#define wxUSE_MENUS 1
EOF
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS menu"
fi
-if test "$wxUSE_STARTUP_TIPS" = "yes"; then
- if test "$wxUSE_CONSTRAINTS" != "yes"; then
- echo "configure: warning: Startup tips requires constraints and won't be compiled without them" 1>&2
- else
- cat >> confdefs.h <<\EOF
-#define wxUSE_STARTUP_TIPS 1
+if test "$wxUSE_METAFILE" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_METAFILE 1
EOF
- fi
fi
-if test "$wxUSE_PROGRESSDLG" = "yes"; then
- if test "$wxUSE_CONSTRAINTS" != "yes"; then
- echo "configure: warning: wxProgressDialog requires constraints so it won't be compiled without them" 1>&2
- else
- cat >> confdefs.h <<\EOF
-#define wxUSE_PROGRESSDLG 1
+if test "$wxUSE_MIMETYPE" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_MIMETYPE 1
EOF
- fi
fi
if test "$wxUSE_MINIFRAME" = "yes"; then
fi
+if test "$wxUSE_CHOICEDLG" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_CHOICEDLG 1
+EOF
+
+fi
+
+if test "$wxUSE_COLOURDLG" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_COLOURDLG 1
+EOF
+
+fi
+
+if test "$wxUSE_FILEDLG" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_FILEDLG 1
+EOF
+
+fi
+
+if test "$wxUSE_FONTDLG" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_FONTDLG 1
+EOF
+
+fi
+
+if test "$wxUSE_DIRDLG" = "yes"; then
+ if test "$wxUSE_CONSTRAINTS" != "yes"; then
+ echo "configure: warning: wxDirDialog requires constraints so it won't be compiled without them" 1>&2
+ else
+ if test "$wxUSE_TREECTRL" != "yes"; then
+ echo "configure: warning: wxDirDialog requires wxTreeCtrl so it won't be compiled without it" 1>&2
+ else
+ cat >> confdefs.h <<\EOF
+#define wxUSE_DIRDLG 1
+EOF
+
+ fi
+ fi
+fi
+
+if test "$wxUSE_MSGDLG" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_MSGDLG 1
+EOF
+
+fi
+
+if test "$wxUSE_NUMBERDLG" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_NUMBERDLG 1
+EOF
+
+fi
+
+if test "$wxUSE_PROGRESSDLG" = "yes"; then
+ if test "$wxUSE_CONSTRAINTS" != "yes"; then
+ echo "configure: warning: wxProgressDialog requires constraints so it won't be compiled without them" 1>&2
+ else
+ cat >> confdefs.h <<\EOF
+#define wxUSE_PROGRESSDLG 1
+EOF
+
+ fi
+fi
+
+if test "$wxUSE_STARTUP_TIPS" = "yes"; then
+ if test "$wxUSE_CONSTRAINTS" != "yes"; then
+ echo "configure: warning: Startup tips requires constraints and won't be compiled without them" 1>&2
+ else
+ cat >> confdefs.h <<\EOF
+#define wxUSE_STARTUP_TIPS 1
+EOF
+
+ fi
+fi
+
+if test "$wxUSE_TEXTDLG" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define wxUSE_TEXTDLG 1
+EOF
+
+fi
+
+
if test "$cross_compiling" = "yes"; then
OSINFO="\"$host\""
else
if test "$wxUSE_GUI" = "yes"; then
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS controls dialogs dragimag \
- drawing dynamic event font fractal image menu \
- minimal richedit"
+ drawing dynamic event font fractal image \
+ minimal richedit widgets"
+
+ if test "$wxUSE_UNIVERSAL" = "yes" ; then
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS univ"
+ fi
CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"
else
+
+
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:15920: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:17164: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
if test -d include; then
if test -d include/wx; then
- if test -d include/wx/${TOOLKIT_DIR}; then
- if test -f include/wx/${TOOLKIT_DIR}/setup.h; then
- mv -f include/wx/${TOOLKIT_DIR}/setup.h setup.h
+ if test -d include/wx/${SETUPH_DIR}; then
+ if test -f include/wx/${SETUPH_DIR}/setup.h; then
+ mv -f include/wx/${SETUPH_DIR}/setup.h setup.h
fi
fi
fi
s%@WXDEBUG_DEFINE@%$WXDEBUG_DEFINE%g
s%@USE_GUI@%$USE_GUI%g
s%@AFMINSTALL@%$AFMINSTALL%g
+s%@SETUPH_DIR@%$SETUPH_DIR%g
s%@TOOLKIT@%$TOOLKIT%g
s%@TOOLKIT_DEF@%$TOOLKIT_DEF%g
s%@TOOLKIT_DIR@%$TOOLKIT_DIR%g
s%@TOOLKIT_NAME@%$TOOLKIT_NAME%g
s%@TOOLKIT_INCLUDE@%$TOOLKIT_INCLUDE%g
+s%@TOOLKIT_VPATH@%$TOOLKIT_VPATH%g
s%@WXCONFIG_INCLUDE@%$WXCONFIG_INCLUDE%g
s%@ALL_OBJECTS@%$ALL_OBJECTS%g
s%@ALL_DEPFILES@%$ALL_DEPFILES%g
EOF
cat >> $CONFIG_STATUS <<EOF
- TOOLKIT_DIR="${TOOLKIT_DIR}"
+ SETUPH_DIR="${SETUPH_DIR}"
TOOLKIT_NAME="${TOOLKIT_NAME}"
LN_S="${LN_S}"
if test ! -d include/wx; then
mkdir include/wx
fi
- if test ! -d include/wx/${TOOLKIT_DIR}; then
- mkdir include/wx/${TOOLKIT_DIR}
+ if test ! -d include/wx/${SETUPH_DIR}; then
+ mkdir include/wx/${SETUPH_DIR}
fi
if test -f setup.h; then
- cp -fp setup.h include/wx/${TOOLKIT_DIR}/setup.h
+ cp -fp setup.h include/wx/${SETUPH_DIR}/setup.h
fi
NEEDS_D_REENTRANT_FOR_R_FUNCS=0
dnl the list of all available toolkits
-ALL_TOOLKITS="CYGWIN GTK MINGW MOTIF MAC WINE PM"
+dnl
+dnl update NUM_TOOLKITS calculation below when adding a new toolkit here!
+ALL_TOOLKITS="CYGWIN GTK MAC MGL MINGW MOTIF PM WINE"
dnl NB: these wxUSE_XXX constants have value of 0 or 1 unlike all the other ones
dnl which are either yes or no
DEFAULT_wxUSE_GTK=0
+DEFAULT_wxUSE_MAC=0
+DEFAULT_wxUSE_MGL=0
DEFAULT_wxUSE_MOTIF=0
DEFAULT_wxUSE_MSW=0
-DEFAULT_wxUSE_MAC=0
-DEFAULT_wxUSE_WINE=0
DEFAULT_wxUSE_PM=0
+DEFAULT_wxUSE_WINE=0
dnl these are the values which are really default for the given platform -
dnl they're not cached and are only used if no --with-toolkit was given *and*
dnl nothing was found in the cache
DEFAULT_DEFAULT_wxUSE_GTK=0
+DEFAULT_DEFAULT_wxUSE_MAC=0
+DEFAULT_DEFAULT_wxUSE_MGL=0
DEFAULT_DEFAULT_wxUSE_MOTIF=0
DEFAULT_DEFAULT_wxUSE_MSW=0
-DEFAULT_DEFAULT_wxUSE_MAC=0
-DEFAULT_DEFAULT_wxUSE_WINE=0
DEFAULT_DEFAULT_wxUSE_PM=0
+DEFAULT_DEFAULT_wxUSE_WINE=0
PROGRAM_EXT=
dnl usage
DEBUG_CONFIGURE=0
if test $DEBUG_CONFIGURE = 1; then
+ DEFAULT_wxUSE_UNIVERSAL=no
+
DEFAULT_wxUSE_THREADS=yes
DEFAULT_wxUSE_SHARED=yes
DEFAULT_wxUSE_BURNT_NAME=no
- DEFAULT_wxUSE_OPTIMISE=yes
+ DEFAULT_wxUSE_OPTIMISE=no
DEFAULT_wxUSE_PROFILE=no
DEFAULT_wxUSE_NO_DEPS=no
DEFAULT_wxUSE_NO_RTTI=no
DEFAULT_wxUSE_APPLE_IEEE=no
DEFAULT_wxUSE_LOG=yes
+ DEFAULT_wxUSE_LOGWINDOW=no
+ DEFAULT_wxUSE_LOGGUI=no
DEFAULT_wxUSE_GUI=yes
+ DEFAULT_wxUSE_CONTROLS=no
DEFAULT_wxUSE_ZLIB=no
DEFAULT_wxUSE_LIBPNG=no
DEFAULT_wxUSE_ON_FATAL_EXCEPTION=no
DEFAULT_wxUSE_SNGLINST_CHECKER=no
DEFAULT_wxUSE_STD_IOSTREAM=no
+ DEFAULT_wxUSE_CMDLINE_PARSER=no
+ DEFAULT_wxUSE_DATETIME=no
+ DEFAULT_wxUSE_TIMEDATE=no
+ DEFAULT_wxUSE_TIMER=no
+ DEFAULT_wxUSE_STOPWATCH=no
DEFAULT_wxUSE_FILE=no
+ DEFAULT_wxUSE_FFILE=no
DEFAULT_wxUSE_TEXTFILE=no
- DEFAULT_wxUSE_TIMEDATE=no
DEFAULT_wxUSE_WAVE=no
DEFAULT_wxUSE_INTL=no
DEFAULT_wxUSE_CONFIG=no
+ DEFAULT_wxUSE_FONTMAP=no
DEFAULT_wxUSE_STREAMS=no
DEFAULT_wxUSE_SOCKETS=no
DEFAULT_wxUSE_DIALUP_MANAGER=no
DEFAULT_wxUSE_HELP=no
DEFAULT_wxUSE_WXTREE=no
DEFAULT_wxUSE_METAFILE=no
+ DEFAULT_wxUSE_MIMETYPE=no
DEFAULT_wxUSE_COMMONDLGS=no
+ DEFAULT_wxUSE_CHOICEDLG=no
+ DEFAULT_wxUSE_COLOURDLG=no
DEFAULT_wxUSE_DIRDLG=no
+ DEFAULT_wxUSE_FILEDLG=no
+ DEFAULT_wxUSE_FONTDLG=no
+ DEFAULT_wxUSE_MSGDLG=no
+ DEFAULT_wxUSE_NUMBERDLG=no
DEFAULT_wxUSE_TEXTDLG=no
DEFAULT_wxUSE_STARTUP_TIPS=no
DEFAULT_wxUSE_PROGRESSDLG=no
+ DEFAULT_wxUSE_MENUS=no
DEFAULT_wxUSE_MINIFRAME=no
DEFAULT_wxUSE_HTML=no
DEFAULT_wxUSE_FILESYSTEM=no
DEFAULT_wxUSE_FS_ZIP=no
DEFAULT_wxUSE_BUSYINFO=no
DEFAULT_wxUSE_ZIPSTREAM=no
- DEFAULT_wxUSE_VALIDATORS=yes
+ DEFAULT_wxUSE_VALIDATORS=no
DEFAULT_wxUSE_ACCEL=no
- DEFAULT_wxUSE_CARET=no
+ DEFAULT_wxUSE_BUTTON=no
DEFAULT_wxUSE_BMPBUTTON=no
+ DEFAULT_wxUSE_CALCTRL=no
+ DEFAULT_wxUSE_CARET=no
DEFAULT_wxUSE_CHECKBOX=no
DEFAULT_wxUSE_CHECKLST=no
- DEFAULT_wxUSE_CHOICE=yes
+ DEFAULT_wxUSE_CHOICE=no
DEFAULT_wxUSE_COMBOBOX=no
DEFAULT_wxUSE_GAUGE=no
DEFAULT_wxUSE_GRID=no
DEFAULT_wxUSE_STATBMP=no
DEFAULT_wxUSE_STATBOX=no
DEFAULT_wxUSE_STATLINE=no
+ DEFAULT_wxUSE_STATTEXT=no
DEFAULT_wxUSE_STATUSBAR=yes
DEFAULT_wxUSE_TABDIALOG=no
+ DEFAULT_wxUSE_TEXTCTRL=no
DEFAULT_wxUSE_TOGGLEBTN=no
DEFAULT_wxUSE_TOOLBAR=no
DEFAULT_wxUSE_TOOLBAR_NATIVE=no
DEFAULT_wxUSE_PNM=no
DEFAULT_wxUSE_XPM=no
else
+ DEFAULT_wxUSE_UNIVERSAL=no
+
DEFAULT_wxUSE_THREADS=yes
DEFAULT_wxUSE_SHARED=yes
DEFAULT_wxUSE_ON_FATAL_EXCEPTION=yes
DEFAULT_wxUSE_SNGLINST_CHECKER=yes
DEFAULT_wxUSE_STD_IOSTREAM=no
+ DEFAULT_wxUSE_CMDLINE_PARSER=yes
+ DEFAULT_wxUSE_DATETIME=yes
+ DEFAULT_wxUSE_TIMEDATE=no
+ DEFAULT_wxUSE_TIMER=yes
+ DEFAULT_wxUSE_STOPWATCH=yes
DEFAULT_wxUSE_FILE=yes
+ DEFAULT_wxUSE_FFILE=yes
DEFAULT_wxUSE_TEXTFILE=yes
- DEFAULT_wxUSE_TIMEDATE=yes
DEFAULT_wxUSE_WAVE=no
DEFAULT_wxUSE_INTL=yes
DEFAULT_wxUSE_CONFIG=yes
+ DEFAULT_wxUSE_FONTMAP=yes
DEFAULT_wxUSE_STREAMS=yes
DEFAULT_wxUSE_SOCKETS=yes
DEFAULT_wxUSE_DIALUP_MANAGER=yes
DEFAULT_wxUSE_HELP=yes
DEFAULT_wxUSE_WXTREE=yes
DEFAULT_wxUSE_METAFILE=yes
+ DEFAULT_wxUSE_MIMETYPE=yes
DEFAULT_wxUSE_COMMONDLGS=yes
+ DEFAULT_wxUSE_CHOICEDLG=yes
+ DEFAULT_wxUSE_COLOURDLG=yes
DEFAULT_wxUSE_DIRDLG=yes
+ DEFAULT_wxUSE_FILEDLG=yes
+ DEFAULT_wxUSE_FONTDLG=yes
+ DEFAULT_wxUSE_MSGDLG=yes
+ DEFAULT_wxUSE_NUMBERDLG=yes
DEFAULT_wxUSE_TEXTDLG=yes
DEFAULT_wxUSE_STARTUP_TIPS=yes
DEFAULT_wxUSE_PROGRESSDLG=yes
+ DEFAULT_wxUSE_MENUS=yes
DEFAULT_wxUSE_MINIFRAME=yes
DEFAULT_wxUSE_HTML=yes
DEFAULT_wxUSE_FILESYSTEM=yes
DEFAULT_wxUSE_VALIDATORS=yes
DEFAULT_wxUSE_ACCEL=yes
- DEFAULT_wxUSE_CARET=yes
+ DEFAULT_wxUSE_BUTTON=yes
DEFAULT_wxUSE_BMPBUTTON=yes
+ DEFAULT_wxUSE_CALCTRL=yes
+ DEFAULT_wxUSE_CARET=yes
DEFAULT_wxUSE_CHECKBOX=yes
DEFAULT_wxUSE_CHECKLST=yes
DEFAULT_wxUSE_CHOICE=yes
DEFAULT_wxUSE_STATBMP=yes
DEFAULT_wxUSE_STATBOX=yes
DEFAULT_wxUSE_STATLINE=yes
+ DEFAULT_wxUSE_STATTEXT=yes
DEFAULT_wxUSE_STATUSBAR=yes
DEFAULT_wxUSE_TABDIALOG=no
+ DEFAULT_wxUSE_TEXTCTRL=yes
DEFAULT_wxUSE_TOGGLEBTN=yes
DEFAULT_wxUSE_TOOLBAR=yes
DEFAULT_wxUSE_TOOLBAR_NATIVE=yes
if test "$wxUSE_GUI" = "yes"; then
+WX_ARG_ENABLE(universal, [ --enable-universal use wxWindows GUI controls instead of native ones], wxUSE_UNIVERSAL)
AC_ARG_WITH(gtk, [ --with-gtk use GTK+], [wxUSE_GTK="$withval" CACHE_GTK=1 TOOLKIT_GIVEN=1])
AC_ARG_WITH(motif, [ --with-motif use Motif/Lesstif], [wxUSE_MOTIF="$withval" CACHE_MOTIF=1 TOOLKIT_GIVEN=1])
AC_ARG_WITH(mac, [ --with-mac use Mac OS X], [wxUSE_MAC="$withval" TOOLKIT_GIVEN=1])
AC_ARG_WITH(cygwin, [ --with-cygwin use Cygwin for MS-Windows], [wxUSE_CYGWIN="$withval" CACHE_CYGWIN=1 TOOLKIT_GIVEN=1])
AC_ARG_WITH(mingw, [ --with-mingw use GCC Minimal MS-Windows], [wxUSE_MINGW="$withval" CACHE_MINGW=1 TOOLKIT_GIVEN=1])
AC_ARG_WITH(pm, [ --with-pm use OS/2 Presentation Manager], [wxUSE_PM="$withval" CACHE_PM=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(mgl, [ --with-mgl use MGL], [wxUSE_MGL="$withval" CACHE_MGL=1 TOOLKIT_GIVEN=1])
AC_ARG_WITH(gtk-prefix, [ --with-gtk-prefix=PFX Prefix where GTK is installed],
gtk_config_prefix="$withval", gtk_config_prefix="")
WX_ARG_ENABLE(ipc, [ --enable-ipc use interprocess communication (wxSocket etc.)], wxUSE_IPC)
+WX_ARG_ENABLE(cmdline, [ --enable-cmdline use wxCmdLineParser class], wxUSE_CMDLINE_PARSER)
+WX_ARG_ENABLE(datetime, [ --enable-datetime use wxDateTime class], wxUSE_DATETIME)
+WX_ARG_ENABLE(timedate, [ --enable-timedate use obsolete wxDate/wxTime classes], wxUSE_TIMEDATE)
+WX_ARG_ENABLE(stopwatch, [ --enable-stopwatch use wxStopWatch class], wxUSE_STOPWATCH)
WX_ARG_ENABLE(dialupman, [ --enable-dialupman use dialup network classes], wxUSE_DIALUP_MANAGER)
WX_ARG_ENABLE(apple_ieee, [ --enable-apple_ieee use the Apple IEEE codec], wxUSE_APPLE_IEEE)
-WX_ARG_ENABLE(timedate, [ --enable-timedate use date/time classes], wxUSE_TIMEDATE)
+WX_ARG_ENABLE(timer, [ --enable-timer use wxTimer class], wxUSE_TIMER)
WX_ARG_ENABLE(wave, [ --enable-wave use wxWave class], wxUSE_WAVE)
WX_ARG_ENABLE(fraction, [ --enable-fraction use wxFraction class], wxUSE_FRACTION)
WX_ARG_ENABLE(dynlib, [ --enable-dynlib use wxLibrary class for DLL loading], wxUSE_DYNLIB_CLASS)
WX_ARG_ENABLE(log, [ --enable-log use logging system], wxUSE_LOG)
WX_ARG_ENABLE(streams, [ --enable-streams use wxStream etc classes], wxUSE_STREAMS)
WX_ARG_ENABLE(file, [ --enable-file use wxFile classes], wxUSE_FILE)
+WX_ARG_ENABLE(ffile, [ --enable-ffile use wxFFile classes], wxUSE_FFILE)
WX_ARG_ENABLE(textfile, [ --enable-textfile use wxTextFile classes], wxUSE_TEXTFILE)
+WX_ARG_ENABLE(fontmap, [ --enable-fontmap use font encodings conversion classes], wxUSE_FONTMAP)
WX_ARG_ENABLE(unicode, [ --enable-unicode compile wxString with Unicode support], wxUSE_UNICODE)
WX_ARG_ENABLE(wcsrtombs, [ --enable-wcsrtombs use wcsrtombs instead of buggy (GNU libc1/Linux libc5) wcstombs], wxUSE_WCSRTOMBS)
WX_ARG_ENABLE(wxprintfv, [ --enable-wxprintfv use wxWindows implementation of vprintf()], wxUSE_EXPERIMENTAL_PRINTF)
WX_ARG_ENABLE(catch_segvs, [ --enable-catch_segvs catch signals and pass them to wxApp::OnFatalException], wxUSE_ON_FATAL_EXCEPTION)
WX_ARG_ENABLE(snglinst, [ --enable-snglinst use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
+WX_ARG_ENABLE(mimetype, [ --enable-mimetypes use wxMimeTypesManager], wxUSE_MIMETYPE)
+
dnl ---------------------------------------------------------------------------
dnl "big" options (i.e. those which change a lot of things throughout the library)
dnl ---------------------------------------------------------------------------
WX_ARG_ENABLE(constraints, [ --enable-constraints use layout-constraints system], wxUSE_CONSTRAINTS)
WX_ARG_ENABLE(printarch, [ --enable-printarch use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
WX_ARG_ENABLE(mdi, [ --enable-mdi use multiple document interface architecture], wxUSE_MDI_ARCHITECTURE)
+WX_ARG_ENABLE(loggui, [ --enable-loggui use standard GUI logger], wxUSE_LOGGUI)
+WX_ARG_ENABLE(logwin, [ --enable-logwin use wxLogWindow], wxUSE_LOGWINDOW)
dnl ---------------------------------------------------------------------------
dnl PostScript options
dnl ---------------------------------------------------------------------------
dnl resources
dnl ---------------------------------------------------------------------------
+
WX_ARG_ENABLE(prologio, [ --enable-prologio use Prolog IO library], wxUSE_PROLOGIO)
WX_ARG_ENABLE(resources, [ --enable-resources use wxWindows resources], wxUSE_RESOURCES)
dnl used (and vice versa)
if test "$wxUSE_CONTROLS" = "yes"; then
DEFAULT_wxUSE_ACCEL=yes
+ DEFAULT_wxUSE_BMPBUTTON=yes
+ DEFAULT_wxUSE_BUTTON=yes
+ DEFAULT_wxUSE_CALCTRL=no
DEFAULT_wxUSE_CARET=yes
DEFAULT_wxUSE_COMBOBOX=yes
- DEFAULT_wxUSE_BMPBUTTON=yes
DEFAULT_wxUSE_CHECKBOX=yes
DEFAULT_wxUSE_CHECKLISTBOX=yes
DEFAULT_wxUSE_CHOICE=yes
DEFAULT_wxUSE_TREECTRL=yes
elif test "$wxUSE_CONTROLS" = "no"; then
DEFAULT_wxUSE_ACCEL=no
+ DEFAULT_wxUSE_BMPBUTTON=no
+ DEFAULT_wxUSE_BUTTON=no
+ DEFAULT_wxUSE_CALCTRL=no
DEFAULT_wxUSE_CARET=no
DEFAULT_wxUSE_COMBOBOX=no
- DEFAULT_wxUSE_BMPBUTTON=no
DEFAULT_wxUSE_CHECKBOX=no
DEFAULT_wxUSE_CHECKLISTBOX=no
DEFAULT_wxUSE_CHOICE=no
fi
WX_ARG_ENABLE(accel, [ --enable-accel use accelerators], wxUSE_ACCEL)
-WX_ARG_ENABLE(caret, [ --enable-caret use wxCaret class], wxUSE_CARET)
+WX_ARG_ENABLE(button, [ --enable-button use wxButton class], wxUSE_BUTTON)
WX_ARG_ENABLE(bmpbutton, [ --enable-bmpbutton use wxBitmapButton class], wxUSE_BMPBUTTON)
+WX_ARG_ENABLE(calendar, [ --enable-calendar use wxCalendarCtrl class], wxUSE_CALCTRL)
+WX_ARG_ENABLE(caret, [ --enable-caret use wxCaret class], wxUSE_CARET)
WX_ARG_ENABLE(checkbox, [ --enable-checkbox use wxCheckBox class], wxUSE_CHECKBOX)
WX_ARG_ENABLE(checklst, [ --enable-checklst use wxCheckListBox (listbox with checkboxes) class], wxUSE_CHECKLST)
WX_ARG_ENABLE(choice, [ --enable-choice use wxChoice class], wxUSE_CHOICE)
WX_ARG_ENABLE(statbmp, [ --enable-statbmp use wxStaticBitmap class], wxUSE_STATBMP)
WX_ARG_ENABLE(statbox, [ --enable-statbox use wxStaticBox class], wxUSE_STATBOX)
WX_ARG_ENABLE(statline, [ --enable-statline use wxStaticLine class], wxUSE_STATLINE)
+WX_ARG_ENABLE(stattext, [ --enable-stattext use wxStaticText class], wxUSE_STATTEXT)
WX_ARG_ENABLE(statusbar, [ --enable-statusbar use wxStatusBar class], wxUSE_STATUSBAR)
WX_ARG_ENABLE(tabdialog, [ --enable-tabdialog use wxTabControl class], wxUSE_TABDIALOG)
+WX_ARG_ENABLE(textctrl, [ --enable-textctrl use wxTextCtrl class], wxUSE_TEXTCTRL)
WX_ARG_ENABLE(togglebtn, [ --enable-togglebtn use wxToggleButton class], wxUSE_TOGGLEBTN)
WX_ARG_ENABLE(toolbar, [ --enable-toolbar use wxToolBar class], wxUSE_TOOLBAR)
WX_ARG_ENABLE(tbarnative, [ --enable-tbarnative use native wxToolBar class], wxUSE_TOOLBAR_NATIVE)
dnl ---------------------------------------------------------------------------
WX_ARG_ENABLE(commondlg, [ --enable-commondlg use common dialogs (wxDirDialog, wxProgressDialog, wxTextDialog, ...)], wxUSE_COMMONDLGS)
+WX_ARG_ENABLE(choicedlg, [ --enable-choicedlg use wxChoiceDialog], wxUSE_CHOICEDLG)
+WX_ARG_ENABLE(coldlg, [ --enable-coldlg use wxColourDialog], wxUSE_COLOURDLG)
+WX_ARG_ENABLE(filedlg, [ --enable-filedlg use wxFileDialog], wxUSE_FILEDLG)
+WX_ARG_ENABLE(fontdlg, [ --enable-fontdlg use wxFontDialog], wxUSE_FONTDLG)
WX_ARG_ENABLE(dirdlg, [ --enable-dirdlg use wxDirDialog], wxUSE_DIRDLG)
+WX_ARG_ENABLE(msgdlg, [ --enable-msgdlg use wxMessageDialog], wxUSE_MSGDLG)
+WX_ARG_ENABLE(numberdlg, [ --enable-numberdlg use wxNumberEntryDialog], wxUSE_NUMBERDLG)
WX_ARG_ENABLE(textdlg, [ --enable-textdlg use wxTextDialog], wxUSE_TEXTDLG)
WX_ARG_ENABLE(tipdlg, [ --enable-tipdlg use startup tips], wxUSE_STARTUP_TIPS)
WX_ARG_ENABLE(progressdlg, [ --enable-progressdlg use wxProgressDialog], wxUSE_PROGRESSDLG)
+WX_ARG_ENABLE(menus, [ --enable-menus use wxMenu/wxMenuBar/wxMenuItem classes], wxUSE_MENUS)
WX_ARG_ENABLE(miniframe, [ --enable-miniframe use wxMiniFrame class], wxUSE_MINIFRAME)
WX_ARG_ENABLE(html, [ --enable-html use wxHTML sub-library], wxUSE_HTML)
WX_ARG_ENABLE(tooltips, [ --enable-tooltips use wxToolTip class], wxUSE_TOOLTIPS)
WX_ARG_ENABLE(validators, [ --enable-validators use wxValidator and derived classes], wxUSE_VALIDATORS)
WX_ARG_ENABLE(busyinfo, [ --enable-busyinfo use wxBusyInfo], wxUSE_BUSYINFO)
WX_ARG_ENABLE(joystick, [ --enable-joystick compile in joystick support (Linux only)], wxUSE_JOYSTICK)
+WX_ARG_ENABLE(metafile, [ --enable-metafiles use wxMetaFile (Windows only)], wxUSE_METAFILE)
dnl ---------------------------------------------------------------------------
dnl support for image formats that do not rely on external library
done
fi
-dnl we suppose that expr exists...
-NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MAC:-0} + ${wxUSE_WINE:-0} + ${wxUSE_MINGW:-0} + ${wxUSE_CYGWIN:-0}`
+dnl we suppose that expr is available (maybe there is a better way to do
+dnl this? what about using ALL_TOOLKITS? TODO)
+NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_MOTIF:-0} + ${wxUSE_MAC:-0} + ${wxUSE_WINE:-0} + ${wxUSE_MINGW:-0} + ${wxUSE_CYGWIN:-0} + ${wxUSE_MGL:-0}`
dnl Allow wxUSE_PM only for OS/2 with EMX.
dnl Path separator; ':' for unix.
AFMINSTALL=
if test "$wxUSE_GUI" = "yes"; then
+ USE_GUI=1
-USE_GUI=1
+ TOOLKIT=
+ TOOLKIT_INCLUDE=
-TOOLKIT=
-TOOLKIT_INCLUDE=
+ GUI_TK_LIBRARY=
+ GUI_TK_LINK=
-GUI_TK_LIBRARY=
-GUI_TK_LINK=
+ WXGTK12=
+ WXGTK127=
+ WXGTK20=
-WXGTK12=
-WXGTK127=
-WXGTK20=
+ WXWINE=
-WXWINE=
-
-if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then
- if test "$cross_compiling" = "yes" ; then
- dnl mingw32 will find them even if they're not in one of standard paths
- AC_MSG_WARN(skipping windows.h check for cross-compilation)
- else
- AC_MSG_CHECKING(for Windows headers)
- WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
- if test "$ac_find_includes" != "" ; then
- AC_MSG_RESULT(found $ac_find_includes)
- TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+ if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then
+ if test "$cross_compiling" = "yes" ; then
+ dnl mingw32 will find them even if they're not in one of standard paths
+ AC_MSG_WARN(skipping windows.h check for cross-compilation)
else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+ AC_MSG_CHECKING(for Windows headers)
+ WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
+ if test "$ac_find_includes" != "" ; then
+ AC_MSG_RESULT(found $ac_find_includes)
+ TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+ fi
fi
- fi
-
- INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
- dnl --- Quick & Dirty ; link against most/all libraries
- dnl --- This will bloat the executable, but it'll work for now...
- LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
-
- dnl add extra odbc libs if we have compiled in odbc
- if test "$wxUSE_ODBC" = "yes" ; then
- LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
- fi
- dnl -mwindows is needed to avoid that spawning of a console window
- if test "$wxUSE_MINGW" = 1; then
- LDFLAGS="$LDFLAGS -mwindows"
- fi
+ INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw"
+ dnl --- Quick & Dirty ; link against most/all libraries
+ dnl --- This will bloat the executable, but it'll work for now...
+ LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32"
- TOOLKIT=MSW
- GUIDIST=MSW_DIST
+ dnl add extra odbc libs if we have compiled in odbc
+ if test "$wxUSE_ODBC" = "yes" ; then
+ LIBS="$LIBS -lodbc32 -lole32 -loleaut32"
+ fi
- dnl we should calculate these
- RCINCSWITCH="--include-dir"
- RCDEFSWITCH="--define"
- RCPREPROCESSOR="--preprocessor \"\$(CC) -c -E -xc-header -DRC_INVOKED\""
- RCINPUTSWITCH="-i"
- RCOUTPUTSWITCH="-o"
- RESFLAGS="$RCPREPROCESSOR $RCINCSWITCH \$(top_srcdir)/include $RCINCSWITCH \$(top_srcdir)/\$(program_dir) $RCDEFSWITCH __WIN32__ $RCDEFSWITCH __WIN95__ $RCDEFSWITCH __GNUWIN32__"
+ dnl -mwindows is needed to avoid that spawning of a console window
+ if test "$wxUSE_MINGW" = 1; then
+ LDFLAGS="$LDFLAGS -mwindows"
+ fi
- dnl set optinal RES_PROGRAM_OPT to RES_PROGRAM
- RESPROGRAM="\$(RES_PROGRAM)"
+ TOOLKIT=MSW
+ GUIDIST=MSW_DIST
-fi
+ dnl we should calculate these
+ RCINCSWITCH="--include-dir"
+ RCDEFSWITCH="--define"
+ RCPREPROCESSOR="--preprocessor \"\$(CC) -c -E -xc-header -DRC_INVOKED\""
+ RCINPUTSWITCH="-i"
+ RCOUTPUTSWITCH="-o"
+ RESFLAGS="$RCPREPROCESSOR $RCINCSWITCH \$(top_srcdir)/include $RCINCSWITCH \$(top_srcdir)/\$(program_dir) $RCDEFSWITCH __WIN32__ $RCDEFSWITCH __WIN95__ $RCDEFSWITCH __GNUWIN32__"
-if test "$wxUSE_GTK" = 1; then
- dnl avoid calling AM_PATH_GTK twice, so check first for the newer version
- dnl and only then, if it wasn't found, for an older one
- AM_PATH_GTK_2_0(1.3.1, WXGTK20=1,[
- AM_PATH_GTK(1.2.7, WXGTK127=1)
- AM_PATH_GTK(1.2.3, WXGTK12=1)
- ], gthread)
-
- if test "$WXGTK12" != 1 -a "$WXGTK20" != 1; then
- AC_MSG_ERROR([
- Please check that gtk-config is in path, the directory
- where GTK+ libraries are installed (returned by
- 'gtk-config --libs' command) is in LD_LIBRARY_PATH or
- equivalent variable and GTK+ is version 1.2.3 or above.
- ])
+ dnl set optinal RES_PROGRAM_OPT to RES_PROGRAM
+ RESPROGRAM="\$(RES_PROGRAM)"
fi
- TOOLKIT_INCLUDE="$GTK_CFLAGS"
+ if test "$wxUSE_GTK" = 1; then
+ dnl avoid calling AM_PATH_GTK twice, so check first for the newer version
+ dnl and only then, if it wasn't found, for an older one
+ AM_PATH_GTK_2_0(1.3.1, WXGTK20=1,[
+ AM_PATH_GTK(1.2.7, WXGTK127=1)
+ AM_PATH_GTK(1.2.3, WXGTK12=1)
+ ], gthread)
+
+ if test "$WXGTK12" != 1 -a "$WXGTK20" != 1; then
+ AC_MSG_ERROR([
+ Please check that gtk-config is in path, the directory
+ where GTK+ libraries are installed (returned by
+ 'gtk-config --libs' command) is in LD_LIBRARY_PATH or
+ equivalent variable and GTK+ is version 1.2.3 or above.
+ ])
+ fi
-dnl Appending gthreads as it was done here is not portable, instead
-dnl we now call "gtk-config --libs gthread" which sets the right library
-dnl name for us. The following hacks are no longer required.
+ TOOLKIT_INCLUDE="$GTK_CFLAGS"
- GUI_TK_LIBRARY="$GTK_LIBS"
+ dnl Appending gthreads as it was done here is not portable, instead
+ dnl we now call "gtk-config --libs gthread" which sets the right library
+ dnl name for us. The following hacks are no longer required.
-dnl dnl On FreeBSD, the libs are called gtk12 etc, so we must append gthread12
-dnl echo $GTK_LIBS | fgrep -q "glib12"
-dnl if test $? = 0 ; then
-dnl GUI_TK_LIBRARY="$GTK_LIBS -gthread12"
-dnl else
-dnl GUI_TK_LIBRARY="$GTK_LIBS -lgthread"
-dnl fi
+ GUI_TK_LIBRARY="$GTK_LIBS"
- AFMINSTALL=afminstall
- TOOLKIT=GTK
- GUIDIST=GTK_DIST
+ dnl dnl On FreeBSD, the libs are called gtk12 etc, so we must append gthread12
+ dnl echo $GTK_LIBS | fgrep -q "glib12"
+ dnl if test $? = 0 ; then
+ dnl GUI_TK_LIBRARY="$GTK_LIBS -gthread12"
+ dnl else
+ dnl GUI_TK_LIBRARY="$GTK_LIBS -lgthread"
+ dnl fi
- dnl test for XIM support in libgdk
- AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
-fi
+ AFMINSTALL=afminstall
+ TOOLKIT=GTK
+ GUIDIST=GTK_DIST
-if test "$wxUSE_WINE" = 1; then
- AC_MSG_CHECKING(for WINE includes)
- WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
- if test "$ac_find_includes" != "" ; then
- AC_MSG_RESULT(found $ac_find_includes)
- TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+ dnl test for XIM support in libgdk
+ AC_CHECK_LIB(gdk, gdk_im_open, AC_DEFINE(HAVE_XIM))
fi
- XPM_LINK=""
- AC_MSG_CHECKING(for Xpm library)
- WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
- if test "$ac_find_libraries" != "" ; then
- GUI_TK_LIBRARY="-L$ac_find_libraries"
- XPM_LINK="-lXpm"
- AC_DEFINE(wxHAVE_LIB_XPM)
- AC_MSG_RESULT(found at $ac_find_libraries)
- else
- AC_MSG_RESULT(no)
- AC_MSG_WARN(library will be compiled without support for images in XPM format)
- fi
+ if test "$wxUSE_MGL" = 1; then
+ dnl FIXME_MGL - test for MGL's variants for freebsd etc.
- MESA_LINK=""
- AC_MSG_CHECKING(for Mesa library)
- WX_PATH_FIND_LIBRARIES($SEARCH_LIB,MesaGL)
- if test "$ac_find_libraries" != "" ; then
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
- MESA_LINK="-lMesaGL"
- AC_MSG_RESULT(found at $ac_find_libraries)
- else
- AC_MSG_ERROR(no)
- fi
+ AC_MSG_CHECKING(for SciTech MGL library)
+ if test "x$MGL_ROOT" = x ; then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR([Cannot find MGL library. Make sure MGL_ROOT is set.])
+ else
+ AC_MSG_RESULT($MGL_ROOT)
+ fi
- GUI_TK_LINK="-lwine $MESA_LINK $XPM_LINK -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses"
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
- WXWINE=1
- TOOLKIT=MSW
- GUIDIST=MSW_DIST
-fi
+ MGL_OS=linux/gcc/glibc
+ MGL_LIB_TYPE=""
-dnl use standard macros to check for X headers/libs, this brings support
-dnl for the standard configure options --x-includes and --x-libraries;
-dnl the path to the X headers/libs is not only needed for motif, but also
-dnl by the OpenGL and XKBlib.h checks further down
+ if test "$wxUSE_DEBUG_FLAG" = yes ; then
+ if test -f $MGL_ROOT/lib/debug/$MGL_OS/libmgl.a ; then
+ MGL_LIB_TYPE=debug
+ fi
+ fi
+ if test "x$MGL_LIB_TYPE" = x ; then
+ if test -f $MGL_ROOT/lib/release/$MGL_OS/libmgl.a ; then
+ MGL_LIB_TYPE=release
+ else
+ AC_MSG_ERROR([Cannot find MGL libraries, make sure they are compiled.])
+ fi
+ fi
-AC_PATH_XTRA
-CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-LDFLAGS="$LDFLAGS $X_LIBS"
+ TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
+ GUI_TK_LIBRARY="-L$MGL_ROOT/lib/$MGL_LIB_TYPE/$MGL_OS -lmgl -lmglcpp -lpm"
-if test "$wxUSE_MOTIF" = 1; then
- if test "$no_x" = "yes"; then
- AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options)
+ AFMINSTALL=afminstall
+ TOOLKIT=MGL
+ GUIDIST=MGL_DIST
fi
- GUI_TK_LIBRARY="$X_LIBS"
- TOOLKIT_INCLUDE="$X_CFLAGS"
+ if test "$wxUSE_WINE" = 1; then
+ AC_MSG_CHECKING(for WINE includes)
+ WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, windows.h)
+ if test "$ac_find_includes" != "" ; then
+ AC_MSG_RESULT(found $ac_find_includes)
+ TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE -I$ac_find_includes"
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
+ fi
- AFMINSTALL=afminstall
+ XPM_LINK=""
+ AC_MSG_CHECKING(for Xpm library)
+ WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
+ if test "$ac_find_libraries" != "" ; then
+ GUI_TK_LIBRARY="-L$ac_find_libraries"
+ XPM_LINK="-lXpm"
+ AC_DEFINE(wxHAVE_LIB_XPM)
+ AC_MSG_RESULT(found at $ac_find_libraries)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(library will be compiled without support for images in XPM format)
+ fi
- dnl manual check for X11 headers/libs
- dnl
- dnl AC_MSG_CHECKING(for X11 headers)
- dnl WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, X11/Intrinsic.h)
- dnl if test "$ac_find_includes" != "" ; then
- dnl AC_MSG_RESULT(found $ac_find_includes)
- dnl else
- dnl AC_MSG_RESULT(no)
- dnl AC_MSG_ERROR(please set CFLAGS to contain the location of X11/Intrinsic.h)
- dnl fi
- dnl
- dnl AC_MSG_CHECKING(for X11 libraries)
- dnl WX_PATH_FIND_LIBRARIES($SEARCH_LIB, X11)
- dnl if test "$ac_find_libraries" != "" ; then
- dnl WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
- dnl WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
- dnl
- dnl GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
- dnl TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
- dnl AC_MSG_RESULT(found at $ac_find_libraries)
- dnl else
- dnl AC_MSG_RESULT(no)
- dnl AC_MSG_ERROR(please set LDFLAGS to contain the location of libX11)
- dnl fi
-
- COMPILED_X_PROGRAM=0
-
- AC_MSG_CHECKING(for Motif/Lesstif headers)
- WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
- if test "$ac_find_includes" != "" ; then
- AC_MSG_RESULT(found $ac_find_includes)
- else
- AC_TRY_COMPILE(
- [
- #include <Xm/Xm.h>
- ],
- [
- int version;
+ MESA_LINK=""
+ AC_MSG_CHECKING(for Mesa library)
+ WX_PATH_FIND_LIBRARIES($SEARCH_LIB,MesaGL)
+ if test "$ac_find_libraries" != "" ; then
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY -L$ac_find_libraries"
+ MESA_LINK="-lMesaGL"
+ AC_MSG_RESULT(found at $ac_find_libraries)
+ else
+ AC_MSG_ERROR(no)
+ fi
- version = xmUseVersion;
- ],
- [
- AC_MSG_RESULT(found in default search path)
- COMPILED_X_PROGRAM=1
- ],
- [
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
- ]
- )
+ GUI_TK_LINK="-lwine $MESA_LINK $XPM_LINK -lXxf86dga -lXxf86vm -lSM -lICE -lXext -lXmu -lX11 -lncurses"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
+ WXWINE=1
+ TOOLKIT=MSW
+ GUIDIST=MSW_DIST
fi
- if test "$COMPILED_X_PROGRAM" = 0; then
- AC_MSG_CHECKING(for Motif/Lesstif library)
- WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
- if test "$ac_find_libraries" != "" ; then
- WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
- WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+ dnl use standard macros to check for X headers/libs, this brings support
+ dnl for the standard configure options --x-includes and --x-libraries;
+ dnl the path to the X headers/libs is not only needed for motif, but also
+ dnl by the OpenGL and XKBlib.h checks further down
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
- TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
- AC_MSG_RESULT(found at $ac_find_libraries)
+ AC_PATH_XTRA
+ CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+ LDFLAGS="$LDFLAGS $X_LIBS"
+
+ if test "$wxUSE_MOTIF" = 1; then
+ if test "$no_x" = "yes"; then
+ AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options)
+ fi
+
+ GUI_TK_LIBRARY="$X_LIBS"
+ TOOLKIT_INCLUDE="$X_CFLAGS"
+
+ AFMINSTALL=afminstall
+
+ dnl manual check for X11 headers/libs
+ dnl
+ dnl AC_MSG_CHECKING(for X11 headers)
+ dnl WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, X11/Intrinsic.h)
+ dnl if test "$ac_find_includes" != "" ; then
+ dnl AC_MSG_RESULT(found $ac_find_includes)
+ dnl else
+ dnl AC_MSG_RESULT(no)
+ dnl AC_MSG_ERROR(please set CFLAGS to contain the location of X11/Intrinsic.h)
+ dnl fi
+ dnl
+ dnl AC_MSG_CHECKING(for X11 libraries)
+ dnl WX_PATH_FIND_LIBRARIES($SEARCH_LIB, X11)
+ dnl if test "$ac_find_libraries" != "" ; then
+ dnl WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+ dnl WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+ dnl
+ dnl GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+ dnl TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+ dnl AC_MSG_RESULT(found at $ac_find_libraries)
+ dnl else
+ dnl AC_MSG_RESULT(no)
+ dnl AC_MSG_ERROR(please set LDFLAGS to contain the location of libX11)
+ dnl fi
+
+ COMPILED_X_PROGRAM=0
+
+ AC_MSG_CHECKING(for Motif/Lesstif headers)
+ WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
+ if test "$ac_find_includes" != "" ; then
+ AC_MSG_RESULT(found $ac_find_includes)
else
- dnl it might happen that we found headers in one of the standard
- dnl paths but the libs are elsewhere - we do need to try to
- dnl compile a sample program then here
AC_TRY_COMPILE(
[
#include <Xm/Xm.h>
],
[
AC_MSG_RESULT(no)
- AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+ AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
]
)
fi
- fi
- dnl we don't need this as we used AC_PATH_XTRA above which does it for us
- dnl
- dnl dnl if we already compiled a sample program, X libs are surely there
- dnl if test "$COMPILED_X_PROGRAM" = 0; then
- dnl AC_MSG_CHECKING(for Xt library)
- dnl WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
- dnl if test "$ac_find_libraries" != "" ; then
- dnl WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
- dnl GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
- dnl AC_MSG_RESULT(found at $ac_find_libraries)
- dnl else
- dnl AC_TRY_COMPILE
- dnl (
- dnl [
- dnl #include <X11/Intrinsic.h>
- dnl ],
- dnl [
- dnl char *p;
- dnl p = XtMalloc(5);
- dnl ],
- dnl [
- dnl AC_MSG_RESULT(found in default search path)
- dnl COMPILED_X_PROGRAM=1
- dnl ],
- dnl [
- dnl AC_MSG_RESULT(no)
- dnl AC_MSG_ERROR(please set LDFLAGS to contain the location of libXt)
- dnl ]
- dnl )
- dnl fi
- dnl fi
-
- XPM_LINK=""
- AC_MSG_CHECKING(for Xpm library)
- WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
- if test "$ac_find_libraries" != "" ; then
- WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
- XPM_LINK="-lXpm "
- AC_DEFINE(wxHAVE_LIB_XPM)
- AC_MSG_RESULT(found at $ac_find_libraries)
- else
- AC_TRY_COMPILE(
- [
- #include <X11/xpm.h>
- ],
- [
- int version;
+ if test "$COMPILED_X_PROGRAM" = 0; then
+ AC_MSG_CHECKING(for Motif/Lesstif library)
+ WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
+ if test "$ac_find_libraries" != "" ; then
+ WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+ WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+ TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+ AC_MSG_RESULT(found at $ac_find_libraries)
+ else
+ dnl it might happen that we found headers in one of the standard
+ dnl paths but the libs are elsewhere - we do need to try to
+ dnl compile a sample program then here
+ AC_TRY_COMPILE(
+ [
+ #include <Xm/Xm.h>
+ ],
+ [
+ int version;
- version = XpmLibraryVersion();
- ],
- [
+ version = xmUseVersion;
+ ],
+ [
+ AC_MSG_RESULT(found in default search path)
+ COMPILED_X_PROGRAM=1
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+ ]
+ )
+ fi
+ fi
+
+ dnl we don't need this as we used AC_PATH_XTRA above which does it for us
+ dnl
+ dnl dnl if we already compiled a sample program, X libs are surely there
+ dnl if test "$COMPILED_X_PROGRAM" = 0; then
+ dnl AC_MSG_CHECKING(for Xt library)
+ dnl WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
+ dnl if test "$ac_find_libraries" != "" ; then
+ dnl WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
+ dnl GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+ dnl AC_MSG_RESULT(found at $ac_find_libraries)
+ dnl else
+ dnl AC_TRY_COMPILE
+ dnl (
+ dnl [
+ dnl #include <X11/Intrinsic.h>
+ dnl ],
+ dnl [
+ dnl char *p;
+ dnl p = XtMalloc(5);
+ dnl ],
+ dnl [
+ dnl AC_MSG_RESULT(found in default search path)
+ dnl COMPILED_X_PROGRAM=1
+ dnl ],
+ dnl [
+ dnl AC_MSG_RESULT(no)
+ dnl AC_MSG_ERROR(please set LDFLAGS to contain the location of libXt)
+ dnl ]
+ dnl )
+ dnl fi
+ dnl fi
+
+ XPM_LINK=""
+ AC_MSG_CHECKING(for Xpm library)
+ WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
+ if test "$ac_find_libraries" != "" ; then
+ WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
XPM_LINK="-lXpm "
AC_DEFINE(wxHAVE_LIB_XPM)
- AC_MSG_RESULT(found in default search path)
- COMPILED_X_PROGRAM=0
- ],
- [
- AC_MSG_RESULT(no)
- AC_MSG_WARN(library will be compiled without support for images in XPM format)
- ]
- )
- fi
+ AC_MSG_RESULT(found at $ac_find_libraries)
+ else
+ AC_TRY_COMPILE(
+ [
+ #include <X11/xpm.h>
+ ],
+ [
+ int version;
- GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXext -lXt -lX11"
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
- TOOLKIT=MOTIF
- GUIDIST=MOTIF_DIST
-fi
+ version = XpmLibraryVersion();
+ ],
+ [
+ XPM_LINK="-lXpm "
+ AC_DEFINE(wxHAVE_LIB_XPM)
+ AC_MSG_RESULT(found in default search path)
+ COMPILED_X_PROGRAM=0
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(library will be compiled without support for images in XPM format)
+ ]
+ )
+ fi
-if test "$wxUSE_MAC" = 1; then
- TOOLKIT=MAC
- dnl we can't call this MAC_DIST or autoconf thinks its a macro
- GUIDIST=MACX_DIST
-fi
+ GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXext -lXt -lX11"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
+ TOOLKIT=MOTIF
+ GUIDIST=MOTIF_DIST
+ fi
-if test "$wxUSE_PM" = 1; then
- TOOLKIT=PM
- GUIDIST=GTK_DIST
-fi
+ if test "$wxUSE_MAC" = 1; then
+ TOOLKIT=MAC
+ dnl we can't call this MAC_DIST or autoconf thinks its a macro
+ GUIDIST=MACX_DIST
+ fi
-dnl the name of the directory where the files for this toolkit live
-if test "$TOOLKIT" != "PM" ; then
- TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[[A-Z]]" "[[a-z]]"`
-else
- TOOLKIT_DIR="os2"
-fi
+ if test "$wxUSE_PM" = 1; then
+ TOOLKIT=PM
+ GUIDIST=GTK_DIST
+ fi
+
+ dnl the name of the directory where the files for this toolkit live
+ if test "$TOOLKIT" != "PM" ; then
+ TOOLKIT_DIR=`echo ${TOOLKIT} | tr "[[A-Z]]" "[[a-z]]"`
+ else
+ TOOLKIT_DIR="os2"
+ fi
dnl the (base) name of the library and support files for this toolkit
- if test "$wxUSE_DEBUG_FLAG" = "yes"; then
- TOOLKIT_NAME="${TOOLKIT_DIR}d"
+ TOOLKIT_NAME="${TOOLKIT_DIR}"
+
+ dnl the list of paths containing the files for this toolkit
+ TOOLKIT_VPATH="\${top_srcdir}/src/${TOOLKIT_DIR}"
+
+ dnl need to add an extra dir for wxMotif
+ if test "$TOOLKIT_NAME" = "motif"; then
+ TOOLKIT_VPATH="${TOOLKIT_VPATH}${PATH_IFS}\${top_srcdir}/src/motif/xmcombo"
+ fi
+
+ dnl are we using the generic version with this low level toolkit?
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ TOOLKIT_NAME="${TOOLKIT_NAME}univ"
+ UNIV_VPATH="\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes"
+ TOOLKIT_VPATH="${UNIV_VPATH}${PATH_IFS}${TOOLKIT_VPATH}"
+ SETUPH_DIR="univ"
else
- TOOLKIT_NAME="${TOOLKIT_DIR}"
+ SETUPH_DIR="${TOOLKIT_DIR}"
+ fi
+
+ dnl append 'd' to the debug library name
+ if test "$wxUSE_DEBUG_FLAG" = "yes"; then
+ TOOLKIT_NAME="${TOOLKIT_NAME}d"
fi
dnl the symbol which allows conditional compilation for the given toolkit
TOOLKIT_DEF="-D__WX${TOOLKIT}__"
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXUNIVERSAL__"
+ fi
dnl the name of the (libtool) library
WX_LIBRARY="wx_${TOOLKIT_NAME}"
- dnl the sources, their dependenices and the headers
- ALL_OBJECTS="\$(GUIOBJS) \$(COMMONOBJS) \$(GENERICOBJS) \$(UNIXOBJS) \$(HTMLOBJS) \$(OGLOBJS)"
+ dnl collect together all the object files for this port
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ ALL_OBJECTS="\$(GUI_LOWLEVEL_OBJS) \${UNIVOBJS}"
+ else
+ ALL_OBJECTS="\$(GUIOBJS)"
+ fi
+
+ ALL_OBJECTS="${ALL_OBJECTS} \$(COMMONOBJS) \$(GENERICOBJS)"
+
+ if test "$TOOLKIT" != "MSW"; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(UNIXOBJS)"
+ fi
+
+ if test "$wxUSE_HTML" = "yes"; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(HTMLOBJS)"
+ fi
dnl ODBC objects are Unix only
- if test "$TOOLKIT" != "MSW" -a "$wxUSE_ODBC" = "yes" ; then
- ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
+ if test "$TOOLKIT" != "MSW"; then
+ if test "$wxUSE_ODBC" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
+ fi
fi
if test "$wxUSE_LIBJPEG" = "yes" ; then
if test "$wxUSE_FREETYPE" = "yes" ; then
ALL_OBJECTS="${ALL_OBJECTS} \$(FREETYPEOBJS)"
fi
- ALL_DEPFILES="\$(GUIDEPS) \$(COMMONDEPS) \$(GENERICDEPS) \$(UNIXDEPS) \$(HTMLDEPS) \$(OGLDEPS)"
+ dnl collect all .d files together as well
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ ALL_DEPFILES="\$(GUI_LOWLEVEL_DEPS) \$(UNIVDEPS)"
+ else
+ ALL_DEPFILES="\$(GUIDEPS)"
+ fi
+
+ ALL_DEPFILES="${ALL_DEPFILES} \$(COMMONDEPS) \$(GENERICDEPS)"
+
+ if test "$TOOLKIT" != "MSW"; then
+ ALL_DEPFILES="${ALL_DEPFILES} \$(UNIXDEPS)"
+ fi
+
+ if test "$wxUSE_HTML" = "yes"; then
+ ALL_DEPFILES="${ALL_DEPFILES} \$(HTMLDEPS)"
+ fi
+
+ dnl misc other files depending on the port
PORT_FILES="src/\$(TOOLKITDIR)/files.lst"
+ if test "$wxUSE_UNIVERSAL" = "yes"; then
+ PORT_FILES="${PORT_FILES} \${top_srcdir}/src/univ/files.lst"
+ fi
RPM_FILES="src/\$(TOOLKITDIR)/rpmfiles.lst"
RPM_SPEC="wx\$(TOOLKIT).spec"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
- dnl add the resources target
- WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
- dnl the name of the shared library
- WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
- WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
- dnl the name of the links to the shared library
- WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
- WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
- WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
- WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
- WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
- WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
+ dnl add the resources target
+ WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
+ dnl the name of the shared library
+ WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+ WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+ dnl the name of the links to the shared library
+ WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
+ WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
+ WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
+ WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
+ WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
+ WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
;;
*-*-osf* )
SHARED_LD="${CXX} -shared -o"
[
AC_TRY_RUN(
[
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #ifdef HAVE_STDLIB_H
- # include <stdlib.h>
- #endif
- #include <stdio.h>
- int main()
- {
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%i", sizeof(wchar_t));
- exit(0);
- }
+ #ifdef HAVE_WCHAR_H
+ # include <wchar.h>
+ #endif
+ #ifdef HAVE_STDLIB_H
+ # include <stdlib.h>
+ #endif
+ #include <stdio.h>
+ int main()
+ {
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%i", sizeof(wchar_t));
+ exit(0);
+ }
],
- wx_cv_sizeof_wchar_t=`cat conftestval`,
- wx_cv_sizeof_wchar_t=0,
- wx_cv_sizeof_wchar_t=4
- )
+ wx_cv_sizeof_wchar_t=`cat conftestval`,
+ wx_cv_sizeof_wchar_t=0,
+ wx_cv_sizeof_wchar_t=4
+ )
])
AC_DEFINE_UNQUOTED(SIZEOF_WCHAR_T, $wx_cv_sizeof_wchar_t)
AC_DEFINE(wxUSE_APPLE_IEEE)
fi
+if test "$wxUSE_TIMER" = "yes"; then
+ AC_DEFINE(wxUSE_TIMER)
+fi
+
if test "$wxUSE_WAVE" = "yes"; then
AC_DEFINE(wxUSE_WAVE)
fi
+if test "$wxUSE_CMDLINE_PARSER" = "yes"; then
+ AC_DEFINE(wxUSE_CMDLINE_PARSER)
+fi
+
+if test "$wxUSE_STOPWATCH" = "yes"; then
+ AC_DEFINE(wxUSE_STOPWATCH)
+fi
+
+if test "$wxUSE_DATETIME" = "yes"; then
+ AC_DEFINE(wxUSE_DATETIME)
+fi
+
+if test "$wxUSE_TIMEDATE" = "yes"; then
+ AC_DEFINE(wxUSE_TIMEDATE)
+fi
+
if test "$wxUSE_FILE" = "yes"; then
AC_DEFINE(wxUSE_FILE)
fi
+if test "$wxUSE_FFILE" = "yes"; then
+ AC_DEFINE(wxUSE_FFILE)
+fi
+
if test "$wxUSE_FILESYSTEM" = "yes"; then
AC_DEFINE(wxUSE_FILESYSTEM)
fi
dnl time/date functions
dnl ------------------------------------------------------------------------
-if test "$wxUSE_TIMEDATE" = "yes"; then
+if test "$wxUSE_DATETIME" = "yes"; then
dnl check for strptime
AC_CHECK_FUNCS(strptime)
dnl String stuff
dnl ---------------------------------------------------------------------------
+if test "$wxUSE_FONTMAP" = "yes" ; then
+ AC_DEFINE(wxUSE_FONTMAP)
+fi
+
if test "$wxUSE_UNICODE" = "yes" ; then
AC_DEFINE(wxUSE_UNICODE)
fi
if test "$wxUSE_CLIPBOARD" = "yes"; then
AC_DEFINE(wxUSE_CLIPBOARD)
+ AC_DEFINE(wxUSE_DATAOBJ)
fi
if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
dnl GUI controls
dnl ---------------------------------------------------------------------------
+USES_CONTROLS=0
+if test "$wxUSE_CONTROLS" = "yes"; then
+ USES_CONTROLS=1
+fi
+
if test "$wxUSE_ACCEL" = "yes"; then
AC_DEFINE(wxUSE_ACCEL)
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_BUTTON" = "yes"; then
+ AC_DEFINE(wxUSE_BUTTON)
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_BMPBUTTON" = "yes"; then
+ AC_DEFINE(wxUSE_BMPBUTTON)
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_CALCTRL" = "yes"; then
+ AC_DEFINE(wxUSE_CALENDARCTRL)
+ USES_CONTROLS=1
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS calendar"
fi
if test "$wxUSE_CARET" = "yes"; then
AC_DEFINE(wxUSE_CARET)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS caret"
fi
if test "$wxUSE_COMBOBOX" = "yes"; then
AC_DEFINE(wxUSE_COMBOBOX)
+ USES_CONTROLS=1
fi
if test "$wxUSE_CHOICE" = "yes"; then
AC_DEFINE(wxUSE_CHOICE)
-fi
-
-if test "$wxUSE_BMPBUTTON" = "yes"; then
- AC_DEFINE(wxUSE_BMPBUTTON)
+ USES_CONTROLS=1
fi
if test "$wxUSE_CHECKBOX" = "yes"; then
AC_DEFINE(wxUSE_CHECKBOX)
+ USES_CONTROLS=1
fi
if test "$wxUSE_CHECKLST" = "yes"; then
AC_DEFINE(wxUSE_CHECKLISTBOX)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS checklst"
fi
if test "$wxUSE_GAUGE" = "yes"; then
AC_DEFINE(wxUSE_GAUGE)
+ USES_CONTROLS=1
fi
if test "$wxUSE_NEW_GRID" = "yes"; then
wxUSE_GRID="yes"
AC_DEFINE(wxUSE_NEW_GRID)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS newgrid"
fi
if test "$wxUSE_GRID" = "yes"; then
AC_DEFINE(wxUSE_GRID)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS grid"
fi
if test "$wxUSE_LISTBOX" = "yes"; then
AC_DEFINE(wxUSE_LISTBOX)
+ USES_CONTROLS=1
fi
if test "$wxUSE_LISTCTRL" = "yes"; then
if test "$wxUSE_IMAGLIST" = "yes"; then
AC_DEFINE(wxUSE_LISTCTRL)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS listctrl"
else
AC_MSG_WARN([wxListCtrl requires wxImageList and won't be compiled without it])
if test "$wxUSE_NOTEBOOK" = "yes"; then
AC_DEFINE(wxUSE_NOTEBOOK)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS notebook"
fi
if test "$wxUSE_RADIOBOX" = "yes"; then
AC_DEFINE(wxUSE_RADIOBOX)
+ USES_CONTROLS=1
fi
if test "$wxUSE_RADIOBTN" = "yes"; then
AC_DEFINE(wxUSE_RADIOBTN)
+ USES_CONTROLS=1
fi
if test "$wxUSE_SASH" = "yes"; then
if test "$wxUSE_SCROLLBAR" = "yes"; then
AC_DEFINE(wxUSE_SCROLLBAR)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll scrollsub"
fi
if test "$wxUSE_SLIDER" = "yes"; then
AC_DEFINE(wxUSE_SLIDER)
+ USES_CONTROLS=1
fi
if test "$wxUSE_SPINBTN" = "yes"; then
AC_DEFINE(wxUSE_SPINBTN)
+ USES_CONTROLS=1
fi
if test "$wxUSE_SPINCTRL" = "yes"; then
AC_DEFINE(wxUSE_SPINCTRL)
+ USES_CONTROLS=1
fi
if test "$wxUSE_SPLITTER" = "yes"; then
if test "$wxUSE_STATBMP" = "yes"; then
AC_DEFINE(wxUSE_STATBMP)
+ USES_CONTROLS=1
fi
if test "$wxUSE_STATBOX" = "yes"; then
AC_DEFINE(wxUSE_STATBOX)
+ USES_CONTROLS=1
+fi
+
+if test "$wxUSE_STATTEXT" = "yes"; then
+ AC_DEFINE(wxUSE_STATTEXT)
+ USES_CONTROLS=1
fi
if test "$wxUSE_STATLINE" = "yes"; then
AC_MSG_WARN([wxStaticLine is not supported under WINE])
else
AC_DEFINE(wxUSE_STATLINE)
+ USES_CONTROLS=1
fi
fi
if test "$wxUSE_STATUSBAR" = "yes"; then
AC_DEFINE(wxUSE_STATUSBAR)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar"
fi
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS tab"
fi
+if test "$wxUSE_TEXTCTRL" = "yes"; then
+ AC_DEFINE(wxUSE_TEXTCTRL)
+ USES_CONTROLS=1
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS text"
+fi
+
if test "$wxUSE_TOGGLEBTN" = "yes"; then
if test "$wxUSE_MAC" = 1; then
AC_MSG_WARN([Toggle button is not yet supported under Mac OS X])
if test "$wxUSE_TOGGLEBTN" = "yes"; then
AC_DEFINE(wxUSE_TOGGLEBTN)
+ USES_CONTROLS=1
fi
fi
if test "$wxUSE_TOOLBAR_SIMPLE" = "yes"; then
AC_DEFINE(wxUSE_TOOLBAR_SIMPLE)
wxUSE_TOOLBAR="yes"
+ USES_CONTROLS=1
fi
if test "$wxUSE_TOOLBAR" = "yes"; then
AC_DEFINE(wxUSE_TOOLBAR)
+ USES_CONTROLS=1
dnl if wxUSE_TOOLBAR and !wxUSE_TOOLBAR_SIMPLE => wxUSE_TOOLBAR_NATIVE
if test "$wxUSE_TOOLBAR_SIMPLE" != "yes"; then
wxUSE_TOOLBAR_NATIVE="yes"
fi
- SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
-fi
+ if test "$wxUSE_TOOLBAR_NATIVE" = "yes"; then
+ AC_DEFINE(wxUSE_TOOLBAR_NATIVE)
+ USES_CONTROLS=1
+ fi
-if test "$wxUSE_TOOLBAR_NATIVE" = "yes"; then
- AC_DEFINE(wxUSE_TOOLBAR_NATIVE)
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS toolbar"
fi
if test "$wxUSE_TOOLTIPS" = "yes"; then
if test "$wxUSE_TREECTRL" = "yes"; then
if test "$wxUSE_IMAGLIST" = "yes"; then
AC_DEFINE(wxUSE_TREECTRL)
+ USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS treectrl"
else
AC_MSG_WARN([wxTreeCtrl requires wxImageList and won't be compiled without it])
fi
fi
+if test "$USES_CONTROLS" = 1; then
+ AC_DEFINE(wxUSE_CONTROLS)
+fi
+
dnl ---------------------------------------------------------------------------
dnl misc options
dnl ---------------------------------------------------------------------------
dnl AC_DEFINE(wxUSE_WXTREE)
dnl fi
-if test "$wxUSE_DIRDLG" = "yes"; then
- if test "$wxUSE_CONSTRAINTS" != "yes"; then
- AC_MSG_WARN(wxDirDialog requires constraints so it won't be compiled without them)
- else
- if test "$wxUSE_TREECTRL" != "yes"; then
- AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
- else
- AC_DEFINE(wxUSE_DIRDLG)
- fi
- fi
+if test "$wxUSE_MENUS" = "yes"; then
+ AC_DEFINE(wxUSE_MENUS)
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS menu"
fi
-if test "$wxUSE_TEXTDLG" = "yes"; then
- AC_DEFINE(wxUSE_TEXTDLG)
+if test "$wxUSE_METAFILE" = "yes"; then
+ AC_DEFINE(wxUSE_METAFILE)
fi
-if test "$wxUSE_STARTUP_TIPS" = "yes"; then
- if test "$wxUSE_CONSTRAINTS" != "yes"; then
- AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
- else
- AC_DEFINE(wxUSE_STARTUP_TIPS)
- fi
-fi
-
-if test "$wxUSE_PROGRESSDLG" = "yes"; then
- if test "$wxUSE_CONSTRAINTS" != "yes"; then
- AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
- else
- AC_DEFINE(wxUSE_PROGRESSDLG)
- fi
+if test "$wxUSE_MIMETYPE" = "yes"; then
+ AC_DEFINE(wxUSE_MIMETYPE)
fi
if test "$wxUSE_MINIFRAME" = "yes"; then
AC_DEFINE(wxUSE_XPM)
fi
+dnl ---------------------------------------------------------------------------
+dnl common dialog
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_CHOICEDLG" = "yes"; then
+ AC_DEFINE(wxUSE_CHOICEDLG)
+fi
+
+if test "$wxUSE_COLOURDLG" = "yes"; then
+ AC_DEFINE(wxUSE_COLOURDLG)
+fi
+
+if test "$wxUSE_FILEDLG" = "yes"; then
+ AC_DEFINE(wxUSE_FILEDLG)
+fi
+
+if test "$wxUSE_FONTDLG" = "yes"; then
+ AC_DEFINE(wxUSE_FONTDLG)
+fi
+
+if test "$wxUSE_DIRDLG" = "yes"; then
+ if test "$wxUSE_CONSTRAINTS" != "yes"; then
+ AC_MSG_WARN(wxDirDialog requires constraints so it won't be compiled without them)
+ else
+ if test "$wxUSE_TREECTRL" != "yes"; then
+ AC_MSG_WARN(wxDirDialog requires wxTreeCtrl so it won't be compiled without it)
+ else
+ AC_DEFINE(wxUSE_DIRDLG)
+ fi
+ fi
+fi
+
+if test "$wxUSE_MSGDLG" = "yes"; then
+ AC_DEFINE(wxUSE_MSGDLG)
+fi
+
+if test "$wxUSE_NUMBERDLG" = "yes"; then
+ AC_DEFINE(wxUSE_NUMBERDLG)
+fi
+
+if test "$wxUSE_PROGRESSDLG" = "yes"; then
+ if test "$wxUSE_CONSTRAINTS" != "yes"; then
+ AC_MSG_WARN(wxProgressDialog requires constraints so it won't be compiled without them)
+ else
+ AC_DEFINE(wxUSE_PROGRESSDLG)
+ fi
+fi
+
+if test "$wxUSE_STARTUP_TIPS" = "yes"; then
+ if test "$wxUSE_CONSTRAINTS" != "yes"; then
+ AC_MSG_WARN(Startup tips requires constraints and won't be compiled without them)
+ else
+ AC_DEFINE(wxUSE_STARTUP_TIPS)
+ fi
+fi
+
+if test "$wxUSE_TEXTDLG" = "yes"; then
+ AC_DEFINE(wxUSE_TEXTDLG)
+fi
+
dnl ---------------------------------------------------------------------------
dnl get the string with OS info - used by wxGetOsDescription()
dnl ---------------------------------------------------------------------------
dnl TODO some samples are never built so far:
dnl ipc, mfc, nativdlg, oleauto, ownerdrw, proplist
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS controls dialogs dragimag \
- drawing dynamic event font fractal image menu \
- minimal richedit"
+ drawing dynamic event font fractal image \
+ minimal richedit widgets"
+
+ if test "$wxUSE_UNIVERSAL" = "yes" ; then
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS univ"
+ fi
dnl this is needed to be able to find AFM files
CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"
dnl toolkit options
AC_SUBST(USE_GUI)
AC_SUBST(AFMINSTALL)
+AC_SUBST(SETUPH_DIR)
AC_SUBST(TOOLKIT)
AC_SUBST(TOOLKIT_DEF)
AC_SUBST(TOOLKIT_DIR)
AC_SUBST(TOOLKIT_NAME)
AC_SUBST(TOOLKIT_INCLUDE)
+AC_SUBST(TOOLKIT_VPATH)
AC_SUBST(WXCONFIG_INCLUDE)
dnl what to compile
dnl move setup.h back if available
if test -d include; then
if test -d include/wx; then
- if test -d include/wx/${TOOLKIT_DIR}; then
- if test -f include/wx/${TOOLKIT_DIR}/setup.h; then
- mv -f include/wx/${TOOLKIT_DIR}/setup.h setup.h
+ if test -d include/wx/${SETUPH_DIR}; then
+ if test -f include/wx/${SETUPH_DIR}/setup.h; then
+ mv -f include/wx/${SETUPH_DIR}/setup.h setup.h
fi
fi
fi
if test ! -d include/wx; then
mkdir include/wx
fi
- if test ! -d include/wx/${TOOLKIT_DIR}; then
- mkdir include/wx/${TOOLKIT_DIR}
+ if test ! -d include/wx/${SETUPH_DIR}; then
+ mkdir include/wx/${SETUPH_DIR}
fi
if test -f setup.h; then
- cp -fp setup.h include/wx/${TOOLKIT_DIR}/setup.h
+ cp -fp setup.h include/wx/${SETUPH_DIR}/setup.h
fi
],
[
- TOOLKIT_DIR="${TOOLKIT_DIR}"
+ SETUPH_DIR="${SETUPH_DIR}"
TOOLKIT_NAME="${TOOLKIT_NAME}"
LN_S="${LN_S}"
]
# FIXME we'll generate this makefile with configure later, but for now please
# change it manually
-TMAKEDIR=/home/zeitlin/build/tmake
-TMAKE=$(TMAKEDIR)/bin/tmake
+#TMAKEDIR=/home/zeitlin/build/tmake
+#TMAKE=$(TMAKEDIR)/bin/tmake
+TMAKE=tmake
WXDIR=../../..
MSW_MAKEFILES_DIR=$(WXDIR)/src/msw
$wxMOTIF{$fields[0]} = $fields[2];
} elsif ( $fields[1] eq "R" ) {
$wxGTK{$fields[0]} = $fields[2];
+ } elsif ( $fields[1] eq "V" ) {
+ $wxUNIV{$fields[0]} = $fields[2];
+ } elsif ( $fields[1] eq "Z" ) {
+ $wxMGL{$fields[0]} = $fields[2];
} elsif ( $fields[1] eq "O" ) {
$wxOS2PM{$fields[0]} = $fields[2];
} elsif ( $fields[1] eq "H" ) {
# M /src/msw
# X /src/motif X for Xt
# U /src/unix
+# V /src/univ V for VZ
# R /src/gtk R for Robert
+# Z /src/mgl Z for v.slavik@volny.cZ
# O /src/os2
# H /src/html
# W /include/wx
# P Not required for the os2Pm port
# (unfortunately I can't use O since that is
# in use already - and above I can't use P :-( )
+# L Low level GUI toolkit file, used by wxUniversal as well
#
# WX Base header
# GTK GTK header
# File name Type Flags
+accel.cpp G U,X,P
busyinfo.cpp G
calctrl.cpp G
caret.cpp G U
logg.cpp G
msgdlgg.cpp G G
notebook.cpp G 16,R,P
+paletteg.cpp G U,X,P
panelg.cpp G
printps.cpp G PS
prntdlgg.cpp G PS,U
appcmn.cpp C B
choiccmn.cpp C
cmdline.cpp C B
+cmdproc.cpp C
cmndata.cpp C
clipcmn.cpp C
config.cpp C B
image.cpp C
imagall.cpp C
imaggif.cpp C
+imagxpm.cpp C
imagjpeg.cpp C 32
imagtiff.cpp C 32
imagpcx.cpp C 32
gsocket.c U B
mimetype.cpp U B
+bmpbuttn.cpp V
+button.cpp V
+checkbox.cpp V
+checklst.cpp V
+cmdproc.cpp V
+colschem.cpp V
+control.cpp V
+framuniv.cpp V
+inphand.cpp V
+listbox.cpp V
+radiobox.cpp V
+radiobut.cpp V
+renderer.cpp V
+scrarrow.cpp V
+scrolbar.cpp V
+scrthumb.cpp V
+slider.cpp V
+spinbutt.cpp V
+statbmp.cpp V
+statbox.cpp V
+statline.cpp V
+stattext.cpp V
+textctrl.cpp V
+theme.cpp V
+gtk.cpp V
+winuniv.cpp V
+win32.cpp V
+
gsockgtk.c R
-win_gtk.c R
-accel.cpp R
-app.cpp R
-bitmap.cpp R
+win_gtk.c R L
+app.cpp R L
+bitmap.cpp R L
bmpbuttn.cpp R
-brush.cpp R
+brush.cpp R L
button.cpp R
checkbox.cpp R
checklst.cpp R
choice.cpp R
-clipbrd.cpp R
-colour.cpp R
+clipbrd.cpp R L
+colour.cpp R L
combobox.cpp R
control.cpp R
-cursor.cpp R
-data.cpp R
-dataobj.cpp R
-dc.cpp R
-dcclient.cpp R
-dcmemory.cpp R
-dcscreen.cpp R
-dialog.cpp R
+cursor.cpp R L
+data.cpp R L
+dataobj.cpp R L
+dc.cpp R L
+dcclient.cpp R L
+dcmemory.cpp R L
+dcscreen.cpp R L
+dialog.cpp R L
dnd.cpp R
-font.cpp R
+font.cpp R L
fontdlg.cpp R
-frame.cpp R
+frame.cpp R L
gauge.cpp R
-gdiobj.cpp R
-icon.cpp R
+gdiobj.cpp R L
+icon.cpp R L
joystick.cpp R
listbox.cpp R
-main.cpp R
+main.cpp R L
mdi.cpp R
menu.cpp R
minifram.cpp R
notebook.cpp R
-paletteg.cpp G U,X,P
-pen.cpp R
+pen.cpp R L
radiobox.cpp R
radiobut.cpp R
-region.cpp R
+region.cpp R L
scrolbar.cpp R
scrolwin.cpp R
-settings.cpp R
+settings.cpp R L
slider.cpp R
spinbutt.cpp R
spinctrl.cpp R
tbargtk.cpp R
textctrl.cpp R
tglbtn.cpp R
-timer.cpp R
+timer.cpp R L
tooltip.cpp R
-utilsgtk.cpp R
+utilsgtk.cpp R L
utilsres.cpp R
wave.cpp R
-window.cpp R
+window.cpp R L
gsockmot.c X S
accel.cpp X
choice.h W
clipbrd.h W
cmdline.h W B
+cmdproc.cpp W
cmndata.h W
colordlg.h W
colour.h W
icon.h W
image.h W
imaggif.h W
+imagxpm.h W
imagbmp.h W
imagpng.h W
imagpcx.h W
treectlg.h N 16
wizard.h N
+# wxMGL:
+colour.cpp Z L
+dc.cpp Z L
+gdiobj.cpp Z L
+palette.cpp Z L
+region.cpp Z L
+brush.cpp Z L
+pen.cpp Z L
+font.cpp Z L
+data.cpp Z L
+#fontenum.cpp Z L
+#fontutil.cpp Z L
+app.cpp Z L
+bitmap.cpp Z L
+clipbrd.cpp Z L
+cursor.cpp Z L
+dcclient.cpp Z L
+dcmemory.cpp Z L
+dcscreen.cpp Z L
+dialog.cpp Z L
+frame.cpp Z L
+icon.cpp Z L
+settings.cpp Z L
+timer.cpp Z L
+window.cpp Z L
+utils.cpp Z L
+bmpbase.cpp Z L
+
# vi: set noet ts=16 nolist:
$project{"GTK_SOURCES"} .= "gtk/" . $file . " ";
$project{"GUIOBJS"} .= $fileobj . " ";
- $project{"GUIDEPS"} .= $filedep . " "
+ $project{"GUIDEPS"} .= $filedep . " ";
+
+ if ( $wxGTK{$file} =~ /\bL\b/ ) {
+ $project{"GUI_LOWLEVEL_OBJS"} .= $fileobj . " ";
+ $project{"GUI_LOWLEVEL_DEPS"} .= $filedep . " ";
+ }
}
foreach $file (sort keys %wxUNIX) {
$project{"HTMLOBJS"} .= $fileobj . " ";
$project{"HTMLDEPS"} .= $filedep . " "
}
-
+
#! find all our headers
foreach $file (sort keys %wxWXINCLUDE) {
next if $wxWXINCLUDE{$file} =~ /\bR\b/;
GUIDEPS = \
#$ ExpandList("GUIDEPS");
+GUI_LOWLEVEL_OBJS = \
+ #$ ExpandList("GUI_LOWLEVEL_OBJS");
+
+GUI_LOWLEVEL_DEPS = \
+ #$ ExpandList("GUI_LOWLEVEL_DEPS");
+
UNIXOBJS = \
#$ ExpandList("UNIXOBJS");
%tmakecmd% -t wat wxwin.pro -o %WXDIR%\src\msw\makefile.wat
echo Generating for Unix and Configure...
%tmakecmd% -t gtk wxwin.pro -o %WXDIR%\src\gtk\files.lst
+%tmakecmd% -t univ wxwin.pro -o %WXDIR%\src\univ\files.lst
%tmakecmd% -t msw wxwin.pro -o %WXDIR%\src\msw\files.lst
%tmakecmd% -t motif wxwin.pro -o %WXDIR%\src\motif\files.lst
%tmakecmd% -t os2 wxwin.pro -o %WXDIR%\src\os2\files.lst
echo "Generating $topdir/src/motif/files.lst for Motif and Configure..."
tmake -t motif wxwin.pro -o $topdir/src/motif/files.lst;;
+ univ.t)
+ echo "Generating $topdir/src/univ/files.lst for wxUniversal..."
+ tmake -t univ wxwin.pro -o $topdir/src/univ/files.lst;;
+
unx.t)
echo "Generating $topdir/src/os2/files.lst for OS/2 PM and Configure..."
tmake -t os2 wxwin.pro -o $topdir/src/os2/files.lst;;
--- /dev/null
+#!################################################################################
+#! File: gtk.t
+#! Purpose: tmake template file from which src/gtk/files.lst containing the
+#! list of files for wxGTK library is generated by tmake
+#! Author: Vadim Zeitlin
+#! Created: 28.01.00
+#! Version: $Id$
+#!################################################################################
+#${
+ #! include the code which parses filelist.txt file and initializes
+ #! %wxCommon, %wxGeneric, %wxHtml, %wxUNIX, %wxGTK, %wxMOTIF and
+ #! %wxOS2PM hashes.
+ IncludeTemplate("filelist.t");
+
+ #! find all our sources
+ $project{"COMMONOBJS"} .= "parser.o ";
+ $project{"COMMONDEPS"} .= "parser.d ";
+
+ foreach $file (sort keys %wxGeneric) {
+ next if $wxGeneric{$file} =~ /\bR\b/;
+
+ ($fileobj = $file) =~ s/cp?p?$/\o/;
+ ($filedep = $file) =~ s/cp?p?$/\d/;
+
+ $project{"MGL_SOURCES"} .= "generic/" . $file . " ";
+ $project{"GENERICOBJS"} .= $fileobj . " ";
+ $project{"GENERICDEPS"} .= $filedep . " "
+ }
+
+ foreach $file (sort keys %wxCommon) {
+ next if $wxCommon{$file} =~ /\bR\b/;
+
+ ($fileobj = $file) =~ s/cp?p?$/\o/;
+ ($filedep = $file) =~ s/cp?p?$/\d/;
+
+ $project{"MGL_SOURCES"} .= "common/" . $file . " ";
+ $project{"COMMONOBJS"} .= $fileobj . " ";
+ $project{"COMMONDEPS"} .= $filedep . " "
+ }
+
+ foreach $file (sort keys %wxMGL) {
+ ($fileobj = $file) =~ s/cp?p?$/\o/;
+ ($filedep = $file) =~ s/cp?p?$/\d/;
+
+ $project{"MGL_SOURCES"} .= "mgl/" . $file . " ";
+ $project{"GUIOBJS"} .= $fileobj . " ";
+ $project{"GUIDEPS"} .= $filedep . " ";
+
+ if ( $wxMGL{$file} =~ /\bL\b/ ) {
+ $project{"GUI_LOWLEVEL_OBJS"} .= $fileobj . " ";
+ $project{"GUI_LOWLEVEL_DEPS"} .= $filedep . " ";
+ }
+ }
+
+ foreach $file (sort keys %wxUNIX) {
+ ($fileobj = $file) =~ s/cp?p?$/\o/;
+ ($filedep = $file) =~ s/cp?p?$/\d/;
+
+ $project{"MGL_SOURCES"} .= "unix/" . $file . " ";
+ $project{"UNIXOBJS"} .= $fileobj . " ";
+ $project{"UNIXDEPS"} .= $filedep . " "
+ }
+
+ foreach $file (sort keys %wxHTML) {
+ ($fileobj = $file) =~ s/cp?p?$/\o/;
+ ($filedep = $file) =~ s/cp?p?$/\d/;
+
+ $project{"MGL_SOURCES"} .= "html/" . $file . " ";
+ $project{"HTMLOBJS"} .= $fileobj . " ";
+ $project{"HTMLDEPS"} .= $filedep . " "
+ }
+
+ #! find all our headers
+ foreach $file (sort keys %wxWXINCLUDE) {
+ $project{"MGL_HEADERS"} .= $file . " "
+ }
+
+ foreach $file (sort keys %wxGTKINCLUDE) {
+ $project{"MGL_HEADERS"} .= "gtk/" . $file . " "
+ }
+
+ foreach $file (sort keys %wxGENERICINCLUDE) {
+ $project{"MGL_HEADERS"} .= "generic/" . $file . " "
+ }
+
+ foreach $file (sort keys %wxUNIXINCLUDE) {
+ $project{"MGL_HEADERS"} .= "unix/" . $file . " "
+ }
+
+ foreach $file (sort keys %wxHTMLINCLUDE) {
+ $project{"MGL_HEADERS"} .= "html/" . $file . " "
+ }
+
+ foreach $file (sort keys %wxPROTOCOLINCLUDE) {
+ $project{"MGL_HEADERS"} .= "protocol/" . $file . " "
+ }
+#$}
+# This file was automatically generated by tmake at #$ Now()
+# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
+ALL_SOURCES = \
+ #$ ExpandList("MGL_SOURCES");
+
+ALL_HEADERS = \
+ #$ ExpandList("MGL_HEADERS");
+
+COMMONOBJS = \
+ #$ ExpandList("COMMONOBJS");
+
+COMMONDEPS = \
+ #$ ExpandList("COMMONDEPS");
+
+GENERICOBJS = \
+ #$ ExpandList("GENERICOBJS");
+
+GENERICDEPS = \
+ #$ ExpandList("GENERICDEPS");
+
+GUIOBJS = \
+ #$ ExpandList("GUIOBJS");
+
+GUIDEPS = \
+ #$ ExpandList("GUIDEPS");
+
+GUI_LOWLEVEL_OBJS = \
+ #$ ExpandList("GUI_LOWLEVEL_OBJS");
+
+GUI_LOWLEVEL_DEPS = \
+ #$ ExpandList("GUI_LOWLEVEL_DEPS");
+
+UNIXOBJS = \
+ #$ ExpandList("UNIXOBJS");
+
+UNIXDEPS = \
+ #$ ExpandList("UNIXDEPS");
+
+HTMLOBJS = \
+ #$ ExpandList("HTMLOBJS");
+
+HTMLDEPS = \
+ #$ ExpandList("HTMLDEPS");
+
--- /dev/null
+#!################################################################################
+#! File: univ.t
+#! Purpose: tmake template file from which src/univ/files.lst containing the
+#! list of files for wxUniversal library is generated by tmake
+#! Author: Vadim Zeitlin
+#! Created: 26.06.01
+#! Version: $Id$
+#!################################################################################
+#${
+ #! include the code which parses filelist.txt file and initializes
+ #! %wxCommon, %wxGeneric, %wxHtml, %wxUNIX, %wxGTK, %wxMOTIF and
+ #! %wxOS2PM hashes.
+ IncludeTemplate("filelist.t");
+
+ #! find all our sources
+ foreach $file (sort keys %wxUNIV) {
+ ($fileobj = $file) =~ s/cp?p?$/\o/;
+ ($filedep = $file) =~ s/cp?p?$/\d/;
+
+ $project{"UNIV_SOURCES"} .= "univ/" . $file . " ";
+ $project{"UNIVOBJS"} .= $fileobj . " ";
+ $project{"UNIVDEPS"} .= $filedep . " ";
+ }
+
+#$}
+# This file was automatically generated by tmake at #$ Now()
+# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
+UNIVOBJS = \
+ #$ ExpandList("UNIVOBJS");
+
+UNIVDEPS = \
+ #$ ExpandList("UNIVDEPS");
+
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/accel.h
+// Purpose: wxAcceleratorEntry and wxAcceleratorTable classes
+// Author: Julian Smart, Robert Roebling, Vadim Zeitlin
+// Modified by:
+// Created: 31.05.01 (extracted from other files)
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_ACCEL_H_BASE_
#define _WX_ACCEL_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/accel.h"
+#include "wx/defs.h"
+
+#if wxUSE_ACCEL
+
+#include "wx/object.h"
+
+class WXDLLEXPORT wxAcceleratorTable;
+class WXDLLEXPORT wxMenuItem;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// wxAcceleratorEntry flags
+enum
+{
+ wxACCEL_NORMAL = 0x0000, // no modifiers
+ wxACCEL_ALT = 0x0001, // hold Alt key down
+ wxACCEL_CTRL = 0x0002, // hold Ctrl key down
+ wxACCEL_SHIFT = 0x0004 // hold Shift key down
+};
+
+// ----------------------------------------------------------------------------
+// an entry in wxAcceleratorTable corresponds to one accelerator
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxAcceleratorEntry
+{
+public:
+ wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0,
+ wxMenuItem *item = NULL)
+ {
+ Set(flags, keyCode, cmd, item);
+ }
+
+ void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL)
+ {
+ m_flags = flags;
+ m_keyCode = keyCode;
+ m_command = cmd;
+ m_item = item;
+ }
+
+ void SetMenuItem(wxMenuItem *item) { m_item = item; }
+
+ int GetFlags() const { return m_flags; }
+ int GetKeyCode() const { return m_keyCode; }
+ int GetCommand() const { return m_command; }
+
+ wxMenuItem *GetMenuItem() const { return m_item; }
+
+ bool operator==(const wxAcceleratorEntry& entry) const
+ {
+ return m_flags == entry.m_flags &&
+ m_keyCode == entry.m_keyCode &&
+ m_command == entry.m_command &&
+ m_item == entry.m_item;
+ }
+
+ bool operator!=(const wxAcceleratorEntry& entry) const
+ { return !(*this == entry); }
+
+private:
+ int m_flags; // combination of wxACCEL_XXX constants
+ int m_keyCode; // ASCII or virtual keycode
+ int m_command; // Command id to generate
+
+ // the menu item this entry corresponds to, may be NULL
+ wxMenuItem *m_item;
+
+ // for compatibility with old code, use accessors now!
+ friend class WXDLLEXPORT wxMenu;
+};
+
+// ----------------------------------------------------------------------------
+// include wxAcceleratorTable class declaration, it is only used by the library
+// and so doesn't have any published user visible interface
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/generic/accel.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/accel.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/accel.h"
+ #include "wx/motif/accel.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/accel.h"
+ #include "wx/gtk/accel.h"
#elif defined(__WXQT__)
-#include "wx/qt/accel.h"
+ #include "wx/qt/accel.h"
#elif defined(__WXMAC__)
-#include "wx/mac/accel.h"
+ #include "wx/mac/accel.h"
#elif defined(__WXPM__)
-#include "wx/os2/accel.h"
+ #include "wx/os2/accel.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/accel.h"
+ #include "wx/stubs/accel.h"
#endif
+WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
+
+#endif // wxUSE_ACCEL
+
#endif
// _WX_ACCEL_H_BASE_
class WXDLLEXPORT wxAppBase : public wxEvtHandler
{
public:
+ wxAppBase();
+
// the virtual functions which may/must be overridden in the derived class
// -----------------------------------------------------------------------
#ifdef __WXMAC_X__
// depend on the toolkit. default version does nothing.
//
// Override: rarely.
- virtual bool OnInitGui() { return TRUE; }
+ virtual bool OnInitGui();
#endif // wxUSE_GUI
// called to start program execution - the default version just enters
// top level window functions
// --------------------------
+ // return TRUE if our app has focus
+ virtual bool IsActive() const { return m_isActive; }
+
// set the "main" top level window
void SetTopWindow(wxWindow *win) { m_topWindow = win; }
// object) - this log object is used by default by all wxLogXXX()
// functions.
virtual wxLog *CreateLogTarget()
-#if wxUSE_GUI
- { return new wxLogGui; }
-#else // !GUI
- { return new wxLogStderr; }
-#endif // wxUSE_GUI
+ #if wxUSE_GUI && wxUSE_LOGGUI
+ { return new wxLogGui; }
+ #else // !GUI
+ { return new wxLogStderr; }
+ #endif // wxUSE_GUI
#endif // wxUSE_LOG
#if wxUSE_GUI
// printing.
virtual void SetPrintMode(int WXUNUSED(mode)) { }
int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
+
+ // called by toolkit-specific code to set the app status: active (we have
+ // focus) or not and also the last window which had focus before we were
+ // deactivated
+ virtual void SetActive(bool isActive, wxWindow *lastFocus);
#endif // wxUSE_GUI
// implementation only from now on
int argc;
wxChar **argv;
-//private:
protected:
// function used for dynamic wxApp creation
static wxAppInitializerFunction m_appInitFn;
m_appName, // app name
m_className; // class name
- // if TRUE, exit the main loop when the last top level window is deleted
- bool m_exitOnFrameDelete;
-
// TRUE if the application wants to get debug output
bool m_wantDebugOutput;
+#if wxUSE_GUI
+ // the main top level window - may be NULL
+ wxWindow *m_topWindow;
+
+ // if TRUE, exit the main loop when the last top level window is deleted
+ bool m_exitOnFrameDelete;
+
// TRUE if the apps whats to use the best visual on systems where
// more than one are available (Sun, SGI, XFree86 4.0 ?)
bool m_useBestVisual;
-#if wxUSE_GUI
- // the main top level window - may be NULL
- wxWindow *m_topWindow;
+ // does any of our windows has focus?
+ bool m_isActive;
#endif // wxUSE_GUI
};
#include "wx/msw/app.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/app.h"
+ #elif defined(__WXMGL__)
+ #include "wx/mgl/app.h"
#elif defined(__WXQT__)
#include "wx/qt/app.h"
#elif defined(__WXGTK__)
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/bitmap.h
+// Purpose: wxBitmap class interface
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 22.04.01
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_BITMAP_H_BASE_
#define _WX_BITMAP_H_BASE_
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma interface "bitmapbase.h"
+#endif
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/palette.h"
+#include "wx/gdiobj.h"
+
+class WXDLLEXPORT wxImage;
+class WXDLLEXPORT wxMask;
+class WXDLLEXPORT wxBitmap;
+class WXDLLEXPORT wxBitmapHandler;
+
+// ----------------------------------------------------------------------------
+// wxBitmapHandler: class which knows how to create/load/save bitmaps in
+// different formats
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxBitmapHandlerBase : public wxObject
+{
+public:
+ wxBitmapHandlerBase()
+ {
+ m_type = wxBITMAP_TYPE_INVALID;
+ }
+
+ virtual ~wxBitmapHandlerBase() { }
+
+ virtual bool Create(wxBitmap *bitmap, void *data, long flags,
+ int width, int height, int depth = 1) = 0;
+ virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
+ int desiredWidth, int desiredHeight) = 0;
+ virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
+ int type, const wxPalette *palette = NULL) = 0;
+
+ void SetName(const wxString& name) { m_name = name; }
+ void SetExtension(const wxString& ext) { m_extension = ext; }
+ void SetType(wxBitmapType type) { m_type = type; }
+ wxString GetName() const { return m_name; }
+ wxString GetExtension() const { return m_extension; }
+ wxBitmapType GetType() const { return m_type; }
+
+protected:
+ wxString m_name;
+ wxString m_extension;
+ wxBitmapType m_type;
+
+ DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase)
+};
+
+
+
+class WXDLLEXPORT wxBitmapBase : public wxGDIObject
+{
+public:
+ wxBitmapBase() : wxGDIObject() {}
+ virtual ~wxBitmapBase() {}
+
+ /*
+ Derived class must implement these:
+
+ wxBitmap();
+ wxBitmap(int width, int height, int depth = -1);
+ wxBitmap(const char bits[], int width, int height, int depth = 1);
+ wxBitmap(const char **bits);
+ wxBitmap(char **bits);
+ wxBitmap(const wxBitmap& bmp);
+ wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
+ wxBitmap(const wxImage& image, int depth = -1);
+ wxBitmap& operator = (const wxBitmap& bmp);
+ bool operator == (const wxBitmap& bmp) const;
+ bool operator != (const wxBitmap& bmp) const;
+
+ bool Create(int width, int height, int depth = -1);
+
+ static void InitStandardHandlers();
+ */
+
+ virtual bool Ok() const = 0;
+
+ virtual int GetHeight() const = 0;
+ virtual int GetWidth() const = 0;
+ virtual int GetDepth() const = 0;
+
+ virtual wxImage ConvertToImage() const = 0;
+
+ virtual wxMask *GetMask() const = 0;
+ virtual void SetMask(wxMask *mask) = 0;
+
+ virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0;
+
+ virtual bool SaveFile(const wxString &name, wxBitmapType type,
+ const wxPalette *palette = (wxPalette *)NULL) const = 0;
+ virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0;
+
+ virtual wxPalette *GetPalette() const = 0;
+ virtual void SetPalette(const wxPalette& palette) = 0;
+
+#if WXWIN_COMPATIBILITY
+ wxPalette *GetColourMap() const { return GetPalette(); }
+ void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
+#endif // WXWIN_COMPATIBILITY
+
+ // copies the contents and mask of the given (colour) icon to the bitmap
+ virtual bool CopyFromIcon(const wxIcon& icon) = 0;
+
+ // implementation:
+ virtual void SetHeight(int height) = 0;
+ virtual void SetWidth(int width) = 0;
+ virtual void SetDepth(int depth) = 0;
+
+ // Format handling
+ static inline wxList& GetHandlers() { return sm_handlers; }
+ static void AddHandler(wxBitmapHandlerBase *handler);
+ static void InsertHandler(wxBitmapHandlerBase *handler);
+ static bool RemoveHandler(const wxString& name);
+ static wxBitmapHandler *FindHandler(const wxString& name);
+ static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType);
+ static wxBitmapHandler *FindHandler(wxBitmapType bitmapType);
+
+ //static void InitStandardHandlers();
+ // (wxBitmap must implement this one)
+
+ static void CleanUpHandlers();
+
+protected:
+ static wxList sm_handlers;
+
+ DECLARE_ABSTRACT_CLASS(wxBitmapBase)
+};
+
+
+
#if defined(__WXMSW__)
#include "wx/msw/bitmap.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/bitmap.h"
#elif defined(__WXGTK__)
#include "wx/gtk/bitmap.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/bitmap.h"
#elif defined(__WXQT__)
#include "wx/qt/bitmap.h"
#elif defined(__WXMAC__)
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/bmpbutton.h
+// Purpose: wxBitmapButton class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_BMPBUTTON_H_BASE_
#define _WX_BMPBUTTON_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/bmpbuttn.h"
+#if wxUSE_BMPBUTTON
+
+#include "wx/bitmap.h"
+#include "wx/button.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
+
+// ----------------------------------------------------------------------------
+// wxBitmapButton: a button which shows bitmaps instead of the usual string.
+// It has different bitmaps for different states (focused/disabled/pressed)
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxBitmapButtonBase : public wxButton
+{
+public:
+ wxBitmapButtonBase() { m_marginX = m_marginY = 0; }
+
+ // set the bitmaps
+ void SetBitmapLabel(const wxBitmap& bitmap)
+ { m_bmpNormal = bitmap; OnSetBitmap(); }
+ void SetBitmapSelected(const wxBitmap& sel)
+ { m_bmpSelected = sel; OnSetBitmap(); };
+ void SetBitmapFocus(const wxBitmap& focus)
+ { m_bmpFocus = focus; OnSetBitmap(); };
+ void SetBitmapDisabled(const wxBitmap& disabled)
+ { m_bmpDisabled = disabled; OnSetBitmap(); };
+ void SetLabel(const wxBitmap& bitmap)
+ { SetBitmapLabel(bitmap); }
+
+ // retrieve the bitmaps
+ const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; }
+ const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; }
+ const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; }
+ const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
+ wxBitmap& GetBitmapLabel() { return m_bmpNormal; }
+ wxBitmap& GetBitmapSelected() { return m_bmpSelected; }
+ wxBitmap& GetBitmapFocus() { return m_bmpFocus; }
+ wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; }
+
+ // set/get the margins around the button
+ virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
+ int GetMarginX() const { return m_marginX; }
+ int GetMarginY() const { return m_marginY; }
+
+protected:
+ // function called when any of the bitmaps changes
+ virtual void OnSetBitmap() { }
+
+ // the bitmaps for various states
+ wxBitmap m_bmpNormal,
+ m_bmpSelected,
+ m_bmpFocus,
+ m_bmpDisabled;
+
+ // the margins around the bitmap
+ int m_marginX,
+ m_marginY;
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/bmpbuttn.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/bmpbuttn.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/bmpbuttn.h"
+ #include "wx/motif/bmpbuttn.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/bmpbuttn.h"
+ #include "wx/gtk/bmpbuttn.h"
#elif defined(__WXQT__)
-#include "wx/qt/bmpbuttn.h"
+ #include "wx/qt/bmpbuttn.h"
#elif defined(__WXMAC__)
-#include "wx/mac/bmpbuttn.h"
+ #include "wx/mac/bmpbuttn.h"
#elif defined(__WXPM__)
-#include "wx/os2/bmpbuttn.h"
+ #include "wx/os2/bmpbuttn.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/bmpbuttn.h"
+ #include "wx/stubs/bmpbuttn.h"
#endif
-#endif
+#endif // wxUSE_BMPBUTTON
+
+#endif // _WX_BMPBUTTON_H_BASE_
#include "wx/motif/brush.h"
#elif defined(__WXGTK__)
#include "wx/gtk/brush.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/brush.h"
#elif defined(__WXQT__)
#include "wx/qt/brush.h"
#elif defined(__WXMAC__)
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/button.h
+// Purpose: wxButtonBase class
+// Author: Vadim Zetlin
+// Modified by:
+// Created: 15.08.00
+// RCS-ID: $Id$
+// Copyright: (c) Vadim Zetlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_BUTTON_H_BASE_
#define _WX_BUTTON_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/button.h"
+#if wxUSE_BUTTON
+
+#include "wx/control.h"
+
+class WXDLLEXPORT wxBitmap;
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
+
+// ----------------------------------------------------------------------------
+// wxButton: a push button
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxButtonBase : public wxControl
+{
+public:
+ // show the image in the button in addition to the label
+ virtual void SetImageLabel(const wxBitmap& bitmap) { }
+
+ // set the margins around the image
+ virtual void SetImageMargins(wxCoord x, wxCoord y) { }
+
+ // this wxButton method is called when the button becomes the default one
+ // on its panel
+ virtual void SetDefault() { }
+
+ // returns the default button size for this platform
+ static wxSize GetDefaultSize();
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/button.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/button.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/button.h"
+ #include "wx/motif/button.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/button.h"
+ #include "wx/gtk/button.h"
#elif defined(__WXQT__)
-#include "wx/qt/button.h"
+ #include "wx/qt/button.h"
#elif defined(__WXMAC__)
-#include "wx/mac/button.h"
+ #include "wx/mac/button.h"
#elif defined(__WXPM__)
-#include "wx/os2/button.h"
+ #include "wx/os2/button.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/button.h"
+ #include "wx/stubs/button.h"
#endif
+#endif // wxUSE_BUTTON
+
#endif
// _WX_BUTTON_H_BASE_
2. background bitmap for the calendar?
*/
-#ifndef _WX_CALCTRL_H
-#define _WX_CALCTRL_H
+#ifndef _WX_CALCTRL_H_
+#define _WX_CALCTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_CALENDARCTRL
#include "wx/datetime.h"
#define EVT_CALENDAR_YEAR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_CALENDAR_YEAR_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxCalendarEventFunction) & fn, (wxObject *) NULL),
#define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_CALENDAR_WEEKDAY_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxCalendarEventFunction) & fn, (wxObject *) NULL),
-#endif // _WX_CALCTRL_H
+#endif // wxUSE_CALENDARCTRL
+
+#endif // _WX_CALCTRL_H_
+
#ifndef _WX_CARET_H_BASE_
#define _WX_CARET_H_BASE_
+#include "wx/defs.h"
+
+#if wxUSE_CARET
+
#ifdef __GNUG__
#pragma interface "caret.h"
#endif
wxCaret *m_caret;
};
+#endif // wxUSE_CARET
+
#endif // _WX_CARET_H_BASE_
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/checkbox.h
+// Purpose: wxCheckBox class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07.09.00
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_CHECKBOX_H_BASE_
#define _WX_CHECKBOX_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/checkbox.h"
+#if wxUSE_CHECKBOX
+
+#include "wx/control.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxCheckBoxNameStr;
+
+// ----------------------------------------------------------------------------
+// wxCheckBox: a control which shows a label and a box which may be checked
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxCheckBoxBase : public wxControl
+{
+public:
+ // set/get the checked status of the listbox
+ virtual void SetValue(bool value) = 0;
+ virtual bool GetValue() const = 0;
+
+ bool IsChecked() const { return GetValue(); }
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/checkbox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/checkbox.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/checkbox.h"
+ #include "wx/motif/checkbox.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/checkbox.h"
+ #include "wx/gtk/checkbox.h"
#elif defined(__WXQT__)
-#include "wx/qt/checkbox.h"
+ #include "wx/qt/checkbox.h"
#elif defined(__WXMAC__)
-#include "wx/mac/checkbox.h"
+ #include "wx/mac/checkbox.h"
#elif defined(__WXPM__)
-#include "wx/os2/checkbox.h"
+ #include "wx/os2/checkbox.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/checkbox.h"
+ #include "wx/stubs/checkbox.h"
#endif
+#endif // wxUSE_CHECKBOX
+
#endif
// _WX_CHECKBOX_H_BASE_
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/checklst.h
+// Purpose: wxCheckListBox class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.09.00
+// RCS-ID: $Id$
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_CHECKLST_H_BASE_
#define _WX_CHECKLST_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/checklst.h"
+#if wxUSE_CHECKLISTBOX
+
+#include "wx/listbox.h"
+
+// ----------------------------------------------------------------------------
+// wxCheckListBox: a listbox whose items may be checked
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxCheckListBoxBase : public wxListBox
+{
+public:
+ // check list box specific methods
+ virtual bool IsChecked(size_t item) const = 0;
+ virtual void Check(size_t item, bool check = TRUE) = 0;
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/checklst.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/checklst.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/checklst.h"
+ #include "wx/motif/checklst.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/checklst.h"
+ #include "wx/gtk/checklst.h"
#elif defined(__WXQT__)
-#include "wx/qt/checklst.h"
+ #include "wx/qt/checklst.h"
#elif defined(__WXMAC__)
-#include "wx/mac/checklst.h"
+ #include "wx/mac/checklst.h"
#elif defined(__WXPM__)
-#include "wx/os2/checklst.h"
+ #include "wx/os2/checklst.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/checklst.h"
+ #include "wx/stubs/checklst.h"
#endif
+#endif // wxUSE_CHECKLISTBOX
+
#endif
// _WX_CHECKLST_H_BASE_
--- /dev/null
+/*
+ * Name: wx/chkconf.h
+ * Purpose: check the config settings for consistency
+ * Author: Vadim Zeitlin
+ * Modified by:
+ * Created: 09.08.00
+ * RCS-ID: $Id$
+ * Copyright: (c) 2000 Vadim Zeitlin <vadim@wxwindows.org>
+ * Licence: wxWindows license
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+/*
+ this global setting determintes what should we do if the setting FOO
+ requires BAR and BAR is not set: we can either silently define BAR
+ (default, recommended) or give an error and abort (mainly useful for
+ developpers only)
+ */
+#define wxABORT_ON_CONFIG_ERROR
+
+/*
+ all these tests are for GUI onlu
+ */
+#if wxUSE_GUI
+
+/*
+ all of the settings tested below must be defined or we'd get an error from
+ preprocessor about invalid integer expression
+ */
+
+#ifndef wxUSE_ACCEL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ACCEL must be defined."
+# else
+# define wxUSE_ACCEL 0
+# endif
+#endif /* !defined(wxUSE_ACCEL) */
+
+#ifndef wxUSE_BMPBUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_BMPBUTTON must be defined."
+# else
+# define wxUSE_BMPBUTTON 0
+# endif
+#endif /* !defined(wxUSE_BMPBUTTON) */
+
+#ifndef wxUSE_BUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_BUTTON must be defined."
+# else
+# define wxUSE_BUTTON 0
+# endif
+#endif /* !defined(wxUSE_BUTTON) */
+
+#ifndef wxUSE_CALENDARCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CALENDARCTRL must be defined."
+# else
+# define wxUSE_CALENDARCTRL 0
+# endif
+#endif /* !defined(wxUSE_CALENDARCTRL) */
+
+#ifndef wxUSE_CARET
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CARET must be defined."
+# else
+# define wxUSE_CARET 0
+# endif
+#endif /* !defined(wxUSE_CARET) */
+
+#ifndef wxUSE_CHECKBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHECKBOX must be defined."
+# else
+# define wxUSE_CHECKBOX 0
+# endif
+#endif /* !defined(wxUSE_CHECKBOX) */
+
+#ifndef wxUSE_CHECKLISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHECKLISTBOX must be defined."
+# else
+# define wxUSE_CHECKLISTBOX 0
+# endif
+#endif /* !defined(wxUSE_CHECKLISTBOX) */
+
+#ifndef wxUSE_CHOICE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHOICE must be defined."
+# else
+# define wxUSE_CHOICE 0
+# endif
+#endif /* !defined(wxUSE_CHOICE) */
+
+#ifndef wxUSE_CLIPBOARD
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CLIPBOARD must be defined."
+# else
+# define wxUSE_CLIPBOARD 0
+# endif
+#endif /* !defined(wxUSE_CLIPBOARD) */
+
+#ifndef wxUSE_COMBOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COMBOBOX must be defined."
+# else
+# define wxUSE_COMBOBOX 0
+# endif
+#endif /* !defined(wxUSE_COMBOBOX) */
+
+#ifndef wxUSE_DATAOBJ
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DATAOBJ must be defined."
+# else
+# define wxUSE_DATAOBJ 0
+# endif
+#endif /* !defined(wxUSE_DATAOBJ) */
+
+#ifndef wxUSE_FILEDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILEDLG must be defined."
+# else
+# define wxUSE_FILEDLG 0
+# endif
+#endif /* !defined(wxUSE_FILEDLG) */
+
+#ifndef wxUSE_FONTDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FONTDLG must be defined."
+# else
+# define wxUSE_FONTDLG 0
+# endif
+#endif /* !defined(wxUSE_FONTDLG) */
+
+#ifndef wxUSE_FONTMAP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FONTMAP must be defined."
+# else
+# define wxUSE_FONTMAP 0
+# endif
+#endif /* !defined(wxUSE_FONTMAP) */
+
+#ifndef wxUSE_GAUGE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_GAUGE must be defined."
+# else
+# define wxUSE_GAUGE 0
+# endif
+#endif /* !defined(wxUSE_GAUGE) */
+
+#ifndef wxUSE_GRID
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_GRID must be defined."
+# else
+# define wxUSE_GRID 0
+# endif
+#endif /* !defined(wxUSE_GRID) */
+
+#ifndef wxUSE_IMAGLIST
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_IMAGLIST must be defined."
+# else
+# define wxUSE_IMAGLIST 0
+# endif
+#endif /* !defined(wxUSE_IMAGLIST) */
+
+#ifndef wxUSE_LISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LISTBOX must be defined."
+# else
+# define wxUSE_LISTBOX 0
+# endif
+#endif /* !defined(wxUSE_LISTBOX) */
+
+#ifndef wxUSE_LISTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LISTCTRL must be defined."
+# else
+# define wxUSE_LISTCTRL 0
+# endif
+#endif /* !defined(wxUSE_LISTCTRL) */
+
+#ifndef wxUSE_MDI_ARCHITECTURE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MDI_ARCHITECTURE must be defined."
+# else
+# define wxUSE_MDI_ARCHITECTURE 0
+# endif
+#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */
+
+#ifndef wxUSE_MENUS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MENUS must be defined."
+# else
+# define wxUSE_MENUS 0
+# endif
+#endif /* !defined(wxUSE_MENUS) */
+
+#ifndef wxUSE_MIMETYPE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MIMETYPE must be defined."
+# else
+# define wxUSE_MIMETYPE 0
+# endif
+#endif /* !defined(wxUSE_MIMETYPE) */
+
+#ifndef wxUSE_NEW_GRID
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_NEW_GRID must be defined."
+# else
+# define wxUSE_NEW_GRID 0
+# endif
+#endif /* !defined(wxUSE_NEW_GRID) */
+
+#ifndef wxUSE_NOTEBOOK
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_NOTEBOOK must be defined."
+# else
+# define wxUSE_NOTEBOOK 0
+# endif
+#endif /* !defined(wxUSE_NOTEBOOK) */
+
+#ifndef wxUSE_POPUPWIN
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_POPUPWIN must be defined."
+# else
+# define wxUSE_POPUPWIN 0
+# endif
+#endif /* !defined(wxUSE_POPUPWIN) */
+
+#ifndef wxUSE_RADIOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBOX must be defined."
+# else
+# define wxUSE_RADIOBOX 0
+# endif
+#endif /* !defined(wxUSE_RADIOBOX) */
+
+#ifndef wxUSE_RADIOBTN
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBTN must be defined."
+# else
+# define wxUSE_RADIOBTN 0
+# endif
+#endif /* !defined(wxUSE_RADIOBTN) */
+
+#ifndef wxUSE_SASH
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SASH must be defined."
+# else
+# define wxUSE_SASH 0
+# endif
+#endif /* !defined(wxUSE_SASH) */
+
+#ifndef wxUSE_SCROLLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SCROLLBAR must be defined."
+# else
+# define wxUSE_SCROLLBAR 0
+# endif
+#endif /* !defined(wxUSE_SCROLLBAR) */
+
+#ifndef wxUSE_SLIDER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SLIDER must be defined."
+# else
+# define wxUSE_SLIDER 0
+# endif
+#endif /* !defined(wxUSE_SLIDER) */
+
+#ifndef wxUSE_SPINBTN
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SPINBTN must be defined."
+# else
+# define wxUSE_SPINBTN 0
+# endif
+#endif /* !defined(wxUSE_SPINBTN) */
+
+#ifndef wxUSE_SPINCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SPINCTRL must be defined."
+# else
+# define wxUSE_SPINCTRL 0
+# endif
+#endif /* !defined(wxUSE_SPINCTRL) */
+
+#ifndef wxUSE_SPLITTER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SPLITTER must be defined."
+# else
+# define wxUSE_SPLITTER 0
+# endif
+#endif /* !defined(wxUSE_SPLITTER) */
+
+#ifndef wxUSE_STATBMP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATBMP must be defined."
+# else
+# define wxUSE_STATBMP 0
+# endif
+#endif /* !defined(wxUSE_STATBMP) */
+
+#ifndef wxUSE_STATBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATBOX must be defined."
+# else
+# define wxUSE_STATBOX 0
+# endif
+#endif /* !defined(wxUSE_STATBOX) */
+
+#ifndef wxUSE_STATLINE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATLINE must be defined."
+# else
+# define wxUSE_STATLINE 0
+# endif
+#endif /* !defined(wxUSE_STATLINE) */
+
+#ifndef wxUSE_STATUSBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATUSBAR must be defined."
+# else
+# define wxUSE_STATUSBAR 0
+# endif
+#endif /* !defined(wxUSE_STATUSBAR) */
+
+#ifndef wxUSE_STOPWATCH
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STOPWATCH must be defined."
+# else
+# define wxUSE_STOPWATCH 0
+# endif
+#endif /* !defined(wxUSE_STOPWATCH) */
+
+#ifndef wxUSE_TAB_DIALOG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TAB_DIALOG must be defined."
+# else
+# define wxUSE_TAB_DIALOG 0
+# endif
+#endif /* !defined(wxUSE_TAB_DIALOG) */
+
+#ifndef wxUSE_TEXTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TEXTCTRL must be defined."
+# else
+# define wxUSE_TEXTCTRL 0
+# endif
+#endif /* !defined(wxUSE_TEXTCTRL) */
+
+#ifndef wxUSE_TOOLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TOOLBAR must be defined."
+# else
+# define wxUSE_TOOLBAR 0
+# endif
+#endif /* !defined(wxUSE_TOOLBAR) */
+
+#ifndef wxUSE_TOOLTIPS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TOOLTIPS must be defined."
+# else
+# define wxUSE_TOOLTIPS 0
+# endif
+#endif /* !defined(wxUSE_TOOLTIPS) */
+
+#ifndef wxUSE_TREECTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TREECTRL must be defined."
+# else
+# define wxUSE_TREECTRL 0
+# endif
+#endif /* !defined(wxUSE_TREECTRL) */
+
+/*
+ check consistency of the settings
+ */
+#if wxUSE_BUTTON || \
+ wxUSE_CALENDARCTRL || \
+ wxUSE_CARET || \
+ wxUSE_COMBOBOX || \
+ wxUSE_BMPBUTTON || \
+ wxUSE_CHECKBOX || \
+ wxUSE_CHECKLISTBOX || \
+ wxUSE_CHOICE || \
+ wxUSE_GAUGE || \
+ wxUSE_GRID || \
+ wxUSE_NEW_GRID || \
+ wxUSE_LISTBOX || \
+ wxUSE_LISTCTRL || \
+ wxUSE_NOTEBOOK || \
+ wxUSE_RADIOBOX || \
+ wxUSE_RADIOBTN || \
+ wxUSE_SCROLLBAR || \
+ wxUSE_SLIDER || \
+ wxUSE_SPINBTN || \
+ wxUSE_SPINCTRL || \
+ wxUSE_STATBMP || \
+ wxUSE_STATBOX || \
+ wxUSE_STATLINE || \
+ wxUSE_STATUSBAR || \
+ wxUSE_TEXTCTRL || \
+ wxUSE_TOOLBAR || \
+ wxUSE_TREECTRL
+# if !wxUSE_CONTROLS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CONTROLS unset but some controls used"
+# else
+# undef wxUSE_CONTROLS
+# define wxUSE_CONTROLS 1
+# endif
+# endif
+#endif /* controls */
+
+#if wxUSE_CALENDARCTRL
+# if !(wxUSE_SPINBTN && wxUSE_COMBOBOX)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxCalendarCtrl requires wxSpinButton and wxComboBox"
+# else
+# undef wxUSE_SPINBTN
+# undef wxUSE_COMBOBOX
+# define wxUSE_SPINBTN 1
+# define wxUSE_COMBOBOX 1
+# endif
+# endif
+#endif /* wxUSE_CALENDARCTRL */
+
+#if wxUSE_CHECKLISTBOX
+# if !wxUSE_LISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxCheckListBox requires wxListBox"
+# else
+# undef wxUSE_LISTBOX
+# define wxUSE_LISTBOX 1
+# endif
+# endif
+#endif /* wxUSE_RADIOBTN */
+
+#if wxUSE_COMBOBOX
+# if defined(__WXUNIVERSAL__) && !wxUSE_LISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxComboBox requires wxListBox in wxUniversal"
+# else
+# undef wxUSE_LISTBOX
+# define wxUSE_LISTBOX 1
+# endif
+# endif
+#endif /* wxUSE_COMBOBOX */
+
+#if !wxUSE_FILEDLG
+# if defined(wxUSE_DOC_VIEW_ARCHITECTURE) || defined(wxUSE_HTML)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxFileDialog must be compiled as well"
+# else
+# undef wxUSE_FILEDLG
+# define wxUSE_FILEDLG 1
+# endif
+# endif
+#endif /* !wxUSE_FILEDLG */
+
+#if !wxUSE_FONTDLG
+# if defined(wxUSE_FONTMAP)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxFontDialog must be compiled as well"
+# else
+# undef wxUSE_FONTDLG
+# define wxUSE_FONTDLG 1
+# endif
+# endif
+#endif /* !wxUSE_FONTDLG */
+
+#if !wxUSE_IMAGLIST
+# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxImageList must be compiled as well"
+# else
+# undef wxUSE_IMAGLIST
+# define wxUSE_IMAGLIST 1
+# endif
+# endif
+#endif /* !wxUSE_IMAGLIST */
+
+#if wxUSE_RADIOBTN
+# if defined(__WXUNIVERSAL__) && !wxUSE_CHECKBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBTN requires wxUSE_CHECKBOX in wxUniversal"
+# else
+# undef wxUSE_CHECKBOX
+# define wxUSE_CHECKBOX 1
+# endif
+# endif
+#endif /* wxUSE_RADIOBTN */
+
+#if wxUSE_RADIOBOX
+# if !wxUSE_RADIOBTN || !wxUSE_STATBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBOX requires wxUSE_RADIOBTN and wxUSE_STATBOX"
+# else
+# undef wxUSE_RADIOBTN
+# undef wxUSE_STATBOX
+# define wxUSE_RADIOBTN 1
+# define wxUSE_STATBOX 1
+# endif
+# endif
+#endif /* wxUSE_RADIOBOX */
+
+#if wxUSE_STOPWATCH
+# if !wxUSE_LONGLONG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STOPWATCH requires wxUSE_LONGLONG"
+# else
+# undef wxUSE_LONGLONG
+# define wxUSE_LONGLONG 1
+# endif
+# endif
+#endif /* wxUSE_STOPWATCH */
+
+#if wxUSE_TEXTCTRL
+# ifdef __WXUNIVERSAL__
+# if !wxUSE_CARET
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxTextCtrl requires wxCaret in wxUniversal"
+# else
+# undef wxUSE_CARET
+# define wxUSE_CARET 1
+# endif
+# endif /* wxUSE_CARET */
+
+# if !wxUSE_SCROLLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxTextCtrl requires wxScrollBar in wxUniversal"
+# else
+# undef wxUSE_SCROLLBAR
+# define wxUSE_SCROLLBAR 1
+# endif
+# endif /* wxUSE_SCROLLBAR */
+# endif /* __WXUNIVERSAL__ */
+#endif /* wxUSE_RADIOBTN */
+
+/* I wonder if we shouldn't just remove all occurrences of
+ wxUSE_DYNAMIC_CLASSES from the sources? */
+#if !defined(wxUSE_DYNAMIC_CLASSES) || !wxUSE_DYNAMIC_CLASSES
+# if wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DYNAMIC_CLASSES must be defined as 1"
+# else
+# undef wxUSE_DYNAMIC_CLASSES
+# define wxUSE_DYNAMIC_CLASSES
+# endif
+#endif /* wxUSE_DYNAMIC_CLASSES */
+
+#if wxUSE_MIMETYPE && !wxUSE_TEXTFILE
+# if wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MIMETYPE requires wxUSE_TEXTFILE"
+# else
+# undef wxUSE_TEXTFILE
+# define wxUSE_TEXTFILE 1
+# endif
+#endif /* wxUSE_MIMETYPE */
+
+#if wxUSE_TEXTFILE && !wxUSE_FILE
+# if wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TEXTFILE requires wxUSE_FILE"
+# else
+# undef wxUSE_FILE
+# define wxUSE_FILE 1
+# endif
+#endif /* wxUSE_TEXTFILE */
+
+#if wxUSE_CLIPBOARD && !wxUSE_DATAOBJ
+# if wxABORT_ON_CONFIG_ERROR
+# error "wxClipboard requires wxDataObject"
+# else
+# undef wxUSE_DATAOBJ
+# define wxUSE_DATAOBJ 1
+# endif
+#endif /* wxUSE_CLIPBOARD */
+
+/* wxUniv-specific dependencies */
+#if defined(__WXUNIVERSAL__)
+# if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN
+# if wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_POPUPWIN must be defined to use comboboxes/menus"
+# else
+# undef wxUSE_POPUPWIN
+# define wxUSE_POPUPWIN 1
+# endif
+# endif
+#endif /* wxUSE_POPUPWIN */
+
+/* wxGTK-specific dependencies */
+#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
+# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS
+# if wxABORT_ON_CONFIG_ERROR
+# error "MDI requires wxUSE_MENUS in wxGTK"
+# else
+# undef wxUSE_MENUS
+# define wxUSE_MENUS 1
+# endif
+# endif
+#endif /* wxGTK && !wxUniv */
+
+#endif /* wxUSE_GUI */
+
#pragma interface "choicebase.h"
#endif
+#if wxUSE_CHOICE
+
#include "wx/ctrlsub.h" // the base class
// ----------------------------------------------------------------------------
#include "wx/stubs/choice.h"
#endif
+#endif // wxUSE_CHOICE
+
#endif
// _WX_CHOICE_H_BASE_
#include "wx/motif/clipbrd.h"
#elif defined(__WXGTK__)
#include "wx/gtk/clipbrd.h"
+#elif defined(__WXMGL__)
+ #include "wx/mgl/clipbrd.h"
#elif defined(__WXQT__)
#include "wx/gtk/clipbrd.h"
#elif defined(__WXMAC__)
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/cmdproc.h
+// Purpose: undo/redo capable command processing framework
+// Author: Julian Smart (extracted from docview.h by VZ)
+// Modified by:
+// Created: 05.11.00
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CMDPROC_H_
+#define _WX_CMDPROC_H_
+
+#ifdef __GNUG__
+ #pragma interface "cmdproc.h"
+#endif
+
+#include "wx/object.h"
+#include "wx/list.h"
+
+// ----------------------------------------------------------------------------
+// wxCommand: a single command capable of performing itself
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxCommand : public wxObject
+{
+public:
+ wxCommand(bool canUndoIt = FALSE, const wxString& name = "");
+ ~wxCommand();
+
+ // Override this to perform a command
+ virtual bool Do() = 0;
+
+ // Override this to undo a command
+ virtual bool Undo() = 0;
+
+ virtual bool CanUndo() const { return m_canUndo; }
+ virtual wxString GetName() const { return m_commandName; }
+
+protected:
+ bool m_canUndo;
+ wxString m_commandName;
+
+private:
+ DECLARE_CLASS(wxCommand)
+};
+
+// ----------------------------------------------------------------------------
+// wxCommandProcessor: wxCommand manager
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxCommandProcessor : public wxObject
+{
+public:
+ // if max number of commands is -1, it is unlimited
+ wxCommandProcessor(int maxCommands = -1);
+ virtual ~wxCommandProcessor();
+
+ // Pass a command to the processor. The processor calls Do(); if
+ // successful, is appended to the command history unless storeIt is FALSE.
+ virtual bool Submit(wxCommand *command, bool storeIt = TRUE);
+
+ // just store the command without executing it
+ virtual void Store(wxCommand *command);
+
+ virtual bool Undo();
+ virtual bool Redo();
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ virtual void Initialize();
+ virtual void SetMenuStrings();
+
+#if wxUSE_MENUS
+ // Call this to manage an edit menu.
+ void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
+ wxMenu *GetEditMenu() const { return m_commandEditMenu; }
+#endif // wxUSE_MENUS
+
+ // command list access
+ wxList& GetCommands() const { return (wxList&) m_commands; }
+ wxCommand *GetCurrentCommand() const
+ {
+ return (wxCommand *)(m_currentCommand ? m_currentCommand->Data() : NULL);
+ }
+ int GetMaxCommands() const { return m_maxNoCommands; }
+ virtual void ClearCommands();
+
+protected:
+ // for further flexibility, command processor doesn't call wxCommand::Do()
+ // and Undo() directly but uses these functions which can be overridden in
+ // the derived class
+ virtual bool DoCommand(wxCommand& cmd);
+ virtual bool UndoCommand(wxCommand& cmd);
+
+ int m_maxNoCommands;
+ wxList m_commands;
+ wxNode* m_currentCommand;
+
+#if wxUSE_MENUS
+ wxMenu* m_commandEditMenu;
+#endif // wxUSE_MENUS
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxCommandProcessor)
+};
+
+#endif // _WX_CMDPROC_H_
#include "wx/motif/colour.h"
#elif defined(__WXGTK__)
#include "wx/gtk/colour.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/colour.h"
#elif defined(__WXQT__)
#include "wx/qt/colour.h"
#elif defined(__WXMAC__)
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/combobox.h
+// Purpose: wxComboBox declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 24.12.00
+// RCS-ID: $Id$
+// Copyright: (c) 1996-2000 wxWindows team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_COMBOBOX_H_BASE_
#define _WX_COMBOBOX_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/combobox.h"
+#include "wx/defs.h"
+
+#if wxUSE_COMBOBOX
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
+
+// ----------------------------------------------------------------------------
+// wxComboBoxBase: this interface defines the methods wxComboBox must implement
+// ----------------------------------------------------------------------------
+
+#include "wx/ctrlsub.h"
+
+class WXDLLEXPORT wxComboBoxBase : public wxItemContainer
+{
+public:
+ // wxTextCtrl-like methods wxComboBox must implement
+ virtual wxString GetValue() const = 0;
+ virtual void SetValue(const wxString& value) = 0;
+
+ virtual void Copy() = 0;
+ virtual void Cut() = 0;
+ virtual void Paste() = 0;
+ virtual void SetInsertionPoint(long pos) = 0;
+ virtual long GetInsertionPoint() const = 0;
+ virtual long GetLastPosition() const = 0;
+ virtual void Replace(long from, long to, const wxString& value) = 0;
+ virtual void SetSelection(long from, long to) = 0;
+ virtual void SetEditable(bool editable) = 0;
+
+ virtual void SetInsertionPointEnd()
+ { SetInsertionPoint(GetLastPosition()); }
+ virtual void Remove(long from, long to)
+ { Replace(from, to, wxEmptyString); }
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-dependent header defining the real class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/combobox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/combobox.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/combobox.h"
+ #include "wx/motif/combobox.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/combobox.h"
+ #include "wx/gtk/combobox.h"
#elif defined(__WXQT__)
-#include "wx/qt/combobox.h"
+ #include "wx/qt/combobox.h"
#elif defined(__WXMAC__)
-#include "wx/mac/combobox.h"
+ #include "wx/mac/combobox.h"
#elif defined(__WXPM__)
-#include "wx/os2/combobox.h"
+ #include "wx/os2/combobox.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/combobox.h"
+ #include "wx/stubs/combobox.h"
#endif
+#endif // wxUSE_COMBOBOX
+
#endif
// _WX_COMBOBOX_H_BASE_
#pragma interface "controlbase.h"
#endif
+#if wxUSE_CONTROLS
+
#include "wx/window.h" // base class
+extern const wxChar* wxControlNameStr; // the default name
+
// ----------------------------------------------------------------------------
// wxControl is the base class for all controls
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxControlBase : public wxWindow
{
public:
-#ifdef __WXMAC_X__
- virtual ~wxControlBase() {} // Added min for Mac X
-#endif
+ // Create() function adds the validator parameter
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr);
+
// simulates the event of given type (i.e. wxButton::Command() is just as
// if the button was clicked)
virtual void Command(wxCommandEvent &event);
+ // get the control alignment (left/right/centre, top/bottom/centre)
+ int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
+
+#ifdef __WXMAC_X__
+ virtual ~wxControlBase() { } // Added min for Mac X
+#endif
+
protected:
// creates the control (calls wxWindowBase::CreateBase inside) and adds it
// to the list of parents children
// include platform-dependent wxControl declarations
// ----------------------------------------------------------------------------
-#if defined(__WXMSW__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/control.h"
+#elif defined(__WXMSW__)
#include "wx/msw/control.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/control.h"
#include "wx/stubs/control.h"
#endif
+#endif // wxUSE_CONTROLS
+
#endif
// _WX_CONTROL_H_BASE_
#pragma interface "controlwithitems.h"
#endif
+#if wxUSE_CONTROLS
+
#include "wx/control.h" // base class
// ----------------------------------------------------------------------------
-// wxControlWithItems defines an interface which is implemented by all controls
+// wxItemContainer defines an interface which is implemented by all controls
// which have string subitems each of which may be selected.
//
-// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox
+// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which
+// implements an extended interface deriving from this one)
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxControlWithItems : public wxControl
+class WXDLLEXPORT wxItemContainer
{
public:
- wxControlWithItems() { m_clientDataItemsType = ClientData_None; }
-#ifdef __WXMAC_X__
- virtual ~wxControlWithItems() {} // Added min for Mac X
-#endif
+ wxItemContainer() { m_clientDataItemsType = wxClientData_None; }
// adding items
// ------------
- void Append(const wxString& item)
- { DoAppend(item); }
- void Append(const wxString& item, void *clientData)
- { int n = DoAppend(item); SetClientData(n, clientData); }
- void Append(const wxString& item, wxClientData *clientData)
- { int n = DoAppend(item); SetClientObject(n, clientData); }
+ int Append(const wxString& item)
+ { return DoAppend(item); }
+ int Append(const wxString& item, void *clientData)
+ { int n = DoAppend(item); SetClientData(n, clientData); return n; }
+ int Append(const wxString& item, wxClientData *clientData)
+ { int n = DoAppend(item); SetClientObject(n, clientData); return n; }
// deleting items
// --------------
wxClientData* GetClientObject(int n) const;
bool HasClientObjectData() const
- { return m_clientDataItemsType == ClientData_Object; }
+ { return m_clientDataItemsType == wxClientData_Object; }
bool HasClientUntypedData() const
- { return m_clientDataItemsType == ClientData_Void; }
+ { return m_clientDataItemsType == wxClientData_Void; }
+#if WXWIN_COMPATIBILITY_2
// compatibility - these functions are deprecated, use the new ones
// instead
int Number() const { return GetCount(); }
+#endif // WXWIN_COMPATIBILITY_2
+
+#ifdef __WXMAC_X__
+ virtual ~wxItemContainer() {} // Added min for Mac X
+#endif
protected:
virtual int DoAppend(const wxString& item) = 0;
wxClientDataType m_clientDataItemsType;
};
-#endif // _WX_CTRLSUB_H_BASE_
+class WXDLLEXPORT wxControlWithItems : public wxControl, public wxItemContainer
+{
+public:
+ // we have to redefine these functions here to avoid ambiguities in classes
+ // deriving from us which would arise otherwise because both base classses
+ // have the methods with the same names - hopefully, a smart compiler can
+ // optimize away these simple inline wrappers so we don't suffer much from
+ // this
+
+ void SetClientData(void *data)
+ {
+ wxControl::SetClientData(data);
+ }
+
+ void *GetClientData() const
+ {
+ return wxControl::GetClientData();
+ }
+
+ void SetClientObject(wxClientData *data)
+ {
+ wxControl::SetClientObject(data);
+ }
+
+ wxClientData *GetClientObject() const
+ {
+ return wxControl::GetClientObject();
+ }
+
+ void SetClientData(int n, void* clientData)
+ {
+ wxItemContainer::SetClientData(n, clientData);
+ }
+
+ void* GetClientData(int n) const
+ {
+ return wxItemContainer::GetClientData(n);
+ }
+
+ void SetClientObject(int n, wxClientData* clientData)
+ {
+ wxItemContainer::SetClientObject(n, clientData);
+ }
+
+ wxClientData* GetClientObject(int n) const
+ {
+ return wxItemContainer::GetClientObject(n);
+ }
+};
+
+#endif // wxUSE_CONTROLS
+#endif // _WX_CTRLSUB_H_BASE_
#include "wx/motif/cursor.h"
#elif defined(__WXGTK__)
#include "wx/gtk/cursor.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/cursor.h"
#elif defined(__WXQT__)
#include "wx/qt/cursor.h"
#elif defined(__WXMAC__)
void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle)
{ DoDrawRotatedText(text, pt.x, pt.y, angle); }
+ // this version puts both optional bitmap and the text into the given
+ // rectangle and aligns is as specified by alignment parameter; it also
+ // will emphasize the character with the given index if it is != -1 and
+ // return the bounding rectangle if required
+ virtual void DrawLabel(const wxString& text,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounding = NULL);
+
+ void DrawLabel(const wxString& text, const wxRect& rect,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1)
+ { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
+
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = FALSE)
virtual wxCoord GetCharHeight() const = 0;
virtual wxCoord GetCharWidth() const = 0;
+ // only works for single line strings
void GetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = NULL,
wxFont *theFont = NULL) const
{ DoGetTextExtent(string, x, y, descent, externalLeading, theFont); }
+ // works for single as well as multi-line strings
+ virtual void GetMultiLineTextExtent(const wxString& text,
+ wxCoord *width,
+ wxCoord *height,
+ wxCoord *heightLine = NULL,
+ wxFont *font = NULL);
+
// size and resolution
// -------------------
#include "wx/motif/dc.h"
#elif defined(__WXGTK__)
#include "wx/gtk/dc.h"
+#elif defined(__WXMGL__)
+ #include "wx/mgl/dc.h"
#elif defined(__WXQT__)
#include "wx/qt/dc.h"
#elif defined(__WXMAC__)
#include "wx/stubs/dc.h"
#endif
+// ----------------------------------------------------------------------------
+// helper class: you can use it to temporarily change the DC text colour and
+// restore it automatically when the object goes out of scope
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxDCTextColourChanger
+{
+public:
+ wxDCTextColourChanger(wxDC& dc) : m_dc(dc) { }
+
+ ~wxDCTextColourChanger()
+ {
+ if ( m_colFgOld.Ok() )
+ m_dc.SetTextForeground(m_colFgOld);
+ }
+
+ void Set(const wxColour& col)
+ {
+ if ( !m_colFgOld.Ok() )
+ m_colFgOld = m_dc.GetTextForeground();
+ m_dc.SetTextForeground(col);
+ }
+
+private:
+ wxDC& m_dc;
+
+ wxColour m_colFgOld;
+};
+
#endif
// _WX_DC_H_BASE_
#include "wx/motif/dcclient.h"
#elif defined(__WXGTK__)
#include "wx/gtk/dcclient.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/dcclient.h"
#elif defined(__WXQT__)
#include "wx/qt/dcclient.h"
#elif defined(__WXMAC__)
#include "wx/motif/dcmemory.h"
#elif defined(__WXGTK__)
#include "wx/gtk/dcmemory.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/dcmemory.h"
#elif defined(__WXQT__)
#include "wx/qt/dcmemory.h"
#elif defined(__WXMAC__)
#include "wx/motif/dcscreen.h"
#elif defined(__WXGTK__)
#include "wx/gtk/dcscreen.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/dcscreen.h"
#elif defined(__WXQT__)
#include "wx/qt/dcscreen.h"
#elif defined(__WXMAC__)
#error "Target can't be both X and Windows"
#elif !defined(__WXMOTIF__) && !defined(__WXMSW__) && !defined(__WXGTK__) && \
!defined(__WXPM__) && !defined(__WXMAC__) && !defined(__X__) && \
- !defined(__WXQT__) && !defined(__WXSTUBS__) && wxUSE_GUI
+ !defined(__WXQT__) && !defined(__WXMGL__) && wxUSE_GUI
#ifdef __UNIX__
- #error "No Target! You should wx-config program for compilation flags!"
+ #error "No Target! You should use wx-config program for compilation flags!"
#else // !Unix
- #error "No Target! You should supplied makefiles for compilation!"
+ #error "No Target! You should use supplied makefiles for compilation!"
#endif // Unix/!Unix
#endif
wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL,
wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL),
- wxALIGN_CENTRE = wxALIGN_CENTER
+ wxALIGN_CENTRE = wxALIGN_CENTER,
+
+ // a mask to extract alignment from the combination of flags
+ wxALIGN_MASK = 0x0f00
};
enum wxStretch
wxGROW = 0x2000,
wxEXPAND = wxGROW,
wxSHAPED = 0x4000,
- wxADJUST_MINSIZE = 0x8000
+ wxADJUST_MINSIZE = 0x8000,
+ wxTILE = 0xc000
+};
+
+// border flags: the values are chosen for backwards compatibility
+enum wxBorder
+{
+ // this is different from wxBORDER_NONE as by default the controls do have
+ // border
+ wxBORDER_DEFAULT = 0,
+
+ wxBORDER_NONE = 0x00200000,
+ wxBORDER_STATIC = 0x01000000,
+ wxBORDER_SIMPLE = 0x02000000,
+ wxBORDER_RAISED = 0x04000000,
+ wxBORDER_SUNKEN = 0x08000000,
+ wxBORDER_DOUBLE = 0x10000000,
+
+ // a mask to extract border style from the combination of flags
+ wxBORDER_MASK = 0x1f200000
};
// ----------------------------------------------------------------------------
#define wxHSCROLL 0x40000000
#define wxCAPTION 0x20000000
-// New styles
-#define wxDOUBLE_BORDER 0x10000000
-#define wxSUNKEN_BORDER 0x08000000
-#define wxRAISED_BORDER 0x04000000
-#define wxBORDER 0x02000000
-#define wxSIMPLE_BORDER wxBORDER
-#define wxSTATIC_BORDER 0x01000000
-#define wxTRANSPARENT_WINDOW 0x00100000
-#define wxNO_BORDER 0x00200000
+// New styles (border styles are now in their own enum)
+#define wxDOUBLE_BORDER wxBORDER_DOUBLE
+#define wxSUNKEN_BORDER wxBORDER_SUNKEN
+#define wxRAISED_BORDER wxBORDER_RAISED
+#define wxBORDER wxBORDER_SIMPLE
+#define wxSIMPLE_BORDER wxBORDER_SIMPLE
+#define wxSTATIC_BORDER wxBORDER_STATIC
+#define wxNO_BORDER wxBORDER_NONE
// Override CTL3D etc. control colour processing to allow own background
// colour.
-// OBSOLETE - use wxNO_3D instead
-#define wxUSER_COLOURS 0x00800000
// Override CTL3D or native 3D styles for children
#define wxNO_3D 0x00800000
+// OBSOLETE - use wxNO_3D instead
+#define wxUSER_COLOURS wxNO_3D
+
+// wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed,
+// disable it - but still show (see also wxLB_ALWAYS_SB style)
+//
+// NB: as this style is only supported by wxUniversal so far as it doesn't use
+// wxUSER_COLOURS/wxNO_3D, we reuse the same style value
+#define wxALWAYS_SHOW_SB 0x00800000
+
// Clip children when painting, which reduces flicker in e.g. frames and
// splitter windows, but can't be used in a panel where a static box must be
// 'transparent' (panel paints the background for it)
#define wxCLIP_CHILDREN 0x00400000
+
// Note we're reusing the wxCAPTION style because we won't need captions
// for subwindows/controls
#define wxCLIP_SIBLINGS 0x20000000
+#define wxTRANSPARENT_WINDOW 0x00100000
+
// Add this style to a panel to get tab traversal working outside of dialogs
// (on by default for wxPanel, wxDialog, wxScrolledWindow)
#define wxTAB_TRAVERSAL 0x00080000
// Windows, it won't normally get the dialog navigation key events)
#define wxWANTS_CHARS 0x00040000
-// Make window retained (mostly Motif, I think)
+// Make window retained (mostly Motif, I think) -- obsolete (VZ)?
#define wxRETAINED 0x00020000
#define wxBACKINGSTORE wxRETAINED
+// set this flag to create a special popup window: it will be always shown on
+// top of other windows, will capture the mouse and will be dismissed when the
+// mouse is clicked outside of it or if it loses focus in any other way
+#define wxPOPUP_WINDOW 0x00020000
+
// don't invalidate the whole window (resulting in a PAINT event) when the
// window is resized (currently, makes sense for wxMSW only)
#define wxNO_FULL_REPAINT_ON_RESIZE 0x00010000
#define wxLB_NEEDED_SB 0x0200
#define wxLB_ALWAYS_SB 0x0400
#define wxLB_HSCROLL wxHSCROLL
-
+// always show an entire number of rows
+#define wxLB_INT_HEIGHT 0x0800
/*
* wxTextCtrl style flags
*/
#define wxTE_RICH 0x0080
#define wxTE_NO_VSCROLL 0x0100
#define wxTE_AUTO_SCROLL 0x0200
-#define wxPROCESS_ENTER 0x0400
-#define wxPASSWORD 0x0800
-#define wxTE_PROCESS_ENTER wxPROCESS_ENTER
-#define wxTE_PASSWORD wxPASSWORD
+#define wxTE_PROCESS_ENTER 0x0400
+#define wxTE_PASSWORD 0x0800
+
+// use wxHSCROLL to not wrap text at all, wxTE_LINEWRAP to wrap it at any
+// position and wxTE_WORDWRAP to wrap at words boundary
+#define wxTE_DONTWRAP wxHSCROLL
+#define wxTE_LINEWRAP 0x0800
+#define wxTE_WORDWRAP 0x0000 // it's just == !wxHSCROLL
+
+// deprecated synonyms
+#define wxPROCESS_ENTER wxTE_PROCESS_ENTER
+#define wxPASSWORD wxTE_PASSWORD
/*
* wxComboBox style flags
/*
* wxRadioBox style flags
*/
+// should we number the items from left to right or from top to bottom in a 2d
+// radiobox?
+#define wxRA_LEFTTORIGHT 0x0001
+#define wxRA_TOPTOBOTTOM 0x0002
+
// New, more intuitive names to specify majorDim argument
#define wxRA_SPECIFY_COLS wxHORIZONTAL
#define wxRA_SPECIFY_ROWS wxVERTICAL
+
// Old names for compatibility
#define wxRA_HORIZONTAL wxHORIZONTAL
#define wxRA_VERTICAL wxVERTICAL
#define wxSL_VERTICAL wxVERTICAL // 8
// The next one is obsolete - use scroll events instead
#define wxSL_NOTIFY_DRAG 0x0000
-#define wxSL_AUTOTICKS 0x0010
-// #define wxSL_MANUALTICKS 0x0010
+#define wxSL_TICKS 0x0010
+#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks
#define wxSL_LABELS 0x0020
#define wxSL_LEFT 0x0040
#define wxSL_TOP 0x0080
* wxNotebook flags
*/
#define wxNB_FIXEDWIDTH 0x0010
+#define wxNB_TOP 0x0000 // default
#define wxNB_LEFT 0x0020
#define wxNB_RIGHT 0x0040
#define wxNB_BOTTOM 0x0080
+#define wxNB_MULTILINE 0x0100
/*
* wxStatusBar95 flags
*/
#define wxST_NO_AUTORESIZE 0x0001
+/*
+ * wxStaticBitmap flags
+ */
+#define wxBI_EXPAND wxEXPAND
+
/*
* wxStaticLine flags
*/
#define wxID_FILEDLGG 5900
#define wxID_HIGHEST 5999
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// hit test results
+enum wxHitTest
+{
+ wxHT_NOWHERE,
+
+ // scrollbar
+ wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE,
+ wxHT_SCROLLBAR_ARROW_LINE_1, // left or upper arrow to scroll by line
+ wxHT_SCROLLBAR_ARROW_LINE_2, // right or down
+ wxHT_SCROLLBAR_ARROW_PAGE_1, // left or upper arrow to scroll by page
+ wxHT_SCROLLBAR_ARROW_PAGE_2, // right or down
+ wxHT_SCROLLBAR_THUMB, // on the thumb
+ wxHT_SCROLLBAR_BAR_1, // bar to the left/above the thumb
+ wxHT_SCROLLBAR_BAR_2, // bar to the right/below the thumb
+ wxHT_SCROLLBAR_LAST,
+
+ // window
+ wxHT_WINDOW_OUTSIDE, // not in this window at all
+ wxHT_WINDOW_INSIDE, // in the client area
+ wxHT_WINDOW_VERT_SCROLLBAR, // on the vertical scrollbar
+ wxHT_WINDOW_HORZ_SCROLLBAR, // on the horizontal scrollbar
+ wxHT_WINDOW_CORNER, // on the corner between 2 scrollbars
+
+ wxHT_MAX
+};
+
// ----------------------------------------------------------------------------
// Possible SetSize flags
// ----------------------------------------------------------------------------
#endif
#endif // GTK
+#ifdef __WXMGL__
+typedef void *WXWidget; // FIXME_MGL - type-safe
+#endif // MGL
+
// This is required because of clashing macros in windows.h, which may be
// included before or after wxWindows classes, and therefore must be
// disabled here before any significant wxWindows headers are included.
#define DECLARE_NO_COPY_CLASS(classname) \
private: \
classname(const classname&); \
- classname& operator=(const classname&)
+ classname& operator=(const classname&);
#endif
// _WX_DEFS_H_
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
int GetReturnCode() const { return m_returnCode; }
+#if wxUSE_STATTEXT && wxUSE_TEXTCTRL
// splits text up at newlines and places the
// lines into a vertical wxBoxSizer
wxSizer *CreateTextSizer( const wxString &message );
+#endif // wxUSE_STATTEXT && wxUSE_TEXTCTRL
+#if wxUSE_BUTTON
// places buttons into a horizontal wxBoxSizer
wxSizer *CreateButtonSizer( long flags );
+#endif // wxUSE_BUTTON
protected:
// the return code from modal dialog
#include "wx/motif/dialog.h"
#elif defined(__WXGTK__)
#include "wx/gtk/dialog.h"
+#elif defined(__WXMGL__)
+ #include "wx/mgl/dialog.h"
+// FIXME_MGL -- belongs to wxUniv
#elif defined(__WXQT__)
#include "wx/qt/dialog.h"
#elif defined(__WXMAC__)
#ifndef _WX_DIRDLG_H_BASE_
#define _WX_DIRDLG_H_BASE_
+#if wxUSE_DIRDLG
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
#include "wx/stubs/dirdlg.h"
#endif
+#endif // wxUSE_DIRDLG
+
#endif
// _WX_DIRDLG_H_BASE_
class WXDLLEXPORT wxDocTemplate;
class WXDLLEXPORT wxDocManager;
class WXDLLEXPORT wxPrintInfo;
-class WXDLLEXPORT wxCommand;
class WXDLLEXPORT wxCommandProcessor;
class WXDLLEXPORT wxFileHistory;
class WXDLLEXPORT wxConfigBase;
};
#endif // wxUSE_PRINTING_ARCHITECTURE
-// ----------------------------------------------------------------------------
-// Command processing framework
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxCommand : public wxObject
-{
- DECLARE_CLASS(wxCommand)
-
-public:
- wxCommand(bool canUndoIt = FALSE, const wxString& name = "");
- ~wxCommand();
-
- // Override this to perform a command
- virtual bool Do() = 0;
-
- // Override this to undo a command
- virtual bool Undo() = 0;
-
- virtual bool CanUndo() const { return m_canUndo; }
- virtual wxString GetName() const { return m_commandName; }
-
-protected:
- bool m_canUndo;
- wxString m_commandName;
-};
-
-class WXDLLEXPORT wxCommandProcessor : public wxObject
-{
- DECLARE_DYNAMIC_CLASS(wxCommandProcessor)
-
-public:
- wxCommandProcessor(int maxCommands = 100);
- ~wxCommandProcessor();
-
- // Pass a command to the processor. The processor calls Do(); if
- // successful, is appended to the command history unless storeIt is FALSE.
- virtual bool Submit(wxCommand *command, bool storeIt = TRUE);
- virtual bool Undo();
- virtual bool Redo();
- virtual bool CanUndo() const;
- virtual bool CanRedo() const;
-
- // Call this to manage an edit menu.
- void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
- wxMenu *GetEditMenu() const { return m_commandEditMenu; }
- virtual void SetMenuStrings();
- virtual void Initialize();
-
- wxList& GetCommands() const { return (wxList&) m_commands; }
- int GetMaxCommands() const { return m_maxNoCommands; }
- virtual void ClearCommands();
-
- // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y"
- const wxString& GetUndoAccelerator() const { return m_undoAccelerator; }
- const wxString& GetRedoAccelerator() const { return m_redoAccelerator; }
-
- void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; }
- void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; }
-
-protected:
- int m_maxNoCommands;
- wxList m_commands;
- wxNode* m_currentCommand;
- wxMenu* m_commandEditMenu;
- wxString m_undoAccelerator;
- wxString m_redoAccelerator;
-};
-
// ----------------------------------------------------------------------------
// File history management
// ----------------------------------------------------------------------------
#ifndef _WX_DRAGIMAG_H_BASE_
#define _WX_DRAGIMAG_H_BASE_
+#if wxUSE_DRAGIMAG
+
#if defined(__WXMSW__)
#ifdef __WIN16__
#include "wx/generic/dragimgg.h"
#endif
+#endif // wxUSE_DRAGIMAG
+
#endif
// _WX_DRAGIMAG_H_BASE_
#endif
#include "wx/defs.h"
+
+#if wxUSE_FONTMAP
+
#include "wx/object.h"
#include "wx/fontenc.h"
#include "wx/dynarray.h"
};
+#endif // wxUSE_FONTMAP
#endif // _WX_ENCCONV_H_
class WXDLLEXPORT wxScrollWinEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxScrollWinEvent)
-
public:
wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
int pos = 0, int orient = 0);
void SetPosition(int pos) { m_commandInt = pos; }
void CopyObject(wxObject& object_dest) const;
+
public:
int m_commandInt; // Additional information
long m_extraLong;
+
+ DECLARE_DYNAMIC_CLASS(wxScrollWinEvent)
};
// Mouse event class
class WXDLLEXPORT wxMouseEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxMouseEvent)
-
public:
wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
// Was the given button 1,2,3 or any in Down state?
bool ButtonIsDown(int but) const;
+ // Get the button which is changing state (-1 if none)
+ int GetButton() const;
+
// Find state of shift/control keys
bool ControlDown() const { return m_controlDown; }
bool MetaDown() const { return m_metaDown; }
int m_wheelRotation;
int m_wheelDelta;
int m_linesPerAction;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxMouseEvent)
};
// Cursor set event
#endif // debug
};
+class WXDLLEXPORT wxNcPaintEvent : public wxEvent
+{
+public:
+ wxNcPaintEvent(int id = 0) : wxEvent(id) { SetEventType(wxEVT_NC_PAINT); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxNcPaintEvent)
+};
+
// Erase background event class
/*
wxEVT_ERASE_BACKGROUND
class WXDLLEXPORT wxFocusEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxFocusEvent)
-
public:
- wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0)
- { m_eventType = type; m_id = Id; }
+ wxFocusEvent(wxEventType type = wxEVT_NULL, int id = 0)
+ { m_eventType = type; m_id = id; m_win = NULL; }
+
+ // the window associated with this event is the window which had focus
+ // before for SET event and the window which will have focus for the KILL
+ // one
+ //
+ // NB: it may be NULL in both cases!
+ wxWindow *GetWindow() const { return m_win; }
+ void SetWindow(wxWindow *win) { m_win = win; }
+
+private:
+ wxWindow *m_win;
+
+ DECLARE_DYNAMIC_CLASS(wxFocusEvent)
};
// Activate event class
#define EVT_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ),
#define EVT_QUERY_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ),
#define EVT_PAINT(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL ),
+#define EVT_NC_PAINT(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_NC_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL ),
#define EVT_ERASE_BACKGROUND(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ERASE_BACKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction) & func, (wxObject *) NULL ),
#define EVT_CHAR(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#define EVT_KEY_DOWN(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_KEY_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#pragma interface "ffile.h"
#endif
-#if wxUSE_FILE
+#if wxUSE_FFILE
#ifndef WX_PRECOMP
#include "wx/string.h"
wxString m_name; // the name of the file (for diagnostic messages)
};
-#endif // wxUSE_FILE
+#endif // wxUSE_FFILE
#endif // _WX_FFILE_H_
#ifndef _WX_FILEDLG_H_BASE_
#define _WX_FILEDLG_H_BASE_
+#if wxUSE_FILEDLG
+
enum
{
wxOPEN = 0x0001,
#include "wx/stubs/filedlg.h"
#endif
+#endif // wxUSE_FILEDLG
#endif
// _WX_FILEDLG_H_BASE_
#include "wx/motif/font.h"
#elif defined(__WXGTK__)
#include "wx/gtk/font.h"
+#elif defined(__WXMGL__)
+ #include "wx/mgl/font.h"
#elif defined(__WXQT__)
#include "wx/qt/font.h"
#elif defined(__WXMAC__)
#ifndef _WX_FONTDLG_H_BASE_
#define _WX_FONTDLG_H_BASE_
+#if wxUSE_FONTDLG
+
#if defined(__WXMSW__)
#include "wx/msw/fontdlg.h"
#elif defined(__WXMOTIF__)
# define sm_classwxFontDialog sm_classwxGenericFontDialog
#endif
+#endif // wxUSE_FONTDLG
+
#endif
// _WX_FONTDLG_H_BASE_
#elif defined(_WX_X_FONTLIKE)
wxString xregistry,
xencoding;
+#elif defined(__WXMGL__)
+ int mglEncoding;
#else
#error "Unsupported toolkit"
#endif
// headers
// ----------------------------------------------------------------------------
+#if wxUSE_FONTMAP
+
#include "wx/fontenc.h" // for wxFontEncoding
+#if wxUSE_GUI
+ #include "wx/fontutil.h" // for wxNativeEncodingInfo
+#endif // wxUSE_GUI
+
#if wxUSE_CONFIG
class WXDLLEXPORT wxConfigBase;
#endif // wxUSE_CONFIG
// the default font mapper for wxWindows programs
WXDLLEXPORT_DATA(extern wxFontMapper *) wxTheFontMapper;
+#endif // wxUSE_FONTMAP
+
#endif // _WX_FONTMAPPER_H_
#include "wx/unix/fontutil.h"
#endif // X || GDK
+// ----------------------------------------------------------------------------
+// font-related functions (MGL)
+// ----------------------------------------------------------------------------
+
+#ifdef __WXMGL__
+ #include "wx/mgl/fontutil.h"
+#endif // __WXMGL__
+
#endif // _WX_FONTUTIL_H_
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
-WXDLLEXPORT_DATA(extern wxWindow*) wxWndHook;
+class WXDLLEXPORT wxFrame;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxStatusBar;
class WXDLLEXPORT wxToolBar;
// menu bar functions
// ------------------
+#if wxUSE_MENUS
virtual void SetMenuBar(wxMenuBar *menubar) = 0;
virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
+#endif // wxUSE_MENUS
// call this to simulate a menu command
bool Command(int id) { return ProcessCommand(id); }
void OnCloseWindow(wxCloseEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
void OnSize(wxSizeEvent& event);
+
// this should go away, but for now it's called from docview.cpp,
// so should be there for all platforms
void OnActivate(wxActivateEvent &WXUNUSED(event)) { }
+#if wxUSE_MENUS
// send wxUpdateUIEvents for all menu items (called from OnIdle())
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
+#endif // wxUSE_MENUS
protected:
// the frame main menu/status/tool bars
// main menubar, statusbar and toolbar (if any)
void DeleteAllBars();
+ // test whether this window makes part of the frame
+ virtual bool IsOneOfBars(const wxWindow *win) const;
+
+#if wxUSE_MENUS
+ // override to update menu bar position when the frame size changes
+ virtual void PositionMenuBar() { }
+
wxMenuBar *m_frameMenuBar;
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
// override to update status bar position (or anything else) when
// include the real class declaration
#if defined(__WXMSW__)
+ #ifndef __WXUNIVERSAL__
+ #define wxFrameMSW wxFrame
+ #define sm_classwxFrameMSW sm_classwxFrame
+ #endif
#include "wx/msw/frame.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/frame.h"
#elif defined(__WXGTK__)
+ #ifndef __WXUNIVERSAL__
+ #define wxFrameGTK wxFrame
+ #define sm_classwxFrameGTK sm_classwxFrame
+ #endif
#include "wx/gtk/frame.h"
+#elif defined(__WXMGL__)
+ #include "wx/mgl/frame.h"
#elif defined(__WXQT__)
#include "wx/qt/frame.h"
#elif defined(__WXMAC__)
#include "wx/stubs/frame.h"
#endif
+#ifdef __WXUNIVERSAL__
+ #include "wx/univ/frame.h"
+#endif
+
#endif
// _WX_FRAME_H_BASE_
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gauge.h
+// Purpose: wxGauge interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 1996-2001 wxWindows team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_GAUGE_H_BASE_
#define _WX_GAUGE_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/gauge.h"
+#ifdef __GNUG__
+ #pragma implementation "gaugebase.h"
+#endif
+
+#include "wx/defs.h"
+
+#if wxUSE_GAUGE
+
+#include "wx/control.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr;
+
+// ----------------------------------------------------------------------------
+// wxGauge: a progress bar
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxGaugeBase : public wxControl
+{
+public:
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int range,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxGA_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxGaugeNameStr);
+
+ // set/get the control range
+ virtual void SetRange(int range);
+ virtual int GetRange() const;
+
+ // position
+ virtual void SetValue(int pos);
+ virtual int GetValue() const;
+
+ // appearance params (not implemented for most ports)
+
+ virtual void SetShadowWidth(int w);
+ virtual int GetShadowWidth() const;
+
+ virtual void SetBezelFace(int w);
+ virtual int GetBezelFace() const;
+
+ // overriden base class virtuals
+ virtual bool AcceptsFocus() const { return FALSE; }
+
+protected:
+ // the max position
+ int m_rangeMax;
+
+ // the current position
+ int m_gaugePos;
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/gauge.h"
+#elif defined(__WXMSW__)
+ #ifdef __WIN95__
+ #include "wx/msw/gauge95.h"
+ #define wxGauge wxGauge95
+ #define sm_classwxGauge sm_classwxGauge95
+ #else // !__WIN95__
+ #include "wx/msw/gaugemsw.h"
+ #define wxGauge wxGaugeMSW
+ #define sm_classwxGauge sm_classwxGaugeMSW
+ #endif
#elif defined(__WXMOTIF__)
-#include "wx/motif/gauge.h"
+ #include "wx/motif/gauge.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/gauge.h"
+ #include "wx/gtk/gauge.h"
#elif defined(__WXQT__)
-#include "wx/qt/gauge.h"
+ #include "wx/qt/gauge.h"
#elif defined(__WXMAC__)
-#include "wx/mac/gauge.h"
+ #include "wx/mac/gauge.h"
#elif defined(__WXPM__)
-#include "wx/os2/gauge.h"
+ #include "wx/os2/gauge.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/gauge.h"
+ #include "wx/stubs/gauge.h"
#endif
+#endif // wxUSE_GAUGE
+
#endif
// _WX_GAUGE_H_BASE_
#elif defined(__WXPM__)
// Load from a resource
#define wxICON(X) wxIcon("" #X "")
+#elif defined(__WXMGL__)
+ // Load from a resource
+ #define wxICON(X) wxIcon("" #X "")
#elif defined(__WXGTK__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( (const char**) X##_xpm )
under Unix bitmaps live in XPMs and under Windows they're in ressources.
*/
-#if defined(__WXMSW__) || defined(__WXPM__)
+#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMGL__)
#define wxBITMAP(name) wxBitmap(#name, wxBITMAP_TYPE_RESOURCE)
#elif defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
// Initialize from an included XPM
// ---------------------------------------------------------------------------
// wxSize
// ---------------------------------------------------------------------------
+
class WXDLLEXPORT wxSize
{
public:
wxSize(int xx, int yy) { Set(xx, yy); }
// no copy ctor or assignment operator - the defaults are ok
+
bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; }
+ bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; }
// FIXME are these really useful? If they're, we should have += &c as well
wxSize operator+(const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
void SetTop(int top) { y = top; }
void SetBottom(int bottom) { height = bottom - y + 1; }
- void Inflate(wxCoord dx, wxCoord dy)
+ // operations with rect
+ wxRect& Inflate(wxCoord dx, wxCoord dy);
+ wxRect& Inflate(wxCoord d) { return Inflate(d, d); }
+ wxRect Inflate(wxCoord dx, wxCoord dy) const
+ {
+ wxRect r = *this;
+ r.Inflate(dx, dy);
+ return r;
+ }
+
+ wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); }
+ wxRect& Deflate(wxCoord d) { return Inflate(-d); }
+ wxRect Deflate(wxCoord dx, wxCoord dy) const
+ {
+ wxRect r = *this;
+ r.Deflate(dx, dy);
+ return r;
+ }
+
+ void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; }
+ void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); }
+
+ wxRect& Intersect(const wxRect& rect);
+ wxRect Intersect(const wxRect& rect) const
{
- x -= dx;
- y -= dy;
- width += 2*dx;
- height += 2*dy;
+ wxRect r = *this;
+ r.Intersect(rect);
+ return r;
}
- void Inflate(wxCoord d) { Inflate(d, d); }
+ wxRect operator+(const wxRect& rect) const;
+ wxRect& operator+=(const wxRect& rect);
+ // compare rectangles
bool operator==(const wxRect& rect) const;
bool operator!=(const wxRect& rect) const { return !(*this == rect); }
- bool Inside(int cx, int cy) const;
+ // return TRUE if the point is (not strcitly) inside the rect
+ bool Inside(int x, int y) const;
bool Inside(const wxPoint& pt) const { return Inside(pt.x, pt.y); }
- wxRect operator+(const wxRect& rect) const;
- wxRect& operator+=(const wxRect& rect);
+
+ // return TRUE if the rectangles have a non empty intersection
+ bool Intersects(const wxRect& rect) const;
public:
int x, y, width, height;
#include "wx/motif/gdiobj.h"
#elif defined(__WXGTK__)
#include "wx/gtk/gdiobj.h"
+#elif defined(__WXMGL__)
+#include "wx/mgl/gdiobj.h"
#elif defined(__WXQT__)
#include "wx/qt/gdiobj.h"
#elif defined(__WXMAC__)
// Created: 21/3/2000
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIRCTRL_H_
#pragma interface "dirctrlg.h"
#endif
+#if wxUSE_DIRDLG
+
#include "wx/treectrl.h"
#include "wx/dirdlg.h"
#include "wx/choice.h"
};
+#endif // wxUSE_DIRDLG
+
#endif
// _WX_DIRCTRLG_H_
#endif
#include "wx/defs.h"
+
+#if wxUSE_GRID
+
#include "wx/panel.h"
#include "wx/string.h"
#include "wx/scrolbar.h"
#define EVT_GRID_LABEL_LCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_GRID_LABEL_LCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL),
#define EVT_GRID_LABEL_RCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_GRID_LABEL_RCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL),
+#endif // wxUSE_GRID
+
#endif // __GRIDH_G__
public:
wxLayoutAlgorithm() {}
+#if wxUSE_MDI_ARCHITECTURE
// The MDI client window is sized to whatever's left over.
bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = (wxRect*) NULL);
+#endif // wxUSE_MDI_ARCHITECTURE
// mainWindow is sized to whatever's left over. This function for backward
// compatibility; use LayoutWindow.
// to the dialog via validators.
virtual void InitDialog();
+#if wxUSE_BUTTON
// a default button is activated when Enter is pressed
wxButton *GetDefaultItem() const { return m_btnDefault; }
void SetDefaultItem(wxButton *btn) { m_btnDefault = btn; }
+#endif // wxUSE_BUTTON
// implementation from now on
// --------------------------
// the child which had the focus last time this panel was activated
wxWindow *m_winLastFocused;
+#if wxUSE_BUTTON
// a default button or NULL
wxButton *m_btnDefault;
+#endif // wxUSE_BUTTON
private:
DECLARE_DYNAMIC_CLASS(wxPanel)
/////////////////////////////////////////////////////////////////////////////
// Name: wx/generic/scrolwin.h
-// Purpose: wxScrolledWindow class
+// Purpose: wxGenericScrolledWindow class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
#endif
+// avoid triggering this stupid VC++ warning
+#ifdef __VISUALC__
+ #pragma warning(disable:4355) // 'this' used in base member initializer list
+#endif
+
// ----------------------------------------------------------------------------
// wxGenericScrolledWindow
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel
+class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
+ public wxScrollHelper
{
public:
- wxGenericScrolledWindow();
+ wxGenericScrolledWindow() : wxScrollHelper(this) { }
wxGenericScrolledWindow(wxWindow *parent,
wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxScrolledWindowStyle,
const wxString& name = wxPanelNameStr)
+ : wxScrollHelper(this)
{
Create(parent, id, pos, size, style, name);
}
- ~wxGenericScrolledWindow();
+ virtual ~wxGenericScrolledWindow();
bool Create(wxWindow *parent,
wxWindowID id,
long style = wxScrolledWindowStyle,
const wxString& name = wxPanelNameStr);
- // Normally the wxGenericScrolledWindow will scroll itself, but in
- // some rare occasions you might want it to scroll another
- // window (e.g. a child of it in order to scroll only a portion
- // the area between the scrollbars (spreadsheet: only cell area
- // will move).
- virtual void SetTargetWindow( wxWindow *target );
- virtual wxWindow *GetTargetWindow();
-
- // Number of pixels per user unit (0 or -1 for no scrollbar)
- // Length of virtual canvas in user units
- // Length of page in user units
- virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
- int noUnitsX, int noUnitsY,
- int xPos = 0, int yPos = 0,
- bool noRefresh = FALSE );
-
- // Physically scroll the window
- virtual void Scroll(int x_pos, int y_pos);
-
-#if WXWIN_COMPATIBILITY
- virtual void GetScrollUnitsPerPage(int *x_page, int *y_page) const;
- virtual void CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const;
-#endif
-
- int GetScrollPageSize(int orient) const;
- void SetScrollPageSize(int orient, int pageSize);
-
- virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
-
- // Enable/disable Windows scrolling in either direction.
- // If TRUE, wxWindows scrolls the canvas and only a bit of
- // the canvas is invalidated; no Clear() is necessary.
- // If FALSE, the whole canvas is invalidated and a Clear() is
- // necessary. Disable for when the scroll increment is used
- // to actually scroll a non-constant distance
- virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
-
- // Get the view start
- virtual void GetViewStart(int *x, int *y) const;
- // Compatibility
- void ViewStart(int *x, int *y) const
- { GetViewStart( x, y ); }
-
- // Actual size in pixels when scrolling is taken into account
- virtual void GetVirtualSize(int *x, int *y) const;
-
- // Set the scale factor, used in PrepareDC
- void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
- double GetScaleX() const { return m_scaleX; }
- double GetScaleY() const { return m_scaleY; }
-
- virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
- virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
-
- // Adjust the scrollbars
- virtual void AdjustScrollbars(void);
-
- // Override this function to draw the graphic (or just process EVT_PAINT)
- virtual void OnDraw(wxDC& WXUNUSED(dc)) {};
-
- // Override this function if you don't want to have wxGenericScrolledWindow
- // automatically change the origin according to the scroll position.
- virtual void PrepareDC(wxDC& dc);
-
- // implementation from now on
- void OnScroll(wxScrollWinEvent& event);
- void OnSize(wxSizeEvent& event);
- void OnPaint(wxPaintEvent& event);
- void OnChar(wxKeyEvent& event);
- void OnMouseWheel(wxMouseEvent& event);
-
- // Calculate scroll increment
- virtual int CalcScrollInc(wxScrollWinEvent& event);
-
-protected:
- wxWindow *m_targetWindow;
- int m_xScrollPixelsPerLine;
- int m_yScrollPixelsPerLine;
- bool m_xScrollingEnabled;
- bool m_yScrollingEnabled;
- int m_xScrollPosition;
- int m_yScrollPosition;
- int m_xScrollLines;
- int m_yScrollLines;
- int m_xScrollLinesPerPage;
- int m_yScrollLinesPerPage;
- double m_scaleX;
- double m_scaleY;
- int m_wheelRotation;
+ virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
private:
- DECLARE_EVENT_TABLE()
DECLARE_ABSTRACT_CLASS(wxGenericScrolledWindow)
};
+#ifdef __VISUALC__
+ #pragma warning(default:4355)
+#endif
+
#endif
// _WX_GENERIC_SCROLLWIN_H_
#ifndef _WX_GENERIC_SPINCTRL_H_
#define _WX_GENERIC_SPINCTRL_H_
+// ----------------------------------------------------------------------------
+// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if
+// wxSpinButton is available, this is what we do - but if it isn't, we still
+// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but
+// the different interface. This allows to write programs using wxSpinCtrl
+// without tons of #ifdefs.
+// ----------------------------------------------------------------------------
+
+#if wxUSE_SPINBTN
+
#ifdef __GNUG__
#pragma interface "spinctlg.h"
#endif
-#include "wx/textctrl.h"
+class WXDLLEXPORT wxSpinButton;
+class WXDLLEXPORT wxTextCtrl;
+
+// ----------------------------------------------------------------------------
+// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxSpinCtrl : public wxControl
+{
+public:
+ wxSpinCtrl() { Init(); }
+
+ wxSpinCtrl(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = _T("wxSpinCtrl"))
+ {
+ Create(parent, id, value, pos, size, style, min, max, initial, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = _T("wxSpinCtrl"));
+
+ virtual ~wxSpinCtrl();
+
+ // operations
+ void SetValue(int val);
+ void SetValue(const wxString& text);
+ void SetRange(int min, int max);
+
+ // accessors
+ int GetValue() const;
+ int GetMin() const;
+ int GetMax() const;
+
+ // implementation from now on
+
+ // forward these functions to all subcontrols
+ virtual bool Enable(bool enable = TRUE);
+ virtual bool Show(bool show = TRUE);
+
+ // get the subcontrols
+ wxTextCtrl *GetText() const { return m_text; }
+ wxSpinButton *GetSpinButton() const { return m_btn; }
+
+ // set the value of the text (only)
+ void SetTextValue(int val);
+
+ // put the numeric value of the string in the text ctrl into val and return
+ // TRUE or return FALSE if the text ctrl doesn't contain a number or if the
+ // number is out of range
+ bool GetTextValue(int *val) const;
+
+protected:
+ // override the base class virtuals involved into geometry calculations
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+
+ // common part of all ctors
+ void Init();
+
+private:
+ // the subcontrols
+ wxTextCtrl *m_text;
+ wxSpinButton *m_btn;
+};
+
+#else // !wxUSE_SPINBTN
// ----------------------------------------------------------------------------
-// generic wxSpinCtrl is just a text control
+// wxSpinCtrl is just a text control
// ----------------------------------------------------------------------------
+#include "wx/textctrl.h"
+
class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl
{
public:
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
};
+#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN
+
#endif // _WX_GENERIC_SPINCTRL_H_
#pragma interface "treectlg.h"
#endif
+#if wxUSE_TREECTRL
+
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/object.h"
#endif
+#endif // wxUSE_TREECTRL
+
#endif // _GENERIC_TREECTRL_H_
-/////////////////////////////////////////////////////////////////////////////
-// Name: accel.h
-// Purpose: wxAcceleratorTable class
-// Author: Robert Roebling
-// RCS-ID: $Id$
-// Copyright: (c) Robert Roebling
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef __GTKACCELH__
-#define __GTKACCELH__
-
-#ifdef __GNUG__
-#pragma interface "accel.h"
-#endif
-
-#include "wx/defs.h"
-
-#if wxUSE_ACCEL
-
-#include "wx/object.h"
-#include "wx/event.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxAcceleratorEntry;
-class wxAcceleratorTable;
-
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-extern wxAcceleratorTable wxNullAcceleratorTable;
-
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-// Hold Ctrl key down
-#define wxACCEL_ALT 0x01
-
-// Hold Ctrl key down
-#define wxACCEL_CTRL 0x02
-
- // Hold Shift key down
-#define wxACCEL_SHIFT 0x04
-
- // Hold no other key
-#define wxACCEL_NORMAL 0x00
-
-//-----------------------------------------------------------------------------
-// wxAcceleratorEntry
-//-----------------------------------------------------------------------------
-
-class wxAcceleratorEntry: public wxObject
-{
-public:
- wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
- { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
-
- inline void Set(int flags, int keyCode, int cmd)
- { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
-
- inline int GetFlags() const { return m_flags; }
- inline int GetKeyCode() const { return m_keyCode; }
- inline int GetCommand() const { return m_command; }
-
- int m_flags;
- int m_keyCode; // ASCII or virtual keycode
- int m_command; // Command id to generate
-};
-
-//-----------------------------------------------------------------------------
-// wxAcceleratorTable
-//-----------------------------------------------------------------------------
-
-class wxAcceleratorTable: public wxObject
-{
-public:
- wxAcceleratorTable();
- wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
- ~wxAcceleratorTable();
-
- inline wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject()
- { Ref(accel); }
- inline wxAcceleratorTable(const wxAcceleratorTable* accel)
- { if (accel) Ref(*accel); }
- inline bool operator == (const wxAcceleratorTable& accel)
- { return m_refData == accel.m_refData; }
- inline bool operator != (const wxAcceleratorTable& accel)
- { return m_refData != accel.m_refData; }
- inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
- { if (*this == accel) return (*this); Ref(accel); return *this; }
-
- bool Ok() const;
-
- // implementation
- // --------------
-
- int GetCommand( wxKeyEvent &event );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
-};
-
-#endif
-
-#endif
+// VZ: keeping the old file just in case we're going to have a native GTK+
+// wxAcceleratorTable implementation one day, but for now use the generic
+// version
+#include "wx/generic/accel.h"
unsigned char *m_colorCube;
private:
- /// Set to TRUE while we are in wxYield().
+ // Set to TRUE while we are in wxYield().
bool m_suppressIdleEvents;
private:
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_BMPBUTTON
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-#include "wx/bitmap.h"
-#include "wx/button.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxBitmapButton;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const wxChar *wxButtonNameStr;
-
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxBitmapButton
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-class wxBitmapButton: public wxButton
+class wxBitmapButton: public wxBitmapButtonBase
{
public:
wxBitmapButton();
- inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr )
+ wxBitmapButton(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBU_AUTODRAW,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
{
Create(parent, id, bitmap, pos, size, style, validator, name);
}
- bool Create( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr);
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBU_AUTODRAW,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
virtual void SetDefault();
+ virtual bool Enable(bool enable = TRUE);
void SetLabel( const wxString &label );
wxString GetLabel() const;
virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); }
- wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_disabled; }
- wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_focus; }
- wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_bitmap; }
- wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_selected; }
-
- void SetBitmapDisabled( const wxBitmap& bitmap );
- void SetBitmapFocus( const wxBitmap& bitmap );
- void SetBitmapLabel( const wxBitmap& bitmap );
- void SetBitmapSelected( const wxBitmap& bitmap );
-
- void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
- int GetMarginX() const { return m_marginX; }
- int GetMarginY() const { return m_marginY; }
-
- virtual bool Enable(bool enable);
-
// implementation
// --------------
bool m_hasFocus;
bool m_isSelected;
- wxBitmap m_bitmap;
- wxBitmap m_disabled;
- wxBitmap m_focus;
- wxBitmap m_selected;
protected:
- int m_marginX;
- int m_marginY;
+ virtual void OnSetBitmap();
private:
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
};
-#endif
-
#endif // __BMPBUTTONH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_CHECKBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxCheckBox;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxCheckBoxNameStr;
-
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxCheckBox
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-class wxCheckBox: public wxControl
+class wxCheckBox : public wxCheckBoxBase
{
public:
wxCheckBox();
GtkWidget *m_widgetCheckbox;
GtkWidget *m_widgetLabel;
-
+
protected:
virtual wxSize DoGetBestSize() const;
DECLARE_DYNAMIC_CLASS(wxCheckBox)
};
-#endif
-
#endif // __GTKCHECKBOXH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_CHECKLISTBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-#include "wx/listbox.h"
-
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
#define wxCHECKLBOX_STRING _T("[ ] ")
#endif
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
// wxCheckListBox
// ----------------------------------------------------------------------------
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
};
-#endif
-
#endif //__GTKCHECKLISTH__
int GetSelection() const;
wxString GetString( int n ) const;
wxString GetStringSelection() const;
+ int GetCount() const { return Number(); }
int Number() const;
void SetSelection( int n );
void SetStringSelection( const wxString &string );
// wxControl
//-----------------------------------------------------------------------------
-extern const wxChar* wxControlNameStr;
-
class wxControl : public wxControlBase
{
public:
class wxClientDC : public wxWindowDC
{
public:
- wxClientDC() { }
+ wxClientDC();
wxClientDC( wxWindow *win );
protected:
class wxToolBar;
class wxStatusBar;
-class wxFrame;
-
//-----------------------------------------------------------------------------
-// wxFrame
+// wxFrameGTK
//-----------------------------------------------------------------------------
-class wxFrame : public wxFrameBase
+class wxFrameGTK : public wxFrameBase
{
public:
// construction
- wxFrame() { Init(); }
- wxFrame(wxWindow *parent,
- wxWindowID id,
- const wxString& title,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_FRAME_STYLE,
- const wxString& name = wxFrameNameStr)
+ wxFrameGTK() { Init(); }
+ wxFrameGTK(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
{
Init();
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
- virtual ~wxFrame();
+ virtual ~wxFrameGTK();
// implement base class pure virtuals
virtual void Maximize(bool maximize = TRUE);
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
virtual bool IsFullScreen() const { return m_fsIsShowing; };
+#if wxUSE_MENUS
virtual void SetMenuBar( wxMenuBar *menuBar );
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual void PositionStatusBar();
bool m_isIconized;
private:
- DECLARE_DYNAMIC_CLASS(wxFrame)
+ DECLARE_DYNAMIC_CLASS(wxFrameGTK)
};
#endif // __GTKFRAMEH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_NOTEBOOK
-
-#include "wx/object.h"
-#include "wx/string.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxImageList;
-class wxNotebook;
-
-typedef wxWindow wxNotebookPage; // so far, any window can be a page
-
//-----------------------------------------------------------------------------
// internal class
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
-class wxNotebook : public wxControl
+class wxNotebook : public wxNotebookBase
{
public:
// default for dynamic class
// accessors
// ---------
- // get number of pages in the dialog
- int GetPageCount() const;
// set the currently selected page, return the index of the previously
// selected one (or -1 on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(int nPage);
- // cycle thru the tabs
- void AdvanceSelection(bool bForward = TRUE);
// get the currently selected page
int GetSelection() const;
// associate image list with a control
void SetImageList(wxImageList* imageList);
void AssignImageList(wxImageList* imageList);
- // get pointer (may be NULL) to the associated image list
- wxImageList *GetImageList() const { return m_imageList; }
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
bool SetPageImage(int nPage, int nImage);
- // currently it's always 1 because wxGTK doesn't support multi-row
- // tab controls
- int GetRowCount() const;
-
// control the appearance of the notebook pages
// set the size (the same for all pages)
void SetPageSize(const wxSize& size);
// operations
// ----------
- // remove one page from the notebook but do not destroy it
- bool RemovePage(int nPage);
// remove one page from the notebook
bool DeletePage(int nPage);
// remove all pages
bool DeleteAllPages();
-
+
// adds a new page to the notebook (it will be deleted ny the notebook,
// don't delete it yourself). If bSelect, this page becomes active.
bool AddPage( wxNotebookPage *win,
bool bSelect = FALSE,
int imageId = -1 );
- // get the panel which represents the given page
- wxNotebookPage *GetPage(int nPage) const;
-
// handler for tab navigation
// --------------------------
void OnNavigationKey(wxNavigationKeyEvent& event);
void ApplyWidgetStyle();
- // report if window belongs to notebook
+ // report if window belongs to notebook
bool IsOwnGtkWindow( GdkWindow *window );
// common part of all ctors
// helper function
wxGtkNotebookPage* GetNotebookPage(int page) const;
- wxImageList* m_imageList;
bool m_ownsImageList;
wxList m_pages;
// selection internally instead of querying the notebook for it
int m_selection;
+protected:
+ // remove one page from the notebook but do not destroy it
+ virtual wxNotebookPage *DoRemovePage(int nPage);
+
private:
DECLARE_DYNAMIC_CLASS(wxNotebook)
DECLARE_EVENT_TABLE()
};
-#endif
-
#endif
// __GTKNOTEBOOKH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_RADIOBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
#include "wx/bitmap.h"
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxRadioBox;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxRadioBoxNameStr;
-
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection( const wxString& s );
- virtual int Number() const;
+ int Number() const;
+ int GetCount() const { return Number(); }
int GetNumberOfRowsOrCols() const;
void SetNumberOfRowsOrCols( int n );
DECLARE_DYNAMIC_CLASS(wxRadioBox)
};
-#endif
-
#endif // __GTKRADIOBOXH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_RADIOBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxRadioButton;
-
-//-----------------------------------------------------------------------------
-// data
-//-----------------------------------------------------------------------------
-
-extern const char* wxRadioButtonNameStr;
-
//-----------------------------------------------------------------------------
// wxRadioButton
//-----------------------------------------------------------------------------
DECLARE_DYNAMIC_CLASS(wxRadioButton)
};
-#endif
-
#endif // __GTKRADIOBUTTONH__
enum wxRegionContain
{
- wxOutRegion = 0,
- wxPartRegion = 1,
+ wxOutRegion = 0,
+ wxPartRegion = 1,
wxInRegion = 2
};
// So far, for internal use only
-enum wxRegionOp
+enum wxRegionOp
{
wxRGN_AND, // Creates the intersection of the two combined regions.
wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
};
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxRegion
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
class wxRegion : public wxGDIObject
{
wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight );
wxRegion( const wxRect& rect );
wxRegion();
- ~wxRegion();
+ virtual ~wxRegion();
- inline wxRegion( const wxRegion& r ): wxGDIObject()
- { Ref(r); }
- inline wxRegion& operator = ( const wxRegion& r )
- { Ref(r); return (*this); }
+ wxRegion( const wxRegion& r ) { Ref(r); }
+ wxRegion& operator = ( const wxRegion& r ) { Ref(r); return *this; }
bool operator == ( const wxRegion& region );
bool operator != ( const wxRegion& region );
public:
wxList *GetRectList() const;
GdkRegion *GetRegion() const;
-
+
+protected:
+ // helper of Intersect()
+ bool IntersectRegionOnly(const wxRegion& reg);
+
+ // call this before modifying the region
+ void Unshare();
+
private:
- DECLARE_DYNAMIC_CLASS(wxRegion);
+ DECLARE_DYNAMIC_CLASS(wxRegion);
};
+// ----------------------------------------------------------------------------
+// wxRegionIterator: decomposes a region into rectangles
+// ----------------------------------------------------------------------------
+
class wxRegionIterator: public wxObject
{
public:
wxCoord GetWidth() const { return GetW(); }
wxCoord GetH() const;
wxCoord GetHeight() const { return GetH(); }
- wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
+ wxRect GetRect() const;
private:
size_t m_current;
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/defs.h"
-#if wxUSE_SCROLLBAR
-
-#include "wx/object.h"
-#include "wx/control.h"
-
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxScrollBar;
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxScrollBarNameStr;
-
//-----------------------------------------------------------------------------
// wxScrollBar
//-----------------------------------------------------------------------------
-class wxScrollBar: public wxControl
+class wxScrollBar: public wxScrollBarBase
{
public:
- wxScrollBar()
+ wxScrollBar()
{ m_adjust = (GtkAdjustment *) NULL; m_oldPos = 0.0; }
inline wxScrollBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
// Backward compatibility
// ----------------------
-
+
int GetValue(void) const;
void SetValue( int viewStart );
void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const;
// implementation
// --------------
-
+
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
-
+
GtkAdjustment *m_adjust;
float m_oldPos;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxScrollBar)
};
-#endif
-
#endif
// __GTKSCROLLBARH__
/////////////////////////////////////////////////////////////////////////////
-// Name: slider.h
+// Name: wx/gtk/slider.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSLIDERH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_SLIDER
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxSlider;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxSliderNameStr;
-
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxSlider
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-class wxSlider: public wxControl
+class wxSlider : public wxSliderBase
{
public:
- wxSlider() {}
- inline wxSlider( wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr )
+ wxSlider() { }
+ wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr)
{
- Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name );
+ Create( parent, id, value, minValue, maxValue,
+ pos, size, style, validator, name );
}
- bool Create(wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr );
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+
+ // implement the base class pure virtuals
virtual int GetValue() const;
- virtual void SetValue( int );
- void SetRange( int minValue, int maxValue );
- int GetMin() const;
- int GetMax() const;
- void SetTickFreq( int n, int pos );
- int GetTickFreq() const;
- void SetPageSize( int pageSize );
- int GetPageSize() const;
- void ClearSel();
- void ClearTicks();
- void SetLineSize( int lineSize );
- int GetLineSize() const;
- int GetSelEnd() const;
- int GetSelStart() const;
- void SetSelection( int minPos, int maxPos );
- void SetThumbLength( int len );
- int GetThumbLength() const;
- void SetTick( int tickPos );
+ virtual void SetValue(int value);
+
+ virtual void SetRange(int minValue, int maxValue);
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ virtual void SetLineSize(int lineSize);
+ virtual void SetPageSize(int pageSize);
+ virtual int GetLineSize() const;
+ virtual int GetPageSize() const;
+
+ virtual void SetThumbLength(int lenPixels);
+ virtual int GetThumbLength() const;
// implementation
// --------------
DECLARE_DYNAMIC_CLASS(wxSlider)
};
-#endif
-
#endif // __GTKSLIDERH__
/////////////////////////////////////////////////////////////////////////////
-// Name: spinbutt.h
+// Name: wx/gtk/spinbutt.h
// Purpose: wxSpinButton class
// Author: Robert Roebling
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifndef __GTKSPINBUTTH__
-#define __GTKSPINBUTTH__
+#ifndef _WX_GTK_SPINBUTT_H_
+#define _WX_GTK_SPINBUTT_H_
#ifdef __GNUG__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_SPINBTN
-
-#include "wx/control.h"
-
//-----------------------------------------------------------------------------
// wxSpinButton
//-----------------------------------------------------------------------------
{
public:
wxSpinButton() { }
- wxSpinButton( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
+ wxSpinButton(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = wxSPIN_BUTTON_NAME)
{
Create(parent, id, pos, size, style, name);
}
- bool Create( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton" );
+ bool Create(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = wxSPIN_BUTTON_NAME);
virtual int GetValue() const;
virtual void SetValue( int value );
};
#endif
- // wxUSE_SPINBTN
-
-#endif
- // __GTKSPINBUTTH__
+ // _WX_GTK_SPINBUTT_H_
/////////////////////////////////////////////////////////////////////////////
-// Name: statbmp.h
+// Name: wx/gtk/statbmp.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_STATBMP
-
-#include "wx/object.h"
-#include "wx/control.h"
-#include "wx/bitmap.h"
#include "wx/icon.h"
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxStaticBitmap;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char* wxStaticBitmapNameStr;
-
//-----------------------------------------------------------------------------
// wxStaticBitmap
//-----------------------------------------------------------------------------
-class wxStaticBitmap: public wxControl
+class wxStaticBitmap : public wxStaticBitmapBase
{
- DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
-
public:
wxStaticBitmap();
wxStaticBitmap( wxWindow *parent,
long style = 0,
const wxString& name = wxStaticBitmapNameStr);
+ virtual void SetIcon(const wxIcon& icon) { SetBitmap( icon ); }
virtual void SetBitmap( const wxBitmap& bitmap );
-
- wxBitmap& GetBitmap() { return m_bitmap; }
- const wxBitmap& GetBitmap() const { return m_bitmap; }
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
// for compatibility with wxMSW
- const wxIcon& GetIcon() const
+ wxIcon GetIcon() const
{
// don't use wxDynamicCast, icons and bitmaps are really the same thing
// in wxGTK
return (const wxIcon &)m_bitmap;
}
- // for compatibility with wxMSW
- void SetIcon(const wxIcon& icon)
- {
- SetBitmap( icon );
- }
-
-protected:
- virtual wxSize DoGetBestSize() const;
-
private:
// creates the new pixmap widget
void CreatePixmapWidget();
wxBitmap m_bitmap;
-};
-#endif
+ DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
+};
#endif // __GTKSTATICBITMAPH__
/////////////////////////////////////////////////////////////////////////////
-// Name: stabox.h
+// Name: wx/gtk/stabox.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_STATBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxStaticBox;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxStaticBoxNameStr;
-
//-----------------------------------------------------------------------------
// wxStaticBox
//-----------------------------------------------------------------------------
-class wxStaticBox: public wxControl
+class wxStaticBox : public wxStaticBoxBase
{
- DECLARE_DYNAMIC_CLASS(wxStaticBox)
-
- public:
+public:
+ wxStaticBox();
+ wxStaticBox( wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticBoxNameStr );
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticBoxNameStr );
+
+ virtual void SetLabel( const wxString &label );
+
+ // implementation
- wxStaticBox(void);
- wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label,
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- long style = 0, const wxString &name = wxStaticBoxNameStr );
- bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- long style = 0, const wxString &name = wxStaticBoxNameStr );
- void SetLabel( const wxString &label );
-
- // implementation
-
void ApplyWidgetStyle();
-};
-#endif
+private:
+ DECLARE_DYNAMIC_CLASS(wxStaticBox)
+};
#endif // __GTKSTATICBOXH__
// global data
//-----------------------------------------------------------------------------
-extern const wxChar *wxStaticTextNameStr;
-
//-----------------------------------------------------------------------------
// wxStaticText
//-----------------------------------------------------------------------------
virtual void Cut();
virtual void Paste();
- virtual bool CanCopy() const;
- virtual bool CanCut() const;
- virtual bool CanPaste() const;
-
// Undo/redo
virtual void Undo();
virtual void Redo();
/////////////////////////////////////////////////////////////////////////////
-// Name: window.h
+// Name: wx/gtk/window.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// callback definition for inserting a window (internal)
//-----------------------------------------------------------------------------
-typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
+class wxWindowGTK;
+typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
//-----------------------------------------------------------------------------
-// wxWindow
+// wxWindowGTK
//-----------------------------------------------------------------------------
-class wxWindow : public wxWindowBase
+class wxWindowGTK : public wxWindowBase
{
- DECLARE_DYNAMIC_CLASS(wxWindow)
-
public:
// creating the window
// -------------------
- wxWindow();
- wxWindow(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxPanelNameStr);
+ wxWindowGTK();
+ wxWindowGTK(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
- virtual ~wxWindow();
+ virtual ~wxWindowGTK();
// implement base class (pure) virtual methods
// -------------------------------------------
const wxFont *theFont = (const wxFont *) NULL)
const;
+#if wxUSE_MENUS
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
+#endif // wxUSE_MENUS
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE );
virtual void OnParentEnable( bool WXUNUSED(enable) ) {};
/* used by all window classes in the widget creation process */
- bool PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size );
+ bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
void PostCreation();
/* internal addition of child windows. differs from class
to class not by using virtual functions but by using
the m_insertCallback */
- void DoAddChild(wxWindow *child);
+ void DoAddChild(wxWindowGTK *child);
/* the methods below are required because many native widgets
are composed of several subwidgets and setting a style for
void Init();
private:
- DECLARE_NO_COPY_CLASS(wxWindow);
+ DECLARE_DYNAMIC_CLASS(wxWindowGTK)
+ DECLARE_NO_COPY_CLASS(wxWindowGTK);
};
#endif // __GTKWINDOWH__
-/////////////////////////////////////////////////////////////////////////////
-// Name: accel.h
-// Purpose: wxAcceleratorTable class
-// Author: Robert Roebling
-// RCS-ID: $Id$
-// Copyright: (c) Robert Roebling
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef __GTKACCELH__
-#define __GTKACCELH__
-
-#ifdef __GNUG__
-#pragma interface "accel.h"
-#endif
-
-#include "wx/defs.h"
-
-#if wxUSE_ACCEL
-
-#include "wx/object.h"
-#include "wx/event.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxAcceleratorEntry;
-class wxAcceleratorTable;
-
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-extern wxAcceleratorTable wxNullAcceleratorTable;
-
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-// Hold Ctrl key down
-#define wxACCEL_ALT 0x01
-
-// Hold Ctrl key down
-#define wxACCEL_CTRL 0x02
-
- // Hold Shift key down
-#define wxACCEL_SHIFT 0x04
-
- // Hold no other key
-#define wxACCEL_NORMAL 0x00
-
-//-----------------------------------------------------------------------------
-// wxAcceleratorEntry
-//-----------------------------------------------------------------------------
-
-class wxAcceleratorEntry: public wxObject
-{
-public:
- wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
- { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
-
- inline void Set(int flags, int keyCode, int cmd)
- { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
-
- inline int GetFlags() const { return m_flags; }
- inline int GetKeyCode() const { return m_keyCode; }
- inline int GetCommand() const { return m_command; }
-
- int m_flags;
- int m_keyCode; // ASCII or virtual keycode
- int m_command; // Command id to generate
-};
-
-//-----------------------------------------------------------------------------
-// wxAcceleratorTable
-//-----------------------------------------------------------------------------
-
-class wxAcceleratorTable: public wxObject
-{
-public:
- wxAcceleratorTable();
- wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
- ~wxAcceleratorTable();
-
- inline wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject()
- { Ref(accel); }
- inline wxAcceleratorTable(const wxAcceleratorTable* accel)
- { if (accel) Ref(*accel); }
- inline bool operator == (const wxAcceleratorTable& accel)
- { return m_refData == accel.m_refData; }
- inline bool operator != (const wxAcceleratorTable& accel)
- { return m_refData != accel.m_refData; }
- inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
- { if (*this == accel) return (*this); Ref(accel); return *this; }
-
- bool Ok() const;
-
- // implementation
- // --------------
-
- int GetCommand( wxKeyEvent &event );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
-};
-
-#endif
-
-#endif
+// VZ: keeping the old file just in case we're going to have a native GTK+
+// wxAcceleratorTable implementation one day, but for now use the generic
+// version
+#include "wx/generic/accel.h"
unsigned char *m_colorCube;
private:
- /// Set to TRUE while we are in wxYield().
+ // Set to TRUE while we are in wxYield().
bool m_suppressIdleEvents;
private:
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_BMPBUTTON
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-#include "wx/bitmap.h"
-#include "wx/button.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxBitmapButton;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const wxChar *wxButtonNameStr;
-
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxBitmapButton
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-class wxBitmapButton: public wxButton
+class wxBitmapButton: public wxBitmapButtonBase
{
public:
wxBitmapButton();
- inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr )
+ wxBitmapButton(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBU_AUTODRAW,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
{
Create(parent, id, bitmap, pos, size, style, validator, name);
}
- bool Create( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr);
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBU_AUTODRAW,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
virtual void SetDefault();
+ virtual bool Enable(bool enable = TRUE);
void SetLabel( const wxString &label );
wxString GetLabel() const;
virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); }
- wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_disabled; }
- wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_focus; }
- wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_bitmap; }
- wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_selected; }
-
- void SetBitmapDisabled( const wxBitmap& bitmap );
- void SetBitmapFocus( const wxBitmap& bitmap );
- void SetBitmapLabel( const wxBitmap& bitmap );
- void SetBitmapSelected( const wxBitmap& bitmap );
-
- void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
- int GetMarginX() const { return m_marginX; }
- int GetMarginY() const { return m_marginY; }
-
- virtual bool Enable(bool enable);
-
// implementation
// --------------
bool m_hasFocus;
bool m_isSelected;
- wxBitmap m_bitmap;
- wxBitmap m_disabled;
- wxBitmap m_focus;
- wxBitmap m_selected;
protected:
- int m_marginX;
- int m_marginY;
+ virtual void OnSetBitmap();
private:
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
};
-#endif
-
#endif // __BMPBUTTONH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_CHECKBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxCheckBox;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxCheckBoxNameStr;
-
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxCheckBox
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-class wxCheckBox: public wxControl
+class wxCheckBox : public wxCheckBoxBase
{
public:
wxCheckBox();
GtkWidget *m_widgetCheckbox;
GtkWidget *m_widgetLabel;
-
+
protected:
virtual wxSize DoGetBestSize() const;
DECLARE_DYNAMIC_CLASS(wxCheckBox)
};
-#endif
-
#endif // __GTKCHECKBOXH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_CHECKLISTBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-#include "wx/listbox.h"
-
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
#define wxCHECKLBOX_STRING _T("[ ] ")
#endif
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
// wxCheckListBox
// ----------------------------------------------------------------------------
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
};
-#endif
-
#endif //__GTKCHECKLISTH__
int GetSelection() const;
wxString GetString( int n ) const;
wxString GetStringSelection() const;
+ int GetCount() const { return Number(); }
int Number() const;
void SetSelection( int n );
void SetStringSelection( const wxString &string );
// wxControl
//-----------------------------------------------------------------------------
-extern const wxChar* wxControlNameStr;
-
class wxControl : public wxControlBase
{
public:
class wxClientDC : public wxWindowDC
{
public:
- wxClientDC() { }
+ wxClientDC();
wxClientDC( wxWindow *win );
protected:
class wxToolBar;
class wxStatusBar;
-class wxFrame;
-
//-----------------------------------------------------------------------------
-// wxFrame
+// wxFrameGTK
//-----------------------------------------------------------------------------
-class wxFrame : public wxFrameBase
+class wxFrameGTK : public wxFrameBase
{
public:
// construction
- wxFrame() { Init(); }
- wxFrame(wxWindow *parent,
- wxWindowID id,
- const wxString& title,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_FRAME_STYLE,
- const wxString& name = wxFrameNameStr)
+ wxFrameGTK() { Init(); }
+ wxFrameGTK(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
{
Init();
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
- virtual ~wxFrame();
+ virtual ~wxFrameGTK();
// implement base class pure virtuals
virtual void Maximize(bool maximize = TRUE);
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
virtual bool IsFullScreen() const { return m_fsIsShowing; };
+#if wxUSE_MENUS
virtual void SetMenuBar( wxMenuBar *menuBar );
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual void PositionStatusBar();
bool m_isIconized;
private:
- DECLARE_DYNAMIC_CLASS(wxFrame)
+ DECLARE_DYNAMIC_CLASS(wxFrameGTK)
};
#endif // __GTKFRAMEH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_NOTEBOOK
-
-#include "wx/object.h"
-#include "wx/string.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxImageList;
-class wxNotebook;
-
-typedef wxWindow wxNotebookPage; // so far, any window can be a page
-
//-----------------------------------------------------------------------------
// internal class
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
-class wxNotebook : public wxControl
+class wxNotebook : public wxNotebookBase
{
public:
// default for dynamic class
// accessors
// ---------
- // get number of pages in the dialog
- int GetPageCount() const;
// set the currently selected page, return the index of the previously
// selected one (or -1 on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(int nPage);
- // cycle thru the tabs
- void AdvanceSelection(bool bForward = TRUE);
// get the currently selected page
int GetSelection() const;
// associate image list with a control
void SetImageList(wxImageList* imageList);
void AssignImageList(wxImageList* imageList);
- // get pointer (may be NULL) to the associated image list
- wxImageList *GetImageList() const { return m_imageList; }
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
bool SetPageImage(int nPage, int nImage);
- // currently it's always 1 because wxGTK doesn't support multi-row
- // tab controls
- int GetRowCount() const;
-
// control the appearance of the notebook pages
// set the size (the same for all pages)
void SetPageSize(const wxSize& size);
// operations
// ----------
- // remove one page from the notebook but do not destroy it
- bool RemovePage(int nPage);
// remove one page from the notebook
bool DeletePage(int nPage);
// remove all pages
bool DeleteAllPages();
-
+
// adds a new page to the notebook (it will be deleted ny the notebook,
// don't delete it yourself). If bSelect, this page becomes active.
bool AddPage( wxNotebookPage *win,
bool bSelect = FALSE,
int imageId = -1 );
- // get the panel which represents the given page
- wxNotebookPage *GetPage(int nPage) const;
-
// handler for tab navigation
// --------------------------
void OnNavigationKey(wxNavigationKeyEvent& event);
void ApplyWidgetStyle();
- // report if window belongs to notebook
+ // report if window belongs to notebook
bool IsOwnGtkWindow( GdkWindow *window );
// common part of all ctors
// helper function
wxGtkNotebookPage* GetNotebookPage(int page) const;
- wxImageList* m_imageList;
bool m_ownsImageList;
wxList m_pages;
// selection internally instead of querying the notebook for it
int m_selection;
+protected:
+ // remove one page from the notebook but do not destroy it
+ virtual wxNotebookPage *DoRemovePage(int nPage);
+
private:
DECLARE_DYNAMIC_CLASS(wxNotebook)
DECLARE_EVENT_TABLE()
};
-#endif
-
#endif
// __GTKNOTEBOOKH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_RADIOBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
#include "wx/bitmap.h"
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxRadioBox;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxRadioBoxNameStr;
-
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection( const wxString& s );
- virtual int Number() const;
+ int Number() const;
+ int GetCount() const { return Number(); }
int GetNumberOfRowsOrCols() const;
void SetNumberOfRowsOrCols( int n );
DECLARE_DYNAMIC_CLASS(wxRadioBox)
};
-#endif
-
#endif // __GTKRADIOBOXH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_RADIOBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxRadioButton;
-
-//-----------------------------------------------------------------------------
-// data
-//-----------------------------------------------------------------------------
-
-extern const char* wxRadioButtonNameStr;
-
//-----------------------------------------------------------------------------
// wxRadioButton
//-----------------------------------------------------------------------------
DECLARE_DYNAMIC_CLASS(wxRadioButton)
};
-#endif
-
#endif // __GTKRADIOBUTTONH__
enum wxRegionContain
{
- wxOutRegion = 0,
- wxPartRegion = 1,
+ wxOutRegion = 0,
+ wxPartRegion = 1,
wxInRegion = 2
};
// So far, for internal use only
-enum wxRegionOp
+enum wxRegionOp
{
wxRGN_AND, // Creates the intersection of the two combined regions.
wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
};
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxRegion
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
class wxRegion : public wxGDIObject
{
wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight );
wxRegion( const wxRect& rect );
wxRegion();
- ~wxRegion();
+ virtual ~wxRegion();
- inline wxRegion( const wxRegion& r ): wxGDIObject()
- { Ref(r); }
- inline wxRegion& operator = ( const wxRegion& r )
- { Ref(r); return (*this); }
+ wxRegion( const wxRegion& r ) { Ref(r); }
+ wxRegion& operator = ( const wxRegion& r ) { Ref(r); return *this; }
bool operator == ( const wxRegion& region );
bool operator != ( const wxRegion& region );
public:
wxList *GetRectList() const;
GdkRegion *GetRegion() const;
-
+
+protected:
+ // helper of Intersect()
+ bool IntersectRegionOnly(const wxRegion& reg);
+
+ // call this before modifying the region
+ void Unshare();
+
private:
- DECLARE_DYNAMIC_CLASS(wxRegion);
+ DECLARE_DYNAMIC_CLASS(wxRegion);
};
+// ----------------------------------------------------------------------------
+// wxRegionIterator: decomposes a region into rectangles
+// ----------------------------------------------------------------------------
+
class wxRegionIterator: public wxObject
{
public:
wxCoord GetWidth() const { return GetW(); }
wxCoord GetH() const;
wxCoord GetHeight() const { return GetH(); }
- wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
+ wxRect GetRect() const;
private:
size_t m_current;
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/defs.h"
-#if wxUSE_SCROLLBAR
-
-#include "wx/object.h"
-#include "wx/control.h"
-
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxScrollBar;
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxScrollBarNameStr;
-
//-----------------------------------------------------------------------------
// wxScrollBar
//-----------------------------------------------------------------------------
-class wxScrollBar: public wxControl
+class wxScrollBar: public wxScrollBarBase
{
public:
- wxScrollBar()
+ wxScrollBar()
{ m_adjust = (GtkAdjustment *) NULL; m_oldPos = 0.0; }
inline wxScrollBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
// Backward compatibility
// ----------------------
-
+
int GetValue(void) const;
void SetValue( int viewStart );
void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const;
// implementation
// --------------
-
+
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
-
+
GtkAdjustment *m_adjust;
float m_oldPos;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxScrollBar)
};
-#endif
-
#endif
// __GTKSCROLLBARH__
/////////////////////////////////////////////////////////////////////////////
-// Name: slider.h
+// Name: wx/gtk/slider.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSLIDERH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_SLIDER
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxSlider;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxSliderNameStr;
-
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxSlider
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-class wxSlider: public wxControl
+class wxSlider : public wxSliderBase
{
public:
- wxSlider() {}
- inline wxSlider( wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr )
+ wxSlider() { }
+ wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr)
{
- Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name );
+ Create( parent, id, value, minValue, maxValue,
+ pos, size, style, validator, name );
}
- bool Create(wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr );
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+
+ // implement the base class pure virtuals
virtual int GetValue() const;
- virtual void SetValue( int );
- void SetRange( int minValue, int maxValue );
- int GetMin() const;
- int GetMax() const;
- void SetTickFreq( int n, int pos );
- int GetTickFreq() const;
- void SetPageSize( int pageSize );
- int GetPageSize() const;
- void ClearSel();
- void ClearTicks();
- void SetLineSize( int lineSize );
- int GetLineSize() const;
- int GetSelEnd() const;
- int GetSelStart() const;
- void SetSelection( int minPos, int maxPos );
- void SetThumbLength( int len );
- int GetThumbLength() const;
- void SetTick( int tickPos );
+ virtual void SetValue(int value);
+
+ virtual void SetRange(int minValue, int maxValue);
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ virtual void SetLineSize(int lineSize);
+ virtual void SetPageSize(int pageSize);
+ virtual int GetLineSize() const;
+ virtual int GetPageSize() const;
+
+ virtual void SetThumbLength(int lenPixels);
+ virtual int GetThumbLength() const;
// implementation
// --------------
DECLARE_DYNAMIC_CLASS(wxSlider)
};
-#endif
-
#endif // __GTKSLIDERH__
/////////////////////////////////////////////////////////////////////////////
-// Name: spinbutt.h
+// Name: wx/gtk/spinbutt.h
// Purpose: wxSpinButton class
// Author: Robert Roebling
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifndef __GTKSPINBUTTH__
-#define __GTKSPINBUTTH__
+#ifndef _WX_GTK_SPINBUTT_H_
+#define _WX_GTK_SPINBUTT_H_
#ifdef __GNUG__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_SPINBTN
-
-#include "wx/control.h"
-
//-----------------------------------------------------------------------------
// wxSpinButton
//-----------------------------------------------------------------------------
{
public:
wxSpinButton() { }
- wxSpinButton( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
+ wxSpinButton(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = wxSPIN_BUTTON_NAME)
{
Create(parent, id, pos, size, style, name);
}
- bool Create( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton" );
+ bool Create(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = wxSPIN_BUTTON_NAME);
virtual int GetValue() const;
virtual void SetValue( int value );
};
#endif
- // wxUSE_SPINBTN
-
-#endif
- // __GTKSPINBUTTH__
+ // _WX_GTK_SPINBUTT_H_
/////////////////////////////////////////////////////////////////////////////
-// Name: statbmp.h
+// Name: wx/gtk/statbmp.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_STATBMP
-
-#include "wx/object.h"
-#include "wx/control.h"
-#include "wx/bitmap.h"
#include "wx/icon.h"
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxStaticBitmap;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char* wxStaticBitmapNameStr;
-
//-----------------------------------------------------------------------------
// wxStaticBitmap
//-----------------------------------------------------------------------------
-class wxStaticBitmap: public wxControl
+class wxStaticBitmap : public wxStaticBitmapBase
{
- DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
-
public:
wxStaticBitmap();
wxStaticBitmap( wxWindow *parent,
long style = 0,
const wxString& name = wxStaticBitmapNameStr);
+ virtual void SetIcon(const wxIcon& icon) { SetBitmap( icon ); }
virtual void SetBitmap( const wxBitmap& bitmap );
-
- wxBitmap& GetBitmap() { return m_bitmap; }
- const wxBitmap& GetBitmap() const { return m_bitmap; }
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
// for compatibility with wxMSW
- const wxIcon& GetIcon() const
+ wxIcon GetIcon() const
{
// don't use wxDynamicCast, icons and bitmaps are really the same thing
// in wxGTK
return (const wxIcon &)m_bitmap;
}
- // for compatibility with wxMSW
- void SetIcon(const wxIcon& icon)
- {
- SetBitmap( icon );
- }
-
-protected:
- virtual wxSize DoGetBestSize() const;
-
private:
// creates the new pixmap widget
void CreatePixmapWidget();
wxBitmap m_bitmap;
-};
-#endif
+ DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
+};
#endif // __GTKSTATICBITMAPH__
/////////////////////////////////////////////////////////////////////////////
-// Name: stabox.h
+// Name: wx/gtk/stabox.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#pragma interface
#endif
-#include "wx/defs.h"
-
-#if wxUSE_STATBOX
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxStaticBox;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxStaticBoxNameStr;
-
//-----------------------------------------------------------------------------
// wxStaticBox
//-----------------------------------------------------------------------------
-class wxStaticBox: public wxControl
+class wxStaticBox : public wxStaticBoxBase
{
- DECLARE_DYNAMIC_CLASS(wxStaticBox)
-
- public:
+public:
+ wxStaticBox();
+ wxStaticBox( wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticBoxNameStr );
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticBoxNameStr );
+
+ virtual void SetLabel( const wxString &label );
+
+ // implementation
- wxStaticBox(void);
- wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label,
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- long style = 0, const wxString &name = wxStaticBoxNameStr );
- bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- long style = 0, const wxString &name = wxStaticBoxNameStr );
- void SetLabel( const wxString &label );
-
- // implementation
-
void ApplyWidgetStyle();
-};
-#endif
+private:
+ DECLARE_DYNAMIC_CLASS(wxStaticBox)
+};
#endif // __GTKSTATICBOXH__
// global data
//-----------------------------------------------------------------------------
-extern const wxChar *wxStaticTextNameStr;
-
//-----------------------------------------------------------------------------
// wxStaticText
//-----------------------------------------------------------------------------
virtual void Cut();
virtual void Paste();
- virtual bool CanCopy() const;
- virtual bool CanCut() const;
- virtual bool CanPaste() const;
-
// Undo/redo
virtual void Undo();
virtual void Redo();
/////////////////////////////////////////////////////////////////////////////
-// Name: window.h
+// Name: wx/gtk/window.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// callback definition for inserting a window (internal)
//-----------------------------------------------------------------------------
-typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
+class wxWindowGTK;
+typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
//-----------------------------------------------------------------------------
-// wxWindow
+// wxWindowGTK
//-----------------------------------------------------------------------------
-class wxWindow : public wxWindowBase
+class wxWindowGTK : public wxWindowBase
{
- DECLARE_DYNAMIC_CLASS(wxWindow)
-
public:
// creating the window
// -------------------
- wxWindow();
- wxWindow(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxPanelNameStr);
+ wxWindowGTK();
+ wxWindowGTK(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
- virtual ~wxWindow();
+ virtual ~wxWindowGTK();
// implement base class (pure) virtual methods
// -------------------------------------------
const wxFont *theFont = (const wxFont *) NULL)
const;
+#if wxUSE_MENUS
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
+#endif // wxUSE_MENUS
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE );
virtual void OnParentEnable( bool WXUNUSED(enable) ) {};
/* used by all window classes in the widget creation process */
- bool PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size );
+ bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
void PostCreation();
/* internal addition of child windows. differs from class
to class not by using virtual functions but by using
the m_insertCallback */
- void DoAddChild(wxWindow *child);
+ void DoAddChild(wxWindowGTK *child);
/* the methods below are required because many native widgets
are composed of several subwidgets and setting a style for
void Init();
private:
- DECLARE_NO_COPY_CLASS(wxWindow);
+ DECLARE_DYNAMIC_CLASS(wxWindowGTK)
+ DECLARE_NO_COPY_CLASS(wxWindowGTK);
};
#endif // __GTKWINDOWH__
#include "wx/motif/icon.h"
#elif defined(__WXGTK__)
#include "wx/gtk/icon.h"
+#elif defined(__WXMGL__)
+ #include "wx/mgl/icon.h"
#elif defined(__WXQT__)
#include "wx/qt/icon.h"
#elif defined(__WXMAC__)
// wxXPMHandler
//-----------------------------------------------------------------------------
-#if wxUSE_XPM
class WXDLLEXPORT wxXPMHandler : public wxImageHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMHandler)
virtual bool DoCanRead( wxInputStream& stream );
#endif
};
-#endif // wxUSE_XPM
#endif
virtual void SetSelection(int n, bool select = TRUE) = 0;
virtual void Select(int n) { SetSelection(n, TRUE); }
void Deselect(int n) { SetSelection(n, FALSE); }
+ void DeselectAll(int itemToLeaveSelected = -1);
virtual bool SetStringSelection(const wxString& s, bool select = TRUE);
// GetSelection which only works for listboxes with single selection)
virtual int GetSelections(wxArrayInt& aSelections) const = 0;
- // Set the specified item at the first visible item or scroll to max
+ // set the specified item at the first visible item or scroll to max
// range.
void SetFirstItem(int n) { DoSetFirstItem(n); }
void SetFirstItem(const wxString& s);
+ // ensures that the given item is visible scrolling the listbox if
+ // necessary
+ virtual void EnsureVisible(int n);
+
+ // a combination of Append() and EnsureVisible(): appends the item to the
+ // listbox and ensures that it is visible i.e. not scrolled out of view
+ void AppendAndEnsureVisible(const wxString& s);
+
+ // return TRUE if the listbox allows multiple selection
+ bool HasMultipleSelection() const
+ {
+ return (m_windowStyle & wxLB_MULTIPLE) ||
+ (m_windowStyle & wxLB_EXTENDED);
+ }
+
+ // return TRUE if this listbox is sorted
+ bool IsSorted() const { return (m_windowStyle & wxLB_SORT) != 0; }
+
// emulate selecting or deselecting the item event.GetInt() (depending on
// event.GetExtraLong())
void Command(wxCommandEvent& event);
// include the platform-specific class declaration
// ----------------------------------------------------------------------------
-#if defined(__WXMSW__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/listbox.h"
+#elif defined(__WXMSW__)
#include "wx/msw/listbox.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/listbox.h"
#pragma interface "listctrlbase.h"
#endif
+#if wxUSE_LISTCTRL
+
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL ),
#define EVT_LIST_ITEM_ACTIVATED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL ),
+#endif // wxUSE_LISTCTRL
+
#endif
// _WX_LISTCTRL_H_BASE_
#if wxUSE_GUI
+#if wxUSE_TEXTCTRL
+
// log everything to a text window (GUI only of course)
class WXDLLEXPORT wxLogTextCtrl : public wxLog
{
wxTextCtrl *m_pTextCtrl;
};
+#endif // wxUSE_TEXTCTRL
+
// ----------------------------------------------------------------------------
// GUI log target, the default one for wxWindows programs
// ----------------------------------------------------------------------------
+
+#if wxUSE_LOGGUI
+
class WXDLLEXPORT wxLogGui : public wxLog
{
public:
m_bWarnings; // any warnings?
};
+#endif // wxUSE_LOGGUI
+
// ----------------------------------------------------------------------------
// (background) log window: this class forwards all log messages to the log
// target which was active when it was instantiated, but also collects them
// to the log window. This window has it's own menu which allows the user to
// close it, clear the log contents or save it to the file.
// ----------------------------------------------------------------------------
+
+#if wxUSE_LOGWINDOW
+
class WXDLLEXPORT wxLogWindow : public wxLog
{
public:
wxLogFrame *m_pLogFrame; // the log frame
};
+#endif // wxUSE_LOGWINDOW
+
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
#pragma interface "menubase.h"
#endif
+#if wxUSE_MENUS
+
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/menuitem.h"
class WXDLLEXPORT wxMenu;
+class WXDLLEXPORT wxMenuBarBase;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxMenuItem;
wxMenuItemList& GetMenuItems() { return m_items; }
// search
- virtual int FindItem(const wxString& itemString) const;
+ virtual int FindItem(const wxString& item) const;
wxMenuItem* FindItem(int id, wxMenu **menu = NULL) const;
// get/set items attributes
// menu or associated window will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL);
+ // get the menu bar this menu is attached to (may be NULL, always NULL for
+ // popup menus)
+ wxMenuBar *GetMenuBar() const { return m_menuBar; }
+
+ // called when the menu is attached/detached to/from a menu bar
+ virtual void Attach(wxMenuBarBase *menubar);
+ virtual void Detach();
+
// is the menu attached to a menu bar (or is it a popup one)?
bool IsAttached() const { return m_menuBar != NULL; }
// pos != NULL
wxMenuItem *FindChildItem(int id, size_t *pos = NULL) const;
+ // called to generate a wxCommandEvent, return TRUE if it was processed,
+ // FALSE otherwise
+ //
+ // the checked parameter may have boolean value or -1 for uncheckable items
+ bool SendEvent(int id, int checked = -1);
+
protected:
// virtuals to override in derived classes
// ---------------------------------------
// common part of all ctors
void Init(long style);
-protected:
+ // associate the submenu with this menu
+ void AddSubMenu(wxMenu *submenu);
+
wxMenuBar *m_menuBar; // menubar we belong to or NULL
wxMenu *m_menuParent; // parent menu or NULL
// enable or disable a submenu
virtual void EnableTop(size_t pos, bool enable) = 0;
+ // is the menu enabled?
+ virtual bool IsEnabledTop(size_t pos) const { return TRUE; }
+
// get or change the label of the menu at given position
virtual void SetLabelTop(size_t pos, const wxString& label) = 0;
virtual wxString GetLabelTop(size_t pos) const = 0;
// by menu and item names, returns wxNOT_FOUND if not found or id of the
// found item
- virtual int FindMenuItem(const wxString& menuString,
- const wxString& itemString) const = 0;
+ virtual int FindMenuItem(const wxString& menu, const wxString& item) const;
// find item by id (in any menu), returns NULL if not found
//
// if menu is !NULL, it will be filled with wxMenu this item belongs to
- virtual wxMenuItem* FindItem(int id, wxMenu **menu = NULL) const = 0;
+ virtual wxMenuItem* FindItem(int id, wxMenu **menu = NULL) const;
// find menu by its caption, return wxNOT_FOUND on failure
int FindMenu(const wxString& title) const;
void SetHelpString(int id, const wxString& helpString);
wxString GetHelpString(int id) const;
+ // implementation helpers
+
+ // get the frame we are attached to (may return NULL)
+ wxFrame *GetFrame() const { return m_menuBarFrame; }
+
+ // returns TRUE if we're attached to a frame
+ bool IsAttached() const { return GetFrame() != NULL; }
+
+ // associate the menubar with the frame
+ virtual void Attach(wxFrame *frame);
+
+ // called before deleting the menubar normally
+ virtual void Detach();
+
// need to override these ones to avoid virtual function hiding
virtual bool Enable(bool enable = TRUE) { return wxWindow::Enable(enable); }
virtual void SetLabel(const wxString& s) { wxWindow::SetLabel(s); }
virtual wxString GetLabel() const { return wxWindow::GetLabel(); }
+ // don't want menu bars to accept the focus by tabbing to them
+ virtual bool AcceptsFocusFromKeyboard() const { return FALSE; }
+
// compatibility only: these functions are deprecated, use the new ones
// instead
#if WXWIN_COMPATIBILITY
protected:
// the list of all our menus
wxMenuList m_menus;
+
+ // the frame we are attached to (may be NULL)
+ wxFrame *m_menuBarFrame;
};
// ----------------------------------------------------------------------------
#ifdef wxUSE_BASE_CLASSES_ONLY
#define wxMenuItem wxMenuItemBase
#else // !wxUSE_BASE_CLASSES_ONLY
-#if defined(__WXMSW__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/menu.h"
+#elif defined(__WXMSW__)
#include "wx/msw/menu.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/menu.h"
#endif
#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
+#endif // wxUSE_MENUS
+
#endif
// _WX_MENU_H_BASE_
#ifndef _WX_MENUITEM_H_BASE_
#define _WX_MENUITEM_H_BASE_
+#if wxUSE_MENUS
+
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
const wxString& GetHelp() const { return m_help; }
#if wxUSE_ACCEL
+ // extract the accelerator from the given menu string, return NULL if none
+ // found
+ static wxAcceleratorEntry *GetAccelFromString(const wxString& label);
+
// get our accelerator or NULL (caller must delete the pointer)
- virtual wxAcceleratorEntry *GetAccel() const { return NULL; }
+ virtual wxAcceleratorEntry *GetAccel() const;
// set the accel for this item - this may also be done indirectly with
// SetText()
#ifdef wxUSE_BASE_CLASSES_ONLY
#define wxMenuItem wxMenuItemBase
#else // !wxUSE_BASE_CLASSES_ONLY
-#if defined(__WXMSW__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/menuitem.h"
+#elif defined(__WXMSW__)
#include "wx/msw/menuitem.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/menuitem.h"
#endif
#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
+#endif // wxUSE_MENUS
+
#endif
// _WX_MENUITEM_H_BASE_
#include "wx/defs.h"
+#if wxUSE_MIMETYPE
+
// the things we really need
#include "wx/string.h"
#include "wx/dynarray.h"
// the default mime manager for wxWindows programs
WXDLLEXPORT_DATA(extern wxMimeTypesManager *) wxTheMimeTypesManager;
+#endif // wxUSE_MIMETYPE
+
#endif
//_WX_MIMETYPE_H_
/////////////////////////////////////////////////////////////////////////////
-// Name: accel.h
+// Name: wx/msw/accel.h
// Purpose: wxAcceleratorTable class
// Author: Julian Smart
// Modified by:
#pragma interface "accel.h"
#endif
-#include "wx/object.h"
-
-class WXDLLEXPORT wxAcceleratorTable;
-
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// Hold Ctrl key down
-#define wxACCEL_ALT 0x01
-
-// Hold Ctrl key down
-#define wxACCEL_CTRL 0x02
-
- // Hold Shift key down
-#define wxACCEL_SHIFT 0x04
-
- // Hold no other key
-#define wxACCEL_NORMAL 0x00
-
-// ----------------------------------------------------------------------------
-// an entry in wxAcceleratorTable corresponds to one accelerator
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxAcceleratorEntry
-{
-public:
- wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
- {
- Set(flags, keyCode, cmd);
- }
-
- void Set(int flags, int keyCode, int cmd)
- {
- m_flags = flags; m_keyCode = keyCode; m_command = cmd;
- }
-
- int GetFlags() const { return m_flags; }
- int GetKeyCode() const { return m_keyCode; }
- int GetCommand() const { return m_command; }
-
-//private:
- int m_flags;
- int m_keyCode; // ASCII or virtual keycode
- int m_command; // Command id to generate
-};
-
// ----------------------------------------------------------------------------
// the accel table has all accelerators for a given window or menu
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxAcceleratorTable : public wxObject
{
-DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
public:
+ // default ctor
wxAcceleratorTable();
- wxAcceleratorTable(const wxString& resource); // Load from .rc resource
- wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array
- // Copy constructors
- inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
- inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
+ // copy ctor
+ wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
+
+ // load from .rc resource (Windows specific)
+ wxAcceleratorTable(const wxString& resource);
+
+ // initialize from array
+ wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
- ~wxAcceleratorTable();
+ virtual ~wxAcceleratorTable();
- inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if ( *this != accel ) Ref(accel); return *this; }
- inline bool operator == (const wxAcceleratorTable& accel) const { return m_refData == accel.m_refData; }
- inline bool operator != (const wxAcceleratorTable& accel) const { return m_refData != accel.m_refData; }
+ wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if ( *this != accel ) Ref(accel); return *this; }
+ bool operator==(const wxAcceleratorTable& accel) const
+ { return m_refData == accel.m_refData; } // FIXME: this is wrong (VZ)
+ bool operator!=(const wxAcceleratorTable& accel) const
+ { return !(*this == accel); }
bool Ok() const;
void SetHACCEL(WXHACCEL hAccel);
// translate the accelerator, return TRUE if done
bool Translate(wxWindow *window, WXMSG *msg) const;
-};
-WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
+private:
+ DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
+};
#endif
// _WX_ACCEL_H_
virtual int MainLoop();
virtual void ExitMainLoop();
virtual bool Initialized();
- virtual bool Pending() ;
- virtual void Dispatch() ;
+ virtual bool Pending();
+ virtual void Dispatch();
virtual wxIcon GetStdIcon(int which) const;
bool GetAuto3D() const { return m_auto3D; }
protected:
- bool m_showOnInit;
- int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
- bool m_auto3D ; // Always use 3D controls, except where overriden
+ bool m_showOnInit;
+ int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
+ bool m_auto3D ; // Always use 3D controls, except where overriden
/* Windows-specific wxApp definitions */
int m_nCmdShow;
protected:
- bool m_keepGoing ;
+ bool m_keepGoing;
DECLARE_EVENT_TABLE()
};
#include "wx/button.h"
#include "wx/bitmap.h"
-WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
-
#define wxDEFAULT_BUTTON_MARGIN 4
-class WXDLLEXPORT wxBitmapButton: public wxButton
+class WXDLLEXPORT wxBitmapButton: public wxBitmapButtonBase
{
- DECLARE_DYNAMIC_CLASS(wxBitmapButton)
-
public:
- wxBitmapButton() { m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN; }
- wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr)
+ wxBitmapButton()
+ { m_marginX = m_marginY = wxDEFAULT_BUTTON_MARGIN; }
+ wxBitmapButton(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBU_AUTODRAW,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
{
Create(parent, id, bitmap, pos, size, style, validator, name);
}
- bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr);
-
- virtual void SetLabel(const wxBitmap& bitmap)
- {
- SetBitmapLabel(bitmap);
- }
-
- virtual void SetBitmapLabel(const wxBitmap& bitmap);
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBU_AUTODRAW,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
#if WXWIN_COMPATIBILITY
- wxBitmap *GetBitmap() const { return (wxBitmap *) & m_buttonBitmap; }
+ wxBitmap *GetBitmap() const { return (wxBitmap *) & m_bmp; }
#endif
- wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }
- wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_buttonBitmapSelected; }
- wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
- wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
-
- void SetBitmapSelected(const wxBitmap& sel) { m_buttonBitmapSelected = sel; };
- void SetBitmapFocus(const wxBitmap& focus) { m_buttonBitmapFocus = focus; };
- void SetBitmapDisabled(const wxBitmap& disabled) { m_buttonBitmapDisabled = disabled; };
-
- void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
- int GetMarginX() const { return m_marginX; }
- int GetMarginY() const { return m_marginY; }
-
// Implementation
virtual void SetDefault();
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
-protected:
- wxBitmap m_buttonBitmap;
- wxBitmap m_buttonBitmapSelected;
- wxBitmap m_buttonBitmapFocus;
- wxBitmap m_buttonBitmapDisabled;
- int m_marginX;
- int m_marginY;
+private:
+ DECLARE_DYNAMIC_CLASS(wxBitmapButton)
};
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: button.h
+// Name: wx/msw/button.h
// Purpose: wxButton class
// Author: Julian Smart
// Modified by:
#pragma interface "button.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
-
// ----------------------------------------------------------------------------
// Pushbutton
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxButton : public wxControl
+class WXDLLEXPORT wxButton : public wxButtonBase
{
-DECLARE_DYNAMIC_CLASS(wxButton)
-
public:
wxButton() { }
- wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr)
+ wxButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
{
Create(parent, id, label, pos, size, style, validator, name);
}
- bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr);
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
virtual ~wxButton();
virtual void SetDefault();
- static wxSize GetDefaultSize();
-
// implementation from now on
virtual void Command(wxCommandEvent& event);
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
bool SendClickEvent();
virtual wxSize DoGetBestSize() const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxButton)
};
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: checkbox.h
+// Name: wx/msw/checkbox.h
// Purpose: wxCheckBox class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHECKBOX_H_
#pragma interface "checkbox.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxCheckBoxNameStr;
-
// Checkbox item (single checkbox)
class WXDLLEXPORT wxBitmap;
-class WXDLLEXPORT wxCheckBox : public wxControl
+class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase
{
-DECLARE_DYNAMIC_CLASS(wxCheckBox)
-
public:
wxCheckBox() { }
wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label,
protected:
virtual wxSize DoGetBestSize() const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxCheckBox)
};
class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
virtual void SetLabel(const wxBitmap& bitmap);
};
+
#endif
// _WX_CHECKBOX_H_
#if wxUSE_COMBOBOX
-WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
// ----------------------------------------------------------------------------
const wxBitmap& GetSelectedBitmap() const { return m_selectedBitmap; }
wxBitmap& GetSelectedBitmap() { return m_selectedBitmap; }
+ // update the internal clip box variables
+ void UpdateClipBox();
+
protected:
virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
int style = wxFLOOD_SURFACE);
// Create a DC corresponding to the client area of the window
wxClientDC(wxWindow *win);
+ virtual ~wxClientDC();
+
+protected:
+ void InitDC();
+
private:
DECLARE_DYNAMIC_CLASS(wxClientDC)
};
-class WXDLLEXPORT wxPaintDC : public wxWindowDC
+class WXDLLEXPORT wxPaintDC : public wxClientDC
{
public:
wxPaintDC();
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/frame.h
-// Purpose: wxFrame class
+// Purpose: wxFrameMSW class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
#pragma interface "frame.h"
#endif
-class WXDLLEXPORT wxFrame : public wxFrameBase
+class WXDLLEXPORT wxFrameMSW : public wxFrameBase
{
public:
// construction
- wxFrame() { Init(); }
- wxFrame(wxWindow *parent,
- wxWindowID id,
- const wxString& title,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_FRAME_STYLE,
- const wxString& name = wxFrameNameStr)
+ wxFrameMSW() { Init(); }
+ wxFrameMSW(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
{
Init();
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
- virtual ~wxFrame();
+ virtual ~wxFrameMSW();
// implement base class pure virtuals
virtual void Maximize(bool maximize = TRUE);
// helper
void DetachMenuBar();
+#if wxUSE_MENUS_NATIVE
// a plug in for MDI frame classes which need to do something special when
// the menubar is set
virtual void InternalSetMenuBar();
+#endif // wxUSE_MENUS_NATIVE
// propagate our state change to all child frames
void IconizeChildFrames(bool bIconize);
WXHWND m_hwndToolTip;
#endif // tooltips
+ DECLARE_DYNAMIC_CLASS(wxFrameMSW)
DECLARE_EVENT_TABLE()
- DECLARE_DYNAMIC_CLASS(wxFrame)
};
#endif
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Name: gauge.h
-// Purpose: wxGauge header, includes gauge class headers as appropriate
-// Author: Julian Smart
-// Modified by:
-// Created: 01/02/97
-// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _WX_GAUGE_H_
-#define _WX_GAUGE_H_
-
-#ifdef __GNUG__
-#pragma interface "gauge.h"
-#endif
-
-#ifdef __WIN95__
-#include "wx/msw/gauge95.h"
-#define wxGauge wxGauge95
-#define sm_classwxGauge sm_classwxGauge95
-#else
-#include "wx/msw/gaugemsw.h"
-#define wxGauge wxGaugeMSW
-#define sm_classwxGauge sm_classwxGaugeMSW
-#endif
-
-#endif
- // _WX_GAUGE_H_
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _GAUGE95_H_
#pragma interface "gauge95.h"
#endif
+#if wxUSE_SLIDER
+
#include "wx/control.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr;
int m_gaugePos;
};
+#endif // wxUSE_GAUGE
+
#endif
// _GAUGEMSW_H_
#pragma interface "listbox.h"
#endif
+#if wxUSE_LISTBOX
+
// ----------------------------------------------------------------------------
// simple types
// ----------------------------------------------------------------------------
virtual void SetupColours();
protected:
- // do we have multiple selections?
- bool HasMultipleSelection() const;
-
// free memory (common part of Clear() and dtor)
void Free();
DECLARE_DYNAMIC_CLASS(wxListBox)
};
+#endif // wxUSE_LISTBOX
+
#endif
// _WX_LISTBOX_H_
#define _WX_LISTCTRL_H_
#ifdef __GNUG__
-#pragma interface "listctrl.h"
+ #pragma interface "listctrl.h"
#endif
+#if wxUSE_LISTCTRL
+
#include "wx/control.h"
#include "wx/event.h"
#include "wx/hash.h"
DECLARE_EVENT_TABLE()
};
+#endif // wxUSE_LISTCTRL
+
#endif
// _WX_LISTCTRL_H_
virtual bool MSWTranslateMessage(WXMSG* msg);
protected:
+#if wxUSE_MENUS_NATIVE
virtual void InternalSetMenuBar();
+#endif // wxUSE_MENUS_NATIVE
wxMDIClientWindow * m_clientWindow;
wxMDIChildFrame * m_currentChild;
-// WXHMENU m_windowMenu;
wxMenu* m_windowMenu;
// TRUE if MDI Frame is intercepting commands, not child
}
#endif // wxUSE_MENU_CALLBACK
- // MSW-specific
- bool ProcessCommand(wxCommandEvent& event);
-
// implementation only from now on
// -------------------------------
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
- // attach/detach menu to/from wxMenuBar
- void Attach(wxMenuBar *menubar);
- void Detach();
-
#if wxUSE_ACCEL
// called by wxMenuBar to build its accel table from the accels of all menus
bool HasAccels() const { return !m_accels.IsEmpty(); }
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
virtual wxMenu *Remove(size_t pos);
- virtual int FindMenuItem(const wxString& menuString,
- const wxString& itemString) const;
- virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const;
-
virtual void EnableTop( size_t pos, bool flag );
virtual void SetLabelTop( size_t pos, const wxString& label );
virtual wxString GetLabelTop( size_t pos ) const;
// implementation from now on
WXHMENU Create();
- void Detach();
-
- // returns TRUE if we're attached to a frame
- bool IsAttached() const { return m_menuBarFrame != NULL; }
- // get the frame we live in
- wxFrame *GetFrame() const { return m_menuBarFrame; }
- // attach to a frame
- void Attach(wxFrame *frame);
+ virtual void Detach();
+ virtual void Attach(wxFrame *frame);
#if wxUSE_ACCEL
// get the accel table for all the menus
wxArrayString m_titles;
- wxFrame *m_menuBarFrame;
WXHMENU m_hMenu;
#if wxUSE_ACCEL
virtual void Check(bool bDoCheck = TRUE);
virtual bool IsChecked() const;
-#if wxUSE_ACCEL
- virtual wxAcceleratorEntry *GetAccel() const;
-#endif // wxUSE_ACCEL
-
// unfortunately needed to resolve ambiguity between
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
#include "wx/defs.h"
+#if wxUSE_MIMETYPE
+
#include "wx/mimetype.h"
// ----------------------------------------------------------------------------
wxFileType *CreateFileType(const wxString& filetype, const wxString& ext);
};
+#endif // wxUSE_MIMETYPE
#endif
//_MIMETYPE_IMPL_H
#pragma interface "notebook.h"
#endif
+#if wxUSE_NOTEBOOK
+
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/control.h"
-#include "wx/dynarray.h"
-
-// ----------------------------------------------------------------------------
-// types
-// ----------------------------------------------------------------------------
-
-// fwd declarations
-class WXDLLEXPORT wxImageList;
-class WXDLLEXPORT wxWindow;
-
-// array of notebook pages
-//typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page
-typedef wxWindow wxNotebookPage; // so far, any window can be a page
-
-WX_DEFINE_EXPORTED_ARRAY(wxNotebookPage *, wxArrayPages);
// ----------------------------------------------------------------------------
// wxNotebook
// ----------------------------------------------------------------------------
-// FIXME this class should really derive from wxTabCtrl, but the interface is not
-// exactly the same, so I can't do it right now and instead we reimplement
-// part of wxTabCtrl here
-class WXDLLEXPORT wxNotebook : public wxControl
+class WXDLLEXPORT wxNotebook : public wxNotebookBase
{
public:
// ctors
// selected one (or -1 on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(int nPage);
- // cycle thru the tabs
- void AdvanceSelection(bool bForward = TRUE);
// get the currently selected page
int GetSelection() const { return m_nSelection; }
// associate image list with a control
void SetImageList(wxImageList* imageList);
void AssignImageList(wxImageList* imageList);
- // get pointer (may be NULL) to the associated image list
- wxImageList* GetImageList() const { return m_pImageList; }
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
// ----------
// remove one page from the notebook
bool DeletePage(int nPage);
- // remove one page from the notebook, without deleting
- bool RemovePage(int nPage);
// remove all pages
bool DeleteAllPages();
// adds a new page to the notebook (it will be deleted ny the notebook,
const wxString& strText,
bool bSelect = FALSE,
int imageId = -1);
- // get the panel which represents the given page
- wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
// style.
// common part of all ctors
void Init();
+ // remove one page from the notebook, without deleting
+ virtual wxNotebookPage *DoRemovePage(int nPage);
+
// helper functions
void ChangePage(int nOldSel, int nSel); // change pages
- wxImageList *m_pImageList; // we can have an associated image list
- bool m_bOwnsImageList;
- wxArrayPages m_aPages; // array of pages
+ bool m_bOwnsImageList;
int m_nSelection; // the current selection (-1 if none)
DECLARE_EVENT_TABLE()
};
+#endif // wxUSE_NOTEBOOK
+
#endif // _NOTEBOOK_H
#define GetHfont() ((HFONT)GetHFONT())
#define GetHfontOf(font) ((HFONT)(font).GetHFONT())
+#define GetHrgn() ((HRGN)GetHRGN())
+#define GetHrgnOf(rgn) ((HRGN)(rgn).GetHRGN())
+
#endif // wxUSE_GUI
// ---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
-// Name: radiobox.h
+// Name: wx/msw/radiobox.h
// Purpose: wxRadioBox class
// Author: Julian Smart
// Modified by:
#pragma interface "radiobox.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxRadioBoxNameStr;
-
class WXDLLEXPORT wxBitmap;
-class WXDLLEXPORT wxRadioBox : public wxControl
-{
- DECLARE_DYNAMIC_CLASS(wxRadioBox)
+// ----------------------------------------------------------------------------
+// wxRadioBox
+// ----------------------------------------------------------------------------
+class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase
+{
public:
wxRadioBox();
- wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- int n = 0, const wxString choices[] = NULL,
- int majorDim = 0, long style = wxRA_HORIZONTAL,
- const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
+ wxRadioBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ int majorDim = 0,
+ long style = wxRA_HORIZONTAL,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr)
{
- Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
+ (void)Create(parent, id, title, pos, size, n, choices, majorDim,
+ style, val, name);
}
~wxRadioBox();
- bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- int n = 0, const wxString choices[] = NULL,
- int majorDim = 0, long style = wxRA_HORIZONTAL,
- const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
-
- virtual bool MSWCommand(WXUINT param, WXWORD id);
-
- int FindString(const wxString& s) const;
- void SetSelection(int N);
- int GetSelection() const;
- wxString GetString(int N) const;
-
- void GetSize(int *x, int *y) const;
- void GetPosition(int *x, int *y) const;
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ int majorDim = 0,
+ long style = wxRA_HORIZONTAL,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr);
+
+ // implement the radiobox interface
+ virtual void SetSelection(int n);
+ virtual int GetSelection() const;
+ virtual int GetCount() const;
+ virtual wxString GetString(int n) const;
+ virtual void SetString(int n, const wxString& label);
+ virtual void Enable(int n, bool enable = TRUE);
+ virtual void Show(int n, bool show = TRUE);
+ virtual int GetColumnCount() const;
+ virtual int GetRowCount() const;
- void SetLabel(int item, const wxString& label);
- void SetLabel(int item, wxBitmap *bitmap);
- wxString GetLabel(int item) const;
bool Show(bool show);
void SetFocus();
bool Enable(bool enable);
- void Enable(int item, bool enable);
- void Show(int item, bool show);
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
void SetButtonFont(const wxFont& font) { SetFont(font); }
- virtual wxString GetStringSelection() const;
- virtual bool SetStringSelection(const wxString& s);
- virtual int Number() const { return m_noItems; };
void Command(wxCommandEvent& event);
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
// implementation only from now on
// -------------------------------
+ virtual bool MSWCommand(WXUINT param, WXWORD id);
+
+ // FIXME: are they used? missing "Do" prefix?
+ void GetSize(int *x, int *y) const;
+ void GetPosition(int *x, int *y) const;
+
virtual bool SetFont(const wxFont& font);
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
- WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
+ WXUINT message,
+ WXWPARAM wParam, WXLPARAM lParam);
WXHWND *GetRadioButtons() const { return m_radioButtons; }
bool ContainsHWND(WXHWND hWnd) const;
void SendNotificationEvent();
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual wxSize DoGetBestSize() const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxRadioBox)
};
#endif
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RADIOBUT_H_
#pragma interface "radiobut.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxRadioButtonNameStr;
-
class WXDLLEXPORT wxRadioButton: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxRadioButton)
void Command(wxCommandEvent& event);
};
-// Not implemented
-#if 0
-class WXDLLEXPORT wxBitmap ;
-
-WXDLLEXPORT_DATA(extern const char*) wxBitmapRadioButtonNameStr;
-
-class WXDLLEXPORT wxBitmapRadioButton: public wxRadioButton
-{
- DECLARE_DYNAMIC_CLASS(wxBitmapRadioButton)
- protected:
- wxBitmap *theButtonBitmap;
- public:
- inline wxBitmapRadioButton(void) { theButtonBitmap = NULL; }
- inline wxBitmapRadioButton(wxWindow *parent, wxWindowID id,
- const wxBitmap *label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxBitmapRadioButtonNameStr)
- {
- Create(parent, id, label, pos, size, style, validator, name);
- }
-
- bool Create(wxWindow *parent, wxWindowID id,
- const wxBitmap *label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxBitmapRadioButtonNameStr);
-
- virtual void SetLabel(const wxBitmap *label);
- virtual void SetValue(bool val) ;
- virtual bool GetValue(void) const ;
-};
-#endif
-
#endif
// _WX_RADIOBUT_H_
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SCROLBAR_H_
#pragma interface "scrolbar.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxScrollBarNameStr;
-
// Scrollbar item
-class WXDLLEXPORT wxScrollBar: public wxControl
+class WXDLLEXPORT wxScrollBar: public wxScrollBarBase
{
DECLARE_DYNAMIC_CLASS(wxScrollBar)
// Recommended setting: 1
#define wxUSE_LONGLONG 1
+// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
+// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
+//
+// Default is 1
+//
+// Recommended setting: 1 (wxFile is highly recommended as it is required by
+// i18n code, wxFileConfig and others)
+#define wxUSE_FILE 1
+#define wxUSE_FFILE 1
+
+// use wxTextFile class: requires wxFile, required by wxFileConfig
+#define wxUSE_TEXTFILE 1
+
+// i18n support: _() macro, wxLocale class. Requires wxTextFile.
+#define wxUSE_INTL 1
+
// Set wxUSE_TIMEDATE to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards
// Recommended setting: 1
#define wxUSE_TIMEDATE 1
+// Set wxUSE_TIMER to 1 to compile wxTimer class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_TIMER 1
+
+// Use wxStopWatch clas.
+//
+// Default is 1
+//
+// Recommended setting: 1 (needed by wxSocket)
+#define wxUSE_STOPWATCH 1
+
// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes
// which allow the application to store its settings in the persistent
// storage. Setting this to 1 will also enable on-demand creation of the
// See also wxUSE_CONFIG_NATIVE below.
//
// Recommended setting: 1
-#define wxUSE_CONFIG 1
+#define wxUSE_CONFIG 1
// If wxUSE_CONFIG is 1, you may choose to use either the native config
// classes under Windows (using .INI files under Win16 and the registry under
// Recommended setting: 1 unless you don't like the license terms (unlikely)
#define wxUSE_APPLE_IEEE 1
-// Use wxFile class.
-//
-// Default is 1.
-//
-// Recommended setting: 1 (highly recommended, required i18n code, wxConfig...)
-#define wxUSE_FILE 1
-
-// use wxTextFile class: requires wxFile, required by wxFileConfig
-#define wxUSE_TEXTFILE 1
-
-// i18n support: _() macro, wxLocale class. Requires wxTextFile.
-#define wxUSE_INTL 1
-
// Joystick support class
#define wxUSE_JOYSTICK 1
-// Miscellaneous geometry code: needed for Canvas library
-#define wxUSE_GEOMETRY 1
+// wxFontMapper class
+#define wxUSE_FONTMAP 1
-// Use menus
-#define wxUSE_MENUS 1
+// wxMimeTypesManager class
+#define wxUSE_MIMETYPE 1
// ----------------------------------------------------------------------------
-// Optional controls
+// Individual GUI controls
// ----------------------------------------------------------------------------
+// You must set wxUSE_CONTROLS to 1 if you are using any controls at all
+// (without it, wxControl class is not compiled)
+//
+// Default is 1
+//
+// Recommended setting: 1 (don't change except for very special programs)
+#define wxUSE_CONTROLS 1
+
+// wxPopupWindow class is not used currently by wxMSW
+//
+// Default is 0
+//
+// Recommended setting: 0
+#define wxUSE_POPUPWIN 0
+
+// Each of the settings below corresponds to one wxWindows control. They are
+// all switched on by default but may be disabled if you are sure that your
+// program (including any standard dialogs it can show!) doesn't need them and
+// if you desperately want to save some space. If you use any of these you must
+// set wxUSE_CONTROLS as well.
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_BUTTON 1 // wxButton
+#define wxUSE_BMPBUTTON 1 // wxBitmapButton
+#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl
+#define wxUSE_CHECKBOX 1 // wxCheckBox
+#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN)
+#define wxUSE_CHOICE 1 // wxChoice
+#define wxUSE_COMBOBOX 1 // wxComboBox
+#define wxUSE_GAUGE 1 // wxGauge
+#define wxUSE_LISTBOX 1 // wxListBox
+#define wxUSE_LISTCTRL 1 // wxListCtrl
+#define wxUSE_RADIOBOX 1 // wxRadioBox
+#define wxUSE_RADIOBTN 1 // wxRadioButton
+#define wxUSE_SCROLLBAR 1 // wxScrollBar
+#define wxUSE_SLIDER 1 // wxSlider
+#define wxUSE_SPINBTN 1 // wxSpinButton
+#define wxUSE_SPINCTRL 1 // wxSpinCtrl
+#define wxUSE_STATBOX 1 // wxStaticBox
+#define wxUSE_STATLINE 1 // wxStaticLine
+#define wxUSE_STATTEXT 1 // wxStaticText
+#define wxUSE_STATBMP 1 // wxStaticBitmap
+#define wxUSE_TEXTCTRL 1 // wxTextCtrl
+#define wxUSE_TOGGLEBTN 1 // requires wxButton
+#define wxUSE_TREECTRL 1 // wxTreeCtrl
+
+// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
+// below either wxStatusBar95 or a generic wxStatusBar will be used.
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_STATUSBAR 1
+
+// Two status bar implementations are available under Win32: the generic one
+// or the wrapper around native control. For native look and feel the native
+// version should be used.
+//
+// Default is 1.
+//
+// Recommended setting: 1 (there is no advantage in using the generic one)
+#define wxUSE_NATIVE_STATUSBAR 1
+
// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar
// classes at all. Otherwise, use the native toolbar class unless
// wxUSE_TOOLBAR_NATIVE is 0. Additionally, the generic toolbar class which
#define wxUSE_TOOLBAR_NATIVE 1
#define wxUSE_TOOLBAR_SIMPLE 1
+// this setting is obsolete, value is ignored
+#define wxUSE_BUTTONBAR 1
+
// wxNotebook is a control with several "tabs" located on one of its sides. It
// may be used ot logically organise the data presented to the user instead of
// putting everything in one huge dialog. It replaces wxTabControl and related
// Recommended setting: 1
#define wxUSE_NOTEBOOK 1
-// The corresponding controls will be compiled in if wxUSE_<CONTROL> is set to
-// 1 and not compiled into the library otherwise.
-//
-// Default is 1 for everything.
-//
-// Recommended setting: 1 (library might fail to compile for some combinations
-// of disabled controls)
-#define wxUSE_CARET 1
-#define wxUSE_CHECKBOX 1
-#define wxUSE_CHECKLISTBOX 1 // requires wxUSE_OWNER_DRAWN
-#define wxUSE_CHOICE 1
-#define wxUSE_COMBOBOX 1
-#define wxUSE_GAUGE 1
-#define wxUSE_LISTBOX 1
-#define wxUSE_RADIOBOX 1
-#define wxUSE_RADIOBTN 1
-#define wxUSE_SASH 1 // wxSashWindow
-#define wxUSE_SCROLLBAR 1
-#define wxUSE_SLIDER 1
-#define wxUSE_SPINBTN 1
-#define wxUSE_SPINCTRL 1
-#define wxUSE_STATLINE 1
-#define wxUSE_STATUSBAR 1
-#define wxUSE_TOGGLEBTN 1 // requires wxButton
-#define wxUSE_TOOLTIPS 1 // wxToolTip and wxWindow::SetToolTip()
-
-// Two status bar implementations are available under Win32: the generic one
-// or the wrapper around native control. For native look and feel the native
-// version should be used.
+// wxTabDialog is a generic version of wxNotebook but it is incompatible with
+// the new class. It shouldn't be used in new code.
//
-// Default is 1.
+// Default is 0.
//
-// Recommended setting: 1
-#define wxUSE_NATIVE_STATUSBAR 1
-
-// this setting is obsolete, value is ignored
-#define wxUSE_BUTTONBAR 1
+// Recommended setting: 0 (use wxNotebook)
+#define wxUSE_TAB_DIALOG 0
// wxGrid class comes in two flavours: the original (pre wxWin 2.2) one and
// the new, much imporved and enhanced version. The new version is backwards
#define wxUSE_GRID 1
#define wxUSE_NEW_GRID 1
-// wxValidator class and related methods
-#define wxUSE_VALIDATORS 1
+// ----------------------------------------------------------------------------
+// Miscellaneous GUI stuff
+// ----------------------------------------------------------------------------
// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar)
#define wxUSE_ACCEL 1
+// Use wxCaret: a class implementing a "cursor" in a text control (called caret
+// under Windows).
+//
+// Default is 1.
+//
+// Recommended setting: 1 (can be safely set to 0, not used by the library)
+#define wxUSE_CARET 1
+
+// Miscellaneous geometry code: needed for Canvas library
+#define wxUSE_GEOMETRY 1
+
+// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and
+// wxListCtrl.
+//
+// Default is 1.
+//
+// Recommended setting: 1 (set it to 0 if you don't use any of the controls
+// enumerated above, then this class is mostly useless too)
+#define wxUSE_IMAGLIST 1
+
+// Use wxMenu, wxMenuBar, wxMenuItem.
+//
+// Default is 1.
+//
+// Recommended setting: 1 (can't be disabled under MSW)
+#define wxUSE_MENUS 1
+
+// Use wxSashWindow class.
+//
+// Default is 1.
+//
+// Recommended setting: 1
+#define wxUSE_SASH 1
+
+// Use wxSplitterWindow class.
+//
+// Default is 1.
+//
+// Recommended setting: 1
+#define wxUSE_SPLITTER 1
+
+// Use wxToolTip and wxWindow::Set/GetToolTip() methods.
+//
+// Default is 1.
+//
+// Recommended setting: 1
+#define wxUSE_TOOLTIPS 1
+
+// wxValidator class and related methods
+#define wxUSE_VALIDATORS 1
+
// ----------------------------------------------------------------------------
// common dialogs
// ----------------------------------------------------------------------------
// Recommended setting: 1 (unless it really doesn't work)
#define wxUSE_COMMON_DIALOGS 1
+// Use file open/save dialogs.
+//
+// Default is 1
+//
+// Recommended setting: 1 (used in many places in the library itself)
+#define wxUSE_FILEDLG 1
+
+// Use font picker dialog
+//
+// Default is 1
+//
+// Recommended setting: 1 (used in the library itself)
+#define wxUSE_FONTDLG 1
+
+// Use single/multiple choice dialogs.
+//
+// Default is 1
+//
+// Recommended setting: 1 (used in the library itself)
+#define wxUSE_CHOICEDLG 1
+
// text entry dialog and wxGetTextFromUser function
#define wxUSE_TEXTDLG 1
// wxTreeLayout class
#define wxUSE_TREELAYOUT 1
+// ----------------------------------------------------------------------------
+// Data transfer
+// ----------------------------------------------------------------------------
+
+// Use wxClipboard class for clipboard copy/paste.
+//
+// Default is 1.
+//
+// Recommended setting: 1
+#define wxUSE_CLIPBOARD 1
+
+// Use wxDataObject and related classes. Needed for clipboard and OLE drag and
+// drop
+//
+// Default is 1.
+//
+// Recommended setting: 1
+#define wxUSE_DATAOBJ 1
+
+// Use wxDropTarget and wxDropSource classes for drag and drop (this is
+// different from "built in" drag and drop in wxTreeCtrl which is always
+// available). Requires wxUSE_DATAOBJ.
+//
+// Default is 1.
+//
+// Recommended setting: 1
+#define wxUSE_DRAG_AND_DROP 1
+
// ----------------------------------------------------------------------------
// miscellaneous settings
// ----------------------------------------------------------------------------
#define wxUSE_CONSTRAINTS 1
// 0 for no window layout constraint system
-#define wxUSE_CLIPBOARD 1
- // 0 for no clipboard functions
-
#define wxUSE_SPLINES 1
// 0 for no splines
-#define wxUSE_DRAG_AND_DROP 1
- // 0 for no drag and drop
+#define wxUSE_XPM_IN_MSW 1
+ // 0 for no XPM support in wxBitmap.
+ // Default is 1, as XPM is now fully
+ // supported this makes easier the issue
+ // of portable icons and bitmaps.
#define wxUSE_IMAGE_LOADING_IN_MSW 1
// Use dynamic DIB loading/saving code in utils/dib under MSW.
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Name: slider.h
-// Purpose: wxSlider header, includes slider class headers as appropriate
-// Author: Julian Smart
-// Modified by:
-// Created: 01/02/97
-// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _SLIDER_H_
-#define _SLIDER_H_
-
-#ifdef __GNUG__
-#pragma interface "slider.h"
-#endif
-
-#ifdef __WIN95__
-#include "wx/msw/slider95.h"
-#define wxSlider wxSlider95
-#define sm_classwxSlider sm_classwxSlider95
-#else
-#include "wx/msw/slidrmsw.h"
-#define wxSlider wxSliderMSW
-#define sm_classwxSlider sm_classwxSliderMSW
-#endif
-
-#endif
- // _SLIDER_H_
/////////////////////////////////////////////////////////////////////////////
-// Name: slider95.h
+// Name: wx/msw/slider95.h
// Purpose: wxSlider95 class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _SLIDER95_H_
#pragma interface "slider95.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr;
-
// Slider
-class WXDLLEXPORT wxSlider95 : public wxControl
+class WXDLLEXPORT wxSlider95 : public wxSliderBase
{
- DECLARE_DYNAMIC_CLASS(wxSlider95)
-
public:
wxSlider95();
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
+
+ DECLARE_DYNAMIC_CLASS(wxSlider95)
};
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: slidrmsw.h
+// Name: wx/msw/slidrmsw.h
// Purpose: wxSliderMSW class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _SLIDRMSW_H_
#pragma interface "slidrmsw.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr;
-
// Slider
-class WXDLLEXPORT wxSliderMSW : public wxControl
+class WXDLLEXPORT wxSliderMSW : public wxSliderBase
{
- DECLARE_DYNAMIC_CLASS(wxSliderMSW)
-
public:
wxSliderMSW();
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr);
- virtual int GetValue() const ;
+ virtual int GetValue() const;
virtual void SetValue(int);
- void GetSize(int *x, int *y) const ;
- void GetPosition(int *x, int *y) const ;
+ void GetSize(int *x, int *y) const;
+ void GetPosition(int *x, int *y) const;
bool Show(bool show);
int GetMax() const { return m_rangeMax; }
// For trackbars only
- void SetTickFreq(int n, int pos);
- int GetTickFreq() const { return m_tickFreq; }
void SetPageSize(int pageSize);
- int GetPageSize() const ;
- void ClearSel() ;
- void ClearTicks() ;
+ int GetPageSize() const;
void SetLineSize(int lineSize);
- int GetLineSize() const ;
- int GetSelEnd() const ;
- int GetSelStart() const ;
- void SetSelection(int minPos, int maxPos);
- void SetThumbLength(int len) ;
- int GetThumbLength() const ;
- void SetTick(int tickPos) ;
+ int GetLineSize() const;
// IMPLEMENTATION
WXHWND GetStaticMin() const { return m_staticMin; }
int m_rangeMax;
int m_pageSize;
int m_lineSize;
- int m_tickFreq;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
+
+ DECLARE_DYNAMIC_CLASS(wxSliderMSW)
};
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: spinbutt.h
+// Name: wx/univ/spinbutt.h
// Purpose: wxSpinButton class
// Author: Julian Smart
// Modified by:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
- const wxString& name = "wxSpinButton")
+ const wxString& name = wxSPIN_BUTTON_NAME)
{
Create(parent, id, pos, size, style, name);
}
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
- const wxString& name = "wxSpinButton");
+ const wxString& name = wxSPIN_BUTTON_NAME);
// accessors
/////////////////////////////////////////////////////////////////////////////
-// Name: statbmp.h
-// Purpose: wxStaticBitmap class
+// Name: wx/msw/statbmp.h
+// Purpose: wxStaticBitmap class for wxMSW
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
// a control showing an icon or a bitmap
-class WXDLLEXPORT wxStaticBitmap : public wxControl
+class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
{
- DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
-
public:
wxStaticBitmap() { Init(); }
virtual ~wxStaticBitmap() { Free(); }
- void SetIcon(const wxIcon& icon) { SetImage(&icon); }
- void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); }
+ virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); }
+ virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); }
// assert failure is provoked by an attempt to get an icon from bitmap or
// vice versa
- const wxIcon& GetIcon() const
+ wxIcon GetIcon() const
{ wxASSERT( m_isIcon ); return *(wxIcon *)m_image; }
- const wxBitmap& GetBitmap() const
+ wxBitmap GetBitmap() const
{ wxASSERT( !m_isIcon ); return *(wxBitmap *)m_image; }
- // overriden base class virtuals
- virtual bool AcceptsFocus() const { return FALSE; }
-
// IMPLEMENTATION
#ifdef __WIN16__
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
// we can have either an icon or a bitmap
bool m_isIcon;
wxGDIImage *m_image;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
};
#endif
#pragma interface "statbox.h"
#endif
-#include "wx/control.h"
-
-WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBoxNameStr;
-
// Group box
-class WXDLLEXPORT wxStaticBox : public wxControl
+class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase
{
-DECLARE_DYNAMIC_CLASS(wxStaticBox)
-
public:
wxStaticBox() { }
protected:
virtual wxSize DoGetBestSize() const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxStaticBox)
};
#endif
public:
wxStaticText() { }
- wxStaticText(wxWindow *parent, wxWindowID id,
- const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxStaticTextNameStr)
+ wxStaticText(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticTextNameStr)
{
Create(parent, id, label, pos, size, style, name);
}
- bool Create(wxWindow *parent, wxWindowID id,
- const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxStaticTextNameStr);
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticTextNameStr);
// accessors
void SetLabel(const wxString& label);
#pragma interface "treectrl.h"
#endif
+#if wxUSE_TREECTRL
+
#include "wx/textctrl.h"
#include "wx/dynarray.h"
#include "wx/treebase.h"
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
};
+#endif // wxUSE_TREECTRL
+
#endif
// _WX_TREECTRL_H_
/////////////////////////////////////////////////////////////////////////////
-// Name: window.h
+// Name: wx/msw/window.h
// Purpose: wxWindow class
// Author: Julian Smart
-// Modified by:
+// Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling,
+// elimination of Default(), ...
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
#pragma interface "window.h"
#endif
-// #include "wx/msw/winundef.h"
-
-// VZ: apparently some version of Windows send extra mouse move messages after
-// a mouse click. My tests under NT 4.0 and 95 didn't show it so I'm
-// tempted to think that it was just an effect of a poor mouse and so the
-// code to work around this is currently disabled - just define this as 1
-// to reenable it
+// [at least] some version of Windows send extra mouse move messages after
+// a mouse click or a key press - to temporarily fix this problem, set the
+// define below to 1
+//
+// a better solution should be found later...
#define wxUSE_MOUSEEVENT_HACK 0
-// ---------------------------------------------------------------------------
-// forward declarations
-// ---------------------------------------------------------------------------
-
-class WXDLLEXPORT wxButton;
+// when building wxUniv/MSW we don't want the code for native menu use to be
+// compiled in - it should only be used when building real wxMSW
+#ifdef __WXUNIVERSAL__
+ #define wxUSE_MENUS_NATIVE 0
+#else // __WXMSW__
+ #define wxUSE_MENUS_NATIVE wxUSE_MENUS
+#endif // __WXUNIVERSAL__/__WXMSW__
// ---------------------------------------------------------------------------
// constants
// wxWindow declaration for MSW
// ---------------------------------------------------------------------------
-class WXDLLEXPORT wxWindow : public wxWindowBase
+class WXDLLEXPORT wxWindowMSW : public wxWindowBase
{
public:
- wxWindow() { Init(); }
-
- wxWindow(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxPanelNameStr)
+ wxWindowMSW() { Init(); }
+
+ wxWindowMSW(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
{
Init();
Create(parent, id, pos, size, style, name);
}
- virtual ~wxWindow();
+ virtual ~wxWindowMSW();
bool Create(wxWindow *parent,
wxWindowID id,
virtual void SetFocus();
- virtual bool Reparent( wxWindowBase *newParent );
+ virtual bool Reparent(wxWindowBase *newParent);
virtual void WarpPointer(int x, int y);
virtual void CaptureMouse();
virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL );
+ virtual void Update();
virtual void Clear();
virtual bool SetCursor( const wxCursor &cursor );
const wxFont *theFont = (const wxFont *) NULL)
const;
+#if wxUSE_MENUS_NATIVE
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
+#endif // wxUSE_MENUS_NATIVE
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE );
void GetCaretPos(int *x, int *y) const;
#endif // wxUSE_CARET
+#ifndef __WXUNIVERSAL__
// Native resource loading (implemented in src/msw/nativdlg.cpp)
// FIXME: should they really be all virtual?
virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
wxWindow* GetWindowChild1(wxWindowID id);
wxWindow* GetWindowChild(wxWindowID id);
+#endif // __WXUNIVERSAL__
// a MSW only function which sends a size event to the window using its
// current size - this has an effect of refreshing the window layout
virtual void MSWDeviceToLogical(float *x, float *y) const;
#endif // WXWIN_COMPATIBILITY
+#ifndef __WXUNIVERSAL__
// Create an appropriate wxWindow from a HWND
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
// Make sure the window style reflects the HWND style (roughly)
virtual void AdoptAttributesFromHWND();
+#endif // __WXUNIVERSAL__
// Setup background and foreground colours correctly
virtual void SetupColours();
// initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX)
void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags);
+ // check if mouse is in the window
+ bool IsMouseInWindow() const;
+
protected:
// the window handle
WXHWND m_hWnd;
bool m_backgroundTransparent:1;
bool m_mouseInWindow:1;
bool m_doubleClickAllowed:1;
- bool m_winCaptured:1;
// the size of one page for scrolling
int m_xThumbSize;
// the helper functions used by HandleChar/KeyXXX methods
wxKeyEvent CreateKeyEvent(wxEventType evType, int id, WXLPARAM lp) const;
- DECLARE_DYNAMIC_CLASS(wxWindow);
- DECLARE_NO_COPY_CLASS(wxWindow);
+ DECLARE_DYNAMIC_CLASS(wxWindowMSW);
+ DECLARE_NO_COPY_CLASS(wxWindowMSW);
DECLARE_EVENT_TABLE()
};
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/notebook.h
+// Purpose: wxNotebook interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 01.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 1996-2000 wxWindows team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_NOTEBOOK_H_BASE_
#define _WX_NOTEBOOK_H_BASE_
// headers
// ----------------------------------------------------------------------------
-#include "wx/event.h" // the base class: wxNotifyEvent
+#include "wx/defs.h"
+
+#if wxUSE_NOTEBOOK
+
+#include "wx/control.h"
+#include "wx/dynarray.h"
+
+class WXDLLEXPORT wxImageList;
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+// array of notebook pages
+typedef wxWindow wxNotebookPage; // so far, any window can be a page
+
+WX_DEFINE_EXPORTED_ARRAY(wxNotebookPage *, wxArrayPages);
+
+#define wxNOTEBOOK_NAME _T("notebook")
+
+// ----------------------------------------------------------------------------
+// wxNotebookBase: define wxNotebook interface
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxNotebookBase : public wxControl
+{
+public:
+ // ctor
+ wxNotebookBase()
+ {
+ m_imageList = NULL;
+ }
+
+ // quasi ctor
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxNOTEBOOK_NAME);
+
+ // accessors
+ // ---------
+
+ // get number of pages in the dialog
+ int GetPageCount() const { return m_pages.GetCount(); }
+
+ // get the panel which represents the given page
+ wxNotebookPage *GetPage(int nPage) { return m_pages[nPage]; }
+
+ // get the currently selected page
+ virtual int GetSelection() const = 0;
+
+ // set/get the title of a page
+ virtual bool SetPageText(int nPage, const wxString& strText) = 0;
+ virtual wxString GetPageText(int nPage) const = 0;
+
+ // image list stuff: each page may have an image associated with it (all
+ // images belong to the same image list)
+ virtual void SetImageList(wxImageList* imageList)
+ {
+ m_imageList = imageList;
+ }
+
+ // get pointer (may be NULL) to the associated image list
+ wxImageList* GetImageList() const { return m_imageList; }
+
+ // sets/returns item's image index in the current image list
+ virtual int GetPageImage(int nPage) const = 0;
+ virtual bool SetPageImage(int nPage, int nImage) = 0;
+
+ // get the number of rows for a control with wxNB_MULTILINE style (not all
+ // versions support it - they will always return 1 then)
+ virtual int GetRowCount() const { return 1; }
+
+ // set the size (the same for all pages)
+ virtual void SetPageSize(const wxSize& size) = 0;
+
+ // set the padding between tabs (in pixels)
+ virtual void SetPadding(const wxSize& padding) = 0;
+
+ // set the size of the tabs for wxNB_FIXEDWIDTH controls
+ virtual void SetTabSize(const wxSize& sz) = 0;
+
+ // calculate the size of the notebook from the size of its page
+ virtual wxSize CalcSizeFromPage(const wxSize& sizePage)
+ {
+ // this was just taken from wxNotebookSizer::CalcMin() and is, of
+ // course, totally bogus - just like the original code was
+ wxSize sizeTotal = sizePage;
+ if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
+ sizeTotal.x += 90;
+ else
+ sizeTotal.y += 40;
+
+ return sizeTotal;
+ }
+
+ // operations
+ // ----------
+
+ // remove one page from the notebook and delete it
+ virtual bool DeletePage(int nPage)
+ {
+ wxNotebookPage *page = DoRemovePage(nPage);
+ if ( !page )
+ return FALSE;
+
+ delete page;
+
+ return TRUE;
+ }
+
+ // remove one page from the notebook, without deleting it
+ virtual bool RemovePage(int nPage) { return DoRemovePage(nPage) != NULL; }
+
+ // remove all pages and delete them
+ virtual bool DeleteAllPages() { WX_CLEAR_ARRAY(m_pages); return TRUE; }
+
+ // adds a new page to the notebook (it will be deleted by the notebook,
+ // don't delete it yourself) and make it the current one if bSelect
+ virtual bool AddPage(wxNotebookPage *pPage,
+ const wxString& strText,
+ bool bSelect = FALSE,
+ int imageId = -1)
+ {
+ return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
+ }
+
+ // the same as AddPage(), but adds the page at the specified position
+ virtual bool InsertPage(int nPage,
+ wxNotebookPage *pPage,
+ const wxString& strText,
+ bool bSelect = FALSE,
+ int imageId = -1) = 0;
+
+ // set the currently selected page, return the index of the previously
+ // selected one (or -1 on error)
+ //
+ // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
+ virtual int SetSelection(int nPage) = 0;
+
+ // cycle thru the tabs
+ void AdvanceSelection(bool forward = TRUE)
+ {
+ int nPage = GetNextPage(forward);
+ if ( nPage != -1 )
+ SetSelection(nPage);
+ }
+
+protected:
+ // remove the page and return a pointer to it
+ virtual wxNotebookPage *DoRemovePage(int page) = 0;
+
+ // get the next page wrapping if we reached the end
+ int GetNextPage(bool forward) const
+ {
+ int nPage;
+
+ int nMax = GetPageCount();
+ if ( nMax-- ) // decrement it to get the last valid index
+ {
+ int nSel = GetSelection();
+
+ // change selection wrapping if it becomes invalid
+ nPage = forward ? nSel == nMax ? 0
+ : nSel + 1
+ : nSel == 0 ? nMax
+ : nSel - 1;
+ }
+ else // notebook is empty, no next page
+ {
+ nPage = -1;
+ }
+
+ return nPage;
+ }
+
+ wxImageList *m_imageList; // we can have an associated image list
+ wxArrayPages m_pages; // array of pages
+};
// ----------------------------------------------------------------------------
// notebook event class (used by NOTEBOOK_PAGE_CHANGED/ING events)
// wxNotebook class itself
// ----------------------------------------------------------------------------
-#if defined(__WXMSW__)
-#ifdef __WIN16__
- #include "wx/generic/notebook.h"
-#else
- #include "wx/msw/notebook.h"
-#endif
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/notebook.h"
+#elif defined(__WXMSW__)
+ #ifdef __WIN16__
+ #include "wx/generic/notebook.h"
+ #else
+ #include "wx/msw/notebook.h"
+ #endif
#elif defined(__WXMOTIF__)
- #include "wx/generic/notebook.h"
+ #include "wx/generic/notebook.h"
#elif defined(__WXGTK__)
- #include "wx/gtk/notebook.h"
+ #include "wx/gtk/notebook.h"
#elif defined(__WXQT__)
- #include "wx/qt/notebook.h"
+ #include "wx/qt/notebook.h"
#elif defined(__WXMAC__)
- #include "wx/mac/notebook.h"
+ #include "wx/mac/notebook.h"
#elif defined(__WXPM__)
- #include "wx/os2/notebook.h"
+ #include "wx/os2/notebook.h"
#elif defined(__WXSTUBS__)
- #include "wx/stubs/notebook.h"
+ #include "wx/stubs/notebook.h"
#endif
+#endif // wxUSE_NOTEBOOK
+
#endif
// _WX_NOTEBOOK_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/popupwin.h
+// Purpose: wxPopupWindow interface declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.01.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// License: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_POPUPWIN_H_BASE_
+#define _WX_POPUPWIN_H_BASE_
+
+#ifdef __GNUG__
+ #pragma interface "popupwin.h"
+#endif
+
+#include "wx/window.h"
+
+#if wxUSE_POPUPWIN
+
+// ----------------------------------------------------------------------------
+// wxPopupWindow: a special kind of top level window used for popup menus,
+// combobox popups and such.
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxPopupWindowBase : public wxWindow
+{
+public:
+ wxPopupWindowBase() { }
+
+ // create the popup window
+ //
+ // style may only contain border flags
+ bool Create(wxWindow *parent, int style = wxBORDER_NONE);
+
+ // move the popup window to the right position, i.e. such that it is
+ // entirely visible
+ //
+ // the popup is positioned at ptOrigin + size if it opens below and to the
+ // right (default), at ptOrigin - sizePopup if it opens above and to the
+ // left &c
+ //
+ // the point must be given in screen coordinates!
+ virtual void Position(const wxPoint& ptOrigin,
+ const wxSize& size);
+};
+
+// include the real class declaration
+#ifdef __WXMSW__
+ #include "wx/msw/popupwin.h"
+#else
+ #error "wxPopupWindow is not supported under this platform."
+#endif
+
+// ----------------------------------------------------------------------------
+// wxPopupTransientWindow: a wxPopupWindow which disappears automatically
+// when the user clicks mouse outside it or if it loses focus in any other way
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxPopupTransientWindow : public wxPopupWindow
+{
+public:
+ // ctors
+ wxPopupTransientWindow() { Init(); }
+ wxPopupTransientWindow(wxWindow *parent);
+
+ virtual ~wxPopupTransientWindow();
+
+ // popup the window (this will show it too) and keep focus at winFocus
+ // (or itself if it's NULL), dismiss the popup if we lose focus
+ virtual void Popup(wxWindow *focus = NULL);
+
+ // hide the window
+ virtual void Dismiss();
+
+ // called when a mouse is pressed while the popup is shown: return TRUE
+ // from here to prevent its normal processing by the popup (which consists
+ // in dismissing it if the mouse is cilcked outside it)
+ virtual bool ProcessLeftDown(wxMouseEvent& event);
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // this is called when the popup is disappeared because of anything
+ // else but direct call to Dismiss()
+ virtual void OnDismiss();
+
+ // dismiss and notify the derived class
+ void DismissAndNotify();
+
+ // remove our event handlers
+ void PopHandlers();
+
+ // the child of this popup if any
+ wxWindow *m_child;
+
+ // the window which has the focus while we're shown
+ wxWindow *m_focus;
+
+ friend class wxPopupWindowHandler;
+ friend class wxPopupFocusHandler;
+};
+
+#if wxUSE_COMBOBOX
+
+// ----------------------------------------------------------------------------
+// wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxComboBox;
+class WXDLLEXPORT wxComboControl;
+
+class WXDLLEXPORT wxPopupComboWindow : public wxPopupTransientWindow
+{
+public:
+ wxPopupComboWindow(wxComboControl *parent);
+
+ bool Create(wxComboControl *parent);
+
+ // position the window correctly relatively to the combo
+ void PositionNearCombo();
+
+protected:
+ // notify the combo here
+ virtual void OnDismiss();
+
+ // the parent combobox
+ wxComboControl *m_combo;
+};
+
+#endif // wxUSE_COMBOBOX
+
+#endif // wxUSE_POPUPWIN
+
+#endif // _WX_POPUPWIN_H_BASE_
+
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/radiobox.h
+// Purpose: wxRadioBox declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.09.00
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_RADIOBOX_H_BASE_
#define _WX_RADIOBOX_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/radiobox.h"
+#ifdef __GNUG__
+ #pragma interface "radioboxbase.h"
+#endif
+
+#if wxUSE_RADIOBOX
+
+#include "wx/control.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxRadioBoxNameStr;
+
+// ----------------------------------------------------------------------------
+// wxRadioBoxBase is not a normal base class, but rather a mix-in because the
+// real wxRadioBox derives from different classes on different platforms: for
+// example, it is a wxStaticBox in wxUniv but not in wxMSW
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxRadioBoxBase
+{
+public:
+ // selection
+ virtual void SetSelection(int n) = 0;
+ virtual int GetSelection() const = 0;
+
+ virtual wxString GetStringSelection() const
+ {
+ wxString s;
+ int sel = GetSelection();
+ if ( sel != wxNOT_FOUND )
+ s = GetString(sel);
+
+ return s;
+ }
+
+ virtual bool SetStringSelection(const wxString& s)
+ {
+ int sel = FindString(s);
+ if ( sel != wxNOT_FOUND )
+ {
+ SetSelection(sel);
+
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ // string access
+ virtual int GetCount() const = 0;
+ virtual int FindString(const wxString& s) const
+ {
+ int count = GetCount();
+ for ( int n = 0; n < count; n++ )
+ {
+ if ( GetString(n) == s )
+ return n;
+ }
+
+ return wxNOT_FOUND;
+ }
+
+ virtual wxString GetString(int n) const = 0;
+ virtual void SetString(int n, const wxString& label) = 0;
+
+ // change the individual radio button state
+ virtual void Enable(int n, bool enable = TRUE) = 0;
+ virtual void Show(int n, bool show = TRUE) = 0;
+
+ // layout parameters
+ virtual int GetColumnCount() const = 0;
+ virtual int GetRowCount() const = 0;
+
+ // return the item above/below/to the left/right of the given one
+ int GetNextItem(int item, wxDirection dir, long style) const;
+
+ // for compatibility only, don't use these methods in new code!
+#ifdef WXWIN_COMPATIBILITY_2
+ int Number() const { return GetCount(); }
+ wxString GetLabel(int n) const { return GetString(n); }
+ void SetLabel(int n, const wxString& label) { SetString(n, label); }
+#endif // WXWIN_COMPATIBILITY_2
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/radiobox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/radiobox.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/radiobox.h"
+ #include "wx/motif/radiobox.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/radiobox.h"
+ #include "wx/gtk/radiobox.h"
#elif defined(__WXQT__)
-#include "wx/qt/radiobox.h"
+ #include "wx/qt/radiobox.h"
#elif defined(__WXMAC__)
-#include "wx/mac/radiobox.h"
+ #include "wx/mac/radiobox.h"
#elif defined(__WXPM__)
-#include "wx/os2/radiobox.h"
+ #include "wx/os2/radiobox.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/radiobox.h"
+ #include "wx/stubs/radiobox.h"
#endif
+#endif // wxUSE_RADIOBOX
+
#endif
// _WX_RADIOBOX_H_BASE_
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/radiobut.h
+// Purpose: wxRadioButton declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07.09.00
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_RADIOBUT_H_BASE_
#define _WX_RADIOBUT_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/radiobut.h"
+#if wxUSE_RADIOBTN
+
+/*
+ There is no wxRadioButtonBase class as wxRadioButton interface is the same
+ as of wxCheckBox(Base), but under some platforms wxRadioButton really
+ derives from wxCheckBox and on the others it doesn't.
+
+ The pseudo-declaration of wxRadioButtonBase would look like this:
+
+ class wxRadioButtonBase : public ...
+ {
+ public:
+ virtual void SetValue(bool value);
+ virtual bool GetValue() const;
+ };
+ */
+
+#include "wx/control.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxRadioButtonNameStr;
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/radiobut.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/radiobut.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/radiobut.h"
+ #include "wx/motif/radiobut.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/radiobut.h"
+ #include "wx/gtk/radiobut.h"
#elif defined(__WXQT__)
-#include "wx/qt/radiobut.h"
+ #include "wx/qt/radiobut.h"
#elif defined(__WXMAC__)
-#include "wx/mac/radiobut.h"
+ #include "wx/mac/radiobut.h"
#elif defined(__WXPM__)
-#include "wx/os2/radiobut.h"
+ #include "wx/os2/radiobut.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/radiobut.h"
+ #include "wx/stubs/radiobut.h"
#endif
+#endif // wxUSE_RADIOBTN
+
#endif
// _WX_RADIOBUT_H_BASE_
#ifndef _WX_SCROLBAR_H_BASE_
#define _WX_SCROLBAR_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/scrolbar.h"
+#if wxUSE_SCROLLBAR
+
+#include "wx/control.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxScrollBarNameStr;
+
+// ----------------------------------------------------------------------------
+// wxScrollBar: a scroll bar control
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxScrollBarBase : public wxControl
+{
+public:
+ // scrollbar construction
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSB_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxScrollBarNameStr);
+
+ // accessors
+ virtual int GetThumbPosition() const = 0;
+ virtual int GetThumbSize() const = 0;
+ virtual int GetPageSize() const = 0;
+ virtual int GetRange() const = 0;
+
+ bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; }
+
+ // operations
+ virtual void SetThumbPosition(int viewStart) = 0;
+ virtual void SetScrollbar(int position, int thumbSize,
+ int range, int pageSize,
+ bool refresh = TRUE) = 0;
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/scrolbar.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/scrolbar.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/scrolbar.h"
+ #include "wx/motif/scrolbar.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/scrolbar.h"
+ #include "wx/gtk/scrolbar.h"
#elif defined(__WXQT__)
-#include "wx/qt/scrolbar.h"
+ #include "wx/qt/scrolbar.h"
#elif defined(__WXMAC__)
-#include "wx/mac/scrolbar.h"
+ #include "wx/mac/scrolbar.h"
#elif defined(__WXPM__)
-#include "wx/os2/scrolbar.h"
+ #include "wx/os2/scrolbar.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/scrolbar.h"
+ #include "wx/stubs/scrolbar.h"
#endif
+#endif // wxUSE_SCROLLBAR
+
#endif
// _WX_SCROLBAR_H_BASE_
+/////////////////////////////////////////////////////////////////////////////
+// Name: include/wx/scrolwin.h
+// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 30.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_SCROLWIN_H_BASE_
#define _WX_SCROLWIN_H_BASE_
-#ifdef __WXGTK__
-#include "wx/gtk/scrolwin.h"
-#else
-#include "wx/generic/scrolwin.h"
-// For non-GTK+ platforms, always use wxGenericScrolledWindow
-class WXDLLEXPORT wxScrolledWindow: public wxGenericScrolledWindow
+#include "wx/window.h"
+
+class WXDLLEXPORT wxTimer;
+
+// ----------------------------------------------------------------------------
+// wxScrollHelper: this class implements the scrolling logic which is used by
+// wxScrolledWindow and wxScrolledControl. It is a mix-in: just derive from it
+// to implement scrolling in your class.
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxScrollHelper
{
public:
- DECLARE_CLASS(wxScrolledWindow)
- wxScrolledWindow() {};
- wxScrolledWindow(wxWindow *parent,
- wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxScrolledWindowStyle,
- const wxString& name = wxPanelNameStr)
+ // ctor and dtor
+ wxScrollHelper(wxWindow *winToScroll = (wxWindow *)NULL);
+ void SetWindow(wxWindow *winToScroll);
+ virtual ~wxScrollHelper();
+
+ // configure the scrolling
+ virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
+ int noUnitsX, int noUnitsY,
+ int xPos = 0, int yPos = 0,
+ bool noRefresh = FALSE );
+
+ // scroll to the given (in logical coords) position
+ virtual void Scroll(int x, int y);
+
+ // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
+ int GetScrollPageSize(int orient) const;
+ void SetScrollPageSize(int orient, int pageSize);
+
+ // get the size of one logical unit in physical ones
+ virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX,
+ int *pixelsPerUnitY) const;
+
+ // Enable/disable Windows scrolling in either direction. If TRUE, wxWindows
+ // scrolls the canvas and only a bit of the canvas is invalidated; no
+ // Clear() is necessary. If FALSE, the whole canvas is invalidated and a
+ // Clear() is necessary. Disable for when the scroll increment is used to
+ // actually scroll a non-constant distance
+ virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
+
+ // Get the view start
+ virtual void GetViewStart(int *x, int *y) const;
+
+ // Actual size in pixels when scrolling is taken into account
+ virtual void GetVirtualSize(int *x, int *y) const;
+
+ // Set the scale factor, used in PrepareDC
+ void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
+ double GetScaleX() const { return m_scaleX; }
+ double GetScaleY() const { return m_scaleY; }
+
+ // translate between scrolled and unscrolled coordinates
+ virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
+ virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
+
+ // Adjust the scrollbars
+ virtual void AdjustScrollbars(void);
+
+ // Calculate scroll increment
+ virtual int CalcScrollInc(wxScrollWinEvent& event);
+
+ // Normally the wxScrolledWindow will scroll itself, but in some rare
+ // occasions you might want it to scroll [part of] another window (e.g. a
+ // child of it in order to scroll only a portion the area between the
+ // scrollbars (spreadsheet: only cell area will move).
+ virtual void SetTargetWindow(wxWindow *target);
+ virtual wxWindow *GetTargetWindow() const;
+
+ void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; }
+ wxRect GetTargetRect() const { return m_rectToScroll; }
+
+ // Override this function to draw the graphic (or just process EVT_PAINT)
+ virtual void OnDraw(wxDC& WXUNUSED(dc)) { }
+
+ // change the DC origin according to the scroll position.
+ virtual void DoPrepareDC(wxDC& dc);
+
+ // are we generating the autoscroll events?
+ bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; }
+
+ // stop generating the scroll events when mouse is held outside the window
+ void StopAutoScrolling();
+
+ // this method can be overridden in a derived class to forbid sending the
+ // auto scroll events - note that unlike StopAutoScrolling() it doesn't
+ // stop the timer, so it will be called repeatedly and will typically
+ // return different values depending on the current mouse position
+ //
+ // the base class version just returns TRUE
+ virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
+
+ // the methods to be called from the window event handlers
+ void HandleOnScroll(wxScrollWinEvent& event);
+ void HandleOnSize(wxSizeEvent& event);
+ void HandleOnPaint(wxPaintEvent& event);
+ void HandleOnChar(wxKeyEvent& event);
+ void HandleOnMouseEnter(wxMouseEvent& event);
+ void HandleOnMouseLeave(wxMouseEvent& event);
+ void HandleOnMouseWheel(wxMouseEvent& event);
+
+protected:
+ // get pointer to our scroll rect if we use it or NULL
+ const wxRect *GetRect() const
+ {
+ return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL;
+ }
+
+ // get the size of the target window
+ wxSize GetTargetSize() const
{
- wxGenericScrolledWindow::Create(parent, id, pos, size, style, name);
+ return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize()
+ : m_targetWindow->GetClientSize();
}
+
+ void GetTargetSize(int *w, int *h)
+ {
+ wxSize size = GetTargetSize();
+ if ( w )
+ *w = size.x;
+ if ( h )
+ *h = size.y;
+ }
+
+ wxWindow *m_win,
+ *m_targetWindow;
+
+ wxRect m_rectToScroll;
+
+ wxTimer *m_timerAutoScroll;
+
+ int m_xScrollPixelsPerLine;
+ int m_yScrollPixelsPerLine;
+ int m_xScrollPosition;
+ int m_yScrollPosition;
+ int m_xScrollLines;
+ int m_yScrollLines;
+ int m_xScrollLinesPerPage;
+ int m_yScrollLinesPerPage;
+
+ bool m_xScrollingEnabled;
+ bool m_yScrollingEnabled;
+
+ double m_scaleX;
+ double m_scaleY;
};
-#define wxSCROLLED_WINDOW_IS_GENERIC 1
+
+// ----------------------------------------------------------------------------
+// wxScrolledWindow: a wxWindow which knows how to scroll
+// ----------------------------------------------------------------------------
+
+#ifdef __WXGTK__
+ #include "wx/gtk/scrolwin.h"
+#else // !wxGTK
+ #include "wx/generic/scrolwin.h"
+
+ class WXDLLEXPORT wxScrolledWindow : public wxGenericScrolledWindow
+ {
+ public:
+ wxScrolledWindow() { }
+ wxScrolledWindow(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxScrolledWindowStyle,
+ const wxString& name = wxPanelNameStr)
+ : wxGenericScrolledWindow(parent, id, pos, size, style, name)
+ {
+ }
+
+ private:
+ DECLARE_CLASS(wxScrolledWindow)
+ };
+
+ #define wxSCROLLED_WINDOW_IS_GENERIC 1
#endif
#endif
#error No __WXxxx__ define set! Please define one of __WXBASE__,__WXGTK__,__WXMSW__,__WXMOTIF__,__WXMAC__,__WXQT__,__WXPM__,__WXSTUBS__
#endif
-#ifdef __WXBASE__
+// wxUniversal is defined together with one of other ports, so test for it
+// first
+#ifdef __WXUNIVERSAL__
+#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__)
+#include "wx/univd/setup.h"
+#else
+#include "wx/univ/setup.h"
+#endif
+
+#elif defined(__WXBASE__)
#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__)
#include "wx/based/setup.h"
#else
#endif
#endif
-#endif
- /* _WX_SETUP_H_BASE_ */
+
+#include "chkconf.h"
+
+#endif /* _WX_SETUP_H_BASE_ */
// classes
//---------------------------------------------------------------------------
-class wxStaticBox;
-class wxNotebook;
-
class wxSizerItem;
class wxSizer;
class wxBoxSizer;
-class wxStaticBoxSizer;
//---------------------------------------------------------------------------
// wxSizerItem
{ DoSetMinSize( width, height ); }
void SetMinSize( wxSize size )
{ DoSetMinSize( size.x, size.y ); }
-
+
/* Searches recursively */
bool SetItemMinSize( wxWindow *window, int width, int height )
{ return DoSetItemMinSize( window, width, height ); }
bool SetItemMinSize( wxWindow *window, wxSize size )
{ return DoSetItemMinSize( window, size.x, size.y ); }
-
+
/* Searches recursively */
bool SetItemMinSize( wxSizer *sizer, int width, int height )
{ return DoSetItemMinSize( sizer, width, height ); }
bool SetItemMinSize( wxSizer *sizer, wxSize size )
{ return DoSetItemMinSize( sizer, size.x, size.y ); }
-
+
bool SetItemMinSize( int pos, int width, int height )
{ return DoSetItemMinSize( pos, width, height ); }
bool SetItemMinSize( int pos, wxSize size )
{ return DoSetItemMinSize( pos, size.x, size.y ); }
-
+
wxSize GetSize()
{ return m_size; }
wxPoint GetPosition()
{ return m_position; }
-
+
/* Calculate the minimal size or return m_minSize if bigger. */
wxSize GetMinSize();
virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
virtual bool DoSetItemMinSize( int pos, int width, int height );
-
+
private:
DECLARE_CLASS(wxSizer);
};
public:
wxGridSizer( int rows, int cols, int vgap, int hgap );
wxGridSizer( int cols, int vgap = 0, int hgap = 0 );
-
+
void RecalcSizes();
wxSize CalcMin();
int GetRows() { return m_rows; }
int GetVGap() { return m_vgap; }
int GetHGap() { return m_hgap; }
-
+
protected:
int m_rows;
int m_cols;
int m_vgap;
int m_hgap;
-
+
void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
-
+
private:
DECLARE_CLASS(wxGridSizer);
};
wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 );
~wxFlexGridSizer();
-
+
void RecalcSizes();
wxSize CalcMin();
-
+
void AddGrowableRow( size_t idx );
void RemoveGrowableRow( size_t idx );
void AddGrowableCol( size_t idx );
int *m_colWidths;
wxArrayInt m_growableRows;
wxArrayInt m_growableCols;
-
+
void CreateArrays();
-
+
private:
DECLARE_CLASS(wxFlexGridSizer);
};
int m_minHeight;
int m_fixedWidth;
int m_fixedHeight;
-
+
private:
DECLARE_CLASS(wxBoxSizer);
};
// wxStaticBoxSizer
//---------------------------------------------------------------------------
+#if wxUSE_STATBOX
+
+class WXDLLEXPORT wxStaticBox;
+
class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
{
public:
protected:
wxStaticBox *m_staticBox;
-
+
private:
DECLARE_CLASS(wxStaticBoxSizer);
};
+#endif // wxUSE_STATBOX
+
//---------------------------------------------------------------------------
// wxNotebookSizer
//---------------------------------------------------------------------------
#if wxUSE_NOTEBOOK
+class WXDLLEXPORT wxNotebook;
+
class WXDLLEXPORT wxNotebookSizer: public wxSizer
{
public:
protected:
wxNotebook *m_notebook;
-
+
private:
DECLARE_CLASS(wxNotebookSizer);
};
-#endif
+#endif // wxUSE_NOTEBOOK
#endif
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/slider.h
+// Purpose: wxSlider interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 09.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 1996-2001 wxWindows team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_SLIDER_H_BASE_
#define _WX_SLIDER_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/slider.h"
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_SLIDER
+
+#include "wx/control.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr;
+
+// ----------------------------------------------------------------------------
+// wxSliderBase: define wxSlider interface
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxSliderBase : public wxControl
+{
+public:
+ /* the ctor of the derived class should have the following form:
+
+ wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+ */
+
+ // get/set the current slider value (should be in range)
+ virtual int GetValue() const = 0;
+ virtual void SetValue(int value) = 0;
+
+ // retrieve/change the range
+ virtual void SetRange(int minValue, int maxValue) = 0;
+ virtual int GetMin() const = 0;
+ virtual int GetMax() const = 0;
+
+ // the line/page size is the increment by which the slider moves when
+ // cursor arrow key/page up or down are pressed (clicking the mouse is like
+ // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
+ virtual void SetLineSize(int lineSize) = 0;
+ virtual void SetPageSize(int pageSize) = 0;
+ virtual int GetLineSize() const = 0;
+ virtual int GetPageSize() const = 0;
+
+ // these methods get/set the length of the slider pointer in pixels
+ virtual void SetThumbLength(int lenPixels) = 0;
+ virtual int GetThumbLength() const = 0;
+
+ // warning: most of subsequent methods are currently only implemented in
+ // wxMSW under Win95 and are silently ignored on other platforms
+
+ virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { }
+ virtual int GetTickFreq() const { return 0; }
+ virtual void ClearTicks() { }
+ virtual void SetTick(int WXUNUSED(tickPos)) { }
+
+ virtual void ClearSel() { }
+ virtual int GetSelEnd() const { return GetMin(); }
+ virtual int GetSelStart() const { return GetMax(); }
+ virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
+};
+
+// ----------------------------------------------------------------------------
+// include the real class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/slider.h"
+#elif defined(__WXMSW__)
+ #ifdef __WIN95__
+ #include "wx/msw/slider95.h"
+ #define wxSlider wxSlider95
+ #define sm_classwxSlider sm_classwxSlider95
+ #else // Win16
+ #include "wx/msw/slidrmsw.h"
+ #define wxSlider wxSliderMSW
+ #define sm_classwxSlider sm_classwxSliderMSW
+ #endif // Win32/Win16
#elif defined(__WXMOTIF__)
-#include "wx/motif/slider.h"
+ #include "wx/motif/slider.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/slider.h"
+ #include "wx/gtk/slider.h"
#elif defined(__WXQT__)
-#include "wx/qt/slider.h"
+ #include "wx/qt/slider.h"
#elif defined(__WXMAC__)
-#include "wx/mac/slider.h"
+ #include "wx/mac/slider.h"
#elif defined(__WXPM__)
-#include "wx/os2/slider.h"
+ #include "wx/os2/slider.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/slider.h"
+ #include "wx/stubs/slider.h"
#endif
+#endif // wxUSE_SLIDER
+
#endif
// _WX_SLIDER_H_BASE_
#include "wx/control.h"
#include "wx/event.h"
+#define wxSPIN_BUTTON_NAME _T("wxSpinButton")
+
// ----------------------------------------------------------------------------
// The wxSpinButton is like a small scrollbar than is often placed next
// to a text control.
m_max = maxVal;
}
+ // is this spin button vertically oriented?
+ bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
+
protected:
// init the base part of the control
void InitBase()
// include the declaration of the real class
// ----------------------------------------------------------------------------
-#if defined(__WXMSW__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/spinbutt.h"
+#elif defined(__WXMSW__)
#include "wx/msw/spinbutt.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/spinbutt.h"
class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent
{
- DECLARE_DYNAMIC_CLASS(wxSpinEvent)
-
public:
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
: wxNotifyEvent(commandType, id)
// get the current value of the control
int GetPosition() const { return m_commandInt; }
void SetPosition(int pos) { m_commandInt = pos; }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxSpinEvent)
};
typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
// include the platform-dependent class implementation
// ----------------------------------------------------------------------------
-#if defined(__WXMSW__) && defined(__WIN32__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/generic/spinctlg.h"
+#elif defined(__WXMSW__) && defined(__WIN32__)
#include "wx/msw/spinctrl.h"
#elif defined(__WXPM__)
#include "wx/os2/spinctrl.h"
#include "wx/generic/spinctlg.h"
#endif // platform
-// Macro must be defined here, not event.h, since it must reference wxSpinEventFunction
#define EVT_SPINCTRL(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_SPINCTRL_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & fn, (wxObject *) NULL ),
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/statbmp.h
+// Purpose: wxStaticBitmap class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_STATBMP_H_BASE_
#define _WX_STATBMP_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/statbmp.h"
+#ifdef __GNUG__
+ #pragma interface "statbmpbase.h"
+#endif
+
+#if wxUSE_STATBMP
+
+#include "wx/control.h"
+#include "wx/bitmap.h"
+
+class WXDLLEXPORT wxIcon;
+class WXDLLEXPORT wxBitmap;
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
+
+// a control showing an icon or a bitmap
+class WXDLLEXPORT wxStaticBitmapBase : public wxControl
+{
+public:
+ // our interface
+ virtual void SetIcon(const wxIcon& icon) = 0;
+ virtual void SetBitmap(const wxBitmap& bitmap) = 0;
+ virtual wxBitmap GetBitmap() const = 0;
+
+ // overriden base class virtuals
+ virtual bool AcceptsFocus() const { return FALSE; }
+
+protected:
+ virtual wxSize DoGetBestClientSize() const;
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/statbmp.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/statbmp.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/statbmp.h"
+ #include "wx/motif/statbmp.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/statbmp.h"
+ #include "wx/gtk/statbmp.h"
#elif defined(__WXQT__)
-#include "wx/qt/statbmp.h"
+ #include "wx/qt/statbmp.h"
#elif defined(__WXMAC__)
-#include "wx/mac/statbmp.h"
+ #include "wx/mac/statbmp.h"
#elif defined(__WXPM__)
-#include "wx/os2/statbmp.h"
+ #include "wx/os2/statbmp.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/statbmp.h"
+ #include "wx/stubs/statbmp.h"
#endif
+#endif // wxUSE_STATBMP
+
#endif
// _WX_STATBMP_H_BASE_
#ifndef _WX_STATBOX_H_BASE_
#define _WX_STATBOX_H_BASE_
-#if defined(__WXMSW__)
+#if wxUSE_STATBOX
+
+#include "wx/control.h"
+
+WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBoxNameStr;
+
+// ----------------------------------------------------------------------------
+// wxStaticBox: a grouping box with a label
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStaticBoxBase : public wxControl
+{
+public:
+ // overriden base class virtuals
+ virtual bool AcceptsFocus() const { return FALSE; }
+};
+
+#if defined(__WXUNIVERSAL__)
+#include "wx/univ/statbox.h"
+#elif defined(__WXMSW__)
#include "wx/msw/statbox.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/statbox.h"
#include "wx/stubs/statbox.h"
#endif
+#endif // wxUSE_STATBOX
+
#endif
// _WX_STATBOX_H_BASE_
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/statline.h
+// Purpose: wxStaticLine class interface
+// Author: Vadim Zeitlin
+// Created: 28.06.99
+// Version: $Id$
+// Copyright: (c) 1999 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_STATLINE_H_BASE_
#define _WX_STATLINE_H_BASE_
// get the default size for the "lesser" dimension of the static line
static int GetDefaultSize() { return 2; }
+ // overriden base class virtuals
+ virtual bool AcceptsFocus() const { return FALSE; }
+
protected:
// set the right size for the right dimension
- wxSize AdjustSize(const wxSize& size)
+ wxSize AdjustSize(const wxSize& size) const
{
wxSize sizeReal(size);
if ( IsVertical() )
return sizeReal;
}
+
+ virtual wxSize DoGetBestSize() const
+ {
+ return AdjustSize(wxDefaultSize);
+ }
};
// ----------------------------------------------------------------------------
// now include the actual class declaration
// ----------------------------------------------------------------------------
-#if defined(__WXMSW__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/statline.h"
+#elif defined(__WXMSW__)
#include "wx/msw/statline.h"
#elif defined(__WXGTK__)
#include "wx/gtk/statline.h"
#ifndef _WX_STATTEXT_H_BASE_
#define _WX_STATTEXT_H_BASE_
-#if defined(__WXMSW__)
-#include "wx/msw/stattext.h"
+#if wxUSE_STATTEXT
+
+#include "wx/control.h"
+
+extern const wxChar *wxStaticTextNameStr;
+
+class WXDLLEXPORT wxStaticTextBase : public wxControl
+{
+public:
+ // overriden base class virtuals
+ virtual bool AcceptsFocus() const { return FALSE; }
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/stattext.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/stattext.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/stattext.h"
+ #include "wx/motif/stattext.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/stattext.h"
+ #include "wx/gtk/stattext.h"
#elif defined(__WXQT__)
-#include "wx/qt/stattext.h"
+ #include "wx/qt/stattext.h"
#elif defined(__WXMAC__)
-#include "wx/mac/stattext.h"
+ #include "wx/mac/stattext.h"
#elif defined(__WXPM__)
-#include "wx/os2/stattext.h"
+ #include "wx/os2/stattext.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/stattext.h"
+ #include "wx/stubs/stattext.h"
#endif
+#endif // wxUSE_STATTEXT
+
#endif
// _WX_STATTEXT_H_BASE_
#include "wx/window.h"
+#if wxUSE_STATUSBAR
+
// ----------------------------------------------------------------------------
// wxStatusBar: a window near the bottom of the frame used for status info
// ----------------------------------------------------------------------------
virtual int GetBorderX() const = 0;
virtual int GetBorderY() const = 0;
+ // don't want status bars to accept the focus at all
+ virtual bool AcceptsFocus() const { return FALSE; }
+
protected:
int m_nFields; // the current number of fields
int *m_statusWidths; // the width (if !NULL) of the fields
DECLARE_DYNAMIC_CLASS(wxStatusBar)
};
+#endif
+
#endif
// _WX_STATUSBR_H_BASE_
#include "wx/defs.h"
+#if wxUSE_TOOLBAR
+
#include "wx/bitmap.h"
#include "wx/list.h"
#include "wx/control.h"
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
virtual void DoToolbarUpdates();
- // Don't want toolbars to accept the focus
- virtual bool AcceptsFocus() const { return FALSE; }
+ // don't want toolbars to accept the focus by tabbing to them
+ virtual bool AcceptsFocusFromKeyboard() const { return FALSE; }
protected:
// to implement in derived classes
DECLARE_CLASS(wxToolBarBase)
};
+#endif // wxUSE_TOOLBAR
+
#endif
// _WX_TBARBASE_H_
#endif
#include "wx/defs.h"
+
+#if wxUSE_TEXTCTRL
+
#include "wx/control.h" // the base class
// 16-bit Borland 4.0 doesn't seem to allow multiple inheritance with wxWindow
virtual void Cut() = 0;
virtual void Paste() = 0;
- virtual bool CanCopy() const = 0;
- virtual bool CanCut() const = 0;
- virtual bool CanPaste() const = 0;
+ virtual bool CanCopy() const;
+ virtual bool CanCut() const;
+ virtual bool CanPaste() const;
// Undo/redo
virtual void Undo() = 0;
virtual long GetLastPosition() const = 0;
virtual void SetSelection(long from, long to) = 0;
+ virtual void SelectAll();
virtual void SetEditable(bool editable) = 0;
// streambuf methods
private:
#ifndef NO_TEXT_WINDOW_STREAM
#if !wxUSE_IOSTREAMH
- char *m_streambuf;
+ char *m_streambuf;
#endif
#endif
};
// include the platform-dependent class definition
// ----------------------------------------------------------------------------
-#if defined(__WXMSW__)
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/textctrl.h"
+#elif defined(__WXMSW__)
#include "wx/msw/textctrl.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/textctrl.h"
#include "wx/stubs/textctrl.h"
#endif
+#endif // wxUSE_TEXTCTRL
+
#endif
// _WX_TEXTCTRL_H_BASE_
#include "wx/defs.h"
-#if !wxUSE_FILE
- #undef wxUSE_TEXTFILE
- #define wxUSE_TEXTFILE 0
-#endif // wxUSE_FILE
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// copy ctor/assignment operator not implemented
wxTextFile(const wxTextFile&);
wxTextFile& operator=(const wxTextFile&);
+
+ // suppress the gcc warning: 'class defines only private constructors and
+ // has no friends'
+#ifdef __GNUG__
+ friend class wxTextFileDummyFriend;
+#endif // gcc
};
#endif // wxUSE_TEXTFILE
#include "wx/longlong.h"
#include "wx/event.h"
-#if wxUSE_GUI
+#if wxUSE_GUI && wxUSE_TIMER
// ----------------------------------------------------------------------------
// wxTimer
#define EVT_TIMER(id, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_TIMER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTimerEventFunction) & func, NULL),
-#endif // wxUSE_GUI
+#endif // wxUSE_GUI && wxUSE_TIMER
// ----------------------------------------------------------------------------
// wxStopWatch: measure time intervals with up to 1ms resolution
// ----------------------------------------------------------------------------
+#if wxUSE_STOPWATCH
+
class WXDLLEXPORT wxStopWatch
{
public:
long m_pause; // the time of the last Pause() or 0
};
+#endif // wxUSE_STOPWATCH
+
+#if wxUSE_LONGLONG
// Starts a global timer
// -- DEPRECATED: use wxStopWatch instead
// -- DEPRECATED: use wxStopWatch instead
long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
+#endif // wxUSE_LONGLONG
+
// ----------------------------------------------------------------------------
// global time functions
// ----------------------------------------------------------------------------
// Get number of seconds since GMT 00:00:00, Jan 1st 1970.
extern long WXDLLEXPORT wxGetUTCTime();
+#if wxUSE_LONGLONG
// Get number of milliseconds since local time 00:00:00 Jan 1st 1970
extern wxLongLong WXDLLEXPORT wxGetLocalTimeMillis();
+#endif // wxUSE_LONGLONG
#define wxGetCurrentTime() wxGetLocalTime()
// Name: wx/tokenzr.h
// Purpose: String tokenizer - a C++ replacement for strtok(3)
// Author: Guilhem Lavaux
-// Modified by: Vadim Zeitlin
+// Modified by: (or rather rewritten by) Vadim Zeitlin
// Created: 04/22/98
// RCS-ID: $Id$
// Copyright: (c) Guilhem Lavaux
bool m_hasMore; // do we have more (possible empty) tokens?
};
+// ----------------------------------------------------------------------------
+// convenience function which returns all tokens at once
+// ----------------------------------------------------------------------------
+
+// the function takes the same parameters as wxStringTokenizer ctor and returns
+// the array containing all tokens
+wxArrayString WXDLLEXPORT
+wxStringTokenize(const wxString& str,
+ const wxString& delims = wxDEFAULT_DELIMITERS,
+ wxStringTokenizerMode mode = wxTOKEN_DEFAULT);
+
#endif // _WX_TOKENZRH
// headers
// ----------------------------------------------------------------------------
-// Not defined in setup.h so removing for now
-// #if wxUSE_TREECTRL
+#if wxUSE_TREECTRL
#include "wx/control.h"
#include "wx/event.h"
#define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL ),
#define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL ),
-// #endif // wxUSE_TREECTRL
+#endif // wxUSE_TREECTRL
#endif
// _WX_TREEBASE_H_
-
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/app.h
+// Purpose: wxUniversalApp class extends wxApp for wxUniv port
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_APP_H_
+#define _WX_UNIX_APP_H_
+
+class WXDLLEXPORT wxUniversalApp : public wxApp
+{
+public:
+};
+
+#endif // _WX_UNIX_APP_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/bmpbuttn.h
+// Purpose: wxBitmapButton class for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_BMPBUTTN_H_
+#define _WX_UNIV_BMPBUTTN_H_
+
+#ifdef __GNUG__
+ #pragma interface "univbmpbuttn.h"
+#endif
+
+class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase
+{
+public:
+ wxBitmapButton() { }
+
+ wxBitmapButton(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ {
+ Create(parent, id, bitmap, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
+ virtual void SetMargins(int x, int y)
+ {
+ SetImageMargins(x, y);
+
+ wxBitmapButtonBase::SetMargins(x, y);
+ }
+
+ virtual bool Enable(bool enable = TRUE);
+
+ virtual bool SetCurrent(bool doit = TRUE);
+
+ virtual void Press();
+ virtual void Release();
+
+protected:
+ void OnSetFocus(wxFocusEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+
+ // called when one of the bitmap is changed by user
+ virtual void OnSetBitmap();
+
+ // set bitmap to the given one if it's ok or to m_bmpNormal and return
+ // TRUE if the bitmap really changed
+ bool ChangeBitmap(const wxBitmap& bmp);
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxBitmapButton)
+};
+
+#endif // _WX_UNIV_BMPBUTTN_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/button.h
+// Purpose: wxButton for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_BUTTON_H_
+#define _WX_UNIV_BUTTON_H_
+
+#ifdef __GNUG__
+ #pragma interface "univbutton.h"
+#endif
+
+class WXDLLEXPORT wxInputHandler;
+
+#include "wx/bitmap.h"
+
+// ----------------------------------------------------------------------------
+// the actions supported by this control
+// ----------------------------------------------------------------------------
+
+#define wxACTION_BUTTON_TOGGLE _T("toggle") // press/release the button
+#define wxACTION_BUTTON_PRESS _T("press") // press the button
+#define wxACTION_BUTTON_RELEASE _T("release") // release the button
+#define wxACTION_BUTTON_CLICK _T("click") // generate button click event
+
+// ----------------------------------------------------------------------------
+// wxButton: a push button
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxButton : public wxButtonBase
+{
+public:
+ wxButton() { Init(); }
+ wxButton(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ {
+ Init();
+
+ Create(parent, id, bitmap, label, pos, size, style, validator, name);
+ }
+
+ wxButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ {
+ Init();
+
+ Create(parent, id, label, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ {
+ return Create(parent, id, wxNullBitmap, label,
+ pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
+ virtual ~wxButton();
+
+ virtual void SetImageLabel(const wxBitmap& bitmap);
+ virtual void SetImageMargins(wxCoord x, wxCoord y);
+ virtual void SetDefault();
+
+ virtual bool IsPressed() const { return m_isPressed; }
+ virtual bool IsDefault() const { return m_isDefault; }
+
+ // wxButton actions
+ void Toggle();
+ virtual void Press();
+ virtual void Release();
+ virtual void Click();
+
+protected:
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = -1,
+ const wxString& strArg = wxEmptyString);
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ virtual bool CanBeHighlighted() const { return TRUE; }
+
+ // common part of all ctors
+ void Init();
+
+ // current state
+ bool m_isPressed,
+ m_isDefault;
+
+ // the (optional) image to show and the margins around it
+ wxBitmap m_bitmap;
+ wxCoord m_marginBmpX,
+ m_marginBmpY;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxButton)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdButtonInputHandler: translates SPACE and ENTER keys and the left mouse
+// click into button press/release actions
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdButtonInputHandler : public wxStdInputHandler
+{
+public:
+ wxStdButtonInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
+ virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
+ virtual bool HandleActivation(wxControl *control, bool activated);
+
+private:
+ // the window (button) which has capture or NULL and the flag telling if
+ // the mouse is inside the button which captured it or not
+ wxWindow *m_winCapture;
+ bool m_winHasMouse;
+};
+
+#endif // _WX_UNIV_BUTTON_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/checkbox.h
+// Purpose: wxCheckBox declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_CHECKBOX_H_
+#define _WX_UNIV_CHECKBOX_H_
+
+#ifdef __GNUG__
+ #pragma interface "univcheckbox.h"
+#endif
+
+#include "wx/button.h" // for wxStdButtonInputHandler
+
+// ----------------------------------------------------------------------------
+// the actions supported by wxCheckBox
+// ----------------------------------------------------------------------------
+
+#define wxACTION_CHECKBOX_CHECK _T("check") // SetValue(TRUE)
+#define wxACTION_CHECKBOX_CLEAR _T("clear") // SetValue(FALSE)
+#define wxACTION_CHECKBOX_TOGGLE _T("toggle") // toggle the check state
+
+// additionally it accepts wxACTION_BUTTON_PRESS and RELEASE
+
+// ----------------------------------------------------------------------------
+// wxCheckBox
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase
+{
+public:
+ // checkbox constants
+ enum State
+ {
+ State_Normal,
+ State_Pressed,
+ State_Disabled,
+ State_Current,
+ State_Max
+ };
+
+ enum Status
+ {
+ Status_Checked,
+ Status_Unchecked,
+ Status_Unknown,
+ Status_Max
+ };
+
+ // constructors
+ wxCheckBox() { Init(); }
+
+ wxCheckBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxCheckBoxNameStr)
+ {
+ Init();
+
+ Create(parent, id, label, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxCheckBoxNameStr);
+
+ // implement the checkbox interface
+ virtual void SetValue(bool value);
+ virtual bool GetValue() const;
+
+ // set/get the bitmaps to use for the checkbox indicator
+ void SetBitmap(const wxBitmap& bmp, State state, Status status);
+ virtual wxBitmap GetBitmap(State state, Status status) const;
+
+ // wxCheckBox actions
+ void Toggle();
+ virtual void Press();
+ virtual void Release();
+ virtual void ChangeValue(bool value);
+
+ // overridden base class virtuals
+ virtual bool IsPressed() const { return m_isPressed; }
+
+protected:
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = -1,
+ const wxString& strArg = wxEmptyString);
+ virtual void DoDraw(wxControlRenderer *renderer);
+ virtual wxSize DoGetBestClientSize() const;
+
+ virtual bool CanBeHighlighted() const { return TRUE; }
+
+ // get the size of the bitmap using either the current one or the default
+ // one (query renderer then)
+ virtual wxSize GetBitmapSize() const;
+
+ // common part of all ctors
+ void Init();
+
+ // send command event notifying about the checkbox state change
+ virtual void SendEvent();
+
+ // called when the checkbox becomes checked - radio button hook
+ virtual void OnCheck();
+
+ // get the state corresponding to the flags (combination of wxCONTROL_XXX)
+ wxCheckBox::State GetState(int flags) const;
+
+ // directly access the bitmaps array without trying to find a valid bitmap
+ // to use as GetBitmap() does
+ wxBitmap DoGetBitmap(State state, Status status) const
+ { return m_bitmaps[state][status]; }
+
+ // get the current status
+ Status GetStatus() const { return m_status; }
+
+private:
+ // the current check status
+ Status m_status;
+
+ // the bitmaps to use for the different states
+ wxBitmap m_bitmaps[State_Max][Status_Max];
+
+ // is the checkbox currently pressed?
+ bool m_isPressed;
+
+ DECLARE_DYNAMIC_CLASS(wxCheckBox)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdCheckboxInputHandler: handles the mouse events for the check and radio
+// boxes (handling the keyboard input is simple, but its handling differs a
+// lot between GTK and MSW, so a new class should be derived for this)
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdCheckboxInputHandler : public wxStdButtonInputHandler
+{
+public:
+ wxStdCheckboxInputHandler(wxInputHandler *inphand);
+
+ // we have to override this one as wxStdButtonInputHandler version works
+ // only with the buttons
+ virtual bool HandleActivation(wxControl *control, bool activated);
+};
+
+#endif // _WX_UNIV_CHECKBOX_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/checklst.h
+// Purpose: wxCheckListBox class for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.09.00
+// RCS-ID: $Id$
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_CHECKLST_H_
+#define _WX_UNIV_CHECKLST_H_
+
+#ifdef __GNUG__
+ #pragma interface "univchecklst.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// actions
+// ----------------------------------------------------------------------------
+
+#define wxACTION_CHECKLISTBOX_TOGGLE _T("toggle")
+
+// ----------------------------------------------------------------------------
+// wxCheckListBox
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
+{
+public:
+ // ctors
+ wxCheckListBox() { Init(); }
+
+ wxCheckListBox(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int nStrings = 0,
+ const wxString *choices = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, nStrings, choices, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int nStrings = 0,
+ const wxString *choices = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr);
+
+ // implement check list box methods
+ virtual bool IsChecked(size_t item) const;
+ virtual void Check(size_t item, bool check = TRUE);
+
+ // and input handling
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = -1l,
+ const wxString& strArg = wxEmptyString);
+
+ // override all methods which add/delete items to update m_checks array as
+ // well
+ virtual void Delete(int n);
+
+protected:
+ virtual int DoAppend(const wxString& item);
+ virtual void DoInsertItems(const wxArrayString& items, int pos);
+ virtual void DoSetItems(const wxArrayString& items, void **clientData);
+ virtual void DoClear();
+
+ // draw the check items instead of the usual ones
+ virtual void DoDrawRange(wxControlRenderer *renderer,
+ int itemFirst, int itemLast);
+
+ // take them also into account for size calculation
+ virtual wxSize DoGetBestClientSize() const;
+
+ // common part of all ctors
+ void Init();
+
+private:
+ // the array containing the checked status of the items
+ wxArrayInt m_checks;
+
+ DECLARE_DYNAMIC_CLASS(wxCheckListBox)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdCheckListBoxInputHandler
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler
+{
+public:
+ wxStdCheckListboxInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+};
+
+#endif // _WX_UNIV_CHECKLST_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/colschem.h
+// Purpose: wxColourScheme class provides the colours to use for drawing
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_COLSCHEM_H_
+#define _WX_UNIV_COLSCHEM_H_
+
+#ifdef __GNUG__
+ #pragma interface "colschem.h"
+#endif
+
+class WXDLLEXPORT wxWindow;
+
+#include "wx/colour.h"
+#include "wx/checkbox.h"
+
+// ----------------------------------------------------------------------------
+// wxColourScheme
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxColourScheme
+{
+public:
+ // the standard colours
+ enum StdColour
+ {
+ // the background colour for a window
+ WINDOW,
+
+ // the different background and text colours for the control
+ CONTROL,
+ CONTROL_PRESSED,
+ CONTROL_CURRENT,
+
+ // the label text for the normal and the disabled state
+ CONTROL_TEXT,
+ CONTROL_TEXT_DISABLED,
+ CONTROL_TEXT_DISABLED_SHADOW,
+
+ // the scrollbar background colour for the normal and pressed states
+ SCROLLBAR,
+ SCROLLBAR_PRESSED,
+
+ // the background and text colour for the highlighted item
+ HIGHLIGHT,
+ HIGHLIGHT_TEXT,
+
+ // these colours are used for drawing the shadows of 3D objects
+ SHADOW_DARK,
+ SHADOW_HIGHLIGHT,
+ SHADOW_IN,
+ SHADOW_OUT,
+
+ MAX
+ };
+
+ // get a standard colour
+ virtual wxColour Get(StdColour col) const = 0;
+
+ // get the background colour for the given window
+ virtual wxColour GetBackground(wxWindow *win) const = 0;
+
+ // virtual dtor for any base class
+ virtual ~wxColourScheme();
+};
+
+// some people just can't spell it correctly :-)
+typedef wxColourScheme wxColorScheme;
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+// retrieve the default colour from the theme or the given scheme
+#define wxSCHEME_COLOUR(scheme, what) scheme->Get(wxColorScheme::what)
+#define wxTHEME_COLOUR(what) \
+ wxSCHEME_COLOUR(wxTheme::Get()->GetColourScheme(), what)
+
+// get the background colour for the window in the current theme
+#define wxTHEME_BG_COLOUR(win) \
+ wxTheme::Get()->GetColourScheme()->GetBackground(win)
+
+#endif // _WX_UNIV_COLSCHEM_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/combobox.h
+// Purpose: the universal combobox
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 30.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ A few words about all the classes defined in this file are probably in
+ order: why do we need extra wxComboControl and wxComboPopup classes?
+
+ This is because a traditional combobox is a combination of a text control
+ (with a button allowing to open the pop down list) with a listbox and
+ wxComboBox class is exactly such control, however we want to also have other
+ combinations - in fact, we want to allow anything at all to be used as pop
+ down list, not just a wxListBox.
+
+ So we define a base wxComboControl which can use any control as pop down
+ list and wxComboBox deriving from it which implements the standard wxWindows
+ combobox API. wxComboControl needs to be told somehow which control to use
+ and this is done by SetPopupControl(). However, we need something more than
+ just a wxControl in this method as, for example, we need to call
+ SetSelection("initial text value") and wxControl doesn't have such method.
+ So we also need a wxComboPopup which is just a very simple interface which
+ must be implemented by a control to be usable as a popup.
+
+ We couldn't derive wxComboPopup from wxControl as this would make it
+ impossible to have a class deriving from both wxListBx and from it, so
+ instead it is just a mix-in.
+ */
+
+#ifndef _WX_UNIV_COMBOBOX_H_
+#define _WX_UNIV_COMBOBOX_H_
+
+#ifdef __GNUG__
+ #pragma implementation "univcombobox.h"
+#endif
+
+class WXDLLEXPORT wxComboControl;
+class WXDLLEXPORT wxListBox;
+class WXDLLEXPORT wxPopupComboWindow;
+
+// ----------------------------------------------------------------------------
+// the actions supported by this control
+// ----------------------------------------------------------------------------
+
+// all actions of single line text controls are supported
+
+// popup/dismiss the choice window
+#define wxACTION_COMBOBOX_POPUP _T("popup")
+#define wxACTION_COMBOBOX_DISMISS _T("dismiss")
+
+// choose the next/prev/specified (by numArg) item
+#define wxACTION_COMBOBOX_SELECT_NEXT _T("next")
+#define wxACTION_COMBOBOX_SELECT_PREV _T("prev")
+#define wxACTION_COMBOBOX_SELECT _T("select")
+
+// ----------------------------------------------------------------------------
+// wxComboPopup is the interface which must be implemented by a control to be
+// used as a popup by wxComboControl
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxComboPopup
+{
+public:
+ wxComboPopup(wxComboControl *combo) { m_combo = combo; }
+
+ // we must have an associated control which is subclassed by the combobox
+ virtual wxControl *GetControl() = 0;
+
+ // called before showing the control to set the initial selection - notice
+ // that the text passed to this method might not correspond to any valid
+ // item (if the user edited it directly), in which case the method should
+ // just return FALSE but not emit any errors
+ virtual bool SetSelection(const wxString& value) = 0;
+
+ // called immediately after the control is shown
+ virtual void OnShow() = 0;
+
+protected:
+ wxComboControl *m_combo;
+};
+
+// ----------------------------------------------------------------------------
+// wxComboControl: a combination of a (single line) text control with a button
+// opening a popup window which contains the control from which the user can
+// choose the value directly.
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxComboControl : public wxControl
+{
+public:
+ // construction
+ wxComboControl()
+ {
+ Init();
+ }
+
+ wxComboControl(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, value, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+ virtual ~wxComboControl();
+
+ // a combo control needs a control for popup window it displays
+ void SetPopupControl(wxComboPopup *popup);
+ wxComboPopup *GetPopupControl() const { return m_popup; }
+
+ // show/hide popup window
+ void ShowPopup();
+ void HidePopup();
+
+ // return TRUE if the popup is currently shown
+ bool IsPopupShown() const { return m_isPopupShown; }
+
+ // get the popup window containing the popup control
+ wxPopupComboWindow *GetPopupWindow() const { return m_winPopup; }
+
+ // get the text control which is part of the combobox
+ wxTextCtrl *GetText() const { return m_text; }
+
+ // implementation only from now on
+ // -------------------------------
+
+ // notifications from wxComboPopup (shouldn't be called by anybody else)
+
+ // called when the user selects something in the popup: this normally hides
+ // the popup and sets the text to the new value
+ virtual void OnSelect(const wxString& value);
+
+ // called when the user dismisses the popup
+ virtual void OnDismiss();
+
+ // forward these functions to all subcontrols
+ virtual bool Enable(bool enable = TRUE);
+ virtual bool Show(bool show = TRUE);
+
+protected:
+ // override the base class virtuals involved into geometry calculations
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+ // we have our own input handler and our own actions
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = 0l,
+ const wxString& strArg = wxEmptyString);
+
+ // event handlers
+ void OnKey(wxCommandEvent& event);
+
+ // common part of all ctors
+ void Init();
+
+private:
+ // the text control and button we show all the time
+ wxTextCtrl *m_text;
+ wxButton *m_btn;
+
+ // the popup control
+ wxComboPopup *m_popup;
+
+ // and the popup window containing it
+ wxPopupComboWindow *m_winPopup;
+
+ // the height of the combobox popup as calculated in Create()
+ wxCoord m_heightPopup;
+
+ // is the popup window currenty shown?
+ bool m_isPopupShown;
+
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// wxComboBox: a combination of text control and a listbox
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxComboBox : public wxComboControl, public wxComboBoxBase
+{
+public:
+ // ctors and such
+ wxComboBox() { Init(); }
+
+ wxComboBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0,
+ const wxString *choices = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, value, pos, size, n, choices,
+ style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0,
+ const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+
+ virtual ~wxComboBox();
+
+ // the wxUniversal-specific methods
+ // --------------------------------
+
+ // implement the combobox interface
+
+ // wxTextCtrl methods
+ virtual wxString GetValue() const;
+ virtual void SetValue(const wxString& value);
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+ virtual void SetInsertionPoint(long pos);
+ virtual void SetInsertionPointEnd();
+ virtual long GetInsertionPoint() const;
+ virtual long GetLastPosition() const;
+ virtual void Replace(long from, long to, const wxString& value);
+ virtual void Remove(long from, long to);
+ virtual void SetSelection(long from, long to);
+ virtual void SetEditable(bool editable);
+
+ // wxControlWithItems methods
+ virtual void Clear();
+ virtual void Delete(int n);
+ virtual int GetCount() const;
+ virtual wxString GetString(int n) const;
+ virtual void SetString(int n, const wxString& s);
+ virtual int FindString(const wxString& s) const;
+ virtual void Select(int n);
+ virtual int GetSelection() const;
+ void SetSelection(int n) { Select(n); }
+
+protected:
+ virtual int DoAppend(const wxString& item);
+ virtual void DoSetItemClientData(int n, void* clientData);
+ virtual void* DoGetItemClientData(int n) const;
+ virtual void DoSetItemClientObject(int n, wxClientData* clientData);
+ virtual wxClientData* DoGetItemClientObject(int n) const;
+
+ // common part of all ctors
+ void Init();
+
+ // get the associated listbox
+ wxListBox *GetLBox() const { return m_lbox; }
+
+private:
+ // the popup listbox
+ wxListBox *m_lbox;
+
+ //DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxComboBox)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdComboBoxInputHandler: allows the user to open/close the combo from kbd
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdComboBoxInputHandler : public wxStdInputHandler
+{
+public:
+ wxStdComboBoxInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+};
+
+#endif // _WX_UNIV_COMBOBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/control.h
+// Purpose: universal wxControl: adds handling of mnemonics
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_CONTROL_H_
+#define _WX_UNIV_CONTROL_H_
+
+#ifdef __GNUG__
+ #pragma interface "control.h"
+#endif
+
+class WXDLLEXPORT wxControlRenderer;
+class WXDLLEXPORT wxInputHandler;
+class WXDLLEXPORT wxRenderer;
+
+// we must include it as most/all control classes derive their handlers from
+// it
+#include "wx/univ/inphand.h"
+
+// ----------------------------------------------------------------------------
+// wxControlAction: the action is currently just a string which identifies it,
+// later it might become an atom (i.e. an opaque handler to string).
+// ----------------------------------------------------------------------------
+
+typedef wxString wxControlAction;
+
+// the list of actions which apply to all controls (other actions are defined
+// in the controls headers)
+
+#define wxACTION_NONE _T("") // no action to perform
+
+// ----------------------------------------------------------------------------
+// wxControl: the base class for all GUI controls
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxControl : public wxControlBase
+{
+public:
+ wxControl() { Init(); }
+
+ wxControl(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr);
+
+ // this function will filter out '&' characters and will put the
+ // accelerator char (the one immediately after '&') into m_chAccel
+ virtual void SetLabel(const wxString &label);
+ virtual wxString GetLabel() const;
+
+ // wxUniversal-specific methods
+
+ // return the accel index in the string or -1 if none and puts the modified
+ // string intosecond parameter if non NULL
+ static int FindAccelIndex(const wxString& label,
+ wxString *labelOnly = NULL);
+
+ // return the index of the accel char in the label or -1 if none
+ int GetAccelIndex() const { return m_indexAccel; }
+
+ // return the accel char itself or 0 if none
+ wxChar GetAccelChar() const
+ {
+ return m_indexAccel == -1 ? _T('\0') : m_label[m_indexAccel];
+ }
+
+ // get the input handler of this control
+ wxInputHandler *GetInputHandler() const { return m_handler; }
+
+ // perform a control-dependent action: an action may have an optional
+ // numeric and another (also optional) string argument whose interpretation
+ // depends on the action
+ //
+ // NB: we might use ellipsis in PerformAction() declaration but this
+ // wouldn't be more efficient than always passing 2 unused parameters
+ // but would be more difficult. Another solution would be to have
+ // several overloaded versions but this will expose the problem of
+ // virtual function hiding we don't have here.
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = -1l,
+ const wxString& strArg = wxEmptyString);
+
+protected:
+ // event handlers
+ void OnMouse(wxMouseEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+ void OnKeyUp(wxKeyEvent& event);
+ void OnFocus(wxFocusEvent& event);
+ void OnActivate(wxActivateEvent& event);
+
+ // common part of all ctors
+ void Init();
+
+ // create input handler by name
+ void CreateInputHandler(const wxString& inphandler);
+
+ // input processor (never deleted, the theme deletes it itself)
+ wxInputHandler *m_handler;
+
+private:
+ // label and accel info
+ wxString m_label;
+ int m_indexAccel;
+
+ DECLARE_DYNAMIC_CLASS(wxControl)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_UNIV_CONTROL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/frame.h
+// Purpose: wxFrame class for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.05.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_FRAME_H_
+#define _WX_UNIV_FRAME_H_
+
+#ifdef __GNUG__
+ #pragma interface "univframe.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxFrame
+// ----------------------------------------------------------------------------
+
+class wxFrame : public wxFrameNative
+{
+public:
+ wxFrame();
+ wxFrame(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ virtual wxPoint GetClientAreaOrigin() const;
+
+protected:
+ void OnSize(wxSizeEvent& event);
+
+#if wxUSE_MENUS
+ // override to update menu bar position when the frame size changes
+ virtual void PositionMenuBar();
+#endif // wxUSE_MENUS
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxFrame)
+};
+
+#endif // _WX_UNIV_FRAME_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/gauge.h
+// Purpose: wxUniversal wxGauge declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation "gaugeuniv.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxGauge: a progress bar
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxGauge : public wxGaugeBase
+{
+public:
+ wxGauge() { Init(); }
+
+ wxGauge(wxWindow *parent,
+ wxWindowID id,
+ int range,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxGA_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxGaugeNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, range, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int range,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxGA_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxGaugeNameStr);
+
+ // implement base class virtuals
+ virtual void SetRange(int range);
+ virtual void SetValue(int pos);
+
+ // wxUniv-specific methods
+
+ // is it a smooth progress bar or a discrete one?
+ bool IsSmooth() const { return (GetWindowStyle() & wxGA_SMOOTH) != 0; }
+
+ // is it a vertica; progress bar or a horizontal one?
+ bool IsVertical() const { return (GetWindowStyle() & wxGA_VERTICAL) != 0; }
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // return the def border for a progress bar
+ virtual wxBorder GetDefaultBorder() const;
+
+ // return the default size
+ virtual wxSize DoGetBestClientSize() const;
+
+ // draw the control
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ DECLARE_DYNAMIC_CLASS(wxGauge)
+};
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/inphand.h
+// Purpose: wxInputHandler class maps the keyboard and mouse events to the
+// actions which then are performed by the control
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 18.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_INPHAND_H_
+#define _WX_UNIV_INPHAND_H_
+
+#ifdef __GNUG__
+ #pragma interface "inphand.h"
+#endif
+
+#include "wx/control.h" // for wxControlAction(s)
+
+// ----------------------------------------------------------------------------
+// types of the standard input handlers which can be passed to
+// wxTheme::GetInputHandler()
+// ----------------------------------------------------------------------------
+
+#define wxINP_HANDLER_DEFAULT _T("")
+#define wxINP_HANDLER_BUTTON _T("button")
+#define wxINP_HANDLER_CHECKBOX _T("checkbox")
+#define wxINP_HANDLER_CHECKLISTBOX _T("checklistbox")
+#define wxINP_HANDLER_COMBOBOX _T("combobox")
+#define wxINP_HANDLER_LISTBOX _T("listbox")
+#define wxINP_HANDLER_NOTEBOOK _T("notebook")
+#define wxINP_HANDLER_RADIOBTN _T("radiobtn")
+#define wxINP_HANDLER_SCROLLBAR _T("scrollbar")
+#define wxINP_HANDLER_SLIDER _T("slider")
+#define wxINP_HANDLER_SPINBTN _T("spinbtn")
+#define wxINP_HANDLER_TEXTCTRL _T("textctrl")
+
+// ----------------------------------------------------------------------------
+// wxInputHandler: maps the events to the actions
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxInputHandler
+{
+public:
+ // map a keyboard event to one or more actions (pressed == TRUE if the key
+ // was pressed, FALSE if released), returns TRUE if something was done
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed) = 0;
+
+ // map a mouse (click) event to one or more actions
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event) = 0;
+
+ // handle mouse movement (or enter/leave) event: it is separated from
+ // HandleMouse() for convenience as many controls don't care about mouse
+ // movements at all
+ virtual bool HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event);
+
+ // do something with focus set/kill event: this is different from
+ // HandleMouseMove() as the mouse maybe over the control without it having
+ // focus
+ //
+ // return TRUE to refresh the control, FALSE otherwise
+ virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
+
+ // react to the app getting/losing activation
+ //
+ // return TRUE to refresh the control, FALSE otherwise
+ virtual bool HandleActivation(wxControl *control, bool activated);
+
+ // virtual dtor for any base class
+ virtual ~wxInputHandler();
+};
+
+// ----------------------------------------------------------------------------
+// wxStdInputHandler is just a base class for all other "standard" handlers
+// and also provides the way to chain input handlers together
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdInputHandler : public wxInputHandler
+{
+public:
+ wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { }
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+ {
+ return m_handler ? m_handler->HandleKey(control, event, pressed)
+ : FALSE;
+ }
+
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+ {
+ return m_handler ? m_handler->HandleMouse(control, event) : FALSE;
+ }
+
+ virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event)
+ {
+ return m_handler ? m_handler->HandleMouseMove(control, event) : FALSE;
+ }
+
+ virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event)
+ {
+ return m_handler ? m_handler->HandleFocus(control, event) : FALSE;
+ }
+
+private:
+ wxInputHandler *m_handler;
+};
+
+#endif // _WX_UNIV_INPHAND_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/listbox.h
+// Purpose: the universal listbox
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 30.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_LISTBOX_H_
+#define _WX_UNIV_LISTBOX_H_
+
+#ifdef __GNUG__
+ #pragma implementation "univlistbox.h"
+#endif
+
+#include "wx/scrolwin.h" // for wxScrollHelper
+
+// ----------------------------------------------------------------------------
+// the actions supported by this control
+// ----------------------------------------------------------------------------
+
+// change the current item
+#define wxACTION_LISTBOX_SETFOCUS _T("setfocus") // select the item
+#define wxACTION_LISTBOX_MOVEDOWN _T("down") // select item below
+#define wxACTION_LISTBOX_MOVEUP _T("up") // select item above
+#define wxACTION_LISTBOX_PAGEDOWN _T("pagedown") // go page down
+#define wxACTION_LISTBOX_PAGEUP _T("pageup") // go page up
+#define wxACTION_LISTBOX_START _T("start") // go to first item
+#define wxACTION_LISTBOX_END _T("end") // go to last item
+#define wxACTION_LISTBOX_FIND _T("find") // find item by 1st letter
+
+// do something with the current item
+#define wxACTION_LISTBOX_ACTIVATE _T("activate") // activate (choose)
+#define wxACTION_LISTBOX_TOGGLE _T("toggle") // togglee selected state
+#define wxACTION_LISTBOX_SELECT _T("select") // sel this, unsel others
+#define wxACTION_LISTBOX_SELECTADD _T("selectadd") // add to selection
+#define wxACTION_LISTBOX_UNSELECT _T("unselect") // unselect
+#define wxACTION_LISTBOX_ANCHOR _T("selanchor") // anchor selection
+
+// do something with the selection globally (not for single selection ones)
+#define wxACTION_LISTBOX_SELECTALL _T("selectall") // select all items
+#define wxACTION_LISTBOX_UNSELECTALL _T("unselectall") // unselect all items
+#define wxACTION_LISTBOX_SELTOGGLE _T("togglesel") // invert the selection
+#define wxACTION_LISTBOX_EXTENDSEL _T("extend") // extend to item
+
+// ----------------------------------------------------------------------------
+// wxListBox: a list of selectable items
+// ----------------------------------------------------------------------------
+
+class wxListBox : public wxListBoxBase, public wxScrollHelper
+{
+public:
+ // ctors and such
+ wxListBox() { Init(); }
+ wxListBox(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr )
+ {
+ Init();
+
+ Create(parent, id, pos, size, n, choices, style, validator, name);
+ }
+
+ virtual ~wxListBox();
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr);
+
+ // implement the listbox interface defined by wxListBoxBase
+ virtual void Clear();
+ virtual void Delete(int n);
+
+ virtual int GetCount() const { return (int)m_strings.GetCount(); }
+ virtual wxString GetString(int n) const { return m_strings[n]; }
+ virtual void SetString(int n, const wxString& s);
+ virtual int FindString(const wxString& s) const
+ { return m_strings.Index(s); }
+
+ virtual bool IsSelected(int n) const
+ { return m_selections.Index(n) != wxNOT_FOUND; }
+ virtual void SetSelection(int n, bool select = TRUE);
+ virtual int GetSelection() const;
+ virtual int GetSelections(wxArrayInt& aSelections) const;
+
+protected:
+ virtual int DoAppend(const wxString& item);
+ virtual void DoInsertItems(const wxArrayString& items, int pos);
+ virtual void DoSetItems(const wxArrayString& items, void **clientData);
+
+ virtual void DoSetFirstItem(int n);
+
+ virtual void DoSetItemClientData(int n, void* clientData);
+ virtual void* DoGetItemClientData(int n) const;
+ virtual void DoSetItemClientObject(int n, wxClientData* clientData);
+ virtual wxClientData* DoGetItemClientObject(int n) const;
+
+public:
+ // override some more base class methods
+ virtual bool SetFont(const wxFont& font);
+
+ // the wxUniversal-specific methods
+ // --------------------------------
+
+ // the current item is the same as the selected one for wxLB_SINGLE
+ // listboxes but for the other ones it is just the focused item which may
+ // be selected or not
+ int GetCurrentItem() const { return m_current; }
+ void SetCurrentItem(int n);
+
+ // select the item which is diff items below the current one
+ void ChangeCurrent(int diff);
+
+ // activate (i.e. send a LISTBOX_DOUBLECLICKED message) the specified or
+ // current (if -1) item
+ void Activate(int item = -1);
+
+ // select or unselect the specified or current (if -1) item
+ void Select(bool sel = TRUE, int item = -1);
+
+ // more readable wrapper
+ void Unselect(int item) { Select(FALSE, item); }
+
+ // select an item and send a notification about it
+ void SelectAndNotify(int item);
+
+ // ensure that the given item is visible by scrolling it into view
+ virtual void EnsureVisible(int n);
+
+ // find the first item [strictly] after the current one which starts with
+ // the given string and make it the current one, return TRUE if the current
+ // item changed
+ bool FindItem(const wxString& prefix, bool strictlyAfter = FALSE);
+ bool FindNextItem(const wxString& prefix) { return FindItem(prefix, TRUE); }
+
+ // extend the selection to span the range from the anchor (see below) to
+ // the specified or current item
+ void ExtendSelection(int itemTo = -1);
+
+ // make this item the new selection anchor: extending selection with
+ // ExtendSelection() will work with it
+ void AnchorSelection(int itemFrom) { m_selAnchor = itemFrom; }
+
+ // get, calculating it if necessary, the number of items per page, the
+ // height of each line and the max width of an item
+ int GetItemsPerPage() const;
+ wxCoord GetLineHeight() const;
+ wxCoord GetMaxWidth() const;
+
+ // override the wxControl virtual methods
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = 0l,
+ const wxString& strArg = wxEmptyString);
+
+ // let wxColourScheme choose the right colours for us
+ virtual bool IsContainerWindow() const { return TRUE; }
+
+protected:
+ // geometry
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+ virtual void DoDraw(wxControlRenderer *renderer);
+ virtual wxBorder GetDefaultBorder() const;
+
+ // common part of all ctors
+ void Init();
+
+ // event handlers
+ void OnIdle(wxIdleEvent& event);
+ void OnSize(wxSizeEvent& event);
+
+ // common part of Clear() and DoSetItems(): clears everything
+ virtual void DoClear();
+
+ // refresh the given item(s) or everything
+ void RefreshItems(int from, int count);
+ void RefreshItem(int n);
+ void RefreshFromItemToEnd(int n);
+ void RefreshAll();
+
+ // send an event of the given type (using m_current by default)
+ bool SendEvent(wxEventType type, int item = -1);
+
+ // calculate the number of items per page using our current size
+ void CalcItemsPerPage();
+
+ // can/should we have a horz scrollbar?
+ bool HasHorzScrollbar() const
+ { return (m_windowStyle & wxLB_HSCROLL) != 0; }
+
+ // redraw the items in the given range only: called from DoDraw()
+ virtual void DoDrawRange(wxControlRenderer *renderer,
+ int itemFirst, int itemLast);
+
+ // update the scrollbars and then ensure that the item is visible
+ void DoEnsureVisible(int n);
+
+ // mark horz scrollbar for updating
+ void RefreshHorzScrollbar();
+
+ // update (show/hide/adjust) the scrollbars
+ void UpdateScrollbars();
+
+ // refresh the items specified by m_updateCount and m_updateFrom
+ void UpdateItems();
+
+ // the array containing all items (it is sorted if the listbox has
+ // wxLB_SORT style)
+ wxArrayString m_strings;
+
+ // this array contains the indices of the selected items (for the single
+ // selection listboxes only the first element of it is used and contains
+ // the current selection)
+ wxArrayInt m_selections;
+
+ // and this one the client data (either void or wxClientData)
+ wxArrayPtrVoid m_itemsClientData;
+
+ // the current item
+ int m_current;
+
+private:
+ // the range of elements which must be updated: if m_updateCount is 0 no
+ // update is needed, if it is -1 everything must be updated, otherwise
+ // m_updateCount items starting from m_updateFrom have to be redrawn
+ int m_updateFrom,
+ m_updateCount;
+
+ // the height of one line in the listbox (all lines have the same height)
+ wxCoord m_lineHeight;
+
+ // the maximal width of a listbox item and the item which has it
+ wxCoord m_maxWidth;
+ int m_maxWidthItem;
+
+ // the extents of horz and vert scrollbars
+ int m_scrollRangeX,
+ m_scrollRangeY;
+
+ // the number of items per page
+ size_t m_itemsPerPage;
+
+ // if the number of items has changed we may need to show/hide the
+ // scrollbar
+ bool m_updateScrollbarX, m_updateScrollbarY,
+ m_showScrollbarX, m_showScrollbarY;
+
+ // if the current item has changed, we might need to scroll if it went out
+ // of the window
+ bool m_currentChanged;
+
+ // the anchor from which the selection is extended for the listboxes with
+ // wxLB_EXTENDED style - this is set to the last item which was selected
+ // by not extending the selection but by choosing it directly
+ int m_selAnchor;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxListBox)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdListboxInputHandler: handles mouse and kbd in a single or multi
+// selection listbox
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdListboxInputHandler : public wxStdInputHandler
+{
+public:
+ // if pressing the mouse button in a multiselection listbox should toggle
+ // the item under mouse immediately, then specify TRUE as the second
+ // parameter (this is the standard behaviour, under GTK the item is toggled
+ // only when the mouse is released in the multi selection listbox)
+ wxStdListboxInputHandler(wxInputHandler *inphand,
+ bool toggleOnPressAlways = TRUE);
+
+ // base class methods
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event);
+
+protected:
+ // return the item under mouse, 0 if the mouse is above the listbox or
+ // GetCount() if it is below it
+ int HitTest(const wxListBox *listbox, const wxMouseEvent& event);
+
+ // parts of HitTest(): first finds the pseudo (because not in range) index
+ // of the item and the second one adjusts it if necessary - that is if the
+ // third one returns FALSE
+ int HitTestUnsafe(const wxListBox *listbox, const wxMouseEvent& event);
+ int FixItemIndex(const wxListBox *listbox, int item);
+ bool IsValidIndex(const wxListBox *listbox, int item);
+
+ // init m_btnCapture and m_actionMouse
+ wxControlAction SetupCapture(wxListBox *lbox,
+ const wxMouseEvent& event,
+ int item);
+
+ wxRenderer *m_renderer;
+
+ // the button which initiated the mouse capture (currently 0 or 1)
+ int m_btnCapture;
+
+ // the action to perform when the mouse moves while we capture it
+ wxControlAction m_actionMouse;
+
+ // the ctor parameter toggleOnPressAlways (see comments near it)
+ bool m_toggleOnPressAlways;
+
+ // do we track the mouse outside the window when it is captured?
+ bool m_trackMouseOutside;
+};
+
+#endif // _WX_UNIV_LISTBOX_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/menu.h
+// Purpose: wxMenu and wxMenuBar classes for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 05.05.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_MENU_H_
+#define _WX_UNIV_MENU_H_
+
+#ifdef __GNUG__
+ #pragma interface "univmenu.h"
+#endif
+
+#if wxUSE_ACCEL
+ #include "wx/accel.h"
+#endif // wxUSE_ACCEL
+
+#include "wx/dynarray.h"
+
+// fwd declarations
+class WXDLLEXPORT wxMenuInfo;
+WX_DECLARE_OBJARRAY(wxMenuInfo, wxMenuInfoArray);
+
+class wxPopupMenuWindow;
+
+class WXDLLEXPORT wxRenderer;
+
+// ----------------------------------------------------------------------------
+// wxMenu helper classes, used in implementation only
+// ----------------------------------------------------------------------------
+
+// used by wxRenderer
+class WXDLLEXPORT wxMenuGeometryInfo
+{
+public:
+ // get the total size of the menu
+ virtual wxSize GetSize() const = 0;
+
+ virtual ~wxMenuGeometryInfo();
+};
+
+// ----------------------------------------------------------------------------
+// wxMenu
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxMenu : public wxMenuBase
+{
+public:
+ // ctors and dtor
+ wxMenu(const wxString& title, long style = 0)
+ : wxMenuBase(title, style) { Init(); }
+
+ wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
+
+ virtual ~wxMenu();
+
+ // called by wxMenuItem when an item of this menu changes
+ void RefreshItem(wxMenuItem *item);
+
+ // does the menu have any items?
+ bool IsEmpty() const { return !GetMenuItems().GetFirst(); }
+
+ // show this menu at the given position (in screen coords) and optionally
+ // select its first item
+ void Popup(const wxPoint& pos, const wxSize& size,
+ bool selectFirst = TRUE);
+
+ // dismiss the menu
+ void Dismiss();
+
+ // override the base class methods to connect/disconnect event handlers
+ virtual void Attach(wxMenuBarBase *menubar);
+ virtual void Detach();
+
+ // implementation only from here
+
+ // do as if this item were clicked, return TRUE if the resulting event was
+ // processed, FALSE otherwise
+ bool ClickItem(wxMenuItem *item);
+
+ // process the key event, return TRUE if done
+ bool ProcessKeyDown(int key);
+
+#if wxUSE_ACCEL
+ // find the item for the given accel and generate an event if found
+ bool ProcessAccelEvent(const wxKeyEvent& event);
+#endif // wxUSE_ACCEL
+
+protected:
+ // implement base class virtuals
+ virtual bool DoAppend(wxMenuItem *item);
+ virtual bool DoInsert(size_t pos, wxMenuItem *item);
+ virtual wxMenuItem *DoRemove(wxMenuItem *item);
+
+ // common part of DoAppend and DoInsert
+ void OnItemAdded(wxMenuItem *item);
+
+ // called by wxPopupMenuWindow when the window is hidden
+ void OnDismiss(bool dismissParent);
+
+ // return true if the menu is currently shown on screen
+ bool IsShown() const;
+
+ // get the menu geometry info
+ const wxMenuGeometryInfo& GetGeometryInfo() const;
+
+ // forget old menu geometry info
+ void InvalidateGeometryInfo();
+
+ // return either the menubar or the invoking window, normally never NULL
+ wxWindow *GetRootWindow() const;
+
+ // get the renderer we use for drawing: either the one of the menu bar or
+ // the one of the window if we're a popup menu
+ wxRenderer *GetRenderer() const;
+
+#if wxUSE_ACCEL
+ // add/remove accel for the given menu item
+ void AddAccelFor(wxMenuItem *item);
+ void RemoveAccelFor(wxMenuItem *item);
+#endif // wxUSE_ACCEL
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // the exact menu geometry is defined by a struct derived from this one
+ // which is opaque and defined by the renderer
+ wxMenuGeometryInfo *m_geometry;
+
+ // the menu shown on screen or NULL if not currently shown
+ wxPopupMenuWindow *m_popupMenu;
+
+#if wxUSE_ACCEL
+ // the accel table for this menu
+ wxAcceleratorTable m_accelTable;
+#endif // wxUSE_ACCEL
+
+ // it calls out OnDismiss()
+ friend wxPopupMenuWindow;
+
+ DECLARE_DYNAMIC_CLASS(wxMenu)
+};
+
+// ----------------------------------------------------------------------------
+// wxMenuBar
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxMenuBar : public wxMenuBarBase
+{
+public:
+ // ctors and dtor
+ wxMenuBar(long WXUNUSED(style) = 0) { Init(); }
+ virtual ~wxMenuBar();
+
+ // implement base class virtuals
+ virtual bool Append( wxMenu *menu, const wxString &title );
+ virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
+ virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
+ virtual wxMenu *Remove(size_t pos);
+
+ virtual void EnableTop(size_t pos, bool enable);
+ virtual bool IsEnabledTop(size_t pos) const;
+
+ virtual void SetLabelTop(size_t pos, const wxString& label);
+ virtual wxString GetLabelTop(size_t pos) const;
+
+ virtual void Attach(wxFrame *frame);
+ virtual void Detach();
+
+ // get the next item for the givan accel letter (used by wxFrame), return
+ // -1 if none
+ //
+ // if unique is not NULL, filled with TRUE if there is only one item with
+ // this accel, FALSE if two or more
+ int FindNextItemForAccel(int idxStart,
+ int keycode,
+ bool *unique = NULL) const;
+
+ // called by wxFrame to set focus to or open the given menu
+ void SelectMenu(size_t pos);
+ void PopupMenu(size_t pos);
+
+#if wxUSE_ACCEL
+ // find the item for the given accel and generate an event if found
+ bool ProcessAccelEvent(const wxKeyEvent& event);
+#endif // wxUSE_ACCEL
+
+ // called by wxMenu when it is dismissed
+ void OnDismissMenu(bool dismissMenuBar = FALSE);
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // event handlers
+ void OnLeftDown(wxMouseEvent& event);
+ void OnMouseMove(wxMouseEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+
+ // process the mouse move event, return TRUE if we did, FALSE to continue
+ // processing as usual
+ //
+ // the coordinates are client coordinates of menubar, convert if necessary
+ bool ProcessMouseEvent(const wxPoint& pt);
+
+ // called when the menu bar loses mouse capture - it is not hidden unlike
+ // menus, but it doesn't have modal status any longer
+ void OnDismiss();
+
+ // draw the menubar
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ // menubar geometry
+ virtual wxSize DoGetBestClientSize() const;
+
+ // has the menubar been created already?
+ bool IsCreated() const { return m_frameLast != NULL; }
+
+ // "fast" version of GetMenuCount()
+ size_t GetCount() const { return m_menuInfos.GetCount(); }
+
+ // get the (total) width of the specified menu
+ wxCoord GetItemWidth(size_t pos) const;
+
+ // get the rect of the item
+ wxRect GetItemRect(size_t pos) const;
+
+ // get the menu from the given point or -1 if none
+ int GetMenuFromPoint(const wxPoint& pos) const;
+
+ // refresh the given item
+ void RefreshItem(size_t pos);
+
+ // refresh all items after this one (including it)
+ void RefreshAllItemsAfter(size_t pos);
+
+ // hide the currently shown menu and show this one
+ void DoSelectMenu(size_t pos);
+
+ // popup the currently selected menu
+ void PopupCurrentMenu(bool selectFirst = TRUE);
+
+ // hide the currently selected menu
+ void DismissMenu();
+
+ // do we show a menu currently?
+ bool IsShowingMenu() const { return m_menuShown != 0; }
+
+ // we don't want to have focus except while selecting from menu
+ void GiveAwayFocus();
+
+ // the array containing extra menu info we need
+ wxMenuInfoArray m_menuInfos;
+
+ // the current item (only used when menubar has focus)
+ int m_current;
+
+private:
+ // the last frame to which we were attached, NULL initially
+ wxFrame *m_frameLast;
+
+ // the currently shown menu or NULL
+ wxMenu *m_menuShown;
+
+ // should be showing the menu? this is subtly different from m_menuShown !=
+ // NULL as the menu which should be shown may be disabled in which case we
+ // don't show it - but will do as soon as the focus shifts to another menu
+ bool m_shouldShowMenu;
+
+ // it calls out ProcessMouseEvent()
+ friend wxPopupMenuWindow;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxMenuBar)
+};
+
+#endif // _WX_UNIV_MENU_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/menuitem.h
+// Purpose: wxMenuItem class for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 05.05.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_MENUITEM_H_
+#define _WX_UNIV_MENUITEM_H_
+
+#ifdef __GNUG__
+ #pragma interface "univmenuitem.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxMenuItem implements wxMenuItemBase
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxMenuItem : public wxMenuItemBase
+{
+public:
+ // ctor & dtor
+ wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
+ int id = wxID_SEPARATOR,
+ const wxString& name = wxEmptyString,
+ const wxString& help = wxEmptyString,
+ bool isCheckable = FALSE,
+ wxMenu *subMenu = (wxMenu *)NULL);
+ virtual ~wxMenuItem();
+
+ // override base class virtuals to update the item appearance on screen
+ virtual void SetText(const wxString& text);
+ virtual void SetCheckable(bool checkable);
+
+ virtual void Enable(bool enable = TRUE);
+ virtual void Check(bool check = TRUE);
+
+ // we add some extra functions which are also available under MSW from
+ // wxOwnerDrawn class - they will be moved to wxMenuItemBase later
+ // hopefully
+ void SetBitmaps(const wxBitmap& bmpChecked,
+ const wxBitmap& bmpUnchecked = wxNullBitmap);
+ void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); }
+ const wxBitmap& GetBitmap(bool checked = TRUE) const
+ { return checked ? m_bmpChecked : m_bmpUnchecked; }
+
+ // wxUniv-specific methods for implementation only starting from here
+
+ // get the accel index of our label or -1 if none
+ int GetAccelIndex() const { return m_indexAccel; }
+
+ // get the accel string (displayed to the right of the label)
+ const wxString& GetAccelString() const { return m_strAccel; }
+
+ // set/get the y coord and the height of this item: note that it must be
+ // set first and retrieved later, the item doesn't calculate it itself
+ void SetGeometry(wxCoord y, wxCoord height)
+ {
+ m_posY = y;
+ m_height = height;
+ }
+
+ wxCoord GetPosition() const
+ {
+ wxASSERT_MSG( m_posY != -1, _T("must call SetHeight first!") );
+
+ return m_posY;
+ }
+
+ wxCoord GetHeight() const
+ {
+ wxASSERT_MSG( m_height != -1, _T("must call SetHeight first!") );
+
+ return m_height;
+ }
+
+protected:
+ // notify the menu about the change in this item
+ inline void NotifyMenu();
+
+ // set the accel index and string from text
+ void UpdateAccelInfo();
+
+ // the bitmaps (may be invalid, then they're not used)
+ wxBitmap m_bmpChecked,
+ m_bmpUnchecked;
+
+ // the position of the accelerator in our label, -1 if none
+ int m_indexAccel;
+
+ // the accel string (i.e. "Ctrl-Q" or "Alt-F1")
+ wxString m_strAccel;
+
+ // the position and height of the displayed item
+ wxCoord m_posY,
+ m_height;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxMenuItem)
+};
+
+#endif // _WX_UNIV_MENUITEM_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/notebook.h
+// Purpose: universal version of wxNotebook
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 01.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_NOTEBOOK_H_
+#define _WX_UNIV_NOTEBOOK_H_
+
+#ifdef __GNUG__
+ #pragma interface "univnotebook.h"
+#endif
+
+class WXDLLEXPORT wxSpinButton;
+
+// ----------------------------------------------------------------------------
+// the actions supported by this control
+// ----------------------------------------------------------------------------
+
+// change the page: to the next/previous/given one
+#define wxACTION_NOTEBOOK_NEXT _T("nexttab")
+#define wxACTION_NOTEBOOK_PREV _T("prevtab")
+#define wxACTION_NOTEBOOK_GOTO _T("gototab")
+
+// ----------------------------------------------------------------------------
+// wxNotebook
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxNotebook : public wxNotebookBase
+{
+public:
+ // ctors and such
+ // --------------
+
+ wxNotebook() { Init(); }
+
+ wxNotebook(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxNOTEBOOK_NAME)
+ {
+ Init();
+
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // quasi ctor
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxNOTEBOOK_NAME);
+
+ // dtor
+ virtual ~wxNotebook();
+
+ // implement wxNotebookBase pure virtuals
+ // --------------------------------------
+
+ virtual int SetSelection(int nPage);
+ virtual int GetSelection() const { return m_sel; }
+
+ virtual bool SetPageText(int nPage, const wxString& strText);
+ virtual wxString GetPageText(int nPage) const;
+
+ virtual int GetPageImage(int nPage) const;
+ virtual bool SetPageImage(int nPage, int nImage);
+
+ virtual void SetPageSize(const wxSize& size);
+ virtual void SetPadding(const wxSize& padding);
+ virtual void SetTabSize(const wxSize& sz);
+
+ virtual wxSize CalcSizeFromPage(const wxSize& sizePage);
+
+ virtual bool DeleteAllPages();
+
+ virtual bool InsertPage(int nPage,
+ wxNotebookPage *pPage,
+ const wxString& strText,
+ bool bSelect = FALSE,
+ int imageId = -1);
+
+ // style tests
+ // -----------
+
+ // return TRUE if all tabs have the same width
+ bool FixedSizeTabs() const
+ { return GetWindowStyle() & wxNB_FIXEDWIDTH != 0; }
+
+ // return wxTOP/wxBOTTOM/wxRIGHT/wxLEFT
+ wxDirection GetTabOrientation() const;
+
+ // return TRUE if the notebook has tabs at the sidesand not at the top (or
+ // bottom) as usual
+ bool IsVertical() const;
+
+ // hit testing
+ // -----------
+
+ // return the tab at this position or -1 if none
+ int HitTest(const wxPoint& pt) const;
+
+ // input handling
+ // --------------
+
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = 0l,
+ const wxString& strArg = wxEmptyString);
+
+ // refresh the currently selected tab
+ void RefreshCurrent();
+
+protected:
+ virtual wxNotebookPage *DoRemovePage(int nPage);
+
+ // drawing
+ virtual void DoDraw(wxControlRenderer *renderer);
+ void DoDrawTab(wxDC& dc, const wxRect& rect, size_t n);
+
+ // resizing
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+ // common part of all ctors
+ void Init();
+
+ // resize the tab to fit its title (and icon if any)
+ void ResizeTab(int page);
+
+ // recalculate the geometry of the notebook completely
+ void Relayout();
+
+ // is the spin button currently shown?
+ bool HasSpinBtn() const;
+
+ // calculate last (fully) visible tab: updates m_lastVisible
+ void CalcLastVisibleTab();
+
+ // show or hide the spin control for tabs scrolling depending on whether it
+ // is needed or not
+ void UpdateSpinBtn();
+
+ // position the spin button
+ void PositionSpinBtn();
+
+ // refresh the given tab only
+ void RefreshTab(int page);
+
+ // refresh all tabs
+ void RefreshAllTabs();
+
+ // get the tab rect (inefficient, don't use this in a loop)
+ wxRect GetTabRect(int page) const;
+
+ // get the rectangle containing all tabs
+ wxRect GetAllTabsRect() const;
+
+ // get the part occupied by the tabs - slightly smaller than
+ // GetAllTabsRect() because the tabs may be indented from it
+ wxRect GetTabsPart() const;
+
+ // calculate the tab size (without padding)
+ wxSize CalcTabSize(int page) const;
+
+ // get the (cached) size of a tab
+ void GetTabSize(int page, wxCoord *w, wxCoord *h) const;
+
+ // get the (cached) width of the tab
+ wxCoord GetTabWidth(int page) const
+ { return FixedSizeTabs() ? m_widthMax : m_widths[page]; }
+
+ // return TRUE if the tab has an associated image
+ bool HasImage(int page) const
+ { return m_imageList && m_images[page] != -1; }
+
+ // get the part of the notebook reserved for the pages (slightly larger
+ // than GetPageRect() as we draw a border and leave marginin between)
+ wxRect GetPagePart() const;
+
+ // get the page rect in our client coords
+ wxRect GetPageRect() const;
+
+ // get our client size from the page size
+ wxSize GetSizeForPage(const wxSize& size) const;
+
+ // change thep age and send events about it (can be vetoed by user code)
+ void ChangePage(int nPage);
+
+ // scroll the tabs so that the first page shown becomes the given one
+ void ScrollTo(int page);
+
+ // scroll the tabs so that the first page shown becomes the given one
+ void ScrollLastTo(int page);
+
+ // the pages titles
+ wxArrayString m_titles;
+
+ // the current selection
+ size_t m_sel;
+
+ // the spin button to change the pages
+ wxSpinButton *m_spinbtn;
+
+ // the offset of the first page shown (may be changed with m_spinbtn)
+ wxCoord m_offset;
+
+ // the first and last currently visible tabs: the name is not completely
+ // accurate as m_lastVisible is, in fact, the first tab which is *not*
+ // visible: so the visible tabs are those with indexes such that
+ // m_firstVisible <= n < m_lastVisible
+ size_t m_firstVisible,
+ m_lastVisible;
+
+ // the last fully visible item, usually just m_lastVisible - 1 but may be
+ // different from it
+ size_t m_lastFullyVisible;
+
+ // the height of tabs in a normal notebook or the width of tabs in a
+ // notebook with tabs on a side
+ wxCoord m_heightTab;
+
+ // the biggest height (or width) of a notebook tab (used only if
+ // FixedSizeTabs()) or -1 if not calculated yet
+ wxCoord m_widthMax;
+
+ // the cached widths (or heights) of tabs
+ wxArrayInt m_widths;
+
+ // the icon indices
+ wxArrayInt m_images;
+
+ // the accel indexes for labels
+ wxArrayInt m_accels;
+
+ // the padding
+ wxSize m_sizePad;
+
+ DECLARE_DYNAMIC_CLASS(wxNotebook)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdNotebookInputHandler: translates SPACE and ENTER keys and the left mouse
+// click into button press/release actions
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdNotebookInputHandler : public wxStdInputHandler
+{
+public:
+ wxStdNotebookInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
+ virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
+ virtual bool HandleActivation(wxControl *control, bool activated);
+
+protected:
+ void HandleFocusChange(wxControl *control);
+};
+
+#endif // _WX_UNIV_NOTEBOOK_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/radiobox.h
+// Purpose: wxRadioBox declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 11.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_RADIOBOX_H_
+#define _WX_UNIV_RADIOBOX_H_
+
+#ifdef __GNUG__
+ #pragma interface "univradiobox.h"
+#endif
+
+class WXDLLEXPORT wxRadioButton;
+
+#include "wx/statbox.h"
+#include "wx/dynarray.h"
+
+WX_DEFINE_ARRAY(wxRadioButton *, wxArrayRadioButtons);
+
+// ----------------------------------------------------------------------------
+// wxRadioBox: a box full of radio buttons
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxRadioBox : public wxStaticBox,
+ public wxRadioBoxBase
+{
+public:
+ // wxRadioBox construction
+ wxRadioBox() { Init(); }
+
+ wxRadioBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString *choices = NULL,
+ int majorDim = 0,
+ long style = wxRA_SPECIFY_COLS,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, title, pos, size, n, choices,
+ majorDim, style, val, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString *choices = NULL,
+ int majorDim = 0,
+ long style = wxRA_SPECIFY_COLS,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr);
+
+ virtual ~wxRadioBox();
+
+ // implement wxRadioBox interface
+ virtual void SetSelection(int n);
+ virtual int GetSelection() const;
+
+ virtual int GetCount() const { return m_buttons.GetCount(); }
+ virtual int GetColumnCount() const { return m_numCols; }
+ virtual int GetRowCount() const { return m_numRows; }
+
+ virtual wxString GetString(int n) const;
+ virtual void SetString(int n, const wxString& label);
+
+ virtual void Enable(int n, bool enable = TRUE);
+ virtual void Show(int n, bool show = TRUE);
+
+ // we also override the wxControl methods to avoid virtual function hiding
+ virtual bool Enable(bool enable = TRUE);
+ virtual bool Show(bool show = TRUE);
+ virtual wxString GetLabel() const;
+ virtual void SetLabel(const wxString& label);
+
+ // wxUniversal-only methods
+
+ // another Append() version
+ void Append(int n, const wxString *choices);
+
+ // implementation only: called by wxRadioHookHandler
+ void OnRadioButton(wxEvent& event);
+ bool OnKeyDown(wxKeyEvent& event);
+
+protected:
+ // override the base class methods dealing with window positioning/sizing
+ // as we must move/size the buttons as well
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+ virtual wxSize DoGetBestClientSize() const;
+
+ // generate a radiobutton click event for the current item
+ void SendRadioEvent();
+
+ // common part of all ctors
+ void Init();
+
+ // check that the index is valid
+ bool IsValid(int n) const { return n >= 0 && n < GetCount(); }
+
+ // sets m_majorDim and calculate m_numCols and m_numRows
+ void SetMajorDim(int majorDim);
+
+ // calculate the max size of all buttons
+ wxSize GetMaxButtonSize() const;
+
+ // the currently selected radio button or -1
+ int m_selection;
+
+ // the parameters defining the button layout: majorDim meaning depends on
+ // the style and is the (max) number of columns if it includes
+ // wxRA_SPECIFY_COLS and is the (max) number of rows if it includes
+ // wxRA_SPECIFY_ROWS - the number of rows and columns is calculated from
+ // it
+ int m_majorDim,
+ m_numCols,
+ m_numRows;
+
+ // all radio buttons
+ wxArrayRadioButtons m_buttons;
+
+ // the event handler which is used to translate radiobutton events into
+ // radiobox one
+ wxEvtHandler *m_evtRadioHook;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxRadioBox)
+};
+
+#endif // _WX_UNIV_RADIOBOX_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/radiobut.h
+// Purpose: wxRadioButton declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_RADIOBUT_H_
+#define _WX_UNIV_RADIOBUT_H_
+
+#ifdef __GNUG__
+ #pragma interface "univradiobut.h"
+#endif
+
+#include "wx/checkbox.h"
+
+// ----------------------------------------------------------------------------
+// wxRadioButton
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxRadioButton : public wxCheckBox
+{
+public:
+ // constructors
+ wxRadioButton() { Init(); }
+
+ wxRadioButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRadioButtonNameStr)
+ {
+ Init();
+
+ Create(parent, id, label, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRadioButtonNameStr);
+
+ // override some base class methods
+ virtual void ChangeValue(bool value);
+
+protected:
+ // implement our own drawing
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ // we use the radio button bitmaps for size calculation
+ virtual wxSize GetBitmapSize() const;
+
+ // the radio button can only be cleared using this method, not
+ // ChangeValue() above - and it is protected as it can only be called by
+ // another radiobutton
+ void ClearValue();
+
+ // called when the radio button becomes checked: we clear all the buttons
+ // in the same group with us here
+ virtual void OnCheck();
+
+ // send event about radio button selection
+ virtual void SendEvent();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxRadioButton)
+};
+
+#endif // _WX_UNIV_RADIOBUT_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/renderer.h
+// Purpose: wxRenderer class declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ wxRenderer class is used to draw all wxWindows controls. This is an ABC and
+ the look of the application is determined by the concrete derivation of
+ wxRenderer used in the program.
+
+ It also contains a few static methods which may be used by the concrete
+ renderers and provide the functionality which is often similar or identical
+ in all renderers (using inheritance here would be more restrictive as the
+ given concrete renderer may need an arbitrary subset of the base class
+ methods)
+ */
+
+#ifdef __GNUG__
+ #pragma interface "renderer.h"
+#endif
+
+#ifndef _WX_UNIV_RENDERER_H_
+#define _WX_UNIV_RENDERER_H_
+
+class WXDLLEXPORT wxDC;
+class WXDLLEXPORT wxCheckListBox;
+class WXDLLEXPORT wxListBox;
+class WXDLLEXPORT wxMenu;
+class WXDLLEXPORT wxScrollBar;
+class WXDLLEXPORT wxTextCtrl;
+class WXDLLEXPORT wxWindow;
+
+#include "wx/string.h"
+#include "wx/gdicmn.h"
+#include "wx/scrolbar.h" // for wxScrollBar::Element
+
+#ifndef WX_PRECOMP
+ #include "wx/menu.h" // for wxMenuGeometryInfo
+#endif // WX_PRECOMP
+
+// ----------------------------------------------------------------------------
+// wxRenderer: abstract renderers interface
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxRenderer
+{
+public:
+ // drawing functions
+ // -----------------
+
+ // draw the controls background
+ virtual void DrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect,
+ int flags) = 0;
+
+ // draw the label inside the given rectangle with the specified alignment
+ // and optionally emphasize the character with the given index
+ virtual void DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL) = 0;
+
+ // same but also draw a bitmap if it is valid
+ virtual void DrawButtonLabel(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL) = 0;
+
+ // draw the border and optionally return the rectangle containing the
+ // region inside the border
+ virtual void DrawBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL) = 0;
+
+ // draw text control border (I hate to have a separate method for this but
+ // it is needed to accomodate GTK+)
+ virtual void DrawTextBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL) = 0;
+
+ // draw push button border and return the rectangle left for the label
+ virtual void DrawButtonBorder(wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL) = 0;
+
+ // draw a horizontal line
+ virtual void DrawHorizontalLine(wxDC& dc,
+ wxCoord y, wxCoord x1, wxCoord x2) = 0;
+
+ // draw a vertical line
+ virtual void DrawVerticalLine(wxDC& dc,
+ wxCoord x, wxCoord y1, wxCoord y2) = 0;
+
+ // draw a frame with the label (horizontal alignment can be specified)
+ virtual void DrawFrame(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT,
+ int indexAccel = -1) = 0;
+
+ // draw an arrow in the given direction
+ virtual void DrawArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw a scrollbar arrow (may be the same as arrow but may be not)
+ virtual void DrawScrollbarArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw the scrollbar thumb
+ virtual void DrawScrollbarThumb(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw a (part of) scrollbar shaft
+ virtual void DrawScrollbarShaft(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw the rectangle in the corner between two scrollbars
+ virtual void DrawScrollCorner(wxDC& dc,
+ const wxRect& rect) = 0;
+
+ // draw an item of a wxListBox
+ virtual void DrawItem(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw an item of a wxCheckListBox
+ virtual void DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw a checkbutton (bitmap may be invalid to use default one)
+ virtual void DrawCheckButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1) = 0;
+
+ // draw a radio button
+ virtual void DrawRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1) = 0;
+
+ // draw a (part of) line in the text control
+ virtual void DrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart = -1,
+ int selEnd = -1,
+ int flags = 0) = 0;
+
+ // draw a line wrap indicator
+ virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) = 0;
+
+ // draw a notebook tab
+ virtual void DrawTab(wxDC& dc,
+ const wxRect& rect,
+ wxDirection dir,
+ const wxString& label,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int indexAccel = -1) = 0;
+
+ // draw the slider shaft
+ virtual void DrawSliderShaft(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0,
+ wxRect *rectShaft = NULL) = 0;
+
+ // draw the slider thumb
+ virtual void DrawSliderThumb(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0) = 0;
+
+ // draw the slider ticks
+ virtual void DrawSliderTicks(wxDC& dc,
+ const wxRect& rect,
+ const wxSize& sizeThumb,
+ wxOrientation orient,
+ int start,
+ int end,
+ int step = 1,
+ int flags = 0) = 0;
+
+ // draw a menu bar item
+ virtual void DrawMenuBarItem(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags = 0,
+ int indexAccel = -1) = 0;
+
+ // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
+ //
+ // the geometryInfo is calculated by GetMenuGeometry() function from below
+ virtual void DrawMenuItem(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geometryInfo,
+ const wxString& label,
+ const wxString& accel,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int indexAccel = -1) = 0;
+
+ // draw a menu bar separator
+ virtual void DrawMenuSeparator(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geomInfo) = 0;
+
+ // misc functions
+ // --------------
+
+ // return the bitmaps to use for combobox button
+ virtual void GetComboBitmaps(wxBitmap *bmpNormal,
+ wxBitmap *bmpPressed,
+ wxBitmap *bmpDisabled) = 0;
+
+ // geometry functions
+ // ------------------
+
+ // get the dimensions of the border: rect.x/y contain the width/height of
+ // the left/top side, width/heigh - of the right/bottom one
+ virtual wxRect GetBorderDimensions(wxBorder border) const = 0;
+
+ // the scrollbars may be drawn either inside the window border or outside
+ // it - this function is used to decide how to draw them
+ virtual bool AreScrollbarsInsideBorder() const = 0;
+
+ // adjust the size of the control of the given class: for most controls,
+ // this just takes into account the border, but for some (buttons, for
+ // example) it is more complicated - the result being, in any case, that
+ // the control looks "nice" if it uses the adjusted rectangle
+ virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0;
+
+ // get the size of a scrollbar arrow
+ virtual wxSize GetScrollbarArrowSize() const = 0;
+
+ // gets the bounding box for a scrollbar element for the given (by default
+ // - current) thumb position
+ virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos = -1) const = 0;
+
+ // returns the size of the scrollbar shaft excluding the arrows
+ virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar) = 0;
+
+ // returns one of wxHT_SCROLLBAR_XXX constants
+ virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt) const = 0;
+
+ // translate the scrollbar position (in logical units) into physical
+ // coordinate (in pixels) and the other way round
+ virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos = -1) = 0;
+ virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
+ wxCoord coord) = 0;
+
+ // get the height of a listbox item from the base font height
+ virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0;
+
+ // get the size of a checkbox/radio button bitmap
+ virtual wxSize GetCheckBitmapSize() const = 0;
+ virtual wxSize GetRadioBitmapSize() const = 0;
+ virtual wxCoord GetCheckItemMargin() const = 0;
+
+ // convert between text rectangle and client rectangle for text controls:
+ // the former is typicall smaller to leave margins around text
+ virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
+ const wxRect& rectText) = 0;
+
+ // extra space is for line indicators
+ virtual wxRect GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rectTotal,
+ wxCoord *extraSpaceBeyond) = 0;
+
+ // get the overhang of a selected tab
+ virtual wxSize GetTabIndent() const = 0;
+
+ // get the padding around the text in a tab
+ virtual wxSize GetTabPadding() const = 0;
+
+ // get the default size of the slider in lesser dimension (i.e. height of a
+ // horizontal slider or width of a vertical one)
+ virtual wxCoord GetSliderDim() const = 0;
+
+ // get the length of the slider ticks displayed along side slider
+ virtual wxCoord GetSliderTickLen() const = 0;
+
+ // get the slider shaft rect from the total slider rect
+ virtual wxRect GetSliderShaftRect(const wxRect& rect,
+ wxOrientation orient) const = 0;
+
+ // get the size of the slider thumb for the given total slider rect
+ virtual wxSize GetSliderThumbSize(const wxRect& rect,
+ wxOrientation orient) const = 0;
+
+ // get the size of one progress bar step (in horz and vertical directions)
+ virtual wxSize GetProgressBarStep() const = 0;
+
+ // get the size of rectangle to use in the menubar for the given text rect
+ virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0;
+
+ // get the struct storing all layout info needed to draw all menu items
+ // (this can't be calculated for each item separately as they should be
+ // aligned)
+ //
+ // the returned pointer must be deleted by the caller
+ virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
+ const wxMenu& menu) const = 0;
+
+ // virtual dtor for any base class
+ virtual ~wxRenderer();
+
+protected:
+ // draw a frame around rectFrame rectangle but not touching the rectLabel
+ // one: this is used by DrawFrame()
+ void StandardDrawFrame(wxDC& dc,
+ const wxRect& rectFrame,
+ const wxRect& rectLabel);
+
+ // standard text line drawing: just use DrawText() and highlight the
+ // selected part
+ static void StandardDrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart, int selEnd,
+ int flags);
+
+ // standard scrollbar hit testing: this assumes that it only has 2 arrows
+ // and a thumb, so the themes which have more complicated scrollbars (e.g.
+ // BeOS) can't use this method
+ static wxRect StandardGetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos,
+ const wxSize& sizeArrow);
+ static wxHitTest StandardHitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt,
+ const wxSize& sizeArrow);
+ static wxCoord StandardScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos,
+ const wxSize& sizeArrow);
+ static int StandardPixelToScrollbar(const wxScrollBar *scrollbar,
+ wxCoord coord,
+ const wxSize& sizeArrow);
+ static wxCoord StandardScrollBarSize(const wxScrollBar *scrollbar,
+ const wxSize& sizeArrow);
+ static void StandardScrollBarThumbSize(wxCoord lenBar,
+ int thumbPos,
+ int thumbSize,
+ int range,
+ wxCoord *thumbStart,
+ wxCoord *thumbEnd);
+};
+
+// ----------------------------------------------------------------------------
+// wxDelegateRenderer: it is impossible to inherit from any of standard
+// renderers as their declarations are in private code, but you can use this
+// class to override only some of the Draw() functions - all the other ones
+// will be left to the original renderer
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxDelegateRenderer : public wxRenderer
+{
+public:
+ wxDelegateRenderer(wxRenderer *renderer) : m_renderer(renderer) { }
+
+ virtual void DrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect,
+ int flags)
+ { m_renderer->DrawBackground(dc, col, rect, flags); }
+ virtual void DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int align = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL)
+ { m_renderer->DrawLabel(dc, label, rect,
+ flags, align, indexAccel, rectBounds); }
+ virtual void DrawButtonLabel(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int flags = 0,
+ int align = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL)
+ { m_renderer->DrawButtonLabel(dc, label, image, rect,
+ flags, align, indexAccel, rectBounds); }
+ virtual void DrawBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL)
+ { m_renderer->DrawBorder(dc, border, rect, flags, rectIn); }
+ virtual void DrawTextBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL)
+ { m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); }
+ virtual void DrawButtonBorder(wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL)
+ { m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); }
+ virtual void DrawFrame(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int align = wxALIGN_LEFT,
+ int indexAccel = -1)
+ { m_renderer->DrawFrame(dc, label, rect, flags, align, indexAccel); }
+ virtual void DrawHorizontalLine(wxDC& dc,
+ wxCoord y, wxCoord x1, wxCoord x2)
+ { m_renderer->DrawHorizontalLine(dc, y, x1, x2); }
+ virtual void DrawVerticalLine(wxDC& dc,
+ wxCoord x, wxCoord y1, wxCoord y2)
+ { m_renderer->DrawVerticalLine(dc, x, y1, y2); }
+ virtual void DrawArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0)
+ { m_renderer->DrawArrow(dc, dir, rect, flags); }
+ virtual void DrawScrollbarArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0)
+ { m_renderer->DrawScrollbarArrow(dc, dir, rect, flags); }
+ virtual void DrawScrollbarThumb(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0)
+ { m_renderer->DrawScrollbarThumb(dc, orient, rect, flags); }
+ virtual void DrawScrollbarShaft(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0)
+ { m_renderer->DrawScrollbarShaft(dc, orient, rect, flags); }
+ virtual void DrawScrollCorner(wxDC& dc,
+ const wxRect& rect)
+ { m_renderer->DrawScrollCorner(dc, rect); }
+ virtual void DrawItem(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0)
+ { m_renderer->DrawItem(dc, label, rect, flags); }
+ virtual void DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0)
+ { m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); }
+ virtual void DrawCheckButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1)
+ { m_renderer->DrawCheckButton(dc, label, bitmap, rect,
+ flags, align, indexAccel); }
+ virtual void DrawRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1)
+ { m_renderer->DrawRadioButton(dc, label, bitmap, rect,
+ flags, align, indexAccel); }
+ virtual void DrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart = -1,
+ int selEnd = -1)
+ { m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd); }
+ virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect)
+ { m_renderer->DrawLineWrapMark(dc, rect); }
+
+ virtual void DrawTab(wxDC& dc,
+ const wxRect& rect,
+ wxDirection dir,
+ const wxString& label,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int accel = -1)
+ { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); }
+
+ virtual void DrawSliderShaft(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0,
+ wxRect *rectShaft = NULL)
+ { m_renderer->DrawSliderShaft(dc, rect, orient, flags, rectShaft); }
+ virtual void DrawSliderThumb(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0)
+ { m_renderer->DrawSliderThumb(dc, rect, orient, flags); }
+ virtual void DrawSliderTicks(wxDC& dc,
+ const wxRect& rect,
+ const wxSize& sizeThumb,
+ wxOrientation orient,
+ int start,
+ int end,
+ int step = 1,
+ int flags = 0)
+ { m_renderer->DrawSliderTicks(dc, rect, sizeThumb, orient,
+ start, end, start, flags); }
+
+ virtual void DrawMenuBarItem(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags = 0,
+ int indexAccel = -1)
+ { m_renderer->DrawMenuBarItem(dc, rect, label, flags, indexAccel); }
+ virtual void DrawMenuItem(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& gi,
+ const wxString& label,
+ const wxString& accel,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int indexAccel = -1)
+ { m_renderer->DrawMenuItem(dc, y, gi, label, accel,
+ bitmap, flags, indexAccel); }
+ virtual void DrawMenuSeparator(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geomInfo)
+ { m_renderer->DrawMenuSeparator(dc, y, geomInfo); }
+
+ virtual void GetComboBitmaps(wxBitmap *bmpNormal,
+ wxBitmap *bmpPressed,
+ wxBitmap *bmpDisabled)
+ { m_renderer->GetComboBitmaps(bmpNormal, bmpPressed, bmpDisabled); }
+
+ virtual void AdjustSize(wxSize *size, const wxWindow *window)
+ { m_renderer->AdjustSize(size, window); }
+ virtual wxRect GetBorderDimensions(wxBorder border) const
+ { return m_renderer->GetBorderDimensions(border); }
+ virtual bool AreScrollbarsInsideBorder() const
+ { return m_renderer->AreScrollbarsInsideBorder(); }
+
+ virtual wxSize GetScrollbarArrowSize() const
+ { return m_renderer->GetScrollbarArrowSize(); }
+ virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos = -1) const
+ { return m_renderer->GetScrollbarRect(scrollbar, elem, thumbPos); }
+ virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar)
+ { return m_renderer->GetScrollbarSize(scrollbar); }
+ virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt) const
+ { return m_renderer->HitTestScrollbar(scrollbar, pt); }
+ virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos = -1)
+ { return m_renderer->ScrollbarToPixel(scrollbar, thumbPos); }
+ virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
+ wxCoord coord)
+ { return m_renderer->PixelToScrollbar(scrollbar, coord); }
+ virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
+ { return m_renderer->GetListboxItemHeight(fontHeight); }
+ virtual wxSize GetCheckBitmapSize() const
+ { return m_renderer->GetCheckBitmapSize(); }
+ virtual wxSize GetRadioBitmapSize() const
+ { return m_renderer->GetRadioBitmapSize(); }
+ virtual wxCoord GetCheckItemMargin() const
+ { return m_renderer->GetCheckItemMargin(); }
+
+ virtual wxRect GetTextTotalArea(const wxTextCtrl *text, const wxRect& rect)
+ { return m_renderer->GetTextTotalArea(text, rect); }
+ virtual wxRect GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rect,
+ wxCoord *extraSpaceBeyond)
+ { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); }
+
+ virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); }
+ virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); }
+
+ virtual wxCoord GetSliderDim() const
+ { return m_renderer->GetSliderDim(); }
+ virtual wxCoord GetSliderTickLen() const
+ { return m_renderer->GetSliderTickLen(); }
+ virtual wxRect GetSliderShaftRect(const wxRect& rect,
+ wxOrientation orient) const
+ { return GetSliderShaftRect(rect, orient); }
+ virtual wxSize GetSliderThumbSize(const wxRect& rect,
+ wxOrientation orient) const
+ { return m_renderer->GetSliderThumbSize(rect, orient); }
+ virtual wxSize GetProgressBarStep() const
+ { return m_renderer->GetProgressBarStep(); }
+ virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const
+ { return m_renderer->GetMenuBarItemSize(sizeText); }
+ virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
+ const wxMenu& menu) const
+ { return m_renderer->GetMenuGeometry(win, menu); }
+
+protected:
+ wxRenderer *m_renderer;
+};
+
+// ----------------------------------------------------------------------------
+// wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
+// OnPaint()
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxControlRenderer
+{
+public:
+ // create a renderer for this dc with this "fundamental" renderer
+ wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer);
+
+ // operations
+ void DrawLabel(const wxBitmap& bitmap = wxNullBitmap,
+ wxCoord marginX = 0, wxCoord marginY = 0);
+#if wxUSE_LISTBOX
+ void DrawItems(const wxListBox *listbox,
+ size_t itemFirst, size_t itemLast);
+#endif // wxUSE_LISTBOX
+#if wxUSE_CHECKLISTBOX
+ void DrawCheckItems(const wxCheckListBox *listbox,
+ size_t itemFirst, size_t itemLast);
+#endif // wxUSE_CHECKLISTBOX
+ void DrawButtonBorder();
+ // the line must be either horizontal or vertical
+ void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
+ void DrawFrame();
+ void DrawBitmap(const wxBitmap& bitmap);
+ void DrawBackgroundBitmap();
+ void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld);
+#if wxUSE_GAUGE
+ void DrawProgressBar(const wxGauge *gauge);
+#endif // wxUSE_GAUGE
+
+ // accessors
+ wxWindow *GetWindow() const { return m_window; }
+ wxRenderer *GetRenderer() const { return m_renderer; }
+
+ wxDC& GetDC() { return m_dc; }
+
+ const wxRect& GetRect() const { return m_rect; }
+ wxRect& GetRect() { return m_rect; }
+
+ // static helpers
+ static void DrawBitmap(wxDC &dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int alignment = wxALIGN_CENTRE |
+ wxALIGN_CENTRE_VERTICAL,
+ wxStretch stretch = wxSTRETCH_NOT);
+
+private:
+ // common part of DrawItems() and DrawCheckItems()
+ void DoDrawItems(const wxListBox *listbox,
+ size_t itemFirst, size_t itemLast,
+ bool isCheckLbox = FALSE);
+
+ wxWindow *m_window;
+ wxRenderer *m_renderer;
+ wxDC& m_dc;
+ wxRect m_rect;
+};
+
+#endif // _WX_UNIV_RENDERER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/scrarrow.h
+// Purpose: wxScrollArrows class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 22.01.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_SCRARROW_H_
+#define _WX_UNIV_SCRARROW_H_
+
+#ifdef __GNUG__
+ #pragma interface "univscrarrow.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxScrollArrows is not a control but just a class containing the common
+// functionality of scroll arrows, whether part of scrollbars, spin ctrls or
+// anything else.
+//
+// To customize its behaviour, wxScrollArrows doesn't use any virtual methods
+// but instead a callback pointer to a wxControlWithArrows object which is used
+// for all control-dependent stuff. Thus, to use wxScrollArrows, you just need
+// to derive from the wxControlWithArrows interface and implement its methods.
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxControlWithArrows;
+class WXDLLEXPORT wxDC;
+class WXDLLEXPORT wxMouseEvent;
+class WXDLLEXPORT wxRect;
+class WXDLLEXPORT wxRenderer;
+
+// ----------------------------------------------------------------------------
+// wxScrollArrows: an abstraction of scrollbar arrow
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxScrollArrows
+{
+public:
+ enum Arrow
+ {
+ Arrow_None = -1,
+ Arrow_First, // left or top
+ Arrow_Second, // right or bottom
+ Arrow_Max
+ };
+
+ // ctor requires a back pointer to wxControlWithArrows
+ wxScrollArrows(wxControlWithArrows *control);
+
+ // draws the arrow on the given DC in the given rectangle, uses
+ // wxControlWithArrows::GetArrowState() to get its current state
+ void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect,
+ bool scrollbarLike = FALSE) const;
+
+ // process a mouse move, enter or leave event, possibly calling
+ // wxControlWithArrows::SetArrowState() if wxControlWithArrows::HitTest()
+ // says that the mosue has left/entered an arrow
+ bool HandleMouseMove(const wxMouseEvent& event) const;
+
+ // process a mouse click event
+ bool HandleMouse(const wxMouseEvent& event) const;
+
+ // dtor
+ ~wxScrollArrows();
+
+private:
+ // set or clear the wxCONTROL_CURRENT flag for the arrow
+ void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const;
+
+ // the main control
+ wxControlWithArrows *m_control;
+
+ // the data for the mouse capture
+ struct wxScrollArrowCaptureData *m_captureData;
+};
+
+// ----------------------------------------------------------------------------
+// wxControlWithArrows: interface implemented by controls using wxScrollArrows
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxControlWithArrows
+{
+public:
+ // get the renderer to use for drawing the arrows
+ virtual wxRenderer *GetRenderer() const = 0;
+
+ // get the controls window (used for mouse capturing)
+ virtual wxWindow *GetWindow() = 0;
+
+ // get the orientation of the arrows (vertical or horizontal)
+ virtual bool IsVertical() const = 0;
+
+ // get the state of this arrow as combination of wxCONTROL_XXX flags
+ virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0;
+
+ // set or clear the specified flag in the arrow state: this function is
+ // responsible for refreshing the control
+ virtual void SetArrowFlag(wxScrollArrows::Arrow arrow,
+ int flag, bool set = TRUE) = 0;
+
+ // hit testing: return on which arrow the point is (or Arrow_None)
+ virtual wxScrollArrows::Arrow HitTest(const wxPoint& pt) const = 0;
+
+ // called when the arrow is pressed, return TRUE to continue scrolling and
+ // FALSE to stop it
+ virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0;
+};
+
+#endif // _WX_UNIV_SCRARROW_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/scrolbar.h
+// Purpose: wxScrollBar for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_SCROLBAR_H_
+#define _WX_UNIV_SCROLBAR_H_
+
+#ifdef __GNUG__
+ #pragma interface "univscrolbar.h"
+#endif
+
+class WXDLLEXPORT wxScrollTimer;
+
+#include "wx/univ/scrarrow.h"
+
+// ----------------------------------------------------------------------------
+// the actions supported by this control
+// ----------------------------------------------------------------------------
+
+// scroll the bar
+#define wxACTION_SCROLL_START _T("start") // to the beginning
+#define wxACTION_SCROLL_END _T("end") // to the end
+#define wxACTION_SCROLL_LINE_UP _T("lineup") // one line up/left
+#define wxACTION_SCROLL_PAGE_UP _T("pageup") // one page up/left
+#define wxACTION_SCROLL_LINE_DOWN _T("linedown") // one line down/right
+#define wxACTION_SCROLL_PAGE_DOWN _T("pagedown") // one page down/right
+
+// the scrollbar thumb may be dragged
+#define wxACTION_SCROLL_THUMB_DRAG _T("thumbdrag")
+#define wxACTION_SCROLL_THUMB_MOVE _T("thumbmove")
+#define wxACTION_SCROLL_THUMB_RELEASE _T("thumbrelease")
+
+// ----------------------------------------------------------------------------
+// wxScrollBar
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxScrollBar : public wxScrollBarBase,
+ public wxControlWithArrows
+{
+public:
+ // scrollbar elements: they correspond to wxHT_SCROLLBAR_XXX constants but
+ // start from 0 which allows to use them as array indices
+ enum Element
+ {
+ Element_Arrow_Line_1,
+ Element_Arrow_Line_2,
+ Element_Arrow_Page_1,
+ Element_Arrow_Page_2,
+ Element_Thumb,
+ Element_Bar_1,
+ Element_Bar_2,
+ Element_Max
+ };
+
+ wxScrollBar();
+ wxScrollBar(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSB_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxScrollBarNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSB_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxScrollBarNameStr);
+
+ virtual ~wxScrollBar();
+
+ // implement base class pure virtuals
+ virtual int GetThumbPosition() const;
+ virtual int GetThumbSize() const;
+ virtual int GetPageSize() const;
+ virtual int GetRange() const;
+
+ virtual void SetThumbPosition(int thumbPos);
+ virtual void SetScrollbar(int position, int thumbSize,
+ int range, int pageSize,
+ bool refresh = TRUE);
+
+ // wxScrollBar actions
+ void ScrollToStart();
+ void ScrollToEnd();
+ void ScrollLines(int nLines);
+ void ScrollPages(int nPages);
+
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = 0,
+ const wxString& strArg = wxEmptyString);
+
+ // wxScrollBar sub elements state (combination of wxCONTROL_XXX)
+ void SetState(Element which, int flags);
+ int GetState(Element which) const;
+
+ // implement wxControlWithArrows methods
+ virtual wxRenderer *GetRenderer() const { return m_renderer; }
+ virtual wxWindow *GetWindow() { return this; }
+ virtual bool IsVertical() const { return wxScrollBarBase::IsVertical(); }
+ virtual int GetArrowState(wxScrollArrows::Arrow arrow) const;
+ virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set);
+ virtual bool OnArrow(wxScrollArrows::Arrow arrow);
+ virtual wxScrollArrows::Arrow HitTest(const wxPoint& pt) const;
+
+ // for wxControlRenderer::DrawScrollbar() only
+ const wxScrollArrows& GetArrows() const { return m_arrows; }
+
+protected:
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoDraw(wxControlRenderer *renderer);
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // event handlers
+ void OnIdle(wxIdleEvent& event);
+
+ // SetThumbPosition() helper
+ void DoSetThumb(int thumbPos);
+
+ // common part of all ctors
+ void Init();
+
+private:
+ // total range of the scrollbar in logical units
+ int m_range;
+
+ // the current and previous (after last refresh - this is used for
+ // repainting optimisation) size of the thumb in logical units (from 0 to
+ // m_range) and its position (from 0 to m_range - m_thumbSize)
+ int m_thumbSize,
+ m_thumbPos,
+ m_thumbPosOld;
+
+ // the page size, i.e. the number of lines by which to scroll when page
+ // up/down action is performed
+ int m_pageSize;
+
+ // the state of the sub elements
+ int m_elementsState[Element_Max];
+
+ // the dirty flag: if set, scrollbar must be updated
+ bool m_dirty;
+
+ // the object handling the arrows
+ wxScrollArrows m_arrows;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxScrollBar)
+};
+
+// ----------------------------------------------------------------------------
+// common scrollbar input handler: it manages clicks on the standard scrollbar
+// elements (line arrows, bar, thumb)
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdScrollBarInputHandler : public wxStdInputHandler
+{
+public:
+ // constructor takes a renderer (used for scrollbar hit testing) and the
+ // base handler to which all unhandled events are forwarded
+ wxStdScrollBarInputHandler(wxRenderer *renderer,
+ wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
+
+ virtual ~wxStdScrollBarInputHandler();
+
+ // this method is called by wxScrollBarTimer only and may be overridden
+ //
+ // return TRUE to continue scrolling, FALSE to stop the timer
+ virtual bool OnScrollTimer(wxScrollBar *scrollbar,
+ const wxControlAction& action);
+
+protected:
+ // the methods which must be overridden in the derived class
+
+ // return TRUE if the mouse button can be used to activate scrollbar, FALSE
+ // if not (only left mouse button can do it under Windows, any button under
+ // GTK+)
+ virtual bool IsAllowedButton(int button) = 0;
+
+ // set or clear the specified flag on the scrollbar element corresponding
+ // to m_htLast
+ void SetElementState(wxScrollBar *scrollbar, int flag, bool doIt);
+
+ // [un]highlight the scrollbar element corresponding to m_htLast
+ virtual void Highlight(wxScrollBar *scrollbar, bool doIt)
+ { SetElementState(scrollbar, wxCONTROL_CURRENT, doIt); }
+
+ // [un]press the scrollbar element corresponding to m_htLast
+ virtual void Press(wxScrollBar *scrollbar, bool doIt)
+ { SetElementState(scrollbar, wxCONTROL_PRESSED, doIt); }
+
+ // stop scrolling because we reached the end point
+ void StopScrolling(wxScrollBar *scrollbar);
+
+ // get the mouse coordinates in the scrollbar direction from the event
+ wxCoord GetMouseCoord(const wxScrollBar *scrollbar,
+ const wxMouseEvent& event) const;
+
+ // generate a "thumb move" action for this mouse event
+ void HandleThumbMove(wxScrollBar *scrollbar, const wxMouseEvent& event);
+
+ // the window (scrollbar) which has capture or NULL and the flag telling if
+ // the mouse is inside the element which captured it or not
+ wxWindow *m_winCapture;
+ bool m_winHasMouse;
+ int m_btnCapture; // the mouse button which has captured mouse
+
+ // the position where we started scrolling by page
+ wxPoint m_ptStartScrolling;
+
+ // one of wxHT_SCROLLBAR_XXX value: where has the mouse been last time?
+ wxHitTest m_htLast;
+
+ // the renderer (we use it only for hit testing)
+ wxRenderer *m_renderer;
+
+ // the offset of the top/left of the scrollbar relative to the mouse to
+ // keep during the thumb drag
+ int m_ofsMouse;
+
+ // the timer for generating scroll events when the mouse stays pressed on
+ // a scrollbar
+ wxScrollTimer *m_timerScroll;
+};
+
+#endif // _WX_UNIV_SCROLBAR_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/scrthumb.h
+// Purpose: wxScrollThumb class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_SCRTHUMB_H_
+#define _WX_UNIV_SCRTHUMB_H_
+
+#ifdef __GNUG__
+ #pragma interface "univscrthumb.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxScrollThumb is not a control but just a class containing the common
+// functionality of scroll thumb such as used by scrollbars, sliders and maybe
+// other (user) controls
+//
+// This class is similar to wxScrollThumb.
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxControlWithThumb;
+class WXDLLEXPORT wxMouseEvent;
+class WXDLLEXPORT wxRect;
+class WXDLLEXPORT wxScrollTimer;
+
+#include "wx/timer.h"
+
+// ----------------------------------------------------------------------------
+// wxScrollThumb: an abstraction of scrollbar thumb
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxScrollThumb
+{
+public:
+ enum Shaft
+ {
+ Shaft_None = -1,
+ Shaft_Above, // or to the left of the thumb
+ Shaft_Below, // or to the right of the thumb
+ Shaft_Thumb, // on the thumb
+ Shaft_Max
+ };
+
+ // ctor requires a back pointer to wxControlWithThumb
+ wxScrollThumb(wxControlWithThumb *control);
+
+ // process a mouse click: will capture the mouse if the button was pressed
+ // on either the thumb (start dragging it then) or the shaft (start
+ // scrolling)
+ bool HandleMouse(const wxMouseEvent& event) const;
+
+ // process a mouse move
+ bool HandleMouseMove(const wxMouseEvent& event) const;
+
+ // dtor
+ ~wxScrollThumb();
+
+private:
+ // do we have the mouse capture?
+ bool HasCapture() const { return m_captureData != NULL; }
+
+ // get the coord of this event in the direction we're interested in (y for
+ // vertical shaft or x for horizontal ones)
+ wxCoord GetMouseCoord(const wxMouseEvent& event) const;
+
+ // get the position of the thumb corresponding to the current mouse
+ // position (can only be called while we're dragging the thumb!)
+ int GetThumbPos(const wxMouseEvent& event) const;
+
+ // the main control
+ wxControlWithThumb *m_control;
+
+ // the part of it where the mouse currently is
+ Shaft m_shaftPart;
+
+ // the data for the mouse capture
+ struct WXDLLEXPORT wxScrollThumbCaptureData *m_captureData;
+};
+
+// ----------------------------------------------------------------------------
+// wxControlWithThumb: interface implemented by controls using wxScrollThumb
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxControlWithThumb
+{
+public:
+ // simple accessors
+ // ----------------
+
+ // get the controls window (used for mouse capturing)
+ virtual wxWindow *GetWindow() = 0;
+
+ // get the orientation of the shaft (vertical or horizontal)
+ virtual bool IsVertical() const = 0;
+
+ // geometry functions
+ // ------------------
+
+ // hit testing: return part of the shaft the point is in (or Shaft_None)
+ virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const = 0;
+
+ // get the current position in pixels of the thumb
+ virtual wxCoord ThumbPosToPixel() const = 0;
+
+ // transform from pixel offset to the thumb logical position
+ virtual int PixelToThumbPos(wxCoord x) const = 0;
+
+ // callbacks
+ // ---------
+
+ // set or clear the specified flag in the arrow state: this function is
+ // responsible for refreshing the control
+ virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart,
+ int flag,
+ bool set = TRUE) = 0;
+
+ // called when the user starts dragging the thumb
+ virtual void OnThumbDragStart(int pos) = 0;
+
+ // called while the user drags the thumb
+ virtual void OnThumbDrag(int pos) = 0;
+
+ // called when the user stops dragging the thumb
+ virtual void OnThumbDragEnd(int pos) = 0;
+
+ // called before starting to call OnPageScroll() - gives the control the
+ // possibility to remember its current state
+ virtual void OnPageScrollStart() = 0;
+
+ // called while the user keeps the mouse pressed above/below the thumb,
+ // return TRUE to continue scrollign and FALSE to stop it (e.g. because the
+ // scrollbar has reached the top/bottom)
+ virtual bool OnPageScroll(int pageInc) = 0;
+};
+
+#endif // _WX_UNIV_SCRTHUMB_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/scrtimer.h
+// Purpose: wxScrollTimer: small helper class for wxScrollArrow/Thumb
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 18.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// NB: this class is implemented in scrolbar.cpp
+
+#include "wx/timer.h"
+
+// ----------------------------------------------------------------------------
+// wxScrollTimer: the timer used when the arrow or scrollbar shaft is kept
+// pressed
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxScrollTimer : public wxTimer
+{
+public:
+ // default ctor
+ wxScrollTimer();
+
+ // start generating the events
+ void StartAutoScroll();
+
+ // the base class method
+ virtual void Notify();
+
+protected:
+ // to implement in derived classes: perform the scroll action and return
+ // TRUE to continue scrolling or FALSE to stop
+ virtual bool DoNotify() = 0;
+
+ // should we skip the next timer event?
+ bool m_skipNext;
+};
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/setup.h
+// Purpose: configuration settings for wxUniversal/MSW
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_SETUP_H_
+#define _WX_UNIV_SETUP_H_
+
+// ----------------------------------------------------------------------------
+// undef everything
+// ----------------------------------------------------------------------------
+
+#define wxUSE_GUI 1
+#define WXWIN_COMPATIBILITY 0
+#define wxICON_IS_BITMAP 0
+#define wxFONT_SIZE_COMPATIBILITY 0
+#define wxDIALOG_UNIT_COMPATIBILITY 0
+#define wxUSE_DEBUG_CONTEXT 0
+#define wxUSE_MEMORY_TRACING 0
+#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
+#define wxUSE_DEBUG_NEW_ALWAYS 0
+#define wxUSE_ON_FATAL_EXCEPTION 0
+
+#define wxUSE_UNICODE 0
+#define wxUSE_WCHAR_T 0
+#define wxUSE_LOG 1
+#define wxUSE_THREADS 0
+#define wxUSE_STREAMS 0
+#define wxUSE_STD_IOSTREAM 0
+#define wxUSE_SERIAL 0
+#define wxUSE_LONGLONG 1
+#define wxUSE_TIMER 1
+#define wxUSE_STOPWATCH 1
+#define wxUSE_TIMEDATE 0
+#define wxUSE_DATETIME 0
+#define wxUSE_CONFIG 0
+#define wxUSE_CONFIG_NATIVE 0
+#define wxUSE_DIALUP_MANAGER 0
+#define wxUSE_DYNLIB_CLASS 0
+#define wxUSE_SOCKETS 0
+#define wxUSE_FILESYSTEM 0
+#define wxUSE_FS_ZIP 0
+#define wxUSE_FS_INET 0
+#define wxUSE_ZIPSTREAM 0
+#define wxUSE_ZLIB 0
+#define wxUSE_FILESYSTEM 0
+#define wxUSE_FS_ZIP 0
+#define wxUSE_FS_INET 0
+#define wxUSE_ZIPSTREAM 0
+#define wxUSE_ZLIB 0
+#define wxUSE_APPLE_IEEE 0
+#define wxUSE_FILE 0
+#define wxUSE_FFILE 1
+#define wxUSE_TEXTFILE 0
+#define wxUSE_INTL 0
+#define wxUSE_MENUS 1
+#define wxUSE_TOOLBAR 0
+#define wxUSE_TOOLBAR_NATIVE 0
+#define wxUSE_TOOLBAR_SIMPLE 0
+#define wxUSE_NOTEBOOK 1
+#define wxUSE_FONTMAP 0
+#define wxUSE_MIMETYPE 0
+
+#define wxUSE_CONTROLS 1
+#define wxUSE_POPUPWIN 1
+#define wxUSE_BUTTON 1
+#define wxUSE_BMPBUTTON 1
+#define wxUSE_CARET 1
+#define wxUSE_CHECKBOX 1
+#define wxUSE_CHECKLISTBOX 1
+#define wxUSE_CHOICE 0
+#define wxUSE_COMBOBOX 1
+#define wxUSE_GAUGE 1
+#define wxUSE_LISTBOX 1
+#define wxUSE_LISTCTRL 0
+#define wxUSE_RADIOBOX 1
+#define wxUSE_RADIOBTN 1
+#define wxUSE_SASH 0
+#define wxUSE_SCROLLBAR 1
+#define wxUSE_SLIDER 1
+#define wxUSE_SPINBTN 1
+#define wxUSE_SPINCTRL 1
+#define wxUSE_STATBOX 1
+#define wxUSE_STATLINE 1
+#define wxUSE_STATTEXT 1
+#define wxUSE_STATBMP 1
+#define wxUSE_STATUSBAR 0
+#define wxUSE_TEXTCTRL 1
+#define wxUSE_TOOLTIPS 0
+#define wxUSE_TREECTRL 0
+
+#define wxUSE_NATIVE_STATUSBAR 0
+#define wxUSE_BUTTONBAR 0
+#define wxUSE_GRID 0
+#define wxUSE_NEW_GRID 0
+#define wxUSE_VALIDATORS 0
+#define wxUSE_ACCEL 1
+#define wxUSE_GENERIC_DIALOGS_IN_MSW 0
+#define wxUSE_COMMON_DIALOGS 0
+#define wxUSE_TEXTDLG 0
+#define wxUSE_PROGRESSDLG 0
+#define wxUSE_BUSYINFO 0
+#define wxUSE_DIRDLG 0
+#define wxUSE_FONTDLG 0
+#define wxUSE_FILEDLG 0
+#define wxUSE_TEXTDLG 0
+#define wxUSE_CHOICEDLG 0
+#define wxUSE_NUMBERDLG 0
+#define wxUSE_STARTUP_TIPS 0
+
+#define wxUSE_METAFILE 0
+#define wxUSE_ENH_METAFILE 0
+#define wxUSE_WIN_METAFILES_ALWAYS 0
+#define wxUSE_DOC_VIEW_ARCHITECTURE 0
+#define wxUSE_MDI_ARCHITECTURE 0
+#define wxUSE_PRINTING_ARCHITECTURE 0
+#define wxUSE_HTML 0
+#define wxUSE_PLOT 0
+#define wxUSE_GLCANVAS 0
+#define wxUSE_TREELAYOUT 0
+#define wxUSE_IPC 0
+#define wxUSE_HELP 0
+#define wxUSE_MS_HTML_HELP 0
+#define wxUSE_RESOURCES 0
+#define wxUSE_CONSTRAINTS 1
+#define wxUSE_CLIPBOARD 1
+#define wxUSE_DATAOBJ 1
+#define wxUSE_SPLINES 0
+#define wxUSE_DRAG_AND_DROP 0
+#define wxUSE_XPM_IN_MSW 1
+#define wxUSE_IMAGE_LOADING_IN_MSW 1
+#define wxUSE_RESOURCE_LOADING_IN_MSW 0
+#define wxUSE_WX_RESOURCES 0
+#define wxUSE_POSTSCRIPT 0
+#define wxUSE_AFM_FOR_POSTSCRIPT 0
+#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
+#define wxUSE_ODBC 0
+#define wxODBC_FWD_ONLY_CURSORS 0
+#define wxODBC_BACKWARD_COMPATABILITY 0
+#define REMOVE_UNUSED_ARG 1
+#define wxUSE_IOSTREAMH 0
+#define wxUSE_LIBPNG 0
+#define wxUSE_LIBJPEG 0
+#define wxUSE_LIBTIFF 0
+#define wxUSE_GIF 0
+#define wxUSE_PNM 0
+#define wxUSE_PCX 0
+#define wxUSE_MFC 0
+#define wxUSE_OLE 0
+#define wxUSE_CTL3D 0
+#define wxUSE_ITSY_BITSY 0
+#define wxUSE_DYNAMIC_CLASSES 1
+
+#endif // _WX_UNIV_SETUP_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/slider.h
+// Purpose: wxSlider control for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 09.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma interface "univslider.h"
+#endif
+
+#ifndef _WX_UNIV_SLIDER_H_
+#define _WX_UNIV_SLIDER_H_
+
+#include "wx/univ/scrthumb.h"
+
+// ----------------------------------------------------------------------------
+// the actions supported by this control
+// ----------------------------------------------------------------------------
+
+// our actions are the same as scrollbars
+
+#define wxACTION_SLIDER_START _T("start") // to the beginning
+#define wxACTION_SLIDER_END _T("end") // to the end
+#define wxACTION_SLIDER_LINE_UP _T("lineup") // one line up/left
+#define wxACTION_SLIDER_PAGE_UP _T("pageup") // one page up/left
+#define wxACTION_SLIDER_LINE_DOWN _T("linedown") // one line down/right
+#define wxACTION_SLIDER_PAGE_DOWN _T("pagedown") // one page down/right
+#define wxACTION_SLIDER_PAGE_CHANGE _T("pagechange")// change page by numArg
+
+#define wxACTION_SLIDER_THUMB_DRAG _T("thumbdrag")
+#define wxACTION_SLIDER_THUMB_MOVE _T("thumbmove")
+#define wxACTION_SLIDER_THUMB_RELEASE _T("thumbrelease")
+
+// ----------------------------------------------------------------------------
+// wxSlider
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxSlider : public wxSliderBase,
+ public wxControlWithThumb
+{
+public:
+ // ctors and such
+ wxSlider();
+
+ wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+
+ // implement base class pure virtuals
+ virtual int GetValue() const;
+ virtual void SetValue(int value);
+
+ virtual void SetRange(int minValue, int maxValue);
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ virtual void SetLineSize(int lineSize);
+ virtual void SetPageSize(int pageSize);
+ virtual int GetLineSize() const;
+ virtual int GetPageSize() const;
+
+ virtual void SetThumbLength(int lenPixels);
+ virtual int GetThumbLength() const;
+
+ virtual void SetTickFreq(int n, int WXUNUSED(dummy) = 0);
+ virtual int GetTickFreq() const { return m_tickFreq; }
+
+ // wxUniv-specific methods
+ // -----------------------
+
+ // is this a vertical slider?
+ bool IsVert() const { return (GetWindowStyle() & wxSL_VERTICAL) != 0; }
+
+ // get the slider orientation
+ wxOrientation GetOrientation() const
+ { return IsVert() ? wxVERTICAL : wxHORIZONTAL; }
+
+ // do we have labels?
+ bool HasLabels() const { return (GetWindowStyle() & wxSL_LABELS) != 0; }
+
+ // do we have ticks?
+ bool HasTicks() const { return (GetWindowStyle() & wxSL_TICKS) != 0; }
+
+ // implement wxControlWithThumb interface
+ virtual wxWindow *GetWindow() { return this; }
+ virtual bool IsVertical() const { return IsVert(); }
+
+ virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const;
+ virtual wxCoord ThumbPosToPixel() const;
+ virtual int PixelToThumbPos(wxCoord x) const;
+
+ virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart,
+ int flag,
+ bool set = TRUE);
+
+ virtual void OnThumbDragStart(int pos);
+ virtual void OnThumbDrag(int pos);
+ virtual void OnThumbDragEnd(int pos);
+ virtual void OnPageScrollStart();
+ virtual bool OnPageScroll(int pageInc);
+
+ // for wxStdSliderButtonInputHandler
+ wxScrollThumb& GetThumb() { return m_thumb; }
+
+protected:
+ enum
+ {
+ INVALID_THUMB_VALUE = -0xffff
+ };
+
+ // overridden base class virtuals
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoDraw(wxControlRenderer *renderer);
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = 0,
+ const wxString& strArg = wxEmptyString);
+
+ // event handlers
+ void OnSize(wxSizeEvent& event);
+
+ // common part of all ctors
+ void Init();
+
+ // normalize the value to fit in the range
+ int NormalizeValue(int value) const;
+
+ // change the value by the given increment, return TRUE if really changed
+ bool ChangeValueBy(int inc);
+
+ // change the value to the given one
+ bool ChangeValueTo(int value);
+
+ // is the value inside the range?
+ bool IsInRange(int value) { return (value >= m_min) && (value <= m_max); }
+
+ // format the value for printing as label
+ virtual wxString FormatValue(int value) const;
+
+ // calculate max label size
+ wxSize CalcLabelSize() const;
+
+ // calculate m_rectLabel/Slider
+ void CalcGeometry();
+
+ // get the thumb size
+ wxSize GetThumbSize() const;
+
+ // get the shaft rect (uses m_rectSlider which is supposed to be calculated)
+ wxRect GetShaftRect() const;
+
+ // calc the current thumb position using the shaft rect (if the pointer is
+ // NULL, we calculate it here too)
+ void CalcThumbRect(const wxRect *rectShaft,
+ wxRect *rectThumbOut,
+ wxRect *rectLabelOut,
+ int value = INVALID_THUMB_VALUE) const;
+
+ // return the slider rect calculating it if needed
+ const wxRect& GetSliderRect() const;
+
+ // refresh the current thumb position
+ void RefreshThumb();
+
+private:
+ // get the default thumb size (without using m_thumbSize)
+ wxSize GetDefaultThumbSize() const;
+
+ // the object which manages our thumb
+ wxScrollThumb m_thumb;
+
+ // the slider range and value
+ int m_min,
+ m_max,
+ m_value;
+
+ // the tick frequence (default is 1)
+ int m_tickFreq;
+
+ // the line and page increments (logical units)
+ int m_lineSize,
+ m_pageSize;
+
+ // the size of the thumb (in pixels)
+ int m_thumbSize;
+
+ // the part of the client area reserved for the label, the ticks and the
+ // part for the slider itself
+ wxRect m_rectLabel,
+ m_rectTicks,
+ m_rectSlider;
+
+ // the state of the thumb (wxCONTROL_XXX constants sum)
+ int m_thumbFlags;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxSlider)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdSliderButtonInputHandler: default slider input handling
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdSliderButtonInputHandler : public wxStdInputHandler
+{
+public:
+ // default ctor
+ wxStdSliderButtonInputHandler(wxInputHandler *inphand)
+ : wxStdInputHandler(inphand)
+ {
+ }
+
+ // base class methods
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event);
+
+ virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
+};
+
+#endif // _WX_UNIV_SLIDER_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/spinbutt.h
+// Purpose: universal version of wxSpinButton
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 21.01.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_SPINBUTT_H_
+#define _WX_UNIV_SPINBUTT_H_
+
+#ifdef __GNUG__
+ #pragma interface "univspinbutt.h"
+#endif
+
+#include "wx/univ/scrarrow.h"
+
+// ----------------------------------------------------------------------------
+// wxSpinButton
+// ----------------------------------------------------------------------------
+
+// actions supported by this control
+#define wxACTION_SPIN_INC _T("inc")
+#define wxACTION_SPIN_DEC _T("dec")
+
+class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase,
+ public wxControlWithArrows
+{
+public:
+ wxSpinButton();
+ wxSpinButton(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
+ const wxString& name = wxSPIN_BUTTON_NAME);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
+ const wxString& name = wxSPIN_BUTTON_NAME);
+
+ // implement wxSpinButtonBase methods
+ virtual int GetValue() const;
+ virtual void SetValue(int val);
+ virtual void SetRange(int minVal, int maxVal);
+
+ // implement wxControlWithArrows methods
+ virtual wxRenderer *GetRenderer() const { return m_renderer; }
+ virtual wxWindow *GetWindow() { return this; }
+ virtual bool IsVertical() const { return wxSpinButtonBase::IsVertical(); }
+ virtual int GetArrowState(wxScrollArrows::Arrow arrow) const;
+ virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set);
+ virtual bool OnArrow(wxScrollArrows::Arrow arrow);
+ virtual wxScrollArrows::Arrow HitTest(const wxPoint& pt) const;
+
+ // for wxStdSpinButtonInputHandler
+ const wxScrollArrows& GetArrows() { return m_arrows; }
+
+protected:
+ virtual wxSize DoGetBestClientSize() const;
+ virtual void DoDraw(wxControlRenderer *renderer);
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = 0,
+ const wxString& strArg = wxEmptyString);
+
+ // the common part of all ctors
+ void Init();
+
+ // normalize the value to fit into min..max range
+ int NormalizeValue(int value) const;
+
+ // change the value by +1/-1 and send the event, return TRUE if value was
+ // changed
+ bool ChangeValue(int inc);
+
+ // get the rectangles for our 2 arrows
+ void CalcArrowRects(wxRect *rect1, wxRect *rect2) const;
+
+ // the current controls value
+ int m_value;
+
+private:
+ // the object which manages our arrows
+ wxScrollArrows m_arrows;
+
+ // the state (combination of wxCONTROL_XXX flags) of the arrows
+ int m_arrowsState[wxScrollArrows::Arrow_Max];
+
+ DECLARE_DYNAMIC_CLASS(wxSpinButton)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdSpinButtonInputHandler: manages clicks on them (use arrows like
+// wxStdScrollBarInputHandler) and processes keyboard events too
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdSpinButtonInputHandler : public wxStdInputHandler
+{
+public:
+ wxStdSpinButtonInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event);
+};
+
+#endif // _WX_UNIV_SPINBUTT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/statbmp.h
+// Purpose: wxStaticBitmap class for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_STATBMP_H_
+#define _WX_UNIV_STATBMP_H_
+
+#ifdef __GNUG__
+ #pragma interface "univstatbmp.h"
+#endif
+
+#include "wx/bitmap.h"
+
+// ----------------------------------------------------------------------------
+// wxStaticBitmap
+// ----------------------------------------------------------------------------
+
+class wxStaticBitmap : public wxStaticBitmapBase
+{
+public:
+ wxStaticBitmap()
+ {
+ }
+
+ wxStaticBitmap(wxWindow *parent,
+ const wxBitmap& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0)
+ {
+ Create(parent, -1, label, pos, size, style);
+ }
+
+ wxStaticBitmap(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBitmapNameStr)
+ {
+ Create(parent, id, label, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBitmapNameStr);
+
+ virtual void SetBitmap(const wxBitmap& bitmap);
+ virtual void SetIcon(const wxIcon& icon);
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
+
+ wxIcon GetIcon() const;
+
+private:
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ // the bitmap which we show
+ wxBitmap m_bitmap;
+
+ DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
+};
+
+#endif // _WX_UNIV_STATBMP_H_
--- /dev/null
+//////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/statbox.h
+// Purpose: wxStaticBox declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_STATBOX_H_
+#define _WX_UNIV_STATBOX_H_
+
+#ifdef __GNUG__
+ #pragma interface "univstatbox.h"
+#endif
+
+class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase
+{
+public:
+ wxStaticBox() { }
+
+ wxStaticBox(wxWindow *parent,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize)
+ {
+ Create(parent, -1, label, pos, size);
+ }
+
+ wxStaticBox(wxWindow *parent, wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBoxNameStr)
+ {
+ Create(parent, id, label, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBoxNameStr);
+
+ // the origin of the static box is inside the border and under the label:
+ // take account of this
+ virtual wxPoint GetBoxAreaOrigin() const;
+
+protected:
+ // draw the control
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ // get the size of the border
+ wxRect GetBorderGeometry() const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxStaticBox)
+};
+
+#endif // _WX_UNIV_STATBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/statline.h
+// Purpose: wxStaticLine class for wxUniversal
+// Author: Vadim Zeitlin
+// Created: 28.06.99
+// Version: $Id$
+// Copyright: (c) 1999 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma interface "univstatline.h"
+#endif
+
+#ifndef _WX_UNIV_STATLINE_H_
+#define _WX_UNIV_STATLINE_H_
+
+class WXDLLEXPORT wxStaticLine : public wxStaticLineBase
+{
+public:
+ // constructors and pseudo-constructors
+ wxStaticLine() { }
+
+ wxStaticLine(wxWindow *parent,
+ const wxPoint &pos,
+ wxCoord length,
+ long style = wxLI_HORIZONTAL)
+ {
+ Create(parent, -1, pos,
+ style & wxLI_VERTICAL ? wxSize(-1, length)
+ : wxSize(length, -1),
+ style);
+ }
+
+ wxStaticLine(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxLI_HORIZONTAL,
+ const wxString &name = wxStaticTextNameStr )
+ {
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxLI_HORIZONTAL,
+ const wxString &name = wxStaticTextNameStr );
+
+protected:
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxStaticLine)
+};
+
+#endif // _WX_UNIV_STATLINE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/stattext.h
+// Purpose: wxStaticText
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_STATTEXT_H_
+#define _WX_UNIV_STATTEXT_H_
+
+#ifdef __GNUG__
+ #pragma interface "univstattext.h"
+#endif
+
+class WXDLLEXPORT wxStaticText : public wxStaticTextBase
+{
+public:
+ // usual ctor
+ wxStaticText(wxWindow *parent,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize)
+ {
+ Create(parent, -1, label, pos, size, 0, wxStaticTextNameStr);
+ }
+
+ // full form
+ wxStaticText(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticTextNameStr)
+ {
+ Create(parent, id, label, pos, size, style, name);
+ }
+
+ // function ctor
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticTextNameStr);
+
+ // implementation only from now on
+
+ virtual void SetLabel(const wxString& label);
+
+protected:
+ // calculate the optimal size for the label
+ virtual wxSize DoGetBestClientSize() const;
+
+ // draw the control
+ virtual void DoDraw(wxControlRenderer *renderer);
+};
+
+#endif // _WX_UNIV_STATTEXT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/textctrl.h
+// Purpose: wxTextCtrl class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_TEXTCTRL_H_
+#define _WX_UNIV_TEXTCTRL_H_
+
+#ifdef __GNUG__
+ #pragma interface "univtextctrl.h"
+#endif
+
+class WXDLLEXPORT wxCaret;
+class WXDLLEXPORT wxTextCtrlCommandProcessor;
+
+#include "wx/scrolwin.h" // for wxScrollHelper
+
+#include "wx/univ/inphand.h"
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl actions
+// ----------------------------------------------------------------------------
+
+// cursor movement and also selection and delete operations
+#define wxACTION_TEXT_GOTO _T("goto") // to pos in numArg
+#define wxACTION_TEXT_FIRST _T("first") // go to pos 0
+#define wxACTION_TEXT_LAST _T("last") // go to last pos
+#define wxACTION_TEXT_HOME _T("home")
+#define wxACTION_TEXT_END _T("end")
+#define wxACTION_TEXT_LEFT _T("left")
+#define wxACTION_TEXT_RIGHT _T("right")
+#define wxACTION_TEXT_UP _T("up")
+#define wxACTION_TEXT_DOWN _T("down")
+#define wxACTION_TEXT_WORD_LEFT _T("wordleft")
+#define wxACTION_TEXT_WORD_RIGHT _T("wordright")
+#define wxACTION_TEXT_PAGE_UP _T("pageup")
+#define wxACTION_TEXT_PAGE_DOWN _T("pagedown")
+
+// clipboard operations
+#define wxACTION_TEXT_COPY _T("copy")
+#define wxACTION_TEXT_CUT _T("cut")
+#define wxACTION_TEXT_PASTE _T("paste")
+
+// insert text at the cursor position: the text is in strArg of PerformAction
+#define wxACTION_TEXT_INSERT _T("insert")
+
+// if the action starts with either of these prefixes and the rest of the
+// string is one of the movement commands, it means to select/delete text from
+// the current cursor position to the new one
+#define wxACTION_TEXT_PREFIX_SEL _T("sel")
+#define wxACTION_TEXT_PREFIX_DEL _T("del")
+
+// mouse selection
+#define wxACTION_TEXT_ANCHOR_SEL _T("anchorsel")
+#define wxACTION_TEXT_EXTEND_SEL _T("extendsel")
+#define wxACTION_TEXT_SEL_WORD _T("wordsel")
+#define wxACTION_TEXT_SEL_LINE _T("linesel")
+
+// undo or redo
+#define wxACTION_TEXT_UNDO _T("undo")
+#define wxACTION_TEXT_REDO _T("redo")
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl types
+// ----------------------------------------------------------------------------
+
+// wxTextPos is the position in the text
+typedef long wxTextPos;
+
+// wxTextCoord is the line or row number (which should have been unsigned but
+// is long for backwards compatibility)
+typedef long wxTextCoord;
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl::HitTest return values
+// ----------------------------------------------------------------------------
+
+// the point asked is ...
+enum wxTextCtrlHitTestResult
+{
+ wxTE_HT_BEFORE = -1, // either to the left or upper
+ wxTE_HT_ON_TEXT, // directly on
+ wxTE_HT_BELOW, // below [the last line]
+ wxTE_HT_BEYOND // after [the end of line]
+};
+// ... the character returned
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase, public wxScrollHelper
+{
+public:
+ // creation
+ // --------
+
+ wxTextCtrl() { Init(); }
+
+ wxTextCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTextCtrlNameStr)
+ {
+ Init();
+
+ Create(parent, id, value, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTextCtrlNameStr);
+
+ virtual ~wxTextCtrl();
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ virtual wxString GetValue() const;
+ virtual void SetValue(const wxString& value);
+
+ virtual int GetLineLength(wxTextCoord lineNo) const;
+ virtual wxString GetLineText(wxTextCoord lineNo) const;
+ virtual int GetNumberOfLines() const;
+
+ virtual bool IsModified() const;
+ virtual bool IsEditable() const;
+
+ // If the return values from and to are the same, there is no selection.
+ virtual void GetSelection(wxTextPos* from, wxTextPos* to) const;
+
+ // operations
+ // ----------
+
+ // editing
+ virtual void Clear();
+ virtual void Replace(wxTextPos from, wxTextPos to, const wxString& value);
+ virtual void Remove(wxTextPos from, wxTextPos to);
+
+ // clears the dirty flag
+ virtual void DiscardEdits();
+
+ // writing text inserts it at the current position, appending always
+ // inserts it at the end
+ virtual void WriteText(const wxString& text);
+ virtual void AppendText(const wxString& text);
+
+ // translate between the position (which is just an index in the text ctrl
+ // considering all its contents as a single strings) and (x, y) coordinates
+ // which represent (logical, i.e. unwrapped) column and line.
+ virtual wxTextPos XYToPosition(wxTextCoord x, wxTextCoord y) const;
+ virtual bool PositionToXY(wxTextPos pos,
+ wxTextCoord *x, wxTextCoord *y) const;
+
+ // wxUniv-specific: find a screen position (in client coordinates) of the
+ // given text position or of the caret
+ bool PositionToLogicalXY(wxTextPos pos, wxCoord *x, wxCoord *y) const;
+ bool PositionToDeviceXY(wxTextPos pos, wxCoord *x, wxCoord *y) const;
+ wxPoint GetCaretPosition() const;
+
+ virtual void ShowPosition(wxTextPos pos);
+
+ // Clipboard operations
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ // Undo/redo
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ // Insertion point
+ virtual void SetInsertionPoint(wxTextPos pos);
+ virtual void SetInsertionPointEnd();
+ virtual wxTextPos GetInsertionPoint() const;
+ virtual wxTextPos GetLastPosition() const;
+
+ virtual void SetSelection(wxTextPos from, wxTextPos to);
+ virtual void SetEditable(bool editable);
+
+ // wxUniv-specific methods
+ // -----------------------
+
+ // caret stuff
+ virtual void ShowCaret(bool show = TRUE);
+ void HideCaret() { ShowCaret(FALSE); }
+ void CreateCaret(); // for the current font size
+
+ // helpers for cursor movement
+ wxTextPos GetWordStart() const;
+ wxTextPos GetWordEnd() const;
+
+ // selection helpers
+ bool HasSelection() const
+ { return m_selStart != -1 && m_selEnd > m_selStart; }
+ void ClearSelection();
+ void RemoveSelection();
+ wxString GetSelectionText() const;
+
+ // find the character at this position, return 0 if the character is
+ // really there, -1 if the point is before the beginning of the text/line
+ // and the returned character is the first one to follow it or +1 if it the
+ // position is beyond the end of line/text and the returned character is
+ // the last one
+ //
+ // NB: pt is in device coords (not adjusted for the client area origin nor
+ // for the scrolling)
+ wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col, wxTextCoord *row) const;
+
+ // find the character at this position in the given line, return value as
+ // for HitTest()
+ //
+ // NB: x is the logical coord (client and unscrolled)
+ wxTextCtrlHitTestResult HitTestLine(const wxString& line,
+ wxCoord x,
+ wxTextCoord *colOut) const;
+
+ // bring the given position into view
+ void ShowHorzPosition(wxCoord pos);
+
+ // scroll the window horizontally so that the first character shown is in
+ // position pos
+ void ScrollText(wxTextCoord col);
+
+ // adjust the DC for horz text control scrolling too
+ virtual void DoPrepareDC(wxDC& dc);
+
+ // implementation only from now on
+ // -------------------------------
+
+ // override this to take into account our scrollbar-less scrolling
+ virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
+ virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
+
+ // set the right colours and border
+ virtual bool IsContainerWindow() const { return TRUE; }
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; }
+
+ // perform an action
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = -1,
+ const wxString& strArg = wxEmptyString);
+
+ // override these methods to handle the caret
+ virtual bool SetFont(const wxFont &font);
+ virtual bool Enable(bool enable = TRUE);
+
+ // more readable flag testing methods
+ bool IsSingleLine() const { return !(GetWindowStyle() & wxTE_MULTILINE); }
+ bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; }
+ bool WrapLines() const
+ { return !IsSingleLine() && !(GetWindowStyle() & wxHSCROLL); }
+
+ // only for wxStdTextCtrlInputHandler
+ void RefreshSelection();
+
+protected:
+ // override base class methods
+ virtual void DoDrawBorder(wxDC& dc, const wxRect& rect);
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ // calc the size from the text extent
+ virtual wxSize DoGetBestClientSize() const;
+
+ // common part of all ctors
+ void Init();
+
+ // drawing
+ // -------
+
+ // draw the text in the given rectangle
+ void DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate);
+
+ // draw the line wrap marks in this rect
+ void DoDrawLineWrapMarks(wxDC& dc, const wxRect& rectUpdate);
+
+ // line/row geometry calculations
+ // ------------------------------
+
+ // get the extent (width) of the text
+ wxCoord GetTextWidth(const wxString& text) const;
+
+ // get the logical text width (accounting for scrolling)
+ wxCoord GetTotalWidth() const;
+
+ // get total number of rows (different from number of lines if the lines
+ // can be wrapped)
+ wxTextCoord GetRowCount() const;
+
+ // find the number of rows in this line (only if WrapLines())
+ wxTextCoord GetRowsPerLine(wxTextCoord line) const;
+
+ // get the starting row of the given line
+ wxTextCoord GetFirstRowOfLine(wxTextCoord line) const;
+
+ // get the row following this line
+ wxTextCoord GetRowAfterLine(wxTextCoord line) const;
+
+ // refresh functions
+ // -----------------
+
+ // the text area is the part of the window in which the text can be
+ // displayed, i.e. part of it inside the margins and the real text area is
+ // the area in which the text *is* currently displayed: for example, in the
+ // multiline control case the text area can have extra space at the bottom
+ // which is not tall enough for another line and which is then not included
+ // into the real text area
+ wxRect GetRealTextArea() const;
+
+ // refresh the text in the given (in logical coords) rect
+ void RefreshTextRect(const wxRect& rect, bool textOnly = TRUE);
+
+ // refresh the line wrap marks for the given range of lines (inclusive)
+ void RefreshLineWrapMarks(wxTextCoord rowFirst, wxTextCoord rowLast);
+
+ // refresh the text in the given range (in logical coords) of this line, if
+ // width is 0, refresh to the end of line
+ void RefreshPixelRange(wxTextCoord line, wxCoord start, wxCoord width);
+
+ // refresh the text in the given range (in text coords) in this line
+ void RefreshColRange(wxTextCoord line, wxTextPos start, size_t count);
+
+ // refresh the text from in the given line range (inclusive)
+ void RefreshLineRange(wxTextCoord lineFirst, wxTextCoord lineLast);
+
+ // refresh the text in the given range which can span multiple lines
+ // (this method accepts arguments in any order)
+ void RefreshTextRange(wxTextPos start, wxTextPos end);
+
+ // get the text to show: either the text itself or the text replaced with
+ // starts for wxTE_PASSWORD control
+ wxString GetTextToShow(const wxString& text) const;
+
+ // find the row in this line where the given position (counted from the
+ // start of line) is
+ wxTextCoord GetRowInLine(wxTextCoord line,
+ wxTextCoord col,
+ wxTextCoord *colRowStart = NULL) const;
+
+ // find the number of characters of a line before it wraps
+ // (and optionally also the real width of the line)
+ size_t GetPartOfWrappedLine(const wxChar* text,
+ wxCoord *widthReal = NULL) const;
+
+ // get the start and end of the selection for this line: if the line is
+ // outside the selection, both will be -1 and FALSE will be returned
+ bool GetSelectedPartOfLine(wxTextCoord line,
+ wxTextPos *start, wxTextPos *end) const;
+
+ // update the text rect: the zone inside our client rect (its coords are
+ // client coords) which contains the text
+ void UpdateTextRect();
+
+ // calculate the last visible position
+ void UpdateLastVisible();
+
+ // move caret to the given position unconditionally
+ // (SetInsertionPoint() does nothing if the position didn't change)
+ void DoSetInsertionPoint(wxTextPos pos);
+
+ // move caret to the new position without updating the display (for
+ // internal use only)
+ void MoveInsertionPoint(wxTextPos pos);
+
+ // set the caret to its initial (default) position
+ void InitInsertionPoint();
+
+ // get the width of the longest line in pixels
+ wxCoord GetMaxWidth() const;
+
+ // force recalculation of the max line width
+ void RecalcMaxWidth();
+
+ // update the max width after the given line was modified
+ void UpdateMaxWidth(wxTextCoord line);
+
+ // hit testing
+ // -----------
+
+ // HitTest2() is more efficient than 2 consecutive HitTest()s with the same
+ // line (i.e. y) and it also returns the offset of the starting position in
+ // pixels
+ //
+ // as the last hack, this function accepts either logical or device (by
+ // default) coords depending on devCoords flag
+ wxTextCtrlHitTestResult HitTest2(wxCoord y,
+ wxCoord x1,
+ wxCoord x2,
+ wxTextCoord *row,
+ wxTextCoord *colStart,
+ wxTextCoord *colEnd,
+ wxTextCoord *colRowStart,
+ bool devCoords = TRUE) const;
+
+ // HitTest() version which takes the logical text coordinates and not the
+ // device ones
+ wxTextCtrlHitTestResult HitTestLogical(const wxPoint& pos,
+ wxTextCoord *col,
+ wxTextCoord *row) const;
+
+ // get the line and the row in this line corresponding to the given row,
+ // return TRUE if ok and FALSE if row is out of range
+ //
+ // NB: this function can only be called for controls which wrap lines
+ bool GetLineAndRow(wxTextCoord row,
+ wxTextCoord *line,
+ wxTextCoord *rowInLine) const;
+
+ // get the height of one line (the same for all lines)
+ wxCoord GetLineHeight() const
+ {
+ // this one should be already precalculated
+ wxASSERT_MSG( m_heightLine != -1, _T("should have line height") );
+
+ return m_heightLine;
+ }
+
+ // get the average char width
+ wxCoord GetAverageWidth() const { return m_widthAvg; }
+
+ // recalc the line height and char width (to call when the font changes)
+ void RecalcFontMetrics();
+
+ // vertical scrolling helpers
+ // --------------------------
+
+ // all these functions are for multi line controls only
+
+ // get the number of visible lines
+ size_t GetLinesPerPage() const;
+
+ // return the position above the cursor or INVALID_POS_VALUE
+ wxTextPos GetPositionAbove();
+
+ // return the position below the cursor or INVALID_POS_VALUE
+ wxTextPos GetPositionBelow();
+
+ // event handlers
+ // --------------
+ void OnIdle(wxIdleEvent& event);
+ void OnChar(wxKeyEvent& event);
+ void OnSize(wxSizeEvent& event);
+
+ // overrdie wxScrollHelper method to prevent (auto)scrolling beyond the end
+ // of line
+ virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
+
+ // return the struct containing control-type dependent data
+ struct wxTextSingleLineData& SData() { return *m_data.sdata; }
+ struct wxTextMultiLineData& MData() { return *m_data.mdata; }
+ struct wxTextWrappedData& WData() { return *m_data.wdata; }
+ const wxTextSingleLineData& SData() const { return *m_data.sdata; }
+ const wxTextMultiLineData& MData() const { return *m_data.mdata; }
+ const wxTextWrappedData& WData() const { return *m_data.wdata; }
+
+ // clipboard operations (unlike the versions without Do prefix, they have a
+ // return code)
+ bool DoCut();
+ bool DoPaste();
+
+private:
+ // all these methods are for multiline text controls only
+
+ // update the scrollbars (only called from OnIdle)
+ void UpdateScrollbars();
+
+ // get read only access to the lines of multiline control
+ inline const wxArrayString& GetLines() const;
+ inline size_t GetLineCount() const;
+
+ // replace a line (returns TRUE if the number of rows in thel ine changed)
+ bool ReplaceLine(wxTextCoord line, const wxString& text);
+
+ // remove a line
+ void RemoveLine(wxTextCoord line);
+
+ // insert a line at this position
+ void InsertLine(wxTextCoord line, const wxString& text);
+
+ // calculate geometry of this line
+ void LayoutLine(wxTextCoord line, class wxWrappedLineData& lineData) const;
+
+ // calculate geometry of all lines until the given one
+ void LayoutLines(wxTextCoord lineLast) const;
+
+ // the initially specified control size
+ wxSize m_sizeInitial;
+
+ // the global control text
+ wxString m_value;
+
+ // current position
+ wxTextPos m_curPos;
+ wxTextCoord m_curCol,
+ m_curRow;
+
+ // last position (only used by GetLastPosition())
+ wxTextPos m_posLast;
+
+ // selection
+ wxTextPos m_selAnchor,
+ m_selStart,
+ m_selEnd;
+
+ // flags
+ bool m_isModified:1,
+ m_isEditable:1,
+ m_hasCaret:1;
+
+ // the rectangle (in client coordinates) to draw text inside
+ wxRect m_rectText;
+
+ // the height of one line (cached value of GetCharHeight)
+ wxCoord m_heightLine;
+
+ // and the average char width (cached value of GetCharWidth)
+ wxCoord m_widthAvg;
+
+ // we have some data which depends on the kind of control (single or multi
+ // line)
+ union
+ {
+ wxTextSingleLineData *sdata;
+ wxTextMultiLineData *mdata;
+ wxTextWrappedData *wdata;
+ void *data;
+ } m_data;
+
+ // the object to which we delegate our undo/redo implementation
+ wxTextCtrlCommandProcessor *m_cmdProcessor;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxTextCtrl)
+};
+
+// ----------------------------------------------------------------------------
+// wxStdTextCtrlInputHandler: this control handles only the mouse/kbd actions
+// common to Win32 and GTK, platform-specific things are implemented elsewhere
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
+{
+public:
+ wxStdTextCtrlInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
+
+protected:
+ // get the position of the mouse click
+ static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos);
+
+ // capture data
+ wxTextCtrl *m_winCapture;
+};
+
+#endif // _WX_UNIV_TEXTCTRL_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/theme.h
+// Purpose: wxTheme class manages all configurable aspects of the
+// application including the look (wxRenderer), feel
+// (wxInputHandler) and the colours (wxColourScheme)
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_THEME_H_
+#define _WX_UNIV_THEME_H_
+
+#ifdef __GNUG__
+ #pragma interface "theme.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxTheme
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxRenderer;
+class WXDLLEXPORT wxColourScheme;
+class WXDLLEXPORT wxInputHandler;
+struct WXDLLEXPORT wxThemeInfo;
+
+class WXDLLEXPORT wxTheme
+{
+public:
+ // static methods
+ // --------------
+
+ // create the default theme
+ static bool CreateDefault();
+
+ // create the theme by name (will return NULL if not found)
+ static wxTheme *Create(const wxString& name);
+
+ // change the current scheme
+ static wxTheme *Set(wxTheme *theme);
+
+ // get the current theme (never NULL)
+ static wxTheme *Get() { return ms_theme; }
+
+ // the theme methods
+ // -----------------
+
+ // get the renderer implementing all the control-drawing operations in
+ // this theme
+ virtual wxRenderer *GetRenderer() = 0;
+
+ // get the input handler of the given type
+ virtual wxInputHandler *GetInputHandler(const wxString& handlerType) = 0;
+
+ // get the colour scheme for the control with this name
+ virtual wxColourScheme *GetColourScheme() = 0;
+
+ // implementation only from now on
+ // -------------------------------
+
+ virtual ~wxTheme();
+
+private:
+ // the list of descriptions of all known themes
+ static wxThemeInfo *ms_allThemes;
+
+ // the current theme
+ static wxTheme *ms_theme;
+
+ friend wxThemeInfo;
+};
+
+// ----------------------------------------------------------------------------
+// dynamic theme creation helpers
+// ----------------------------------------------------------------------------
+
+struct WXDLLEXPORT wxThemeInfo
+{
+ typedef wxTheme *(*Constructor)();
+
+ // theme name and (user readable) description
+ wxString name, desc;
+
+ // the function to create a theme object
+ Constructor ctor;
+
+ // next node in the linked list or NULL
+ wxThemeInfo *next;
+
+ // constructor for the struct itself
+ wxThemeInfo(Constructor ctor, const wxChar *name, const wxChar *desc);
+};
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+// to use a standard theme insert this macro into one of the application files:
+// without it, an over optimizing linker may discard the object module
+// containing the theme implementation entirely
+#define WX_USE_THEME(themename) \
+ extern bool wxThemeUse##themename; \
+ static struct wxThemeUserFor##themename \
+ { \
+ wxThemeUserFor##themename() { wxThemeUse##themename = TRUE; } \
+ } wxThemeDoUse##themename
+
+// to declare a new theme, this macro must be used in the class declaration
+#define WX_DECLARE_THEME(themename) \
+ private: \
+ static wxThemeInfo ms_info##themename; \
+ public: \
+ const wxThemeInfo *GetThemeInfo() const \
+ { return &ms_info##themename; }
+
+// and this one must be inserted in the source file
+#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \
+ bool wxThemeUse##themename = TRUE; \
+ wxTheme *wxCtorFor##themename() { return new classname; } \
+ wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \
+ #themename, themedesc)
+
+#endif // _WX_UNIV_THEME_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/univ/window.h
+// Purpose: wxWindow class which is the base class for all
+// wxUniv port controls, it supports the customization of the
+// window drawing and input processing.
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIV_WINDOW_H_
+#define _WX_UNIV_WINDOW_H_
+
+#ifdef __GNUG__
+ #pragma interface "univwindow.h"
+#endif
+
+#include "wx/bitmap.h" // for m_bitmapBg
+
+class WXDLLEXPORT wxControlRenderer;
+class WXDLLEXPORT wxEventLoop;
+class WXDLLEXPORT wxMenu;
+class WXDLLEXPORT wxMenuBar;
+class WXDLLEXPORT wxRenderer;
+class WXDLLEXPORT wxScrollBar;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// control state flags used in wxRenderer and wxColourScheme
+enum
+{
+ wxCONTROL_DISABLED = 0x00000001, // control is disabled
+ wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
+ wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
+ wxCONTROL_ISDEFAULT = 0x00000008, // only applies to the buttons
+ wxCONTROL_ISSUBMENU = wxCONTROL_ISDEFAULT, // only for menu items
+ wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
+ wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
+ wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
+ wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
+
+ wxCONTROL_FLAGS_MASK = 0x000000ff,
+
+ // this is a pseudo flag not used directly by wxRenderer but rather by some
+ // controls internally
+ wxCONTROL_DIRTY = 0x80000000
+};
+
+// ----------------------------------------------------------------------------
+// wxWindow
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxWindow : public wxWindowNative
+{
+public:
+ // ctors and creatie functions
+ // ---------------------------
+
+ wxWindow() { Init(); }
+
+ wxWindow(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ : wxWindowNative(parent, id, pos, size, style | wxCLIP_CHILDREN, name)
+ { Init(); }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr);
+
+ // background pixmap support
+ // -------------------------
+
+ virtual void SetBackground(const wxBitmap& bitmap,
+ int alignment = wxALIGN_CENTRE,
+ wxStretch stretch = wxSTRETCH_NOT);
+
+ const wxBitmap& GetBackgroundBitmap(int *alignment = NULL,
+ wxStretch *stretch = NULL) const;
+
+ // scrollbars: we (re)implement it ourselves using our own scrollbars
+ // instead of the native ones
+ // ------------------------------------------------------------------
+
+ virtual void SetScrollbar(int orient,
+ int pos,
+ int page,
+ int range,
+ bool refresh = TRUE );
+ virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE);
+ virtual int GetScrollPos(int orient) const;
+ virtual int GetScrollThumb(int orient) const;
+ virtual int GetScrollRange(int orient) const;
+ virtual void ScrollWindow(int dx, int dy,
+ const wxRect* rect = (wxRect *) NULL);
+
+ // take into account the borders here
+ virtual wxPoint GetClientAreaOrigin() const;
+
+ // popup menu support
+ // ------------------
+
+ // NB: all menu related functions are implemented in menu.cpp
+
+#if wxUSE_MENUS
+ virtual bool DoPopupMenu(wxMenu *menu, int x, int y);
+
+ // this is wxUniv-specific private method to be used only by wxMenu
+ void DismissPopupMenu();
+#endif // wxUSE_MENUS
+
+ // miscellaneous other methods
+ // ---------------------------
+
+ // get the state information
+ virtual bool IsFocused() const;
+ virtual bool IsCurrent() const;
+ virtual bool IsPressed() const;
+ virtual bool IsDefault() const;
+
+ // return all state flags at once (combination of wxCONTROL_XXX values)
+ int GetStateFlags() const;
+
+ // set the "highlighted" flag and return TRUE if it changed
+ virtual bool SetCurrent(bool doit = TRUE);
+
+ // get the scrollbar (may be NULL) for the given orientation
+ wxScrollBar *GetScrollbar(int orient) const
+ {
+ return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz;
+ }
+
+ // methods used by wxColourScheme to choose the colours for this window
+ // --------------------------------------------------------------------
+
+ // return TRUE if this is a panel/canvas window which contains other
+ // controls only
+ virtual bool IsCanvasWindow() const { return FALSE; }
+
+ // return TRUE if this a container window which contains the other items:
+ // e.g, a listbox, listctrl, treectrl, ... and FALSE if it is a monolithic
+ // control (e.g. a button, checkbox, ...)
+ virtual bool IsContainerWindow() const { return FALSE; }
+
+ // return TRUE if this control can be highlighted when the mouse is over
+ // it (the theme decides itself whether it is really highlighted or not)
+ virtual bool CanBeHighlighted() const { return FALSE; }
+
+ // return TRUE if we should use the colours/fonts returned by the
+ // corresponding GetXXX() methods instead of the default ones
+ bool UseBgCol() const { return m_hasBgCol; }
+ bool UseFgCol() const { return m_hasFgCol; }
+ bool UseFont() const { return m_hasFont; }
+
+ // returns the (low level) renderer to use for drawing the control by
+ // querying the current theme
+ wxRenderer *GetRenderer() const { return m_renderer; }
+
+ // scrolling helper: like ScrollWindow() except that it doesn't refresh the
+ // uncovered window areas but returns the rectangle to update (don't call
+ // this with both dx and dy non zero)
+ wxRect ScrollNoRefresh(int dx, int dy, const wxRect *rect = NULL);
+
+ // after scrollbars are added or removed they must be refreshed by calling
+ // this function
+ void RefreshScrollbars();
+
+ // erase part of the control
+ virtual void EraseBackground(wxDC& dc, const wxRect& rect);
+
+ // overridden base class methods
+ // -----------------------------
+
+ // the rect coordinates are, for us, in client coords, but if no rect is
+ // specified, the entire window is refreshed
+ virtual void Refresh(bool eraseBackground = TRUE,
+ const wxRect *rect = (const wxRect *) NULL);
+
+ // we refresh the window when it is dis/enabled
+ virtual bool Enable(bool enable = TRUE);
+
+ // remember that the font/colour was changed
+ virtual bool SetBackgroundColour(const wxColour& colour);
+ virtual bool SetForegroundColour(const wxColour& colour);
+ virtual bool SetFont(const wxFont& font);
+
+ // our Capture/ReleaseMouse() maintains the stack of windows which had
+ // captured the mouse and when ReleaseMouse() is called, the mouse freed
+ // only if the stack is empty, otherwise it is captured back by the window
+ // on top of the stack
+ virtual void CaptureMouse();
+ virtual void ReleaseMouse();
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // overridden base class virtuals
+
+ // we deal with the scrollbars in these functions
+ virtual void DoSetClientSize(int width, int height);
+ virtual void DoGetClientSize(int *width, int *height) const;
+ virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
+
+ // event handlers
+ void OnSize(wxSizeEvent& event);
+ void OnNcPaint(wxPaintEvent& event);
+ void OnPaint(wxPaintEvent& event);
+ void OnErase(wxEraseEvent& event);
+
+#if wxUSE_ACCEL || wxUSE_MENUS
+ void OnKeyDown(wxKeyEvent& event);
+#endif // wxUSE_ACCEL
+
+#if wxUSE_MENUS
+ void OnChar(wxKeyEvent& event);
+ void OnKeyUp(wxKeyEvent& event);
+#endif // wxUSE_MENUS
+
+ // draw the control background, return TRUE if done
+ virtual bool DoDrawBackground(wxDC& dc);
+
+ // draw the controls border
+ virtual void DoDrawBorder(wxDC& dc, const wxRect& rect);
+
+ // draw the controls contents
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ // calculate the best size for the client area of the window: default
+ // implementation of DoGetBestSize() uses this method and adds the border
+ // width to the result
+ virtual wxSize DoGetBestClientSize() const;
+ virtual wxSize DoGetBestSize() const;
+
+ // adjust the size of the window to take into account its borders
+ wxSize AdjustSize(const wxSize& size) const;
+
+ // put the scrollbars along the edges of the window
+ void PositionScrollbars();
+
+#if wxUSE_MENUS
+ // return the menubar of the parent frame or NULL
+ wxMenuBar *GetParentFrameMenuBar() const;
+#endif // wxUSE_MENUS
+
+ // the renderer we use
+ wxRenderer *m_renderer;
+
+ // background bitmap info
+ wxBitmap m_bitmapBg;
+ int m_alignBgBitmap;
+ wxStretch m_stretchBgBitmap;
+
+ // more flags
+ bool m_isCurrent:1; // is the mouse currently inside the window?
+ bool m_hasBgCol:1; // was the bg colour explicitly changed by user?
+ bool m_hasFgCol:1; // fg
+ bool m_hasFont:1; // font
+
+private:
+ // the window scrollbars
+ wxScrollBar *m_scrollbarHorz,
+ *m_scrollbarVert;
+
+ // the stack of windows which have captured the mouse
+ static struct WXDLLEXPORT wxWindowNext *ms_winCaptureNext;
+
+#if wxUSE_MENUS
+ // the current modal event loop for the popup menu we show or NULL
+ static wxEventLoop *ms_evtLoopPopup;
+
+ // the last window over which Alt was pressed (used by OnKeyUp)
+ static wxWindow *ms_winLastAltPress;
+#endif // wxUSE_MENUS
+
+ DECLARE_DYNAMIC_CLASS(wxWindow)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_UNIV_WINDOW_H_
+
class WXDLLEXPORT wxWindowList;
class WXDLLEXPORT wxPoint;
-// FIXME should use wxStricmp() instead
-#if defined(__GNUWIN32__)
- #define stricmp strcasecmp
- #define strnicmp strncasecmp
-#endif
-
// ----------------------------------------------------------------------------
// Macros
// ----------------------------------------------------------------------------
// TODO move into a separate header?
// ----------------------------------------------------------------------------
+// what kind of client data do we have?
+enum wxClientDataType
+{
+ wxClientData_None, // we don't know yet because we don't have it at all
+ wxClientData_Object, // our client data is typed and we own it
+ wxClientData_Void // client data is untyped and we don't own it
+};
+
class wxClientData
{
public:
class WXDLLEXPORT wxWindowBase : public wxEvtHandler
{
- DECLARE_ABSTRACT_CLASS(wxWindowBase);
-
public:
// creating the window
// -------------------
void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
{ DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
- void Move( int x, int y )
- { DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); }
+ void Move(int x, int y, int flags = wxSIZE_USE_EXISTING)
+ { DoSetSize(x, y, -1, -1, flags); }
- void Move(const wxPoint& pt)
- { Move(pt.x, pt.y); }
+ void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING)
+ { Move(pt.x, pt.y, flags); }
// Z-order
virtual void Raise() = 0;
return wxSize(w, h);
}
+ // get the origin of the client area of the window relative to the
+ // window top left corner (the client area may be shifted because of
+ // the borders, scrollbars, other decorations...)
+ virtual wxPoint GetClientAreaOrigin() const;
+
+ // get the client rectangle in window (i.e. client) coordinates
+ wxRect GetClientRect() const
+ {
+ return wxRect(GetClientAreaOrigin(), GetClientSize());
+ }
+
// get the size best suited for the window (in fact, minimal
// acceptable size using which it will still look "nice")
wxSize GetBestSize() const { return DoGetBestSize(); }
// can this window have focus?
virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); }
+ // can this window be given focus by keyboard navigation? if not, the
+ // only way to give it focus (provided it accepts it at all) is to
+ // click it
+ virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); }
+
// parent/children relations
// -------------------------
void PushEventHandler( wxEvtHandler *handler );
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
- // validators and client data
- // --------------------------
+ // validators
+ // ----------
#if wxUSE_VALIDATORS
// a window may have an associated validator which is used to control
virtual wxValidator *GetValidator() { return m_windowValidator; }
#endif // wxUSE_VALIDATORS
+ // client data
+ // -----------
+
// each window may have associated client data: either a pointer to
// wxClientData object in which case it is managed by the window (i.e.
// it will delete the data when it's destroyed) or an untyped pointer
virtual void CaptureMouse() = 0;
virtual void ReleaseMouse() = 0;
+ // get the window which currently captures the mouse or NULL
+ static wxWindow *GetCapture();
+
+ // does this window have the capture?
+ virtual bool HasCapture() const
+ { return (wxWindow *)this == GetCapture(); }
+
// painting the window
// -------------------
// will be repainted
virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL ) = 0;
+
+ // a less awkward wrapper for Refresh
+ void RefreshRect(const wxRect& rect) { Refresh(TRUE, &rect); }
+
+ // repaint all invalid areas of the window immediately
+ virtual void Update() { }
+
// clear the window entirely
virtual void Clear() = 0;
const wxRegion& GetUpdateRegion() const { return m_updateRegion; }
wxRegion& GetUpdateRegion() { return m_updateRegion; }
+ // get the update rectangleregion bounding box in client coords
+ wxRect GetUpdateClientRect() const;
+
// these functions verify whether the given point/rectangle belongs to
// (or at least intersects with) the update region
bool IsExposed( int x, int y ) const;
const wxFont *theFont = (const wxFont *) NULL)
const = 0;
+ // client <-> screen coords
+ // ------------------------
+
// translate to/from screen/client coordinates (pointers may be NULL)
void ClientToScreen( int *x, int *y ) const
{ DoClientToScreen(x, y); }
void ScreenToClient( int *x, int *y ) const
{ DoScreenToClient(x, y); }
+
+ // wxPoint interface to do the same thing
wxPoint ClientToScreen(const wxPoint& pt) const
{
int x = pt.x, y = pt.y;
return wxPoint(x, y);
}
+ // test where the given (in client coords) point lies
+ wxHitTest HitTest(wxCoord x, wxCoord y) const
+ { return DoHitTest(x, y); }
+
+ wxHitTest HitTest(const wxPoint& pt) const
+ { return DoHitTest(pt.x, pt.y); }
+
// misc
// ----
+ // get the window border style: uses the current style and falls back to
+ // the default style for this class otherwise (see GetDefaultBorder())
+ wxBorder GetBorder() const;
+
void UpdateWindowUI();
+#if wxUSE_MENUS
bool PopupMenu( wxMenu *menu, const wxPoint& pos )
{ return DoPopupMenu(menu, pos.x, pos.y); }
bool PopupMenu( wxMenu *menu, int x, int y )
{ return DoPopupMenu(menu, x, y); }
+#endif // wxUSE_MENUS
// scrollbars
// ----------
+ // does the window have the scrollbar for this orientation?
+ bool HasScrollbar(int orient) const
+ {
+ return (m_windowStyle &
+ (orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0;
+ }
+
// configure the window scrollbars
virtual void SetScrollbar( int orient,
int pos,
- int thumbVisible,
+ int thumbvisible,
int range,
bool refresh = TRUE ) = 0;
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ) = 0;
// ctor
void InitBase();
+ // override this to change the default (i.e. used when no style is
+ // specified) border for the window class
+ virtual wxBorder GetDefaultBorder() const;
+
// get the default size for the new window if no explicit size given
// FIXME why 20 and not 30, 10 or ...?
static int WidthDefault(int w) { return w == -1 ? 20 : w; }
static int HeightDefault(int h) { return h == -1 ? 20 : h; }
- // sets the size to be size but take width and/or height from
- // DoGetBestSize() if width/height of size is -1
- //
- // NB: when calling this function from the ctor, the DoGetBestSize() of
- // the class with the same name as the ctor, not the real (most
- // derived) one - but this is what we usually want
- void SetSizeOrDefault(const wxSize& size = wxDefaultSize)
+ // set the best size for the control if the default size was given:
+ // replaces the fields of size == -1 with the best values for them and
+ // calls SetSize() if needed
+ void SetBestSize(const wxSize& size)
{
if ( size.x == -1 || size.y == -1 )
{
- wxSize sizeDef = GetBestSize();
- SetSize( size.x == -1 ? sizeDef.x : size.x,
- size.y == -1 ? sizeDef.y : size.y);
- }
- else
- {
- SetSize(size);
+ wxSize sizeBest = DoGetBestSize();
+ if ( size.x != -1 )
+ sizeBest.x = size.x;
+ if ( size.y != -1 )
+ sizeBest.y = size.y;
+
+ SetSize(sizeBest);
}
}
virtual void DoClientToScreen( int *x, int *y ) const = 0;
virtual void DoScreenToClient( int *x, int *y ) const = 0;
+ virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
+
// retrieve the position/size of the window
virtual void DoGetPosition( int *x, int *y ) const = 0;
virtual void DoGetSize( int *width, int *height ) const = 0;
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
+#if wxUSE_MENUS
virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) = 0;
+#endif // wxUSE_MENUS
// client data accessors
virtual void DoSetClientObject( wxClientData *data );
virtual void *DoGetClientData() const;
// what kind of data do we have?
- enum wxClientDataType
- {
- ClientData_None, // we don't know yet because we don't have it at all
- ClientData_Object, // our client data is typed and we own it
- ClientData_Void // client data is untyped and we don't own it
- } m_clientDataType;
+ wxClientDataType m_clientDataType;
private:
// contains the last id generated by NewControlId
static int ms_lastControlId;
- DECLARE_NO_COPY_CLASS(wxWindowBase);
+ DECLARE_ABSTRACT_CLASS(wxWindowBase)
+ DECLARE_NO_COPY_CLASS(wxWindowBase)
DECLARE_EVENT_TABLE()
};
// now include the declaration of wxWindow class
// ----------------------------------------------------------------------------
+// include the declaration of the platform-specific class
#if defined(__WXMSW__)
+ #if !defined(__WXUNIVERSAL__)
+ #define wxWindowMSW wxWindow
+ #define sm_classwxWindowMSW sm_classwxWindow
+ #endif // wxUniv
#include "wx/msw/window.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/window.h"
#elif defined(__WXGTK__)
+ #if !defined(__WXUNIVERSAL__)
+ #define wxWindowGTK wxWindow
+ #define sm_classwxWindowGTK sm_classwxWindow
+ #endif // wxUniv
#include "wx/gtk/window.h"
#elif defined(__WXQT__)
#include "wx/qt/window.h"
#include "wx/os2/window.h"
#endif
+// for wxUniversal, we now derive the real wxWindow from wxWindow<platform>,
+// for the native ports we already have defined it above
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/window.h"
+#endif // wxUniv
+
// ----------------------------------------------------------------------------
// inline functions which couldn't be declared in the class body because of
// forward dependencies
// Get the current mouse position.
WXDLLEXPORT extern wxPoint wxGetMousePosition();
+// get the currently active window of this application or NULL
+WXDLLEXPORT extern wxWindow *wxGetActiveWindow();
+
// deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId()
inline int NewControlId() { return wxWindowBase::NewControlId(); }
#ifndef _WX_WIZARD_H_
#define _WX_WIZARD_H_
+#if wxUSE_WIZARDDLG
+
// ----------------------------------------------------------------------------
// headers and other simple declarations
// ----------------------------------------------------------------------------
// unless the event handler vetoes the event
#define EVT_WIZARD_CANCEL(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WIZARD_CANCEL, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL),
+#endif // wxUSE_WIZARDDLG
+
#endif // _WX_WIZARD_H_
#include "wx/msgdlg.h"
#include "wx/cmndata.h"
+#include "wx/control.h"
+#include "wx/ctrlsub.h"
#include "wx/bmpbuttn.h"
#include "wx/checkbox.h"
+#include "wx/checklst.h"
#include "wx/choice.h"
#include "wx/scrolbar.h"
#include "wx/stattext.h"
# define wxStrcspn _tcscspn
# define wxStrftime _tcsftime
# define wxStricmp _tcsicmp
+# define wxStrnicmp _tcsnicmp
# define wxStrlen_ _tcslen // used in wxStrlen inline function
# define wxStrncat _tcsncat
# define wxStrncmp _tcsncmp
#include "wx/setup.h"
-#if wxUSE_IMAGE && wxUSE_XPM
class WXDLLEXPORT wxImage;
class WXDLLEXPORT wxInputStream;
};
-#endif // wxUSE_IMAGE && wxUSE_XPM
#endif // _WX_GIFDECOD_H_
*/
#define wxUSE_VALIDATORS 0
+/*
+ * Use wxControl
+ */
+#define wxUSE_CONTROLS 0
+
+/*
+ Use wxPopupWindow (useful in wxUniv only for now)
+*/
+#define wxUSE_POPUPWIN 0
+
/*
* Use accelerators
*/
#define wxUSE_ACCEL 0
+/*
+ * Use wxCalendarCtrl
+ */
+#define wxUSE_CALENDARCTRL 0
+
+/*
+ * Use wxFileDialog
+ */
+#define wxUSE_FILEDLG 0
+
+/*
+ * Use wxFontDialog
+ */
+#define wxUSE_FONTDLG 0
+
+/*
+ * Use wxMimeTypesManager and related classes
+ */
+#define wxUSE_MIMETYPE 0
+
+/*
+ * Use wxMessageDialog (and wxMessageBox)
+ */
+#define wxUSE_MSGDLG 0
+
+/*
+ * Use wxNumberEntryDialog
+ */
+#define wxUSE_NUMBERDLG 0
+
/*
* Use wxTextEntryDialog
*/
*/
#define wxUSE_PROGRESSDLG 0
+/*
+ * Use chooser dialog
+ */
+#define wxUSE_CHOICEDLG 0
+
+/*
+ * Use colour picker dialog
+ */
+#define wxUSE_COLOURDLG 0
+
/*
* Use directory chooser dialog
*/
#define wxUSE_DIRDLG 0
+/*
+ * Use property sheet classes
+ */
+#define wxUSE_PROPSHEET 0
+
+/*
+ * Use wxWizard
+ */
+#define wxUSE_WIZARDDLG 0
+
+/*
+ * Use splash screen
+ */
+#define wxUSE_SPLASH 0
+
/*
* Joystick support (Linux/GTK only)
*/
#define wxUSE_JOYSTICK 0
+/*
+ * Use this control
+ */
+#define wxUSE_BUTTON 0
/*
* Use this control
*/
* Use this control
*/
#define wxUSE_LISTCTRL 0
+/*
+ * Use wxMenuBar, wxMenuItem and wxMenu
+ */
+#define wxUSE_MENUS 0
/*
* Use this control
*/
* Use this control
*/
#define wxUSE_STATUSBAR 0
+#define wxUSE_STATTEXT 0
+/*
+ * Use this control
+ */
+#define wxUSE_STATUSBAR 0
/*
* Use this control
*/
/* compatibility */
#define wxUSE_TABDIALOG wxUSE_TAB_DIALOG
+/*
+ * Use wxTextCtrl
+ */
+#define wxUSE_TEXTCTRL 0
+
/*
* Use wxToollBar
*/
*/
#define wxUSE_GEOMETRY 0
+/*
+ * Use wxCmdLineParser class
+ */
+#define wxUSE_CMDLINE_PARSER 0
+/*
+ * Use wxDateTime
+ */
+#define wxUSE_DATETIME 0
/*
* Use wxFile class
*/
#define wxUSE_FILE 0
-
+/*
+ * Use wxFFile class
+ */
+#define wxUSE_FFILE 0
/*
* Use wxTextFile class
*/
* Use log classes and logging functions
*/
#define wxUSE_LOG 0
+/*
+ * Use log window
+ */
+#define wxUSE_LOGWINDOW 0
+/*
+ * Use standard GUI logger
+ */
+#define wxUSE_LOGGUI 0
+/*
+ * Use wxStopWatch
+ */
+#define wxUSE_STOPWATCH 0
/*
* Use time and date classes
*/
* Use config system
*/
#define wxUSE_CONFIG 0
+/*
+ * Use font mapping/conversion classes
+ */
+#define wxUSE_FONTMAP 0
/*
* Use intl system
*/
*/
#define wxUSE_DYNLIB_CLASS 0
+/*
+ * Use wxTimer
+ */
+#define wxUSE_TIMER 0
+
/*
* Use font metric files in GetTextExtent for wxPostScriptDC
* Use consistent PostScript fonts for AFM and printing (!)
* Use clipboard
*/
#define wxUSE_CLIPBOARD 0
+/*
+ * Use wxDataObject
+ */
+#define wxUSE_DATAOBJ 0
/*
* Use tooltips
*/
/* Define this if you are using gtk and gdk contains support for X11R6 XIM */
#undef HAVE_XIM
+/* now check the settings self consistency */
+#include "wx/chkconf.h"
+
#endif /* __WX_SETUP_H__ */
#include "wx/thread.h"
#include "wx/confbase.h"
+#ifdef __WXUNIVERSAL__
+ #include "wx/univ/theme.h"
+#endif // __WXUNIVERSAL__
+
// ===========================================================================
// implementation
// ===========================================================================
+wxAppBase::wxAppBase()
+{
+ wxTheApp = (wxApp *)this;
+
+ // VZ: what's this? is it obsolete?
+ m_wantDebugOutput = FALSE;
+
+#if wxUSE_GUI
+ m_topWindow = (wxWindow *)NULL;
+ m_useBestVisual = FALSE;
+ m_exitOnFrameDelete = TRUE;
+ m_isActive = TRUE;
+#endif // wxUSE_GUI
+}
+
+// ----------------------------------------------------------------------------
+// initialization and termination
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+bool wxAppBase::OnInitGui()
+{
+#ifdef __WXUNIVERSAL__
+ if ( !wxTheme::CreateDefault() )
+ return FALSE;
+#endif // __WXUNIVERSAL__
+
+ return TRUE;
+}
+#endif // wxUSE_GUI
+
+int wxAppBase::OnExit()
+{
+#if wxUSE_CONFIG
+ // delete the config object if any (don't use Get() here, but Set()
+ // because Get() could create a new config object)
+ delete wxConfigBase::Set((wxConfigBase *) NULL);
+#endif // wxUSE_CONFIG
+
+#ifdef __WXUNIVERSAL__
+ delete wxTheme::Set(NULL);
+#endif // __WXUNIVERSAL__
+
+ return 0;
+}
+
// ---------------------------------------------------------------------------
// wxAppBase
// ----------------------------------------------------------------------------
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
}
-int wxAppBase::OnExit()
+// ----------------------------------------------------------------------------
+// misc
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+void wxAppBase::SetActive(bool active, wxWindow *lastFocus)
{
-#if wxUSE_CONFIG
- // delete the config object if any (don't use Get() here, but Set()
- // because Get() could create a new config object)
- delete wxConfigBase::Set((wxConfigBase *) NULL);
-#endif // wxUSE_CONFIG
+ static wxWindow *s_lastFocus = (wxWindow *)NULL;
- return 0;
+ m_isActive = active;
+
+ // if we're being deactivated remember the last focused window
+ if ( !active )
+ {
+ s_lastFocus = lastFocus;
+ }
+
+ if ( s_lastFocus )
+ {
+ // give the focused window the chance to refresh itself if its
+ // appearance depends on the app activation state
+ wxActivateEvent event(wxEVT_ACTIVATE, active);
+ s_lastFocus->GetEventHandler()->ProcessEvent(event);
+ }
}
+
+#endif // wxUSE_GUI
#pragma hdrstop
#endif
+#if wxUSE_CHOICE
+
#ifndef WX_PRECOMP
#include "wx/choice.h"
#endif
SetSelection(event.m_commandInt);
(void)ProcessEvent(event);
}
+
+#endif // wxUSE_CHOICE
+
#pragma hdrstop
#endif
+#if wxUSE_CMDLINE_PARSER
+
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/log.h"
return s;
}
+
+#endif // wxUSE_CMDLINE_PARSER
#ifdef __GNUG__
#pragma implementation "controlbase.h"
+ #pragma implementation "statbmpbase.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#pragma hdrstop
#endif
+#if wxUSE_CONTROLS
+
#ifndef WX_PRECOMP
#include "wx/control.h"
#include "wx/log.h"
#endif
+#if wxUSE_STATBMP
+ #include "wx/bitmap.h"
+ #include "wx/statbmp.h"
+#endif // wxUSE_STATBMP
+
// ============================================================================
// implementation
// ============================================================================
+bool wxControlBase::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ bool ret = wxWindow::Create(parent, id, pos, size, style, name);
+
+#if wxUSE_VALIDATORS
+ if ( ret )
+ SetValidator(validator);
+#endif // wxUSE_VALIDATORS
+
+ return ret;
+}
+
bool wxControlBase::CreateControl(wxWindowBase *parent,
wxWindowID id,
const wxPoint& pos,
switch ( m_clientDataType )
{
- case ClientData_Void:
+ case wxClientData_Void:
event.SetClientData(GetClientData());
break;
- case ClientData_Object:
+ case wxClientData_Object:
event.SetClientObject(GetClientObject());
break;
- case ClientData_None:
+ case wxClientData_None:
// nothing to do
;
}
}
+// ----------------------------------------------------------------------------
+// wxStaticBitmap
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STATBMP
+
+wxSize wxStaticBitmapBase::DoGetBestClientSize() const
+{
+ wxBitmap bmp = GetBitmap();
+ if ( bmp.Ok() )
+ return wxSize(bmp.GetWidth(), bmp.GetHeight());
+
+ // this is completely arbitrary
+ return wxSize(16, 16);
+}
+
+#endif // wxUSE_STATBMP
+
+#endif // wxUSE_CONTROLS
+
///////////////////////////////////////////////////////////////////////////////
// Name: common/ctrlsub.cpp
-// Purpose: wxControlWithItems implementation
+// Purpose: wxItemContainer implementation
// Author: Vadim Zeitlin
// Modified by:
// Created: 22.10.99
#pragma hdrstop
#endif
+#if wxUSE_CONTROLS
+
#ifndef WX_PRECOMP
#include "wx/ctrlsub.h"
#endif
// selection
// ----------------------------------------------------------------------------
-wxString wxControlWithItems::GetStringSelection() const
+wxString wxItemContainer::GetStringSelection() const
{
wxString s;
int sel = GetSelection();
// client data
// ----------------------------------------------------------------------------
-void wxControlWithItems::SetClientObject(int n, wxClientData *data)
+void wxItemContainer::SetClientObject(int n, wxClientData *data)
{
- wxASSERT_MSG( m_clientDataItemsType != ClientData_Void,
+ wxASSERT_MSG( m_clientDataItemsType != wxClientData_Void,
wxT("can't have both object and void client data") );
wxClientData *clientDataOld = DoGetItemClientObject(n);
delete clientDataOld;
DoSetItemClientObject(n, data);
- m_clientDataItemsType = ClientData_Object;
+ m_clientDataItemsType = wxClientData_Object;
}
-wxClientData *wxControlWithItems::GetClientObject(int n) const
+wxClientData *wxItemContainer::GetClientObject(int n) const
{
- wxASSERT_MSG( m_clientDataItemsType == ClientData_Object,
+ wxASSERT_MSG( m_clientDataItemsType == wxClientData_Object,
wxT("this window doesn't have object client data") );
return DoGetItemClientObject(n);
}
-void wxControlWithItems::SetClientData(int n, void *data)
+void wxItemContainer::SetClientData(int n, void *data)
{
- wxASSERT_MSG( m_clientDataItemsType != ClientData_Object,
+ wxASSERT_MSG( m_clientDataItemsType != wxClientData_Object,
wxT("can't have both object and void client data") );
DoSetItemClientData(n, data);
- m_clientDataItemsType = ClientData_Void;
+ m_clientDataItemsType = wxClientData_Void;
}
-void *wxControlWithItems::GetClientData(int n) const
+void *wxItemContainer::GetClientData(int n) const
{
- wxASSERT_MSG( m_clientDataItemsType == ClientData_Void,
+ wxASSERT_MSG( m_clientDataItemsType == wxClientData_Void,
wxT("this window doesn't have void client data") );
return DoGetItemClientData(n);
}
+#endif // wxUSE_CONTROLS
#pragma hdrstop
#endif
+#if !defined(wxUSE_DATETIME) || wxUSE_DATETIME
+
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/intl.h"
return holidays.GetCount();
}
-
+#endif // wxUSE_DATETIME
/////////////////////////////////////////////////////////////////////////////
-// Name: dc.cpp
-// Purpose: wxDC Class
-// Author: Brian Macy
+// Name: common/dcbase.cpp
+// Purpose: generic methods of the wxDC Class
+// Author: Vadim Zeitlin
// Modified by:
// Created: 05/25/99
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
+// ============================================================================
+// declarations
+// ============================================================================
+
#ifdef __GNUG__
-#pragma implementation "dcbase.h"
+ #pragma implementation "dcbase.h"
#endif
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include <math.h>
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// special symbols
+// ----------------------------------------------------------------------------
+
void wxDCBase::DoDrawCheckMark(wxCoord x1, wxCoord y1,
wxCoord width, wxCoord height)
{
CalcBoundingBox(x2, y2);
}
+// ----------------------------------------------------------------------------
+// line/polygons
+// ----------------------------------------------------------------------------
+
void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
{
int n = list->Number();
delete [] points;
}
+// ----------------------------------------------------------------------------
+// splines
+// ----------------------------------------------------------------------------
#if wxUSE_SPLINES
}
#endif // wxUSE_SPLINES
+
+// ----------------------------------------------------------------------------
+// enhanced text drawing
+// ----------------------------------------------------------------------------
+
+void wxDCBase::GetMultiLineTextExtent(const wxString& text,
+ wxCoord *x,
+ wxCoord *y,
+ wxCoord *h,
+ wxFont *font)
+{
+ int widthTextMax = 0, widthLine,
+ heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
+
+ wxString curLine;
+ for ( const wxChar *pc = text; ; pc++ )
+ {
+ if ( *pc == _T('\n') || *pc == _T('\0') )
+ {
+ if ( curLine.empty() )
+ {
+ // we can't use GetTextExtent - it will return 0 for both width
+ // and height and an empty line should count in height
+ // calculation
+
+ // assume that this line has the same height as the previous
+ // one
+ if ( !heightLineDefault )
+ heightLineDefault = heightLine;
+
+ if ( !heightLineDefault )
+ {
+ // but we don't know it yet - choose something reasonable
+ GetTextExtent(_T("W"), NULL, &heightLineDefault,
+ NULL, NULL, font);
+ }
+
+ heightTextTotal += heightLineDefault;
+ }
+ else
+ {
+ GetTextExtent(curLine, &widthLine, &heightLine,
+ NULL, NULL, font);
+ if ( widthLine > widthTextMax )
+ widthTextMax = widthLine;
+ heightTextTotal += heightLine;
+ }
+
+ if ( *pc == _T('\n') )
+ {
+ curLine.clear();
+ }
+ else
+ {
+ // the end of string
+ break;
+ }
+ }
+ else
+ {
+ curLine += *pc;
+ }
+ }
+
+ if ( x )
+ *x = widthTextMax;
+ if ( y )
+ *y = heightTextTotal;
+ if ( h )
+ *h = heightLine;
+}
+
+void wxDCBase::DrawLabel(const wxString& text,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounding)
+{
+ // find the text position
+ wxCoord widthText, heightText, heightLine;
+ GetMultiLineTextExtent(text, &widthText, &heightText, &heightLine);
+
+ wxCoord width, height;
+ if ( bitmap.Ok() )
+ {
+ width = widthText + bitmap.GetWidth();
+ height = bitmap.GetHeight();
+ }
+ else // no bitmap
+ {
+ width = widthText;
+ height = heightText;
+ }
+
+ wxCoord x, y;
+ if ( alignment & wxALIGN_RIGHT )
+ {
+ x = rect.GetRight() - width;
+ }
+ else if ( alignment & wxALIGN_CENTRE_HORIZONTAL )
+ {
+ x = (rect.GetLeft() + rect.GetRight() + 1 - width) / 2;
+ }
+ else // alignment & wxALIGN_LEFT
+ {
+ x = rect.GetLeft();
+ }
+
+ if ( alignment & wxALIGN_BOTTOM )
+ {
+ y = rect.GetBottom() - height;
+ }
+ else if ( alignment & wxALIGN_CENTRE_VERTICAL )
+ {
+ y = (rect.GetTop() + rect.GetBottom() + 1 - height) / 2;
+ }
+ else // alignment & wxALIGN_TOP
+ {
+ y = rect.GetTop();
+ }
+
+ // draw the bitmap first
+ wxCoord x0 = x,
+ y0 = y,
+ width0 = width;
+ if ( bitmap.Ok() )
+ {
+ DrawBitmap(bitmap, x, y, TRUE /* use mask */);
+
+ wxCoord offset = bitmap.GetWidth() + 4;
+ x += offset;
+ width -= offset;
+
+ y += (height - heightText) / 2;
+ }
+
+ // we will draw the underscore under the accel char later
+ wxCoord startUnderscore = 0,
+ endUnderscore = 0,
+ yUnderscore = 0;
+
+ // split the string into lines and draw each of them separately
+ wxString curLine;
+ for ( const wxChar *pc = text; ; pc++ )
+ {
+ if ( *pc == _T('\n') || *pc == _T('\0') )
+ {
+ int xRealStart = x; // init it here to avoid compielr warnings
+
+ if ( !curLine.empty() )
+ {
+ // NB: can't test for !(alignment & wxALIGN_LEFT) because
+ // wxALIGN_LEFT is 0
+ if ( alignment & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL) )
+ {
+ wxCoord widthLine;
+ GetTextExtent(curLine, &widthLine, NULL);
+
+ if ( alignment & wxALIGN_RIGHT )
+ {
+ xRealStart += width - widthLine;
+ }
+ else // if ( alignment & wxALIGN_CENTRE_HORIZONTAL )
+ {
+ xRealStart += (width - widthLine) / 2;
+ }
+ }
+ //else: left aligned, nothing to do
+
+ DrawText(curLine, xRealStart, y);
+ }
+
+ y += heightLine;
+
+ // do we have underscore in this line? we can check yUnderscore
+ // because it is set below to just y + heightLine if we do
+ if ( y == yUnderscore )
+ {
+ // adjust the horz positions to account for the shift
+ startUnderscore += xRealStart;
+ endUnderscore += xRealStart;
+ }
+
+ if ( *pc == _T('\0') )
+ break;
+
+ curLine.clear();
+ }
+ else // not end of line
+ {
+ if ( pc - text == indexAccel )
+ {
+ // remeber to draw underscore here
+ GetTextExtent(curLine, &startUnderscore, NULL);
+ curLine += *pc;
+ GetTextExtent(curLine, &endUnderscore, NULL);
+
+ yUnderscore = y + heightLine;
+ }
+ else
+ {
+ curLine += *pc;
+ }
+ }
+ }
+
+ // draw the underscore if found
+ if ( startUnderscore != endUnderscore )
+ {
+ // it should be of the same colour as text
+ SetPen(wxPen(GetTextForeground(), 0, wxSOLID));
+
+ yUnderscore--;
+
+ DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore);
+ }
+
+ // return bounding rect if requested
+ if ( rectBounding )
+ {
+ *rectBounding = wxRect(x, y - heightText, widthText, heightText);
+ }
+
+ CalcBoundingBox(x0, y0);
+ CalcBoundingBox(x0 + width0, y0 + height);
+}
// wxDialogBase
//--------------------------------------------------------------------------
+#if wxUSE_STATTEXT && wxUSE_TEXTCTRL
+
wxSizer *wxDialogBase::CreateTextSizer( const wxString &message )
{
wxBoxSizer *box = new wxBoxSizer( wxVERTICAL );
return box;
}
+#endif // wxUSE_STATTEXT && wxUSE_TEXTCTRL
+
+#if wxUSE_BUTTON
+
wxSizer *wxDialogBase::CreateButtonSizer( long flags )
{
wxBoxSizer *box = new wxBoxSizer( wxHORIZONTAL );
return box;
}
+#endif // wxUSE_BUTTON
#pragma hdrstop
#endif
+#if wxUSE_DATAOBJ
+
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/debug.h"
return OnDropFiles(x, y, dobj->GetFilenames()) ? def : wxDragNone;
}
-#endif
+#endif // wxUSE_DRAG_AND_DROP
+#endif // wxUSE_DATAOBJ
/////////////////////////////////////////////////////////////////////////////
-// Name: docview.cpp
+// Name: src/common/docview.cpp
// Purpose: Document/view classes
// Author: Julian Smart
// Modified by:
#include "wx/docview.h"
#include "wx/confbase.h"
#include "wx/file.h"
+#include "wx/cmdproc.h"
#include <stdio.h>
#include <string.h>
// wxWindows macros
// ----------------------------------------------------------------------------
- IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler)
- IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler)
- IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject)
- IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler)
- IMPLEMENT_CLASS(wxDocChildFrame, wxFrame)
- IMPLEMENT_CLASS(wxDocParentFrame, wxFrame)
+IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler)
+IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler)
+IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject)
+IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler)
+IMPLEMENT_CLASS(wxDocChildFrame, wxFrame)
+IMPLEMENT_CLASS(wxDocParentFrame, wxFrame)
- #if wxUSE_PRINTING_ARCHITECTURE
- IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout)
- #endif
+#if wxUSE_PRINTING_ARCHITECTURE
+ IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout)
+#endif
- IMPLEMENT_CLASS(wxCommand, wxObject)
- IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject)
- IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
+IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
// ----------------------------------------------------------------------------
// function prototypes
#endif // wxUSE_PRINTING_ARCHITECTURE
-// ----------------------------------------------------------------------------
-// Command processing framework
-// ----------------------------------------------------------------------------
-
-wxCommand::wxCommand(bool canUndoIt, const wxString& name)
-{
- m_canUndo = canUndoIt;
- m_commandName = name;
-}
-
-wxCommand::~wxCommand()
-{
-}
-
-// Command processor
-wxCommandProcessor::wxCommandProcessor(int maxCommands)
-{
- m_maxNoCommands = maxCommands;
- m_currentCommand = (wxNode *) NULL;
- m_commandEditMenu = (wxMenu *) NULL;
- m_undoAccelerator = wxT("\tCtrl+Z");
- m_redoAccelerator = wxT("\tCtrl+Y");
-}
-
-wxCommandProcessor::~wxCommandProcessor()
-{
- ClearCommands();
-}
-
-// Pass a command to the processor. The processor calls Do();
-// if successful, is appended to the command history unless
-// storeIt is FALSE.
-bool wxCommandProcessor::Submit(wxCommand *command, bool storeIt)
-{
- bool success = command->Do();
- if (success && storeIt)
- {
- if (m_commands.Number() == m_maxNoCommands)
- {
- wxNode *firstNode = m_commands.First();
- wxCommand *firstCommand = (wxCommand *)firstNode->Data();
- delete firstCommand;
- delete firstNode;
- }
-
- // Correct a bug: we must chop off the current 'branch'
- // so that we're at the end of the command list.
- if (!m_currentCommand)
- ClearCommands();
- else
- {
- wxNode *node = m_currentCommand->Next();
- while (node)
- {
- wxNode *next = node->Next();
- delete (wxCommand *)node->Data();
- delete node;
- node = next;
- }
- }
-
- m_commands.Append(command);
- m_currentCommand = m_commands.Last();
- SetMenuStrings();
- }
- return success;
-}
-
-bool wxCommandProcessor::Undo()
-{
- if (m_currentCommand)
- {
- wxCommand *command = (wxCommand *)m_currentCommand->Data();
- if (command->CanUndo())
- {
- bool success = command->Undo();
- if (success)
- {
- m_currentCommand = m_currentCommand->Previous();
- SetMenuStrings();
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-bool wxCommandProcessor::Redo()
-{
- wxCommand *redoCommand = (wxCommand *) NULL;
- wxNode *redoNode = (wxNode *) NULL;
- if (m_currentCommand && m_currentCommand->Next())
- {
- redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
- redoNode = m_currentCommand->Next();
- }
- else
- {
- if (m_commands.Number() > 0)
- {
- redoCommand = (wxCommand *)m_commands.First()->Data();
- redoNode = m_commands.First();
- }
- }
-
- if (redoCommand)
- {
- bool success = redoCommand->Do();
- if (success)
- {
- m_currentCommand = redoNode;
- SetMenuStrings();
- return TRUE;
- }
- }
- return FALSE;
-}
-
-bool wxCommandProcessor::CanUndo() const
-{
- if (m_currentCommand)
- return ((wxCommand *)m_currentCommand->Data())->CanUndo();
- return FALSE;
-}
-
-bool wxCommandProcessor::CanRedo() const
-{
- if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->Next() == (wxNode*) NULL))
- return FALSE;
-
- if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->Next() != (wxNode*) NULL))
- return TRUE;
-
- if ((m_currentCommand == (wxNode*) NULL) && (m_commands.Number() > 0))
- return TRUE;
-
- return FALSE;
-}
-
-void wxCommandProcessor::Initialize()
-{
- m_currentCommand = m_commands.Last();
- SetMenuStrings();
-}
-
-void wxCommandProcessor::SetMenuStrings()
-{
- if (m_commandEditMenu)
- {
- wxString buf;
- if (m_currentCommand)
- {
- wxCommand *command = (wxCommand *)m_currentCommand->Data();
- wxString commandName(command->GetName());
- if (commandName == wxT("")) commandName = _("Unnamed command");
- bool canUndo = command->CanUndo();
- if (canUndo)
- buf = wxString(_("&Undo ")) + commandName + m_undoAccelerator;
- else
- buf = wxString(_("Can't &Undo ")) + commandName + m_undoAccelerator;
-
- m_commandEditMenu->SetLabel(wxID_UNDO, buf);
- m_commandEditMenu->Enable(wxID_UNDO, canUndo);
-
- // We can redo, if we're not at the end of the history.
- if (m_currentCommand->Next())
- {
- wxCommand *redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
- wxString redoCommandName(redoCommand->GetName());
- if (redoCommandName == wxT("")) redoCommandName = _("Unnamed command");
- buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator;
- m_commandEditMenu->SetLabel(wxID_REDO, buf);
- m_commandEditMenu->Enable(wxID_REDO, TRUE);
- }
- else
- {
- m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo") + m_redoAccelerator);
- m_commandEditMenu->Enable(wxID_REDO, FALSE);
- }
- }
- else
- {
- m_commandEditMenu->SetLabel(wxID_UNDO, _("&Undo") + m_undoAccelerator);
- m_commandEditMenu->Enable(wxID_UNDO, FALSE);
-
- if (m_commands.Number() == 0)
- {
- m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo") + m_redoAccelerator);
- m_commandEditMenu->Enable(wxID_REDO, FALSE);
- }
- else
- {
- // currentCommand is NULL but there are commands: this means that
- // we've undone to the start of the list, but can redo the first.
- wxCommand *redoCommand = (wxCommand *)m_commands.First()->Data();
- wxString redoCommandName(redoCommand->GetName());
- if (redoCommandName == wxT("")) redoCommandName = _("Unnamed command");
- buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator;
- m_commandEditMenu->SetLabel(wxID_REDO, buf);
- m_commandEditMenu->Enable(wxID_REDO, TRUE);
- }
- }
- }
-}
-
-void wxCommandProcessor::ClearCommands()
-{
- wxNode *node = m_commands.First();
- while (node)
- {
- wxCommand *command = (wxCommand *)node->Data();
- delete command;
- delete node;
- node = m_commands.First();
- }
- m_currentCommand = (wxNode *) NULL;
-}
-
// ----------------------------------------------------------------------------
// File history processor
// ----------------------------------------------------------------------------
#pragma hdrstop
#endif
+#if wxUSE_FONTMAP
+
#include "wx/encconv.h"
#include <stdlib.h>
return arr;
}
+
+#endif // wxUSE_FONTMAP
IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent)
+ IMPLEMENT_DYNAMIC_CLASS(wxNcPaintEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent)
// or any button up event (but = -1)
bool wxMouseEvent::ButtonUp(int but) const
{
- switch (but) {
+ switch (but)
+ {
case -1:
return (LeftUp() || MiddleUp() || RightUp());
case 1:
// True if the given button is currently changing state
bool wxMouseEvent::Button(int but) const
{
- switch (but) {
+ switch (but)
+ {
case -1:
return (ButtonUp(-1) || ButtonDown(-1) || ButtonDClick(-1));
case 1:
bool wxMouseEvent::ButtonIsDown(int but) const
{
- switch (but) {
+ switch (but)
+ {
case -1:
return (LeftIsDown() || MiddleIsDown() || RightIsDown());
case 1:
return FALSE;
}
+int wxMouseEvent::GetButton() const
+{
+ for ( int i = 1; i <= 3; i++ )
+ {
+ if ( Button(i) )
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
// Find the logical position of the event given the DC
wxPoint wxMouseEvent::GetLogicalPosition(const wxDC& dc) const
{
{
#if wxUSE_GUI
// check that our flag corresponds to reality
- wxASSERT( m_isWindow == IsKindOf(CLASSINFO(wxWindow)) );
+ wxASSERT_MSG( m_isWindow == IsKindOf(CLASSINFO(wxWindow)),
+ _T("this should [not] be a window but it is [not]") );
#endif // wxUSE_GUI
// An event handler can be enabled or disabled
#pragma hdrstop
#endif
-#if wxUSE_FILE
+#if wxUSE_FFILE
#ifndef WX_PRECOMP
#include "wx/intl.h"
return (size_t)-1;
}
-#endif // wxUSE_FILE
+#endif // wxUSE_FFILE
wxNativeFontInfo *wxFontBase::GetNativeFontInfo() const
{
-#if !defined(__WXGTK__) && !defined(__WXMSW__)
+#if !defined(__WXGTK__) && !defined(__WXMSW__) && !defined(__WXMGL__)
wxNativeFontInfo *fontInfo = new wxNativeFontInfo;
fontInfo->pointSize = GetPointSize();
void wxFontBase::SetNativeFontInfo(const wxNativeFontInfo& info)
{
-#if !defined(__WXGTK__) && !defined(__WXMSW__)
+#if !defined(__WXGTK__) && !defined(__WXMSW__) && !defined(__WXMGL__)
SetPointSize(info.pointSize);
SetFamily(info.family);
SetStyle(info.style);
SetFaceName(info.faceName);
SetEncoding(info.encoding);
#else
- (void)info;
+ (void)info;
#endif
}
}
}
-#if !defined(__WXGTK__) && !defined(__WXMSW__)
+#if !defined(__WXGTK__) && !defined(__WXMSW__) && !defined(__WXMGL__)
// ----------------------------------------------------------------------------
// wxNativeFontInfo
#pragma hdrstop
#endif
+#if wxUSE_FONTMAP
+
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/log.h"
// ----------------------------------------------------------------------------
// the config paths we use
+#if wxUSE_CONFIG
static const wxChar* FONTMAPPER_ROOT_PATH = wxT("/wxWindows/FontMapper");
static const wxChar* FONTMAPPER_CHARSET_PATH = wxT("Charsets");
static const wxChar* FONTMAPPER_CHARSET_ALIAS_PATH = wxT("Aliases");
static const wxChar* FONTMAPPER_FONT_FROM_ENCODING_PATH = wxT("Encodings");
static const wxChar* FONTMAPPER_FONT_DONT_ASK = wxT("none");
#endif // wxUSE_GUI
+#endif // wxUSE_CONFIG
// encodings supported by GetEncodingDescription
static wxFontEncoding gs_encodings[] =
}
#endif // wxUSE_GUI
+
+#endif // wxUSE_FONTMAP
#pragma hdrstop
#endif
-#include "wx/frame.h"
-#include "wx/menu.h"
-#include "wx/menuitem.h"
-#include "wx/dcclient.h"
+#ifndef WX_PRECOMP
+ #include "wx/frame.h"
+ #include "wx/menu.h"
+ #include "wx/menuitem.h"
+ #include "wx/dcclient.h"
+#endif // WX_PRECOMP
#if wxUSE_TOOLBAR
#include "wx/toolbar.h"
wxFrameBase::wxFrameBase()
{
+#if wxUSE_MENUS
m_frameMenuBar = NULL;
+#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
void wxFrameBase::DeleteAllBars()
{
+#if wxUSE_MENUS
if ( m_frameMenuBar )
{
delete m_frameMenuBar;
m_frameMenuBar = (wxMenuBar *) NULL;
}
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
if ( m_frameStatusBar )
#endif // wxUSE_TOOLBAR
}
+bool wxFrameBase::IsOneOfBars(const wxWindow *win) const
+{
+#if wxUSE_MENUS
+ if ( win == GetMenuBar() )
+ return TRUE;
+#endif // wxUSE_MENUS
+
+#if wxUSE_STATUSBAR
+ if ( win == GetStatusBar() )
+ return TRUE;
+#endif // wxUSE_STATUSBAR
+
+#if wxUSE_TOOLBAR
+ if ( win == GetToolBar() )
+ return TRUE;
+#endif // wxUSE_TOOLBAR
+
+ return FALSE;
+}
+
// ----------------------------------------------------------------------------
// wxFrame size management: we exclude the areas taken by menu/status/toolbars
// from the client area, so the client area is what's really available for the
bool wxFrameBase::ProcessCommand(int id)
{
+#if wxUSE_MENUS
wxMenuBar *bar = GetMenuBar();
if ( !bar )
return FALSE;
}
return GetEventHandler()->ProcessEvent(commandEvent);
+#else // !wxUSE_MENUS
+ return FALSE;
+#endif // wxUSE_MENUS/!wxUSE_MENUS
}
// ----------------------------------------------------------------------------
Layout();
}
else
-#endif
+#endif // wxUSE_CONSTRAINTS
{
// do we have _exactly_ one child?
wxWindow *child = (wxWindow *)NULL;
// exclude top level and managed windows (status bar isn't
// currently in the children list except under wxMac anyhow, but
// it makes no harm to test for it)
- if ( !win->IsTopLevel()
-#if wxUSE_STATUSBAR
- && (win != GetStatusBar())
-#endif // wxUSE_STATUSBAR
-#if wxUSE_TOOLBAR
- && (win != GetToolBar())
-#endif // wxUSE_TOOLBAR
- )
+ if ( !win->IsTopLevel() && !IsOneOfBars(win) )
{
if ( child )
{
void wxFrameBase::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
+#if wxUSE_MENUS
DoMenuUpdates();
+#endif // wxUSE_MENUS
}
+#if wxUSE_MENUS
+
// update all menus
void wxFrameBase::DoMenuUpdates()
{
node = node->GetNext();
}
}
+
+#endif // wxUSE_MENUS
return wxRect(x1, y1, x2-x1, y2-y1);
}
+wxRect& wxRect::Inflate(wxCoord dx, wxCoord dy)
+{
+ x -= dx;
+ y -= dy;
+ width += 2*dx;
+ height += 2*dy;
+
+ // check that we didn't make the rectangle invalid by accident (you almost
+ // never want to have negative coords and never want negative size)
+ wxASSERT_MSG( x >= 0 && y >= 0 && width >= 0 && height >= 0,
+ _T("wxRect::Inflate() resulted in an invalid rectangle!") );
+
+ return *this;
+}
+
bool wxRect::Inside(int cx, int cy) const
{
return ( (cx >= x) && (cy >= y)
);
}
+wxRect& wxRect::Intersect(const wxRect& rect)
+{
+ int x2 = GetRight(),
+ y2 = GetBottom();
+
+ if ( x < rect.x )
+ x = rect.x;
+ if ( y < rect.y )
+ y = rect.y;
+ if ( x2 > rect.GetRight() )
+ x2 = rect.GetRight();
+ if ( y2 > rect.GetBottom() )
+ y2 = rect.GetBottom();
+
+ width = x2 - x + 1;
+ height = y2 - y + 1;
+
+ if ( width <= 0 || height <= 0 )
+ {
+ width =
+ height = 0;
+ }
+
+ return *this;
+}
+
+bool wxRect::Intersects(const wxRect& rect) const
+{
+ wxRect r = Intersect(rect);
+
+ // if there is no intersection, both width and height are 0
+ return r.width != 0;
+}
+
wxColourDatabase::wxColourDatabase (int type) : wxList (type)
{
}
#ifdef __WXPM__
return NULL;
#endif
+#ifdef __WXMGL__
+ return NULL;
+#endif
// TODO for other implementations. This should really go into
// platform-specific directories.
# include "wx/defs.h"
#endif
-#if wxUSE_IMAGE && wxUSE_XPM
#include "wx/imagxpm.h"
#include "wx/wfstream.h"
#endif // wxUSE_STREAMS
-#endif // wxUSE_XPM && wxUSE_IMAGE
void wxMsgCatalog::ConvertEncoding()
{
- wxFontEncoding enc;
-
// first, find encoding header:
const char *hdr = StringAtOfs(m_pOrigTable, 0);
if ( hdr == NULL || hdr[0] != 0 ) {
while (header[n] != wxT('\n'))
charset << header[n++];
- enc = wxTheFontMapper->CharsetToEncoding(charset, FALSE);
+#if wxUSE_FONTMAP
+ wxFontEncoding enc = wxTheFontMapper->CharsetToEncoding(charset, FALSE);
if ( enc == wxFONTENCODING_SYSTEM )
return; // unknown encoding
for (size_t i = 0; i < m_numStrings; i++)
converter.Convert((char*)StringAtOfs(m_pTransTable, i));
+#endif // wxUSE_FONTMAP
}
{
return (wxFontEncoding)(wxFONTENCODING_CP1250 + codepage - 1250);
}
-#elif defined(__UNIX_LIKE__)
+#elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP
wxString encname = GetSystemEncodingName();
if ( !encname.empty() )
{
#pragma hdrstop
#endif
+#if wxUSE_LISTBOX
+
#ifndef WX_PRECOMP
#include "wx/listbox.h"
#endif
return TRUE;
}
+void wxListBoxBase::DeselectAll(int itemToLeaveSelected)
+{
+ if ( HasMultipleSelection() )
+ {
+ wxArrayInt selections;
+ GetSelections(selections);
+
+ size_t count = selections.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ int item = selections[n];
+ if ( item != itemToLeaveSelected )
+ Deselect(item);
+ }
+ }
+ else // single selection
+ {
+ int sel = GetSelection();
+ if ( sel != -1 && sel != itemToLeaveSelected )
+ {
+ Deselect(sel);
+ }
+ }
+}
+
// ----------------------------------------------------------------------------
// misc
// ----------------------------------------------------------------------------
(void)ProcessEvent(event);
}
+// ----------------------------------------------------------------------------
+// SetFirstItem() and such
+// ----------------------------------------------------------------------------
+
void wxListBoxBase::SetFirstItem(const wxString& s)
{
int n = FindString(s);
DoSetFirstItem(n);
}
+
+void wxListBoxBase::AppendAndEnsureVisible(const wxString& s)
+{
+ Append(s);
+ EnsureVisible(GetCount() - 1);
+}
+
+void wxListBoxBase::EnsureVisible(int WXUNUSED(n))
+{
+ // the base class version does nothing (the only alternative would be to
+ // call SetFirstItem() but this is probably even more stupid)
+}
+
+#endif // wxUSE_LISTBOX
// send it to the normal log destination
wxLogDebug(szBuf);
-#if wxUSE_GUI || defined(__WXMSW__)
+#if (wxUSE_GUI && wxUSE_MSGDLG) || defined(__WXMSW__)
// this message is intentionally not translated - it is for
// developpers only
wxStrcat(szBuf, wxT("\nDo you want to stop the program?\nYou can also choose [Cancel] to suppress further warnings."));
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include <ctype.h>
-
#ifdef __BORLANDC__
#pragma hdrstop
#endif
+#if wxUSE_MENUS
+
+#include <ctype.h>
+
#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/log.h"
#include "wx/menu.h"
#endif
wxMenuItemBase::~wxMenuItemBase()
{
- if (m_subMenu)
- delete m_subMenu;
+ delete m_subMenu;
}
#if wxUSE_ACCEL
+// return wxAcceleratorEntry for the given menu string or NULL if none
+// specified
+wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
+{
+ // check for accelerators: they are given after '\t'
+ int posTab = label.Find(wxT('\t'));
+ if ( posTab != wxNOT_FOUND ) {
+ // parse the accelerator string
+ int keyCode = 0;
+ int accelFlags = wxACCEL_NORMAL;
+ wxString current;
+ for ( size_t n = (size_t)posTab + 1; n < label.Len(); n++ ) {
+ if ( (label[n] == '+') || (label[n] == '-') ) {
+ if ( current == _("ctrl") )
+ accelFlags |= wxACCEL_CTRL;
+ else if ( current == _("alt") )
+ accelFlags |= wxACCEL_ALT;
+ else if ( current == _("shift") )
+ accelFlags |= wxACCEL_SHIFT;
+ else {
+ wxLogDebug(wxT("Unknown accel modifier: '%s'"),
+ current.c_str());
+ }
+
+ current.Empty();
+ }
+ else {
+ current += wxTolower(label[n]);
+ }
+ }
+
+ if ( current.IsEmpty() ) {
+ wxLogDebug(wxT("No accel key found, accel string ignored."));
+ }
+ else {
+ if ( current.Len() == 1 ) {
+ // it's a letter
+ keyCode = wxToupper(current[0U]);
+ }
+ else {
+ // is it a function key?
+ if ( current[0U] == 'f' && isdigit(current[1U]) &&
+ (current.Len() == 2 ||
+ (current.Len() == 3 && isdigit(current[2U]))) ) {
+ int n;
+ wxSscanf(current.c_str() + 1, wxT("%d"), &n);
+
+ keyCode = WXK_F1 + n - 1;
+ }
+ else {
+ // several special cases
+ current.MakeUpper();
+ if ( current == wxT("DEL") ) {
+ keyCode = WXK_DELETE;
+ }
+ else if ( current == wxT("DELETE") ) {
+ keyCode = WXK_DELETE;
+ }
+ else if ( current == wxT("INS") ) {
+ keyCode = WXK_INSERT;
+ }
+ else if ( current == wxT("INSERT") ) {
+ keyCode = WXK_INSERT;
+ }
+#if 0
+ else if ( current == wxT("PGUP") ) {
+ keyCode = VK_PRIOR;
+ }
+ else if ( current == wxT("PGDN") ) {
+ keyCode = VK_NEXT;
+ }
+#endif
+ else
+ {
+ wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."),
+ current.c_str());
+ }
+ }
+ }
+ }
+
+ if ( keyCode ) {
+ // we do have something
+ return new wxAcceleratorEntry(accelFlags, keyCode);
+ }
+ }
+
+ return (wxAcceleratorEntry *)NULL;
+}
+
+wxAcceleratorEntry *wxMenuItemBase::GetAccel() const
+{
+ return wxGetAccelFromString(GetText());
+}
+
void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel)
{
wxString text = m_text.BeforeFirst(wxT('\t'));
wxMenuBase::~wxMenuBase()
{
// nothing to do, wxMenuItemList dtor will delete the menu items.
- // Actually, in GTK, the submenus have to get deleted first.
+
+ // Actually, in GTK, the submenus have to get deleted first.
}
// ----------------------------------------------------------------------------
// wxMenu item adding/removing
// ----------------------------------------------------------------------------
+void wxMenuBase::AddSubMenu(wxMenu *submenu)
+{
+ wxCHECK_RET( submenu, _T("can't add a NULL submenu") );
+
+ if ( m_menuBar )
+ {
+ submenu->Attach(m_menuBar);
+ }
+
+ submenu->SetParent((wxMenu *)this);
+}
+
bool wxMenuBase::DoAppend(wxMenuItem *item)
{
wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Append()") );
m_items.Append(item);
+ if ( item->IsSubMenu() )
+ {
+ AddSubMenu(item->GetSubMenu());
+ }
return TRUE;
}
wxCHECK_MSG( node, FALSE, wxT("invalid index in wxMenu::Insert()") );
m_items.Insert(node, item);
+ if ( item->IsSubMenu() )
+ {
+ AddSubMenu(item->GetSubMenu());
+ }
return TRUE;
}
}
// ----------------------------------------------------------------------------
-// wxMenu helpers
+// wxMenu helpers used by derived classes
// ----------------------------------------------------------------------------
// Update a menu and all submenus recursively. source is the object that has
}
}
+bool wxMenuBase::SendEvent(int id, int checked)
+{
+ wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id);
+ event.SetEventObject(this);
+ event.SetInt(checked);
+
+ bool processed = FALSE;
+
+#if wxUSE_MENU_CALLBACK
+ // Try a callback
+ if (m_callback)
+ {
+ (void)(*(m_callback))(*this, event);
+ processed = TRUE;
+ }
+#endif // wxUSE_MENU_CALLBACK
+
+ // Try the menu's event handler
+ if ( !processed )
+ {
+ wxEvtHandler *handler = GetEventHandler();
+ if ( handler )
+ processed = handler->ProcessEvent(event);
+ }
+
+ // Try the window the menu was popped up from (and up through the
+ // hierarchy)
+ if ( !processed )
+ {
+ const wxMenuBase *menu = this;
+ while ( menu )
+ {
+ wxWindow *win = menu->GetInvokingWindow();
+ if ( win )
+ {
+ processed = win->GetEventHandler()->ProcessEvent(event);
+ break;
+ }
+
+ menu = menu->GetParent();
+ }
+ }
+
+ return processed;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu attaching/detaching to/from menu bar
+// ----------------------------------------------------------------------------
+
+void wxMenuBase::Attach(wxMenuBarBase *menubar)
+{
+ // use Detach() instead!
+ wxASSERT_MSG( menubar, _T("menu can't be attached to NULL menubar") );
+
+ // use IsAttached() to prevent this from happening
+ wxASSERT_MSG( !m_menuBar, _T("attaching menu twice?") );
+
+ m_menuBar = (wxMenuBar *)menubar;
+}
+
+void wxMenuBase::Detach()
+{
+ // use IsAttached() to prevent this from happening
+ wxASSERT_MSG( m_menuBar, _T("detaching unattached menu?") );
+
+ m_menuBar = NULL;
+}
+
// ----------------------------------------------------------------------------
// wxMenu functions forwarded to wxMenuItem
// ----------------------------------------------------------------------------
{
// we own the menus when we get them
m_menus.DeleteContents(TRUE);
+
+ // not attached yet
+ m_menuBarFrame = NULL;
}
wxMenuBarBase::~wxMenuBarBase()
wxCHECK_MSG( menu, FALSE, wxT("can't append NULL menu") );
m_menus.Append(menu);
+ menu->Attach(this);
return TRUE;
}
{
return wxMenuBarBase::Append(menu, title);
}
- else
+ else // not at the end
{
wxCHECK_MSG( menu, FALSE, wxT("can't insert NULL menu") );
wxCHECK_MSG( node, FALSE, wxT("bad index in wxMenuBar::Insert()") );
m_menus.Insert(node, menu);
+ menu->Attach(this);
return TRUE;
}
wxMenu *menuOld = node->GetData();
node->SetData(menu);
+ menu->Attach(this);
+ menuOld->Detach();
+
return menuOld;
}
node = m_menus.DetachNode(node);
wxCHECK( node, NULL ); // unexpected
wxMenu *menu = node->GetData();
+ menu->Detach();
delete node;
}
+// ----------------------------------------------------------------------------
+// wxMenuBar attaching/detaching to/from the frame
+// ----------------------------------------------------------------------------
+
+void wxMenuBarBase::Attach(wxFrame *frame)
+{
+ wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+
+ m_menuBarFrame = frame;
+}
+
+void wxMenuBarBase::Detach()
+{
+ wxASSERT_MSG( IsAttached(), wxT("detaching unattached menubar") );
+
+ m_menuBarFrame = NULL;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar searching for items
+// ----------------------------------------------------------------------------
+
+wxMenuItem *wxMenuBarBase::FindItem(int id, wxMenu **menu) const
+{
+ if ( menu )
+ *menu = NULL;
+
+ wxMenuItem *item = NULL;
+ size_t count = GetMenuCount();
+ for ( size_t i = 0; !item && (i < count); i++ )
+ {
+ item = m_menus[i]->FindItem(id, menu);
+ }
+
+ return item;
+}
+
+int wxMenuBarBase::FindMenuItem(const wxString& menu, const wxString& item) const
+{
+ wxString label = wxMenuItem::GetLabelFromText(menu);
+
+ int i = 0;
+ wxMenuList::Node *node;
+ for ( node = m_menus.GetFirst(); node; node = node->GetNext(), i++ )
+ {
+ if ( label == wxMenuItem::GetLabelFromText(GetLabelTop(i)) )
+ return node->GetData()->FindItem(item);
+ }
+
+ return wxNOT_FOUND;
+}
+
// ---------------------------------------------------------------------------
// wxMenuBar functions forwarded to wxMenuItem
// ---------------------------------------------------------------------------
return item->GetHelp();
}
+#endif // wxUSE_MENUS
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/module.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_MIMETYPE
+
#ifndef WX_PRECOMP
- #include "wx/defs.h"
+ #include "wx/module.h"
#endif
#ifndef WX_PRECOMP
};
IMPLEMENT_DYNAMIC_CLASS(wxMimeTypeCmnModule, wxModule)
+
+#endif // wxUSE_MIMETYPE
#endif
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#include "wx/image.h"
IMPLEMENT_ABSTRACT_CLASS(wxGridSizer, wxSizer);
IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer, wxGridSizer);
IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer, wxSizer);
+#if wxUSE_STATBOX
IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer);
+#endif
#if wxUSE_NOTEBOOK
IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer);
#endif
// wxStaticBoxSizer
//---------------------------------------------------------------------------
+#if wxUSE_STATBOX
+
wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient )
: wxBoxSizer( orient )
{
return ret;
}
+#endif // wxUSE_STATBOX
+
//---------------------------------------------------------------------------
// wxNotebookSizer
//---------------------------------------------------------------------------
wxSize wxNotebookSizer::CalcMin()
{
- // This will have to be done platform by platform
- // as there is no way to guess the thickness of
- // the wxNotebook tabs and border.
-
- int borderX = 5;
- int borderY = 5;
- if ((m_notebook->HasFlag(wxNB_RIGHT)) ||
- (m_notebook->HasFlag(wxNB_LEFT)))
- {
- borderX += 90; // improvements later..
- }
- else
- {
- borderY += 40; // improvements later..
- }
+ wxSize sizeBorder = m_notebook->CalcSizeFromPage(wxSize(0, 0));
+
+ sizeBorder.x += 5;
+ sizeBorder.y += 5;
if (m_notebook->GetChildren().GetCount() == 0)
- return wxSize(borderX + 10, borderY + 10);
+ {
+ return wxSize(sizeBorder.x + 10, sizeBorder.y + 10);
+ }
int maxX = 0;
int maxY = 0;
{
wxSize subsize( itemsizer->CalcMin() );
- if (subsize.x > maxX) maxX = subsize.x;
- if (subsize.y > maxY) maxY = subsize.y;
+ if (subsize.x > maxX)
+ maxX = subsize.x;
+ if (subsize.y > maxY)
+ maxY = subsize.y;
}
node = node->GetNext();
}
- return wxSize( borderX + maxX, borderY + maxY );
+ return wxSize( maxX, maxY ) + sizeBorder;
}
#endif // wxUSE_NOTEBOOK
{
size_t len =
MultiByteToWideChar(CodePage, 0, psz, -1, buf, buf ? n : 0);
- //VS: returns # of written chars for buf!=NULL and *size*
+ //VS: returns # of written chars for buf!=NULL and *size*
// needed buffer for buf==NULL
return len ? (buf ? len : len-1) : (size_t)-1;
}
{
size_t len = WideCharToMultiByte(CodePage, 0, psz, -1, buf,
buf ? n : 0, NULL, NULL);
- //VS: returns # of written chars for buf!=NULL and *size*
+ //VS: returns # of written chars for buf!=NULL and *size*
// needed buffer for buf==NULL
return len ? (buf ? len : len-1) : (size_t)-1;
}
public:
long CodePage;
};
-#endif
+#endif // __WIN32__
+
+#if wxUSE_FONTMAP
class EC_CharSet : public wxCharacterSet
{
wxEncodingConverter m2w, w2m;
};
+#endif // wxUSE_FONTMAP
+
static wxCharacterSet *wxGetCharacterSet(const wxChar *name)
{
wxCharacterSet *cset = NULL;
}
}
- if (cset && cset->usable()) return cset;
+ if (cset && cset->usable())
+ return cset;
+
if (cset)
{
delete cset;
delete cset;
#endif // __WIN32__
+#if wxUSE_FONTMAP
cset = new EC_CharSet(name);
if (cset->usable())
return cset;
+#endif // wxUSE_FONTMAP
delete cset;
wxLogError(_("Unknown encoding '%s'!"), name);
class EC_CharSetConverter
{
public:
- EC_CharSetConverter(EC_CharSet*from,EC_CharSet*to)
+ EC_CharSetConverter(EC_CharSet* from,EC_CharSet* to)
{ cnv.Init(from->enc,to->enc); }
- size_t Convert(char*buf, const char*psz, size_t n)
+ size_t Convert(char* buf, const char* psz, size_t n)
{
size_t inbuf = strlen(psz);
if (buf) cnv.Convert(psz,buf);
Copy(src);
+ m_autoSort = src.m_autoSort;
+
return *this;
}
#pragma hdrstop
#endif
+#if wxUSE_TOOLBAR
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <windows.h>
#endif
-#if wxUSE_TOOLBAR
-
#include "wx/tbarbase.h"
// ----------------------------------------------------------------------------
// wxWindows macros
// ----------------------------------------------------------------------------
-#if !USE_SHARED_LIBRARY
- BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
- EVT_IDLE(wxToolBarBase::OnIdle)
- END_EVENT_TABLE()
-#endif
-
IMPLEMENT_CLASS(wxToolBarBase, wxControl)
+BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
+ EVT_IDLE(wxToolBarBase::OnIdle)
+END_EVENT_TABLE()
+
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxToolBarToolsList);
// ============================================================================
// declarations
// ============================================================================
+
#ifdef __GNUG__
#pragma implementation "textctrlbase.h"
#endif
-
+
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#pragma hdrstop
#endif
+#if wxUSE_TEXTCTRL
+
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
wxTextCtrlBase::wxTextCtrlBase()
{
#ifndef NO_TEXT_WINDOW_STREAM
- #if wxUSE_IOSTREAMH
- if (allocate())
- setp(base(),ebuf());
- #else
- m_streambuf=new char[64];
- setp(m_streambuf,m_streambuf+64);
- #endif //wxUSE_IOSTREAMH
+ #if wxUSE_IOSTREAMH
+ if (allocate())
+ setp(base(),ebuf());
+ #else
+ m_streambuf = new char[64];
+ setp(m_streambuf, m_streambuf + 64);
+ #endif //wxUSE_IOSTREAMH
#endif // NO_TEXT_WINDOW_STREAM
}
bool wxTextCtrlBase::LoadFile(const wxString& filename)
{
+#if wxUSE_FFILE
wxFFile file(filename);
if ( file.IsOpened() )
{
}
wxLogError(_("File couldn't be loaded."));
+#endif // wxUSE_FFILE
return FALSE;
}
return FALSE;
}
+#if wxUSE_FFILE
wxFFile file(filename, "w");
if ( file.IsOpened() && file.Write(GetValue()) )
{
}
wxLogError(_("The text couldn't be saved."));
+#endif // wxUSE_FFILE
return FALSE;
}
#endif // NO_TEXT_WINDOW_STREAM
+// ----------------------------------------------------------------------------
+// clipboard stuff
+// ----------------------------------------------------------------------------
+
+bool wxTextCtrlBase::CanCopy() const
+{
+ // can copy if there's a selection
+ long from, to;
+ GetSelection(&from, &to);
+ return from != to;
+}
+
+bool wxTextCtrlBase::CanCut() const
+{
+ // can cut if there's a selection and if we're not read only
+ return CanCopy() && IsEditable();
+}
+
+bool wxTextCtrlBase::CanPaste() const
+{
+ // can paste if we are not read only
+ return IsEditable();
+}
+
+// ----------------------------------------------------------------------------
+// misc
+// ----------------------------------------------------------------------------
+
+void wxTextCtrlBase::SelectAll()
+{
+ SetSelection(0, GetLastPosition());
+}
+
+#endif // wxUSE_TEXTCTRL
+
// wxWin macros
// ----------------------------------------------------------------------------
-#if wxUSE_GUI
+#if wxUSE_GUI && wxUSE_TIMER
IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent)
#endif // wxUSE_GUI
// wxTimerBase
// ----------------------------------------------------------------------------
-#if wxUSE_GUI
+#if wxUSE_GUI && wxUSE_TIMER
void wxTimerBase::Notify()
{
// wxStopWatch
// ----------------------------------------------------------------------------
+#if wxUSE_LONGLONG
+
void wxStopWatch::Start(long t)
{
m_t0 = wxGetLocalTimeMillis() - t;
return (m_pause ? m_pause : GetElapsedTime());
}
+#endif // wxUSE_LONGLONG
+
// ----------------------------------------------------------------------------
// old timer functions superceded by wxStopWatch
// ----------------------------------------------------------------------------
+#if wxUSE_LONGLONG
+
static wxLongLong wxStartTime = 0l;
// starts the global timer
return (newTime - oldTime).GetLo();
}
+#endif // wxUSE_LONGLONG
// ----------------------------------------------------------------------------
// the functions to get the current time and timezone info
long wxGetUTCTime()
{
struct tm tm;
- struct tm *ptm;
+ struct tm *ptm;
time_t t0, t1;
// This cannot be made static because mktime can overwrite it
return -1;
}
+#if wxUSE_LONGLONG
// Get local time as milliseconds since 00:00:00, Jan 1st 1970
wxLongLong wxGetLocalTimeMillis()
#endif // time functions
}
+
+#endif // wxUSE_LONGLONG
+
// Name: tokenzr.cpp
// Purpose: String tokenizer
// Author: Guilhem Lavaux
-// Modified by: Vadim Zeitlin
+// Modified by: Vadim Zeitlin (almost full rewrite)
// Created: 04/22/98
// RCS-ID: $Id$
// Copyright: (c) Guilhem Lavaux
if ( m_string.find_first_not_of(m_delims) == wxString::npos )
{
- // no non empty tokens left, but in wxTOKEN_RET_EMPTY_ALL mode we
- // still may return TRUE if GetNextToken() wasn't called yet for the
- // last trailing empty token
- return m_mode == wxTOKEN_RET_EMPTY_ALL ? m_hasMore : FALSE;
+ // no non empty tokens left, but in 2 cases we still may return TRUE if
+ // GetNextToken() wasn't called yet for this empty token:
+ //
+ // a) in wxTOKEN_RET_EMPTY_ALL mode we always do it
+ // b) in wxTOKEN_RET_EMPTY mode we do it in the special case of a
+ // string containing only the delimiter: then there is an empty
+ // token just before it
+ return (m_mode == wxTOKEN_RET_EMPTY_ALL) ||
+ (m_mode == wxTOKEN_RET_EMPTY && m_pos == 0)
+ ? m_hasMore : FALSE;
}
else
{
return token;
}
+
+// ----------------------------------------------------------------------------
+// public functions
+// ----------------------------------------------------------------------------
+
+wxArrayString wxStringTokenize(const wxString& str,
+ const wxString& delims,
+ wxStringTokenizerMode mode)
+{
+ wxArrayString tokens;
+ wxStringTokenizer tk(str, delims, mode);
+ while ( tk.HasMoreTokens() )
+ {
+ tokens.Add(tk.GetNextToken());
+ }
+
+ return tokens;
+}
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_TREECTRL
+
#include "wx/treebase.h"
#include "wx/settings.h"
#include "wx/log.h"
m_itemOld = 0l;
}
+#endif // wxUSE_TREECTRL
+
#if wxUSE_GUI
#include "wx/window.h"
- #include "wx/menu.h"
#include "wx/frame.h"
+ #include "wx/menu.h"
#include "wx/msgdlg.h"
#include "wx/textdlg.h"
#if wxUSE_ACCEL
{
static wxChar buf[256];
-// sprintf (buf, "%.2f", number);
wxSprintf (buf, fmt, number);
return buf;
}
#if wxUSE_GUI
+#if wxUSE_MENUS
+
// ----------------------------------------------------------------------------
// Menu accelerators related functions
// ----------------------------------------------------------------------------
-wxChar *wxStripMenuCodes (wxChar *in, wxChar *out)
+wxChar *wxStripMenuCodes(wxChar *in, wxChar *out)
{
- if (!in)
- return (wxChar *) NULL;
-
- if (!out)
- out = copystring(in);
-
- wxChar *tmpOut = out;
-
- while (*in)
+ wxString s = wxMenuItem::GetLabelFromText(in);
+ if ( out )
{
- if (*in == wxT('&'))
- {
- // Check && -> &, &x -> x
- if (*++in == wxT('&'))
- *out++ = *in++;
- }
- else if (*in == wxT('\t'))
- {
- // Remove all stuff after \t in X mode, and let the stuff as is
- // in Windows mode.
- // Accelerators are handled in wx_item.cc for Motif, and are not
- // YET supported in XView
- break;
- }
- else
- *out++ = *in++;
- } // while
-
- *out = wxT('\0');
+ // go smash their buffer if it's not big enough - I love char * params
+ memcpy(out, s.c_str(), s.length() * sizeof(wxChar));
+ }
+ else
+ {
+ out = copystring(s);
+ }
- return tmpOut;
+ return out;
}
-wxString wxStripMenuCodes(const wxString& str)
+wxString wxStripMenuCodes(const wxString& in)
{
- wxChar *buf = new wxChar[str.Length() + 1];
- wxStripMenuCodes(WXSTRINGCAST str, buf);
- wxString str1(buf);
- delete[] buf;
- return str1;
-}
+ wxString out;
-#if wxUSE_ACCEL
+ size_t len = in.length();
+ out.reserve(len);
-// return wxAcceleratorEntry for the given menu string or NULL if none
-// specified
-wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
-{
- // check for accelerators: they are given after '\t'
- int posTab = label.Find(wxT('\t'));
- if ( posTab != wxNOT_FOUND ) {
- // parse the accelerator string
- int keyCode = 0;
- int accelFlags = wxACCEL_NORMAL;
- wxString current;
- for ( size_t n = (size_t)posTab + 1; n < label.Len(); n++ ) {
- if ( (label[n] == '+') || (label[n] == '-') ) {
- if ( current == _("ctrl") )
- accelFlags |= wxACCEL_CTRL;
- else if ( current == _("alt") )
- accelFlags |= wxACCEL_ALT;
- else if ( current == _("shift") )
- accelFlags |= wxACCEL_SHIFT;
- else {
- wxLogDebug(wxT("Unknown accel modifier: '%s'"),
- current.c_str());
- }
-
- current.Empty();
+ for ( size_t n = 0; n < len; n++ )
+ {
+ wxChar ch = in[n];
+ if ( ch == _T('&') )
+ {
+ // skip it, it is used to introduce the accel char (or to quote
+ // itself in which case it should still be skipped): note that it
+ // can't be the last character of the string
+ if ( ++n == len )
+ {
+ wxLogDebug(_T("Invalid menu string '%s'"), in.c_str());
}
- else {
- current += wxTolower(label[n]);
+ else
+ {
+ // use the next char instead
+ ch = in[n];
}
}
-
- if ( current.IsEmpty() ) {
- wxLogDebug(wxT("No accel key found, accel string ignored."));
- }
- else {
- if ( current.Len() == 1 ) {
- // it's a letter
- keyCode = wxToupper(current[0U]);
- }
- else {
- // is it a function key?
- if ( current[0U] == 'f' && isdigit(current[1U]) &&
- (current.Len() == 2 ||
- (current.Len() == 3 && isdigit(current[2U]))) ) {
- int n;
- wxSscanf(current.c_str() + 1, wxT("%d"), &n);
-
- keyCode = WXK_F1 + n - 1;
- }
- else {
- // several special cases
- current.MakeUpper();
- if ( current == _("DEL") ) {
- keyCode = WXK_DELETE;
- }
- else if ( current == _("DELETE") ) {
- keyCode = WXK_DELETE;
- }
- else if ( current == _("INS") ) {
- keyCode = WXK_INSERT;
- }
- else if ( current == _("INSERT") ) {
- keyCode = WXK_INSERT;
- }
-#if 0
- else if ( current == _("PGUP") ) {
- keyCode = VK_PRIOR;
- }
- else if ( current == _("PGDN") ) {
- keyCode = VK_NEXT;
- }
-#endif
- else
- {
- wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."),
- current.c_str());
- }
- }
- }
+ else if ( ch == _T('\t') )
+ {
+ // everything after TAB is accel string, exit the loop
+ break;
}
- if ( keyCode ) {
- // we do have something
- return new wxAcceleratorEntry(accelFlags, keyCode);
- }
+ out += ch;
}
- return (wxAcceleratorEntry *)NULL;
+ return out;
}
-#endif // wxUSE_ACCEL
+#endif // wxUSE_MENUS
// ----------------------------------------------------------------------------
// Window search functions
int
wxFindMenuItemId (wxFrame * frame, const wxString& menuString, const wxString& itemString)
{
+#if wxUSE_MENUS
wxMenuBar *menuBar = frame->GetMenuBar ();
- if (!menuBar)
- return -1;
- return menuBar->FindMenuItem (menuString, itemString);
+ if ( menuBar )
+ return menuBar->FindMenuItem (menuString, itemString);
+#endif // wxUSE_MENUS
+
+ return -1;
}
// Try to find the deepest child that contains 'pt'.
* since otherwise the generic code may be pulled in unnecessarily.
*/
+#if wxUSE_MSGDLG
+
int wxMessageBox(const wxString& message, const wxString& caption, long style,
wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) )
{
return wxCANCEL;
}
+#endif // wxUSE_MSGDLG
+
#if wxUSE_TEXTDLG
+
wxString wxGetTextFromUser(const wxString& message, const wxString& caption,
const wxString& defaultValue, wxWindow *parent,
int x, int y, bool WXUNUSED(centre) )
#endif // wxUSE_TEXTDLG
+#if wxUSE_COLOURDLG
+
wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit)
{
wxColourData data;
return colRet;
}
+#endif // wxUSE_COLOURDLG
+
// ----------------------------------------------------------------------------
// missing C RTL functions (FIXME shouldn't be here at all)
// ----------------------------------------------------------------------------
return TRUE;
}
} else
+ // array controls
#if wxUSE_CHECKLISTBOX && !defined(__WIN16__)
- // array controls
- // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox
- // MUST come first:
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
- {
- wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
- if (m_pArrayInt)
+ // NOTE: wxCheckListBox is a wxListBox, so wxCheckListBox MUST come first:
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
{
- // clear all selections
- int i;
- for (i = 0 ; i < pControl->Number(); ++i)
- pControl->Check(i, FALSE);
- // select each item in our array
- unsigned u;
- for (u = 0; u < m_pArrayInt->Count(); ++u)
- pControl->Check(m_pArrayInt->Item(u));
- return TRUE;
- }
+ wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
+ if (m_pArrayInt)
+ {
+ // clear all selections
+ size_t i,
+ count = pControl->GetCount();
+ for ( i = 0 ; i < count; i++ )
+ pControl->Check(i, FALSE);
+
+ // select each item in our array
+ count = m_pArrayInt->GetCount();
+ for ( i = 0 ; i < count; i++ )
+ pControl->Check(m_pArrayInt->Item(i));
+
+ return TRUE;
+ }
else
- return FALSE;
- } else
+ return FALSE;
+ } else
#endif
#if wxUSE_LISTBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
if (m_pArrayInt)
{
// clear all selections
- int i;
- for (i = 0 ; i < pControl->Number(); ++i)
+ size_t i,
+ count = pControl->GetCount();
+ for ( i = 0 ; i < count; i++ )
pControl->Deselect(i);
+
// select each item in our array
- unsigned u;
- for (u = 0; u < m_pArrayInt->Count(); ++u)
- pControl->SetSelection(m_pArrayInt->Item(u));
+ count = m_pArrayInt->GetCount();
+ for ( i = 0 ; i < count; i++ )
+ pControl->SetSelection(m_pArrayInt->Item(i));
+
return TRUE;
}
} else
return TRUE;
}
} else
+ // array controls
#if wxUSE_CHECKLISTBOX
#ifndef __WIN16__
- // array controls
- // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox
- // MUST come first:
+ // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
{
wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
- if (m_pArrayInt)
+ if (m_pArrayInt)
{
// clear our array
m_pArrayInt->Clear();
+
// add each selected item to our array
- int i;
- for (i = 0 ; i < pControl->Number(); ++i)
+ size_t i,
+ count = pControl->GetCount();
+ for ( i = 0; i < count; i++ )
+ {
if (pControl->IsChecked(i))
m_pArrayInt->Add(i);
+ }
+
return TRUE;
}
- else
- return FALSE;
+ else
+ return FALSE;
} else
#endif
#endif
{
// clear our array
m_pArrayInt->Clear();
+
// add each selected item to our array
- int i;
- for (i = 0 ; i < pControl->Number(); ++i)
+ size_t i,
+ count = pControl->GetCount();
+ for ( i = 0; i < count; i++ )
+ {
if (pControl->Selected(i))
m_pArrayInt->Add(i);
+ }
+
return TRUE;
}
} else
#include "wx/frame.h"
#include "wx/defs.h"
#include "wx/window.h"
+ #include "wx/control.h"
#include "wx/checkbox.h"
#include "wx/radiobut.h"
#include "wx/textctrl.h"
// no client data (yet)
m_clientData = NULL;
- m_clientDataType = ClientData_None;
+ m_clientDataType = wxClientData_None;
// the default event handler is just this window
m_eventHandler = this;
#endif // wxUSE_VALIDATORS
// we only delete object data, not untyped
- if ( m_clientDataType == ClientData_Object )
+ if ( m_clientDataType == wxClientData_Object )
delete m_clientObject;
#if wxUSE_CONSTRAINTS
node = node->GetNext() )
{
wxWindow *win = node->GetData();
- if ( win->IsTopLevel() || wxDynamicCast(win, wxStatusBar) || !win->IsShown())
+ if ( win->IsTopLevel()
+#if wxUSE_STATUSBAR
+ || wxDynamicCast(win, wxStatusBar)
+#endif // wxUSE_STATUSBAR
+ )
{
// dialogs and frames lie in different top level windows -
// don't deal with them here; as for the status bars, they
}
}
+// by default the origin is not shifted
+wxPoint wxWindowBase::GetClientAreaOrigin() const
+{
+ return wxPoint(0, 0);
+}
+
// set the min/max size of the window
void wxWindowBase::SetSizeHints(int minW, int minH,
int maxW, int maxH,
#endif // wxUSE_VALIDATORS
// ----------------------------------------------------------------------------
-// update region testing
+// update region stuff
// ----------------------------------------------------------------------------
+wxRect wxWindowBase::GetUpdateClientRect() const
+{
+ wxRegion rgnUpdate = GetUpdateRegion();
+ rgnUpdate.Intersect(GetClientRect());
+ wxRect rectUpdate = rgnUpdate.GetBox();
+ wxPoint ptOrigin = GetClientAreaOrigin();
+ rectUpdate.x -= ptOrigin.x;
+ rectUpdate.y -= ptOrigin.y;
+
+ return rectUpdate;
+}
+
bool wxWindowBase::IsExposed(int x, int y) const
{
return m_updateRegion.Contains(x, y) != wxOutRegion;
// of control classes.
void wxWindowBase::UpdateWindowUI()
{
+#if wxUSE_CONTROLS
wxUpdateUIEvent event(GetId());
event.m_eventObject = this;
wxControl *control = wxDynamicThisCast(this, wxControl);
if ( control )
{
+#if wxUSE_TEXTCTRL
wxTextCtrl *text = wxDynamicCast(control, wxTextCtrl);
if ( text )
text->SetValue(event.GetText());
else
+#endif // wxUSE_TEXTCTRL
control->SetLabel(event.GetText());
}
}
}
#endif // wxUSE_RADIOBTN
}
+#endif // wxUSE_CONTROLS
}
// ----------------------------------------------------------------------------
void wxWindowBase::DoSetClientObject( wxClientData *data )
{
- wxASSERT_MSG( m_clientDataType != ClientData_Void,
+ wxASSERT_MSG( m_clientDataType != wxClientData_Void,
wxT("can't have both object and void client data") );
if ( m_clientObject )
delete m_clientObject;
m_clientObject = data;
- m_clientDataType = ClientData_Object;
+ m_clientDataType = wxClientData_Object;
}
wxClientData *wxWindowBase::DoGetClientObject() const
{
// it's not an error to call GetClientObject() on a window which doesn't
// have client data at all - NULL will be returned
- wxASSERT_MSG( m_clientDataType != ClientData_Void,
+ wxASSERT_MSG( m_clientDataType != wxClientData_Void,
wxT("this window doesn't have object client data") );
return m_clientObject;
void wxWindowBase::DoSetClientData( void *data )
{
- wxASSERT_MSG( m_clientDataType != ClientData_Object,
+ wxASSERT_MSG( m_clientDataType != wxClientData_Object,
wxT("can't have both object and void client data") );
m_clientData = data;
- m_clientDataType = ClientData_Void;
+ m_clientDataType = wxClientData_Void;
}
void *wxWindowBase::DoGetClientData() const
{
// it's not an error to call GetClientData() on a window which doesn't have
// client data at all - NULL will be returned
- wxASSERT_MSG( m_clientDataType != ClientData_Object,
+ wxASSERT_MSG( m_clientDataType != wxClientData_Object,
wxT("this window doesn't have void client data") );
return m_clientData;
// process Ctrl-Alt-mclick
void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
{
+#if wxUSE_MSGDLG
if ( event.ControlDown() && event.AltDown() )
{
// don't translate these strings
(wxWindow *)this);
}
else
+#endif // wxUSE_MSGDLG
{
event.Skip();
}
delete (wxWindow *)GetData();
}
+// ----------------------------------------------------------------------------
+// borders
+// ----------------------------------------------------------------------------
+
+wxBorder wxWindowBase::GetBorder() const
+{
+ wxBorder border = (wxBorder)(m_windowStyle & wxBORDER_MASK);
+ if ( border == wxBORDER_DEFAULT )
+ {
+ border = GetDefaultBorder();
+ }
+
+ return border;
+}
+
+wxBorder wxWindowBase::GetDefaultBorder() const
+{
+ return wxBORDER_NONE;
+}
+
+// ----------------------------------------------------------------------------
+// hit testing
+// ----------------------------------------------------------------------------
+
+wxHitTest wxWindowBase::DoHitTest(wxCoord x, wxCoord y) const
+{
+ // here we just check if the point is inside the window or not
+
+ // check the top and left border first
+ bool outside = x < 0 || y < 0;
+ if ( !outside )
+ {
+ // check the right and bottom borders too
+ wxSize size = GetSize();
+ outside = x >= size.x || y >= size.y;
+ }
+
+ return outside ? wxHT_WINDOW_OUTSIDE : wxHT_WINDOW_INSIDE;
+}
+
# include "wx/defs.h"
#endif
-#if wxUSE_IMAGE && wxUSE_XPM
#include "wx/stream.h"
#include "wx/image.h"
static rgbRecord theRGBRecords[] =
{
- {"aliceblue", myRGB(240, 248, 255)},
- {"antiquewhite", myRGB(250, 235, 215)},
- {"aquamarine", myRGB(50, 191, 193)},
- {"azure", myRGB(240, 255, 255)},
- {"beige", myRGB(245, 245, 220)},
- {"bisque", myRGB(255, 228, 196)},
- {"black", myRGB(0, 0, 0)},
- {"blanchedalmond", myRGB(255, 235, 205)},
- {"blue", myRGB(0, 0, 255)},
- {"blueviolet", myRGB(138, 43, 226)},
- {"brown", myRGB(165, 42, 42)},
+ {"AliceBlue", myRGB(240, 248, 255)},
+ {"AntiqueWhite", myRGB(250, 235, 215)},
+ {"Aquamarine", myRGB(50, 191, 193)},
+ {"Azure", myRGB(240, 255, 255)},
+ {"Beige", myRGB(245, 245, 220)},
+ {"Bisque", myRGB(255, 228, 196)},
+ {"Black", myRGB(0, 0, 0)},
+ {"BlanchedAlmond", myRGB(255, 235, 205)},
+ {"Blue", myRGB(0, 0, 255)},
+ {"BlueViolet", myRGB(138, 43, 226)},
+ {"Brown", myRGB(165, 42, 42)},
{"burlywood", myRGB(222, 184, 135)},
- {"cadetblue", myRGB(95, 146, 158)},
+ {"CadetBlue", myRGB(95, 146, 158)},
{"chartreuse", myRGB(127, 255, 0)},
{"chocolate", myRGB(210, 105, 30)},
- {"coral", myRGB(255, 114, 86)},
- {"cornflowerblue", myRGB(34, 34, 152)},
+ {"Coral", myRGB(255, 114, 86)},
+ {"CornflowerBlue", myRGB(34, 34, 152)},
{"cornsilk", myRGB(255, 248, 220)},
- {"cyan", myRGB(0, 255, 255)},
- {"darkgoldenrod", myRGB(184, 134, 11)},
- {"darkgreen", myRGB(0, 86, 45)},
- {"darkkhaki", myRGB(189, 183, 107)},
- {"darkolivegreen", myRGB(85, 86, 47)},
- {"darkorange", myRGB(255, 140, 0)},
- {"darkorchid", myRGB(139, 32, 139)},
- {"darksalmon", myRGB(233, 150, 122)},
- {"darkseagreen", myRGB(143, 188, 143)},
- {"darkslateblue", myRGB(56, 75, 102)},
- {"darkslategray", myRGB(47, 79, 79)},
- {"darkturquoise", myRGB(0, 166, 166)},
- {"darkviolet", myRGB(148, 0, 211)},
- {"deeppink", myRGB(255, 20, 147)},
- {"deepskyblue", myRGB(0, 191, 255)},
- {"dimgray", myRGB(84, 84, 84)},
- {"dodgerblue", myRGB(30, 144, 255)},
- {"firebrick", myRGB(142, 35, 35)},
- {"floralwhite", myRGB(255, 250, 240)},
- {"forestgreen", myRGB(80, 159, 105)},
+ {"Cyan", myRGB(0, 255, 255)},
+ {"DarkGoldenrod", myRGB(184, 134, 11)},
+ {"DarkGreen", myRGB(0, 86, 45)},
+ {"DarkKhaki", myRGB(189, 183, 107)},
+ {"DarkOliveGreen", myRGB(85, 86, 47)},
+ {"DarkOrange", myRGB(255, 140, 0)},
+ {"DarkOrchid", myRGB(139, 32, 139)},
+ {"DarkSalmon", myRGB(233, 150, 122)},
+ {"DarkSeaGreen", myRGB(143, 188, 143)},
+ {"DarkSlateBlue", myRGB(56, 75, 102)},
+ {"DarkSlateGray", myRGB(47, 79, 79)},
+ {"DarkTurquoise", myRGB(0, 166, 166)},
+ {"DarkViolet", myRGB(148, 0, 211)},
+ {"DeepPink", myRGB(255, 20, 147)},
+ {"DeepSkyBlue", myRGB(0, 191, 255)},
+ {"DimGray", myRGB(84, 84, 84)},
+ {"DodgerBlue", myRGB(30, 144, 255)},
+ {"Firebrick", myRGB(142, 35, 35)},
+ {"FloralWhite", myRGB(255, 250, 240)},
+ {"ForestGreen", myRGB(80, 159, 105)},
{"gainsboro", myRGB(220, 220, 220)},
- {"ghostwhite", myRGB(248, 248, 255)},
- {"gold", myRGB(218, 170, 0)},
- {"goldenrod", myRGB(239, 223, 132)},
- {"gray", myRGB(126, 126, 126)},
- {"gray0", myRGB(0, 0, 0)},
- {"gray1", myRGB(3, 3, 3)},
- {"gray10", myRGB(26, 26, 26)},
- {"gray100", myRGB(255, 255, 255)},
- {"gray11", myRGB(28, 28, 28)},
- {"gray12", myRGB(31, 31, 31)},
- {"gray13", myRGB(33, 33, 33)},
- {"gray14", myRGB(36, 36, 36)},
- {"gray15", myRGB(38, 38, 38)},
- {"gray16", myRGB(41, 41, 41)},
- {"gray17", myRGB(43, 43, 43)},
- {"gray18", myRGB(46, 46, 46)},
- {"gray19", myRGB(48, 48, 48)},
- {"gray2", myRGB(5, 5, 5)},
- {"gray20", myRGB(51, 51, 51)},
- {"gray21", myRGB(54, 54, 54)},
- {"gray22", myRGB(56, 56, 56)},
- {"gray23", myRGB(59, 59, 59)},
- {"gray24", myRGB(61, 61, 61)},
- {"gray25", myRGB(64, 64, 64)},
- {"gray26", myRGB(66, 66, 66)},
- {"gray27", myRGB(69, 69, 69)},
- {"gray28", myRGB(71, 71, 71)},
- {"gray29", myRGB(74, 74, 74)},
- {"gray3", myRGB(8, 8, 8)},
- {"gray30", myRGB(77, 77, 77)},
- {"gray31", myRGB(79, 79, 79)},
- {"gray32", myRGB(82, 82, 82)},
- {"gray33", myRGB(84, 84, 84)},
- {"gray34", myRGB(87, 87, 87)},
- {"gray35", myRGB(89, 89, 89)},
- {"gray36", myRGB(92, 92, 92)},
- {"gray37", myRGB(94, 94, 94)},
- {"gray38", myRGB(97, 97, 97)},
- {"gray39", myRGB(99, 99, 99)},
- {"gray4", myRGB(10, 10, 10)},
- {"gray40", myRGB(102, 102, 102)},
- {"gray41", myRGB(105, 105, 105)},
- {"gray42", myRGB(107, 107, 107)},
- {"gray43", myRGB(110, 110, 110)},
- {"gray44", myRGB(112, 112, 112)},
- {"gray45", myRGB(115, 115, 115)},
- {"gray46", myRGB(117, 117, 117)},
- {"gray47", myRGB(120, 120, 120)},
- {"gray48", myRGB(122, 122, 122)},
- {"gray49", myRGB(125, 125, 125)},
- {"gray5", myRGB(13, 13, 13)},
- {"gray50", myRGB(127, 127, 127)},
- {"gray51", myRGB(130, 130, 130)},
- {"gray52", myRGB(133, 133, 133)},
- {"gray53", myRGB(135, 135, 135)},
- {"gray54", myRGB(138, 138, 138)},
- {"gray55", myRGB(140, 140, 140)},
- {"gray56", myRGB(143, 143, 143)},
- {"gray57", myRGB(145, 145, 145)},
- {"gray58", myRGB(148, 148, 148)},
- {"gray59", myRGB(150, 150, 150)},
- {"gray6", myRGB(15, 15, 15)},
- {"gray60", myRGB(153, 153, 153)},
- {"gray61", myRGB(156, 156, 156)},
- {"gray62", myRGB(158, 158, 158)},
- {"gray63", myRGB(161, 161, 161)},
- {"gray64", myRGB(163, 163, 163)},
- {"gray65", myRGB(166, 166, 166)},
- {"gray66", myRGB(168, 168, 168)},
- {"gray67", myRGB(171, 171, 171)},
- {"gray68", myRGB(173, 173, 173)},
- {"gray69", myRGB(176, 176, 176)},
- {"gray7", myRGB(18, 18, 18)},
- {"gray70", myRGB(179, 179, 179)},
- {"gray71", myRGB(181, 181, 181)},
- {"gray72", myRGB(184, 184, 184)},
- {"gray73", myRGB(186, 186, 186)},
- {"gray74", myRGB(189, 189, 189)},
- {"gray75", myRGB(191, 191, 191)},
- {"gray76", myRGB(194, 194, 194)},
- {"gray77", myRGB(196, 196, 196)},
- {"gray78", myRGB(199, 199, 199)},
- {"gray79", myRGB(201, 201, 201)},
- {"gray8", myRGB(20, 20, 20)},
- {"gray80", myRGB(204, 204, 204)},
- {"gray81", myRGB(207, 207, 207)},
- {"gray82", myRGB(209, 209, 209)},
- {"gray83", myRGB(212, 212, 212)},
- {"gray84", myRGB(214, 214, 214)},
- {"gray85", myRGB(217, 217, 217)},
- {"gray86", myRGB(219, 219, 219)},
- {"gray87", myRGB(222, 222, 222)},
- {"gray88", myRGB(224, 224, 224)},
- {"gray89", myRGB(227, 227, 227)},
- {"gray9", myRGB(23, 23, 23)},
- {"gray90", myRGB(229, 229, 229)},
- {"gray91", myRGB(232, 232, 232)},
- {"gray92", myRGB(235, 235, 235)},
- {"gray93", myRGB(237, 237, 237)},
- {"gray94", myRGB(240, 240, 240)},
- {"gray95", myRGB(242, 242, 242)},
- {"gray96", myRGB(245, 245, 245)},
- {"gray97", myRGB(247, 247, 247)},
- {"gray98", myRGB(250, 250, 250)},
- {"gray99", myRGB(252, 252, 252)},
- {"green", myRGB(0, 255, 0)},
- {"greenyellow", myRGB(173, 255, 47)},
+ {"GhostWhite", myRGB(248, 248, 255)},
+ {"Gold", myRGB(218, 170, 0)},
+ {"Goldenrod", myRGB(239, 223, 132)},
+ {"Gray", myRGB(126, 126, 126)},
+ {"Gray0", myRGB(0, 0, 0)},
+ {"Gray1", myRGB(3, 3, 3)},
+ {"Gray10", myRGB(26, 26, 26)},
+ {"Gray100", myRGB(255, 255, 255)},
+ {"Gray11", myRGB(28, 28, 28)},
+ {"Gray12", myRGB(31, 31, 31)},
+ {"Gray13", myRGB(33, 33, 33)},
+ {"Gray14", myRGB(36, 36, 36)},
+ {"Gray15", myRGB(38, 38, 38)},
+ {"Gray16", myRGB(41, 41, 41)},
+ {"Gray17", myRGB(43, 43, 43)},
+ {"Gray18", myRGB(46, 46, 46)},
+ {"Gray19", myRGB(48, 48, 48)},
+ {"Gray2", myRGB(5, 5, 5)},
+ {"Gray20", myRGB(51, 51, 51)},
+ {"Gray21", myRGB(54, 54, 54)},
+ {"Gray22", myRGB(56, 56, 56)},
+ {"Gray23", myRGB(59, 59, 59)},
+ {"Gray24", myRGB(61, 61, 61)},
+ {"Gray25", myRGB(64, 64, 64)},
+ {"Gray26", myRGB(66, 66, 66)},
+ {"Gray27", myRGB(69, 69, 69)},
+ {"Gray28", myRGB(71, 71, 71)},
+ {"Gray29", myRGB(74, 74, 74)},
+ {"Gray3", myRGB(8, 8, 8)},
+ {"Gray30", myRGB(77, 77, 77)},
+ {"Gray31", myRGB(79, 79, 79)},
+ {"Gray32", myRGB(82, 82, 82)},
+ {"Gray33", myRGB(84, 84, 84)},
+ {"Gray34", myRGB(87, 87, 87)},
+ {"Gray35", myRGB(89, 89, 89)},
+ {"Gray36", myRGB(92, 92, 92)},
+ {"Gray37", myRGB(94, 94, 94)},
+ {"Gray38", myRGB(97, 97, 97)},
+ {"Gray39", myRGB(99, 99, 99)},
+ {"Gray4", myRGB(10, 10, 10)},
+ {"Gray40", myRGB(102, 102, 102)},
+ {"Gray41", myRGB(105, 105, 105)},
+ {"Gray42", myRGB(107, 107, 107)},
+ {"Gray43", myRGB(110, 110, 110)},
+ {"Gray44", myRGB(112, 112, 112)},
+ {"Gray45", myRGB(115, 115, 115)},
+ {"Gray46", myRGB(117, 117, 117)},
+ {"Gray47", myRGB(120, 120, 120)},
+ {"Gray48", myRGB(122, 122, 122)},
+ {"Gray49", myRGB(125, 125, 125)},
+ {"Gray5", myRGB(13, 13, 13)},
+ {"Gray50", myRGB(127, 127, 127)},
+ {"Gray51", myRGB(130, 130, 130)},
+ {"Gray52", myRGB(133, 133, 133)},
+ {"Gray53", myRGB(135, 135, 135)},
+ {"Gray54", myRGB(138, 138, 138)},
+ {"Gray55", myRGB(140, 140, 140)},
+ {"Gray56", myRGB(143, 143, 143)},
+ {"Gray57", myRGB(145, 145, 145)},
+ {"Gray58", myRGB(148, 148, 148)},
+ {"Gray59", myRGB(150, 150, 150)},
+ {"Gray6", myRGB(15, 15, 15)},
+ {"Gray60", myRGB(153, 153, 153)},
+ {"Gray61", myRGB(156, 156, 156)},
+ {"Gray62", myRGB(158, 158, 158)},
+ {"Gray63", myRGB(161, 161, 161)},
+ {"Gray64", myRGB(163, 163, 163)},
+ {"Gray65", myRGB(166, 166, 166)},
+ {"Gray66", myRGB(168, 168, 168)},
+ {"Gray67", myRGB(171, 171, 171)},
+ {"Gray68", myRGB(173, 173, 173)},
+ {"Gray69", myRGB(176, 176, 176)},
+ {"Gray7", myRGB(18, 18, 18)},
+ {"Gray70", myRGB(179, 179, 179)},
+ {"Gray71", myRGB(181, 181, 181)},
+ {"Gray72", myRGB(184, 184, 184)},
+ {"Gray73", myRGB(186, 186, 186)},
+ {"Gray74", myRGB(189, 189, 189)},
+ {"Gray75", myRGB(191, 191, 191)},
+ {"Gray76", myRGB(194, 194, 194)},
+ {"Gray77", myRGB(196, 196, 196)},
+ {"Gray78", myRGB(199, 199, 199)},
+ {"Gray79", myRGB(201, 201, 201)},
+ {"Gray8", myRGB(20, 20, 20)},
+ {"Gray80", myRGB(204, 204, 204)},
+ {"Gray81", myRGB(207, 207, 207)},
+ {"Gray82", myRGB(209, 209, 209)},
+ {"Gray83", myRGB(212, 212, 212)},
+ {"Gray84", myRGB(214, 214, 214)},
+ {"Gray85", myRGB(217, 217, 217)},
+ {"Gray86", myRGB(219, 219, 219)},
+ {"Gray87", myRGB(222, 222, 222)},
+ {"Gray88", myRGB(224, 224, 224)},
+ {"Gray89", myRGB(227, 227, 227)},
+ {"Gray9", myRGB(23, 23, 23)},
+ {"Gray90", myRGB(229, 229, 229)},
+ {"Gray91", myRGB(232, 232, 232)},
+ {"Gray92", myRGB(235, 235, 235)},
+ {"Gray93", myRGB(237, 237, 237)},
+ {"Gray94", myRGB(240, 240, 240)},
+ {"Gray95", myRGB(242, 242, 242)},
+ {"Gray96", myRGB(245, 245, 245)},
+ {"Gray97", myRGB(247, 247, 247)},
+ {"Gray98", myRGB(250, 250, 250)},
+ {"Gray99", myRGB(252, 252, 252)},
+ {"Green", myRGB(0, 255, 0)},
+ {"GreenYellow", myRGB(173, 255, 47)},
{"honeydew", myRGB(240, 255, 240)},
- {"hotpink", myRGB(255, 105, 180)},
- {"indianred", myRGB(107, 57, 57)},
+ {"HotPink", myRGB(255, 105, 180)},
+ {"IndianRed", myRGB(107, 57, 57)},
{"ivory", myRGB(255, 255, 240)},
- {"khaki", myRGB(179, 179, 126)},
+ {"Khaki", myRGB(179, 179, 126)},
{"lavender", myRGB(230, 230, 250)},
- {"lavenderblush", myRGB(255, 240, 245)},
- {"lawngreen", myRGB(124, 252, 0)},
- {"lemonchiffon", myRGB(255, 250, 205)},
- {"lightblue", myRGB(176, 226, 255)},
- {"lightcoral", myRGB(240, 128, 128)},
- {"lightcyan", myRGB(224, 255, 255)},
- {"lightgoldenrod", myRGB(238, 221, 130)},
- {"lightgoldenrodyellow", myRGB(250, 250, 210)},
- {"lightgray", myRGB(168, 168, 168)},
- {"lightpink", myRGB(255, 182, 193)},
- {"lightsalmon", myRGB(255, 160, 122)},
- {"lightseagreen", myRGB(32, 178, 170)},
- {"lightskyblue", myRGB(135, 206, 250)},
- {"lightslateblue", myRGB(132, 112, 255)},
- {"lightslategray", myRGB(119, 136, 153)},
- {"lightsteelblue", myRGB(124, 152, 211)},
- {"lightyellow", myRGB(255, 255, 224)},
- {"limegreen", myRGB(0, 175, 20)},
+ {"LavenderBlush", myRGB(255, 240, 245)},
+ {"LawnGreen", myRGB(124, 252, 0)},
+ {"LemonChiffon", myRGB(255, 250, 205)},
+ {"LightBlue", myRGB(176, 226, 255)},
+ {"LightCoral", myRGB(240, 128, 128)},
+ {"LightCyan", myRGB(224, 255, 255)},
+ {"LightGoldenrod", myRGB(238, 221, 130)},
+ {"LightGoldenrodYellow", myRGB(250, 250, 210)},
+ {"LightGray", myRGB(168, 168, 168)},
+ {"LightPink", myRGB(255, 182, 193)},
+ {"LightSalmon", myRGB(255, 160, 122)},
+ {"LightSeaGreen", myRGB(32, 178, 170)},
+ {"LightSkyBlue", myRGB(135, 206, 250)},
+ {"LightSlateBlue", myRGB(132, 112, 255)},
+ {"LightSlateGray", myRGB(119, 136, 153)},
+ {"LightSteelBlue", myRGB(124, 152, 211)},
+ {"LightYellow", myRGB(255, 255, 224)},
+ {"LimeGreen", myRGB(0, 175, 20)},
{"linen", myRGB(250, 240, 230)},
- {"magenta", myRGB(255, 0, 255)},
- {"maroon", myRGB(143, 0, 82)},
- {"mediumaquamarine", myRGB(0, 147, 143)},
- {"mediumblue", myRGB(50, 50, 204)},
- {"mediumforestgreen", myRGB(50, 129, 75)},
- {"mediumgoldenrod", myRGB(209, 193, 102)},
- {"mediumorchid", myRGB(189, 82, 189)},
- {"mediumpurple", myRGB(147, 112, 219)},
- {"mediumseagreen", myRGB(52, 119, 102)},
- {"mediumslateblue", myRGB(106, 106, 141)},
- {"mediumspringgreen", myRGB(35, 142, 35)},
- {"mediumturquoise", myRGB(0, 210, 210)},
- {"mediumvioletred", myRGB(213, 32, 121)},
- {"midnightblue", myRGB(47, 47, 100)},
- {"mintcream", myRGB(245, 255, 250)},
- {"mistyrose", myRGB(255, 228, 225)},
+ {"Magenta", myRGB(255, 0, 255)},
+ {"Maroon", myRGB(143, 0, 82)},
+ {"MediumAquamarine", myRGB(0, 147, 143)},
+ {"MediumBlue", myRGB(50, 50, 204)},
+ {"MediumForestGreen", myRGB(50, 129, 75)},
+ {"MediumGoldenrod", myRGB(209, 193, 102)},
+ {"MediumOrchid", myRGB(189, 82, 189)},
+ {"MediumPurple", myRGB(147, 112, 219)},
+ {"MediumSeaGreen", myRGB(52, 119, 102)},
+ {"MediumSlateBlue", myRGB(106, 106, 141)},
+ {"MediumSpringGreen", myRGB(35, 142, 35)},
+ {"MediumTurquoise", myRGB(0, 210, 210)},
+ {"MediumVioletRed", myRGB(213, 32, 121)},
+ {"MidnightBlue", myRGB(47, 47, 100)},
+ {"MintCream", myRGB(245, 255, 250)},
+ {"MistyRose", myRGB(255, 228, 225)},
{"moccasin", myRGB(255, 228, 181)},
- {"navajowhite", myRGB(255, 222, 173)},
- {"navy", myRGB(35, 35, 117)},
- {"navyblue", myRGB(35, 35, 117)},
- {"oldlace", myRGB(253, 245, 230)},
- {"olivedrab", myRGB(107, 142, 35)},
- {"orange", myRGB(255, 135, 0)},
- {"orangered", myRGB(255, 69, 0)},
- {"orchid", myRGB(239, 132, 239)},
- {"palegoldenrod", myRGB(238, 232, 170)},
- {"palegreen", myRGB(115, 222, 120)},
- {"paleturquoise", myRGB(175, 238, 238)},
- {"palevioletred", myRGB(219, 112, 147)},
- {"papayawhip", myRGB(255, 239, 213)},
- {"peachpuff", myRGB(255, 218, 185)},
+ {"NavajoWhite", myRGB(255, 222, 173)},
+ {"Navy", myRGB(35, 35, 117)},
+ {"NavyBlue", myRGB(35, 35, 117)},
+ {"OldLace", myRGB(253, 245, 230)},
+ {"OliveDrab", myRGB(107, 142, 35)},
+ {"Orange", myRGB(255, 135, 0)},
+ {"OrangeRed", myRGB(255, 69, 0)},
+ {"Orchid", myRGB(239, 132, 239)},
+ {"PaleGoldenrod", myRGB(238, 232, 170)},
+ {"PaleGreen", myRGB(115, 222, 120)},
+ {"PaleTurquoise", myRGB(175, 238, 238)},
+ {"PaleVioletRed", myRGB(219, 112, 147)},
+ {"PapayaWhip", myRGB(255, 239, 213)},
+ {"PeachPuff", myRGB(255, 218, 185)},
{"peru", myRGB(205, 133, 63)},
- {"pink", myRGB(255, 181, 197)},
- {"plum", myRGB(197, 72, 155)},
- {"powderblue", myRGB(176, 224, 230)},
+ {"Pink", myRGB(255, 181, 197)},
+ {"Plum", myRGB(197, 72, 155)},
+ {"PowderBlue", myRGB(176, 224, 230)},
{"purple", myRGB(160, 32, 240)},
- {"red", myRGB(255, 0, 0)},
- {"rosybrown", myRGB(188, 143, 143)},
- {"royalblue", myRGB(65, 105, 225)},
- {"saddlebrown", myRGB(139, 69, 19)},
- {"salmon", myRGB(233, 150, 122)},
- {"sandybrown", myRGB(244, 164, 96)},
- {"seagreen", myRGB(82, 149, 132)},
+ {"Red", myRGB(255, 0, 0)},
+ {"RosyBrown", myRGB(188, 143, 143)},
+ {"RoyalBlue", myRGB(65, 105, 225)},
+ {"SaddleBrown", myRGB(139, 69, 19)},
+ {"Salmon", myRGB(233, 150, 122)},
+ {"SandyBrown", myRGB(244, 164, 96)},
+ {"SeaGreen", myRGB(82, 149, 132)},
{"seashell", myRGB(255, 245, 238)},
- {"sienna", myRGB(150, 82, 45)},
- {"skyblue", myRGB(114, 159, 255)},
- {"slateblue", myRGB(126, 136, 171)},
- {"slategray", myRGB(112, 128, 144)},
+ {"Sienna", myRGB(150, 82, 45)},
+ {"SkyBlue", myRGB(114, 159, 255)},
+ {"SlateBlue", myRGB(126, 136, 171)},
+ {"SlateGray", myRGB(112, 128, 144)},
{"snow", myRGB(255, 250, 250)},
- {"springgreen", myRGB(65, 172, 65)},
- {"steelblue", myRGB(84, 112, 170)},
- {"tan", myRGB(222, 184, 135)},
- {"thistle", myRGB(216, 191, 216)},
+ {"SpringGreen", myRGB(65, 172, 65)},
+ {"SteelBlue", myRGB(84, 112, 170)},
+ {"Tan", myRGB(222, 184, 135)},
+ {"Thistle", myRGB(216, 191, 216)},
{"tomato", myRGB(255, 99, 71)},
- {"transparent", myRGB(0, 0, 1)},
- {"turquoise", myRGB(25, 204, 223)},
- {"violet", myRGB(156, 62, 206)},
- {"violetred", myRGB(243, 62, 150)},
- {"wheat", myRGB(245, 222, 179)},
- {"white", myRGB(255, 255, 255)},
- {"whitesmoke", myRGB(245, 245, 245)},
- {"yellow", myRGB(255, 255, 0)},
- {"yellowgreen", myRGB(50, 216, 56)},
+ {"Transparent", myRGB(0, 0, 1)},
+ {"Turquoise", myRGB(25, 204, 223)},
+ {"Violet", myRGB(156, 62, 206)},
+ {"VioletRed", myRGB(243, 62, 150)},
+ {"Wheat", myRGB(245, 222, 179)},
+ {"White", myRGB(255, 255, 255)},
+ {"WhiteSmoke", myRGB(245, 245, 245)},
+ {"Yellow", myRGB(255, 255, 0)},
+ {"YellowGreen", myRGB(50, 216, 56)},
{NULL, myRGB(0, 0, 0)}
};
static int numTheRGBRecords = 234;
}
-#endif // wxUSE_IMAGE && wxUSE_XPM
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BASE.T!
ALL_SOURCES = \
common/init.cpp \
#include "wx/stattext.h"
#endif //WX_PRECOMP
-// Can only use wxSpinEvent if this is enabled
-#if wxUSE_SPINBTN
+#if wxUSE_CALENDARCTRL
#include "wx/calctrl.h"
m_date = cal->GetDate();
}
-#endif // wxUSE_SPINBTN
+#endif // wxUSE_CALENDARCTRL
if ( m_xOld == -1 && m_yOld == -1 )
{
// save the part we're going to overdraw
+
+ int x = m_x,
+ y = m_y;
+#if defined(__WXGTK__) && !defined(__WX_DC_BLIT_FIXED__)
+ wxPoint pt = dcWin.GetDeviceOrigin();
+ x += pt.x;
+ y += pt.y;
+#endif // broken wxGTK wxDC::Blit
dcMem.Blit(0, 0, m_width, m_height,
- &dcWin, m_x, m_y);
+ &dcWin, x, y);
+
m_xOld = m_x;
m_yOld = m_y;
}
#pragma hdrstop
#endif
+#if wxUSE_CHOICEDLG
+
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/utils.h"
return TRUE;
}
+
+#endif // wxUSE_CHOICEDLG
/////////////////////////////////////////////////////////////////////////////
-// Name: colrdlgg.cpp
+// Name: generic/colrdlgg.cpp
// Purpose: Choice dialogs
// Author: Julian Smart
// Modified by:
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_COLOURDLG
+
#ifndef WX_PRECOMP
-#include <stdio.h>
-#include <stdio.h>
-#include "wx/utils.h"
-#include "wx/intl.h"
-#include "wx/dialog.h"
-#include "wx/listbox.h"
-#include "wx/button.h"
-#include "wx/stattext.h"
-#include "wx/layout.h"
-#include "wx/dcclient.h"
-#include "wx/slider.h"
-#include "wx/sizer.h"
+ #include "wx/utils.h"
+ #include "wx/intl.h"
+ #include "wx/dialog.h"
+ #include "wx/listbox.h"
+ #include "wx/button.h"
+ #include "wx/stattext.h"
+ #include "wx/layout.h"
+ #include "wx/dcclient.h"
+ #include "wx/slider.h"
+ #include "wx/sizer.h"
#endif
#if wxUSE_STATLINE
PaintCustomColour(dc);
}
+#endif // wxUSE_COLOURDLG
#pragma hdrstop
#endif
-#include "wx/defs.h"
+#if wxUSE_DIRDLG
#include "wx/utils.h"
#include "wx/dialog.h"
m_dirCtrl->GetTreeCtrl()->EnsureVisible( new_id );
m_dirCtrl->GetTreeCtrl()->EditLabel( new_id );
}
+
+#endif // wxUSE_DIRDLG
#pragma hdrstop
#endif
+#if wxUSE_DRAGIMAGE
+
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/setup.h"
}
}
+#endif // wxUSE_DRAGIMAGE
#pragma hdrstop
#endif
+#if wxUSE_FILEDLG
+
#ifndef __UNIX__
#error wxFileDialog currently only supports unix
#endif
};
IMPLEMENT_DYNAMIC_CLASS(wxFileDialogGenericModule, wxModule)
+
+#endif // wxUSE_FILEDLG
#pragma hdrstop
#endif
+#if wxUSE_GRID
+
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/dcclient.h"
return rc;
}
+#endif // wxUSE_GRID
#endif
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#include "wx/mdi.h"
#endif
* wxLayoutAlgorithm
*/
+#if wxUSE_MDI_ARCHITECTURE
+
// Lays out windows for an MDI frame. The MDI client area gets what's left
// over.
bool wxLayoutAlgorithm::LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* r)
return TRUE;
}
+#endif // wxUSE_MDI_ARCHITECTURE
+
// Layout algorithm for any window. mainWindow gets what's left over.
bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow)
{
#pragma hdrstop
#endif
+#if wxUSE_LISTCTRL
+
#include "wx/dcscreen.h"
#include "wx/app.h"
#include "wx/listctrl.h"
void wxListMainWindow::OnScroll(wxScrollWinEvent& event)
{
- wxScrolledWindow::OnScroll( event ) ;
+ HandleOnScroll( event );
#if wxUSE_GENERIC_LIST_EXTENSIONS
{
lc->m_headerWin->Refresh() ;
#ifdef __WXMAC__
- lc->m_headerWin->MacUpdateImmediately() ;
+ lc->m_headerWin->MacUpdateImmediately() ;
#endif
}
}
if ( FindFocus() != this )
m_mainWin->SetFocus();
}
+
+#endif // wxUSE_LISTCTRL
#include "wx/button.h"
#endif // WX_PRECOMP
+#if wxUSE_LOGGUI || wxUSE_LOGWINDOW
+
#include "wx/file.h"
#include "wx/textfile.h"
#include "wx/statline.h"
}
}
-// ----------------------------------------------------------------------------
-// wxLogTextCtrl implementation
-// ----------------------------------------------------------------------------
-
-wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl)
-{
- m_pTextCtrl = pTextCtrl;
-}
-
-void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
-{
- wxString msg;
- TimeStamp(&msg);
-#ifdef __WXMAC__
- msg << szString << wxT('\r');
-#else
- msg << szString << wxT('\n');
-#endif
-
- m_pTextCtrl->AppendText(msg);
-}
-
// ----------------------------------------------------------------------------
// wxLogGui implementation (FIXME MT-unsafe)
// ----------------------------------------------------------------------------
titleFormat = _("%s Information");
style = wxICON_INFORMATION;
}
-
+
wxString title;
title.Printf(titleFormat, appName.c_str());
#endif // wxUSE_FILE
-#endif // wxUSE_LOG
+#endif // !(wxUSE_LOGGUI || wxUSE_LOGWINDOW)
+
+#if wxUSE_TEXTCTRL
+
+// ----------------------------------------------------------------------------
+// wxLogTextCtrl implementation
+// ----------------------------------------------------------------------------
+
+wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl)
+{
+ m_pTextCtrl = pTextCtrl;
+}
+
+void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
+{
+ wxString msg;
+ TimeStamp(&msg);
+
+#ifdef __WXMAC__
+ // VZ: this is a bug in wxMac, it *must* accept '\n' as new line, the
+ // translation must be done in wxTextCtrl, not here! (FIXME)
+ msg << szString << wxT('\r');
+#else
+ msg << szString << wxT('\n');
+#endif
+
+ m_pTextCtrl->AppendText(msg);
+}
+
+#endif // wxUSE_TEXTCTRL
+
#pragma hdrstop
#endif
+#if wxUSE_MSGDLG
+
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/dialog.h"
}
}
+#endif // wxUSE_MSGDLG
#pragma hdrstop
#endif
+#if wxUSE_NUMBERDLG
+
#ifndef WX_PRECOMP
#include <stdio.h>
return dialog.GetValue();
}
+
+#endif // wxUSE_NUMBERDLG
#include "wx/log.h"
#endif
-#include "wx/toolbar.h"
-#include "wx/statusbr.h"
-
#include "wx/generic/panelg.h"
// ----------------------------------------------------------------------------
void wxPanel::Init()
{
m_winLastFocused = (wxWindow *)NULL;
+#if wxUSE_BUTTON
m_btnDefault = (wxButton *)NULL;
+#endif // wxUSE_BUTTON
}
bool wxPanel::Create(wxWindow *parent, wxWindowID id,
wxWindow *child = node->GetData();
- if ( child->AcceptsFocus() )
+ if ( child->AcceptsFocusFromKeyboard() )
{
m_winLastFocused = child; // should be redundant, but it is not
// It might happen that the window got reparented or no longer accepts
// the focus.
if ( (*childLastFocused)->GetParent() == win &&
- (*childLastFocused)->AcceptsFocus() )
+ (*childLastFocused)->AcceptsFocusFromKeyboard() )
{
wxLogTrace(_T("focus"),
_T("SetFocusToChild() => last child (0x%08x)."),
{
wxWindow *child = node->GetData();
- if ( child->AcceptsFocus()
- && !child->IsTopLevel()
-#if wxUSE_TOOLBAR
- && !wxDynamicCast(child, wxToolBar)
-#endif // wxUSE_TOOLBAR
-#if wxUSE_STATUSBAR
- && !wxDynamicCast(child, wxStatusBar)
-#endif // wxUSE_STATUSBAR
- )
+ if ( child->AcceptsFocusFromKeyboard() && !child->IsTopLevel() )
{
wxLogTrace(_T("focus"),
_T("SetFocusToChild() => first child (0x%08x)."),
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma hdrstop
#endif
+#if wxUSE_PROPSHEET
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
expr->WritePropertyType(stream);
expr = expr->m_next;
if (expr)
- stream.Append( wxT(", ") );
+ stream.Append( wxT(", ") );
}
stream.Append( wxT("]") );
}
if(node)
{
wxProperty *prop = (wxProperty *)node->Data();
- delete prop;
+ delete prop;
m_properties.DeleteNode(node);
}
-}
+}
bool wxPropertySheet::HasProperty(const wxString& name) const
{
- return (GetProperty(name)?TRUE:FALSE);
+ return (GetProperty(name)?TRUE:FALSE);
}
// Clear all properties
{}
bool wxPropertyValidator::StringToFloat (wxChar *s, float *number) {
- double num;
- bool ok = StringToDouble (s, &num);
- *number = (float) num;
- return ok;
+ double num;
+ bool ok = StringToDouble (s, &num);
+ *number = (float) num;
+ return ok;
}
bool wxPropertyValidator::StringToDouble (wxChar *s, double *number) {
wxChar *value_ptr;
*number = wxStrtod (s, &value_ptr);
if (value_ptr) {
- int len = wxStrlen (value_ptr);
- for (int i = 0; i < len; i++) {
- ok = (wxIsspace (value_ptr[i]) != 0);
- if (!ok) return FALSE;
- }
+ int len = wxStrlen (value_ptr);
+ for (int i = 0; i < len; i++) {
+ ok = (wxIsspace (value_ptr[i]) != 0);
+ if (!ok) return FALSE;
+ }
}
return ok;
}
bool wxPropertyValidator::StringToInt (wxChar *s, int *number) {
- long num;
- bool ok = StringToLong (s, &num);
- *number = (int) num;
- return ok;
+ long num;
+ bool ok = StringToLong (s, &num);
+ *number = (int) num;
+ return ok;
}
bool wxPropertyValidator::StringToLong (wxChar *s, long *number) {
wxChar *value_ptr;
*number = wxStrtol (s, &value_ptr, 10);
if (value_ptr) {
- int len = wxStrlen (value_ptr);
- for (int i = 0; i < len; i++) {
- ok = (wxIsspace (value_ptr[i]) != 0);
- if (!ok) return FALSE;
- }
+ int len = wxStrlen (value_ptr);
+ for (int i = 0; i < len; i++) {
+ ok = (wxIsspace (value_ptr[i]) != 0);
+ if (!ok) return FALSE;
+ }
}
return ok;
}
wxChar *wxPropertyValidator::FloatToString (float number) {
- static wxChar buf[20];
- wxSprintf (buf, wxT("%.6g"), number);
- return buf;
+ static wxChar buf[20];
+ wxSprintf (buf, wxT("%.6g"), number);
+ return buf;
}
wxChar *wxPropertyValidator::DoubleToString (double number) {
- static wxChar buf[20];
- wxSprintf (buf, wxT("%.6g"), number);
- return buf;
+ static wxChar buf[20];
+ wxSprintf (buf, wxT("%.6g"), number);
+ return buf;
}
wxChar *wxPropertyValidator::IntToString (int number) {
- return ::IntToString (number);
+ return ::IntToString (number);
}
wxChar *wxPropertyValidator::LongToString (long number) {
- return ::LongToString (number);
+ return ::LongToString (number);
}
+
+#endif // wxUSE_PROPSHEET
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma hdrstop
#endif
+#if wxUSE_PROPSHEET
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView)
BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView)
-EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk)
-EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel)
-EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp)
-EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert)
-EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
+EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk)
+EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel)
+EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp)
+EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert)
+EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
END_EVENT_TABLE()
bool wxPropertyFormView::sm_dialogCancelled = FALSE;
{
m_propertyWindow = propPanel;
m_managedWindow = NULL;
-
+
m_windowCloseButton = NULL;
m_windowCancelButton = NULL;
m_windowHelpButton = NULL;
-
+
m_detailedEditing = FALSE;
}
void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
{
m_propertySheet = ps;
-
+
AssociatePanel(panel);
// CreateControls();
// UpdatePropertyList();
{
if (!m_propertySheet)
return FALSE;
-
+
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
{
if (!m_propertySheet)
return FALSE;
-
+
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
{
if (!m_propertySheet)
return FALSE;
-
+
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
{
if (!m_propertySheet || !m_propertyWindow)
return FALSE;
-
+
wxNode *node = m_propertyWindow->GetChildren().First();
while (node)
{
// Retrieve the value if any
if (!Check())
return;
-
+
sm_dialogCancelled = FALSE;
TransferToPropertySheet();
-
+
m_managedWindow->Close(TRUE);
}
void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
{
sm_dialogCancelled = TRUE;
-
+
m_managedWindow->Close(TRUE);
}
{
if (!m_propertySheet)
return;
-
+
if (win.GetName() == wxT(""))
return;
-
+
if (wxStrcmp(win.GetName(), wxT("ok")) == 0)
OnOk(event);
else if (wxStrcmp(win.GetName(), wxT("cancel")) == 0)
{
if (!m_propertySheet)
return;
-
+
// Find a validator to route the command to.
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
///
/// Real number form validator
-///
-bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+///
+bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
-
+
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
-
+
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
-
+
float val = 0.0;
if (!StringToFloat(WXSTRINGCAST value, &val))
{
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
-
+
if (val < m_realMin || val > m_realMax)
{
wxChar buf[200];
return TRUE;
}
-bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
-
+
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
-
+
if (value.Length() == 0)
return FALSE;
-
+
float f = (float)wxAtof((const wxChar *)value);
property->GetValue() = f;
return TRUE;
}
-bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
-
+
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(FloatToString(property->GetValue().RealValue()));
return TRUE;
///
/// Integer validator
-///
+///
IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)
-bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
if (m_integerMin == 0.0 && m_integerMax == 0.0)
return TRUE;
-
+
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
-
+
long val = 0;
-
+
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
-
+
if (!StringToLong(WXSTRINGCAST value, &val))
{
wxChar buf[200];
}
else
return FALSE;
-
+
if (val < m_integerMin || val > m_integerMax)
{
char buf[200];
return TRUE;
}
-bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
-
+
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
-
+
if (value.Length() == 0)
return FALSE;
-
+
long i = wxAtol((const wxChar *)value);
property->GetValue() = i;
}
}
else
return FALSE;
-
+
return TRUE;
}
-bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
-
+
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
///
/// Boolean validator
-///
+///
IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator)
-bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
-
+
return TRUE;
}
-bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the boolean: should be a checkbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
-
+
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
-
+
property->GetValue() = (bool)checkBox->GetValue();
return TRUE;
}
-bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
-
+
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
checkBox->SetValue((bool)property->GetValue().BoolValue());
return TRUE;
///
/// String validator
-///
+///
IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)
wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
m_strings = list;
}
-bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow )
{
if (!m_strings)
return TRUE;
-
+
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return TRUE;
}
-bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
return TRUE;
}
-bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
+bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
return TRUE;
}
+#endif // wxUSE_PROPSHEET
#pragma hdrstop
#endif
+#if wxUSE_PROPSHEET
+
#ifndef WX_PRECOMP
#include "wx/window.h"
#include "wx/font.h"
return s_crossBitmap;
}
+#endif // wxUSE_PROPSHEET
#pragma hdrstop
#endif
+#if wxUSE_SASH
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
-#if wxUSE_SASH
-
#include <math.h>
#include <stdlib.h>
// Name: generic/scrolwin.cpp
// Purpose: wxGenericScrolledWindow implementation
// Author: Julian Smart
-// Modified by:
+// Modified by: Vadim Zeitlin on 31.08.00: wxScrollHelper allows to implement
// Created: 01/02/97
// RCS-ID: $Id$
-// Copyright: (c) Julian Smart and Markus Holzem
+// Copyright: (c) wxWindows team
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "wx/utils.h"
#include "wx/dcclient.h"
-#include "wx/generic/scrolwin.h"
+#include "wx/scrolwin.h"
#include "wx/panel.h"
+#include "wx/timer.h"
#ifdef __WXMSW__
- #include "windows.h"
+ #include <windows.h> // for DLGC_WANTARROWS
#endif
#ifdef __WXMOTIF__
#endif
#ifndef __WXGTK__
-#include "wx/scrolwin.h"
IMPLEMENT_CLASS(wxScrolledWindow, wxGenericScrolledWindow)
#endif
// ----------------------------------------------------------------------------
-// event tables
+// wxScrollHelperEvtHandler: intercept the events from the window and forward
+// them to wxScrollHelper
// ----------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(wxGenericScrolledWindow, wxPanel)
- EVT_SCROLLWIN(wxGenericScrolledWindow::OnScroll)
- EVT_SIZE(wxGenericScrolledWindow::OnSize)
- EVT_PAINT(wxGenericScrolledWindow::OnPaint)
- EVT_CHAR(wxGenericScrolledWindow::OnChar)
- EVT_MOUSEWHEEL(wxGenericScrolledWindow::OnMouseWheel)
-END_EVENT_TABLE()
+class wxScrollHelperEvtHandler : public wxEvtHandler
+{
+public:
+ wxScrollHelperEvtHandler(wxScrollHelper *scrollHelper)
+ {
+ m_scrollHelper = scrollHelper;
+ }
-IMPLEMENT_DYNAMIC_CLASS(wxGenericScrolledWindow, wxPanel)
+ virtual bool ProcessEvent(wxEvent& event);
+
+private:
+ wxScrollHelper *m_scrollHelper;
+};
+
+// ----------------------------------------------------------------------------
+// wxAutoScrollTimer: the timer used to generate a stream of scroll events when
+// a captured mouse is held outside the window
+// ----------------------------------------------------------------------------
+
+class wxAutoScrollTimer : public wxTimer
+{
+public:
+ wxAutoScrollTimer(wxWindow *winToScroll, wxScrollHelper *scroll,
+ wxEventType eventTypeToSend,
+ int pos, int orient);
+
+ virtual void Notify();
+
+private:
+ wxWindow *m_win;
+ wxScrollHelper *m_scrollHelper;
+ wxEventType m_eventType;
+ int m_pos,
+ m_orient;
+};
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
-// wxGenericScrolledWindow creation
+// wxAutoScrollTimer
// ----------------------------------------------------------------------------
-wxGenericScrolledWindow::wxGenericScrolledWindow()
+wxAutoScrollTimer::wxAutoScrollTimer(wxWindow *winToScroll,
+ wxScrollHelper *scroll,
+ wxEventType eventTypeToSend,
+ int pos, int orient)
{
- m_xScrollPixelsPerLine = 0;
- m_yScrollPixelsPerLine = 0;
- m_xScrollingEnabled = TRUE;
- m_yScrollingEnabled = TRUE;
- m_xScrollPosition = 0;
- m_yScrollPosition = 0;
- m_xScrollLines = 0;
- m_yScrollLines = 0;
- m_xScrollLinesPerPage = 0;
- m_yScrollLinesPerPage = 0;
- m_scaleX = 1.0;
- m_scaleY = 1.0;
- m_wheelRotation = 0;
- m_targetWindow = (wxWindow*) NULL;
+ m_win = winToScroll;
+ m_scrollHelper = scroll;
+ m_eventType = eventTypeToSend;
+ m_pos = pos;
+ m_orient = orient;
}
-bool wxGenericScrolledWindow::Create(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
- long style,
- const wxString& name)
+void wxAutoScrollTimer::Notify()
{
- m_xScrollPixelsPerLine = 0;
- m_yScrollPixelsPerLine = 0;
- m_xScrollingEnabled = TRUE;
- m_yScrollingEnabled = TRUE;
- m_xScrollPosition = 0;
- m_yScrollPosition = 0;
- m_xScrollLines = 0;
- m_yScrollLines = 0;
- m_xScrollLinesPerPage = 0;
+ // only do all this as long as the window is capturing the mouse
+ if ( wxWindow::GetCapture() != m_win )
+ {
+ Stop();
+ }
+ else // we still capture the mouse, continue generating events
+ {
+ // first scroll the window if we are allowed to do it
+ wxScrollWinEvent event1(m_eventType, m_pos, m_orient);
+ event1.SetEventObject(m_win);
+ if ( m_scrollHelper->SendAutoScrollEvents(event1) &&
+ m_win->GetEventHandler()->ProcessEvent(event1) )
+ {
+ // and then send a pseudo mouse-move event to refresh the selection
+ wxMouseEvent event2(wxEVT_MOTION);
+ wxGetMousePosition(&event2.m_x, &event2.m_y);
+
+ // the mouse event coordinates should be client, not screen as
+ // returned by wxGetMousePosition
+ wxWindow *parentTop = m_win;
+ while ( parentTop->GetParent() )
+ parentTop = parentTop->GetParent();
+ wxPoint ptOrig = parentTop->GetPosition();
+ event2.m_x -= ptOrig.x;
+ event2.m_y -= ptOrig.y;
+
+ event2.SetEventObject(m_win);
+
+ // FIXME: we don't fill in the other members - ok?
+
+ m_win->GetEventHandler()->ProcessEvent(event2);
+ }
+ else // can't scroll further, stop
+ {
+ Stop();
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxScrollHelperEvtHandler
+// ----------------------------------------------------------------------------
+
+bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event)
+{
+ if ( wxEvtHandler::ProcessEvent(event) )
+ return TRUE;
+
+ // reset the skipped flag to FALSE as it might have been set to TRUE in
+ // ProcessEvent() above
+ event.Skip(FALSE);
+
+ switch ( event.GetEventType() )
+ {
+ case wxEVT_SCROLLWIN_TOP:
+ case wxEVT_SCROLLWIN_BOTTOM:
+ case wxEVT_SCROLLWIN_LINEUP:
+ case wxEVT_SCROLLWIN_LINEDOWN:
+ case wxEVT_SCROLLWIN_PAGEUP:
+ case wxEVT_SCROLLWIN_PAGEDOWN:
+ case wxEVT_SCROLLWIN_THUMBTRACK:
+ case wxEVT_SCROLLWIN_THUMBRELEASE:
+ m_scrollHelper->HandleOnScroll((wxScrollWinEvent &)event);
+ return !event.GetSkipped();
+
+ case wxEVT_PAINT:
+ m_scrollHelper->HandleOnPaint((wxPaintEvent &)event);
+ return TRUE;
+
+ case wxEVT_SIZE:
+ m_scrollHelper->HandleOnSize((wxSizeEvent &)event);
+ return FALSE;
+
+ case wxEVT_CHAR:
+ m_scrollHelper->HandleOnChar((wxKeyEvent &)event);
+ return !event.GetSkipped();
+
+ case wxEVT_ENTER_WINDOW:
+ m_scrollHelper->HandleOnMouseEnter((wxMouseEvent &)event);
+ break;
+
+ case wxEVT_LEAVE_WINDOW:
+ m_scrollHelper->HandleOnMouseLeave((wxMouseEvent &)event);
+ break;
+
+ case wxEVT_MOUSEWHEEL:
+ m_scrollHelper->HandleOnMouseWheel((wxMouseEvent &)event);
+ break;
+ }
+
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// wxScrollHelper construction
+// ----------------------------------------------------------------------------
+
+wxScrollHelper::wxScrollHelper(wxWindow *win)
+{
+ m_xScrollPixelsPerLine =
+ m_yScrollPixelsPerLine =
+ m_xScrollPosition =
+ m_yScrollPosition =
+ m_xScrollLines =
+ m_yScrollLines =
+ m_xScrollLinesPerPage =
m_yScrollLinesPerPage = 0;
- m_scaleX = 1.0;
+
+ m_xScrollingEnabled =
+ m_yScrollingEnabled = TRUE;
+
+ m_scaleX =
m_scaleY = 1.0;
m_wheelRotation = 0;
- m_targetWindow = this;
+ m_win =
+ m_targetWindow = (wxWindow *)NULL;
- bool ok = wxPanel::Create(parent, id, pos, size, style, name);
+ m_timerAutoScroll = (wxTimer *)NULL;
-#ifdef __WXMSW__
- // we need to process arrows ourselves for scrolling
- m_lDlgCode |= DLGC_WANTARROWS;
-#endif // __WXMSW__
+ if ( win )
+ SetWindow(win);
+}
- return ok;
+void wxScrollHelper::SetWindow(wxWindow *win)
+{
+ wxCHECK_RET( win, _T("wxScrollHelper needs a window to scroll") );
+
+ m_targetWindow = m_win = win;
+
+ // install the event handler which will intercept the events we're
+ // interested in
+ m_win->PushEventHandler(new wxScrollHelperEvtHandler(this));
}
-wxGenericScrolledWindow::~wxGenericScrolledWindow()
+wxScrollHelper::~wxScrollHelper()
{
+ StopAutoScrolling();
+
+ if ( m_targetWindow )
+ m_targetWindow->PopEventHandler(TRUE /* do delete it */);
}
// ----------------------------------------------------------------------------
// setting scrolling parameters
// ----------------------------------------------------------------------------
-/*
- * pixelsPerUnitX/pixelsPerUnitY: number of pixels per unit (e.g. pixels per text line)
- * noUnitsX/noUnitsY: : no. units per scrollbar
- */
-void wxGenericScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
- int noUnitsX, int noUnitsY,
- int xPos, int yPos, bool noRefresh )
+void wxScrollHelper::SetScrollbars(int pixelsPerUnitX,
+ int pixelsPerUnitY,
+ int noUnitsX,
+ int noUnitsY,
+ int xPos,
+ int yPos,
+ bool noRefresh)
{
int xpos, ypos;
(noUnitsY < m_yScrollLines && ypos > pixelsPerUnitY*noUnitsY) ||
(xPos != m_xScrollPosition) ||
(yPos != m_yScrollPosition)
-// (pixelsPerUnitX != m_xScrollPixelsPerLine) ||
-// (pixelsPerUnitY != m_yScrollPixelsPerLine)
);
m_xScrollPixelsPerLine = pixelsPerUnitX;
// be entirely generic because it relies on the wxWindowDC implementation
// to duplicate X drawing calls for the backing pixmap.
- if ((m_windowStyle & wxRETAINED) == wxRETAINED)
+ if ( m_targetWindow->GetWindowStyle() & wxRETAINED )
{
- Display* dpy = XtDisplay((Widget) GetMainWidget());
+ Display* dpy = XtDisplay((Widget)m_targetWindow->GetMainWidget());
int totalPixelWidth = m_xScrollLines * m_xScrollPixelsPerLine;
int totalPixelHeight = m_yScrollLines * m_yScrollPixelsPerLine;
- if (m_backingPixmap &&
- !((m_pixmapWidth == totalPixelWidth) &&
- (m_pixmapHeight == totalPixelHeight)))
+ if (m_targetWindow->m_backingPixmap &&
+ !((m_targetWindow->m_pixmapWidth == totalPixelWidth) &&
+ (m_targetWindow->m_pixmapHeight == totalPixelHeight)))
{
- XFreePixmap (dpy, (Pixmap) m_backingPixmap);
- m_backingPixmap = (WXPixmap) 0;
+ XFreePixmap (dpy, (Pixmap) m_targetWindow->m_backingPixmap);
+ m_targetWindow->m_backingPixmap = (WXPixmap) 0;
}
- if (!m_backingPixmap &&
+ if (!m_targetWindow->m_backingPixmap &&
(noUnitsX != 0) && (noUnitsY != 0))
{
int depth = wxDisplayDepth();
AdjustScrollbars();
if (do_refresh && !noRefresh)
- m_targetWindow->Refresh();
+ m_targetWindow->Refresh(TRUE, GetRect());
-#ifdef __WXMSW__
- // GRG: if this turns out to be really necessary, we could
- // at least move it to the above if { ... } so that it is
- // only done if noRefresh = FALSE (the default). OTOH, if
- // this doesn't break anything, which seems to be the
- // case, we could just leave it out.
-
- // Necessary?
- // UpdateWindow ((HWND) m_targetWindow->GetHWND());
-#endif
#ifdef __WXMAC__
m_targetWindow->MacUpdateImmediately() ;
#endif
// target window handling
// ----------------------------------------------------------------------------
-void wxGenericScrolledWindow::SetTargetWindow( wxWindow *target )
+void wxScrollHelper::SetTargetWindow( wxWindow *target )
{
wxASSERT_MSG( target, wxT("target window must not be NULL") );
m_targetWindow = target;
}
-wxWindow *wxGenericScrolledWindow::GetTargetWindow()
+wxWindow *wxScrollHelper::GetTargetWindow() const
{
return m_targetWindow;
}
// scrolling implementation itself
// ----------------------------------------------------------------------------
-void wxGenericScrolledWindow::OnScroll(wxScrollWinEvent& event)
+void wxScrollHelper::HandleOnScroll(wxScrollWinEvent& event)
{
- int orient = event.GetOrientation();
-
int nScrollInc = CalcScrollInc(event);
- if (nScrollInc == 0) return;
-
- if (orient == wxHORIZONTAL)
+ if ( nScrollInc == 0 )
{
- int newPos = m_xScrollPosition + nScrollInc;
- SetScrollPos(wxHORIZONTAL, newPos, TRUE );
- }
- else
- {
- int newPos = m_yScrollPosition + nScrollInc;
- SetScrollPos(wxVERTICAL, newPos, TRUE );
+ // can't scroll further
+ event.Skip();
+
+ return;
}
+ int orient = event.GetOrientation();
if (orient == wxHORIZONTAL)
{
m_xScrollPosition += nScrollInc;
+ m_targetWindow->SetScrollPos(wxHORIZONTAL, m_xScrollPosition, FALSE);
}
else
{
m_yScrollPosition += nScrollInc;
+ m_targetWindow->SetScrollPos(wxVERTICAL, m_yScrollPosition, FALSE);
}
+ bool needsRefresh = FALSE;
+ int dx = 0,
+ dy = 0;
if (orient == wxHORIZONTAL)
{
- if (m_xScrollingEnabled)
- m_targetWindow->ScrollWindow(-m_xScrollPixelsPerLine * nScrollInc, 0, (const wxRect *) NULL);
+ if ( m_xScrollingEnabled )
+ {
+ dx = -m_xScrollPixelsPerLine * nScrollInc;
+ }
else
- m_targetWindow->Refresh();
+ {
+ needsRefresh = TRUE;
+ }
}
else
{
- if (m_yScrollingEnabled)
- m_targetWindow->ScrollWindow(0, -m_yScrollPixelsPerLine * nScrollInc, (const wxRect *) NULL);
+ if ( m_yScrollingEnabled )
+ {
+ dy = -m_yScrollPixelsPerLine * nScrollInc;
+ }
else
- m_targetWindow->Refresh();
+ {
+ needsRefresh = TRUE;
+ }
+ }
+
+ if ( needsRefresh )
+ {
+ m_targetWindow->Refresh(TRUE, GetRect());
+ }
+ else
+ {
+ m_targetWindow->ScrollWindow(dx, dy, GetRect());
}
+
#ifdef __WXMAC__
m_targetWindow->MacUpdateImmediately() ;
#endif
}
-int wxGenericScrolledWindow::CalcScrollInc(wxScrollWinEvent& event)
+int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event)
{
int pos = event.GetPosition();
int orient = event.GetOrientation();
if (m_xScrollPixelsPerLine > 0)
{
int w, h;
- m_targetWindow->GetClientSize(&w, &h);
+ GetTargetSize(&w, &h);
int nMaxWidth = m_xScrollLines*m_xScrollPixelsPerLine;
int noPositions = (int) ( ((nMaxWidth - w)/(double)m_xScrollPixelsPerLine) + 0.5 );
nScrollInc = noPositions - m_xScrollPosition; // As +ve as we can go
}
else
- m_targetWindow->Refresh();
+ m_targetWindow->Refresh(TRUE, GetRect());
}
else
{
if (m_yScrollPixelsPerLine > 0)
{
int w, h;
- m_targetWindow->GetClientSize(&w, &h);
+ GetTargetSize(&w, &h);
int nMaxHeight = m_yScrollLines*m_yScrollPixelsPerLine;
int noPositions = (int) ( ((nMaxHeight - h)/(double)m_yScrollPixelsPerLine) + 0.5 );
nScrollInc = noPositions - m_yScrollPosition; // As +ve as we can go
}
else
- m_targetWindow->Refresh();
+ m_targetWindow->Refresh(TRUE, GetRect());
}
return nScrollInc;
}
// Adjust the scrollbars - new version.
-void wxGenericScrolledWindow::AdjustScrollbars()
+void wxScrollHelper::AdjustScrollbars()
{
#ifdef __WXMAC__
m_targetWindow->MacUpdateImmediately();
#endif
int w, h;
- m_targetWindow->GetClientSize(&w, &h);
+ GetTargetSize(&w, &h);
int oldXScroll = m_xScrollPosition;
int oldYScroll = m_yScrollPosition;
// current client window
int noPagePositions = (int) ( (w/(double)m_xScrollPixelsPerLine) + 0.5 );
if (noPagePositions < 1) noPagePositions = 1;
+ if ( noPagePositions > m_xScrollLines )
+ noPagePositions = m_xScrollLines;
// Correct position if greater than extent of canvas minus
// the visible portion of it or if below zero
m_xScrollPosition = wxMin( m_xScrollLines-noPagePositions, m_xScrollPosition);
m_xScrollPosition = wxMax( 0, m_xScrollPosition );
- SetScrollbar(wxHORIZONTAL, m_xScrollPosition, noPagePositions, m_xScrollLines);
+ m_targetWindow->SetScrollbar(wxHORIZONTAL, m_xScrollPosition, noPagePositions, m_xScrollLines);
// The amount by which we scroll when paging
SetScrollPageSize(wxHORIZONTAL, noPagePositions);
}
else
{
m_xScrollPosition = 0;
- SetScrollbar (wxHORIZONTAL, 0, 0, 0, FALSE);
+ m_targetWindow->SetScrollbar (wxHORIZONTAL, 0, 0, 0, FALSE);
}
if (m_yScrollLines > 0)
// current client window
int noPagePositions = (int) ( (h/(double)m_yScrollPixelsPerLine) + 0.5 );
if (noPagePositions < 1) noPagePositions = 1;
+ if ( noPagePositions > m_yScrollLines )
+ noPagePositions = m_yScrollLines;
// Correct position if greater than extent of canvas minus
// the visible portion of it or if below zero
m_yScrollPosition = wxMin( m_yScrollLines-noPagePositions, m_yScrollPosition );
m_yScrollPosition = wxMax( 0, m_yScrollPosition );
- SetScrollbar(wxVERTICAL, m_yScrollPosition, noPagePositions, m_yScrollLines);
+ m_targetWindow->SetScrollbar(wxVERTICAL, m_yScrollPosition, noPagePositions, m_yScrollLines);
// The amount by which we scroll when paging
SetScrollPageSize(wxVERTICAL, noPagePositions);
}
else
{
m_yScrollPosition = 0;
- SetScrollbar (wxVERTICAL, 0, 0, 0, FALSE);
+ m_targetWindow->SetScrollbar (wxVERTICAL, 0, 0, 0, FALSE);
}
if (oldXScroll != m_xScrollPosition)
{
if (m_xScrollingEnabled)
- m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll-m_xScrollPosition), 0, (const wxRect *) NULL );
+ m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll-m_xScrollPosition), 0,
+ GetRect() );
else
- m_targetWindow->Refresh();
+ m_targetWindow->Refresh(TRUE, GetRect());
}
if (oldYScroll != m_yScrollPosition)
{
if (m_yScrollingEnabled)
- m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition), (const wxRect *) NULL );
+ m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition),
+ GetRect() );
else
- m_targetWindow->Refresh();
+ m_targetWindow->Refresh(TRUE, GetRect());
}
#ifdef __WXMAC__
#endif
}
-// Override this function if you don't want to have wxGenericScrolledWindow
-// automatically change the origin according to the scroll position.
-void wxGenericScrolledWindow::PrepareDC(wxDC& dc)
+void wxScrollHelper::DoPrepareDC(wxDC& dc)
{
- dc.SetDeviceOrigin( -m_xScrollPosition * m_xScrollPixelsPerLine,
- -m_yScrollPosition * m_yScrollPixelsPerLine );
+ wxPoint pt = dc.GetDeviceOrigin();
+ dc.SetDeviceOrigin( pt.x - m_xScrollPosition * m_xScrollPixelsPerLine,
+ pt.y - m_yScrollPosition * m_yScrollPixelsPerLine );
dc.SetUserScale( m_scaleX, m_scaleY );
}
-#if WXWIN_COMPATIBILITY
-void wxGenericScrolledWindow::GetScrollUnitsPerPage (int *x_page, int *y_page) const
-{
- *x_page = GetScrollPageSize(wxHORIZONTAL);
- *y_page = GetScrollPageSize(wxVERTICAL);
-}
-
-void wxGenericScrolledWindow::CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const
-{
- if ( xx )
- *xx = (float)(x + m_xScrollPosition * m_xScrollPixelsPerLine);
- if ( yy )
- *yy = (float)(y + m_yScrollPosition * m_yScrollPixelsPerLine);
-}
-#endif // WXWIN_COMPATIBILITY
-
-void wxGenericScrolledWindow::GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const
+void wxScrollHelper::GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const
{
if ( x_unit )
*x_unit = m_xScrollPixelsPerLine;
*y_unit = m_yScrollPixelsPerLine;
}
-int wxGenericScrolledWindow::GetScrollPageSize(int orient) const
+int wxScrollHelper::GetScrollPageSize(int orient) const
{
if ( orient == wxHORIZONTAL )
return m_xScrollLinesPerPage;
return m_yScrollLinesPerPage;
}
-void wxGenericScrolledWindow::SetScrollPageSize(int orient, int pageSize)
+void wxScrollHelper::SetScrollPageSize(int orient, int pageSize)
{
if ( orient == wxHORIZONTAL )
m_xScrollLinesPerPage = pageSize;
/*
* Scroll to given position (scroll position, not pixel position)
*/
-void wxGenericScrolledWindow::Scroll( int x_pos, int y_pos )
+void wxScrollHelper::Scroll( int x_pos, int y_pos )
{
if (!m_targetWindow)
return;
#endif
int w, h;
- m_targetWindow->GetClientSize(&w, &h);
+ GetTargetSize(&w, &h);
if ((x_pos != -1) && (m_xScrollPixelsPerLine))
{
m_xScrollPosition = wxMax( 0, m_xScrollPosition );
if (old_x != m_xScrollPosition) {
- m_targetWindow->SetScrollPos( wxHORIZONTAL, m_xScrollPosition, TRUE );
- m_targetWindow->ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0 );
+ m_targetWindow->SetScrollPos( wxHORIZONTAL, m_xScrollPosition, FALSE );
+ m_targetWindow->ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0,
+ GetRect() );
}
}
if ((y_pos != -1) && (m_yScrollPixelsPerLine))
m_yScrollPosition = wxMax( 0, m_yScrollPosition );
if (old_y != m_yScrollPosition) {
- m_targetWindow->SetScrollPos( wxVERTICAL, m_yScrollPosition, TRUE );
- m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine );
+ m_targetWindow->SetScrollPos( wxVERTICAL, m_yScrollPosition, FALSE );
+ m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine,
+ GetRect() );
}
}
}
-void wxGenericScrolledWindow::EnableScrolling (bool x_scroll, bool y_scroll)
+void wxScrollHelper::EnableScrolling (bool x_scroll, bool y_scroll)
{
m_xScrollingEnabled = x_scroll;
m_yScrollingEnabled = y_scroll;
}
-void wxGenericScrolledWindow::GetVirtualSize (int *x, int *y) const
+void wxScrollHelper::GetVirtualSize (int *x, int *y) const
{
if ( x )
*x = m_xScrollPixelsPerLine * m_xScrollLines;
}
// Where the current view starts from
-void wxGenericScrolledWindow::GetViewStart (int *x, int *y) const
+void wxScrollHelper::GetViewStart (int *x, int *y) const
{
if ( x )
*x = m_xScrollPosition;
*y = m_yScrollPosition;
}
-void wxGenericScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
+void wxScrollHelper::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x - m_xScrollPosition * m_xScrollPixelsPerLine;
*yy = y - m_yScrollPosition * m_yScrollPixelsPerLine;
}
-void wxGenericScrolledWindow::CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
+void wxScrollHelper::CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x + m_xScrollPosition * m_xScrollPixelsPerLine;
// ----------------------------------------------------------------------------
// Default OnSize resets scrollbars, if any
-void wxGenericScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event))
+void wxScrollHelper::HandleOnSize(wxSizeEvent& WXUNUSED(event))
{
#if wxUSE_CONSTRAINTS
- if (GetAutoLayout())
- Layout();
+ if ( m_targetWindow->GetAutoLayout() )
+ m_targetWindow->Layout();
#endif
AdjustScrollbars();
// This calls OnDraw, having adjusted the origin according to the current
// scroll position
-void wxGenericScrolledWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
+void wxScrollHelper::HandleOnPaint(wxPaintEvent& WXUNUSED(event))
{
- wxPaintDC dc(this);
- PrepareDC(dc);
+ wxPaintDC dc(m_targetWindow);
+ DoPrepareDC(dc);
OnDraw(dc);
}
// compatibility here - if we used OnKeyDown(), the programs which process
// arrows themselves in their OnChar() would never get the message and like
// this they always have the priority
-void wxGenericScrolledWindow::OnChar(wxKeyEvent& event)
+void wxScrollHelper::HandleOnChar(wxKeyEvent& event)
{
int stx, sty, // view origin
szx, szy, // view size (total)
clix, cliy; // view size (on screen)
- ViewStart(&stx, &sty);
- GetClientSize(&clix, &cliy);
+ GetViewStart(&stx, &sty);
+ GetTargetSize(&clix, &cliy);
GetVirtualSize(&szx, &szy);
if( m_xScrollPixelsPerLine )
}
}
+// ----------------------------------------------------------------------------
+// autoscroll stuff: these functions deal with sending fake scroll events when
+// a captured mouse is being held outside the window
+// ----------------------------------------------------------------------------
+
+bool wxScrollHelper::SendAutoScrollEvents(wxScrollWinEvent& event) const
+{
+ // only send the event if the window is scrollable in this direction
+ wxWindow *win = (wxWindow *)event.GetEventObject();
+ return win->HasScrollbar(event.GetOrientation());
+}
+
+void wxScrollHelper::StopAutoScrolling()
+{
+ if ( m_timerAutoScroll )
+ {
+ delete m_timerAutoScroll;
+ m_timerAutoScroll = (wxTimer *)NULL;
+ }
+}
-void wxGenericScrolledWindow::OnMouseWheel(wxMouseEvent& event)
+void wxScrollHelper::HandleOnMouseEnter(wxMouseEvent& event)
{
- int lines;
- int vsx, vsy;
+ StopAutoScrolling();
+
+ event.Skip();
+}
+void wxScrollHelper::HandleOnMouseLeave(wxMouseEvent& event)
+{
+ // don't prevent the usual processing of the event from taking place
+ event.Skip();
+
+ // when a captured mouse leave a scrolled window we start generate
+ // scrolling events to allow, for example, extending selection beyond the
+ // visible area in some controls
+ if ( wxWindow::GetCapture() == m_targetWindow )
+ {
+ // where is the mouse leaving?
+ int pos, orient;
+ wxPoint pt = event.GetPosition();
+ if ( pt.x < 0 )
+ {
+ orient = wxHORIZONTAL;
+ pos = 0;
+ }
+ else if ( pt.y < 0 )
+ {
+ orient = wxVERTICAL;
+ pos = 0;
+ }
+ else // we're lower or to the right of the window
+ {
+ wxSize size = m_targetWindow->GetClientSize();
+ if ( pt.x > size.x )
+ {
+ orient = wxHORIZONTAL;
+ pos = m_xScrollLines;
+ }
+ else if ( pt.y > size.y )
+ {
+ orient = wxVERTICAL;
+ pos = m_yScrollLines;
+ }
+ else // this should be impossible
+ {
+ // but seems to happen sometimes under wxMSW - maybe it's a bug
+ // there but for now just ignore it
+
+ //wxFAIL_MSG( _T("can't understand where has mouse gone") );
+
+ return;
+ }
+ }
+
+ // only start the auto scroll timer if the window can be scrolled in
+ // this direction
+ if ( !m_targetWindow->HasScrollbar(orient) )
+ return;
+
+ delete m_timerAutoScroll;
+ m_timerAutoScroll = new wxAutoScrollTimer
+ (
+ m_targetWindow, this,
+ pos == 0 ? wxEVT_SCROLLWIN_LINEUP
+ : wxEVT_SCROLLWIN_LINEDOWN,
+ pos,
+ orient
+ );
+ m_timerAutoScroll->Start(50); // FIXME: make configurable
+ }
+}
+
+void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
+{
m_wheelRotation += event.GetWheelRotation();
- lines = m_wheelRotation / event.GetWheelDelta();
+ int lines = m_wheelRotation / event.GetWheelDelta();
m_wheelRotation -= lines * event.GetWheelDelta();
- if (lines != 0) {
+ if (lines != 0)
+ {
lines *= event.GetLinesPerAction();
+
+ int vsx, vsy;
GetViewStart(&vsx, &vsy);
Scroll(-1, vsy - lines);
}
}
+// ----------------------------------------------------------------------------
+// wxGenericScrolledWindow implementation
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxGenericScrolledWindow, wxPanel)
+
+bool wxGenericScrolledWindow::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+{
+ m_targetWindow = this;
+
+ bool ok = wxPanel::Create(parent, id, pos, size, style, name);
+
+#ifdef __WXMSW__
+ // we need to process arrows ourselves for scrolling
+ m_lDlgCode |= DLGC_WANTARROWS;
+#endif // __WXMSW__
+
+ return ok;
+}
+
+wxGenericScrolledWindow::~wxGenericScrolledWindow()
+{
+}
+#if WXWIN_COMPATIBILITY
+void wxGenericScrolledWindow::GetScrollUnitsPerPage (int *x_page, int *y_page) const
+{
+ *x_page = GetScrollPageSize(wxHORIZONTAL);
+ *y_page = GetScrollPageSize(wxVERTICAL);
+}
+void wxGenericScrolledWindow::CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const
+{
+ if ( xx )
+ *xx = (float)(x + m_xScrollPosition * m_xScrollPixelsPerLine);
+ if ( yy )
+ *yy = (float)(y + m_yScrollPosition * m_yScrollPixelsPerLine);
+}
+#endif // WXWIN_COMPATIBILITY
#pragma hdrstop
#endif
+#if wxUSE_SPLASH
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
GetParent()->Close(TRUE);
}
+#endif // wxUSE_SPLASH
#pragma hdrstop
#endif
-//#if !defined(__WIN32__) || !wxUSE_NATIVE_STATUSBAR
+#if wxUSE_STATUSBAR
#ifndef WX_PRECOMP
#include "wx/setup.h"
}
}
-//#endif // Win32 && wxUSE_NATIVE_STATUSBAR
+#endif // wxUSE_STATUSBAR
#pragma hdrstop
#endif
+#if wxUSE_TAB_DIALOG
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
newWindow->Refresh();
}
+#endif // wxUSE_TAB_DIALOG
#pragma hdrstop
#endif
+#if wxUSE_TEXTDLG
+
#ifndef WX_PRECOMP
#include <stdio.h>
EndModal(wxID_OK);
}
+
+#endif // wxUSE_TEXTDLG
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_TREECTRL
+
#include "wx/generic/treectlg.h"
#include "wx/imaglist.h"
#include "wx/settings.h"
int start_x = 0;
int start_y = 0;
- ViewStart( &start_x, &start_y );
+ GetViewStart( &start_x, &start_y );
start_y *= PIXELS_PER_UNIT;
int client_h = 0;
Refresh( TRUE, &rect );
}
+#endif // wxUSE_TREECTRL
#endif
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#if wxUSE_TREELAYOUT
#pragma hdrstop
#endif
+#if wxUSE_WIZARDDLG
+
#ifndef WX_PRECOMP
#include "wx/dynarray.h"
#include "wx/intl.h"
m_direction = direction;
}
+#endif // wxUSE_WIZARDDLG
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Name: accel.cpp
-// Purpose:
-// Author: Robert Roebling
-// Id: $id:$
-// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation "accel.h"
-#endif
-
-#include "wx/accel.h"
-
-#if wxUSE_ACCEL
-
-#include <ctype.h>
-
-//-----------------------------------------------------------------------------
-// wxAcceleratorTable
-//-----------------------------------------------------------------------------
-
-class wxAccelRefData: public wxObjectRefData
-{
-public:
- wxAccelRefData();
-
- wxList m_accels;
-};
-
-wxAccelRefData::wxAccelRefData()
-{
- m_accels.DeleteContents( TRUE );
-}
-
-//-----------------------------------------------------------------------------
-
-#define M_ACCELDATA ((wxAccelRefData *)m_refData)
-
-IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable,wxObject)
-
-wxAcceleratorTable::wxAcceleratorTable()
-{
-}
-
-wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] )
-{
- m_refData = new wxAccelRefData();
-
- for (int i = 0; i < n; i++)
- {
- int flag = entries[i].GetFlags();
- int keycode = entries[i].GetKeyCode();
- int command = entries[i].GetCommand();
- if ((keycode >= (int)'a') && (keycode <= (int)'z')) keycode = (int)toupper( (char)keycode );
- M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) );
- }
-}
-
-wxAcceleratorTable::~wxAcceleratorTable()
-{
-}
-
-bool wxAcceleratorTable::Ok() const
-{
- return (m_refData != NULL);
-}
-
-int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
-{
- if (!Ok()) return -1;
-
- wxNode *node = M_ACCELDATA->m_accels.First();
- while (node)
- {
- wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
- if ((event.m_keyCode == entry->GetKeyCode()) &&
- (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
- (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
- (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown()))
- {
- return entry->GetCommand();
- }
- node = node->Next();
- }
-
- return -1;
-}
-
-#endif
wxApp::wxApp()
{
- wxTheApp = this;
-
- m_topWindow = (wxWindow *) NULL;
- m_exitOnFrameDelete = TRUE;
-
m_idleTag = 0;
wxapp_install_idle_handler();
#endif
m_colorCube = (unsigned char*) NULL;
-
- m_useBestVisual = FALSE;
}
wxApp::~wxApp()
bool wxApp::OnInitGui()
{
+ if ( !wxAppBase::OnInitGui() )
+ return FALSE;
+
GdkVisual *visual = gdk_visual_get_system();
/* on some machines, the default visual is just 256 colours, so
return TRUE;
}
-
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
{
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
#pragma implementation "bmpbuttn.h"
#endif
-#include "wx/bmpbuttn.h"
+#include "wx/defs.h"
#if wxUSE_BMPBUTTON
+#include "wx/bmpbuttn.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
m_needParent = TRUE;
m_acceptsFocus = TRUE;
- m_marginX =
- m_marginY = 0;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
return FALSE;
}
- m_bitmap = bitmap;
- m_disabled = bitmap;
- m_focus = bitmap;
- m_selected = bitmap;
+ m_bmpNormal =
+ m_bmpDisabled =
+ m_bmpFocus =
+ m_bmpSelected = bitmap;
m_widget = gtk_button_new();
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
#endif
- if (m_bitmap.Ok())
+ if (m_bmpNormal.Ok())
{
wxSize newSize = size;
int border = (style & wxNO_BORDER) ? 4 : 10;
void wxBitmapButton::SetBitmap()
{
- wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
+ wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );
wxBitmap the_one;
if (!m_isEnabled)
else if (m_hasFocus)
the_one = m_focus;
else
- the_one = m_bitmap;
+ {
+ if (m_isSelected)
+ {
+ the_one = m_bmpSelected;
+ }
+ else
+ {
+ if (m_hasFocus)
+ the_one = m_bmpFocus;
+ else
+ the_one = m_bmpNormal;
+ }
+ }
- if (!the_one.Ok()) the_one = m_bitmap;
+ if (!the_one.Ok()) the_one = m_bmpNormal;
if (!the_one.Ok()) return;
GdkBitmap *mask = (GdkBitmap *) NULL;
#pragma implementation "button.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_BUTTON
+
#include "wx/button.h"
#include <gdk/gdk.h>
return ret;
}
+#endif // wxUSE_BUTTON
+
#pragma implementation "checkbox.h"
#endif
-#include "wx/checkbox.h"
+#include "wx/defs.h"
#if wxUSE_CHECKBOX
+#include "wx/checkbox.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#pragma implementation "checklst.h"
#endif
-#include "wx/checklst.h"
+#include "wx/defs.h"
#if wxUSE_CHECKLISTBOX
+#include "wx/checklst.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#pragma implementation "choice.h"
#endif
-#include "wx/choice.h"
+#include "wx/defs.h"
#if wxUSE_CHOICE
+#include "wx/choice.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#pragma implementation "control.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_CONTROLS
+
#include "wx/control.h"
#include <gtk/gtk.h>
return wxSize(req.width, req.height);
}
+#endif // wxUSE_CONTROLS
+
#include "gdk/gdkprivate.h"
-void gdk_wx_draw_bitmap (GdkDrawable *drawable,
- GdkGC *gc,
- GdkDrawable *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
+void gdk_wx_draw_bitmap(GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkDrawable *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
{
gint src_width, src_height;
#ifndef __WXGTK20__
}
}
-bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc,
- int logical_func, bool useMask )
+bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
+ wxCoord width, wxCoord height,
+ wxDC *source,
+ wxCoord xsrc, wxCoord ysrc,
+ int logical_func,
+ bool useMask )
{
/* this is the nth try to get this utterly useless function to
work. it now completely ignores the scaling or translation
if (!m_window) return FALSE;
+#if 0
+ // transform the source DC coords to the device ones
+ xsrc = XLOG2DEV(xsrc);
+ ysrc = YLOG2DEV(ysrc);
+#endif
+
wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source;
GdkRegion *region = m_paintClippingRegion.GetRegion();
if ( region )
{
- m_currentClippingRegion.Union( m_paintClippingRegion );
+ m_paintClippingRegion = win->GetUpdateRegion();
+ GdkRegion *region = m_paintClippingRegion.GetRegion();
+ if ( region )
+ {
+ m_currentClippingRegion.Union( m_paintClippingRegion );
- gdk_gc_set_clip_region( m_penGC, region );
- gdk_gc_set_clip_region( m_brushGC, region );
- gdk_gc_set_clip_region( m_textGC, region );
- gdk_gc_set_clip_region( m_bgGC, region );
+ gdk_gc_set_clip_region( m_penGC, region );
+ gdk_gc_set_clip_region( m_brushGC, region );
+ gdk_gc_set_clip_region( m_textGC, region );
+ gdk_gc_set_clip_region( m_bgGC, region );
+ }
}
-#endif
+#endif // USE_PAINT_REGION
}
//-----------------------------------------------------------------------------
wxClientDC::wxClientDC( wxWindow *win )
: wxWindowDC( win )
{
-}
-
-void wxClientDC::DoGetSize(int *width, int *height) const
-{
- wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );
-
- m_owner->GetClientSize( width, height );
+#ifdef __WXUNIVERSAL__
+ wxPoint ptOrigin = win->GetClientAreaOrigin();
+ SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
+ wxSize size = win->GetClientSize();
+ SetClippingRegion(wxPoint(0, 0), size);
+#endif // __WXUNIVERSAL__
}
// ----------------------------------------------------------------------------
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
+ generic/accel.cpp \
generic/busyinfo.cpp \
generic/calctrl.cpp \
generic/caret.cpp \
common/choiccmn.cpp \
common/clipcmn.cpp \
common/cmdline.cpp \
+ common/cmdproc.cpp \
common/cmndata.cpp \
common/config.cpp \
common/cshelp.cpp \
common/xpmdecod.cpp \
common/zipstrm.cpp \
common/zstream.cpp \
- gtk/accel.cpp \
gtk/app.cpp \
gtk/bitmap.cpp \
gtk/bmpbuttn.cpp \
choice.h \
clipbrd.h \
cmdline.h \
+ cmdproc.h \
cmndata.h \
colordlg.h \
colour.h \
choiccmn.o \
clipcmn.o \
cmdline.o \
+ cmdproc.o \
cmndata.o \
config.o \
cshelp.o \
choiccmn.d \
clipcmn.d \
cmdline.d \
+ cmdproc.d \
cmndata.d \
config.d \
cshelp.d \
zstream.d
GENERICOBJS = \
+ accel.o \
busyinfo.o \
calctrl.o \
caret.o \
wizard.o
GENERICDEPS = \
+ accel.d \
busyinfo.d \
calctrl.d \
caret.d \
wizard.d
GUIOBJS = \
- accel.o \
app.o \
bitmap.o \
bmpbuttn.o \
window.o
GUIDEPS = \
- accel.d \
app.d \
bitmap.d \
bmpbuttn.d \
win_gtk.d \
window.d
+GUI_LOWLEVEL_OBJS = \
+ app.o \
+ bitmap.o \
+ brush.o \
+ clipbrd.o \
+ colour.o \
+ cursor.o \
+ data.o \
+ dataobj.o \
+ dc.o \
+ dcclient.o \
+ dcmemory.o \
+ dcscreen.o \
+ dialog.o \
+ font.o \
+ frame.o \
+ gdiobj.o \
+ icon.o \
+ main.o \
+ pen.o \
+ region.o \
+ settings.o \
+ timer.o \
+ utilsgtk.o \
+ win_gtk.o \
+ window.o
+
+GUI_LOWLEVEL_DEPS = \
+ app.d \
+ bitmap.d \
+ brush.d \
+ clipbrd.d \
+ colour.d \
+ cursor.d \
+ data.d \
+ dataobj.d \
+ dc.d \
+ dcclient.d \
+ dcmemory.d \
+ dcscreen.d \
+ dialog.d \
+ font.d \
+ frame.d \
+ gdiobj.d \
+ icon.d \
+ main.d \
+ pen.d \
+ region.d \
+ settings.d \
+ timer.d \
+ utilsgtk.d \
+ win_gtk.d \
+ window.d
+
UNIXOBJS = \
dialup.o \
dir.o \
/////////////////////////////////////////////////////////////////////////////
-// Name: fontdlg.cpp
+// Name: gtk/fontdlg.cpp
// Purpose: wxFontDialog
// Author: Robert Roebling
// Id: $Id$
#pragma implementation "fontdlg.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_FONTDLG
+
#include "wx/fontutil.h"
#include "wx/fontdlg.h"
#include "wx/utils.h"
{
}
+#endif // wxUSE_FONTDLG
+
// event tables
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
+#ifdef __WXUNIVERSAL__
+ IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow)
+#else
+ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
+#endif
// ----------------------------------------------------------------------------
// data
// "size_allocate"
//-----------------------------------------------------------------------------
-static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
+static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
// "delete_event"
//-----------------------------------------------------------------------------
-static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
+static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
return TRUE;
}
+#if wxUSE_MENUS
//-----------------------------------------------------------------------------
// "child_attached" of menu bar
//-----------------------------------------------------------------------------
-static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
// "child_detached" of menu bar
//-----------------------------------------------------------------------------
-static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
win->m_menuBarDetached = TRUE;
win->GtkUpdateSize();
}
+#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
//-----------------------------------------------------------------------------
// "child_attached" of tool bar
//-----------------------------------------------------------------------------
-static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
// "child_detached" of tool bar
//-----------------------------------------------------------------------------
-static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
static gint
#if (GTK_MINOR_VERSION > 0)
-gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrame *win )
+gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrameGTK *win )
#else
-gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
+gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrameGTK *win )
#endif
{
if (g_isIdle)
so we do this directly after realization */
static void
-gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrame *win )
+gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
}
// ----------------------------------------------------------------------------
-// wxFrame itself
+// wxFrameGTK itself
// ----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// InsertChild for wxFrame
+// InsertChild for wxFrameGTK
//-----------------------------------------------------------------------------
-/* Callback for wxFrame. This very strange beast has to be used because
+/* Callback for wxFrameGTK. This very strange beast has to be used because
* C++ has no virtual methods in a constructor. We have to emulate a
* virtual function here as wxWindows requires different ways to insert
* a child in container classes. */
-static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
+static void wxInsertChildInFrame( wxFrameGTK* parent, wxWindow* child )
{
wxASSERT( GTK_IS_WIDGET(child->m_widget) );
if (!parent->m_insertInClientArea)
{
/* these are outside the client area */
- wxFrame* frame = (wxFrame*) parent;
+ wxFrameGTK* frame = (wxFrameGTK*) parent;
gtk_pizza_put( GTK_PIZZA(frame->m_mainWidget),
GTK_WIDGET(child->m_widget),
child->m_x,
}
// ----------------------------------------------------------------------------
-// wxFrame creation
+// wxFrameGTK creation
// ----------------------------------------------------------------------------
-void wxFrame::Init()
+void wxFrameGTK::Init()
{
m_sizeSet = FALSE;
m_miniEdge = 0;
m_themeEnabled = TRUE;
}
-bool wxFrame::Create( wxWindow *parent,
+bool wxFrameGTK::Create( wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
- wxFAIL_MSG( wxT("wxFrame creation failed") );
+ wxFAIL_MSG( wxT("wxFrameGTK creation failed") );
return FALSE;
}
gtk_window_set_wmclass( GTK_WINDOW(m_widget), name.mb_str(), name.mb_str() );
#ifdef __WXDEBUG__
- debug_focus_in( m_widget, wxT("wxFrame::m_widget"), name );
+ debug_focus_in( m_widget, wxT("wxFrameGTK::m_widget"), name );
#endif
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
#ifdef __WXDEBUG__
- debug_focus_in( m_mainWidget, wxT("wxFrame::m_mainWidget"), name );
+ debug_focus_in( m_mainWidget, wxT("wxFrameGTK::m_mainWidget"), name );
#endif
/* m_wxwindow only represents the client area without toolbar and menubar */
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
#ifdef __WXDEBUG__
- debug_focus_in( m_wxwindow, wxT("wxFrame::m_wxwindow"), name );
+ debug_focus_in( m_wxwindow, wxT("wxFrameGTK::m_wxwindow"), name );
#endif
/* we donm't allow the frame to get the focus as otherwise
return TRUE;
}
-wxFrame::~wxFrame()
+wxFrameGTK::~wxFrameGTK()
{
m_isBeingDeleted = TRUE;
// overridden wxWindow methods
// ----------------------------------------------------------------------------
-bool wxFrame::Show( bool show )
+bool wxFrameGTK::Show( bool show )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
return wxWindow::Show( show );
}
-void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
+void wxFrameGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
{
- wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") );
+ wxFAIL_MSG( wxT("DoMoveWindow called for wxFrameGTK") );
}
-void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
+void wxFrameGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
- /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
+ /* this shouldn't happen: wxFrameGTK, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
/* avoid recursions */
m_resizing = FALSE;
}
-void wxFrame::DoGetClientSize( int *width, int *height ) const
+void wxFrameGTK::DoGetClientSize( int *width, int *height ) const
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxWindow::DoGetClientSize( width, height );
if (height)
{
+#if wxUSE_MENUS
/* menu bar */
if (m_frameMenuBar)
{
else
(*height) -= wxPLACE_HOLDER;
}
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
/* status bar */
}
}
-void wxFrame::DoSetClientSize( int width, int height )
+void wxFrameGTK::DoSetClientSize( int width, int height )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
+#if wxUSE_MENUS
/* menu bar */
if (m_frameMenuBar)
{
else
height += wxPLACE_HOLDER;
}
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
/* status bar */
DoSetSize( -1, -1, width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0 );
}
-void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
+void wxFrameGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
int width, int height )
{
// due to a bug in gtk, x,y are always 0
if (m_resizing) return;
m_resizing = TRUE;
- /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
+ /* this shouldn't happen: wxFrameGTK, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
m_width = width;
int client_area_x_offset = 0,
client_area_y_offset = 0;
- /* wxMDIChildFrame derives from wxFrame but it _is_ a wxWindow as it uses
+ /* wxMDIChildFrame derives from wxFrameGTK but it _is_ a wxWindow as it uses
wxWindow::Create to create it's GTK equivalent. m_mainWidget is only
- set in wxFrame::Create so it is used to check what kind of frame we
+ set in wxFrameGTK::Create so it is used to check what kind of frame we
have here. if m_mainWidget is NULL it is a wxMDIChildFrame and so we
skip the part which handles m_frameMenuBar, m_frameToolBar and (most
importantly) m_mainWidget */
* this hurts in the eye, but I don't want to call SetSize()
* because I don't want to call any non-native functions here. */
+#if wxUSE_MENUS
if (m_frameMenuBar)
{
int xx = m_miniEdge;
xx, yy, ww, hh );
client_area_y_offset += hh;
}
+#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
if ((m_frameToolBar) && m_frameToolBar->IsShown() &&
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
+#if wxUSE_MENUS
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
else
yy += wxPLACE_HOLDER;
}
+#endif // wxUSE_MENUS
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
xx, yy, ww, hh );
gtk_widget_draw( m_frameStatusBar->m_widget, (GdkRectangle*) NULL );
}
-#endif
+#endif // wxUSE_STATUSBAR
m_sizeSet = TRUE;
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
+#if wxUSE_STATUSBAR
// send size event to status bar
if (m_frameStatusBar)
{
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
+#endif // wxUSE_STATUSBAR
m_resizing = FALSE;
}
-void wxFrame::MakeModal( bool modal )
+void wxFrameGTK::MakeModal( bool modal )
{
if (modal)
gtk_grab_add( m_widget );
gtk_grab_remove( m_widget );
}
-void wxFrame::OnInternalIdle()
+void wxFrameGTK::OnInternalIdle()
{
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
{
return;
}
+#if wxUSE_MENUS
if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
+#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
#endif
// menu/tool/status bar stuff
// ----------------------------------------------------------------------------
-void wxFrame::SetMenuBar( wxMenuBar *menuBar )
+#if wxUSE_MENUS
+
+void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
m_sizeSet = FALSE;
}
+#endif // wxUSE_MENUS
+
#if wxUSE_TOOLBAR
-wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& name )
+
+wxToolBar* wxFrameGTK::CreateToolBar( long style, wxWindowID id, const wxString& name )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
return m_frameToolBar;
}
-void wxFrame::SetToolBar(wxToolBar *toolbar)
+void wxFrameGTK::SetToolBar(wxToolBar *toolbar)
{
wxFrameBase::SetToolBar(toolbar);
#if wxUSE_STATUSBAR
-wxStatusBar* wxFrame::CreateStatusBar(int number,
+wxStatusBar* wxFrameGTK::CreateStatusBar(int number,
long style,
wxWindowID id,
const wxString& name)
return wxFrameBase::CreateStatusBar( number, style, id, name );
}
-void wxFrame::PositionStatusBar()
+void wxFrameGTK::PositionStatusBar()
{
if ( !m_frameStatusBar )
return;
// frame title/icon
// ----------------------------------------------------------------------------
-void wxFrame::SetTitle( const wxString &title )
+void wxFrameGTK::SetTitle( const wxString &title )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
}
-void wxFrame::SetIcon( const wxIcon &icon )
+void wxFrameGTK::SetIcon( const wxIcon &icon )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
// frame state: maximized/iconized/normal
// ----------------------------------------------------------------------------
-void wxFrame::Maximize(bool WXUNUSED(maximize))
+void wxFrameGTK::Maximize(bool WXUNUSED(maximize))
{
wxFAIL_MSG( _T("not implemented") );
}
-bool wxFrame::IsMaximized() const
+bool wxFrameGTK::IsMaximized() const
{
// wxFAIL_MSG( _T("not implemented") );
return FALSE;
}
-void wxFrame::Restore()
+void wxFrameGTK::Restore()
{
wxFAIL_MSG( _T("not implemented") );
}
-void wxFrame::Iconize( bool iconize )
+void wxFrameGTK::Iconize( bool iconize )
{
if (iconize)
{
}
}
-bool wxFrame::IsIconized() const
+bool wxFrameGTK::IsIconized() const
{
return m_isIconized;
}
gtk_widget_show( GTK_WIDGET(m_list) );
- SetSizeOrDefault( size );
+ SetBestSize( size );
if ( style & wxLB_SORT )
{
wxNode *node = m_clientList.Nth( n );
if ( node )
{
- if ( m_clientDataItemsType == ClientData_Object )
+ if ( m_clientDataItemsType == wxClientData_Object )
{
wxClientData *cd = (wxClientData*)node->Data();
delete cd;
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{
- if (g_isIdle) wxapp_install_idle_handler();
+ if (g_isIdle)
+ wxapp_install_idle_handler();
int id = menu->FindMenuIdByMenuItem(widget);
/* should find it for normal (not popup) menu */
- wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) );
+ wxASSERT_MSG( (id != -1) || (menu->GetInvokingWindow() != NULL),
+ _T("menu item not found in gtk_menu_clicked_callback") );
if (!menu->IsEnabled(id))
return;
}
}
- wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
- event.SetEventObject( menu );
- if (item->IsCheckable())
- event.SetInt( item->IsChecked() );
-
-#if wxUSE_MENU_CALLBACK
- if (menu->GetCallback())
- {
- (void) (*(menu->GetCallback())) (*menu, event);
- return;
- }
-#endif // wxUSE_MENU_CALLBACK
-
- if (menu->GetEventHandler()->ProcessEvent(event))
- return;
-
- wxWindow *win = menu->GetInvokingWindow();
- if (win)
- win->GetEventHandler()->ProcessEvent( event );
+ menu->SendEvent(item->GetId(), item->IsCheckable() ? item->IsChecked() : -1);
}
//-----------------------------------------------------------------------------
return selOld;
}
-void wxNotebook::AdvanceSelection( bool forward )
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
-
- int max = GetPageCount();
- if ( !max )
- {
- // nothing to do with empty notebook
- return;
- }
-
- int sel = GetSelection();
-
- if (forward)
- SetSelection( sel == max - 1 ? 0 : sel + 1 );
- else
- SetSelection( sel == 0 ? max - 1 : sel - 1 );
-}
-
void wxNotebook::SetImageList( wxImageList* imageList )
{
if (m_ownsImageList) delete m_imageList;
return TRUE;
}
-bool wxNotebook::RemovePage( int page )
+wxNotebookPage *wxNotebook::DoRemovePage( int page )
{
wxGtkNotebookPage* nb_page = GetNotebookPage(page);
- wxCHECK_MSG( nb_page, FALSE, _T("wxNotebook::RemovePage: invalid page") );
+ wxCHECK_MSG( nb_page, NULL, _T("wxNotebook::RemovePage: invalid page") );
gtk_widget_ref( nb_page->m_client->m_widget );
gtk_widget_unrealize( nb_page->m_client->m_widget );
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
+ wxNotebookPage *pageRemoved = (wxNotebookPage *)m_pages[page];
m_pages.DeleteObject( nb_page );
- return TRUE;
+ return pageRemoved;
}
bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString& text,
event.Skip();
}
-wxNotebookPage *wxNotebook::GetPage( int page ) const
-{
- wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, wxT("invalid notebook") );
-
- wxGtkNotebookPage* nb_page = GetNotebookPage(page);
- if (!nb_page)
- return (wxNotebookPage *) NULL;
- else
- return nb_page->m_client;
-}
-
#if wxUSE_CONSTRAINTS
// override these 2 functions to do nothing: everything is done in OnSize
#pragma implementation "radiobox.h"
#endif
-#include "wx/radiobox.h"
+#include "wx/defs.h"
#if wxUSE_RADIOBOX
+#include "wx/radiobox.h"
+
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/log.h"
#pragma implementation "radiobut.h"
#endif
-#include "wx/radiobut.h"
+#include "wx/defs.h"
#if wxUSE_RADIOBOX
+#include "wx/radiobut.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
// Name: gtk/region.cpp
// Purpose:
// Author: Robert Roebling
+// Modified: VZ at 05.10.00: use Unshare(), comparison fixed
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// ============================================================================
+// declarations
+// ============================================================================
+
#ifdef __GNUG__
-#pragma implementation "region.h"
+ #pragma implementation "region.h"
#endif
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
#include "wx/region.h"
#include <gdk/gdk.h>
#define OLDCODE 0
#endif
-//-----------------------------------------------------------------------------
-// wxRegion
-//-----------------------------------------------------------------------------
+#include "wx/log.h"
+
+// ----------------------------------------------------------------------------
+// wxRegionRefData: private class containing the information about the region
+// ----------------------------------------------------------------------------
-class wxRegionRefData: public wxObjectRefData
+class wxRegionRefData : public wxObjectRefData
{
public:
wxRegionRefData();
- ~wxRegionRefData();
+ wxRegionRefData(const wxRegionRefData& refData);
+ virtual ~wxRegionRefData();
GdkRegion *m_region;
#if OLDCODE
#endif
};
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+#define M_REGIONDATA ((wxRegionRefData *)m_refData)
+#define M_REGIONDATA_OF(rgn) ((wxRegionRefData *)(rgn.m_refData))
+
+IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
+IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxRegionRefData
+// ----------------------------------------------------------------------------
+
wxRegionRefData::wxRegionRefData()
{
m_region = (GdkRegion *) NULL;
}
+wxRegionRefData::wxRegionRefData(const wxRegionRefData& refData)
+{
+#ifdef __WXGTK20__
+ m_region = gdk_region_copy(refData.m_region);
+#else
+ m_region = gdk_region_new();
+ GdkRegion *regCopy = gdk_regions_union(m_region, refData.m_region);
+ gdk_region_destroy(m_region);
+ m_region = regCopy;
+#endif
+
+ wxNode *node = refData.m_rects.First();
+ while (node)
+ {
+ wxRect *r = (wxRect*)node->Data();
+ m_rects.Append( (wxObject*) new wxRect(*r) );
+ node = node->Next();
+ }
+}
+
wxRegionRefData::~wxRegionRefData()
{
if (m_region) gdk_region_destroy( m_region );
#endif
}
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// wxRegion construction
+// ----------------------------------------------------------------------------
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject);
+wxRegion::wxRegion()
+{
+}
+
wxRegion::wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
{
m_refData = new wxRegionRefData();
#endif
}
-wxRegion::wxRegion()
+wxRegion::~wxRegion()
{
}
-wxRegion::~wxRegion()
+bool wxRegion::operator==( const wxRegion& region )
{
+ // VZ: compare the regions themselves, not the pointers to ref data!
+ return gdk_region_equal(M_REGIONDATA->m_region,
+ M_REGIONDATA_OF(region)->m_region);
}
-bool wxRegion::operator == ( const wxRegion& region )
+bool wxRegion::operator != ( const wxRegion& region )
{
- return m_refData == region.m_refData;
+ return !(*this == region);
}
-bool wxRegion::operator != ( const wxRegion& region )
+void wxRegion::Unshare()
{
- return m_refData != region.m_refData;
+ if ( !m_refData )
+ {
+ m_refData = new wxRegionRefData;
+ M_REGIONDATA->m_region = gdk_region_new();
+ }
+ else if ( m_refData->GetRefCount() > 1 )
+ {
+ wxRegionRefData *refData = new wxRegionRefData(*M_REGIONDATA);
+ UnRef();
+ m_refData = refData;
+ }
+ //else: we're not shared
}
+// ----------------------------------------------------------------------------
+// wxRegion operations
+// ----------------------------------------------------------------------------
+
void wxRegion::Clear()
{
UnRef();
}
else
{
+ Unshare();
+
#ifdef __WXGTK20__
gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
#else
M_REGIONDATA->m_region = reg;
#endif
}
-
+
#if OLDCODE
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) );
#endif
if (region.IsNull())
return FALSE;
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
+ Unshare();
#ifdef __WXGTK20__
gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() );
bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( x, y, width, height );
- Intersect( reg );
- return TRUE;
+
+ return Intersect( reg );
}
bool wxRegion::Intersect( const wxRect& rect )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( rect );
- Intersect( reg );
- return TRUE;
+ return Intersect( reg );
}
-bool wxRegion::Intersect( const wxRegion& region )
+// this helper function just computes the region intersection without updating
+// the list of rectangles each region maintaints: this allows us to call it
+// from Intersect() itself without going into infinite recursion as we would
+// if we called Intersect() itself recursively
+bool wxRegion::IntersectRegionOnly(const wxRegion& region)
{
- if (region.IsNull())
- return FALSE;
+ Unshare();
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- return TRUE;
- }
-
#ifdef __WXGTK20__
gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() );
#else
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
#endif
+
return TRUE;
}
-bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+bool wxRegion::Intersect( const wxRegion& region )
{
+ if (region.IsNull())
+ return FALSE;
+
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
+ return TRUE;
+ }
+
+ if ( !IntersectRegionOnly(region) )
+ {
+ GetRectList()->Clear();
+
+ return FALSE;
+ }
+
+ // we need to update the rect list as well
+ wxList& list = *GetRectList();
+ wxNode *node = list.First();
+ while (node)
+ {
+ wxRect *r = (wxRect*)node->Data();
+
+ wxRegion regCopy = region;
+ if ( regCopy.IntersectRegionOnly(*r) )
+ {
+ // replace the node with the intersection
+ *r = regCopy.GetBox();
+ }
+ else
+ {
+ // TODO remove the rect from the list
+ r->width = 0;
+ r->height = 0;
+ }
+
+ node = node->Next();
}
- wxRegion reg( x, y, width, height );
- Subtract( reg );
return TRUE;
}
-bool wxRegion::Subtract( const wxRect& rect )
+bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
+ wxRegion reg( x, y, width, height );
+ return Subtract( reg );
+}
+bool wxRegion::Subtract( const wxRect& rect )
+{
wxRegion reg( rect );
- Subtract( reg );
- return TRUE;
+ return Subtract( reg );
}
bool wxRegion::Subtract( const wxRegion& region )
M_REGIONDATA->m_region = gdk_region_new();
}
+ Unshare();
+
#ifdef __WXGTK20__
gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() );
#else
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
#endif
+
return TRUE;
}
bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( x, y, width, height );
- Xor( reg );
- return TRUE;
+ return Xor( reg );
}
bool wxRegion::Xor( const wxRect& rect )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( rect );
- Xor( reg );
- return TRUE;
+ return Xor( reg );
}
bool wxRegion::Xor( const wxRegion& region )
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
+ else
+ {
+ Unshare();
+ }
#ifdef __WXGTK20__
gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() );
return TRUE;
}
+// ----------------------------------------------------------------------------
+// wxRegion tests
+// ----------------------------------------------------------------------------
+
void wxRegion::GetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const
{
- x = 0;
- y = 0;
- w = -1;
- h = -1;
- if (!m_refData)
- return;
-
- GdkRectangle rect;
- gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
- x = rect.x;
- y = rect.y;
- w = rect.width;
- h = rect.height;
+ if ( m_refData )
+ {
+ GdkRectangle rect;
+ gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
+ x = rect.x;
+ y = rect.y;
+ w = rect.width;
+ h = rect.height;
+ }
+ else
+ {
+ x = 0;
+ y = 0;
+ w = -1;
+ h = -1;
+ }
}
wxRect wxRegion::GetBox() const
{
- wxCoord x = 0;
- wxCoord y = 0;
- wxCoord w = -1;
- wxCoord h = -1;
+ wxCoord x, y, w, h;
GetBox( x, y, w, h );
return wxRect( x, y, w, h );
}
#endif
}
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxRegionIterator
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
#if OLDCODE
struct _XBox {
short x1, x2, y1, y2;
};
-
+
struct _XRegion {
long size , numRects;
_XBox *rects, extents;
return ((wxRIRefData*)m_refData)->m_rects[m_current].height;
}
+wxRect wxRegionIterator::GetRect() const
+{
+ wxRect r;
+ wxNode *node = m_region.GetRectList()->Nth( m_current );
+
+ if (node)
+ r = *((wxRect*)node->Data());
+
+ return r;
+}
+
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: scrolbar.cpp
+// Name: src/gtk/scrolbar.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#pragma implementation "scrolbar.h"
#endif
-#include "wx/scrolbar.h"
+#include "wx/defs.h"
#if wxUSE_SCROLLBAR
+#include "wx/scrolbar.h"
+
#include "wx/utils.h"
#include <math.h>
/////////////////////////////////////////////////////////////////////////////
-// Name: slider.cpp
+// Name: gtk/slider.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
+extern bool g_blockEventsOnDrag;
static const float sensitivity = 0.02;
double dvalue = adjust->value;
int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5);
- int orient = wxHORIZONTAL;
- if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
- orient = wxVERTICAL;
+ int orient = win->GetWindowStyleFlag() & wxSL_VERTICAL ? wxVERTICAL
+ : wxHORIZONTAL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
return 0;
}
-void wxSlider::SetTick( int WXUNUSED(tickPos) )
-{
-}
-
-void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
-{
-}
-
-int wxSlider::GetTickFreq() const
-{
- return 0;
-}
-
-void wxSlider::ClearTicks()
-{
-}
-
-void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
-{
-}
-
-int wxSlider::GetSelEnd() const
-{
- return 0;
-}
-
-int wxSlider::GetSelStart() const
-{
- return 0;
-}
-
-void wxSlider::ClearSel()
-{
-}
-
bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
{
GtkRange *range = GTK_RANGE(m_widget);
#pragma implementation "statbmp.h"
#endif
-#include "wx/statbmp.h"
+#include "wx/defs.h"
#if wxUSE_STATBMP
+#include "wx/statbmp.h"
+
#include "gdk/gdk.h"
#include "gtk/gtk.h"
mask = m_bitmap.GetMask()->GetBitmap();
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
- SetSizeOrDefault( size );
+ SetBestSize( size );
}
else
{
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
}
- SetSizeOrDefault();
+ SetBestSize(wxSize(bitmap.GetWidth(), bitmap.GetHeight()));
}
}
-wxSize wxStaticBitmap::DoGetBestSize() const
-{
- if ( m_bitmap.Ok() )
- return wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());
- else
- return wxSize(16, 16); // completely arbitrary
-}
+#endif // wxUSE_STATBMP
-#endif
#pragma implementation "statbox.h"
#endif
-#include "wx/statbox.h"
+#include "wx/defs.h"
#if wxUSE_STATBOX
+#include "wx/statbox.h"
+
#include "gdk/gdk.h"
#include "gtk/gtk.h"
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
- return FALSE;
+ return FALSE;
}
m_isStaticBox = TRUE;
-
+
if (label.IsEmpty())
m_widget = gtk_frame_new( (char*) NULL );
else
m_widget = gtk_frame_new( m_label.mbc_str() );
m_parent->DoAddChild( this );
-
+
PostCreation();
SetLabel(label);
-
+
SetFont( parent->GetFont() );
SetBackgroundColour( parent->GetBackgroundColour() );
gtk_widget_set_style( m_widget, m_widgetStyle );
}
-#endif
+#endif // wxUSE_STATBOX
#pragma implementation "stattext.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_STATTEXT
+
#include "wx/stattext.h"
#include "gdk/gdk.h"
return wxSize(req.width, req.height);
}
+#endif // wxUSE_STATTEXT
#endif
}
-bool wxTextCtrl::CanCopy() const
-{
- // Can copy if there's a selection
- long from, to;
- GetSelection(& from, & to);
- return (from != to) ;
-}
-
-bool wxTextCtrl::CanCut() const
-{
- // Can cut if there's a selection
- long from, to;
- GetSelection(& from, & to);
- return (from != to) && (IsEditable());
-}
-
-bool wxTextCtrl::CanPaste() const
-{
- return IsEditable() ;
-}
-
// Undo/redo
void wxTextCtrl::Undo()
{
/////////////////////////////////////////////////////////////////////////////
// Name: gtk/timer.cpp
-// Purpose:
+// Purpose: wxTimer implementation
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
#pragma implementation "timer.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_TIMER
+
#include "wx/timer.h"
#include "gtk/gtk.h"
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxTimer
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject)
+IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
static gint timeout_callback( gpointer data )
{
}
}
+#endif // wxUSE_TIMER
+
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
+#ifndef __WXUNIVERSAL__
if (pizza->shadow_type == GTK_MYSHADOW_NONE)
{
/* no border, no changes to sizes */
- } else
- if (pizza->shadow_type == GTK_MYSHADOW_THIN)
+ }
+ else if (pizza->shadow_type == GTK_MYSHADOW_THIN)
{
/* GTK_MYSHADOW_THIN == wxSIMPLE_BORDER */
attributes.x += 1;
attributes.y += 1;
attributes.width -= 2;
attributes.height -= 2;
- } else
+ }
+ else
{
/* GTK_MYSHADOW_IN == wxSUNKEN_BORDER */
/* GTK_MYSHADOW_OUT == wxRAISED_BORDER */
attributes.width -= 4;
attributes.height -= 4;
}
+#endif /* __WXUNIVERSAL__ */
/* minimal size */
if (attributes.width < 2) attributes.width = 2;
#include "wx/defs.h"
#include "wx/window.h"
-#include "wx/dc.h"
#include "wx/dcclient.h"
#include "wx/frame.h"
#include "wx/app.h"
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
extern wxCursor g_globalCursor;
-static wxWindow *g_captureWindow = (wxWindow*) NULL;
-/* extern */ wxWindow *g_focusWindow = (wxWindow*) NULL;
+// mouse capture state: the window which has it and if the mouse is currently
+// inside it
+static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL;
+static bool g_captureWindowHasMouse = FALSE;
+
+/* extern */ wxWindowGTK *g_focusWindow = (wxWindowGTK*) NULL;
+
+// the last window which had the focus - this is normally never NULL (except
+// if we never had focus at all) as even when g_focusWindow is NULL it still
+// keeps its previous value
+static wxWindowGTK *g_focusWindowLast = (wxWindowGTK *)NULL;
// if we detect that the app has got/lost the focus, we set this variable to
// either TRUE or FALSE and an activate event will be sent during the next
//-----------------------------------------------------------------------------
// returns the child of win which currently has focus or NULL if not found
+//
// Note: can't be static, needed by textctrl.cpp.
-/* static */ wxWindow *FindFocusedChild(wxWindow *win)
+wxWindow *FindFocusedChild(wxWindowGTK *win)
{
- wxWindow *winFocus = wxWindow::FindFocus();
+ wxWindowGTK *winFocus = wxWindowGTK::FindFocus();
if ( !winFocus )
- return (wxWindow *)NULL;
+ return (wxWindowGTK *)NULL;
if ( winFocus == win )
return win;
node;
node = node->GetNext() )
{
- wxWindow *child = FindFocusedChild(node->GetData());
+ wxWindowGTK *child = FindFocusedChild(node->GetData());
if ( child )
return child;
}
- return (wxWindow *)NULL;
+ return (wxWindowGTK *)NULL;
}
-static void draw_frame( GtkWidget *widget, wxWindow *win )
+static void draw_frame( GtkWidget *widget, wxWindowGTK *win )
{
+ // wxUniversal widgets draw the borders and scrollbars themselves
+#ifndef __WXUNIVERSAL__
if (!win->m_hasVMT)
return;
gdk_gc_unref( gc );
return;
}
+#endif // __WXUNIVERSAL__
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
-gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindowGTK *win )
{
if (gdk_event->count > 0) return FALSE;
-
+
draw_frame( widget, win );
-
+
return TRUE;
}
// "draw" of m_widget
//-----------------------------------------------------------------------------
-static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
+static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindowGTK *win )
{
draw_frame( widget, win );
}
win->GetSize( &w, &h );
if (w < 2) w = 2;
if (h < 2) h = 2;
-
+
requisition->height = h;
requisition->width = w;
}
// "expose_event" of m_wxwindow
//-----------------------------------------------------------------------------
-static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+static int gtk_window_expose_callback( GtkWidget *widget,
+ GdkEventExpose *gdk_event,
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
if (g_isIdle)
wxapp_install_idle_handler();
-
+
/*
if (win->GetName() == wxT("panel"))
{
(int)gdk_event->area.height );
}
*/
-
+
GtkPizza *pizza = GTK_PIZZA (widget);
if (win->GetThemeEnabled())
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
}
-
+
win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y,
gdk_event->area.width,
if (gdk_event->count == 0)
{
win->m_clipPaintRegion = TRUE;
-
- wxEraseEvent eevent( win->GetId() );
+
+ wxWindowDC dc(win);
+ dc.SetClippingRegion(win->GetUpdateRegion());
+ wxEraseEvent eevent( win->GetId(), &dc );
eevent.SetEventObject( win );
#if 1
- win->GetEventHandler()->ProcessEvent(eevent);
-#else
+ (void)win->GetEventHandler()->ProcessEvent(eevent);
+#else // 0
if (!win->GetEventHandler()->ProcessEvent(eevent))
{
wxClientDC dc( win );
dc.SetBrush( wxBrush( win->GetBackgroundColour(), wxSOLID ) );
dc.SetPen( *wxTRANSPARENT_PEN );
-
+
wxRegionIterator upd( win->GetUpdateRegion() );
while (upd)
{
upd ++;
}
}
-#endif
+#endif // 1/0
+
+ wxNcPaintEvent eventNc( win->GetId() );
+ eventNc.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( eventNc );
wxPaintEvent event( win->GetId() );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
-
+
win->GetUpdateRegion().Clear();
-
+
win->m_clipPaintRegion = FALSE;
}
-
- /* The following code will result in all window-less widgets
- being redrawn if the wxWindows class is given a chance to
- paint *anything* because it will then be allowed to paint
- over the window-less widgets */
-
- GList *children = pizza->children;
- while (children)
- {
- GtkPizzaChild *child = (GtkPizzaChild*) children->data;
- children = children->next;
- GdkEventExpose child_event = *gdk_event;
+ /* The following code will result in all window-less widgets
+ being redrawn if the wxWindows class is given a chance to
+ paint *anything* because it will then be allowed to paint
+ over the window-less widgets */
+ GList *children = pizza->children;
+ while (children)
+ {
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
+
+ GdkEventExpose child_event = *gdk_event;
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- GTK_WIDGET_DRAWABLE (child->widget) /* &&
- gtk_widget_intersect (child->widget, &gdk_event->area, &child_event.area)*/ )
- {
- child_event.area.x = child->widget->allocation.x;
- child_event.area.y = child->widget->allocation.y;
- child_event.area.width = child->widget->allocation.width;
- child_event.area.height = child->widget->allocation.height;
- gtk_widget_event (child->widget, (GdkEvent*) &child_event);
- }
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_WIDGET_DRAWABLE (child->widget) /* &&
+ gtk_widget_intersect (child->widget, &gdk_event->area, &child_event.area)*/ )
+ {
+ child_event.area.x = child->widget->allocation.x;
+ child_event.area.y = child->widget->allocation.y;
+ child_event.area.width = child->widget->allocation.width;
+ child_event.area.height = child->widget->allocation.height;
+ gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
-
+ }
+
return TRUE;
}
There, we look for expose events ourselves whereas all other events are
handled normally. */
-gint gtk_window_event_event_callback( GtkWidget *widget, GdkEventExpose *event, wxWindow *win )
+gint gtk_window_event_event_callback( GtkWidget *widget,
+ GdkEventExpose *event,
+ wxWindow *win )
{
if (event->type == GDK_EXPOSE)
{
/* This callback is a complete replacement of the gtk_pizza_draw() function,
which disabled. */
-static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win )
+static void gtk_window_draw_callback( GtkWidget *widget,
+ GdkRectangle *rect,
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
(int)rect->height );
}
*/
-
+
GtkPizza *pizza = GTK_PIZZA (widget);
if (win->GetThemeEnabled())
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, rect, parent->m_widget, "base", 0, 0, -1, -1);
}
-
-
+
+
if (!(GTK_WIDGET_APP_PAINTABLE (widget)) &&
(pizza->clear_on_draw))
{
gdk_window_clear_area( pizza->bin_window,
rect->x, rect->y, rect->width, rect->height);
}
-
+
win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height );
win->m_clipPaintRegion = TRUE;
-
- wxEraseEvent eevent( win->GetId() );
+
+ wxWindowDC dc(win);
+ dc.SetClippingRegion(win->GetUpdateRegion());
+ wxEraseEvent eevent( win->GetId(), &dc );
eevent.SetEventObject( win );
-
+
#if 1
- win->GetEventHandler()->ProcessEvent(eevent);
+ (void)win->GetEventHandler()->ProcessEvent(eevent);
#else
if (!win->GetEventHandler()->ProcessEvent(eevent))
{
wxClientDC dc( win );
dc.SetBrush( wxBrush( win->GetBackgroundColour(), wxSOLID ) );
dc.SetPen( *wxTRANSPARENT_PEN );
-
+
wxRegionIterator upd( win->GetUpdateRegion() );
while (upd)
{
}
#endif
+ wxNcPaintEvent eventNc( win->GetId() );
+ eventNc.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( eventNc );
+
wxPaintEvent event( win->GetId() );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
win->GetUpdateRegion().Clear();
-
+
win->m_clipPaintRegion = FALSE;
-
-
+
+
GList *children = pizza->children;
while (children)
{
// "key_press_event" from any window
//-----------------------------------------------------------------------------
-static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
+static gint gtk_window_key_press_callback( GtkWidget *widget,
+ GdkEventKey *gdk_event,
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
#if wxUSE_ACCEL
if (!ret)
{
- wxWindow *ancestor = win;
+ wxWindowGTK *ancestor = win;
while (ancestor)
{
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
if ( (!ret) &&
(gdk_event->keyval == GDK_F10) )
{
- wxWindow *ancestor = win;
+ wxWindowGTK *ancestor = win;
while (ancestor)
{
if (wxIsKindOf(ancestor,wxFrame))
// "key_release_event" from any window
//-----------------------------------------------------------------------------
-static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
+static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// for compatibility with MSW and common sense we want m_leftDown be TRUE
// for a LEFT_DOWN event, not FALSE, so we will invert
// left/right/middleDown for the corresponding click events
-
+
if ((event.GetEventType() == wxEVT_LEFT_DOWN) ||
(event.GetEventType() == wxEVT_LEFT_DCLICK) ||
(event.GetEventType() == wxEVT_LEFT_UP))
// "button_press_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
+static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
wxNode *node = win->GetChildren().First();
while (node)
{
- wxWindow *child = (wxWindow*)node->Data();
+ wxWindowGTK *child = (wxWindowGTK*)node->Data();
node = node->Next();
if (!child->IsShown())
// "button_release_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
+static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
wxNode *node = win->GetChildren().First();
while (node)
{
- wxWindow *child = (wxWindow*)node->Data();
+ wxWindowGTK *child = (wxWindowGTK*)node->Data();
node = node->Next();
if (!child->IsShown())
return FALSE;
}
+// ============================================================================
+// the mouse events
+// ============================================================================
+
+// init wxMouseEvent with the info from gdk_event
+#define InitMouseEvent(event, gdk_event) \
+ event.SetTimestamp( gdk_event->time ); \
+ event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); \
+ event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK); \
+ event.m_altDown = (gdk_event->state & GDK_MOD1_MASK); \
+ event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK); \
+ event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK); \
+ event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK); \
+ event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK); \
+\
+ event.m_x = (wxCoord)gdk_event->x; \
+ event.m_y = (wxCoord)gdk_event->y \
+
//-----------------------------------------------------------------------------
// "motion_notify_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
+static gint gtk_window_motion_notify_callback( GtkWidget *widget,
+ GdkEventMotion *gdk_event,
+ wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
*/
wxMouseEvent event( wxEVT_MOTION );
- event.SetTimestamp( gdk_event->time );
- event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
- event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
- event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
- event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
- event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
- event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
- event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
-
- event.m_x = (wxCoord)gdk_event->x;
- event.m_y = (wxCoord)gdk_event->y;
-
- // Some control don't have their own X window and thus cannot get
- // any events.
+ InitMouseEvent(event, gdk_event);
- if (!g_captureWindow)
+ if ( g_captureWindow )
{
+ // synthetize a mouse enter or leave event if needed
+ GdkWindow *winUnderMouse = gdk_window_at_pointer(NULL, NULL);
+ bool hasMouse = winUnderMouse == gdk_event->window;
+ if ( hasMouse != g_captureWindowHasMouse )
+ {
+ // the mouse changed window
+ g_captureWindowHasMouse = hasMouse;
+
+ wxMouseEvent event(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
+ : wxEVT_LEAVE_WINDOW);
+ InitMouseEvent(event, gdk_event);
+ event.SetEventObject(win);
+ win->GetEventHandler()->ProcessEvent(event);
+ }
+ }
+ else // no capture
+ {
+ // Some control don't have their own X window and thus cannot get
+ // any events.
+
wxCoord x = event.m_x;
wxCoord y = event.m_y;
if (win->m_wxwindow)
wxNode *node = win->GetChildren().First();
while (node)
{
- wxWindow *child = (wxWindow*)node->Data();
+ wxWindowGTK *child = (wxWindowGTK*)node->Data();
node = node->Next();
if (!child->IsShown())
// "focus_in_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
+static gint gtk_window_focus_in_callback( GtkWidget *widget,
+ GdkEvent *WXUNUSED(event),
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
break;
}
+ g_focusWindowLast =
g_focusWindow = win;
/*
gdk_im_begin(win->m_ic, win->m_wxwindow->window);
#endif
-#ifdef wxUSE_CARET
+#if wxUSE_CARET
// caret needs to be informed about focus change
wxCaret *caret = win->GetCaret();
if ( caret )
// "focus_out_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
+static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// g_sendActivateEvent to -1
g_sendActivateEvent = 0;
- wxWindow *winFocus = FindFocusedChild(win);
+ wxWindowGTK *winFocus = FindFocusedChild(win);
if ( winFocus )
win = winFocus;
- g_focusWindow = (wxWindow *)NULL;
+ g_focusWindow = (wxWindowGTK *)NULL;
/*
printf( "OnKillFocus from " );
gdk_im_end();
#endif
-#ifdef wxUSE_CARET
+#if wxUSE_CARET
// caret needs to be informed about focus change
wxCaret *caret = win->GetCaret();
if ( caret )
// "enter_notify_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
gdk_window_get_pointer( widget->window, &x, &y, &state );
- event.m_shiftDown = (state & GDK_SHIFT_MASK);
- event.m_controlDown = (state & GDK_CONTROL_MASK);
- event.m_altDown = (state & GDK_MOD1_MASK);
- event.m_metaDown = (state & GDK_MOD2_MASK);
- event.m_leftDown = (state & GDK_BUTTON1_MASK);
- event.m_middleDown = (state & GDK_BUTTON2_MASK);
- event.m_rightDown = (state & GDK_BUTTON3_MASK);
+ InitMouseEvent(event, gdk_event);
event.m_x = x;
event.m_y = y;
// "leave_notify_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// "value_changed" from m_vAdjust
//-----------------------------------------------------------------------------
-static void gtk_window_vscroll_callback( GtkAdjustment *adjust, wxWindow *win )
+static void gtk_window_vscroll_callback( GtkAdjustment *adjust, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// "value_changed" from m_hAdjust
//-----------------------------------------------------------------------------
-static void gtk_window_hscroll_callback( GtkAdjustment *adjust, wxWindow *win )
+static void gtk_window_hscroll_callback( GtkAdjustment *adjust, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
GdkEventButton *gdk_event,
- wxWindow *win)
+ wxWindowGTK *win)
{
DEBUG_MAIN_THREAD
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
- wxWindow *win)
+ wxWindowGTK *win)
{
DEBUG_MAIN_THREAD
wxWindow *wxWindowBase::FindFocus()
{
- return g_focusWindow;
+ // the cast is necessary when we compile in wxUniversal mode
+ return (wxWindow *)g_focusWindow;
}
//-----------------------------------------------------------------------------
wxWindowCreateEvent event( win );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
-
+
return FALSE;
}
static
void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget),
GtkAllocation* WXUNUSED_UNLESS_XIM(alloc),
- wxWindow* WXUNUSED_UNLESS_XIM(win) )
+ wxWindowGTK* WXUNUSED_UNLESS_XIM(win) )
{
if (g_isIdle)
wxapp_install_idle_handler();
static gint
gtk_wxwindow_realized_callback( GtkWidget * WXUNUSED_UNLESS_XIM(widget),
- wxWindow * WXUNUSED_UNLESS_XIM(win) )
+ wxWindowGTK * WXUNUSED_UNLESS_XIM(win) )
{
if (g_isIdle)
wxapp_install_idle_handler();
GdkIMStyle style;
GdkIMStyle supported_style = (GdkIMStyle)
(GDK_IM_PREEDIT_NONE |
- GDK_IM_PREEDIT_NOTHING |
- GDK_IM_PREEDIT_POSITION |
- GDK_IM_STATUS_NONE |
- GDK_IM_STATUS_NOTHING);
+ GDK_IM_PREEDIT_NOTHING |
+ GDK_IM_PREEDIT_POSITION |
+ GDK_IM_STATUS_NONE |
+ GDK_IM_STATUS_NOTHING);
if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- supported_style = (GdkIMStyle)(supported_style & ~GDK_IM_PREEDIT_POSITION);
+ supported_style = (GdkIMStyle)(supported_style & ~GDK_IM_PREEDIT_POSITION);
attr->style = style = gdk_im_decide_style (supported_style);
attr->client_window = widget->window;
if ((colormap = gtk_widget_get_colormap (widget)) !=
- gtk_widget_get_default_colormap ())
+ gtk_widget_get_default_colormap ())
{
attrmask |= GDK_IC_PREEDIT_COLORMAP;
attr->preedit_colormap = colormap;
switch (style & GDK_IM_PREEDIT_MASK)
{
- case GDK_IM_PREEDIT_POSITION:
- if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- {
- g_warning ("over-the-spot style requires fontset");
- break;
- }
+ case GDK_IM_PREEDIT_POSITION:
+ if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
+ {
+ g_warning ("over-the-spot style requires fontset");
+ break;
+ }
- gdk_window_get_size (widget->window, &width, &height);
+ gdk_window_get_size (widget->window, &width, &height);
- attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
- attr->spot_location.x = 0;
- attr->spot_location.y = height;
- attr->preedit_area.x = 0;
- attr->preedit_area.y = 0;
- attr->preedit_area.width = width;
- attr->preedit_area.height = height;
- attr->preedit_fontset = widget->style->font;
+ attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
+ attr->spot_location.x = 0;
+ attr->spot_location.y = height;
+ attr->preedit_area.x = 0;
+ attr->preedit_area.y = 0;
+ attr->preedit_area.width = width;
+ attr->preedit_area.height = height;
+ attr->preedit_fontset = widget->style->font;
- break;
+ break;
}
win->m_ic = gdk_ic_new (attr, (GdkICAttributesType)attrmask);
if (win->m_ic == NULL)
- g_warning ("Can't create input context.");
+ g_warning ("Can't create input context.");
else
- {
- mask = gdk_window_get_events (widget->window);
- mask = (GdkEventMask)(mask | gdk_ic_get_events (win->m_ic));
- gdk_window_set_events (widget->window, mask);
-
- if (GTK_WIDGET_HAS_FOCUS(widget))
- gdk_im_begin (win->m_ic, widget->window);
- }
-#endif
+ {
+ mask = gdk_window_get_events (widget->window);
+ mask = (GdkEventMask)(mask | gdk_ic_get_events (win->m_ic));
+ gdk_window_set_events (widget->window, mask);
+
+ if (GTK_WIDGET_HAS_FOCUS(widget))
+ gdk_im_begin (win->m_ic, widget->window);
+ }
+#endif // HAVE_XIM
return FALSE;
}
//-----------------------------------------------------------------------------
-// InsertChild for wxWindow.
+// InsertChild for wxWindowGTK.
//-----------------------------------------------------------------------------
-/* Callback for wxWindow. This very strange beast has to be used because
+/* Callback for wxWindowGTK. This very strange beast has to be used because
* C++ has no virtual methods in a constructor. We have to emulate a
* virtual function here as wxNotebook requires a different way to insert
* a child in it. I had opted for creating a wxNotebookPage window class
* which would have made this superfluous (such in the MDI window system),
* but no-one was listening to me... */
-static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
+static void wxInsertChildInWindow( wxWindowGTK* parent, wxWindowGTK* child )
{
/* the window might have been scrolled already, do we
have to adapt the position */
// global functions
//-----------------------------------------------------------------------------
-wxWindow* wxGetActiveWindow()
+wxWindow *wxGetActiveWindow()
{
- return g_focusWindow;
+ // the cast is necessary when we compile in wxUniversal mode
+ return (wxWindow *)g_focusWindow;
}
//-----------------------------------------------------------------------------
-// wxWindow
+// wxWindowGTK
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+#ifdef __WXUNIVERSAL__
+ IMPLEMENT_DYNAMIC_CLASS(wxWindowGTK, wxWindowBase)
+#else
+ IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+#endif
-void wxWindow::Init()
+void wxWindowGTK::Init()
{
// common init
InitBase();
m_delayedForegroundColour = FALSE;
m_delayedBackgroundColour = FALSE;
-
+
#ifdef HAVE_XIM
m_ic = (GdkIC*) NULL;
m_icattr = (GdkICAttr*) NULL;
#endif
}
-wxWindow::wxWindow()
+wxWindowGTK::wxWindowGTK()
{
Init();
}
-wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name )
+wxWindowGTK::wxWindowGTK( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name )
{
Init();
Create( parent, id, pos, size, style, name );
}
-bool wxWindow::Create( wxWindow *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name )
+bool wxWindowGTK::Create( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name )
{
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
- wxFAIL_MSG( wxT("wxWindow creation failed") );
+ wxFAIL_MSG( wxT("wxWindowGTK creation failed") );
return FALSE;
}
m_insertCallback = wxInsertChildInWindow;
-
+
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
+#ifndef __WXUNIVERSAL__
#if (GTK_MINOR_VERSION > 0)
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
}
#endif // GTK_MINOR_VERSION
+#endif // __WXUNIVERSAL__
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
m_acceptsFocus = TRUE;
return TRUE;
}
-wxWindow::~wxWindow()
+wxWindowGTK::~wxWindowGTK()
{
if (g_focusWindow == this)
g_focusWindow = NULL;
// don't delete if it's a pixmap theme style
if (!m_widgetStyle->engine_data)
gtk_style_unref( m_widgetStyle );
-#endif
+#endif
m_widgetStyle = (GtkStyle*) NULL;
}
}
}
-bool wxWindow::PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size )
+bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size )
{
wxCHECK_MSG( !m_needParent || parent, FALSE, wxT("Need complete parent.") );
return TRUE;
}
-void wxWindow::PostCreation()
+void wxWindowGTK::PostCreation()
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
if (!m_noExpose)
{
/* these get reported to wxWindows -> wxPaintEvent */
-
+
gtk_pizza_set_external( GTK_PIZZA(m_wxwindow), TRUE );
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
else
{
// For dialogs and frames, we are interested mainly in
- // m_widget's focus.
+ // m_widget's focus.
gtk_signal_connect( GTK_OBJECT(m_widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_request",
GTK_SIGNAL_FUNC(gtk_window_size_request_callback), (gpointer) this );
}
-
+
m_hasVMT = TRUE;
}
-void wxWindow::ConnectWidget( GtkWidget *widget )
+void wxWindowGTK::ConnectWidget( GtkWidget *widget )
{
gtk_signal_connect( GTK_OBJECT(widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_window_key_press_callback), (gpointer)this );
GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
}
-bool wxWindow::Destroy()
+bool wxWindowGTK::Destroy()
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
return wxWindowBase::Destroy();
}
-void wxWindow::DoMoveWindow(int x, int y, int width, int height)
+void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height)
{
gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height );
}
-void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
+void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
- wxASSERT_MSG( (m_parent != NULL), wxT("wxWindow::SetSize requires parent.\n") );
+ wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") );
/*
printf( "DoSetSize: name %s, x,y,w,h: %d,%d,%d,%d \n", GetName().c_str(), x,y,width,height );
if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
-
+
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
/* don't set the size for children of wxNotebook, just take the values. */
if (m_hasScrolling)
{
- /* Sometimes the client area changes size without the
+ /* Sometimes the client area changes size without the
whole windows's size changing, but if the whole
windows's size doesn't change, no wxSizeEvent will
normally be sent. Here we add an extra test if
m_resizing = FALSE;
}
-void wxWindow::OnInternalIdle()
+void wxWindowGTK::OnInternalIdle()
{
if ( g_sendActivateEvent != -1 )
{
// do it only once
g_sendActivateEvent = -1;
+ wxTheApp->SetActive(activate, (wxWindow *)g_focusWindowLast);
+
wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
event.SetEventObject(this);
UpdateWindowUI();
}
-void wxWindow::DoGetSize( int *width, int *height ) const
+void wxWindowGTK::DoGetSize( int *width, int *height ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (height) (*height) = m_height;
}
-void wxWindow::DoSetClientSize( int width, int height )
+void wxWindowGTK::DoSetClientSize( int width, int height )
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
int dw = 0;
int dh = 0;
+#ifndef __WXUNIVERSAL__
if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
{
/* when using GTK 1.2 we set the shadow border size to 2 */
dw += 1 * 2;
dh += 1 * 2;
}
+#endif // __WXUNIVERSAL__
if (m_hasScrolling)
{
}
}
-void wxWindow::DoGetClientSize( int *width, int *height ) const
+void wxWindowGTK::DoGetClientSize( int *width, int *height ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
int dw = 0;
int dh = 0;
+#ifndef __WXUNIVERSAL__
if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
{
/* when using GTK 1.2 we set the shadow border size to 2 */
dw += 1 * 2;
dh += 1 * 2;
}
+#endif // __WXUNIVERSAL__
if (m_hasScrolling)
{
if (width) (*width) = m_width - dw;
if (height) (*height) = m_height - dh;
}
-
+
/*
printf( "GetClientSize, name %s ", GetName().c_str() );
if (width) printf( " width = %d", (*width) );
*/
}
-void wxWindow::DoGetPosition( int *x, int *y ) const
+void wxWindowGTK::DoGetPosition( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (y) (*y) = m_y - dy;
}
-void wxWindow::DoClientToScreen( int *x, int *y ) const
+void wxWindowGTK::DoClientToScreen( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (y) *y += org_y;
}
-void wxWindow::DoScreenToClient( int *x, int *y ) const
+void wxWindowGTK::DoScreenToClient( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (y) *y -= org_y;
}
-bool wxWindow::Show( bool show )
+bool wxWindowGTK::Show( bool show )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
return TRUE;
}
-int wxWindow::GetCharHeight() const
+int wxWindowGTK::GetCharHeight() const
{
wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") );
return font->ascent + font->descent;
}
-int wxWindow::GetCharWidth() const
+int wxWindowGTK::GetCharWidth() const
{
wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") );
return gdk_string_width( font, "H" );
}
-void wxWindow::GetTextExtent( const wxString& string,
+void wxWindowGTK::GetTextExtent( const wxString& string,
int *x,
int *y,
int *descent,
if (externalLeading) (*externalLeading) = 0; // ??
}
-void wxWindow::SetFocus()
+void wxWindowGTK::SetFocus()
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
}
}
-bool wxWindow::AcceptsFocus() const
+bool wxWindowGTK::AcceptsFocus() const
{
return m_acceptsFocus && wxWindowBase::AcceptsFocus();
}
-bool wxWindow::Reparent( wxWindowBase *newParentBase )
+bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
- wxWindow *oldParent = m_parent,
- *newParent = (wxWindow *)newParentBase;
+ wxWindowGTK *oldParent = m_parent,
+ *newParent = (wxWindowGTK *)newParentBase;
wxASSERT( GTK_IS_WIDGET(m_widget) );
return TRUE;
}
-void wxWindow::DoAddChild(wxWindow *child)
+void wxWindowGTK::DoAddChild(wxWindowGTK *child)
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
(*m_insertCallback)(this, child);
}
-void wxWindow::Raise()
+void wxWindowGTK::Raise()
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
gdk_window_raise( m_widget->window );
}
-void wxWindow::Lower()
+void wxWindowGTK::Lower()
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
gdk_window_lower( m_widget->window );
}
-bool wxWindow::SetCursor( const wxCursor &cursor )
+bool wxWindowGTK::SetCursor( const wxCursor &cursor )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
if (g_isIdle)
wxapp_install_idle_handler();
-
+
if (cursor == wxNullCursor)
return wxWindowBase::SetCursor( *wxSTANDARD_CURSOR );
else
return wxWindowBase::SetCursor( cursor );
}
-void wxWindow::WarpPointer( int x, int y )
+void wxWindowGTK::WarpPointer( int x, int y )
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
gdk_window_warp_pointer( window, x, y );
}
-void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
+void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
{
if (!m_widget) return;
if (!m_widget->window) return;
+ // temporarily hide the caret to avoid nasty interactions between caret
+ // drawing and the window contents redraw
+#if 0 // def wxUSE_CARET -- doesn't seem to help :-(
+ wxCaretSuspend cs((wxWindow *)this);
+#endif // wxUSE_CARET
+
if (eraseBackground && m_wxwindow && m_wxwindow->window)
{
if (rect)
gdk_event.area.y = 0;
gdk_event.area.width = m_wxwindow->allocation.width;
gdk_event.area.height = m_wxwindow->allocation.height;
- gtk_window_expose_callback( m_wxwindow, &gdk_event, this );
-
+ gtk_window_expose_callback( m_wxwindow, &gdk_event, (wxWindow *)this );
}
else
{
gdk_event.area.y = rect->y;
gdk_event.area.width = rect->width;
gdk_event.area.height = rect->height;
- gtk_window_expose_callback( m_wxwindow, &gdk_event, this );
+ gtk_window_expose_callback( m_wxwindow, &gdk_event, (wxWindow *)this );
}
else
{
}
}
-void wxWindow::Clear()
+void wxWindowGTK::Clear()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
}
#if wxUSE_TOOLTIPS
-void wxWindow::DoSetToolTip( wxToolTip *tip )
+void wxWindowGTK::DoSetToolTip( wxToolTip *tip )
{
wxWindowBase::DoSetToolTip(tip);
m_tooltip->Apply( this );
}
-void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
+void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{
gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
}
#endif // wxUSE_TOOLTIPS
-bool wxWindow::SetBackgroundColour( const wxColour &colour )
+bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
-bool wxWindow::SetForegroundColour( const wxColour &colour )
+bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
-GtkStyle *wxWindow::GetWidgetStyle()
+GtkStyle *wxWindowGTK::GetWidgetStyle()
{
if (m_widgetStyle)
{
return m_widgetStyle;
}
-void wxWindow::SetWidgetStyle()
+void wxWindowGTK::SetWidgetStyle()
{
#if DISABLE_STYLE_IF_BROKEN_THEM
if (m_widget->style->engine_data)
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
}
- else
+ else
{
// Try to restore the gtk default style. This is still a little
// oversimplified for what is probably really needed here for controls
// oversimplified for what is probably really needed here for controls
// other than buttons, but is better than not being able to (re)set a
// control's background colour to default grey and means resetting a
- // button to wxSYS_COLOUR_BTNFACE will restore its usual highlighting
+ // button to wxSYS_COLOUR_BTNFACE will restore its usual highlighting
// behavior -- RL
GtkStyle *def = gtk_rc_get_style( m_widget );
}
}
-void wxWindow::ApplyWidgetStyle()
+void wxWindowGTK::ApplyWidgetStyle()
{
}
// Pop-up menu stuff
//-----------------------------------------------------------------------------
+#if wxUSE_MENUS
+
static void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
{
*is_waiting = FALSE;
}
-static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
+static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
{
menu->SetInvokingWindow( win );
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
static void pop_pos_callback( GtkMenu * WXUNUSED(menu),
gint *x, gint *y,
- wxWindow *win )
+ wxWindowGTK *win )
{
win->ClientToScreen( &gs_pop_x, &gs_pop_y );
*x = gs_pop_x;
*y = gs_pop_y;
}
-bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
+bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
+#endif // wxUSE_MENUS
+
#if wxUSE_DRAG_AND_DROP
-void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
+void wxWindowGTK::SetDropTarget( wxDropTarget *dropTarget )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
#endif // wxUSE_DRAG_AND_DROP
-GtkWidget* wxWindow::GetConnectWidget()
+GtkWidget* wxWindowGTK::GetConnectWidget()
{
GtkWidget *connect_widget = m_widget;
if (m_wxwindow) connect_widget = m_wxwindow;
return connect_widget;
}
-bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
+bool wxWindowGTK::IsOwnGtkWindow( GdkWindow *window )
{
if (m_wxwindow)
return (window == GTK_PIZZA(m_wxwindow)->bin_window);
return (window == m_widget->window);
}
-bool wxWindow::SetFont( const wxFont &font )
+bool wxWindowGTK::SetFont( const wxFont &font )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
-void wxWindow::CaptureMouse()
+void wxWindowGTK::CaptureMouse()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
cursor->GetCursor(),
(guint32)GDK_CURRENT_TIME );
g_captureWindow = this;
+ g_captureWindowHasMouse = TRUE;
}
-void wxWindow::ReleaseMouse()
+void wxWindowGTK::ReleaseMouse()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
return;
gdk_pointer_ungrab ( (guint32)GDK_CURRENT_TIME );
- g_captureWindow = (wxWindow*) NULL;
+ g_captureWindow = (wxWindowGTK*) NULL;
}
-bool wxWindow::IsRetained() const
+/* static */
+wxWindow *wxWindowBase::GetCapture()
+{
+ return (wxWindow *)g_captureWindow;
+}
+
+bool wxWindowGTK::IsRetained() const
{
return FALSE;
}
-void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
+void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
}
-void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
+void wxWindowGTK::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
}
}
-int wxWindow::GetScrollThumb( int orient ) const
+int wxWindowGTK::GetScrollThumb( int orient ) const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") );
return (int)(m_vAdjust->page_size+0.5);
}
-int wxWindow::GetScrollPos( int orient ) const
+int wxWindowGTK::GetScrollPos( int orient ) const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") );
return (int)(m_vAdjust->value+0.5);
}
-int wxWindow::GetScrollRange( int orient ) const
+int wxWindowGTK::GetScrollRange( int orient ) const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") );
return (int)(m_vAdjust->upper+0.5);
}
-void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
+void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
-
+
if ((dx == 0) && (dy == 0)) return;
m_clipPaintRegion = TRUE;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = FALSE;
-
-/*
+
+/*
if (m_children.GetCount() > 0)
{
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
else
{
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
-
+
pizza->xoffset -= dx;
pizza->yoffset -= dy;
-
+
GdkGC *m_scrollGC = gdk_gc_new( pizza->bin_window );
gdk_gc_set_exposures( m_scrollGC, TRUE );
if ((h < 0) || (w < 0))
{
Refresh();
- }
+ }
else
{
int s_x = 0;
Refresh( TRUE, &rect );
}
-
+
gdk_gc_unref( m_scrollGC );
}
*/
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Name: accel.cpp
-// Purpose:
-// Author: Robert Roebling
-// Id: $id:$
-// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation "accel.h"
-#endif
-
-#include "wx/accel.h"
-
-#if wxUSE_ACCEL
-
-#include <ctype.h>
-
-//-----------------------------------------------------------------------------
-// wxAcceleratorTable
-//-----------------------------------------------------------------------------
-
-class wxAccelRefData: public wxObjectRefData
-{
-public:
- wxAccelRefData();
-
- wxList m_accels;
-};
-
-wxAccelRefData::wxAccelRefData()
-{
- m_accels.DeleteContents( TRUE );
-}
-
-//-----------------------------------------------------------------------------
-
-#define M_ACCELDATA ((wxAccelRefData *)m_refData)
-
-IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable,wxObject)
-
-wxAcceleratorTable::wxAcceleratorTable()
-{
-}
-
-wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] )
-{
- m_refData = new wxAccelRefData();
-
- for (int i = 0; i < n; i++)
- {
- int flag = entries[i].GetFlags();
- int keycode = entries[i].GetKeyCode();
- int command = entries[i].GetCommand();
- if ((keycode >= (int)'a') && (keycode <= (int)'z')) keycode = (int)toupper( (char)keycode );
- M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) );
- }
-}
-
-wxAcceleratorTable::~wxAcceleratorTable()
-{
-}
-
-bool wxAcceleratorTable::Ok() const
-{
- return (m_refData != NULL);
-}
-
-int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
-{
- if (!Ok()) return -1;
-
- wxNode *node = M_ACCELDATA->m_accels.First();
- while (node)
- {
- wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
- if ((event.m_keyCode == entry->GetKeyCode()) &&
- (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
- (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
- (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown()))
- {
- return entry->GetCommand();
- }
- node = node->Next();
- }
-
- return -1;
-}
-
-#endif
wxApp::wxApp()
{
- wxTheApp = this;
-
- m_topWindow = (wxWindow *) NULL;
- m_exitOnFrameDelete = TRUE;
-
m_idleTag = 0;
wxapp_install_idle_handler();
#endif
m_colorCube = (unsigned char*) NULL;
-
- m_useBestVisual = FALSE;
}
wxApp::~wxApp()
bool wxApp::OnInitGui()
{
+ if ( !wxAppBase::OnInitGui() )
+ return FALSE;
+
GdkVisual *visual = gdk_visual_get_system();
/* on some machines, the default visual is just 256 colours, so
return TRUE;
}
-
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
{
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
#pragma implementation "bmpbuttn.h"
#endif
-#include "wx/bmpbuttn.h"
+#include "wx/defs.h"
#if wxUSE_BMPBUTTON
+#include "wx/bmpbuttn.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
m_needParent = TRUE;
m_acceptsFocus = TRUE;
- m_marginX =
- m_marginY = 0;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
return FALSE;
}
- m_bitmap = bitmap;
- m_disabled = bitmap;
- m_focus = bitmap;
- m_selected = bitmap;
+ m_bmpNormal =
+ m_bmpDisabled =
+ m_bmpFocus =
+ m_bmpSelected = bitmap;
m_widget = gtk_button_new();
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
#endif
- if (m_bitmap.Ok())
+ if (m_bmpNormal.Ok())
{
wxSize newSize = size;
int border = (style & wxNO_BORDER) ? 4 : 10;
void wxBitmapButton::SetBitmap()
{
- wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
+ wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );
wxBitmap the_one;
if (!m_isEnabled)
else if (m_hasFocus)
the_one = m_focus;
else
- the_one = m_bitmap;
+ {
+ if (m_isSelected)
+ {
+ the_one = m_bmpSelected;
+ }
+ else
+ {
+ if (m_hasFocus)
+ the_one = m_bmpFocus;
+ else
+ the_one = m_bmpNormal;
+ }
+ }
- if (!the_one.Ok()) the_one = m_bitmap;
+ if (!the_one.Ok()) the_one = m_bmpNormal;
if (!the_one.Ok()) return;
GdkBitmap *mask = (GdkBitmap *) NULL;
#pragma implementation "button.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_BUTTON
+
#include "wx/button.h"
#include <gdk/gdk.h>
return ret;
}
+#endif // wxUSE_BUTTON
+
#pragma implementation "checkbox.h"
#endif
-#include "wx/checkbox.h"
+#include "wx/defs.h"
#if wxUSE_CHECKBOX
+#include "wx/checkbox.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#pragma implementation "checklst.h"
#endif
-#include "wx/checklst.h"
+#include "wx/defs.h"
#if wxUSE_CHECKLISTBOX
+#include "wx/checklst.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#pragma implementation "choice.h"
#endif
-#include "wx/choice.h"
+#include "wx/defs.h"
#if wxUSE_CHOICE
+#include "wx/choice.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#pragma implementation "control.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_CONTROLS
+
#include "wx/control.h"
#include <gtk/gtk.h>
return wxSize(req.width, req.height);
}
+#endif // wxUSE_CONTROLS
+
#include "gdk/gdkprivate.h"
-void gdk_wx_draw_bitmap (GdkDrawable *drawable,
- GdkGC *gc,
- GdkDrawable *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
+void gdk_wx_draw_bitmap(GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkDrawable *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
{
gint src_width, src_height;
#ifndef __WXGTK20__
}
}
-bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc,
- int logical_func, bool useMask )
+bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
+ wxCoord width, wxCoord height,
+ wxDC *source,
+ wxCoord xsrc, wxCoord ysrc,
+ int logical_func,
+ bool useMask )
{
/* this is the nth try to get this utterly useless function to
work. it now completely ignores the scaling or translation
if (!m_window) return FALSE;
+#if 0
+ // transform the source DC coords to the device ones
+ xsrc = XLOG2DEV(xsrc);
+ ysrc = YLOG2DEV(ysrc);
+#endif
+
wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source;
GdkRegion *region = m_paintClippingRegion.GetRegion();
if ( region )
{
- m_currentClippingRegion.Union( m_paintClippingRegion );
+ m_paintClippingRegion = win->GetUpdateRegion();
+ GdkRegion *region = m_paintClippingRegion.GetRegion();
+ if ( region )
+ {
+ m_currentClippingRegion.Union( m_paintClippingRegion );
- gdk_gc_set_clip_region( m_penGC, region );
- gdk_gc_set_clip_region( m_brushGC, region );
- gdk_gc_set_clip_region( m_textGC, region );
- gdk_gc_set_clip_region( m_bgGC, region );
+ gdk_gc_set_clip_region( m_penGC, region );
+ gdk_gc_set_clip_region( m_brushGC, region );
+ gdk_gc_set_clip_region( m_textGC, region );
+ gdk_gc_set_clip_region( m_bgGC, region );
+ }
}
-#endif
+#endif // USE_PAINT_REGION
}
//-----------------------------------------------------------------------------
wxClientDC::wxClientDC( wxWindow *win )
: wxWindowDC( win )
{
-}
-
-void wxClientDC::DoGetSize(int *width, int *height) const
-{
- wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );
-
- m_owner->GetClientSize( width, height );
+#ifdef __WXUNIVERSAL__
+ wxPoint ptOrigin = win->GetClientAreaOrigin();
+ SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
+ wxSize size = win->GetClientSize();
+ SetClippingRegion(wxPoint(0, 0), size);
+#endif // __WXUNIVERSAL__
}
// ----------------------------------------------------------------------------
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
+ generic/accel.cpp \
generic/busyinfo.cpp \
generic/calctrl.cpp \
generic/caret.cpp \
common/choiccmn.cpp \
common/clipcmn.cpp \
common/cmdline.cpp \
+ common/cmdproc.cpp \
common/cmndata.cpp \
common/config.cpp \
common/cshelp.cpp \
common/xpmdecod.cpp \
common/zipstrm.cpp \
common/zstream.cpp \
- gtk/accel.cpp \
gtk/app.cpp \
gtk/bitmap.cpp \
gtk/bmpbuttn.cpp \
choice.h \
clipbrd.h \
cmdline.h \
+ cmdproc.h \
cmndata.h \
colordlg.h \
colour.h \
choiccmn.o \
clipcmn.o \
cmdline.o \
+ cmdproc.o \
cmndata.o \
config.o \
cshelp.o \
choiccmn.d \
clipcmn.d \
cmdline.d \
+ cmdproc.d \
cmndata.d \
config.d \
cshelp.d \
zstream.d
GENERICOBJS = \
+ accel.o \
busyinfo.o \
calctrl.o \
caret.o \
wizard.o
GENERICDEPS = \
+ accel.d \
busyinfo.d \
calctrl.d \
caret.d \
wizard.d
GUIOBJS = \
- accel.o \
app.o \
bitmap.o \
bmpbuttn.o \
window.o
GUIDEPS = \
- accel.d \
app.d \
bitmap.d \
bmpbuttn.d \
win_gtk.d \
window.d
+GUI_LOWLEVEL_OBJS = \
+ app.o \
+ bitmap.o \
+ brush.o \
+ clipbrd.o \
+ colour.o \
+ cursor.o \
+ data.o \
+ dataobj.o \
+ dc.o \
+ dcclient.o \
+ dcmemory.o \
+ dcscreen.o \
+ dialog.o \
+ font.o \
+ frame.o \
+ gdiobj.o \
+ icon.o \
+ main.o \
+ pen.o \
+ region.o \
+ settings.o \
+ timer.o \
+ utilsgtk.o \
+ win_gtk.o \
+ window.o
+
+GUI_LOWLEVEL_DEPS = \
+ app.d \
+ bitmap.d \
+ brush.d \
+ clipbrd.d \
+ colour.d \
+ cursor.d \
+ data.d \
+ dataobj.d \
+ dc.d \
+ dcclient.d \
+ dcmemory.d \
+ dcscreen.d \
+ dialog.d \
+ font.d \
+ frame.d \
+ gdiobj.d \
+ icon.d \
+ main.d \
+ pen.d \
+ region.d \
+ settings.d \
+ timer.d \
+ utilsgtk.d \
+ win_gtk.d \
+ window.d
+
UNIXOBJS = \
dialup.o \
dir.o \
/////////////////////////////////////////////////////////////////////////////
-// Name: fontdlg.cpp
+// Name: gtk/fontdlg.cpp
// Purpose: wxFontDialog
// Author: Robert Roebling
// Id: $Id$
#pragma implementation "fontdlg.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_FONTDLG
+
#include "wx/fontutil.h"
#include "wx/fontdlg.h"
#include "wx/utils.h"
{
}
+#endif // wxUSE_FONTDLG
+
// event tables
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
+#ifdef __WXUNIVERSAL__
+ IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow)
+#else
+ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
+#endif
// ----------------------------------------------------------------------------
// data
// "size_allocate"
//-----------------------------------------------------------------------------
-static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
+static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
// "delete_event"
//-----------------------------------------------------------------------------
-static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
+static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
return TRUE;
}
+#if wxUSE_MENUS
//-----------------------------------------------------------------------------
// "child_attached" of menu bar
//-----------------------------------------------------------------------------
-static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
// "child_detached" of menu bar
//-----------------------------------------------------------------------------
-static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
win->m_menuBarDetached = TRUE;
win->GtkUpdateSize();
}
+#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
//-----------------------------------------------------------------------------
// "child_attached" of tool bar
//-----------------------------------------------------------------------------
-static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
// "child_detached" of tool bar
//-----------------------------------------------------------------------------
-static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
static gint
#if (GTK_MINOR_VERSION > 0)
-gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrame *win )
+gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrameGTK *win )
#else
-gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
+gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrameGTK *win )
#endif
{
if (g_isIdle)
so we do this directly after realization */
static void
-gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrame *win )
+gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
}
// ----------------------------------------------------------------------------
-// wxFrame itself
+// wxFrameGTK itself
// ----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// InsertChild for wxFrame
+// InsertChild for wxFrameGTK
//-----------------------------------------------------------------------------
-/* Callback for wxFrame. This very strange beast has to be used because
+/* Callback for wxFrameGTK. This very strange beast has to be used because
* C++ has no virtual methods in a constructor. We have to emulate a
* virtual function here as wxWindows requires different ways to insert
* a child in container classes. */
-static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
+static void wxInsertChildInFrame( wxFrameGTK* parent, wxWindow* child )
{
wxASSERT( GTK_IS_WIDGET(child->m_widget) );
if (!parent->m_insertInClientArea)
{
/* these are outside the client area */
- wxFrame* frame = (wxFrame*) parent;
+ wxFrameGTK* frame = (wxFrameGTK*) parent;
gtk_pizza_put( GTK_PIZZA(frame->m_mainWidget),
GTK_WIDGET(child->m_widget),
child->m_x,
}
// ----------------------------------------------------------------------------
-// wxFrame creation
+// wxFrameGTK creation
// ----------------------------------------------------------------------------
-void wxFrame::Init()
+void wxFrameGTK::Init()
{
m_sizeSet = FALSE;
m_miniEdge = 0;
m_themeEnabled = TRUE;
}
-bool wxFrame::Create( wxWindow *parent,
+bool wxFrameGTK::Create( wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
- wxFAIL_MSG( wxT("wxFrame creation failed") );
+ wxFAIL_MSG( wxT("wxFrameGTK creation failed") );
return FALSE;
}
gtk_window_set_wmclass( GTK_WINDOW(m_widget), name.mb_str(), name.mb_str() );
#ifdef __WXDEBUG__
- debug_focus_in( m_widget, wxT("wxFrame::m_widget"), name );
+ debug_focus_in( m_widget, wxT("wxFrameGTK::m_widget"), name );
#endif
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
#ifdef __WXDEBUG__
- debug_focus_in( m_mainWidget, wxT("wxFrame::m_mainWidget"), name );
+ debug_focus_in( m_mainWidget, wxT("wxFrameGTK::m_mainWidget"), name );
#endif
/* m_wxwindow only represents the client area without toolbar and menubar */
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
#ifdef __WXDEBUG__
- debug_focus_in( m_wxwindow, wxT("wxFrame::m_wxwindow"), name );
+ debug_focus_in( m_wxwindow, wxT("wxFrameGTK::m_wxwindow"), name );
#endif
/* we donm't allow the frame to get the focus as otherwise
return TRUE;
}
-wxFrame::~wxFrame()
+wxFrameGTK::~wxFrameGTK()
{
m_isBeingDeleted = TRUE;
// overridden wxWindow methods
// ----------------------------------------------------------------------------
-bool wxFrame::Show( bool show )
+bool wxFrameGTK::Show( bool show )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
return wxWindow::Show( show );
}
-void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
+void wxFrameGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
{
- wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") );
+ wxFAIL_MSG( wxT("DoMoveWindow called for wxFrameGTK") );
}
-void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
+void wxFrameGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
- /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
+ /* this shouldn't happen: wxFrameGTK, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
/* avoid recursions */
m_resizing = FALSE;
}
-void wxFrame::DoGetClientSize( int *width, int *height ) const
+void wxFrameGTK::DoGetClientSize( int *width, int *height ) const
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxWindow::DoGetClientSize( width, height );
if (height)
{
+#if wxUSE_MENUS
/* menu bar */
if (m_frameMenuBar)
{
else
(*height) -= wxPLACE_HOLDER;
}
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
/* status bar */
}
}
-void wxFrame::DoSetClientSize( int width, int height )
+void wxFrameGTK::DoSetClientSize( int width, int height )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
+#if wxUSE_MENUS
/* menu bar */
if (m_frameMenuBar)
{
else
height += wxPLACE_HOLDER;
}
+#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
/* status bar */
DoSetSize( -1, -1, width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0 );
}
-void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
+void wxFrameGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
int width, int height )
{
// due to a bug in gtk, x,y are always 0
if (m_resizing) return;
m_resizing = TRUE;
- /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
+ /* this shouldn't happen: wxFrameGTK, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
m_width = width;
int client_area_x_offset = 0,
client_area_y_offset = 0;
- /* wxMDIChildFrame derives from wxFrame but it _is_ a wxWindow as it uses
+ /* wxMDIChildFrame derives from wxFrameGTK but it _is_ a wxWindow as it uses
wxWindow::Create to create it's GTK equivalent. m_mainWidget is only
- set in wxFrame::Create so it is used to check what kind of frame we
+ set in wxFrameGTK::Create so it is used to check what kind of frame we
have here. if m_mainWidget is NULL it is a wxMDIChildFrame and so we
skip the part which handles m_frameMenuBar, m_frameToolBar and (most
importantly) m_mainWidget */
* this hurts in the eye, but I don't want to call SetSize()
* because I don't want to call any non-native functions here. */
+#if wxUSE_MENUS
if (m_frameMenuBar)
{
int xx = m_miniEdge;
xx, yy, ww, hh );
client_area_y_offset += hh;
}
+#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
if ((m_frameToolBar) && m_frameToolBar->IsShown() &&
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
+#if wxUSE_MENUS
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
else
yy += wxPLACE_HOLDER;
}
+#endif // wxUSE_MENUS
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
xx, yy, ww, hh );
gtk_widget_draw( m_frameStatusBar->m_widget, (GdkRectangle*) NULL );
}
-#endif
+#endif // wxUSE_STATUSBAR
m_sizeSet = TRUE;
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
+#if wxUSE_STATUSBAR
// send size event to status bar
if (m_frameStatusBar)
{
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
+#endif // wxUSE_STATUSBAR
m_resizing = FALSE;
}
-void wxFrame::MakeModal( bool modal )
+void wxFrameGTK::MakeModal( bool modal )
{
if (modal)
gtk_grab_add( m_widget );
gtk_grab_remove( m_widget );
}
-void wxFrame::OnInternalIdle()
+void wxFrameGTK::OnInternalIdle()
{
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
{
return;
}
+#if wxUSE_MENUS
if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
+#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
#endif
// menu/tool/status bar stuff
// ----------------------------------------------------------------------------
-void wxFrame::SetMenuBar( wxMenuBar *menuBar )
+#if wxUSE_MENUS
+
+void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
m_sizeSet = FALSE;
}
+#endif // wxUSE_MENUS
+
#if wxUSE_TOOLBAR
-wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& name )
+
+wxToolBar* wxFrameGTK::CreateToolBar( long style, wxWindowID id, const wxString& name )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
return m_frameToolBar;
}
-void wxFrame::SetToolBar(wxToolBar *toolbar)
+void wxFrameGTK::SetToolBar(wxToolBar *toolbar)
{
wxFrameBase::SetToolBar(toolbar);
#if wxUSE_STATUSBAR
-wxStatusBar* wxFrame::CreateStatusBar(int number,
+wxStatusBar* wxFrameGTK::CreateStatusBar(int number,
long style,
wxWindowID id,
const wxString& name)
return wxFrameBase::CreateStatusBar( number, style, id, name );
}
-void wxFrame::PositionStatusBar()
+void wxFrameGTK::PositionStatusBar()
{
if ( !m_frameStatusBar )
return;
// frame title/icon
// ----------------------------------------------------------------------------
-void wxFrame::SetTitle( const wxString &title )
+void wxFrameGTK::SetTitle( const wxString &title )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
}
-void wxFrame::SetIcon( const wxIcon &icon )
+void wxFrameGTK::SetIcon( const wxIcon &icon )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
// frame state: maximized/iconized/normal
// ----------------------------------------------------------------------------
-void wxFrame::Maximize(bool WXUNUSED(maximize))
+void wxFrameGTK::Maximize(bool WXUNUSED(maximize))
{
wxFAIL_MSG( _T("not implemented") );
}
-bool wxFrame::IsMaximized() const
+bool wxFrameGTK::IsMaximized() const
{
// wxFAIL_MSG( _T("not implemented") );
return FALSE;
}
-void wxFrame::Restore()
+void wxFrameGTK::Restore()
{
wxFAIL_MSG( _T("not implemented") );
}
-void wxFrame::Iconize( bool iconize )
+void wxFrameGTK::Iconize( bool iconize )
{
if (iconize)
{
}
}
-bool wxFrame::IsIconized() const
+bool wxFrameGTK::IsIconized() const
{
return m_isIconized;
}
gtk_widget_show( GTK_WIDGET(m_list) );
- SetSizeOrDefault( size );
+ SetBestSize( size );
if ( style & wxLB_SORT )
{
wxNode *node = m_clientList.Nth( n );
if ( node )
{
- if ( m_clientDataItemsType == ClientData_Object )
+ if ( m_clientDataItemsType == wxClientData_Object )
{
wxClientData *cd = (wxClientData*)node->Data();
delete cd;
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{
- if (g_isIdle) wxapp_install_idle_handler();
+ if (g_isIdle)
+ wxapp_install_idle_handler();
int id = menu->FindMenuIdByMenuItem(widget);
/* should find it for normal (not popup) menu */
- wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) );
+ wxASSERT_MSG( (id != -1) || (menu->GetInvokingWindow() != NULL),
+ _T("menu item not found in gtk_menu_clicked_callback") );
if (!menu->IsEnabled(id))
return;
}
}
- wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
- event.SetEventObject( menu );
- if (item->IsCheckable())
- event.SetInt( item->IsChecked() );
-
-#if wxUSE_MENU_CALLBACK
- if (menu->GetCallback())
- {
- (void) (*(menu->GetCallback())) (*menu, event);
- return;
- }
-#endif // wxUSE_MENU_CALLBACK
-
- if (menu->GetEventHandler()->ProcessEvent(event))
- return;
-
- wxWindow *win = menu->GetInvokingWindow();
- if (win)
- win->GetEventHandler()->ProcessEvent( event );
+ menu->SendEvent(item->GetId(), item->IsCheckable() ? item->IsChecked() : -1);
}
//-----------------------------------------------------------------------------
return selOld;
}
-void wxNotebook::AdvanceSelection( bool forward )
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
-
- int max = GetPageCount();
- if ( !max )
- {
- // nothing to do with empty notebook
- return;
- }
-
- int sel = GetSelection();
-
- if (forward)
- SetSelection( sel == max - 1 ? 0 : sel + 1 );
- else
- SetSelection( sel == 0 ? max - 1 : sel - 1 );
-}
-
void wxNotebook::SetImageList( wxImageList* imageList )
{
if (m_ownsImageList) delete m_imageList;
return TRUE;
}
-bool wxNotebook::RemovePage( int page )
+wxNotebookPage *wxNotebook::DoRemovePage( int page )
{
wxGtkNotebookPage* nb_page = GetNotebookPage(page);
- wxCHECK_MSG( nb_page, FALSE, _T("wxNotebook::RemovePage: invalid page") );
+ wxCHECK_MSG( nb_page, NULL, _T("wxNotebook::RemovePage: invalid page") );
gtk_widget_ref( nb_page->m_client->m_widget );
gtk_widget_unrealize( nb_page->m_client->m_widget );
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
+ wxNotebookPage *pageRemoved = (wxNotebookPage *)m_pages[page];
m_pages.DeleteObject( nb_page );
- return TRUE;
+ return pageRemoved;
}
bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString& text,
event.Skip();
}
-wxNotebookPage *wxNotebook::GetPage( int page ) const
-{
- wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, wxT("invalid notebook") );
-
- wxGtkNotebookPage* nb_page = GetNotebookPage(page);
- if (!nb_page)
- return (wxNotebookPage *) NULL;
- else
- return nb_page->m_client;
-}
-
#if wxUSE_CONSTRAINTS
// override these 2 functions to do nothing: everything is done in OnSize
#pragma implementation "radiobox.h"
#endif
-#include "wx/radiobox.h"
+#include "wx/defs.h"
#if wxUSE_RADIOBOX
+#include "wx/radiobox.h"
+
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/log.h"
#pragma implementation "radiobut.h"
#endif
-#include "wx/radiobut.h"
+#include "wx/defs.h"
#if wxUSE_RADIOBOX
+#include "wx/radiobut.h"
+
#include <gdk/gdk.h>
#include <gtk/gtk.h>
// Name: gtk/region.cpp
// Purpose:
// Author: Robert Roebling
+// Modified: VZ at 05.10.00: use Unshare(), comparison fixed
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// ============================================================================
+// declarations
+// ============================================================================
+
#ifdef __GNUG__
-#pragma implementation "region.h"
+ #pragma implementation "region.h"
#endif
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
#include "wx/region.h"
#include <gdk/gdk.h>
#define OLDCODE 0
#endif
-//-----------------------------------------------------------------------------
-// wxRegion
-//-----------------------------------------------------------------------------
+#include "wx/log.h"
+
+// ----------------------------------------------------------------------------
+// wxRegionRefData: private class containing the information about the region
+// ----------------------------------------------------------------------------
-class wxRegionRefData: public wxObjectRefData
+class wxRegionRefData : public wxObjectRefData
{
public:
wxRegionRefData();
- ~wxRegionRefData();
+ wxRegionRefData(const wxRegionRefData& refData);
+ virtual ~wxRegionRefData();
GdkRegion *m_region;
#if OLDCODE
#endif
};
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+#define M_REGIONDATA ((wxRegionRefData *)m_refData)
+#define M_REGIONDATA_OF(rgn) ((wxRegionRefData *)(rgn.m_refData))
+
+IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
+IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxRegionRefData
+// ----------------------------------------------------------------------------
+
wxRegionRefData::wxRegionRefData()
{
m_region = (GdkRegion *) NULL;
}
+wxRegionRefData::wxRegionRefData(const wxRegionRefData& refData)
+{
+#ifdef __WXGTK20__
+ m_region = gdk_region_copy(refData.m_region);
+#else
+ m_region = gdk_region_new();
+ GdkRegion *regCopy = gdk_regions_union(m_region, refData.m_region);
+ gdk_region_destroy(m_region);
+ m_region = regCopy;
+#endif
+
+ wxNode *node = refData.m_rects.First();
+ while (node)
+ {
+ wxRect *r = (wxRect*)node->Data();
+ m_rects.Append( (wxObject*) new wxRect(*r) );
+ node = node->Next();
+ }
+}
+
wxRegionRefData::~wxRegionRefData()
{
if (m_region) gdk_region_destroy( m_region );
#endif
}
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// wxRegion construction
+// ----------------------------------------------------------------------------
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject);
+wxRegion::wxRegion()
+{
+}
+
wxRegion::wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
{
m_refData = new wxRegionRefData();
#endif
}
-wxRegion::wxRegion()
+wxRegion::~wxRegion()
{
}
-wxRegion::~wxRegion()
+bool wxRegion::operator==( const wxRegion& region )
{
+ // VZ: compare the regions themselves, not the pointers to ref data!
+ return gdk_region_equal(M_REGIONDATA->m_region,
+ M_REGIONDATA_OF(region)->m_region);
}
-bool wxRegion::operator == ( const wxRegion& region )
+bool wxRegion::operator != ( const wxRegion& region )
{
- return m_refData == region.m_refData;
+ return !(*this == region);
}
-bool wxRegion::operator != ( const wxRegion& region )
+void wxRegion::Unshare()
{
- return m_refData != region.m_refData;
+ if ( !m_refData )
+ {
+ m_refData = new wxRegionRefData;
+ M_REGIONDATA->m_region = gdk_region_new();
+ }
+ else if ( m_refData->GetRefCount() > 1 )
+ {
+ wxRegionRefData *refData = new wxRegionRefData(*M_REGIONDATA);
+ UnRef();
+ m_refData = refData;
+ }
+ //else: we're not shared
}
+// ----------------------------------------------------------------------------
+// wxRegion operations
+// ----------------------------------------------------------------------------
+
void wxRegion::Clear()
{
UnRef();
}
else
{
+ Unshare();
+
#ifdef __WXGTK20__
gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
#else
M_REGIONDATA->m_region = reg;
#endif
}
-
+
#if OLDCODE
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) );
#endif
if (region.IsNull())
return FALSE;
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
+ Unshare();
#ifdef __WXGTK20__
gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() );
bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( x, y, width, height );
- Intersect( reg );
- return TRUE;
+
+ return Intersect( reg );
}
bool wxRegion::Intersect( const wxRect& rect )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( rect );
- Intersect( reg );
- return TRUE;
+ return Intersect( reg );
}
-bool wxRegion::Intersect( const wxRegion& region )
+// this helper function just computes the region intersection without updating
+// the list of rectangles each region maintaints: this allows us to call it
+// from Intersect() itself without going into infinite recursion as we would
+// if we called Intersect() itself recursively
+bool wxRegion::IntersectRegionOnly(const wxRegion& region)
{
- if (region.IsNull())
- return FALSE;
+ Unshare();
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- return TRUE;
- }
-
#ifdef __WXGTK20__
gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() );
#else
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
#endif
+
return TRUE;
}
-bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+bool wxRegion::Intersect( const wxRegion& region )
{
+ if (region.IsNull())
+ return FALSE;
+
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
+ return TRUE;
+ }
+
+ if ( !IntersectRegionOnly(region) )
+ {
+ GetRectList()->Clear();
+
+ return FALSE;
+ }
+
+ // we need to update the rect list as well
+ wxList& list = *GetRectList();
+ wxNode *node = list.First();
+ while (node)
+ {
+ wxRect *r = (wxRect*)node->Data();
+
+ wxRegion regCopy = region;
+ if ( regCopy.IntersectRegionOnly(*r) )
+ {
+ // replace the node with the intersection
+ *r = regCopy.GetBox();
+ }
+ else
+ {
+ // TODO remove the rect from the list
+ r->width = 0;
+ r->height = 0;
+ }
+
+ node = node->Next();
}
- wxRegion reg( x, y, width, height );
- Subtract( reg );
return TRUE;
}
-bool wxRegion::Subtract( const wxRect& rect )
+bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
+ wxRegion reg( x, y, width, height );
+ return Subtract( reg );
+}
+bool wxRegion::Subtract( const wxRect& rect )
+{
wxRegion reg( rect );
- Subtract( reg );
- return TRUE;
+ return Subtract( reg );
}
bool wxRegion::Subtract( const wxRegion& region )
M_REGIONDATA->m_region = gdk_region_new();
}
+ Unshare();
+
#ifdef __WXGTK20__
gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() );
#else
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
#endif
+
return TRUE;
}
bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( x, y, width, height );
- Xor( reg );
- return TRUE;
+ return Xor( reg );
}
bool wxRegion::Xor( const wxRect& rect )
{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- M_REGIONDATA->m_region = gdk_region_new();
- }
-
wxRegion reg( rect );
- Xor( reg );
- return TRUE;
+ return Xor( reg );
}
bool wxRegion::Xor( const wxRegion& region )
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
+ else
+ {
+ Unshare();
+ }
#ifdef __WXGTK20__
gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() );
return TRUE;
}
+// ----------------------------------------------------------------------------
+// wxRegion tests
+// ----------------------------------------------------------------------------
+
void wxRegion::GetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const
{
- x = 0;
- y = 0;
- w = -1;
- h = -1;
- if (!m_refData)
- return;
-
- GdkRectangle rect;
- gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
- x = rect.x;
- y = rect.y;
- w = rect.width;
- h = rect.height;
+ if ( m_refData )
+ {
+ GdkRectangle rect;
+ gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
+ x = rect.x;
+ y = rect.y;
+ w = rect.width;
+ h = rect.height;
+ }
+ else
+ {
+ x = 0;
+ y = 0;
+ w = -1;
+ h = -1;
+ }
}
wxRect wxRegion::GetBox() const
{
- wxCoord x = 0;
- wxCoord y = 0;
- wxCoord w = -1;
- wxCoord h = -1;
+ wxCoord x, y, w, h;
GetBox( x, y, w, h );
return wxRect( x, y, w, h );
}
#endif
}
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxRegionIterator
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
#if OLDCODE
struct _XBox {
short x1, x2, y1, y2;
};
-
+
struct _XRegion {
long size , numRects;
_XBox *rects, extents;
return ((wxRIRefData*)m_refData)->m_rects[m_current].height;
}
+wxRect wxRegionIterator::GetRect() const
+{
+ wxRect r;
+ wxNode *node = m_region.GetRectList()->Nth( m_current );
+
+ if (node)
+ r = *((wxRect*)node->Data());
+
+ return r;
+}
+
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: scrolbar.cpp
+// Name: src/gtk/scrolbar.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#pragma implementation "scrolbar.h"
#endif
-#include "wx/scrolbar.h"
+#include "wx/defs.h"
#if wxUSE_SCROLLBAR
+#include "wx/scrolbar.h"
+
#include "wx/utils.h"
#include <math.h>
/////////////////////////////////////////////////////////////////////////////
-// Name: slider.cpp
+// Name: gtk/slider.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
+extern bool g_blockEventsOnDrag;
static const float sensitivity = 0.02;
double dvalue = adjust->value;
int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5);
- int orient = wxHORIZONTAL;
- if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
- orient = wxVERTICAL;
+ int orient = win->GetWindowStyleFlag() & wxSL_VERTICAL ? wxVERTICAL
+ : wxHORIZONTAL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
return 0;
}
-void wxSlider::SetTick( int WXUNUSED(tickPos) )
-{
-}
-
-void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
-{
-}
-
-int wxSlider::GetTickFreq() const
-{
- return 0;
-}
-
-void wxSlider::ClearTicks()
-{
-}
-
-void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
-{
-}
-
-int wxSlider::GetSelEnd() const
-{
- return 0;
-}
-
-int wxSlider::GetSelStart() const
-{
- return 0;
-}
-
-void wxSlider::ClearSel()
-{
-}
-
bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
{
GtkRange *range = GTK_RANGE(m_widget);
#pragma implementation "statbmp.h"
#endif
-#include "wx/statbmp.h"
+#include "wx/defs.h"
#if wxUSE_STATBMP
+#include "wx/statbmp.h"
+
#include "gdk/gdk.h"
#include "gtk/gtk.h"
mask = m_bitmap.GetMask()->GetBitmap();
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
- SetSizeOrDefault( size );
+ SetBestSize( size );
}
else
{
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
}
- SetSizeOrDefault();
+ SetBestSize(wxSize(bitmap.GetWidth(), bitmap.GetHeight()));
}
}
-wxSize wxStaticBitmap::DoGetBestSize() const
-{
- if ( m_bitmap.Ok() )
- return wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());
- else
- return wxSize(16, 16); // completely arbitrary
-}
+#endif // wxUSE_STATBMP
-#endif
#pragma implementation "statbox.h"
#endif
-#include "wx/statbox.h"
+#include "wx/defs.h"
#if wxUSE_STATBOX
+#include "wx/statbox.h"
+
#include "gdk/gdk.h"
#include "gtk/gtk.h"
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
- return FALSE;
+ return FALSE;
}
m_isStaticBox = TRUE;
-
+
if (label.IsEmpty())
m_widget = gtk_frame_new( (char*) NULL );
else
m_widget = gtk_frame_new( m_label.mbc_str() );
m_parent->DoAddChild( this );
-
+
PostCreation();
SetLabel(label);
-
+
SetFont( parent->GetFont() );
SetBackgroundColour( parent->GetBackgroundColour() );
gtk_widget_set_style( m_widget, m_widgetStyle );
}
-#endif
+#endif // wxUSE_STATBOX
#pragma implementation "stattext.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_STATTEXT
+
#include "wx/stattext.h"
#include "gdk/gdk.h"
return wxSize(req.width, req.height);
}
+#endif // wxUSE_STATTEXT
#endif
}
-bool wxTextCtrl::CanCopy() const
-{
- // Can copy if there's a selection
- long from, to;
- GetSelection(& from, & to);
- return (from != to) ;
-}
-
-bool wxTextCtrl::CanCut() const
-{
- // Can cut if there's a selection
- long from, to;
- GetSelection(& from, & to);
- return (from != to) && (IsEditable());
-}
-
-bool wxTextCtrl::CanPaste() const
-{
- return IsEditable() ;
-}
-
// Undo/redo
void wxTextCtrl::Undo()
{
/////////////////////////////////////////////////////////////////////////////
// Name: gtk/timer.cpp
-// Purpose:
+// Purpose: wxTimer implementation
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
#pragma implementation "timer.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_TIMER
+
#include "wx/timer.h"
#include "gtk/gtk.h"
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxTimer
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject)
+IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
static gint timeout_callback( gpointer data )
{
}
}
+#endif // wxUSE_TIMER
+
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
+#ifndef __WXUNIVERSAL__
if (pizza->shadow_type == GTK_MYSHADOW_NONE)
{
/* no border, no changes to sizes */
- } else
- if (pizza->shadow_type == GTK_MYSHADOW_THIN)
+ }
+ else if (pizza->shadow_type == GTK_MYSHADOW_THIN)
{
/* GTK_MYSHADOW_THIN == wxSIMPLE_BORDER */
attributes.x += 1;
attributes.y += 1;
attributes.width -= 2;
attributes.height -= 2;
- } else
+ }
+ else
{
/* GTK_MYSHADOW_IN == wxSUNKEN_BORDER */
/* GTK_MYSHADOW_OUT == wxRAISED_BORDER */
attributes.width -= 4;
attributes.height -= 4;
}
+#endif /* __WXUNIVERSAL__ */
/* minimal size */
if (attributes.width < 2) attributes.width = 2;
#include "wx/defs.h"
#include "wx/window.h"
-#include "wx/dc.h"
#include "wx/dcclient.h"
#include "wx/frame.h"
#include "wx/app.h"
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
extern wxCursor g_globalCursor;
-static wxWindow *g_captureWindow = (wxWindow*) NULL;
-/* extern */ wxWindow *g_focusWindow = (wxWindow*) NULL;
+// mouse capture state: the window which has it and if the mouse is currently
+// inside it
+static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL;
+static bool g_captureWindowHasMouse = FALSE;
+
+/* extern */ wxWindowGTK *g_focusWindow = (wxWindowGTK*) NULL;
+
+// the last window which had the focus - this is normally never NULL (except
+// if we never had focus at all) as even when g_focusWindow is NULL it still
+// keeps its previous value
+static wxWindowGTK *g_focusWindowLast = (wxWindowGTK *)NULL;
// if we detect that the app has got/lost the focus, we set this variable to
// either TRUE or FALSE and an activate event will be sent during the next
//-----------------------------------------------------------------------------
// returns the child of win which currently has focus or NULL if not found
+//
// Note: can't be static, needed by textctrl.cpp.
-/* static */ wxWindow *FindFocusedChild(wxWindow *win)
+wxWindow *FindFocusedChild(wxWindowGTK *win)
{
- wxWindow *winFocus = wxWindow::FindFocus();
+ wxWindowGTK *winFocus = wxWindowGTK::FindFocus();
if ( !winFocus )
- return (wxWindow *)NULL;
+ return (wxWindowGTK *)NULL;
if ( winFocus == win )
return win;
node;
node = node->GetNext() )
{
- wxWindow *child = FindFocusedChild(node->GetData());
+ wxWindowGTK *child = FindFocusedChild(node->GetData());
if ( child )
return child;
}
- return (wxWindow *)NULL;
+ return (wxWindowGTK *)NULL;
}
-static void draw_frame( GtkWidget *widget, wxWindow *win )
+static void draw_frame( GtkWidget *widget, wxWindowGTK *win )
{
+ // wxUniversal widgets draw the borders and scrollbars themselves
+#ifndef __WXUNIVERSAL__
if (!win->m_hasVMT)
return;
gdk_gc_unref( gc );
return;
}
+#endif // __WXUNIVERSAL__
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
-gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindowGTK *win )
{
if (gdk_event->count > 0) return FALSE;
-
+
draw_frame( widget, win );
-
+
return TRUE;
}
// "draw" of m_widget
//-----------------------------------------------------------------------------
-static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
+static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindowGTK *win )
{
draw_frame( widget, win );
}
win->GetSize( &w, &h );
if (w < 2) w = 2;
if (h < 2) h = 2;
-
+
requisition->height = h;
requisition->width = w;
}
// "expose_event" of m_wxwindow
//-----------------------------------------------------------------------------
-static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+static int gtk_window_expose_callback( GtkWidget *widget,
+ GdkEventExpose *gdk_event,
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
if (g_isIdle)
wxapp_install_idle_handler();
-
+
/*
if (win->GetName() == wxT("panel"))
{
(int)gdk_event->area.height );
}
*/
-
+
GtkPizza *pizza = GTK_PIZZA (widget);
if (win->GetThemeEnabled())
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
}
-
+
win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y,
gdk_event->area.width,
if (gdk_event->count == 0)
{
win->m_clipPaintRegion = TRUE;
-
- wxEraseEvent eevent( win->GetId() );
+
+ wxWindowDC dc(win);
+ dc.SetClippingRegion(win->GetUpdateRegion());
+ wxEraseEvent eevent( win->GetId(), &dc );
eevent.SetEventObject( win );
#if 1
- win->GetEventHandler()->ProcessEvent(eevent);
-#else
+ (void)win->GetEventHandler()->ProcessEvent(eevent);
+#else // 0
if (!win->GetEventHandler()->ProcessEvent(eevent))
{
wxClientDC dc( win );
dc.SetBrush( wxBrush( win->GetBackgroundColour(), wxSOLID ) );
dc.SetPen( *wxTRANSPARENT_PEN );
-
+
wxRegionIterator upd( win->GetUpdateRegion() );
while (upd)
{
upd ++;
}
}
-#endif
+#endif // 1/0
+
+ wxNcPaintEvent eventNc( win->GetId() );
+ eventNc.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( eventNc );
wxPaintEvent event( win->GetId() );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
-
+
win->GetUpdateRegion().Clear();
-
+
win->m_clipPaintRegion = FALSE;
}
-
- /* The following code will result in all window-less widgets
- being redrawn if the wxWindows class is given a chance to
- paint *anything* because it will then be allowed to paint
- over the window-less widgets */
-
- GList *children = pizza->children;
- while (children)
- {
- GtkPizzaChild *child = (GtkPizzaChild*) children->data;
- children = children->next;
- GdkEventExpose child_event = *gdk_event;
+ /* The following code will result in all window-less widgets
+ being redrawn if the wxWindows class is given a chance to
+ paint *anything* because it will then be allowed to paint
+ over the window-less widgets */
+ GList *children = pizza->children;
+ while (children)
+ {
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
+
+ GdkEventExpose child_event = *gdk_event;
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- GTK_WIDGET_DRAWABLE (child->widget) /* &&
- gtk_widget_intersect (child->widget, &gdk_event->area, &child_event.area)*/ )
- {
- child_event.area.x = child->widget->allocation.x;
- child_event.area.y = child->widget->allocation.y;
- child_event.area.width = child->widget->allocation.width;
- child_event.area.height = child->widget->allocation.height;
- gtk_widget_event (child->widget, (GdkEvent*) &child_event);
- }
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_WIDGET_DRAWABLE (child->widget) /* &&
+ gtk_widget_intersect (child->widget, &gdk_event->area, &child_event.area)*/ )
+ {
+ child_event.area.x = child->widget->allocation.x;
+ child_event.area.y = child->widget->allocation.y;
+ child_event.area.width = child->widget->allocation.width;
+ child_event.area.height = child->widget->allocation.height;
+ gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
-
+ }
+
return TRUE;
}
There, we look for expose events ourselves whereas all other events are
handled normally. */
-gint gtk_window_event_event_callback( GtkWidget *widget, GdkEventExpose *event, wxWindow *win )
+gint gtk_window_event_event_callback( GtkWidget *widget,
+ GdkEventExpose *event,
+ wxWindow *win )
{
if (event->type == GDK_EXPOSE)
{
/* This callback is a complete replacement of the gtk_pizza_draw() function,
which disabled. */
-static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win )
+static void gtk_window_draw_callback( GtkWidget *widget,
+ GdkRectangle *rect,
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
(int)rect->height );
}
*/
-
+
GtkPizza *pizza = GTK_PIZZA (widget);
if (win->GetThemeEnabled())
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, rect, parent->m_widget, "base", 0, 0, -1, -1);
}
-
-
+
+
if (!(GTK_WIDGET_APP_PAINTABLE (widget)) &&
(pizza->clear_on_draw))
{
gdk_window_clear_area( pizza->bin_window,
rect->x, rect->y, rect->width, rect->height);
}
-
+
win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height );
win->m_clipPaintRegion = TRUE;
-
- wxEraseEvent eevent( win->GetId() );
+
+ wxWindowDC dc(win);
+ dc.SetClippingRegion(win->GetUpdateRegion());
+ wxEraseEvent eevent( win->GetId(), &dc );
eevent.SetEventObject( win );
-
+
#if 1
- win->GetEventHandler()->ProcessEvent(eevent);
+ (void)win->GetEventHandler()->ProcessEvent(eevent);
#else
if (!win->GetEventHandler()->ProcessEvent(eevent))
{
wxClientDC dc( win );
dc.SetBrush( wxBrush( win->GetBackgroundColour(), wxSOLID ) );
dc.SetPen( *wxTRANSPARENT_PEN );
-
+
wxRegionIterator upd( win->GetUpdateRegion() );
while (upd)
{
}
#endif
+ wxNcPaintEvent eventNc( win->GetId() );
+ eventNc.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( eventNc );
+
wxPaintEvent event( win->GetId() );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
win->GetUpdateRegion().Clear();
-
+
win->m_clipPaintRegion = FALSE;
-
-
+
+
GList *children = pizza->children;
while (children)
{
// "key_press_event" from any window
//-----------------------------------------------------------------------------
-static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
+static gint gtk_window_key_press_callback( GtkWidget *widget,
+ GdkEventKey *gdk_event,
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
#if wxUSE_ACCEL
if (!ret)
{
- wxWindow *ancestor = win;
+ wxWindowGTK *ancestor = win;
while (ancestor)
{
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
if ( (!ret) &&
(gdk_event->keyval == GDK_F10) )
{
- wxWindow *ancestor = win;
+ wxWindowGTK *ancestor = win;
while (ancestor)
{
if (wxIsKindOf(ancestor,wxFrame))
// "key_release_event" from any window
//-----------------------------------------------------------------------------
-static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
+static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// for compatibility with MSW and common sense we want m_leftDown be TRUE
// for a LEFT_DOWN event, not FALSE, so we will invert
// left/right/middleDown for the corresponding click events
-
+
if ((event.GetEventType() == wxEVT_LEFT_DOWN) ||
(event.GetEventType() == wxEVT_LEFT_DCLICK) ||
(event.GetEventType() == wxEVT_LEFT_UP))
// "button_press_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
+static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
wxNode *node = win->GetChildren().First();
while (node)
{
- wxWindow *child = (wxWindow*)node->Data();
+ wxWindowGTK *child = (wxWindowGTK*)node->Data();
node = node->Next();
if (!child->IsShown())
// "button_release_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
+static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
wxNode *node = win->GetChildren().First();
while (node)
{
- wxWindow *child = (wxWindow*)node->Data();
+ wxWindowGTK *child = (wxWindowGTK*)node->Data();
node = node->Next();
if (!child->IsShown())
return FALSE;
}
+// ============================================================================
+// the mouse events
+// ============================================================================
+
+// init wxMouseEvent with the info from gdk_event
+#define InitMouseEvent(event, gdk_event) \
+ event.SetTimestamp( gdk_event->time ); \
+ event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); \
+ event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK); \
+ event.m_altDown = (gdk_event->state & GDK_MOD1_MASK); \
+ event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK); \
+ event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK); \
+ event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK); \
+ event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK); \
+\
+ event.m_x = (wxCoord)gdk_event->x; \
+ event.m_y = (wxCoord)gdk_event->y \
+
//-----------------------------------------------------------------------------
// "motion_notify_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
+static gint gtk_window_motion_notify_callback( GtkWidget *widget,
+ GdkEventMotion *gdk_event,
+ wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
*/
wxMouseEvent event( wxEVT_MOTION );
- event.SetTimestamp( gdk_event->time );
- event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
- event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
- event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
- event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
- event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
- event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
- event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
-
- event.m_x = (wxCoord)gdk_event->x;
- event.m_y = (wxCoord)gdk_event->y;
-
- // Some control don't have their own X window and thus cannot get
- // any events.
+ InitMouseEvent(event, gdk_event);
- if (!g_captureWindow)
+ if ( g_captureWindow )
{
+ // synthetize a mouse enter or leave event if needed
+ GdkWindow *winUnderMouse = gdk_window_at_pointer(NULL, NULL);
+ bool hasMouse = winUnderMouse == gdk_event->window;
+ if ( hasMouse != g_captureWindowHasMouse )
+ {
+ // the mouse changed window
+ g_captureWindowHasMouse = hasMouse;
+
+ wxMouseEvent event(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
+ : wxEVT_LEAVE_WINDOW);
+ InitMouseEvent(event, gdk_event);
+ event.SetEventObject(win);
+ win->GetEventHandler()->ProcessEvent(event);
+ }
+ }
+ else // no capture
+ {
+ // Some control don't have their own X window and thus cannot get
+ // any events.
+
wxCoord x = event.m_x;
wxCoord y = event.m_y;
if (win->m_wxwindow)
wxNode *node = win->GetChildren().First();
while (node)
{
- wxWindow *child = (wxWindow*)node->Data();
+ wxWindowGTK *child = (wxWindowGTK*)node->Data();
node = node->Next();
if (!child->IsShown())
// "focus_in_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
+static gint gtk_window_focus_in_callback( GtkWidget *widget,
+ GdkEvent *WXUNUSED(event),
+ wxWindow *win )
{
DEBUG_MAIN_THREAD
break;
}
+ g_focusWindowLast =
g_focusWindow = win;
/*
gdk_im_begin(win->m_ic, win->m_wxwindow->window);
#endif
-#ifdef wxUSE_CARET
+#if wxUSE_CARET
// caret needs to be informed about focus change
wxCaret *caret = win->GetCaret();
if ( caret )
// "focus_out_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
+static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// g_sendActivateEvent to -1
g_sendActivateEvent = 0;
- wxWindow *winFocus = FindFocusedChild(win);
+ wxWindowGTK *winFocus = FindFocusedChild(win);
if ( winFocus )
win = winFocus;
- g_focusWindow = (wxWindow *)NULL;
+ g_focusWindow = (wxWindowGTK *)NULL;
/*
printf( "OnKillFocus from " );
gdk_im_end();
#endif
-#ifdef wxUSE_CARET
+#if wxUSE_CARET
// caret needs to be informed about focus change
wxCaret *caret = win->GetCaret();
if ( caret )
// "enter_notify_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
gdk_window_get_pointer( widget->window, &x, &y, &state );
- event.m_shiftDown = (state & GDK_SHIFT_MASK);
- event.m_controlDown = (state & GDK_CONTROL_MASK);
- event.m_altDown = (state & GDK_MOD1_MASK);
- event.m_metaDown = (state & GDK_MOD2_MASK);
- event.m_leftDown = (state & GDK_BUTTON1_MASK);
- event.m_middleDown = (state & GDK_BUTTON2_MASK);
- event.m_rightDown = (state & GDK_BUTTON3_MASK);
+ InitMouseEvent(event, gdk_event);
event.m_x = x;
event.m_y = y;
// "leave_notify_event"
//-----------------------------------------------------------------------------
-static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// "value_changed" from m_vAdjust
//-----------------------------------------------------------------------------
-static void gtk_window_vscroll_callback( GtkAdjustment *adjust, wxWindow *win )
+static void gtk_window_vscroll_callback( GtkAdjustment *adjust, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
// "value_changed" from m_hAdjust
//-----------------------------------------------------------------------------
-static void gtk_window_hscroll_callback( GtkAdjustment *adjust, wxWindow *win )
+static void gtk_window_hscroll_callback( GtkAdjustment *adjust, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
GdkEventButton *gdk_event,
- wxWindow *win)
+ wxWindowGTK *win)
{
DEBUG_MAIN_THREAD
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
- wxWindow *win)
+ wxWindowGTK *win)
{
DEBUG_MAIN_THREAD
wxWindow *wxWindowBase::FindFocus()
{
- return g_focusWindow;
+ // the cast is necessary when we compile in wxUniversal mode
+ return (wxWindow *)g_focusWindow;
}
//-----------------------------------------------------------------------------
wxWindowCreateEvent event( win );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
-
+
return FALSE;
}
static
void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget),
GtkAllocation* WXUNUSED_UNLESS_XIM(alloc),
- wxWindow* WXUNUSED_UNLESS_XIM(win) )
+ wxWindowGTK* WXUNUSED_UNLESS_XIM(win) )
{
if (g_isIdle)
wxapp_install_idle_handler();
static gint
gtk_wxwindow_realized_callback( GtkWidget * WXUNUSED_UNLESS_XIM(widget),
- wxWindow * WXUNUSED_UNLESS_XIM(win) )
+ wxWindowGTK * WXUNUSED_UNLESS_XIM(win) )
{
if (g_isIdle)
wxapp_install_idle_handler();
GdkIMStyle style;
GdkIMStyle supported_style = (GdkIMStyle)
(GDK_IM_PREEDIT_NONE |
- GDK_IM_PREEDIT_NOTHING |
- GDK_IM_PREEDIT_POSITION |
- GDK_IM_STATUS_NONE |
- GDK_IM_STATUS_NOTHING);
+ GDK_IM_PREEDIT_NOTHING |
+ GDK_IM_PREEDIT_POSITION |
+ GDK_IM_STATUS_NONE |
+ GDK_IM_STATUS_NOTHING);
if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- supported_style = (GdkIMStyle)(supported_style & ~GDK_IM_PREEDIT_POSITION);
+ supported_style = (GdkIMStyle)(supported_style & ~GDK_IM_PREEDIT_POSITION);
attr->style = style = gdk_im_decide_style (supported_style);
attr->client_window = widget->window;
if ((colormap = gtk_widget_get_colormap (widget)) !=
- gtk_widget_get_default_colormap ())
+ gtk_widget_get_default_colormap ())
{
attrmask |= GDK_IC_PREEDIT_COLORMAP;
attr->preedit_colormap = colormap;
switch (style & GDK_IM_PREEDIT_MASK)
{
- case GDK_IM_PREEDIT_POSITION:
- if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- {
- g_warning ("over-the-spot style requires fontset");
- break;
- }
+ case GDK_IM_PREEDIT_POSITION:
+ if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
+ {
+ g_warning ("over-the-spot style requires fontset");
+ break;
+ }
- gdk_window_get_size (widget->window, &width, &height);
+ gdk_window_get_size (widget->window, &width, &height);
- attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
- attr->spot_location.x = 0;
- attr->spot_location.y = height;
- attr->preedit_area.x = 0;
- attr->preedit_area.y = 0;
- attr->preedit_area.width = width;
- attr->preedit_area.height = height;
- attr->preedit_fontset = widget->style->font;
+ attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
+ attr->spot_location.x = 0;
+ attr->spot_location.y = height;
+ attr->preedit_area.x = 0;
+ attr->preedit_area.y = 0;
+ attr->preedit_area.width = width;
+ attr->preedit_area.height = height;
+ attr->preedit_fontset = widget->style->font;
- break;
+ break;
}
win->m_ic = gdk_ic_new (attr, (GdkICAttributesType)attrmask);
if (win->m_ic == NULL)
- g_warning ("Can't create input context.");
+ g_warning ("Can't create input context.");
else
- {
- mask = gdk_window_get_events (widget->window);
- mask = (GdkEventMask)(mask | gdk_ic_get_events (win->m_ic));
- gdk_window_set_events (widget->window, mask);
-
- if (GTK_WIDGET_HAS_FOCUS(widget))
- gdk_im_begin (win->m_ic, widget->window);
- }
-#endif
+ {
+ mask = gdk_window_get_events (widget->window);
+ mask = (GdkEventMask)(mask | gdk_ic_get_events (win->m_ic));
+ gdk_window_set_events (widget->window, mask);
+
+ if (GTK_WIDGET_HAS_FOCUS(widget))
+ gdk_im_begin (win->m_ic, widget->window);
+ }
+#endif // HAVE_XIM
return FALSE;
}
//-----------------------------------------------------------------------------
-// InsertChild for wxWindow.
+// InsertChild for wxWindowGTK.
//-----------------------------------------------------------------------------
-/* Callback for wxWindow. This very strange beast has to be used because
+/* Callback for wxWindowGTK. This very strange beast has to be used because
* C++ has no virtual methods in a constructor. We have to emulate a
* virtual function here as wxNotebook requires a different way to insert
* a child in it. I had opted for creating a wxNotebookPage window class
* which would have made this superfluous (such in the MDI window system),
* but no-one was listening to me... */
-static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
+static void wxInsertChildInWindow( wxWindowGTK* parent, wxWindowGTK* child )
{
/* the window might have been scrolled already, do we
have to adapt the position */
// global functions
//-----------------------------------------------------------------------------
-wxWindow* wxGetActiveWindow()
+wxWindow *wxGetActiveWindow()
{
- return g_focusWindow;
+ // the cast is necessary when we compile in wxUniversal mode
+ return (wxWindow *)g_focusWindow;
}
//-----------------------------------------------------------------------------
-// wxWindow
+// wxWindowGTK
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+#ifdef __WXUNIVERSAL__
+ IMPLEMENT_DYNAMIC_CLASS(wxWindowGTK, wxWindowBase)
+#else
+ IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+#endif
-void wxWindow::Init()
+void wxWindowGTK::Init()
{
// common init
InitBase();
m_delayedForegroundColour = FALSE;
m_delayedBackgroundColour = FALSE;
-
+
#ifdef HAVE_XIM
m_ic = (GdkIC*) NULL;
m_icattr = (GdkICAttr*) NULL;
#endif
}
-wxWindow::wxWindow()
+wxWindowGTK::wxWindowGTK()
{
Init();
}
-wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name )
+wxWindowGTK::wxWindowGTK( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name )
{
Init();
Create( parent, id, pos, size, style, name );
}
-bool wxWindow::Create( wxWindow *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name )
+bool wxWindowGTK::Create( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name )
{
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
- wxFAIL_MSG( wxT("wxWindow creation failed") );
+ wxFAIL_MSG( wxT("wxWindowGTK creation failed") );
return FALSE;
}
m_insertCallback = wxInsertChildInWindow;
-
+
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
+#ifndef __WXUNIVERSAL__
#if (GTK_MINOR_VERSION > 0)
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
}
#endif // GTK_MINOR_VERSION
+#endif // __WXUNIVERSAL__
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
m_acceptsFocus = TRUE;
return TRUE;
}
-wxWindow::~wxWindow()
+wxWindowGTK::~wxWindowGTK()
{
if (g_focusWindow == this)
g_focusWindow = NULL;
// don't delete if it's a pixmap theme style
if (!m_widgetStyle->engine_data)
gtk_style_unref( m_widgetStyle );
-#endif
+#endif
m_widgetStyle = (GtkStyle*) NULL;
}
}
}
-bool wxWindow::PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size )
+bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size )
{
wxCHECK_MSG( !m_needParent || parent, FALSE, wxT("Need complete parent.") );
return TRUE;
}
-void wxWindow::PostCreation()
+void wxWindowGTK::PostCreation()
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
if (!m_noExpose)
{
/* these get reported to wxWindows -> wxPaintEvent */
-
+
gtk_pizza_set_external( GTK_PIZZA(m_wxwindow), TRUE );
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
else
{
// For dialogs and frames, we are interested mainly in
- // m_widget's focus.
+ // m_widget's focus.
gtk_signal_connect( GTK_OBJECT(m_widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_request",
GTK_SIGNAL_FUNC(gtk_window_size_request_callback), (gpointer) this );
}
-
+
m_hasVMT = TRUE;
}
-void wxWindow::ConnectWidget( GtkWidget *widget )
+void wxWindowGTK::ConnectWidget( GtkWidget *widget )
{
gtk_signal_connect( GTK_OBJECT(widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_window_key_press_callback), (gpointer)this );
GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
}
-bool wxWindow::Destroy()
+bool wxWindowGTK::Destroy()
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
return wxWindowBase::Destroy();
}
-void wxWindow::DoMoveWindow(int x, int y, int width, int height)
+void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height)
{
gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height );
}
-void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
+void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
- wxASSERT_MSG( (m_parent != NULL), wxT("wxWindow::SetSize requires parent.\n") );
+ wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") );
/*
printf( "DoSetSize: name %s, x,y,w,h: %d,%d,%d,%d \n", GetName().c_str(), x,y,width,height );
if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
-
+
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
/* don't set the size for children of wxNotebook, just take the values. */
if (m_hasScrolling)
{
- /* Sometimes the client area changes size without the
+ /* Sometimes the client area changes size without the
whole windows's size changing, but if the whole
windows's size doesn't change, no wxSizeEvent will
normally be sent. Here we add an extra test if
m_resizing = FALSE;
}
-void wxWindow::OnInternalIdle()
+void wxWindowGTK::OnInternalIdle()
{
if ( g_sendActivateEvent != -1 )
{
// do it only once
g_sendActivateEvent = -1;
+ wxTheApp->SetActive(activate, (wxWindow *)g_focusWindowLast);
+
wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
event.SetEventObject(this);
UpdateWindowUI();
}
-void wxWindow::DoGetSize( int *width, int *height ) const
+void wxWindowGTK::DoGetSize( int *width, int *height ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (height) (*height) = m_height;
}
-void wxWindow::DoSetClientSize( int width, int height )
+void wxWindowGTK::DoSetClientSize( int width, int height )
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
int dw = 0;
int dh = 0;
+#ifndef __WXUNIVERSAL__
if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
{
/* when using GTK 1.2 we set the shadow border size to 2 */
dw += 1 * 2;
dh += 1 * 2;
}
+#endif // __WXUNIVERSAL__
if (m_hasScrolling)
{
}
}
-void wxWindow::DoGetClientSize( int *width, int *height ) const
+void wxWindowGTK::DoGetClientSize( int *width, int *height ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
int dw = 0;
int dh = 0;
+#ifndef __WXUNIVERSAL__
if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
{
/* when using GTK 1.2 we set the shadow border size to 2 */
dw += 1 * 2;
dh += 1 * 2;
}
+#endif // __WXUNIVERSAL__
if (m_hasScrolling)
{
if (width) (*width) = m_width - dw;
if (height) (*height) = m_height - dh;
}
-
+
/*
printf( "GetClientSize, name %s ", GetName().c_str() );
if (width) printf( " width = %d", (*width) );
*/
}
-void wxWindow::DoGetPosition( int *x, int *y ) const
+void wxWindowGTK::DoGetPosition( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (y) (*y) = m_y - dy;
}
-void wxWindow::DoClientToScreen( int *x, int *y ) const
+void wxWindowGTK::DoClientToScreen( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (y) *y += org_y;
}
-void wxWindow::DoScreenToClient( int *x, int *y ) const
+void wxWindowGTK::DoScreenToClient( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (y) *y -= org_y;
}
-bool wxWindow::Show( bool show )
+bool wxWindowGTK::Show( bool show )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
return TRUE;
}
-int wxWindow::GetCharHeight() const
+int wxWindowGTK::GetCharHeight() const
{
wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") );
return font->ascent + font->descent;
}
-int wxWindow::GetCharWidth() const
+int wxWindowGTK::GetCharWidth() const
{
wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") );
return gdk_string_width( font, "H" );
}
-void wxWindow::GetTextExtent( const wxString& string,
+void wxWindowGTK::GetTextExtent( const wxString& string,
int *x,
int *y,
int *descent,
if (externalLeading) (*externalLeading) = 0; // ??
}
-void wxWindow::SetFocus()
+void wxWindowGTK::SetFocus()
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
}
}
-bool wxWindow::AcceptsFocus() const
+bool wxWindowGTK::AcceptsFocus() const
{
return m_acceptsFocus && wxWindowBase::AcceptsFocus();
}
-bool wxWindow::Reparent( wxWindowBase *newParentBase )
+bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
- wxWindow *oldParent = m_parent,
- *newParent = (wxWindow *)newParentBase;
+ wxWindowGTK *oldParent = m_parent,
+ *newParent = (wxWindowGTK *)newParentBase;
wxASSERT( GTK_IS_WIDGET(m_widget) );
return TRUE;
}
-void wxWindow::DoAddChild(wxWindow *child)
+void wxWindowGTK::DoAddChild(wxWindowGTK *child)
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
(*m_insertCallback)(this, child);
}
-void wxWindow::Raise()
+void wxWindowGTK::Raise()
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
gdk_window_raise( m_widget->window );
}
-void wxWindow::Lower()
+void wxWindowGTK::Lower()
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
gdk_window_lower( m_widget->window );
}
-bool wxWindow::SetCursor( const wxCursor &cursor )
+bool wxWindowGTK::SetCursor( const wxCursor &cursor )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
if (g_isIdle)
wxapp_install_idle_handler();
-
+
if (cursor == wxNullCursor)
return wxWindowBase::SetCursor( *wxSTANDARD_CURSOR );
else
return wxWindowBase::SetCursor( cursor );
}
-void wxWindow::WarpPointer( int x, int y )
+void wxWindowGTK::WarpPointer( int x, int y )
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
gdk_window_warp_pointer( window, x, y );
}
-void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
+void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
{
if (!m_widget) return;
if (!m_widget->window) return;
+ // temporarily hide the caret to avoid nasty interactions between caret
+ // drawing and the window contents redraw
+#if 0 // def wxUSE_CARET -- doesn't seem to help :-(
+ wxCaretSuspend cs((wxWindow *)this);
+#endif // wxUSE_CARET
+
if (eraseBackground && m_wxwindow && m_wxwindow->window)
{
if (rect)
gdk_event.area.y = 0;
gdk_event.area.width = m_wxwindow->allocation.width;
gdk_event.area.height = m_wxwindow->allocation.height;
- gtk_window_expose_callback( m_wxwindow, &gdk_event, this );
-
+ gtk_window_expose_callback( m_wxwindow, &gdk_event, (wxWindow *)this );
}
else
{
gdk_event.area.y = rect->y;
gdk_event.area.width = rect->width;
gdk_event.area.height = rect->height;
- gtk_window_expose_callback( m_wxwindow, &gdk_event, this );
+ gtk_window_expose_callback( m_wxwindow, &gdk_event, (wxWindow *)this );
}
else
{
}
}
-void wxWindow::Clear()
+void wxWindowGTK::Clear()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
}
#if wxUSE_TOOLTIPS
-void wxWindow::DoSetToolTip( wxToolTip *tip )
+void wxWindowGTK::DoSetToolTip( wxToolTip *tip )
{
wxWindowBase::DoSetToolTip(tip);
m_tooltip->Apply( this );
}
-void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
+void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{
gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
}
#endif // wxUSE_TOOLTIPS
-bool wxWindow::SetBackgroundColour( const wxColour &colour )
+bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
-bool wxWindow::SetForegroundColour( const wxColour &colour )
+bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
-GtkStyle *wxWindow::GetWidgetStyle()
+GtkStyle *wxWindowGTK::GetWidgetStyle()
{
if (m_widgetStyle)
{
return m_widgetStyle;
}
-void wxWindow::SetWidgetStyle()
+void wxWindowGTK::SetWidgetStyle()
{
#if DISABLE_STYLE_IF_BROKEN_THEM
if (m_widget->style->engine_data)
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
}
- else
+ else
{
// Try to restore the gtk default style. This is still a little
// oversimplified for what is probably really needed here for controls
// oversimplified for what is probably really needed here for controls
// other than buttons, but is better than not being able to (re)set a
// control's background colour to default grey and means resetting a
- // button to wxSYS_COLOUR_BTNFACE will restore its usual highlighting
+ // button to wxSYS_COLOUR_BTNFACE will restore its usual highlighting
// behavior -- RL
GtkStyle *def = gtk_rc_get_style( m_widget );
}
}
-void wxWindow::ApplyWidgetStyle()
+void wxWindowGTK::ApplyWidgetStyle()
{
}
// Pop-up menu stuff
//-----------------------------------------------------------------------------
+#if wxUSE_MENUS
+
static void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
{
*is_waiting = FALSE;
}
-static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
+static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
{
menu->SetInvokingWindow( win );
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
static void pop_pos_callback( GtkMenu * WXUNUSED(menu),
gint *x, gint *y,
- wxWindow *win )
+ wxWindowGTK *win )
{
win->ClientToScreen( &gs_pop_x, &gs_pop_y );
*x = gs_pop_x;
*y = gs_pop_y;
}
-bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
+bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
+#endif // wxUSE_MENUS
+
#if wxUSE_DRAG_AND_DROP
-void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
+void wxWindowGTK::SetDropTarget( wxDropTarget *dropTarget )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
#endif // wxUSE_DRAG_AND_DROP
-GtkWidget* wxWindow::GetConnectWidget()
+GtkWidget* wxWindowGTK::GetConnectWidget()
{
GtkWidget *connect_widget = m_widget;
if (m_wxwindow) connect_widget = m_wxwindow;
return connect_widget;
}
-bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
+bool wxWindowGTK::IsOwnGtkWindow( GdkWindow *window )
{
if (m_wxwindow)
return (window == GTK_PIZZA(m_wxwindow)->bin_window);
return (window == m_widget->window);
}
-bool wxWindow::SetFont( const wxFont &font )
+bool wxWindowGTK::SetFont( const wxFont &font )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
return TRUE;
}
-void wxWindow::CaptureMouse()
+void wxWindowGTK::CaptureMouse()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
cursor->GetCursor(),
(guint32)GDK_CURRENT_TIME );
g_captureWindow = this;
+ g_captureWindowHasMouse = TRUE;
}
-void wxWindow::ReleaseMouse()
+void wxWindowGTK::ReleaseMouse()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
return;
gdk_pointer_ungrab ( (guint32)GDK_CURRENT_TIME );
- g_captureWindow = (wxWindow*) NULL;
+ g_captureWindow = (wxWindowGTK*) NULL;
}
-bool wxWindow::IsRetained() const
+/* static */
+wxWindow *wxWindowBase::GetCapture()
+{
+ return (wxWindow *)g_captureWindow;
+}
+
+bool wxWindowGTK::IsRetained() const
{
return FALSE;
}
-void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
+void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
}
-void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
+void wxWindowGTK::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
}
}
-int wxWindow::GetScrollThumb( int orient ) const
+int wxWindowGTK::GetScrollThumb( int orient ) const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") );
return (int)(m_vAdjust->page_size+0.5);
}
-int wxWindow::GetScrollPos( int orient ) const
+int wxWindowGTK::GetScrollPos( int orient ) const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") );
return (int)(m_vAdjust->value+0.5);
}
-int wxWindow::GetScrollRange( int orient ) const
+int wxWindowGTK::GetScrollRange( int orient ) const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") );
return (int)(m_vAdjust->upper+0.5);
}
-void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
+void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
-
+
if ((dx == 0) && (dy == 0)) return;
m_clipPaintRegion = TRUE;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = FALSE;
-
-/*
+
+/*
if (m_children.GetCount() > 0)
{
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
else
{
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
-
+
pizza->xoffset -= dx;
pizza->yoffset -= dy;
-
+
GdkGC *m_scrollGC = gdk_gc_new( pizza->bin_window );
gdk_gc_set_exposures( m_scrollGC, TRUE );
if ((h < 0) || (w < 0))
{
Refresh();
- }
+ }
else
{
int s_x = 0;
Refresh( TRUE, &rect );
}
-
+
gdk_gc_unref( m_scrollGC );
}
*/
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MOTIF.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
common/choiccmn.cpp \
common/clipcmn.cpp \
common/cmdline.cpp \
+ common/cmdproc.cpp \
common/cmndata.cpp \
common/config.cpp \
common/cshelp.cpp \
choice.h \
clipbrd.h \
cmdline.h \
+ cmdproc.cpp \
cmndata.h \
colordlg.h \
colour.h \
choiccmn.o \
clipcmn.o \
cmdline.o \
+ cmdproc.o \
cmndata.o \
config.o \
cshelp.o \
choiccmn.d \
clipcmn.d \
cmdline.d \
+ cmdproc.d \
cmndata.d \
config.d \
cshelp.d \
#endif
#ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/setup.h"
-#include "wx/window.h"
+ #include "wx/window.h"
#endif
-#include "wx/msw/accel.h"
+#include "wx/accel.h"
#include "wx/msw/private.h"
m_refData = new wxAcceleratorRefData;
ACCEL* arr = new ACCEL[n];
- int i;
- for (i = 0; i < n; i++)
+ for ( int i = 0; i < n; i++ )
{
+ int flags = entries[i].GetFlags();
+
BYTE fVirt = 0;
- if (entries[i].m_flags & wxACCEL_ALT)
- {
- fVirt |= FALT;
- fVirt |= FVIRTKEY;
- }
- if (entries[i].m_flags & wxACCEL_SHIFT)
- {
- fVirt |= FSHIFT;
- fVirt |= FVIRTKEY;
- }
- if (entries[i].m_flags & wxACCEL_CTRL)
- {
- fVirt |= FCONTROL;
- fVirt |= FVIRTKEY;
- }
+ if ( flags & wxACCEL_ALT )
+ fVirt |= FALT | FVIRTKEY;
+ if ( flags & wxACCEL_SHIFT )
+ fVirt |= FSHIFT | FVIRTKEY;
+ if ( flags & wxACCEL_CTRL )
+ fVirt |= FCONTROL | FVIRTKEY;
bool isVirtual;
- WORD key = wxCharCodeWXToMSW(entries[i].m_keyCode, & isVirtual);
+
+ WORD key = wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual);
if (isVirtual)
fVirt |= FVIRTKEY;
- WORD cmd = entries[i].m_command;
-
arr[i].fVirt = fVirt;
arr[i].key = key;
- arr[i].cmd = cmd;
+ arr[i].cmd = entries[i].GetCommand();
}
M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(arr, n);
#endif // __WIN95__
-#if wxUSE_OLE
+#if wxUSE_OLE || wxUSE_DRAG_AND_DROP || wxUSE_DATAOBJ
#ifdef __WIN16__
// for OLE, enlarge message queue to be as large as possible
// we need to initialize OLE library
if ( FAILED(::OleInitialize(NULL)) )
wxLogError(_("Cannot initialize OLE"));
+
#endif // wxUSE_OLE
#if wxUSE_CTL3D
wxLogError(wxT("Cannot register CTL3D"));
Ctl3dAutoSubclass(wxhInstance);
-#endif
+#endif // wxUSE_CTL3D
// VZ: these icons are not in wx.rc anyhow (but should they?)!
#if 0
// GL: I'm annoyed ... I don't know where to put this and I don't want to
// create a module for that as it's part of the core.
delete wxPendingEvents;
+
#if wxUSE_THREADS
delete wxPendingEventsLocker;
- // If we don't do the following, we get an apparent memory leak.
+ // If we don't do the following, we get an apparent memory leak
#if wxUSE_VALIDATORS
((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
-#endif
-#endif
+#endif // wxUSE_VALIDATORS
+#endif // wxUSE_THREADS
wxClassInfo::CleanUpClasses();
int WXDLLEXPORT wxEntryInitGui()
{
- wxTheApp->OnInitGui();
- return 0;
+ return wxTheApp->OnInitGui();
}
void WXDLLEXPORT wxEntryCleanup()
wxTheApp->ConvertToStandardCommandArgs(lpCmdLine);
wxTheApp->m_nCmdShow = nCmdShow;
- // GUI-specific initialisation. In fact on Windows we don't have any,
- // but this call is provided for compatibility across platforms.
- wxEntryInitGui();
-
// We really don't want timestamps by default, because it means
// we can't simply double-click on the error message and get to that
// line in the source. So VC++ at least, let's have a sensible default.
wxTheApp->SetExitOnFrameDelete(FALSE);
// init the app
- retValue = wxTheApp->OnInit() ? 0 : -1;
+ retValue = wxEntryInitGui() && wxTheApp->OnInit() ? 0 : -1;
// restore the old flag value
wxTheApp->SetExitOnFrameDelete(exitOnLastFrameDelete);
wxApp::wxApp()
{
- m_topWindow = NULL;
- wxTheApp = this;
- m_wantDebugOutput = TRUE;
-
argc = 0;
argv = NULL;
m_printMode = wxPRINT_WINDOWS;
- m_exitOnFrameDelete = TRUE;
m_auto3D = TRUE;
}
bool ok = TRUE;
+ // SelectObject() will fail
+ wxASSERT_MSG( !bitmap.GetSelectedInto(),
+ _T("bitmap can't be selected in another DC") );
+
HGDIOBJ hbmpSrcOld = ::SelectObject(srcDC, GetHbitmapOf(bitmap));
if ( !hbmpSrcOld )
{
/////////////////////////////////////////////////////////////////////////////
-// Name: bmpbuttn.cpp
+// Name: src/msw/bmpbuttn.cpp
// Purpose: wxBitmapButton
// Author: Julian Smart
// Modified by:
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_BMPBUTTON
+
#ifndef WX_PRECOMP
#include "wx/bmpbuttn.h"
#include "wx/log.h"
const wxValidator& validator,
const wxString& name)
{
- m_buttonBitmap = bitmap;
+ m_bmpNormal = bitmap;
SetName(name);
#if wxUSE_VALIDATORS
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowStyle = style;
- m_marginX = 0;
- m_marginY = 0;
if ( style & wxBU_AUTODRAW )
{
return TRUE;
}
-void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
-{
- m_buttonBitmap = bitmap;
-}
-
// VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN
#define FOCUS_MARGIN 3
// choose the bitmap to use depending on the button state
wxBitmap* bitmap;
- if ( isSelected && m_buttonBitmapSelected.Ok() )
- bitmap = &m_buttonBitmapSelected;
- else if ((state & ODS_FOCUS) && m_buttonBitmapFocus.Ok())
- bitmap = &m_buttonBitmapFocus;
- else if ((state & ODS_DISABLED) && m_buttonBitmapDisabled.Ok())
- bitmap = &m_buttonBitmapDisabled;
+ if ( isSelected && m_bmpSelected.Ok() )
+ bitmap = &m_bmpSelected;
+ else if ((state & ODS_FOCUS) && m_bmpFocus.Ok())
+ bitmap = &m_bmpFocus;
+ else if ((state & ODS_DISABLED) && m_bmpDisabled.Ok())
+ bitmap = &m_bmpDisabled;
else
- bitmap = &m_buttonBitmap;
+ bitmap = &m_bmpNormal;
if ( !bitmap->Ok() )
return FALSE;
{
wxButton::SetDefault();
}
+
+#endif // wxUSE_BMPBUTTON
#pragma hdrstop
#endif
+#if wxUSE_BUTTON
+
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/brush.h"
}
/* static */
-wxSize wxButton::GetDefaultSize()
+wxSize wxButtonBase::GetDefaultSize()
{
static wxSize s_sizeBtn;
}
#endif // __WIN32__
+
+#endif // wxUSE_BUTTON
+
wxASSERT_MSG( GetWindow(), wxT("caret without window cannot be shown") );
wxASSERT_MSG( IsOk(), wxT("caret of zero size cannot be shown") );
+ // we might not have created the caret yet if we had got the focus first
+ // and the caret was shown later - so do it now if we have the focus but
+ // not the caret
+ if ( !m_hasCaret && (wxWindow::FindFocus() == GetWindow()) )
+ {
+ if ( MSWCreateCaret() )
+ {
+ DoMove();
+ }
+ }
+
if ( m_hasCaret )
{
CALL_CARET_API(ShowCaret, (GetWinHwnd(GetWindow())));
wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(),
wxT("how did we lose focus?") );
- CALL_CARET_API(SetCaretPos, (m_x, m_y));
+ // for compatibility with the generic version, the coordinates are
+ // client ones
+ wxPoint pt = GetWindow()->GetClientAreaOrigin();
+ CALL_CARET_API(SetCaretPos, (m_x + pt.x, m_y + pt.y));
}
//else: we don't have caret right now, nothing to do (this does happen)
}
#pragma hdrstop
#endif
+#if wxUSE_CHECKBOX
+
#ifndef WX_PRECOMP
#include "wx/checkbox.h"
#include "wx/brush.h"
{
wxFAIL_MSG(wxT("not implemented"));
}
+
+#endif // wxUSE_CHECKBOX
#pragma hdrstop
#endif
+#if wxUSE_CHOICE
+
#ifndef WX_PRECOMP
#include "wx/choice.h"
#include "wx/utils.h"
return (WXHBRUSH)brush->GetResourceHandle();
}
-
+#endif // wxUSE_CHOICE
// wxDataObject is tied to OLE/drag and drop implementation, therefore so are
// the functions using wxDataObject in wxClipboard
-#define wxUSE_DATAOBJ wxUSE_DRAG_AND_DROP
+//#define wxUSE_DATAOBJ wxUSE_DRAG_AND_DROP
#if wxUSE_DATAOBJ
#include "wx/dataobj.h"
/////////////////////////////////////////////////////////////////////////////
-// Name: control.cpp
+// Name: msw/control.cpp
// Purpose: wxControl class
// Author: Julian Smart
// Modified by:
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation "control.h"
+ #pragma implementation "control.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_CONTROLS
+
#ifndef WX_PRECOMP
-#include "wx/event.h"
-#include "wx/app.h"
-#include "wx/dcclient.h"
-#include "wx/log.h"
+ #include "wx/event.h"
+ #include "wx/app.h"
+ #include "wx/dcclient.h"
+ #include "wx/log.h"
#endif
#include "wx/control.h"
rect->bottom = bottom;
}
+#endif // wxUSE_CONTROLS
wxCursor *wxCROSS_CURSOR = NULL;
// 'Null' objects
+#if wxUSE_ACCEL
wxAcceleratorTable wxNullAcceleratorTable;
+#endif // wxUSE_ACCEL
+
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
// clipping
// ---------------------------------------------------------------------------
-#define DO_SET_CLIPPING_BOX() \
-{ \
- RECT rect; \
- \
- GetClipBox(GetHdc(), &rect); \
- \
- m_clipX1 = (wxCoord) XDEV2LOG(rect.left); \
- m_clipY1 = (wxCoord) YDEV2LOG(rect.top); \
- m_clipX2 = (wxCoord) XDEV2LOG(rect.right); \
- m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom); \
+void wxDC::UpdateClipBox()
+{
+ RECT rect;
+ GetClipBox(GetHdc(), &rect);
+
+ m_clipX1 = (wxCoord) XDEV2LOG(rect.left);
+ m_clipY1 = (wxCoord) YDEV2LOG(rect.top);
+ m_clipX2 = (wxCoord) XDEV2LOG(rect.right);
+ m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom);
}
void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
// the region coords are always the device ones, so do the translation
// manually
+ //
+ // FIXME: possible +/-1 error here, to check!
HRGN hrgn = ::CreateRectRgn(LogicalToDeviceX(x),
LogicalToDeviceY(y),
LogicalToDeviceX(x + w),
wxLogLastError(_T("SelectClipRgn"));
}
- DO_SET_CLIPPING_BOX()
+ UpdateClipBox();
}
}
void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
{
- wxCHECK_RET( region.GetHRGN(), wxT("invalid clipping region") );
+ wxCHECK_RET( GetHrgnOf(region), wxT("invalid clipping region") );
m_clipping = TRUE;
#ifdef __WIN16__
- SelectClipRgn(GetHdc(), (HRGN) region.GetHRGN());
-#else
- ExtSelectClipRgn(GetHdc(), (HRGN) region.GetHRGN(), RGN_AND);
-#endif
+ SelectClipRgn(GetHdc(), GetHrgnOf(region));
+#else // Win32
+ ExtSelectClipRgn(GetHdc(), GetHrgnOf(region), RGN_AND);
+#endif // Win16/32
- DO_SET_CLIPPING_BOX()
+ UpdateClipBox();
}
void wxDC::DestroyClippingRegion()
SelectClipRgn(GetHdc(), rgn);
DeleteObject(rgn);
}
+
m_clipping = FALSE;
}
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
-IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
+IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC)
// ----------------------------------------------------------------------------
// global variables
// m_bOwnsDC was already set to false in the base class ctor, so the DC
// will be released (and not deleted) in ~wxDC
-
InitDC();
}
InitDC();
}
+void wxClientDC::InitDC()
+{
+ wxWindowDC::InitDC();
+
+ // in wxUniv build we must manually do some DC adjustments usually
+ // performed by Windows for us
+#ifdef __WXUNIVERSAL__
+ wxPoint ptOrigin = m_canvas->GetClientAreaOrigin();
+ if ( ptOrigin.x || ptOrigin.y )
+ {
+ // no need to shift DC origin if shift is null
+ SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
+ }
+
+ // clip the DC to avoid overwriting the non client area
+ SetClippingRegion(wxPoint(0, 0), m_canvas->GetClientSize());
+#endif // __WXUNIVERSAL__
+}
+
+wxClientDC::~wxClientDC()
+{
+}
+
// ----------------------------------------------------------------------------
// wxPaintDC
// ----------------------------------------------------------------------------
ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
}
+ // (re)set the DC parameters
InitDC();
}
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
+
#ifdef __GNUG__
#pragma implementation "dirdlg.h"
#endif
#pragma hdrstop
#endif
+#if wxUSE_DIRDLG
+
#if defined(__WIN95__) && !defined(__GNUWIN32_OLD__)
#ifndef WX_PRECOMP
#else
#include "../generic/dirdlgg.cpp"
#endif // compiler/platform on which the code here compiles
+
+#endif // wxUSE_DIRDLG
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/msw/private.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
+#if wxUSE_DRAGIMAG
+
#if defined(__WIN95__)
#ifndef WX_PRECOMP
#include "wx/settings.h"
#endif
+#include "wx/msw/private.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/frame.h"
#endif
// __WIN95__
+#endif // wxUSE_DRAGIMAG
#pragma hdrstop
#endif
+#if wxUSE_FILEDLG
+
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/msgdlg.h"
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
}
+#endif // wxUSE_FILEDLG
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MSW.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
common/choiccmn.cpp \
common/clipcmn.cpp \
common/cmdline.cpp \
+ common/cmdproc.cpp \
common/cmndata.cpp \
common/config.cpp \
common/cshelp.cpp \
choice.h \
clipbrd.h \
cmdline.h \
+ cmdproc.cpp \
cmndata.h \
colordlg.h \
colour.h \
choiccmn.o \
clipcmn.o \
cmdline.o \
+ cmdproc.o \
cmndata.o \
config.o \
cshelp.o \
choiccmn.d \
clipcmn.d \
cmdline.d \
+ cmdproc.d \
cmndata.d \
config.d \
cshelp.d \
#include "wx/tokenzr.h"
#include "wx/msw/private.h"
+#include "wx/tokenzr.h"
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
return M_FONTDATA->m_encoding;
}
-wxNativeFontInfo *wxFont::GetNativeFontInfo() const
+// ----------------------------------------------------------------------------
+// wxNativeFontInfo
+// ----------------------------------------------------------------------------
+
+bool wxNativeFontInfo::FromString(const wxString& s)
{
- if( M_FONTDATA->m_nativeFontInfoOk )
- return new wxNativeFontInfo(M_FONTDATA->m_nativeFontInfo);
+ long l;
+
+ wxStringTokenizer tokenizer(s, _T(";"));
+
+ wxString token = tokenizer.GetNextToken();
+ //
+ // Ignore the version for now
+ //
- return 0;
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfHeight = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfWidth = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfEscapement = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfOrientation = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfWeight = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfItalic = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfUnderline = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfStrikeOut = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfCharSet = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfOutPrecision = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfClipPrecision = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfQuality = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfPitchAndFamily = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if(!token)
+ return FALSE;
+ wxStrcpy(lf.lfFaceName, token.c_str());
+
+ return TRUE;
+}
+
+wxString wxNativeFontInfo::ToString() const
+{
+ wxString s;
+
+ s.Printf(_T("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%s"),
+ 0, // version, in case we want to change the format later
+ lf.lfHeight,
+ lf.lfWidth,
+ lf.lfEscapement,
+ lf.lfOrientation,
+ lf.lfWeight,
+ lf.lfItalic,
+ lf.lfUnderline,
+ lf.lfStrikeOut,
+ lf.lfCharSet,
+ lf.lfOutPrecision,
+ lf.lfClipPrecision,
+ lf.lfQuality,
+ lf.lfPitchAndFamily,
+ lf.lfFaceName);
+
+ return s;
}
/////////////////////////////////////////////////////////////////////////////
-// Name: fontdlg.cpp
+// Name: src/msw/fontdlg.cpp
// Purpose: wxFontDialog class
// Author: Julian Smart
// Modified by:
#pragma hdrstop
#endif
+#if wxUSE_FONTDLG
+
#ifndef WX_PRECOMP
#include "wx/defs.h"
#include "wx/utils.h"
return wxID_CANCEL;
}
}
+
+#endif // wxUSE_FONTDLG
#pragma hdrstop
#endif
+#if wxUSE_FONTMAP
+
#ifndef WX_PRECOMP
#include "wx/font.h"
#endif
return fontEnum->OnFont(lplf, lptm);
}
+#endif // wxUSE_FONTMAP
wxFontEncoding encoding = font->GetEncoding();
if ( !wxGetNativeFontEncoding(encoding, &info) )
{
+#if wxUSE_FONTMAP
if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
+#endif // wxUSE_FONTMAP
{
// unsupported encoding, replace with the default
info.charset = ANSI_CHARSET;
/////////////////////////////////////////////////////////////////////////////
// Name: msw/frame.cpp
-// Purpose: wxFrame
+// Purpose: wxFrameMSW
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
#endif
#ifndef WX_PRECOMP
- #include "wx/setup.h"
#include "wx/frame.h"
- #include "wx/menu.h"
#include "wx/app.h"
+ #include "wx/menu.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/settings.h"
#include "wx/menuitem.h"
#include "wx/log.h"
+#ifdef __WXUNIVERSAL__
+ #include "wx/univ/theme.h"
+ #include "wx/univ/colschem.h"
+#endif // __WXUNIVERSAL__
+
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
extern wxWindowList wxModelessWindows;
extern wxList WXDLLEXPORT wxPendingDelete;
extern const wxChar *wxFrameClassName;
+
+#if wxUSE_MENUS_NATIVE
extern wxMenu *wxCurrentPopupMenu;
+#endif // wxUSE_MENUS_NATIVE
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
- EVT_ACTIVATE(wxFrame::OnActivate)
- EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
+BEGIN_EVENT_TABLE(wxFrameMSW, wxFrameBase)
+ EVT_ACTIVATE(wxFrameMSW::OnActivate)
+ EVT_SYS_COLOUR_CHANGED(wxFrameMSW::OnSysColourChanged)
END_EVENT_TABLE()
-IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
+IMPLEMENT_DYNAMIC_CLASS(wxFrameMSW, wxWindow)
// ============================================================================
// implementation
// static class members
// ----------------------------------------------------------------------------
-#if wxUSE_NATIVE_STATUSBAR
- bool wxFrame::m_useNativeStatusBar = TRUE;
-#else
- bool wxFrame::m_useNativeStatusBar = FALSE;
-#endif
+#if wxUSE_STATUSBAR
+ #if wxUSE_NATIVE_STATUSBAR
+ bool wxFrameMSW::m_useNativeStatusBar = TRUE;
+ #else
+ bool wxFrameMSW::m_useNativeStatusBar = FALSE;
+ #endif
+#endif // wxUSE_NATIVE_STATUSBAR
// ----------------------------------------------------------------------------
// creation/destruction
// ----------------------------------------------------------------------------
-void wxFrame::Init()
+void wxFrameMSW::Init()
{
m_iconized =
m_maximizeOnShow = FALSE;
m_isShown = FALSE;
}
-bool wxFrame::Create(wxWindow *parent,
+bool wxFrameMSW::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
{
SetName(name);
m_windowStyle = style;
+#if wxUSE_MENUS
m_frameMenuBar = NULL;
+#endif // wxUSE_MENUS
+#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
+#endif // wxUSE_TOOLBAR
+#if wxUSE_STATUSBAR
m_frameStatusBar = NULL;
+#endif // wxUSE_STATUSBAR
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
return TRUE;
}
-wxFrame::~wxFrame()
+wxFrameMSW::~wxFrameMSW()
{
m_isBeingDeleted = TRUE;
wxTopLevelWindows.DeleteObject(this);
}
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
-void wxFrame::DoGetClientSize(int *x, int *y) const
+void wxFrameMSW::DoGetClientSize(int *x, int *y) const
{
RECT rect;
::GetClientRect(GetHwnd(), &rect);
// Set the client size (i.e. leave the calculation of borders etc.
// to wxWindows)
-void wxFrame::DoSetClientSize(int width, int height)
+void wxFrameMSW::DoSetClientSize(int width, int height)
{
HWND hWnd = GetHwnd();
GetEventHandler()->ProcessEvent(event);
}
-void wxFrame::DoGetSize(int *width, int *height) const
+void wxFrameMSW::DoGetSize(int *width, int *height) const
{
RECT rect;
::GetWindowRect(GetHwnd(), &rect);
*height = rect.bottom - rect.top;
}
-void wxFrame::DoGetPosition(int *x, int *y) const
+void wxFrameMSW::DoGetPosition(int *x, int *y) const
{
RECT rect;
::GetWindowRect(GetHwnd(), &rect);
// variations around ::ShowWindow()
// ----------------------------------------------------------------------------
-void wxFrame::DoShowWindow(int nShowCmd)
+void wxFrameMSW::DoShowWindow(int nShowCmd)
{
::ShowWindow(GetHwnd(), nShowCmd);
m_iconized = nShowCmd == SW_MINIMIZE;
}
-bool wxFrame::Show(bool show)
+bool wxFrameMSW::Show(bool show)
{
// don't use wxWindow version as we want to call DoShowWindow()
if ( !wxWindowBase::Show(show) )
return TRUE;
}
-void wxFrame::Iconize(bool iconize)
+void wxFrameMSW::Iconize(bool iconize)
{
DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
}
-void wxFrame::Maximize(bool maximize)
+void wxFrameMSW::Maximize(bool maximize)
{
if ( IsShown() )
{
}
}
-void wxFrame::Restore()
+void wxFrameMSW::Restore()
{
DoShowWindow(SW_RESTORE);
}
-bool wxFrame::IsIconized() const
+bool wxFrameMSW::IsIconized() const
{
- ((wxFrame *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
+ ((wxFrameMSW *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
return m_iconized;
}
// Is it maximized?
-bool wxFrame::IsMaximized() const
+bool wxFrameMSW::IsMaximized() const
{
return (::IsZoomed(GetHwnd()) != 0);
}
-void wxFrame::SetIcon(const wxIcon& icon)
+void wxFrameMSW::SetIcon(const wxIcon& icon)
{
wxFrameBase::SetIcon(icon);
}
#if wxUSE_STATUSBAR
-wxStatusBar *wxFrame::OnCreateStatusBar(int number,
+wxStatusBar *wxFrameMSW::OnCreateStatusBar(int number,
long style,
wxWindowID id,
const wxString& name)
return statusBar;
}
-void wxFrame::PositionStatusBar()
+void wxFrameMSW::PositionStatusBar()
{
if ( !m_frameStatusBar )
return;
}
#endif // wxUSE_STATUSBAR
-void wxFrame::DetachMenuBar()
+void wxFrameMSW::DetachMenuBar()
{
+#if wxUSE_MENUS
if ( m_frameMenuBar )
{
m_frameMenuBar->Detach();
m_frameMenuBar = NULL;
}
+#endif // wxUSE_MENUS
}
-void wxFrame::SetMenuBar(wxMenuBar *menubar)
+void wxFrameMSW::SetMenuBar(wxMenuBar *menubar)
{
+#if wxUSE_MENUS
+ // detach the old menu bar in any case
+ DetachMenuBar();
+
+#if wxUSE_MENUS_NATIVE
if ( !menubar )
{
- DetachMenuBar();
-
// actually remove the menu from the frame
m_hMenu = (WXHMENU)0;
InternalSetMenuBar();
}
else // set new non NULL menu bar
{
- m_frameMenuBar = NULL;
-
// Can set a menubar several times.
- // TODO: how to prevent a memory leak if you have a currently-unattached
- // menubar? wxWindows assumes that the frame will delete the menu (otherwise
- // there are problems for MDI).
if ( menubar->GetHMenu() )
{
m_hMenu = menubar->GetHMenu();
}
InternalSetMenuBar();
+ }
+#endif // wxUSE_MENUS_NATIVE
+ if ( menubar )
+ {
m_frameMenuBar = menubar;
- menubar->Attach(this);
+ menubar->Attach((wxFrame *)this);
}
+#endif // wxUSE_MENUS
}
-void wxFrame::InternalSetMenuBar()
+#if wxUSE_MENUS_NATIVE
+
+void wxFrameMSW::InternalSetMenuBar()
{
if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
{
}
}
+#endif // wxUSE_MENUS_NATIVE
+
// Responds to colour changes, and passes event on to children.
-void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
+void wxFrameMSW::OnSysColourChanged(wxSysColourChangedEvent& event)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
Refresh();
+#if wxUSE_STATUSBAR
if ( m_frameStatusBar )
{
wxSysColourChangedEvent event2;
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent(event2);
}
+#endif // wxUSE_STATUSBAR
// Propagate the event to the non-top-level children
wxWindow::OnSysColourChanged(event);
}
// Pass TRUE to show full screen, FALSE to restore.
-bool wxFrame::ShowFullScreen(bool show, long style)
+bool wxFrameMSW::ShowFullScreen(bool show, long style)
{
if (show)
{
m_fsIsShowing = TRUE;
m_fsStyle = style;
+#if wxUSE_TOOLBAR
wxToolBar *theToolBar = GetToolBar();
- wxStatusBar *theStatusBar = GetStatusBar();
-
- int dummyWidth;
-
if (theToolBar)
- theToolBar->GetSize(&dummyWidth, &m_fsToolBarHeight);
- if (theStatusBar)
- theStatusBar->GetSize(&dummyWidth, &m_fsStatusBarHeight);
+ theToolBar->GetSize(NULL, &m_fsToolBarHeight);
// zap the toolbar, menubar, and statusbar
theToolBar->SetSize(-1,0);
theToolBar->Show(FALSE);
}
+#endif // wxUSE_TOOLBAR
if (style & wxFULLSCREEN_NOMENUBAR)
SetMenu((HWND)GetHWND(), (HMENU) NULL);
+#if wxUSE_STATUSBAR
+ wxStatusBar *theStatusBar = GetStatusBar();
+ if (theStatusBar)
+ theStatusBar->GetSize(NULL, &m_fsStatusBarHeight);
+
// Save the number of fields in the statusbar
if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar)
{
}
else
m_fsStatusBarFields = 0;
+#endif // wxUSE_STATUSBAR
// zap the frame borders
m_fsIsShowing = FALSE;
+#if wxUSE_TOOLBAR
wxToolBar *theToolBar = GetToolBar();
// restore the toolbar, menubar, and statusbar
theToolBar->SetSize(-1, m_fsToolBarHeight);
theToolBar->Show(TRUE);
}
+#endif // wxUSE_TOOLBAR
- if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR)) // && (m_fsStatusBarFields > 0))
+#if wxUSE_STATUSBAR
+ if ( m_fsStyle & wxFULLSCREEN_NOSTATUSBAR )
{
//CreateStatusBar(m_fsStatusBarFields);
if (GetStatusBar())
PositionStatusBar();
}
}
+#endif // wxUSE_STATUSBAR
if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
*
*/
-bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow *wx_win, const wxChar *title,
+bool wxFrameMSW::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow *wx_win, const wxChar *title,
int x, int y, int width, int height, long style)
{
if (style & wxCLIP_CHILDREN)
msflags |= WS_CLIPCHILDREN;
- // Keep this in wxFrame because it saves recoding this function
+ // Keep this in wxFrameMSW because it saves recoding this function
// in wxTinyFrame
#if wxUSE_ITSY_BITSY && !defined(__WIN32__)
if (style & wxTINY_CAPTION_VERT)
// Default activation behaviour - set the focus for the first child
// subwindow found.
-void wxFrame::OnActivate(wxActivateEvent& event)
+void wxFrameMSW::OnActivate(wxActivateEvent& event)
{
if ( event.GetActive() )
{
// restore focus to the child which was last focused
- wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd);
+ wxLogTrace(_T("focus"), _T("wxFrameMSW %08x activated."), m_hWnd);
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
: NULL;
}
wxLogTrace(_T("focus"),
- _T("wxFrame %08x deactivated, last focused: %08x."),
+ _T("wxFrameMSW %08x deactivated, last focused: %08x."),
m_hWnd,
m_winLastFocused ? GetHwndOf(m_winLastFocused)
: NULL);
#if wxUSE_TOOLBAR
-wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
+wxToolBar* wxFrameMSW::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
if ( wxFrameBase::CreateToolBar(style, id, name) )
{
return m_frameToolBar;
}
-void wxFrame::PositionToolBar()
+void wxFrameMSW::PositionToolBar()
{
RECT rect;
::GetClientRect(GetHwnd(), &rect);
// propagate our state change to all child frames: this allows us to emulate X
// Windows behaviour where child frames float independently of the parent one
// on the desktop, but are iconized/restored with it
-void wxFrame::IconizeChildFrames(bool bIconize)
+void wxFrameMSW::IconizeChildFrames(bool bIconize)
{
for ( wxWindowList::Node *node = GetChildren().GetFirst();
node;
// the child MDI frames are a special case and should not be touched by
// the parent frame - instead, they are managed by the user
- wxFrame *frame = wxDynamicCast(win, wxFrame);
- if ( frame && !frame->IsMDIChild() )
+ wxFrameMSW *frame = wxDynamicCast(win, wxFrameMSW);
+ if ( frame
+#if wxUSE_MDI_ARCHITECTURE
+ && !wxDynamicCast(frame, wxMDIChildFrame)
+#endif // wxUSE_MDI_ARCHITECTURE
+ )
{
frame->Iconize(bIconize);
}
// preprocessing
// ---------------------------------------------------------------------------
-bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
+bool wxFrameMSW::MSWTranslateMessage(WXMSG* pMsg)
{
if ( wxWindow::MSWTranslateMessage(pMsg) )
return TRUE;
+#if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
// try the menu bar accels
wxMenuBar *menuBar = GetMenuBar();
if ( !menuBar )
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
return acceleratorTable.Translate(this, pMsg);
+#else
+ return FALSE;
+#endif // wxUSE_MENUS && wxUSE_ACCEL
}
// ---------------------------------------------------------------------------
// our private (non virtual) message handlers
// ---------------------------------------------------------------------------
-bool wxFrame::HandlePaint()
+bool wxFrameMSW::HandlePaint()
{
RECT rect;
if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
}
}
-bool wxFrame::HandleSize(int x, int y, WXUINT id)
+bool wxFrameMSW::HandleSize(int x, int y, WXUINT id)
{
bool processed = FALSE;
if ( !m_iconized )
{
+#if wxUSE_STATUSBAR
PositionStatusBar();
+#endif // wxUSE_STATUSBAR
+
+#if wxUSE_TOOLBAR
PositionToolBar();
+#endif // wxUSE_TOOLBAR
wxSizeEvent event(wxSize(x, y), m_windowId);
event.SetEventObject( this );
return processed;
}
-bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
+bool wxFrameMSW::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
if ( control )
{
// handle here commands from menus and accelerators
if ( cmd == 0 || cmd == 1 )
{
+#if wxUSE_MENUS_NATIVE
if ( wxCurrentPopupMenu )
{
wxMenu *popupMenu = wxCurrentPopupMenu;
return popupMenu->MSWCommand(cmd, id);
}
+#endif // wxUSE_MENUS_NATIVE
if ( ProcessCommand(id) )
{
return FALSE;
}
-bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
+bool wxFrameMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
{
int item;
if ( flags == 0xFFFF && hMenu == 0 )
}
else
{
+#if wxUSE_STATUSBAR
// don't give hints for separators (doesn't make sense) nor for the
// items opening popup menus (they don't have them anyhow) but do clear
// the status line - otherwise, we would be left with the help message
{
statbar->SetStatusText(wxEmptyString);
}
+#endif // wxUSE_STATUSBAR
return FALSE;
}
}
// ---------------------------------------------------------------------------
-// the window proc for wxFrame
+// the window proc for wxFrameMSW
// ---------------------------------------------------------------------------
-long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
long rc = 0;
bool processed = FALSE;
///////////////////////////////////////////////////////////////////////////////
-// Name: listbox.cpp
+// Name: src/msw/listbox.cpp
// Purpose: wxListBox
// Author: Julian Smart
// Modified by: Vadim Zeitlin (owner drawn stuff)
#pragma hdrstop
#endif
-#include "wx/window.h"
-#include "wx/msw/private.h"
+#if wxUSE_LISTBOX
#ifndef WX_PRECOMP
#include "wx/listbox.h"
#include "wx/utils.h"
#endif
+#include "wx/window.h"
+#include "wx/msw/private.h"
+
#include <windowsx.h>
#ifdef __WXWINE__
wxLogDebug(wxT("LB_SETITEMDATA failed"));
}
-bool wxListBox::HasMultipleSelection() const
-{
- return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
-}
-
// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
void *oldData = NULL;
wxClientData *oldObjData = NULL;
- if ( m_clientDataItemsType == ClientData_Void )
+ if ( m_clientDataItemsType == wxClientData_Void )
oldData = GetClientData(N);
- else if ( m_clientDataItemsType == ClientData_Object )
+ else if ( m_clientDataItemsType == wxClientData_Object )
oldObjData = GetClientObject(N);
// delete and recreate it
(wxOwnerDrawn::wxODStatus)pStruct->itemState);
}
-#endif
- // wxUSE_OWNER_DRAWN
+#endif // wxUSE_OWNER_DRAWN
+
+#endif // wxUSE_LISTBOX
#pragma hdrstop
#endif
+#if wxUSE_LISTCTRL
+
#ifdef __WIN95__
#ifndef WX_PRECOMP
#endif // __WIN95__
+#endif // wxUSE_LISTCTRL
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
#
$(MSWDIR)\choiccmn.obj \
$(MSWDIR)\clipcmn.obj \
$(MSWDIR)\cmdline.obj \
+ $(MSWDIR)\cmdproc.obj \
$(MSWDIR)\cmndata.obj \
$(MSWDIR)\config.obj \
$(MSWDIR)\cshelp.obj \
$(MSWDIR)\cmdline.obj: $(COMMDIR)\cmdline.$(SRCSUFF)
+$(MSWDIR)\cmdproc.obj: $(COMMDIR)\cmdproc.$(SRCSUFF)
+
$(MSWDIR)\cmndata.obj: $(COMMDIR)\cmndata.$(SRCSUFF)
$(MSWDIR)\config.obj: $(COMMDIR)\config.$(SRCSUFF)
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
#
$(MSWDIR)\choiccmn.obj \
$(MSWDIR)\clipcmn.obj \
$(MSWDIR)\cmdline.obj \
+ $(MSWDIR)\cmdproc.obj \
$(MSWDIR)\cmndata.obj \
$(MSWDIR)\config.obj \
$(MSWDIR)\cshelp.obj \
$(MSWDIR)\cmdline.obj: $(COMMDIR)\cmdline.$(SRCSUFF)
+$(MSWDIR)\cmdproc.obj: $(COMMDIR)\cmdproc.$(SRCSUFF)
+
$(MSWDIR)\cmndata.obj: $(COMMDIR)\cmndata.$(SRCSUFF)
$(MSWDIR)\config.obj: $(COMMDIR)\config.$(SRCSUFF)
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
#
$(COMMDIR)\choiccmn.obj \
$(COMMDIR)\clipcmn.obj \
$(COMMDIR)\cmdline.obj \
+ $(COMMDIR)\cmdproc.obj \
$(COMMDIR)\cmndata.obj \
$(COMMDIR)\config.obj \
$(COMMDIR)\cshelp.obj \
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
+$(COMMDIR)/cmdproc.obj: $*.$(SRCSUFF)
+ cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
$(COMMDIR)/cmndata.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
#
$(COMMDIR)/choiccmn.$(OBJSUFF) \
$(COMMDIR)/clipcmn.$(OBJSUFF) \
$(COMMDIR)/cmdline.$(OBJSUFF) \
+ $(COMMDIR)/cmdproc.$(OBJSUFF) \
$(COMMDIR)/cmndata.$(OBJSUFF) \
$(COMMDIR)/config.$(OBJSUFF) \
$(COMMDIR)/cshelp.$(OBJSUFF) \
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
# Symantec C++ makefile for the msw objects
$(COMMDIR)\choiccmn.obj \
$(COMMDIR)\clipcmn.obj \
$(COMMDIR)\cmdline.obj \
+ $(COMMDIR)\cmdproc.obj \
$(COMMDIR)\cmndata.obj \
$(COMMDIR)\config.obj \
$(COMMDIR)\cshelp.obj \
-# This file was automatically generated by tmake at 01:54, 2001/06/22
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
# File: makefile.vc
# These are generic things that don't need to be compiled on MSW,
# but sometimes it's useful to do so for testing purposes.
-NONESSENTIALOBJS= ..\generic\$D\caret.obj \
+NONESSENTIALOBJS= ..\generic\$D\accel.obj \
+ ..\generic\$D\caret.obj \
..\generic\$D\colrdlgg.obj \
..\generic\$D\dcpsg.obj \
..\generic\$D\dirdlgg.obj \
..\common\$D\choiccmn.obj \
..\common\$D\clipcmn.obj \
..\common\$D\cmdline.obj \
+ ..\common\$D\cmdproc.obj \
..\common\$D\cmndata.obj \
..\common\$D\config.obj \
..\common\$D\cshelp.obj \
#!/binb/wmake.exe
-# This file was automatically generated by tmake at 13:07, 2001/06/18
+# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
#
# These are generic things that don't need to be compiled on MSW,
# but sometimes it's useful to do so for testing purposes.
-NONESSENTIALOBJS= caret.obj &
+NONESSENTIALOBJS= accel.obj &
+ caret.obj &
colrdlgg.obj &
dcpsg.obj &
dirdlgg.obj &
choiccmn.obj &
clipcmn.obj &
cmdline.obj &
+ cmdproc.obj &
cmndata.obj &
config.obj &
cshelp.obj &
cmdline.obj: $(COMMDIR)\cmdline.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+cmdproc.obj: $(COMMDIR)\cmdproc.cpp
+ *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+
cmndata.obj: $(COMMDIR)\cmndata.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
}
}
+#if wxUSE_MENUS_NATIVE
+
void wxMDIParentFrame::InternalSetMenuBar()
{
-// HMENU subMenu = GetSubMenu((HMENU) m_windowMenu, 0);
-
m_parentFrameActive = TRUE;
- HMENU subMenu = (HMENU) 0;
- if (GetWindowMenu())
- subMenu = (HMENU) GetWindowMenu()->GetHMenu();
+ wxMenu *menu = GetWindowMenu();
+ HMENU subMenu = menu ? GetHmenuOf(menu) : 0;
InsertWindowMenu(GetClientWindow(), m_hMenu, subMenu);
}
+#endif // wxUSE_MENUS_NATIVE
+
void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
{
if (m_windowMenu)
#pragma hdrstop
#endif
+#if wxUSE_MENUS
+
#ifndef WX_PRECOMP
#include "wx/frame.h"
#include "wx/menu.h"
// NB: VC++ generates wrong assembler for `if ( id != idMenuTitle )'!!
if ( id != (WXWORD)idMenuTitle )
{
- wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED);
- event.SetEventObject( this );
- event.SetId( id );
-
// VZ: previosuly, the command int was set to id too which was quite
// useless anyhow (as it could be retrieved using GetId()) and
// uncompatible with wxGTK, so now we use the command int instead
// to pass the checked status
- event.SetInt(::GetMenuState(GetHmenu(), id, MF_BYCOMMAND) & MF_CHECKED);
-
- ProcessCommand(event);
+ SendEvent(id, ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND) & MF_CHECKED);
}
return TRUE;
}
-bool wxMenu::ProcessCommand(wxCommandEvent & event)
-{
- bool processed = FALSE;
-
-#if wxUSE_MENU_CALLBACK
- // Try a callback
- if (m_callback)
- {
- (void)(*(m_callback))(*this, event);
- processed = TRUE;
- }
-#endif // wxUSE_MENU_CALLBACK
-
- // Try the menu's event handler
- if ( !processed && GetEventHandler())
- {
- processed = GetEventHandler()->ProcessEvent(event);
- }
-
- // Try the window the menu was popped up from (and up through the
- // hierarchy)
- wxWindow *win = GetInvokingWindow();
- if ( !processed && win )
- processed = win->GetEventHandler()->ProcessEvent(event);
-
- return processed;
-}
-
// ---------------------------------------------------------------------------
// other
// ---------------------------------------------------------------------------
-void wxMenu::Attach(wxMenuBar *menubar)
-{
- // menu can be in at most one menubar because otherwise they would both
- // delete the menu pointer
- wxASSERT_MSG( !m_menuBar, wxT("menu belongs to 2 menubars, expect a crash") );
-
- m_menuBar = menubar;
-}
-
-void wxMenu::Detach()
-{
- wxASSERT_MSG( m_menuBar, wxT("can't detach menu if it's not attached") );
-
- m_menuBar = NULL;
-}
-
wxWindow *wxMenu::GetWindow() const
{
if ( m_invokingWindow != NULL )
void wxMenuBar::Init()
{
m_eventHandler = this;
- m_menuBarFrame = NULL;
m_hMenu = 0;
}
{
wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );
- DrawMenuBar(GetHwndOf(m_menuBarFrame));
+ DrawMenuBar(GetHwndOf(GetFrame()));
}
WXHMENU wxMenuBar::Create()
void wxMenuBar::Attach(wxFrame *frame)
{
-// wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+ wxMenuBarBase::Attach(frame);
m_menuBarFrame = frame;
void wxMenuBar::Detach()
{
-// ::DestroyMenu((HMENU)m_hMenu);
m_hMenu = (WXHMENU)NULL;
- m_menuBarFrame = NULL;
-}
-
-
-// ---------------------------------------------------------------------------
-// wxMenuBar searching for menu items
-// ---------------------------------------------------------------------------
-
-// Find the itemString in menuString, and return the item id or wxNOT_FOUND
-int wxMenuBar::FindMenuItem(const wxString& menuString,
- const wxString& itemString) const
-{
- wxString menuLabel = wxStripMenuCodes(menuString);
- size_t count = GetMenuCount();
- for ( size_t i = 0; i < count; i++ )
- {
- wxString title = wxStripMenuCodes(m_titles[i]);
- if ( menuLabel == title )
- return m_menus[i]->FindItem(itemString);
- }
-
- return wxNOT_FOUND;
-}
-
-wxMenuItem *wxMenuBar::FindItem(int id, wxMenu **itemMenu) const
-{
- if ( itemMenu )
- *itemMenu = NULL;
-
- wxMenuItem *item = NULL;
- size_t count = GetMenuCount();
- for ( size_t i = 0; !item && (i < count); i++ )
- {
- item = m_menus[i]->FindItem(id, itemMenu);
- }
- return item;
+ wxMenuBarBase::Detach();
}
+#endif // wxUSE_MENUS
#pragma hdrstop
#endif
+#if wxUSE_MENUS
+
#ifndef WX_PRECOMP
#include "wx/font.h"
#include "wx/bitmap.h"
return wxStripMenuCodes(text);
}
-// accelerators
-// ------------
-
-#if wxUSE_ACCEL
-
-wxAcceleratorEntry *wxMenuItem::GetAccel() const
-{
- return wxGetAccelFromString(GetText());
-}
-
-#endif // wxUSE_ACCEL
-
// change item state
// -----------------
{
return new wxMenuItem(parentMenu, id, name, help, isCheckable, subMenu);
}
+
+#endif // wxUSE_MENUS
#pragma hdrstop
#endif
-// this is Win32 only code
+#if wxUSE_MIMETYPE
+
+// Doesn't compile in WIN16 mode
#ifndef __WIN16__
#ifndef WX_PRECOMP
#endif
// __WIN16__
+
+#endif // wxUSE_MIMETYPE
win = new wxSpinButton;
}
#endif
+#if wxUSE_SLIDER
else if (str == wxT("MSCTLS_TRACKBAR32"))
{
// Need to ascertain if it's horiz or vert
win = new wxSlider;
}
+#endif // wxUSE_SLIDER
else if (str == wxT("STATIC"))
{
int style1 = (style & 0xFF);
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_NOTEBOOK
+
// wxWindows
#ifndef WX_PRECOMP
#include "wx/string.h"
// common part of all ctors
void wxNotebook::Init()
{
- m_pImageList = NULL;
m_bOwnsImageList = FALSE;
+ m_imageList = NULL;
m_nSelection = -1;
}
int wxNotebook::GetPageCount() const
{
// consistency check
- wxASSERT( (int)m_aPages.Count() == TabCtrl_GetItemCount(m_hwnd) );
+ wxASSERT( (int)m_pages.Count() == TabCtrl_GetItemCount(m_hwnd) );
- return m_aPages.Count();
+ return m_pages.Count();
}
int wxNotebook::GetRowCount() const
return TabCtrl_SetCurSel(m_hwnd, nPage);
}
-void wxNotebook::AdvanceSelection(bool bForward)
-{
- int nSel = GetSelection();
- int nMax = GetPageCount() - 1;
- if ( bForward )
- SetSelection(nSel == nMax ? 0 : nSel + 1);
- else
- SetSelection(nSel == 0 ? nMax : nSel - 1);
-}
-
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") );
void wxNotebook::SetImageList(wxImageList* imageList)
{
- if (m_bOwnsImageList) delete m_pImageList;
- m_pImageList = imageList;
+ if ( m_bOwnsImageList )
+ {
+ delete m_imageList;
+ }
+
m_bOwnsImageList = FALSE;
+ m_imageList = imageList;
+
TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
}
TabCtrl_DeleteItem(m_hwnd, nPage);
- delete m_aPages[nPage];
- m_aPages.Remove(nPage);
+ delete m_pages[nPage];
+ m_pages.Remove(nPage);
- if ( m_aPages.IsEmpty() ) {
+ if ( m_pages.IsEmpty() ) {
// no selection if the notebook became empty
m_nSelection = -1;
}
}
// remove one page from the notebook, without deleting
-bool wxNotebook::RemovePage(int nPage)
+wxNotebookPage *wxNotebook::DoRemovePage(int nPage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL, wxT("notebook page out of range") );
TabCtrl_DeleteItem(m_hwnd, nPage);
- m_aPages.Remove(nPage);
+ wxNotebookPage *pageRemoved = m_pages[nPage];
+ m_pages.Remove(nPage);
- if ( m_aPages.IsEmpty() )
- m_nSelection = -1;
- else
- m_nSelection = TabCtrl_GetCurSel(m_hwnd);
+ if ( m_pages.IsEmpty() )
+ m_nSelection = -1;
+ else
+ m_nSelection = TabCtrl_GetCurSel(m_hwnd);
- return TRUE;
+ return pageRemoved;
}
// remove all pages
int nPageCount = GetPageCount();
int nPage;
for ( nPage = 0; nPage < nPageCount; nPage++ )
- delete m_aPages[nPage];
+ delete m_pages[nPage];
- m_aPages.Clear();
+ m_pages.Clear();
TabCtrl_DeleteAllItems(m_hwnd);
}
// save the pointer to the page
- m_aPages.Insert(pPage, nPage);
+ m_pages.Insert(pPage, nPage);
// don't show pages by default (we'll need to adjust their size first)
HWND hwnd = GetWinHwnd(pPage);
int width = rc.right - rc.left,
height = rc.bottom - rc.top;
- size_t nCount = m_aPages.Count();
+ size_t nCount = m_pages.Count();
for ( size_t nPage = 0; nPage < nCount; nPage++ ) {
- wxNotebookPage *pPage = m_aPages[nPage];
+ wxNotebookPage *pPage = m_pages[nPage];
pPage->SetSize(rc.left, rc.top, width, height);
}
{
int sel = event.GetOldSelection();
if ( sel != -1 )
- m_aPages[sel]->Show(FALSE);
+ m_pages[sel]->Show(FALSE);
sel = event.GetSelection();
if ( sel != -1 )
{
- wxNotebookPage *pPage = m_aPages[sel];
+ wxNotebookPage *pPage = m_pages[sel];
pPage->Show(TRUE);
pPage->SetFocus();
}
// set focus to the currently selected page if any
if ( m_nSelection != -1 )
- m_aPages[m_nSelection]->SetFocus();
+ m_pages[m_nSelection]->SetFocus();
event.Skip();
}
// and is being propagated downwards
event.SetEventObject(this);
- wxWindow *page = m_aPages[m_nSelection];
+ wxWindow *page = m_pages[m_nSelection];
if ( !page->GetEventHandler()->ProcessEvent(event) )
{
page->SetFocus();
event.SetSelection(nSel);
event.SetOldSelection(nOldSel);
event.SetEventObject(this);
- if ( ProcessEvent(event) && !event.IsAllowed() )
+ if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
{
// program doesn't allow the page change
s_bInsideChangePage = FALSE;
}
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
- ProcessEvent(event);
+ GetEventHandler()->ProcessEvent(event);
s_bInsideChangePage = FALSE;
}
+
+#endif // wxUSE_NOTEBOOK
#pragma hdrstop
#endif
+#if wxUSE_RADIOBOX
+
#ifndef WX_PRECOMP
#include "wx/bitmap.h"
#include "wx/brush.h"
// wxRadioBox
// ---------------------------------------------------------------------------
+int wxRadioBox::GetCount() const
+{
+ return m_noItems;
+}
+
+int wxRadioBox::GetColumnCount() const
+{
+ return GetNumHor();
+}
+
+int wxRadioBox::GetRowCount() const
+{
+ return GetNumVer();
+}
+
// returns the number of rows
int wxRadioBox::GetNumVer() const
{
}
-wxString wxRadioBox::GetLabel(int item) const
-{
- wxCHECK_MSG( item >= 0 && item < m_noItems, wxT(""), wxT("invalid radiobox index") );
-
- return wxGetWindowText(m_radioButtons[item]);
-}
-
-void wxRadioBox::SetLabel(int item, const wxString& label)
+void wxRadioBox::SetString(int item, const wxString& label)
{
wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") );
SetWindowText((HWND)m_radioButtons[item], label.c_str());
}
-void wxRadioBox::SetLabel(int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap))
-{
- /*
- m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN;
- m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN;
- */
- wxFAIL_MSG(wxT("not implemented"));
-}
-
-int wxRadioBox::FindString(const wxString& s) const
-{
- for (int i = 0; i < m_noItems; i++)
- {
- if ( s == wxGetWindowText(m_radioButtons[i]) )
- return i;
- }
-
- return wxNOT_FOUND;
-}
-
void wxRadioBox::SetSelection(int N)
{
wxCHECK_RET( (N >= 0) && (N < m_noItems), wxT("invalid radiobox index") );
}
// Find string for position
-wxString wxRadioBox::GetString(int N) const
+wxString wxRadioBox::GetString(int item) const
{
- return wxGetWindowText(m_radioButtons[N]);
+ wxCHECK_MSG( item >= 0 && item < m_noItems, wxEmptyString,
+ wxT("invalid radiobox index") );
+
+ return wxGetWindowText(m_radioButtons[item]);
}
// ----------------------------------------------------------------------------
::ShowWindow((HWND)m_radioButtons[item], show ? SW_SHOW : SW_HIDE);
}
-// For single selection items only
-wxString wxRadioBox::GetStringSelection() const
-{
- wxString result;
- int sel = GetSelection();
- if (sel > -1)
- result = GetString(sel);
-
- return result;
-}
-
-bool wxRadioBox::SetStringSelection(const wxString& s)
-{
- int sel = FindString (s);
- if (sel > -1)
- {
- SetSelection (sel);
- return TRUE;
- }
- else
- return FALSE;
-}
-
bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
{
- int i;
- for (i = 0; i < Number(); i++)
+ size_t count = GetCount();
+ for ( size_t i = 0; i < count; i++ )
{
- if (GetRadioButtons()[i] == hWnd)
+ if ( GetRadioButtons()[i] == hWnd )
return TRUE;
}
int selOld = radiobox->GetSelection();
int selNew = selOld;
- // wrapping will be handled below for the cases when we
- // add/substract more than 1 but here otherwise as it's simpler
switch ( wParam )
{
case VK_UP:
- if ( horz )
- selNew -= cols;
- else
- {
- if ( selNew )
- selNew--;
- else
- selNew = num - 1;
- }
+ dir = wxUP;
break;
case VK_LEFT:
- if ( horz )
- {
- if ( selNew )
- selNew--;
- else
- selNew = num - 1;
- }
- else
- selNew -= rows;
+ dir = wxLEFT;
break;
case VK_DOWN:
- if ( horz )
- selNew += cols;
- else
- {
- if ( ++selNew == num )
- selNew = 0;
- }
+ dir = wxDOWN;
break;
case VK_RIGHT:
- if ( horz )
- {
- if ( ++selNew == num )
- selNew = 0;
- }
- else
- selNew += rows;
+ dir = wxRIGHT;
break;
default:
processed = FALSE;
+
+ // just to suppress the compiler warning
+ dir = wxALL;
}
if ( processed )
{
- // ensure that selNew is in range [0..num)
- if ( selNew >= num )
- {
- selNew -= num;
-
- int dim = horz ? cols : rows;
- selNew += dim - 1;
- selNew %= dim;
- }
- else if ( selNew < 0 )
- {
- selNew += num;
+ int selOld = radiobox->GetSelection();
+ int selNew = radiobox->GetNextItem
+ (
+ selOld,
+ dir,
+ radiobox->GetWindowStyle()
+ );
int dim = horz ? cols : rows;
if ( selNew % dim == 0 )
#endif // __WIN32__
+#endif // wxUSE_RADIOBOX
/////////////////////////////////////////////////////////////////////////////
-// Name: radiobut.cpp
+// Name: msw/radiobut.cpp
// Purpose: wxRadioButton
// Author: Julian Smart
// Modified by:
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation "radiobut.h"
+ #pragma implementation "radiobut.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_RADIOBTN
+
#ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/setup.h"
-#include "wx/radiobut.h"
-#include "wx/settings.h"
-#include "wx/brush.h"
+ #include "wx/radiobut.h"
+ #include "wx/settings.h"
+ #include "wx/brush.h"
#endif
#include "wx/msw/private.h"
}
#endif
+
+#endif // wxUSE_RADIOBTN
/////////////////////////////////////////////////////////////////////////////
-// Name: scrolbar.cpp
+// Name: msw/scrolbar.cpp
// Purpose: wxScrollBar
// Author: Julian Smart
// Modified by:
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation "scrolbar.h"
+ #pragma implementation "scrolbar.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_SCROLLBAR
+
#ifndef WX_PRECOMP
-#include "wx/defs.h"
-#include "wx/utils.h"
+ #include "wx/utils.h"
#endif
#include "wx/scrolbar.h"
}
}
#endif
+
+#endif // wxUSE_SCROLLBAR
#pragma hdrstop
#endif
+#if wxUSE_SLIDER
+
#ifndef WX_PRECOMP
-#include <stdio.h>
#include "wx/utils.h"
#include "wx/brush.h"
#endif
bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
WXWORD pos, WXHWND control)
{
- int position = 0; // Dummy - not used in this mode
-
- int nScrollInc;
- wxEventType scrollEvent = wxEVT_NULL;
+ wxEventType scrollEvent;
switch ( wParam )
{
case SB_TOP:
- nScrollInc = m_rangeMax - position;
scrollEvent = wxEVT_SCROLL_TOP;
break;
case SB_BOTTOM:
- nScrollInc = - position;
scrollEvent = wxEVT_SCROLL_BOTTOM;
break;
case SB_LINEUP:
- nScrollInc = - GetLineSize();
scrollEvent = wxEVT_SCROLL_LINEUP;
break;
case SB_LINEDOWN:
- nScrollInc = GetLineSize();
scrollEvent = wxEVT_SCROLL_LINEDOWN;
break;
case SB_PAGEUP:
- nScrollInc = -GetPageSize();
scrollEvent = wxEVT_SCROLL_PAGEUP;
break;
case SB_PAGEDOWN:
- nScrollInc = GetPageSize();
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
break;
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
-#ifdef __WIN32__
- nScrollInc = (signed short)pos - position;
-#else // Win16
- nScrollInc = pos - position;
-#endif // Win32/16
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
break;
default:
- nScrollInc = 0;
- }
-
- if (scrollEvent == wxEVT_NULL)
- {
- // no event...
- return FALSE;
+ // unknown scroll event?
+ return FALSE;
}
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
#endif
// __WIN95__
+#endif // wxUSE_SLIDER
m_lineSize = 1;
m_rangeMax = 0;
m_rangeMin = 0;
- m_tickFreq = 0;
}
bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
m_pageSize = 1;
m_lineSize = 1;
m_windowStyle = style;
- m_tickFreq = 0;
if ( id == -1 )
m_windowId = (int)NewControlId();
return wxControl::OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
}
-// For trackbars only
-void wxSliderMSW::SetTickFreq(int n, int pos)
-{
-}
-
void wxSliderMSW::SetPageSize(int pageSize)
{
m_pageSize = pageSize;
return m_pageSize;
}
-void wxSliderMSW::ClearSel()
-{
-}
-
-void wxSliderMSW::ClearTicks()
-{
-}
-
void wxSliderMSW::SetLineSize(int lineSize)
{
m_lineSize = lineSize;
return m_lineSize;
}
-int wxSliderMSW::GetSelEnd() const
-{
- return 0;
-}
-
-int wxSliderMSW::GetSelStart() const
-{
- return 0;
-}
-
-void wxSliderMSW::SetSelection(int minPos, int maxPos)
-{
-}
-
-void wxSliderMSW::SetThumbLength(int len)
-{
-}
-
-int wxSliderMSW::GetThumbLength() const
-{
- return 0;
-}
-
-void wxSliderMSW::SetTick(int tickPos)
-{
-}
-
bool wxSliderMSW::ContainsHWND(WXHWND hWnd) const
{
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
#pragma hdrstop
#endif
+#if wxUSE_STATBMP
+
#include "wx/window.h"
#include "wx/msw/private.h"
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
}
+#endif // wxUSE_STATBMP
#pragma hdrstop
#endif
+#if wxUSE_STATBOX
+
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/dcclient.h"
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
}
+#endif // wxUSE_STATBOX
#pragma hdrstop
#endif
+#if wxUSE_STATTEXT
+
#ifndef WX_PRECOMP
#include "wx/event.h"
#include "wx/app.h"
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
}
-
+#endif // wxUSE_STATTEXT
#pragma hdrstop
#endif
+#if wxUSE_TEXTCTRL
+
#ifndef WX_PRECOMP
#include "wx/textctrl.h"
#include "wx/settings.h"
#endif // wxUSE_RICHEDIT
+#endif // wxUSE_TEXTCTRL
#pragma hdrstop
#endif
+#if wxUSE_TIMER
+
#ifndef WX_PRECOMP
#include "wx/setup.h"
#include "wx/window.h"
return 0;
}
+
+#endif // wxUSE_TIMER
/////////////////////////////////////////////////////////////////////////////
-// Name: treectrl.cpp
+// Name: src/msw/treectrl.cpp
// Purpose: wxTreeCtrl
// Author: Julian Smart
// Modified by: Vadim Zeitlin to be less MSW-specific on 10.10.98
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
+
#ifdef __GNUG__
#pragma implementation "treectrl.h"
#endif
#pragma hdrstop
#endif
+#if wxUSE_TREECTRL
+
#include "wx/msw/private.h"
-// Set this to 1 to be _absolutely_ sure that repainting will work for all comctl32.dll versions
+// Set this to 1 to be _absolutely_ sure that repainting will work for all
+// comctl32.dll versions
#define wxUSE_COMCTL32_SAFELY 0
// Mingw32 is a bit mental even though this is done in winundef
#endif // __WIN95__
+#endif // wxUSE_TREECTRL
#include "wx/timer.h"
-#include <ctype.h>
-
#if !defined(__GNUWIN32__) && !defined(__WXWINE__) && !defined(__SALFORDC__)
#include <direct.h>
#endif
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#ifndef __WATCOMC__
#if !(defined(_MSC_VER) && (_MSC_VER > 800))
#include <errno.h>
#endif
#endif
-#include <stdarg.h>
//// BEGIN for console support: VC++ only
#ifdef __VISUALC__
#include "wx/ioswrap.h"
-#if wxUSE_IOSTREAMH
-// N.B. BC++ doesn't have istream.h, ostream.h
-# include <io.h>
-# include <fstream.h>
-#else
-# include <fstream>
-#endif
+#include "wx/ioswrap.h"
/* Need to undef new if including crtdbg.h */
# ifdef new
#if wxUSE_GUI
+#if wxUSE_TIMER
+
// Sleep for nSecs seconds. Attempt a Windows implementation using timers.
static bool gs_inTimer = FALSE;
-class wxSleepTimer: public wxTimer
+class wxSleepTimer : public wxTimer
{
public:
virtual void Notify()
{
#ifdef __WIN32__
::Sleep(milliseconds);
-#else
+#else // !Win32
if (gs_inTimer)
return;
}
delete wxTheSleepTimer;
wxTheSleepTimer = NULL;
-#endif
+#endif // Win32/!Win32
}
void wxSleep(int nSecs)
// wxYield();
}
+#endif // wxUSE_TIMER
+
#elif defined(__WIN32__) // wxUSE_GUI
void wxUsleep(unsigned long milliseconds)
#pragma hdrstop
#endif
+#if wxUSE_WAVE
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
return FALSE;
}
-
+#endif // wxUSE_WAVE
/////////////////////////////////////////////////////////////////////////////
-// Name: windows.cpp
+// Name: src/msw/windows.cpp
// Purpose: wxWindow
// Author: Julian Smart
// Modified by: VZ on 13.05.99: no more Default(), MSWOnXXX() reorganisation
// the last Windows message we got (MT-UNSAFE)
extern MSG s_currentMsg;
+#if wxUSE_MENUS_NATIVE
wxMenu *wxCurrentPopupMenu = NULL;
+#endif // wxUSE_MENUS_NATIVE
+
extern wxList WXDLLEXPORT wxPendingDelete;
extern const wxChar *wxCanvasClassName;
const char *wxGetMessageName(int message);
#endif //__WXDEBUG__
-void wxRemoveHandleAssociation(wxWindow *win);
-void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win);
+void wxRemoveHandleAssociation(wxWindowMSW *win);
+void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win);
wxWindow *wxFindWinFromHandle(WXHWND hWnd);
// this magical function is used to translate VK_APPS key presses to right
// mouse clicks
-static void TranslateKbdEventToMouse(wxWindow *win, int *x, int *y, WPARAM *flags);
+static void TranslateKbdEventToMouse(wxWindowMSW *win,
+ int *x, int *y, WPARAM *flags);
// get the text metrics for the current font
-static TEXTMETRIC wxGetTextMetrics(const wxWindow *win);
+static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win);
+
+// check if the mouse is in the window or its child
+static bool IsMouseInWindow(HWND hwnd);
// ---------------------------------------------------------------------------
// event tables
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
- EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
- EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
- EVT_INIT_DIALOG(wxWindow::OnInitDialog)
- EVT_IDLE(wxWindow::OnIdle)
- EVT_SET_FOCUS(wxWindow::OnSetFocus)
+// in wxUniv/MSW this class is abstract because it doesn't have DoPopupMenu()
+// method
+#ifdef __WXUNIVERSAL__
+ IMPLEMENT_ABSTRACT_CLASS(wxWindowMSW, wxWindowBase)
+#else // __WXMSW__
+ IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+#endif // __WXUNIVERSAL__/__WXMSW__
+
+BEGIN_EVENT_TABLE(wxWindowMSW, wxWindowBase)
+ EVT_ERASE_BACKGROUND(wxWindowMSW::OnEraseBackground)
+ EVT_SYS_COLOUR_CHANGED(wxWindowMSW::OnSysColourChanged)
+ EVT_INIT_DIALOG(wxWindowMSW::OnInitDialog)
+ EVT_IDLE(wxWindowMSW::OnIdle)
+ EVT_SET_FOCUS(wxWindowMSW::OnSetFocus)
END_EVENT_TABLE()
// ===========================================================================
// ---------------------------------------------------------------------------
// Find an item given the MS Windows id
-wxWindow *wxWindow::FindItem(long id) const
+wxWindow *wxWindowMSW::FindItem(long id) const
{
+#if wxUSE_CONTROLS
wxControl *item = wxDynamicThisCast(this, wxControl);
if ( item )
{
- // i it we or one of our "internal" children?
- if ( item->GetId() == id ||
- (item->GetSubcontrols().Index(id) != wxNOT_FOUND) )
+ // is it we or one of our "internal" children?
+ if ( item->GetId() == id
+#ifndef __WXUNIVERSAL__
+ || (item->GetSubcontrols().Index(id) != wxNOT_FOUND)
+#endif // __WXUNIVERSAL__
+ )
{
return item;
}
}
+#endif // wxUSE_CONTROLS
wxWindowList::Node *current = GetChildren().GetFirst();
while (current)
}
// Find an item given the MS Windows handle
-wxWindow *wxWindow::FindItemByHWND(WXHWND hWnd, bool controlOnly) const
+wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const
{
wxWindowList::Node *current = GetChildren().GetFirst();
while (current)
if ( wnd )
return wnd;
- if ( !controlOnly || parent->IsKindOf(CLASSINFO(wxControl)) )
+ if ( !controlOnly
+#if wxUSE_CONTROLS
+ || parent->IsKindOf(CLASSINFO(wxControl))
+#endif // wxUSE_CONTROLS
+ )
{
wxWindow *item = current->GetData();
if ( item->GetHWND() == hWnd )
}
// Default command handler
-bool wxWindow::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id))
+bool wxWindowMSW::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id))
{
return FALSE;
}
// constructors and such
// ----------------------------------------------------------------------------
-void wxWindow::Init()
+void wxWindowMSW::Init()
{
// generic
InitBase();
// MSW specific
m_doubleClickAllowed = 0;
- m_winCaptured = FALSE;
m_isBeingDeleted = FALSE;
m_oldWndProc = 0;
}
// Destructor
-wxWindow::~wxWindow()
+wxWindowMSW::~wxWindowMSW()
{
m_isBeingDeleted = TRUE;
}
// real construction (Init() must have been called before!)
-bool wxWindow::Create(wxWindow *parent, wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
- long style,
- const wxString& name)
+bool wxWindowMSW::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
{
wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindow without parent") );
parent->AddChild(this);
- DWORD msflags = 0;
- if ( style & wxBORDER )
- msflags |= WS_BORDER;
-/* Not appropriate for non-frame/dialog windows, and
- may clash with other window styles.
- if ( style & wxTHICK_FRAME )
- msflags |= WS_THICKFRAME;
-*/
- //msflags |= WS_CHILD /* | WS_CLIPSIBLINGS */ | WS_VISIBLE;
- msflags |= WS_CHILD | WS_VISIBLE;
+ // all windows are created visible
+ DWORD msflags = WS_CHILD | WS_VISIBLE;
+
+#ifdef __WXUNIVERSAL__
+ // no 3d effects, we draw them ourselves
+ WXDWORD exStyle = 0;
+#else // !wxUniversal
if ( style & wxCLIP_CHILDREN )
msflags |= WS_CLIPCHILDREN;
if ( style & wxCLIP_SIBLINGS )
// Even with extended styles, need to combine with WS_BORDER
// for them to look right.
- if ( want3D || (m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
- (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
+ if ( want3D ||
+ (m_windowStyle & (wxBORDER |
+ wxSIMPLE_BORDER |
+ wxRAISED_BORDER |
+ wxSUNKEN_BORDER |
+ wxDOUBLE_BORDER)) )
{
msflags |= WS_BORDER;
}
m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS |
DLGC_WANTTAB | DLGC_WANTMESSAGE;
}
+#endif // wxUniversal/!wxUniversal
+
+ if ( style & wxPOPUP_WINDOW )
+ {
+ // a popup window floats on top of everything
+ exStyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
- return MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL,
+ // it is also created hidden as other top level windows
+ msflags &= ~WS_VISIBLE;
+ m_isShown = FALSE;
+ }
+
+ return MSWCreate(m_windowId, parent, wxCanvasClassName,
+ (wxWindow *)this, NULL,
pos.x, pos.y,
WidthDefault(size.x), HeightDefault(size.y),
msflags, NULL, exStyle);
// basic operations
// ---------------------------------------------------------------------------
-void wxWindow::SetFocus()
+void wxWindowMSW::SetFocus()
{
HWND hWnd = GetHwnd();
- if ( hWnd )
- ::SetFocus(hWnd);
+ wxCHECK_RET( hWnd, _T("can't set focus to invalid window") );
+
+ ::SetLastError(0);
+
+ if ( !::SetFocus(hWnd) )
+ {
+ // was there really an error?
+ DWORD dwRes = ::GetLastError();
+ if ( dwRes )
+ {
+ wxLogApiError(_T("SetFocus"), dwRes);
+ }
+
+ // VZ: just why does this happen sometimes?? any idea?
+#if 0
+ HWND hwndFocus = ::GetFocus();
+ wxASSERT_MSG( hwndFocus == hWnd, _T("SetFocus() didn't work?") );
+#endif // 0
+ }
}
// Get the window with the focus
return NULL;
}
-bool wxWindow::Enable(bool enable)
+bool wxWindowMSW::Enable(bool enable)
{
if ( !wxWindowBase::Enable(enable) )
return FALSE;
return TRUE;
}
-bool wxWindow::Show(bool show)
+bool wxWindowMSW::Show(bool show)
{
if ( !wxWindowBase::Show(show) )
return FALSE;
}
// Raise the window to the top of the Z order
-void wxWindow::Raise()
+void wxWindowMSW::Raise()
{
#ifdef __WIN16__
::BringWindowToTop(GetHwnd());
}
// Lower the window to the bottom of the Z order
-void wxWindow::Lower()
+void wxWindowMSW::Lower()
{
::SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
-void wxWindow::SetTitle( const wxString& title)
+void wxWindowMSW::SetTitle( const wxString& title)
{
SetWindowText(GetHwnd(), title.c_str());
}
-wxString wxWindow::GetTitle() const
+wxString wxWindowMSW::GetTitle() const
{
return wxGetWindowText(GetHWND());
}
-void wxWindow::CaptureMouse()
+void wxWindowMSW::CaptureMouse()
{
HWND hWnd = GetHwnd();
- if ( hWnd && !m_winCaptured )
+ if ( hWnd )
{
- SetCapture(hWnd);
- m_winCaptured = TRUE;
+ ::SetCapture(hWnd);
}
}
-void wxWindow::ReleaseMouse()
+void wxWindowMSW::ReleaseMouse()
{
- if ( m_winCaptured )
+ if ( !::ReleaseCapture() )
{
- ReleaseCapture();
- m_winCaptured = FALSE;
+ wxLogLastError(_T("ReleaseCapture"));
}
}
-bool wxWindow::SetFont(const wxFont& font)
+/* static */ wxWindow *wxWindowBase::GetCapture()
+{
+ HWND hwnd = ::GetCapture();
+ return hwnd ? wxFindWinFromHandle((WXHWND)hwnd) : (wxWindow *)NULL;
+}
+
+bool wxWindowMSW::SetFont(const wxFont& font)
{
if ( !wxWindowBase::SetFont(font) )
{
return TRUE;
}
-bool wxWindow::SetCursor(const wxCursor& cursor)
+bool wxWindowMSW::SetCursor(const wxCursor& cursor)
{
if ( !wxWindowBase::SetCursor(cursor) )
{
return TRUE;
}
-void wxWindow::WarpPointer (int x_pos, int y_pos)
+void wxWindowMSW::WarpPointer (int x, int y)
{
- // Move the pointer to (x_pos,y_pos) coordinates. They are expressed in
- // pixel coordinates, relatives to the canvas -- So, we first need to
- // substract origin of the window, then convert to screen position
-
- int x = x_pos; int y = y_pos;
- RECT rect;
- GetWindowRect (GetHwnd(), &rect);
-
- x += rect.left;
- y += rect.top;
+ ClientToScreen(&x, &y);
- SetCursorPos (x, y);
+ if ( !::SetCursorPos(x, y) )
+ {
+ wxLogLastError(_T("SetCursorPos"));
+ }
}
#if WXWIN_COMPATIBILITY
-void wxWindow::MSWDeviceToLogical (float *x, float *y) const
+void wxWindowMSW::MSWDeviceToLogical (float *x, float *y) const
{
}
#endif // WXWIN_COMPATIBILITY
// ---------------------------------------------------------------------------
#if WXWIN_COMPATIBILITY
-void wxWindow::SetScrollRange(int orient, int range, bool refresh)
+void wxWindowMSW::SetScrollRange(int orient, int range, bool refresh)
{
#if defined(__WIN95__)
#endif
}
-void wxWindow::SetScrollPage(int orient, int page, bool refresh)
+void wxWindowMSW::SetScrollPage(int orient, int page, bool refresh)
{
#if defined(__WIN95__)
SCROLLINFO info;
#endif
}
-int wxWindow::OldGetScrollRange(int orient) const
+int wxWindowMSW::OldGetScrollRange(int orient) const
{
int wOrient;
if ( orient == wxHORIZONTAL )
return 0;
}
-int wxWindow::GetScrollPage(int orient) const
+int wxWindowMSW::GetScrollPage(int orient) const
{
if ( orient == wxHORIZONTAL )
return m_xThumbSize;
#endif // WXWIN_COMPATIBILITY
-int wxWindow::GetScrollPos(int orient) const
+int wxWindowMSW::GetScrollPos(int orient) const
{
int wOrient;
if ( orient == wxHORIZONTAL )
// This now returns the whole range, not just the number
// of positions that we can scroll.
-int wxWindow::GetScrollRange(int orient) const
+int wxWindowMSW::GetScrollRange(int orient) const
{
int wOrient;
if ( orient == wxHORIZONTAL )
return 0;
}
-int wxWindow::GetScrollThumb(int orient) const
+int wxWindowMSW::GetScrollThumb(int orient) const
{
if ( orient == wxHORIZONTAL )
return m_xThumbSize;
return m_yThumbSize;
}
-void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
+void wxWindowMSW::SetScrollPos(int orient, int pos, bool refresh)
{
#if defined(__WIN95__)
SCROLLINFO info;
}
// New function that will replace some of the above.
-void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
+void wxWindowMSW::SetScrollbar(int orient, int pos, int thumbVisible,
int range, bool refresh)
{
#if defined(__WIN95__)
}
}
-void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
+void wxWindowMSW::ScrollWindow(int dx, int dy, const wxRect *prect)
{
- RECT rect2;
- if ( rect )
+ RECT rect;
+ if ( prect )
{
- rect2.left = rect->x;
- rect2.top = rect->y;
- rect2.right = rect->x + rect->width;
- rect2.bottom = rect->y + rect->height;
+ rect.left = prect->x;
+ rect.top = prect->y;
+ rect.right = prect->x + prect->width;
+ rect.bottom = prect->y + prect->height;
}
- if ( rect )
- ::ScrollWindow(GetHwnd(), dx, dy, &rect2, NULL);
- else
- ::ScrollWindow(GetHwnd(), dx, dy, NULL, NULL);
+ ::ScrollWindow(GetHwnd(), dx, dy, prect ? &rect : NULL, NULL);
}
// ---------------------------------------------------------------------------
// subclassing
// ---------------------------------------------------------------------------
-void wxWindow::SubclassWin(WXHWND hWnd)
+void wxWindowMSW::SubclassWin(WXHWND hWnd)
{
wxASSERT_MSG( !m_oldWndProc, wxT("subclassing window twice?") );
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
}
-void wxWindow::UnsubclassWin()
+void wxWindowMSW::UnsubclassWin()
{
wxRemoveHandleAssociation(this);
}
// Make a Windows extended style from the given wxWindows window style
-WXDWORD wxWindow::MakeExtendedStyle(long style, bool eliminateBorders)
+WXDWORD wxWindowMSW::MakeExtendedStyle(long style, bool eliminateBorders)
{
WXDWORD exStyle = 0;
if ( style & wxTRANSPARENT_WINDOW )
// Determines whether native 3D effects or CTL3D should be used,
// applying a default border style if required, and returning an extended
// style to pass to CreateWindowEx.
-WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle,
+WXDWORD wxWindowMSW::Determine3DEffects(WXDWORD defaultBorderStyle,
bool *want3D) const
{
// If matches certain criteria, then assume no 3D effects
// unless specifically requested (dealt with in MakeExtendedStyle)
- if ( !GetParent() || !IsKindOf(CLASSINFO(wxControl)) || (m_windowStyle & wxNO_BORDER) )
+ if ( !GetParent()
+#if wxUSE_CONTROLS
+ || !IsKindOf(CLASSINFO(wxControl))
+#endif // wxUSE_CONTROLS
+ || (m_windowStyle & wxNO_BORDER) )
{
*want3D = FALSE;
return MakeExtendedStyle(m_windowStyle, FALSE);
// If nothing defined for this, try the parent.
// E.g. we may be a button loaded from a resource, with no callback function
// defined.
-void wxWindow::OnCommand(wxWindow& win, wxCommandEvent& event)
+void wxWindowMSW::OnCommand(wxWindow& win, wxCommandEvent& event)
{
if ( GetEventHandler()->ProcessEvent(event) )
return;
#endif // WXWIN_COMPATIBILITY_2
#if WXWIN_COMPATIBILITY
-wxObject* wxWindow::GetChild(int number) const
+wxObject* wxWindowMSW::GetChild(int number) const
{
// Return a pointer to the Nth object in the Panel
wxNode *node = GetChildren().First();
#endif // WXWIN_COMPATIBILITY
// Setup background and foreground colours correctly
-void wxWindow::SetupColours()
+void wxWindowMSW::SetupColours()
{
if ( GetParent() )
SetBackgroundColour(GetParent()->GetBackgroundColour());
}
-void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
+bool wxWindowMSW::IsMouseInWindow() const
+{
+ // get the mouse position
+ POINT pt;
+ ::GetCursorPos(&pt);
+
+ // find the window which currently has the cursor and go up the window
+ // chain until we find this window - or exhaust it
+ HWND hwnd = ::WindowFromPoint(pt);
+ while ( hwnd && (hwnd != GetHwnd()) )
+ hwnd = ::GetParent(hwnd);
+
+ return hwnd != NULL;
+}
+
+void wxWindowMSW::OnIdle(wxIdleEvent& WXUNUSED(event))
{
// Check if we need to send a LEAVE event
if ( m_mouseInWindow )
{
- POINT pt;
- ::GetCursorPos(&pt);
- if ( ::WindowFromPoint(pt) != GetHwnd() )
+ if ( !IsMouseInWindow() )
{
// Generate a LEAVE event
m_mouseInWindow = FALSE;
- // Unfortunately the mouse button and keyboard state may have changed
- // by the time the OnIdle function is called, so 'state' may be
- // meaningless.
+ // Unfortunately the mouse button and keyboard state may have
+ // changed by the time the OnIdle function is called, so 'state'
+ // may be meaningless.
int state = 0;
if ( wxIsShiftDown() )
state |= MK_SHIFT;
if ( GetKeyState( VK_RBUTTON ) )
state |= MK_RBUTTON;
- wxMouseEvent event(wxEVT_LEAVE_WINDOW);
- InitMouseEvent(event, pt.x, pt.y, state);
+ POINT pt;
+ if ( !::GetCursorPos(&pt) )
+ {
+ wxLogLastError(_T("GetCursorPos"));
+ }
- (void)GetEventHandler()->ProcessEvent(event);
+ // we need to have client coordinates here for symmetry with
+ // wxEVT_ENTER_WINDOW
+ RECT rect;
+ if ( !::GetWindowRect(GetHwnd(), &rect) )
+ {
+ wxLogLastError(_T("GetWindowRect"));
+ }
+ pt.x -= rect.left;
+ pt.y -= rect.top;
+
+ wxMouseEvent event2(wxEVT_LEAVE_WINDOW);
+ InitMouseEvent(event2, pt.x, pt.y, state);
+
+ (void)GetEventHandler()->ProcessEvent(event2);
}
}
}
// Set this window to be the child of 'parent'.
-bool wxWindow::Reparent(wxWindowBase *parent)
+bool wxWindowMSW::Reparent(wxWindowBase *parent)
{
if ( !wxWindowBase::Reparent(parent) )
return FALSE;
return TRUE;
}
-void wxWindow::Clear()
+void wxWindowMSW::Clear()
{
- wxClientDC dc(this);
+ wxClientDC dc((wxWindow *)this);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(brush);
dc.Clear();
}
-void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
+void wxWindowMSW::Refresh(bool eraseBack, const wxRect *rect)
{
HWND hWnd = GetHwnd();
if ( hWnd )
}
}
+void wxWindowMSW::Update()
+{
+ if ( !::UpdateWindow(GetHwnd()) )
+ {
+ wxLogLastError(_T("UpdateWindow"));
+ }
+
+#ifdef __WIN32__
+ // just calling UpdateWindow() is not enough, what we did in our WM_PAINT
+ // handler needs to be really drawn right now
+ (void)::GdiFlush();
+#endif // __WIN32__
+}
+
// ---------------------------------------------------------------------------
// drag and drop
// ---------------------------------------------------------------------------
#if wxUSE_DRAG_AND_DROP
-void wxWindow::SetDropTarget(wxDropTarget *pDropTarget)
+void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget)
{
if ( m_dropTarget != 0 ) {
m_dropTarget->Revoke(m_hWnd);
// old style file-manager drag&drop support: we retain the old-style
// DragAcceptFiles in parallel with SetDropTarget.
-void wxWindow::DragAcceptFiles(bool accept)
+void wxWindowMSW::DragAcceptFiles(bool accept)
{
HWND hWnd = GetHwnd();
if ( hWnd )
#if wxUSE_TOOLTIPS
-void wxWindow::DoSetToolTip(wxToolTip *tooltip)
+void wxWindowMSW::DoSetToolTip(wxToolTip *tooltip)
{
wxWindowBase::DoSetToolTip(tooltip);
// ---------------------------------------------------------------------------
// Get total size
-void wxWindow::DoGetSize(int *x, int *y) const
+void wxWindowMSW::DoGetSize(int *x, int *y) const
{
HWND hWnd = GetHwnd();
RECT rect;
*y = rect.bottom - rect.top;
}
-void wxWindow::DoGetPosition(int *x, int *y) const
+void wxWindowMSW::DoGetPosition(int *x, int *y) const
{
HWND hWnd = GetHwnd();
*y = point.y;
}
-void wxWindow::DoScreenToClient(int *x, int *y) const
+void wxWindowMSW::DoScreenToClient(int *x, int *y) const
{
POINT pt;
if ( x )
*y = pt.y;
}
-void wxWindow::DoClientToScreen(int *x, int *y) const
+void wxWindowMSW::DoClientToScreen(int *x, int *y) const
{
POINT pt;
if ( x )
}
// Get size *available for subwindows* i.e. excluding menu bar etc.
-void wxWindow::DoGetClientSize(int *x, int *y) const
+void wxWindowMSW::DoGetClientSize(int *x, int *y) const
{
HWND hWnd = GetHwnd();
RECT rect;
*y = rect.bottom;
}
-void wxWindow::DoMoveWindow(int x, int y, int width, int height)
+void wxWindowMSW::DoMoveWindow(int x, int y, int width, int height)
{
if ( !::MoveWindow(GetHwnd(), x, y, width, height, TRUE) )
{
// If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
// the width/height to best suit our contents, otherwise we reuse the current
// width/height
-void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
// get the current size and position...
int currentX, currentY;
DoMoveWindow(x, y, width, height);
}
-void wxWindow::DoSetClientSize(int width, int height)
+void wxWindowMSW::DoSetClientSize(int width, int height)
{
wxWindow *parent = GetParent();
HWND hWnd = GetHwnd();
// For implementation purposes - sometimes decorations make the client area
// smaller
-wxPoint wxWindow::GetClientAreaOrigin() const
+wxPoint wxWindowMSW::GetClientAreaOrigin() const
{
return wxPoint(0, 0);
}
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
-void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
+void wxWindowMSW::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
{
// don't do it for the dialogs/frames - they float independently of their
// parent
if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent )
{
wxPoint pt(parent->GetClientAreaOrigin());
- x += pt.x; y += pt.y;
+ x += pt.x;
+ y += pt.y;
}
}
}
// text metrics
// ---------------------------------------------------------------------------
-int wxWindow::GetCharHeight() const
+int wxWindowMSW::GetCharHeight() const
{
return wxGetTextMetrics(this).tmHeight;
}
-int wxWindow::GetCharWidth() const
+int wxWindowMSW::GetCharWidth() const
{
// +1 is needed because Windows apparently adds it when calculating the
// dialog units size in pixels
#if wxDIALOG_UNIT_COMPATIBILITY
- return wxGetTextMetrics(this).tmAveCharWidth ;
+ return wxGetTextMetrics(this).tmAveCharWidth;
#else
return wxGetTextMetrics(this).tmAveCharWidth + 1;
#endif
}
-void wxWindow::GetTextExtent(const wxString& string,
+void wxWindowMSW::GetTextExtent(const wxString& string,
int *x, int *y,
int *descent, int *externalLeading,
const wxFont *theFont) const
// Caret manipulation
// ---------------------------------------------------------------------------
-void wxWindow::CreateCaret(int w, int h)
+void wxWindowMSW::CreateCaret(int w, int h)
{
SetCaret(new wxCaret(this, w, h));
}
-void wxWindow::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
+void wxWindowMSW::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
{
wxFAIL_MSG("not implemented");
}
-void wxWindow::ShowCaret(bool show)
+void wxWindowMSW::ShowCaret(bool show)
{
wxCHECK_RET( m_caret, "no caret to show" );
m_caret->Show(show);
}
-void wxWindow::DestroyCaret()
+void wxWindowMSW::DestroyCaret()
{
SetCaret(NULL);
}
-void wxWindow::SetCaretPos(int x, int y)
+void wxWindowMSW::SetCaretPos(int x, int y)
{
wxCHECK_RET( m_caret, "no caret to move" );
m_caret->Move(x, y);
}
-void wxWindow::GetCaretPos(int *x, int *y) const
+void wxWindowMSW::GetCaretPos(int *x, int *y) const
{
wxCHECK_RET( m_caret, "no caret to get position of" );
}
}
-bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
+#if wxUSE_MENUS_NATIVE
+
+bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y)
{
menu->SetInvokingWindow(this);
menu->UpdateUI();
return TRUE;
}
+#endif // wxUSE_MENUS_NATIVE
+
// ===========================================================================
// pre/post message processing
// ===========================================================================
-long wxWindow::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+long wxWindowMSW::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
if ( m_oldWndProc )
return ::CallWindowProc(CASTWNDPROC m_oldWndProc, GetHwnd(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
return ::DefWindowProc(GetHwnd(), nMsg, wParam, lParam);
}
-bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
+bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
{
+ // wxUniversal implements tab traversal itself
+#ifndef __WXUNIVERSAL__
if ( m_hWnd != 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL) )
{
// intercept dialog navigation keys
bProcess = FALSE;
}
+#if wxUSE_BUTTON
else
{
wxPanel *panel = wxDynamicThisCast(this, wxPanel);
// it work like a TAB - and that's what we do.
// Note that Ctrl-Enter always works this way.
}
+#endif // wxUSE_BUTTON
}
break;
if ( GetEventHandler()->ProcessEvent(event) )
{
+#if wxUSE_BUTTON
wxButton *btn = wxDynamicCast(FindFocus(), wxButton);
if ( btn )
{
// the button which has focus should be default
btn->SetDefault();
}
+#endif // wxUSE_BUTTON
return TRUE;
}
return TRUE;
}
}
+#endif // __WXUNIVERSAL__
#if wxUSE_TOOLTIPS
if ( m_tooltip )
return FALSE;
}
-bool wxWindow::MSWTranslateMessage(WXMSG* pMsg)
+bool wxWindowMSW::MSWTranslateMessage(WXMSG* pMsg)
{
+#if wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
return m_acceleratorTable.Translate(this, pMsg);
+#else
+ return FALSE;
+#endif // wxUSE_ACCEL
}
// ---------------------------------------------------------------------------
#ifdef __WIN32__
-void wxWindow::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
WORD *id, WXHWND *hwnd, WORD *cmd)
{
*id = LOWORD(wParam);
*cmd = HIWORD(wParam);
}
-void wxWindow::UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *state, WXWORD *minimized, WXHWND *hwnd)
{
*state = LOWORD(wParam);
*hwnd = (WXHWND)lParam;
}
-void wxWindow::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *code, WXWORD *pos, WXHWND *hwnd)
{
*code = LOWORD(wParam);
*hwnd = (WXHWND)lParam;
}
-void wxWindow::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd)
{
*nCtlColor = CTLCOLOR_BTN;
*hdc = (WXHDC)wParam;
}
-void wxWindow::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *item, WXWORD *flags, WXHMENU *hmenu)
{
*item = (WXWORD)wParam;
#else // Win16
-void wxWindow::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *id, WXHWND *hwnd, WXWORD *cmd)
{
*id = (WXWORD)wParam;
*cmd = HIWORD(lParam);
}
-void wxWindow::UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *state, WXWORD *minimized, WXHWND *hwnd)
{
*state = (WXWORD)wParam;
*hwnd = (WXHWND)HIWORD(lParam);
}
-void wxWindow::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *code, WXWORD *pos, WXHWND *hwnd)
{
*code = (WXWORD)wParam;
*hwnd = (WXHWND)HIWORD(lParam);
}
-void wxWindow::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd)
{
*hwnd = (WXHWND)LOWORD(lParam);
*hdc = (WXHDC)wParam;
}
-void wxWindow::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
+void wxWindowMSW::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *item, WXWORD *flags, WXHMENU *hmenu)
{
*item = (WXWORD)wParam;
// Hook for new window just as it's being created, when the window isn't yet
// associated with the handle
-wxWindow *wxWndHook = NULL;
+wxWindowMSW *wxWndHook = NULL;
// Main window proc
LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
wxGetMessageName(message), wParam, lParam);
#endif // __WXDEBUG__
- wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd);
+ wxWindowMSW *wnd = wxFindWinFromHandle((WXHWND) hWnd);
// when we get the first message for the HWND we just created, we associate
// it with wxWindow stored in wxWndHook
return rc;
}
-long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
// did we process the message?
bool processed = FALSE;
break;
case WM_SIZE:
- processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
+ switch ( wParam )
+ {
+ case SIZE_MAXHIDE:
+ case SIZE_MAXSHOW:
+ // we're not interested in these messages at all
+ break;
+
+ case SIZE_MINIMIZED:
+ // we shouldn't send sizev events for these messages as the
+ // client size may be negative which breaks existing code
+ //
+ // OTOH we might send another (wxMinimizedEvent?) one or
+ // add an additional parameter to wxSizeEvent if this is
+ // useful to anybody
+ break;
+
+ default:
+ wxFAIL_MSG( _T("unexpected WM_SIZE parameter") );
+ // fall through nevertheless
+
+ case SIZE_MAXIMIZED:
+ case SIZE_RESTORED:
+ processed = HandleSize(LOWORD(lParam), HIWORD(lParam),
+ wParam);
+ }
+ break;
+
+#ifdef __WXUNIVERSAL__
+ case WM_ACTIVATEAPP:
+ wxTheApp->SetActive(wParam != 0, FindFocus());
break;
+ case WM_NCHITTEST:
+ // we shouldn't allow the windows which don't want to get focus to
+ // get it
+ if ( !AcceptsFocus() )
+ {
+ rc.result = HTTRANSPARENT;
+ processed = TRUE;
+ }
+ break;
+#endif // __WXUNIVERSAL__
+
case WM_ACTIVATE:
{
WXWORD state, minimized;
static int gs_AssociationCount = 0;
#endif
-void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
+void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win)
{
// adding NULL hWnd is (first) surely a result of an error and
// (secondly) breaks menu command processing
}
}
-void wxRemoveHandleAssociation(wxWindow *win)
+void wxRemoveHandleAssociation(wxWindowMSW *win)
{
#if 0 // def __WXDEBUG__
if (wxWinHandleList->Member(win))
// Default destroyer - override if you destroy it in some other way
// (e.g. with MDI child windows)
-void wxWindow::MSWDestroyWindow()
+void wxWindowMSW::MSWDestroyWindow()
{
}
-void wxWindow::MSWDetachWindowMenu()
+void wxWindowMSW::MSWDetachWindowMenu()
{
if ( m_hMenu )
{
}
}
-bool wxWindow::MSWCreate(int id,
- wxWindow *parent,
- const wxChar *wclass,
- wxWindow *WXUNUSED(wx_win),
- const wxChar *title,
- int x,
- int y,
- int width,
- int height,
- WXDWORD style,
- const wxChar *dialog_template,
- WXDWORD extendedStyle)
+bool wxWindowMSW::MSWCreate(int id,
+ wxWindow *parent,
+ const wxChar *wclass,
+ wxWindow * WXUNUSED(wx_win),
+ const wxChar *title,
+ int x,
+ int y,
+ int width,
+ int height,
+ WXDWORD style,
+ const wxChar *dialog_template,
+ WXDWORD extendedStyle)
{
int x1 = CW_USEDEFAULT;
int y1 = 0;
// Find parent's size, if it exists, to set up a possible default
// panel size the size of the parent window
- RECT parent_rect;
+ RECT rectParent;
if ( parent )
{
- ::GetClientRect((HWND) parent->GetHWND(), &parent_rect);
+ ::GetClientRect(GetHwndOf(parent), &rectParent);
- width1 = parent_rect.right - parent_rect.left;
- height1 = parent_rect.bottom - parent_rect.top;
+ width1 = rectParent.right - rectParent.left;
+ height1 = rectParent.bottom - rectParent.top;
}
if ( x != -1 )
}
#endif // 0
- HWND hParent = parent ? GetHwndOf(parent) : NULL;
+ HWND hParent;
+ if ( GetWindowStyleFlag() & wxPOPUP_WINDOW )
+ {
+ // popup windows should have desktop as parent because they shouldn't
+ // be limited to the parents client area as child windows usually are
+ hParent = ::GetDesktopWindow();
+ }
+ else if ( parent )
+ {
+ hParent = GetHwndOf(parent);
+ }
+ else
+ {
+ // top level window
+ hParent = NULL;
+ }
wxWndHook = this;
{
int controlId = 0;
if ( style & WS_CHILD )
+ {
controlId = id;
- if ( GetWindowStyleFlag() & wxCLIP_SIBLINGS )
- style |= WS_CLIPSIBLINGS;
+ if ( GetWindowStyleFlag() & wxCLIP_SIBLINGS )
+ {
+ style |= WS_CLIPSIBLINGS;
+ }
+ }
wxString className(wclass);
if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
#ifdef __WIN95__
// FIXME: VZ: I'm not sure at all that the order of processing is correct
-bool wxWindow::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
+bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
LPNMHDR hdr = (LPNMHDR)lParam;
HWND hWnd = hdr->hwndFrom;
return MSWOnNotify(idCtrl, lParam, result);
}
-bool wxWindow::MSWOnNotify(int WXUNUSED(idCtrl),
+bool wxWindowMSW::MSWOnNotify(int WXUNUSED(idCtrl),
WXLPARAM lParam,
WXLPARAM* WXUNUSED(result))
{
// end session messages
// ---------------------------------------------------------------------------
-bool wxWindow::HandleQueryEndSession(long logOff, bool *mayEnd)
+bool wxWindowMSW::HandleQueryEndSession(long logOff, bool *mayEnd)
{
wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1);
event.SetEventObject(wxTheApp);
return rc;
}
-bool wxWindow::HandleEndSession(bool endSession, long logOff)
+bool wxWindowMSW::HandleEndSession(bool endSession, long logOff)
{
// do nothing if the session isn't ending
if ( !endSession )
// window creation/destruction
// ---------------------------------------------------------------------------
-bool wxWindow::HandleCreate(WXLPCREATESTRUCT WXUNUSED(cs), bool *mayCreate)
+bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT WXUNUSED(cs), bool *mayCreate)
{
// TODO: should generate this event from WM_NCCREATE
- wxWindowCreateEvent event(this);
+ wxWindowCreateEvent event((wxWindow *)this);
(void)GetEventHandler()->ProcessEvent(event);
*mayCreate = TRUE;
return TRUE;
}
-bool wxWindow::HandleDestroy()
+bool wxWindowMSW::HandleDestroy()
{
- wxWindowDestroyEvent event(this);
+ wxWindowDestroyEvent event((wxWindow *)this);
(void)GetEventHandler()->ProcessEvent(event);
// delete our drop target if we've got one
// activation/focus
// ---------------------------------------------------------------------------
-void wxWindow::OnSetFocus(wxFocusEvent& event)
+void wxWindowMSW::OnSetFocus(wxFocusEvent& event)
{
// panel wants to track the window which was the last to have focus in it,
// so we want to set ourselves as the window which last had focus
// notice that it's also important to do it upwards the tree becaus
// otherwise when the top level panel gets focus, it won't set it back to
// us, but to some other sibling
- wxWindow *win = this;
+ wxWindow *win = (wxWindow *)this;
while ( win )
{
wxWindow *parent = win->GetParent();
event.Skip();
}
-bool wxWindow::HandleActivate(int state,
+bool wxWindowMSW::HandleActivate(int state,
bool WXUNUSED(minimized),
WXHWND WXUNUSED(activate))
{
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd))
+bool wxWindowMSW::HandleSetFocus(WXHWND hwnd)
{
#if wxUSE_CARET
// Deal with caret
wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
event.SetEventObject(this);
+ // wxFindWinFromHandle() may return NULL, it is ok
+ event.SetWindow(wxFindWinFromHandle(hwnd));
+
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleKillFocus(WXHWND WXUNUSED(hwnd))
+bool wxWindowMSW::HandleKillFocus(WXHWND hwnd)
{
#if wxUSE_CARET
// Deal with caret
wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId);
event.SetEventObject(this);
+ // wxFindWinFromHandle() may return NULL, it is ok
+ event.SetWindow(wxFindWinFromHandle(hwnd));
+
return GetEventHandler()->ProcessEvent(event);
}
// miscellaneous
// ---------------------------------------------------------------------------
-bool wxWindow::HandleShow(bool show, int WXUNUSED(status))
+bool wxWindowMSW::HandleShow(bool show, int WXUNUSED(status))
{
wxShowEvent event(GetId(), show);
event.m_eventObject = this;
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleInitDialog(WXHWND WXUNUSED(hWndFocus))
+bool wxWindowMSW::HandleInitDialog(WXHWND WXUNUSED(hWndFocus))
{
wxInitDialogEvent event(GetId());
event.m_eventObject = this;
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleDropFiles(WXWPARAM wParam)
+bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam)
{
HDROP hFilesInfo = (HDROP) wParam;
POINT dropPoint;
return rc;
}
-bool wxWindow::HandleSetCursor(WXHWND WXUNUSED(hWnd),
- short nHitTest,
- int WXUNUSED(mouseMsg))
+bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd),
+ short nHitTest,
+ int WXUNUSED(mouseMsg))
{
// the logic is as follows:
// -1. don't set cursor for non client area, including but not limited to
// owner drawn stuff
// ---------------------------------------------------------------------------
-bool wxWindow::MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *itemStruct)
+bool wxWindowMSW::MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *itemStruct)
{
#if wxUSE_OWNER_DRAWN
+
+#if wxUSE_MENUS_NATIVE
// is it a menu item?
if ( id == 0 )
{
(wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
);
}
+#endif // wxUSE_MENUS_NATIVE
+#if wxUSE_CONTROLS
wxWindow *item = FindItem(id);
if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
{
return ((wxControl *)item)->MSWOnDraw(itemStruct);
}
+#endif // wxUSE_CONTROLS
+
#endif // USE_OWNER_DRAWN
return FALSE;
}
-bool wxWindow::MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *itemStruct)
+bool wxWindowMSW::MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *itemStruct)
{
#if wxUSE_OWNER_DRAWN
// is it a menu item?
// colours and palettes
// ---------------------------------------------------------------------------
-bool wxWindow::HandleSysColorChange()
+bool wxWindowMSW::HandleSysColorChange()
{
wxSysColourChangedEvent event;
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleCtlColor(WXHBRUSH *brush,
+bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush,
WXHDC pDC,
WXHWND pWnd,
WXUINT nCtlColor,
{
hBrush = OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
}
+#if wxUSE_CONTROLS
else
{
wxControl *item = (wxControl *)FindItemByHWND(pWnd, TRUE);
if ( item )
hBrush = item->OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
}
+#endif // wxUSE_CONTROLS
if ( hBrush )
*brush = hBrush;
}
// Define for each class of dialog and control
-WXHBRUSH wxWindow::OnCtlColor(WXHDC WXUNUSED(hDC),
- WXHWND WXUNUSED(hWnd),
- WXUINT WXUNUSED(nCtlColor),
- WXUINT WXUNUSED(message),
- WXWPARAM WXUNUSED(wParam),
- WXLPARAM WXUNUSED(lParam))
+WXHBRUSH wxWindowMSW::OnCtlColor(WXHDC WXUNUSED(hDC),
+ WXHWND WXUNUSED(hWnd),
+ WXUINT WXUNUSED(nCtlColor),
+ WXUINT WXUNUSED(message),
+ WXWPARAM WXUNUSED(wParam),
+ WXLPARAM WXUNUSED(lParam))
{
return (WXHBRUSH)0;
}
-bool wxWindow::HandlePaletteChanged(WXHWND hWndPalChange)
+bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange)
{
wxPaletteChangedEvent event(GetId());
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleQueryNewPalette()
+bool wxWindowMSW::HandleQueryNewPalette()
{
wxQueryNewPaletteEvent event(GetId());
event.SetEventObject(this);
}
// Responds to colour changes: passes event on to children.
-void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
+void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& event)
{
wxNode *node = GetChildren().First();
while ( node )
// painting
// ---------------------------------------------------------------------------
-bool wxWindow::HandlePaint()
+bool wxWindowMSW::HandlePaint()
{
#ifdef __WIN32__
HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
wxLogLastError(wxT("GetUpdateRgn"));
m_updateRegion = wxRegion((WXHRGN) hRegion);
-#else
+#else // Win16
RECT updateRect;
- ::GetUpdateRect(GetHwnd(), & updateRect, FALSE);
+ ::GetUpdateRect(GetHwnd(), &updateRect, FALSE);
m_updateRegion = wxRegion(updateRect.left, updateRect.top,
updateRect.right - updateRect.left,
updateRect.bottom - updateRect.top);
-#endif
+#endif // Win32/16
wxPaintEvent event(m_windowId);
event.SetEventObject(this);
- return GetEventHandler()->ProcessEvent(event);
+ bool processed = GetEventHandler()->ProcessEvent(event);
+
+ // note that we must generate NC event after the normal one as otherwise
+ // BeginPaint() will happily overwrite our decorations with the background
+ // colour
+ wxNcPaintEvent eventNc(m_windowId);
+ eventNc.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(eventNc);
+
+ return processed;
}
// Can be called from an application's OnPaint handler
-void wxWindow::OnPaint(wxPaintEvent& event)
+void wxWindowMSW::OnPaint(wxPaintEvent& event)
{
+#ifdef __WXUNIVERSAL__
+ event.Skip();
+#else
HDC hDC = (HDC) wxPaintDC::FindDCInCache((wxWindow*) event.GetEventObject());
if (hDC != 0)
{
MSWDefWindowProc(WM_PAINT, (WPARAM) hDC, 0);
}
+#endif
}
-bool wxWindow::HandleEraseBkgnd(WXHDC hdc)
+bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
{
// Prevents flicker when dragging
if ( ::IsIconic(GetHwnd()) )
wxDCTemp dc(hdc);
- dc.SetWindow(this);
+ dc.SetHDC(hdc);
+ dc.SetWindow((wxWindow *)this);
dc.BeginDrawing();
wxEraseEvent event(m_windowId, &dc);
return rc;
}
-void wxWindow::OnEraseBackground(wxEraseEvent& event)
+void wxWindowMSW::OnEraseBackground(wxEraseEvent& event)
{
RECT rect;
::GetClientRect(GetHwnd(), &rect);
// moving and resizing
// ---------------------------------------------------------------------------
-bool wxWindow::HandleMinimize()
+bool wxWindowMSW::HandleMinimize()
{
wxIconizeEvent event(m_windowId);
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleMaximize()
+bool wxWindowMSW::HandleMaximize()
{
wxMaximizeEvent event(m_windowId);
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleMove(int x, int y)
+bool wxWindowMSW::HandleMove(int x, int y)
{
wxMoveEvent event(wxPoint(x, y), m_windowId);
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleSize(int w, int h, WXUINT WXUNUSED(flag))
+bool wxWindowMSW::HandleSize(int w, int h, WXUINT WXUNUSED(flag))
{
wxSizeEvent event(wxSize(w, h), m_windowId);
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleGetMinMaxInfo(void *mmInfo)
+bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo)
{
MINMAXINFO *info = (MINMAXINFO *)mmInfo;
return rc;
}
-// generate an artificial resize event
-/* FUNCTION IS NOW A MEMBER OF wxFrame - gt
-void wxWindow::SendSizeEvent()
-{
- RECT r;
-#ifdef __WIN16__
- ::GetWindowRect(GetHwnd(), &r);
-#else
- if ( !::GetWindowRect(GetHwnd(), &r) )
- {
- wxLogLastError(_T("GetWindowRect"));
- }
-#endif
-
- (void)::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED,
- MAKELPARAM(r.right - r.left, r.bottom - r.top));
-}
-*/
-
// ---------------------------------------------------------------------------
// command messages
// ---------------------------------------------------------------------------
-bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
+bool wxWindowMSW::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
+#if wxUSE_MENUS_NATIVE
if ( wxCurrentPopupMenu )
{
wxMenu *popupMenu = wxCurrentPopupMenu;
return popupMenu->MSWCommand(cmd, id);
}
+#endif // wxUSE_MENUS_NATIVE
wxWindow *win = (wxWindow*) NULL;
if ( cmd == 0 || cmd == 1 ) // menu or accel - use id
return FALSE;
}
-bool wxWindow::HandleSysCommand(WXWPARAM wParam, WXLPARAM WXUNUSED(lParam))
+bool wxWindowMSW::HandleSysCommand(WXWPARAM wParam, WXLPARAM WXUNUSED(lParam))
{
// 4 bits are reserved
switch ( wParam & 0xFFFFFFF0 )
// mouse events
// ---------------------------------------------------------------------------
-void wxWindow::InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags)
+void wxWindowMSW::InitMouseEvent(wxMouseEvent& event,
+ int x, int y,
+ WXUINT flags)
{
- event.m_x = x;
- event.m_y = y;
- event.m_shiftDown = ((flags & MK_SHIFT) != 0);
- event.m_controlDown = ((flags & MK_CONTROL) != 0);
- event.m_leftDown = ((flags & MK_LBUTTON) != 0);
- event.m_middleDown = ((flags & MK_MBUTTON) != 0);
- event.m_rightDown = ((flags & MK_RBUTTON) != 0);
+ // our client coords are not quite the same as Windows ones
+ wxPoint pt = GetClientAreaOrigin();
+ event.m_x = x - pt.x;
+ event.m_y = y - pt.y;
+
+ event.m_shiftDown = (flags & MK_SHIFT) != 0;
+ event.m_controlDown = (flags & MK_CONTROL) != 0;
+ event.m_leftDown = (flags & MK_LBUTTON) != 0;
+ event.m_middleDown = (flags & MK_MBUTTON) != 0;
+ event.m_rightDown = (flags & MK_RBUTTON) != 0;
event.m_altDown = (::GetKeyState(VK_MENU) & 0x80000000) != 0;
+
event.SetTimestamp(s_currentMsg.time);
event.m_eventObject = this;
m_lastMouseY = y;
m_lastMouseEvent = event.GetEventType();
#endif // wxUSE_MOUSEEVENT_HACK
-
}
-bool wxWindow::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags)
+bool wxWindowMSW::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags)
{
// the mouse events take consecutive IDs from WM_MOUSEFIRST to
// WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
return GetEventHandler()->ProcessEvent(event);
}
-bool wxWindow::HandleMouseMove(int x, int y, WXUINT flags)
+bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags)
{
if ( !m_mouseInWindow )
{
- // Generate an ENTER event
- m_mouseInWindow = TRUE;
+ // it would be wrong to assume that just because we get a mouse move
+ // event that the mouse is inside the window: although this is usually
+ // true, it is not if we had captured the mouse, so we need to check
+ // the mouse coordinates here
+ if ( !HasCapture() || IsMouseInWindow() )
+ {
+ // Generate an ENTER event
+ m_mouseInWindow = TRUE;
- wxMouseEvent event(wxEVT_ENTER_WINDOW);
- InitMouseEvent(event, x, y, flags);
+ wxMouseEvent event(wxEVT_ENTER_WINDOW);
+ InitMouseEvent(event, x, y, flags);
- (void)GetEventHandler()->ProcessEvent(event);
+ (void)GetEventHandler()->ProcessEvent(event);
+ }
}
#if wxUSE_MOUSEEVENT_HACK
// create the key event of the given type for the given key - used by
// HandleChar and HandleKeyDown/Up
-wxKeyEvent wxWindow::CreateKeyEvent(wxEventType evType,
+wxKeyEvent wxWindowMSW::CreateKeyEvent(wxEventType evType,
int id,
WXLPARAM lParam) const
{
// isASCII is TRUE only when we're called from WM_CHAR handler and not from
// WM_KEYDOWN one
-bool wxWindow::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII)
+bool wxWindowMSW::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII)
{
bool ctrlDown = FALSE;
return FALSE;
}
-bool wxWindow::HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam)
+bool wxWindowMSW::HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam)
{
int id = wxCharCodeMSWToWX(wParam);
return FALSE;
}
-bool wxWindow::HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam)
+bool wxWindowMSW::HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam)
{
int id = wxCharCodeMSWToWX(wParam);
// joystick
// ---------------------------------------------------------------------------
-bool wxWindow::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags)
+bool wxWindowMSW::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags)
{
int change = 0;
if ( flags & JOY_BUTTON1CHG )
// scrolling
// ---------------------------------------------------------------------------
-bool wxWindow::MSWOnScroll(int orientation, WXWORD wParam,
+bool wxWindowMSW::MSWOnScroll(int orientation, WXWORD wParam,
WXWORD pos, WXHWND control)
{
if ( control )
}
#endif //__WXDEBUG__
-static void TranslateKbdEventToMouse(wxWindow *win, int *x, int *y, WPARAM *flags)
+static void TranslateKbdEventToMouse(wxWindowMSW *win,
+ int *x, int *y, WPARAM *flags)
{
// construct the key mask
WPARAM& fwKeys = *flags;
win->ScreenToClient(x, y);
}
-static TEXTMETRIC wxGetTextMetrics(const wxWindow *win)
+static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win)
{
// prepare the DC
TEXTMETRIC tm;
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/bmpbuttn.cpp
+// Purpose: wxBitmapButton implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univbmpbuttn.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_BMPBUTTON
+
+#ifndef WX_PRECOMP
+ #include "wx/dc.h"
+ #include "wx/bmpbuttn.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/renderer.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
+
+BEGIN_EVENT_TABLE(wxBitmapButton, wxButton)
+ EVT_SET_FOCUS(wxBitmapButton::OnSetFocus)
+ EVT_KILL_FOCUS(wxBitmapButton::OnKillFocus)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// wxBitmapButton
+// ----------------------------------------------------------------------------
+
+bool wxBitmapButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ if ( !wxButton::Create(parent, id, bitmap, _T(""),
+ pos, size, style, validator, name) )
+ return FALSE;
+
+ m_bmpNormal = bitmap;
+
+ return TRUE;
+}
+
+void wxBitmapButton::OnSetBitmap()
+{
+ wxBitmap bmp;
+ if ( !IsEnabled() )
+ {
+ bmp = m_bmpDisabled;
+ }
+ else if ( IsPressed() )
+ {
+ bmp = m_bmpSelected;
+ }
+ else if ( IsFocused() )
+ {
+ bmp = m_bmpFocus;
+ }
+ else
+ {
+ bmp = m_bmpNormal;
+ }
+
+ ChangeBitmap(bmp);
+}
+
+bool wxBitmapButton::ChangeBitmap(const wxBitmap& bmp)
+{
+ wxBitmap bitmap = bmp.Ok() ? bmp : m_bmpNormal;
+ if ( bitmap != m_bitmap )
+ {
+ m_bitmap = bitmap;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+bool wxBitmapButton::Enable(bool enable)
+{
+ if ( !wxButton::Enable(enable) )
+ return FALSE;
+
+ if ( !enable && ChangeBitmap(m_bmpDisabled) )
+ Refresh();
+
+ return TRUE;
+}
+
+bool wxBitmapButton::SetCurrent(bool doit)
+{
+ ChangeBitmap(doit ? m_bmpFocus : m_bmpNormal);
+
+ return wxButton::SetCurrent(doit);
+}
+
+void wxBitmapButton::OnSetFocus(wxFocusEvent& event)
+{
+ if ( ChangeBitmap(m_bmpFocus) )
+ Refresh();
+
+ event.Skip();
+}
+
+void wxBitmapButton::OnKillFocus(wxFocusEvent& event)
+{
+ if ( ChangeBitmap(m_bmpNormal) )
+ Refresh();
+
+ event.Skip();
+}
+
+void wxBitmapButton::Press()
+{
+ ChangeBitmap(m_bmpSelected);
+
+ wxButton::Press();
+}
+
+void wxBitmapButton::Release()
+{
+ ChangeBitmap(IsFocused() ? m_bmpFocus : m_bmpNormal);
+
+ wxButton::Release();
+}
+
+#endif // wxUSE_BMPBUTTON
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/button.cpp
+// Purpose: wxButton
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univbutton.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_BUTTON
+
+#ifndef WX_PRECOMP
+ #include "wx/dcclient.h"
+ #include "wx/dcscreen.h"
+ #include "wx/button.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// default margins around the image
+static const wxCoord DEFAULT_BTN_MARGIN_X = 0;
+static const wxCoord DEFAULT_BTN_MARGIN_Y = 0;
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+void wxButton::Init()
+{
+ m_isPressed =
+ m_isDefault = FALSE;
+}
+
+bool wxButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxString &label,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ // center label by default
+ if ( !(style & wxALIGN_MASK) )
+ {
+ style |= wxALIGN_CENTRE_HORIZONTAL | wxALIGN_CENTRE_VERTICAL;
+ }
+
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ SetLabel(label);
+ SetImageLabel(bitmap);
+ // SetBestSize(size); -- called by SetImageLabel()
+
+ CreateInputHandler(wxINP_HANDLER_BUTTON);
+
+ return TRUE;
+}
+
+wxButton::~wxButton()
+{
+}
+
+// ----------------------------------------------------------------------------
+// size management
+// ----------------------------------------------------------------------------
+
+/* static */
+wxSize wxButtonBase::GetDefaultSize()
+{
+ static wxSize s_sizeBtn;
+
+ if ( s_sizeBtn.x == 0 )
+ {
+ wxScreenDC dc;
+
+ // this corresponds more or less to wxMSW standard in Win32 theme (see
+ // wxWin32Renderer::AdjustSize())
+ s_sizeBtn.x = 8*dc.GetCharWidth();
+ s_sizeBtn.y = (11*dc.GetCharHeight())/10 + 2;
+ }
+
+ return s_sizeBtn;
+}
+
+wxSize wxButton::DoGetBestClientSize() const
+{
+ wxClientDC dc(wxConstCast(this, wxButton));
+ wxCoord width, height;
+ dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
+
+ if ( m_bitmap.Ok() )
+ {
+ // allocate extra space for the bitmap
+ wxCoord heightBmp = m_bitmap.GetHeight() + 2*m_marginBmpY;
+ if ( height < heightBmp )
+ height = heightBmp;
+
+ width += m_bitmap.GetWidth() + 2*m_marginBmpX;
+ }
+
+ // for compatibility with other ports, the buttons default size is never
+ // less than the standard one
+ wxSize szDef = GetDefaultSize();
+ if ( width < szDef.x )
+ width = szDef.x;
+
+ return wxSize(width, height);
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+void wxButton::DoDraw(wxControlRenderer *renderer)
+{
+ renderer->DrawButtonBorder();
+ renderer->DrawLabel(m_bitmap, m_marginBmpX, m_marginBmpY);
+}
+
+// ----------------------------------------------------------------------------
+// input processing
+// ----------------------------------------------------------------------------
+
+void wxButton::Press()
+{
+ if ( !m_isPressed )
+ {
+ m_isPressed = TRUE;
+
+ Refresh();
+ }
+}
+
+void wxButton::Release()
+{
+ if ( m_isPressed )
+ {
+ m_isPressed = FALSE;
+
+ Refresh();
+ }
+}
+
+void wxButton::Toggle()
+{
+ if ( m_isPressed )
+ Release();
+ else
+ Press();
+
+ if ( !m_isPressed )
+ {
+ // releasing button after it had been pressed generates a click event
+ Click();
+ }
+}
+
+void wxButton::Click()
+{
+ wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
+ InitCommandEvent(event);
+ Command(event);
+}
+
+bool wxButton::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ if ( action == wxACTION_BUTTON_TOGGLE )
+ Toggle();
+ else if ( action == wxACTION_BUTTON_CLICK )
+ Click();
+ else if ( action == wxACTION_BUTTON_PRESS )
+ Press();
+ else if ( action == wxACTION_BUTTON_RELEASE )
+ Release();
+ else
+ return wxControl::PerformAction(action, numArg, strArg);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// misc
+// ----------------------------------------------------------------------------
+
+void wxButton::SetImageLabel(const wxBitmap& bitmap)
+{
+ m_bitmap = bitmap;
+
+ SetImageMargins(DEFAULT_BTN_MARGIN_X, DEFAULT_BTN_MARGIN_Y);
+}
+
+void wxButton::SetImageMargins(wxCoord x, wxCoord y)
+{
+ m_marginBmpX = x;
+ m_marginBmpY = y;
+
+ SetBestSize(wxDefaultSize);
+}
+
+void wxButton::SetDefault()
+{
+ m_isDefault = TRUE;
+}
+
+// ============================================================================
+// wxStdButtonInputHandler
+// ============================================================================
+
+wxStdButtonInputHandler::wxStdButtonInputHandler(wxInputHandler *handler)
+ : wxStdInputHandler(handler)
+{
+ m_winCapture = NULL;
+ m_winHasMouse = FALSE;
+}
+
+bool wxStdButtonInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ int keycode = event.GetKeyCode();
+ if ( keycode == WXK_SPACE || keycode == WXK_RETURN )
+ {
+ control->PerformAction(wxACTION_BUTTON_TOGGLE);
+
+ return TRUE;
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdButtonInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ // the button has 2 states: pressed and normal with the following
+ // transitions between them:
+ //
+ // normal -> left down -> capture mouse and go to pressed state
+ // pressed -> left up inside -> generate click -> go to normal
+ // outside ------------------>
+ //
+ // the other mouse buttons are ignored
+ if ( event.Button(1) )
+ {
+ if ( event.ButtonDown(1) )
+ {
+ m_winCapture = control;
+ m_winCapture->CaptureMouse();
+ m_winHasMouse = TRUE;
+
+ control->PerformAction(wxACTION_BUTTON_PRESS);
+
+ return TRUE;
+ }
+ else // up
+ {
+ if ( m_winCapture )
+ {
+ m_winCapture->ReleaseMouse();
+ m_winCapture = NULL;
+ }
+
+ if ( m_winHasMouse )
+ {
+ // this will generate a click event
+ control->PerformAction(wxACTION_BUTTON_TOGGLE);
+
+ return TRUE;
+ }
+ //else: the mouse was released outside the window, this doesn't
+ // count as a click
+ }
+ }
+
+ return wxStdInputHandler::HandleMouse(control, event);
+}
+
+bool wxStdButtonInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ // we only have to do something when the mouse leaves/enters the pressed
+ // button and don't care about the other ones
+ if ( event.GetEventObject() == m_winCapture )
+ {
+ // leaving the button should remove its pressed state
+ if ( event.Leaving() )
+ {
+ // remember that the mouse is now outside
+ m_winHasMouse = FALSE;
+
+ // we do have a pressed button, so release it
+ control->SetCurrent(FALSE);
+ control->PerformAction(wxACTION_BUTTON_RELEASE);
+
+ return TRUE;
+ }
+ // and entering it back should make it pressed again if it had been
+ // pressed
+ else if ( event.Entering() )
+ {
+ // the mouse is (back) inside the button
+ m_winHasMouse = TRUE;
+
+ // we did have a pressed button which we released when leaving the
+ // window, press it again
+ control->SetCurrent(TRUE);
+ control->PerformAction(wxACTION_BUTTON_PRESS);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdInputHandler::HandleMouseMove(control, event);
+}
+
+bool wxStdButtonInputHandler::HandleFocus(wxControl *control,
+ const wxFocusEvent& event)
+{
+ // buttons change appearance when they get/lose focus, so return TRUE to
+ // refresh
+ return TRUE;
+}
+
+bool wxStdButtonInputHandler::HandleActivation(wxControl *control,
+ bool activated)
+{
+ // the default button changes appearance when the app is [de]activated, so
+ // return TRUE to refresh
+ return wxStaticCast(control, wxButton)->IsDefault();
+}
+
+#endif // wxUSE_BUTTON
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/checkbox.cpp
+// Purpose: wxCheckBox implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univcheckbox.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_CHECKBOX
+
+#ifndef WX_PRECOMP
+ #include "wx/dcclient.h"
+ #include "wx/checkbox.h"
+ #include "wx/validate.h"
+
+ #include "wx/button.h" // for wxACTION_BUTTON_XXX
+#endif
+
+#include "wx/univ/theme.h"
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/colschem.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
+
+// ----------------------------------------------------------------------------
+// wxCheckBox
+// ----------------------------------------------------------------------------
+
+void wxCheckBox::Init()
+{
+ m_isPressed = FALSE;
+ m_status = Status_Unchecked;
+}
+
+bool wxCheckBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ SetLabel(label);
+ SetBestSize(size);
+
+ CreateInputHandler(wxINP_HANDLER_CHECKBOX);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// checkbox interface
+// ----------------------------------------------------------------------------
+
+bool wxCheckBox::GetValue() const
+{
+ return m_status == Status_Checked;
+}
+
+void wxCheckBox::SetValue(bool value)
+{
+ Status status = value ? Status_Checked : Status_Unchecked;
+ if ( status != m_status )
+ {
+ m_status = status;
+
+ if ( m_status == Status_Checked )
+ {
+ // invoke the hook
+ OnCheck();
+ }
+
+ Refresh();
+ }
+}
+
+void wxCheckBox::OnCheck()
+{
+ // we do nothing here
+}
+
+// ----------------------------------------------------------------------------
+// indicator bitmaps
+// ----------------------------------------------------------------------------
+
+wxBitmap wxCheckBox::GetBitmap(State state, Status status) const
+{
+ wxBitmap bmp = m_bitmaps[state][status];
+ if ( !bmp.Ok() )
+ bmp = m_bitmaps[State_Normal][status];
+
+ return bmp;
+}
+
+void wxCheckBox::SetBitmap(const wxBitmap& bmp, State state, Status status)
+{
+ m_bitmaps[state][status] = bmp;
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+wxCheckBox::State wxCheckBox::GetState(int flags) const
+{
+ if ( flags & wxCONTROL_DISABLED )
+ return State_Disabled;
+ else if ( flags & wxCONTROL_PRESSED )
+ return State_Pressed;
+ else if ( flags & wxCONTROL_CURRENT )
+ return State_Current;
+ else
+ return State_Normal;
+}
+
+void wxCheckBox::DoDraw(wxControlRenderer *renderer)
+{
+ int flags = GetStateFlags();
+
+ wxDC& dc = renderer->GetDC();
+ dc.SetFont(GetFont());
+ dc.SetTextForeground(GetForegroundColour());
+
+ if ( m_status == Status_Checked )
+ flags |= wxCONTROL_CHECKED;
+
+ renderer->GetRenderer()->
+ DrawCheckButton(dc,
+ GetLabel(),
+ GetBitmap(GetState(flags), m_status),
+ renderer->GetRect(),
+ flags,
+ GetWindowStyle() & wxALIGN_RIGHT ? wxALIGN_RIGHT
+ : wxALIGN_LEFT,
+ GetAccelIndex());
+}
+
+// ----------------------------------------------------------------------------
+// geometry calculations
+// ----------------------------------------------------------------------------
+
+wxSize wxCheckBox::GetBitmapSize() const
+{
+ wxBitmap bmp = GetBitmap(State_Normal, Status_Checked);
+ return bmp.Ok() ? wxSize(bmp.GetWidth(), bmp.GetHeight())
+ : GetRenderer()->GetCheckBitmapSize();
+}
+
+wxSize wxCheckBox::DoGetBestClientSize() const
+{
+ wxClientDC dc(wxConstCast(this, wxCheckBox));
+ dc.SetFont(GetFont());
+ wxCoord width, height;
+ dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
+
+ wxSize sizeBmp = GetBitmapSize();
+ if ( height < sizeBmp.y )
+ height = sizeBmp.y;
+
+#if wxUNIV_COMPATIBLE_MSW
+ // this looks better but is different from what wxMSW does
+ height += GetCharHeight()/2;
+#endif // wxUNIV_COMPATIBLE_MSW
+
+ width += sizeBmp.x + 2*GetCharWidth();
+
+ return wxSize(width, height);
+}
+
+// ----------------------------------------------------------------------------
+// checkbox actions
+// ----------------------------------------------------------------------------
+
+void wxCheckBox::Press()
+{
+ if ( !m_isPressed )
+ {
+ m_isPressed = TRUE;
+
+ Refresh();
+ }
+}
+
+void wxCheckBox::Release()
+{
+ if ( m_isPressed )
+ {
+ m_isPressed = FALSE;
+
+ Refresh();
+ }
+}
+
+void wxCheckBox::Toggle()
+{
+ m_isPressed = FALSE;
+
+ ChangeValue(!GetValue());
+}
+
+void wxCheckBox::ChangeValue(bool value)
+{
+ SetValue(value);
+
+ SendEvent();
+}
+
+void wxCheckBox::SendEvent()
+{
+ wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, GetId());
+ InitCommandEvent(event);
+ event.SetInt(IsChecked());
+ Command(event);
+}
+
+// ----------------------------------------------------------------------------
+// input handling
+// ----------------------------------------------------------------------------
+
+bool wxCheckBox::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ if ( action == wxACTION_BUTTON_PRESS )
+ Press();
+ else if ( action == wxACTION_BUTTON_RELEASE )
+ Release();
+ if ( action == wxACTION_CHECKBOX_CHECK )
+ ChangeValue(TRUE);
+ else if ( action == wxACTION_CHECKBOX_CLEAR )
+ ChangeValue(FALSE);
+ else if ( action == wxACTION_CHECKBOX_TOGGLE )
+ Toggle();
+ else
+ return wxControl::PerformAction(action, numArg, strArg);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxStdCheckboxInputHandler
+// ----------------------------------------------------------------------------
+
+wxStdCheckboxInputHandler::wxStdCheckboxInputHandler(wxInputHandler *inphand)
+ : wxStdButtonInputHandler(inphand)
+{
+}
+
+bool wxStdCheckboxInputHandler::HandleActivation(wxControl *control,
+ bool activated)
+{
+ // only the focused checkbox appearance changes when the app gains/loses
+ // activation
+ return control->IsFocused();
+}
+
+#endif // wxUSE_CHECKBOX
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/checklst.cpp
+// Purpose: wxCheckListBox implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univchecklst.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_CHECKLISTBOX
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+
+ #include "wx/dcclient.h"
+ #include "wx/checklst.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ============================================================================
+// implementation of wxCheckListBox
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+void wxCheckListBox::Init()
+{
+}
+
+bool wxCheckListBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ int n,
+ const wxString choices[],
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ if ( !wxListBox::Create(parent, id, pos, size,
+ n, choices, style, validator, name) )
+ return FALSE;
+
+ CreateInputHandler(wxINP_HANDLER_CHECKLISTBOX);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxCheckListBox functions
+// ----------------------------------------------------------------------------
+
+bool wxCheckListBox::IsChecked(size_t item) const
+{
+ wxCHECK_MSG( item < m_checks.GetCount(), FALSE,
+ _T("invalid index in wxCheckListBox::IsChecked") );
+
+ return m_checks[item] != 0;
+}
+
+void wxCheckListBox::Check(size_t item, bool check)
+{
+ wxCHECK_RET( item < m_checks.GetCount(),
+ _T("invalid index in wxCheckListBox::Check") );
+
+ // intermediate var is needed to avoid compiler warning with VC++
+ bool isChecked = m_checks[item] != 0;
+ if ( check != isChecked )
+ {
+ m_checks[item] = check;
+
+ RefreshItem(item);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// methods forwarded to wxListBox
+// ----------------------------------------------------------------------------
+
+void wxCheckListBox::Delete(int n)
+{
+ wxCHECK_RET( n < GetCount(), _T("invalid index in wxListBox::Delete") );
+
+ wxListBox::Delete(n);
+
+ m_checks.RemoveAt(n);
+}
+
+int wxCheckListBox::DoAppend(const wxString& item)
+{
+ int pos = wxListBox::DoAppend(item);
+
+ // the item is initially unchecked
+ m_checks.Insert(FALSE, pos);
+
+ return pos;
+}
+
+void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos)
+{
+ wxListBox::DoInsertItems(items, pos);
+
+ size_t count = items.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ m_checks.Insert(FALSE, pos + n);
+ }
+}
+
+void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData)
+{
+ // call it first as it does DoClear()
+ wxListBox::DoSetItems(items, clientData);
+
+ size_t count = items.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ m_checks.Add(FALSE);
+ }
+}
+
+void wxCheckListBox::DoClear()
+{
+ m_checks.Empty();
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+wxSize wxCheckListBox::DoGetBestClientSize() const
+{
+ wxSize size = wxListBox::DoGetBestClientSize();
+ size.x += GetRenderer()->GetCheckBitmapSize().x;
+
+ return size;
+}
+
+void wxCheckListBox::DoDrawRange(wxControlRenderer *renderer,
+ int itemFirst, int itemLast)
+{
+ renderer->DrawCheckItems(this, itemFirst, itemLast);
+}
+
+// ----------------------------------------------------------------------------
+// actions
+// ----------------------------------------------------------------------------
+
+bool wxCheckListBox::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ if ( action == wxACTION_CHECKLISTBOX_TOGGLE )
+ {
+ int sel = (int)numArg;
+ if ( sel == -1 )
+ {
+ sel = GetSelection();
+ }
+
+ if ( sel != -1 )
+ {
+ Check(sel, !IsChecked(sel));
+
+ SendEvent(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, sel);
+ }
+ }
+ else
+ {
+ return wxListBox::PerformAction(action, numArg, strArg);
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxStdCheckListboxInputHandler
+// ----------------------------------------------------------------------------
+
+wxStdCheckListboxInputHandler::
+wxStdCheckListboxInputHandler(wxInputHandler *inphand)
+ : wxStdListboxInputHandler(inphand)
+{
+}
+
+bool wxStdCheckListboxInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ if ( pressed && (event.GetKeyCode() == WXK_SPACE) )
+ control->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE);
+
+ return wxStdListboxInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdCheckListboxInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ if ( event.LeftDown() || event.LeftDClick() )
+ {
+ wxCheckListBox *lbox = wxStaticCast(control, wxCheckListBox);
+ int x, y;
+
+ wxPoint pt = event.GetPosition();
+ pt -= control->GetClientAreaOrigin();
+ lbox->CalcUnscrolledPosition(pt.x, pt.y, &x, &y);
+
+ wxRenderer *renderer = lbox->GetRenderer();
+ x -= renderer->GetCheckItemMargin();
+
+ int item = y / lbox->GetLineHeight();
+ if ( x >= 0 &&
+ x < renderer->GetCheckBitmapSize().x &&
+ item >= 0 &&
+ item < lbox->GetCount() )
+ {
+ lbox->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE, item);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdListboxInputHandler::HandleMouse(control, event);
+}
+
+#endif // wxUSE_CHECKLISTBOX
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/colschem.cpp
+// Purpose: (trivial) wxColourScheme implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "colschem.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif // WX_PRECOMP
+
+#include "wx/univ/colschem.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+wxColourScheme::~wxColourScheme()
+{
+}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/combobox.cpp
+// Purpose: wxComboControl and wxComboBox implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.12.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ TODO:
+
+ +1. typing in the text should select the string in listbox
+ +2. scrollbars in listbox are unusable
+ +3. the initially selected item is not selected
+ ?4. kbd interface (what does GTK do?)
+ 5. there is still autoscrolling without scrollbars - but is it bad?
+ */
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univcombobox.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_COMBOBOX
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+
+ #include "wx/button.h"
+ #include "wx/combobox.h"
+ #include "wx/listbox.h"
+ #include "wx/textctrl.h"
+
+ #include "wx/validate.h"
+#endif
+
+#include "wx/popupwin.h"
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+/*
+ The keyboard event flow:
+
+ 1. they always come to the text ctrl
+ 2. it forwards the ones it doesn't process to the wxComboControl
+ 3. which passes them to the popup window if it is popped up
+ */
+
+// ----------------------------------------------------------------------------
+// wxComboButton is just a normal button except that it sends commands to the
+// combobox and not its parent
+// ----------------------------------------------------------------------------
+
+class wxComboButton : public wxBitmapButton
+{
+public:
+ wxComboButton(wxComboControl *combo)
+ : wxBitmapButton(combo->GetParent(), -1, wxNullBitmap,
+ wxDefaultPosition, wxDefaultSize,
+ wxBORDER_NONE)
+ {
+ m_combo = combo;
+
+ wxBitmap bmpNormal, bmpPressed, bmpDisabled;
+
+ GetRenderer()->GetComboBitmaps(&bmpNormal, &bmpPressed, &bmpDisabled);
+ SetBitmapLabel(bmpNormal);
+ SetBitmapFocus(bmpNormal);
+ SetBitmapSelected(bmpPressed);
+ SetBitmapDisabled(bmpDisabled);
+
+ SetSize(bmpNormal.GetWidth(), bmpNormal.GetHeight());
+ }
+
+protected:
+ void OnButton(wxCommandEvent& event) { m_combo->ShowPopup(); }
+
+ virtual wxSize DoGetBestSize() const { return GetSize(); }
+
+private:
+ wxComboControl *m_combo;
+
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// wxComboListBox is a listbox modified to be used as a popup window in a
+// combobox
+// ----------------------------------------------------------------------------
+
+class wxComboListBox : public wxListBox, public wxComboPopup
+{
+public:
+ // ctor and dtor
+ wxComboListBox(wxComboControl *combo, int style = 0);
+ virtual ~wxComboListBox();
+
+ // implement wxComboPopup methods
+ virtual bool SetSelection(const wxString& value);
+ virtual wxControl *GetControl() { return this; }
+ virtual void OnShow();
+
+protected:
+ // we shouldn't return height too big from here
+ virtual wxSize DoGetBestClientSize() const;
+
+ // filter mouse move events happening outside the list box
+ void OnMouseMove(wxMouseEvent& event);
+
+ // called whenever the user selects or activates a listbox item
+ void OnSelect(wxCommandEvent& event);
+
+ // used to process wxUniv actions
+ bool PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg);
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// wxComboTextCtrl is a simple text ctrl which forwards
+// wxEVT_COMMAND_TEXT_UPDATED events and all key events to the combobox
+// ----------------------------------------------------------------------------
+
+class wxComboTextCtrl : public wxTextCtrl
+{
+public:
+ wxComboTextCtrl(wxComboControl *combo,
+ const wxString& value,
+ long style,
+ const wxValidator& validator);
+
+protected:
+ void OnKey(wxKeyEvent& event);
+ void OnText(wxCommandEvent& event);
+
+private:
+ wxComboControl *m_combo;
+
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// event tables and such
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(wxComboButton, wxButton)
+ EVT_BUTTON(-1, wxComboButton::OnButton)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(wxComboListBox, wxListBox)
+ EVT_LISTBOX(-1, wxComboListBox::OnSelect)
+ EVT_LISTBOX_DCLICK(-1, wxComboListBox::OnSelect)
+ EVT_MOTION(wxComboListBox::OnMouseMove)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(wxComboControl, wxControl)
+ EVT_KEY_DOWN(wxComboControl::OnKey)
+ EVT_KEY_UP(wxComboControl::OnKey)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(wxComboTextCtrl, wxTextCtrl)
+ EVT_KEY_DOWN(wxComboTextCtrl::OnKey)
+ EVT_KEY_UP(wxComboTextCtrl::OnKey)
+ EVT_TEXT(-1, wxComboTextCtrl::OnText)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl);
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxComboControl creation
+// ----------------------------------------------------------------------------
+
+void wxComboControl::Init()
+{
+ m_popup = (wxComboPopup *)NULL;
+ m_winPopup = (wxPopupComboWindow *)NULL;
+ m_isPopupShown = FALSE;
+}
+
+bool wxComboControl::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ // first create our own window, i.e. the one which will contain all
+ // subcontrols
+ style &= ~wxBORDER_NONE;
+ style |= wxBORDER_SUNKEN;
+ if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
+ return FALSE;
+
+ // create the text control and the button as our siblings (*not* children),
+ // don't care about size/position here - they will be set in DoMoveWindow()
+ m_btn = new wxComboButton(this);
+ m_text = new wxComboTextCtrl(this,
+ value,
+ style & wxCB_READONLY ? wxTE_READONLY : 0,
+ validator);
+
+ // for compatibility with the other ports, the height specified is the
+ // combined height of the combobox itself and the popup
+ if ( size.y == -1 )
+ {
+ // ok, use default height for popup too
+ m_heightPopup = -1;
+ }
+ else
+ {
+ m_heightPopup = size.y - DoGetBestSize().y;
+ }
+
+ DoSetSize(pos.x, pos.y, size.x, size.y);
+
+ // create the popup window immediately here to allow creating the controls
+ // with parent == GetPopupWindow() from the derived class ctor
+ m_winPopup = new wxPopupComboWindow(this);
+
+ // have to disable this window to avoid interfering it with message
+ // processing to the text and the button... but pretend it is enabled to
+ // make IsEnabled() return TRUE
+ wxControl::Enable(FALSE); // don't use non virtual Disable() here!
+ m_isEnabled = TRUE;
+
+ CreateInputHandler(wxINP_HANDLER_COMBOBOX);
+
+ return TRUE;
+}
+
+wxComboControl::~wxComboControl()
+{
+ // as the button and the text control are the parent's children and not
+ // ours, we have to delete them manually - they are not deleted
+ // automatically by wxWindows when we're deleted
+ delete m_btn;
+ delete m_text;
+
+ delete m_winPopup;
+}
+
+// ----------------------------------------------------------------------------
+// geometry stuff
+// ----------------------------------------------------------------------------
+
+void wxComboControl::DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags)
+{
+ // combo height is always fixed
+ wxControl::DoSetSize(x, y, width, DoGetBestSize().y, sizeFlags);
+}
+
+wxSize wxComboControl::DoGetBestClientSize() const
+{
+ wxSize sizeBtn = m_btn->GetBestSize(),
+ sizeText = m_text->GetBestSize();
+
+ return wxSize(sizeBtn.x + sizeText.x, wxMax(sizeBtn.y, sizeText.y));
+}
+
+void wxComboControl::DoMoveWindow(int x, int y, int width, int height)
+{
+ wxControl::DoMoveWindow(x, y, width, height);
+
+ // position the subcontrols inside the client area
+ wxRect rectBorders = GetRenderer()->GetBorderDimensions(GetBorder());
+ x += rectBorders.x;
+ y += rectBorders.y;
+ width -= rectBorders.x + rectBorders.width;
+ height -= rectBorders.y + rectBorders.height;
+
+ wxSize sizeBtn = m_btn->GetSize(),
+ sizeText = m_text->GetSize();
+
+ wxCoord wText = width - sizeBtn.x;
+ m_text->SetSize(x, y, wText, height);
+ m_btn->SetSize(x + wText, y, -1, height);
+}
+
+// ----------------------------------------------------------------------------
+// operations
+// ----------------------------------------------------------------------------
+
+bool wxComboControl::Enable(bool enable)
+{
+ if ( !wxControl::Enable(enable) )
+ return FALSE;
+
+ m_btn->Enable(enable);
+ m_text->Enable(enable);
+
+ return TRUE;
+}
+
+bool wxComboControl::Show(bool show)
+{
+ if ( !wxControl::Show(show) )
+ return FALSE;
+
+ m_btn->Show(show);
+ m_text->Show(show);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// popup window handling
+// ----------------------------------------------------------------------------
+
+void wxComboControl::SetPopupControl(wxComboPopup *popup)
+{
+ m_popup = popup;
+}
+
+void wxComboControl::ShowPopup()
+{
+ wxCHECK_RET( m_popup, _T("no popup to show in wxComboControl") );
+ wxCHECK_RET( !IsPopupShown(), _T("popup window already shown") );
+
+ wxControl *control = m_popup->GetControl();
+
+ // size and position the popup window correctly
+ m_winPopup->SetSize(GetSize().x,
+ m_heightPopup == -1 ? control->GetBestSize().y
+ : m_heightPopup);
+ wxSize sizePopup = m_winPopup->GetClientSize();
+ control->SetSize(0, 0, sizePopup.x, sizePopup.y);
+
+ // some controls don't accept the size we give then: e.g. a listbox may
+ // require more space to show its last row
+ wxSize sizeReal = control->GetSize();
+ if ( sizeReal != sizePopup )
+ {
+ m_winPopup->SetClientSize(sizeReal);
+ }
+
+ m_winPopup->PositionNearCombo();
+
+ // show it
+ m_winPopup->Popup(m_text);
+ m_text->SelectAll();
+ m_popup->SetSelection(m_text->GetValue());
+
+ m_isPopupShown = TRUE;
+}
+
+void wxComboControl::HidePopup()
+{
+ wxCHECK_RET( m_popup, _T("no popup to hide in wxComboControl") );
+ wxCHECK_RET( IsPopupShown(), _T("popup window not shown") );
+
+ m_winPopup->Dismiss();
+
+ m_isPopupShown = FALSE;
+}
+
+void wxComboControl::OnSelect(const wxString& value)
+{
+ m_text->SetValue(value);
+ m_text->SelectAll();
+
+ OnDismiss();
+}
+
+void wxComboControl::OnDismiss()
+{
+ HidePopup();
+ m_text->SetFocus();
+}
+
+// ----------------------------------------------------------------------------
+// wxComboTextCtrl
+// ----------------------------------------------------------------------------
+
+wxComboTextCtrl::wxComboTextCtrl(wxComboControl *combo,
+ const wxString& value,
+ long style,
+ const wxValidator& validator)
+ : wxTextCtrl(combo->GetParent(), -1, value,
+ wxDefaultPosition, wxDefaultSize,
+ wxBORDER_NONE | style,
+ validator)
+{
+ m_combo = combo;
+}
+
+void wxComboTextCtrl::OnText(wxCommandEvent& event)
+{
+ if ( m_combo->IsPopupShown() )
+ {
+ m_combo->GetPopupControl()->SetSelection(GetValue());
+ }
+
+ // we need to make a copy of the event to have the correct originating
+ // object and id
+ wxCommandEvent event2 = event;
+ event2.SetEventObject(m_combo);
+ event2.SetId(m_combo->GetId());
+
+ // there is a small incompatibility with wxMSW here: the combobox gets the
+ // event before the text control in our case which corresponds to SMW
+ // CBN_EDITUPDATE notification and not CBN_EDITCHANGE one wxMSW currently
+ // uses
+ //
+ // if this is really a problem, we can play games with the event handlers
+ // to circumvent this
+ (void)m_combo->ProcessEvent(event2);
+
+ event.Skip();
+}
+
+// pass the keys we don't process to the combo first
+void wxComboTextCtrl::OnKey(wxKeyEvent& event)
+{
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_RETURN:
+ // the popup control gets it first but only if it is shown
+ if ( !m_combo->IsPopupShown() )
+ break;
+ //else: fall through
+
+ case WXK_UP:
+ case WXK_DOWN:
+ case WXK_ESCAPE:
+ case WXK_PAGEDOWN:
+ case WXK_PAGEUP:
+ case WXK_PRIOR:
+ case WXK_NEXT:
+ (void)m_combo->ProcessEvent(event);
+ return;
+ }
+
+ event.Skip();
+}
+
+// ----------------------------------------------------------------------------
+// wxComboListBox
+// ----------------------------------------------------------------------------
+
+wxComboListBox::wxComboListBox(wxComboControl *combo, int style)
+ : wxListBox(combo->GetPopupWindow(), -1,
+ wxDefaultPosition, wxDefaultSize,
+ 0, NULL,
+ wxBORDER_SIMPLE | wxLB_INT_HEIGHT | style),
+ wxComboPopup(combo)
+{
+ // we don't react to the mouse events outside the window at all
+ StopAutoScrolling();
+}
+
+wxComboListBox::~wxComboListBox()
+{
+}
+
+bool wxComboListBox::SetSelection(const wxString& value)
+{
+ // FindItem() would just find the current item for an empty string (it
+ // always matches), but we want to show the first one in such case
+ if ( value.empty() )
+ {
+ if ( GetCount() )
+ {
+ wxListBox::SetSelection(0);
+ }
+ //else: empty listbox - nothing to do
+ }
+ else if ( !FindItem(value) )
+ {
+ // no match att all
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void wxComboListBox::OnSelect(wxCommandEvent& event)
+{
+ // first let the user code have the event
+
+ // all fields are already filled by the listbox, just change the event
+ // type and send it to the combo
+ wxCommandEvent event2 = event;
+ event2.SetEventType(wxEVT_COMMAND_COMBOBOX_SELECTED);
+ event2.SetEventObject(m_combo);
+ event2.SetId(m_combo->GetId());
+ m_combo->ProcessEvent(event2);
+
+ // next update the combo and close the listbox
+ m_combo->OnSelect(event.GetString());
+}
+
+void wxComboListBox::OnShow()
+{
+}
+
+bool wxComboListBox::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+
+{
+ if ( action == wxACTION_LISTBOX_FIND )
+ {
+ // we don't let the listbox handle this as instead of just using the
+ // single key presses, as usual, we use the text ctrl value as prefix
+ // and this is done by wxComboControl itself
+ return TRUE;
+ }
+
+ return wxListBox::PerformAction(action, numArg, strArg);
+}
+
+void wxComboListBox::OnMouseMove(wxMouseEvent& event)
+{
+ // while a wxComboListBox is shown, it always has capture, so if it doesn't
+ // we're about to go away anyhow (normally this shouldn't happen at all,
+ // but I don't put assert here as it just might do on other platforms and
+ // it doesn't break anythign anyhow)
+ if ( this == wxWindow::GetCapture() )
+ {
+ if ( HitTest(event.GetPosition()) == wxHT_WINDOW_INSIDE )
+ {
+ event.Skip();
+ }
+ //else: popup shouldn't react to the mouse motions outside it, it only
+ // captures the mouse to be able to detect when it must be
+ // dismissed, so don't call Skip()
+ }
+}
+
+wxSize wxComboListBox::DoGetBestClientSize() const
+{
+ // don't return size too big or we risk to not fit on the screen
+ wxSize size = wxListBox::DoGetBestClientSize();
+ wxCoord hChar = GetCharHeight();
+
+ int nLines = size.y / hChar;
+
+ // 10 is the same limit as used by wxMSW
+ if ( nLines > 10 )
+ {
+ size.y = 10*hChar;
+ }
+
+ return size;
+}
+
+// ----------------------------------------------------------------------------
+// wxComboBox
+// ----------------------------------------------------------------------------
+
+void wxComboBox::Init()
+{
+ m_lbox = (wxListBox *)NULL;
+}
+
+bool wxComboBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString *choices,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ if ( !wxComboControl::Create(parent, id, value, pos, size, style,
+ validator, name) )
+ {
+ return FALSE;
+ }
+
+ wxComboListBox *combolbox =
+ new wxComboListBox(this, style & wxCB_SORT ? wxLB_SORT : 0);
+ m_lbox = combolbox;
+ m_lbox->Set(n, choices);
+
+ SetPopupControl(combolbox);
+
+ return TRUE;
+}
+
+wxComboBox::~wxComboBox()
+{
+}
+
+// ----------------------------------------------------------------------------
+// wxComboBox methods forwarded to wxTextCtrl
+// ----------------------------------------------------------------------------
+
+wxString wxComboBox::GetValue() const
+{
+ return GetText()->GetValue();
+}
+
+void wxComboBox::SetValue(const wxString& value)
+{
+ GetText()->SetValue(value);
+}
+
+void wxComboBox::Copy()
+{
+ GetText()->Copy();
+}
+
+void wxComboBox::Cut()
+{
+ GetText()->Cut();
+}
+
+void wxComboBox::Paste()
+{
+ GetText()->Paste();
+}
+
+void wxComboBox::SetInsertionPoint(long pos)
+{
+ GetText()->SetInsertionPoint(pos);
+}
+
+void wxComboBox::SetInsertionPointEnd()
+{
+ GetText()->SetInsertionPointEnd();
+}
+
+long wxComboBox::GetInsertionPoint() const
+{
+ return GetText()->GetInsertionPoint();
+}
+
+long wxComboBox::GetLastPosition() const
+{
+ return GetText()->GetLastPosition();
+}
+
+void wxComboBox::Replace(long from, long to, const wxString& value)
+{
+ GetText()->Replace(from, to, value);
+}
+
+void wxComboBox::Remove(long from, long to)
+{
+ GetText()->Remove(from, to);
+}
+
+void wxComboBox::SetSelection(long from, long to)
+{
+ GetText()->SetSelection(from, to);
+}
+
+void wxComboBox::SetEditable(bool editable)
+{
+ GetText()->SetEditable(editable);
+}
+
+// ----------------------------------------------------------------------------
+// wxComboBox methods forwarded to wxListBox
+// ----------------------------------------------------------------------------
+
+void wxComboBox::Clear()
+{
+ GetLBox()->Clear();
+}
+
+void wxComboBox::Delete(int n)
+{
+ GetLBox()->Delete(n);
+}
+
+int wxComboBox::GetCount() const
+{
+ return GetLBox()->GetCount();
+}
+
+wxString wxComboBox::GetString(int n) const
+{
+ return GetLBox()->GetString(n);
+}
+
+void wxComboBox::SetString(int n, const wxString& s)
+{
+ GetLBox()->SetString(n, s);
+}
+
+int wxComboBox::FindString(const wxString& s) const
+{
+ return GetLBox()->FindString(s);
+}
+
+void wxComboBox::Select(int n)
+{
+ wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid combobox index") );
+
+ GetLBox()->SetSelection(n);
+ GetText()->SetValue(GetLBox()->GetString(n));
+}
+
+int wxComboBox::GetSelection() const
+{
+ // if the current value isn't one of the listbox strings, return -1
+ return FindString(GetText()->GetValue());
+}
+
+int wxComboBox::DoAppend(const wxString& item)
+{
+ return GetLBox()->Append(item);
+}
+
+void wxComboBox::DoSetItemClientData(int n, void* clientData)
+{
+ GetLBox()->SetClientData(n, clientData);
+}
+
+void *wxComboBox::DoGetItemClientData(int n) const
+{
+ return GetLBox()->GetClientData(n);
+}
+
+void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData)
+{
+ GetLBox()->SetClientObject(n, clientData);
+}
+
+wxClientData* wxComboBox::DoGetItemClientObject(int n) const
+{
+ return GetLBox()->GetClientObject(n);
+}
+
+// ----------------------------------------------------------------------------
+// input handling
+// ----------------------------------------------------------------------------
+
+void wxComboControl::OnKey(wxCommandEvent& event)
+{
+ if ( m_isPopupShown )
+ {
+ // pass it to the popped up control
+ (void)m_popup->GetControl()->ProcessEvent(event);
+ }
+ else // no popup
+ {
+ event.Skip();
+ }
+}
+
+bool wxComboControl::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ bool processed = FALSE;
+ if ( action == wxACTION_COMBOBOX_POPUP )
+ {
+ if ( !m_isPopupShown )
+ {
+ ShowPopup();
+
+ processed = TRUE;
+ }
+ }
+ else if ( action == wxACTION_COMBOBOX_DISMISS )
+ {
+ if ( m_isPopupShown )
+ {
+ HidePopup();
+
+ processed = TRUE;
+ }
+ }
+
+ if ( !processed )
+ {
+ // pass along
+ return wxControl::PerformAction(action, numArg, strArg);
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxStdComboBoxInputHandler
+// ----------------------------------------------------------------------------
+
+wxStdComboBoxInputHandler::wxStdComboBoxInputHandler(wxInputHandler *inphand)
+ : wxStdInputHandler(inphand)
+{
+}
+
+bool wxStdComboBoxInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ if ( pressed )
+ {
+ wxControlAction action;
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_DOWN:
+ action = wxACTION_COMBOBOX_POPUP;
+ break;
+
+ case WXK_ESCAPE:
+ action = wxACTION_COMBOBOX_DISMISS;
+ break;
+ }
+
+ if ( !!action )
+ {
+ control->PerformAction(action);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+#endif // wxUSE_COMBOBOX
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/univ/control.cpp
+// Purpose: universal wxControl: adds handling of mnemonics
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+#ifdef __GNUG__
+ #pragma implementation "control.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_CONTROLS
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/control.h"
+ #include "wx/dcclient.h"
+#endif
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
+
+BEGIN_EVENT_TABLE(wxControl, wxControlBase)
+ EVT_KEY_DOWN(wxControl::OnKeyDown)
+ EVT_KEY_UP(wxControl::OnKeyUp)
+
+ EVT_MOUSE_EVENTS(wxControl::OnMouse)
+
+ EVT_SET_FOCUS(wxControl::OnFocus)
+ EVT_KILL_FOCUS(wxControl::OnFocus)
+
+ EVT_ACTIVATE(wxControl::OnActivate)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+void wxControl::Init()
+{
+ m_indexAccel = -1;
+
+ m_handler = (wxInputHandler *)NULL;
+}
+
+bool wxControl::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ if ( !wxControlBase::Create(parent, id, pos, size, style, validator, name) )
+ return FALSE;
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// mnemonics handling
+// ----------------------------------------------------------------------------
+
+/* static */
+int wxControl::FindAccelIndex(const wxString& label, wxString *labelOnly)
+{
+ // the character following MNEMONIC_PREFIX is the accelerator for this
+ // control unless it is MNEMONIC_PREFIX too - this allows to insert
+ // literal MNEMONIC_PREFIX chars into the label
+ static const wxChar MNEMONIC_PREFIX = _T('&');
+
+ if ( labelOnly )
+ {
+ labelOnly->Empty();
+ labelOnly->Alloc(label.length());
+ }
+
+ int indexAccel = -1;
+ for ( const wxChar *pc = label; *pc != wxT('\0'); pc++ )
+ {
+ if ( *pc == MNEMONIC_PREFIX )
+ {
+ pc++; // skip it
+ if ( *pc != MNEMONIC_PREFIX )
+ {
+ if ( indexAccel == -1 )
+ {
+ // remember it (-1 is for MNEMONIC_PREFIX itself
+ indexAccel = pc - label.c_str() - 1;
+ }
+ else
+ {
+ wxFAIL_MSG(_T("duplicate accel char in control label"));
+ }
+ }
+ }
+
+ if ( labelOnly )
+ {
+ *labelOnly += *pc;
+ }
+ }
+
+ return indexAccel;
+}
+
+void wxControl::SetLabel(const wxString& label)
+{
+ wxString labelOld = m_label;
+ m_indexAccel = FindAccelIndex(label, &m_label);
+
+ if ( m_label != labelOld )
+ {
+ Refresh();
+ }
+}
+
+wxString wxControl::GetLabel() const
+{
+ return m_label;
+}
+
+// ----------------------------------------------------------------------------
+// focus/activation handling
+// ----------------------------------------------------------------------------
+
+void wxControl::OnFocus(wxFocusEvent& event)
+{
+ if ( m_handler && m_handler->HandleFocus(this, event) )
+ Refresh();
+ else
+ event.Skip();
+}
+
+void wxControl::OnActivate(wxActivateEvent& event)
+{
+ if ( m_handler && m_handler->HandleActivation(this, event.GetActive()) )
+ Refresh();
+ else
+ event.Skip();
+}
+
+// ----------------------------------------------------------------------------
+// input processing
+// ----------------------------------------------------------------------------
+
+void wxControl::CreateInputHandler(const wxString& inphandler)
+{
+ m_handler = wxTheme::Get()->GetInputHandler(inphandler);
+}
+
+void wxControl::OnKeyDown(wxKeyEvent& event)
+{
+ if ( !m_handler || !m_handler->HandleKey(this, event, TRUE) )
+ event.Skip();
+}
+
+void wxControl::OnKeyUp(wxKeyEvent& event)
+{
+ if ( !m_handler || !m_handler->HandleKey(this, event, FALSE) )
+ event.Skip();
+}
+
+void wxControl::OnMouse(wxMouseEvent& event)
+{
+ if ( m_handler )
+ {
+ if ( event.Moving() || event.Entering() || event.Leaving() )
+ {
+ if ( m_handler->HandleMouseMove(this, event) )
+ return;
+ }
+ else // a click action
+ {
+ if ( m_handler->HandleMouse(this, event) )
+ return;
+ }
+ }
+
+ event.Skip();
+}
+
+// ----------------------------------------------------------------------------
+// the actions
+// ----------------------------------------------------------------------------
+
+bool wxControl::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ return FALSE;
+}
+
+#endif // wxUSE_CONTROLS
--- /dev/null
+UNIVOBJS = \
+ bmpbuttn.o \
+ button.o \
+ checkbox.o \
+ checklst.o \
+ cmdproc.o \
+ colschem.o \
+ control.o \
+ framuniv.o \
+ inphand.o \
+ listbox.o \
+ radiobox.o \
+ radiobut.o \
+ renderer.o \
+ scrarrow.o \
+ scrolbar.o \
+ scrthumb.o \
+ slider.o \
+ spinbutt.o \
+ statbmp.o \
+ statbox.o \
+ statline.o \
+ stattext.o \
+ textctrl.o \
+ theme.o \
+ gtk.o \
+ winuniv.o \
+ win32.o
+
+UNIVDEPS = \
+ bmpbuttn.d \
+ button.d \
+ checkbox.d \
+ checklst.d \
+ cmdproc.d \
+ colschem.d \
+ control.d \
+ framuniv.d \
+ inphand.d \
+ listbox.d \
+ radiobox.d \
+ radiobut.d \
+ renderer.d \
+ scrarrow.d \
+ scrolbar.d \
+ scrthumb.d \
+ slider.d \
+ spinbutt.d \
+ statbmp.d \
+ statbox.d \
+ statline.d \
+ stattext.d \
+ textctrl.d \
+ theme.d \
+ gtk.d \
+ winuniv.d \
+ win32.d
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/frame.cpp
+// Purpose: wxFrame class for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.05.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univframe.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+ #include "wx/menu.h"
+#ifndef WX_PRECOMP
+ #include "wx/frame.h"
+#endif // WX_PRECOMP
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+BEGIN_EVENT_TABLE(wxFrame, wxFrameNative)
+ EVT_SIZE(wxFrame::OnSize)
+END_EVENT_TABLE()
+
+#if defined(__WXMSW__)
+ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameMSW)
+#elif defined(__WXGTK__)
+ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameGTK)
+#endif
+
+// ----------------------------------------------------------------------------
+// ctors
+// ----------------------------------------------------------------------------
+
+wxFrame::wxFrame()
+{
+}
+
+wxFrame::wxFrame(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+ : wxFrameNative(parent, id, title, pos, size, style, name)
+{
+ m_renderer = NULL;
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+void wxFrame::OnSize(wxSizeEvent& event)
+{
+ PositionMenuBar();
+
+ event.Skip();
+}
+
+void wxFrame::PositionMenuBar()
+{
+#if wxUSE_MENUS
+ if ( m_frameMenuBar )
+ {
+ // the menubar is positioned above the client size, hence the negative
+ // y coord
+ m_frameMenuBar->SetSize(0, -m_frameMenuBar->GetSize().y,
+ GetClientSize().x, -1);
+ }
+#endif // wxUSE_MENUS
+}
+
+wxPoint wxFrame::GetClientAreaOrigin() const
+{
+ wxPoint pt = wxFrameNative::GetClientAreaOrigin();
+
+#if wxUSE_MENUS
+ if ( m_frameMenuBar )
+ {
+ pt.y += m_frameMenuBar->GetSize().y;
+ }
+#endif // wxUSE_MENUS
+
+ return pt;
+}
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/gauge/gaugecmn.cpp
+// Purpose: wxGauge for wxUniversal
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// License: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "gaugeuniv.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif //WX_PRECOMP
+
+#include "wx/gauge.h"
+
+#if wxUSE_GAUGE
+
+#include "wx/univ/renderer.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxGauge creation
+// ----------------------------------------------------------------------------
+
+void wxGauge::Init()
+{
+ m_gaugePos =
+ m_rangeMax = 0;
+}
+
+bool wxGauge::Create(wxWindow *parent,
+ wxWindowID id,
+ int range,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ if ( !wxGaugeBase::Create(parent, id, range, pos, size, style,
+ validator, name) )
+ {
+ return FALSE;
+ }
+
+ SetBestSize(size);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxGauge range/position
+// ----------------------------------------------------------------------------
+
+void wxGauge::SetRange(int range)
+{
+ wxGaugeBase::SetRange(range);
+
+ Refresh();
+}
+
+void wxGauge::SetValue(int pos)
+{
+ wxGaugeBase::SetValue(pos);
+
+ Refresh();
+}
+
+// ----------------------------------------------------------------------------
+// wxGauge geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxGauge::DoGetBestClientSize() const
+{
+ wxSize size = GetRenderer()->GetProgressBarStep();
+
+ // these adjustments are really ridiculous - they are just done to find the
+ // "correct" result under Windows (FIXME)
+ if ( IsVertical() )
+ {
+ size.x = (3*size.y) / 2 + 2;
+ size.y = -1;
+ }
+ else
+ {
+ size.y = (3*size.x) / 2 + 2;
+ size.x = -1;
+ }
+
+ return size;
+}
+
+// ----------------------------------------------------------------------------
+// wxGauge drawing
+// ----------------------------------------------------------------------------
+
+wxBorder wxGauge::GetDefaultBorder() const
+{
+ return wxBORDER_STATIC;
+}
+
+void wxGauge::DoDraw(wxControlRenderer *renderer)
+{
+ renderer->DrawProgressBar(this);
+}
+
+#endif // wxUSE_GAUGE
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/inphand.cpp
+// Purpose: (trivial) wxInputHandler implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 18.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "inphand.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif // WX_PRECOMP
+
+#include "wx/univ/inphand.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxInputHandler
+// ----------------------------------------------------------------------------
+
+bool wxInputHandler::HandleMouseMove(wxControl * WXUNUSED(control),
+ const wxMouseEvent& WXUNUSED(event))
+{
+ return FALSE;
+}
+
+bool wxInputHandler::HandleFocus(wxControl *WXUNUSED(control),
+ const wxFocusEvent& WXUNUSED(event))
+{
+ return FALSE;
+}
+
+bool wxInputHandler::HandleActivation(wxControl *WXUNUSED(control),
+ bool WXUNUSED(activated))
+{
+ return FALSE;
+}
+
+wxInputHandler::~wxInputHandler()
+{
+}
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/listbox.cpp
+// Purpose: wxListBox implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 30.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univlistbox.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_LISTBOX
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+
+ #include "wx/dcclient.h"
+ #include "wx/listbox.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ============================================================================
+// implementation of wxListBox
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
+
+BEGIN_EVENT_TABLE(wxListBox, wxListBoxBase)
+ EVT_SIZE(wxListBox::OnSize)
+
+ EVT_IDLE(wxListBox::OnIdle)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// construction
+// ----------------------------------------------------------------------------
+
+void wxListBox::Init()
+{
+ // will be calculated later when needed
+ m_lineHeight = 0;
+ m_itemsPerPage = 0;
+ m_maxWidth = 0;
+ m_scrollRangeY = 0;
+ m_maxWidthItem = -1;
+
+ // no items hence no current item
+ m_current = -1;
+ m_selAnchor = -1;
+ m_currentChanged = FALSE;
+
+ // no need to update anything initially
+ m_updateCount = 0;
+
+ // no scrollbars to show nor update
+ m_updateScrollbarX =
+ m_showScrollbarX =
+ m_updateScrollbarY =
+ m_showScrollbarY = FALSE;
+}
+
+bool wxListBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ int n,
+ const wxString choices[],
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ // for compatibility accept both the new and old styles - they mean the
+ // same thing for us
+ if ( style & wxLB_ALWAYS_SB )
+ style |= wxALWAYS_SHOW_SB;
+
+ // if we don't have neither multiple nor extended flag, we must have the
+ // single selection listbox
+ if ( !(style & (wxLB_MULTIPLE | wxLB_EXTENDED)) )
+ style |= wxLB_SINGLE;
+
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ SetWindow(this);
+
+ if ( style & wxLB_SORT )
+ m_strings = wxArrayString(TRUE /* auto sort */);
+
+ Set(n, choices);
+
+ SetBestSize(size);
+
+ CreateInputHandler(wxINP_HANDLER_LISTBOX);
+
+ return TRUE;
+}
+
+wxListBox::~wxListBox()
+{
+}
+
+// ----------------------------------------------------------------------------
+// adding/inserting strings
+// ----------------------------------------------------------------------------
+
+int wxListBox::DoAppend(const wxString& item)
+{
+ size_t index = m_strings.Add(item);
+ m_itemsClientData.Insert(NULL, index);
+
+ m_updateScrollbarY = TRUE;
+
+ if ( HasHorzScrollbar() )
+ {
+ // has the max width increased?
+ wxCoord width;
+ GetTextExtent(item, &width, NULL);
+ if ( width > m_maxWidth )
+ {
+ m_maxWidth = width;
+ m_maxWidthItem = index;
+ m_updateScrollbarX = TRUE;
+ }
+ }
+
+ RefreshFromItemToEnd(index);
+
+ return index;
+}
+
+void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
+{
+ // the position of the item being added to a sorted listbox can't be
+ // specified
+ wxCHECK_RET( !IsSorted(), _T("can't insert items into sorted listbox") );
+
+ size_t count = items.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ m_strings.Insert(items[n], pos + n);
+ m_itemsClientData.Insert(NULL, pos + n);
+ }
+
+ // the number of items has changed so we might have to show the scrollbar
+ m_updateScrollbarY = TRUE;
+
+ // the max width also might have changed - just recalculate it instead of
+ // keeping track of it here, this is probably more efficient for a typical
+ // use pattern
+ RefreshHorzScrollbar();
+
+ // note that we have to refresh all the items after the ones we inserted,
+ // not just these items
+ RefreshFromItemToEnd(pos);
+}
+
+void wxListBox::DoSetItems(const wxArrayString& items, void **clientData)
+{
+ DoClear();
+
+ size_t count = items.GetCount();
+ if ( !count )
+ return;
+
+ m_strings.Alloc(count);
+ m_itemsClientData.Alloc(count);
+ for ( size_t n = 0; n < count; n++ )
+ {
+ size_t index = m_strings.Add(items[n]);
+ m_itemsClientData.Insert(clientData ? clientData[n] : NULL, index);
+ }
+
+ m_updateScrollbarY = TRUE;
+
+ RefreshAll();
+}
+
+void wxListBox::SetString(int n, const wxString& s)
+{
+ if ( HasHorzScrollbar() )
+ {
+ // we need to update m_maxWidth as changing the string may cause the
+ // horz scrollbar [dis]appear
+ wxCoord width;
+ m_strings[n] = s;
+ GetTextExtent(s, &width, NULL);
+
+ // it might have increased if the new string is long
+ if ( width > m_maxWidth )
+ {
+ m_maxWidth = width;
+ m_maxWidthItem = n;
+ m_updateScrollbarX = TRUE;
+ }
+ // or also decreased if the old string was the longest one
+ else if ( n == m_maxWidthItem )
+ {
+ RefreshHorzScrollbar();
+ }
+ }
+ else // no horz scrollbar
+ {
+ m_strings[n] = s;
+ }
+
+ RefreshItem(n);
+}
+
+// ----------------------------------------------------------------------------
+// removing strings
+// ----------------------------------------------------------------------------
+
+void wxListBox::DoClear()
+{
+ m_strings.Clear();
+
+ if ( HasClientObjectData() )
+ {
+ size_t count = m_itemsClientData.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ delete m_itemsClientData[n];
+ }
+ }
+
+ m_itemsClientData.Clear();
+ m_selections.Clear();
+
+ m_current = -1;
+}
+
+void wxListBox::Clear()
+{
+ DoClear();
+
+ m_updateScrollbarY = TRUE;
+
+ RefreshHorzScrollbar();
+
+ RefreshAll();
+}
+
+void wxListBox::Delete(int n)
+{
+ wxCHECK_RET( n < GetCount(), _T("invalid index in wxListBox::Delete") );
+
+ // do it before removing the index as otherwise the last item will not be
+ // refreshed (as GetCount() will be decremented)
+ RefreshFromItemToEnd(n);
+
+ m_strings.RemoveAt(n);
+
+ if ( HasClientObjectData() )
+ {
+ delete m_itemsClientData[n];
+ }
+
+ m_itemsClientData.RemoveAt(n);
+
+ // when the item disappears we must not keep using its index
+ if ( n == m_current )
+ {
+ m_current = -1;
+ }
+ else if ( n < m_current )
+ {
+ m_current--;
+ }
+ //else: current item may stay
+
+ // update the selections array: the indices of all seletected items after
+ // the one being deleted must change and the item itselfm ust be removed
+ int index = wxNOT_FOUND;
+ size_t count = m_selections.GetCount();
+ for ( size_t item = 0; item < count; item++ )
+ {
+ if ( m_selections[item] == n )
+ {
+ // remember to delete it later
+ index = item;
+ }
+ else if ( m_selections[item] > n )
+ {
+ // to account for the index shift
+ m_selections[item]--;
+ }
+ //else: nothing changed for this one
+ }
+
+ if ( index != wxNOT_FOUND )
+ {
+ m_selections.RemoveAt(index);
+ }
+
+ // the number of items has changed, hence the scrollbar may disappear
+ m_updateScrollbarY = TRUE;
+
+ // finally, if the longest item was deleted the scrollbar may disappear
+ if ( n == m_maxWidthItem )
+ {
+ RefreshHorzScrollbar();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// client data handling
+// ----------------------------------------------------------------------------
+
+void wxListBox::DoSetItemClientData(int n, void* clientData)
+{
+ m_itemsClientData[n] = clientData;
+}
+
+void *wxListBox::DoGetItemClientData(int n) const
+{
+ return m_itemsClientData[n];
+}
+
+void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
+{
+ m_itemsClientData[n] = clientData;
+}
+
+wxClientData* wxListBox::DoGetItemClientObject(int n) const
+{
+ return (wxClientData *)m_itemsClientData[n];
+}
+
+// ----------------------------------------------------------------------------
+// selection
+// ----------------------------------------------------------------------------
+
+void wxListBox::SetSelection(int n, bool select)
+{
+ if ( select )
+ {
+ if ( m_selections.Index(n) == wxNOT_FOUND )
+ {
+ if ( !HasMultipleSelection() )
+ {
+ // selecting an item in a single selection listbox deselects
+ // all the others
+ DeselectAll();
+ }
+
+ m_selections.Add(n);
+
+ RefreshItem(n);
+ }
+ //else: already selected
+ }
+ else // unselect
+ {
+ int index = m_selections.Index(n);
+ if ( index != wxNOT_FOUND )
+ {
+ m_selections.RemoveAt(index);
+
+ RefreshItem(n);
+ }
+ //else: not selected
+ }
+
+ // sanity check: a single selection listbox can't have more than one item
+ // selected
+ wxASSERT_MSG( HasMultipleSelection() || (m_selections.GetCount() < 2),
+ _T("multiple selected items in single selection lbox?") );
+
+ if ( select )
+ {
+ // the newly selected item becomes the current one
+ SetCurrentItem(n);
+ }
+}
+
+int wxListBox::GetSelection() const
+{
+ wxCHECK_MSG( !HasMultipleSelection(), -1,
+ _T("use wxListBox::GetSelections for ths listbox") );
+
+ return m_selections.IsEmpty() ? -1 : m_selections[0];
+}
+
+int wxCMPFUNC_CONV wxCompareInts(int *n, int *m)
+{
+ return *n - *m;
+}
+
+int wxListBox::GetSelections(wxArrayInt& selections) const
+{
+ // always return sorted array to the user
+ selections = m_selections;
+ size_t count = m_selections.GetCount();
+
+ // don't call sort on an empty array
+ if ( count )
+ {
+ selections.Sort(wxCompareInts);
+ }
+
+ return count;
+}
+
+// ----------------------------------------------------------------------------
+// refresh logic: we use delayed refreshing which allows to avoid multiple
+// refreshes (and hence flicker) in case when several listbox items are
+// added/deleted/changed subsequently
+// ----------------------------------------------------------------------------
+
+void wxListBox::RefreshFromItemToEnd(int from)
+{
+ RefreshItems(from, GetCount() - from);
+}
+
+void wxListBox::RefreshItems(int from, int count)
+{
+ switch ( m_updateCount )
+ {
+ case 0:
+ m_updateFrom = from;
+ m_updateCount = count;
+ break;
+
+ case -1:
+ // we refresh everything anyhow
+ break;
+
+ default:
+ // add these items to the others which we have to refresh
+ if ( m_updateFrom < from )
+ {
+ count += from - m_updateFrom;
+ if ( m_updateCount < count )
+ m_updateCount = count;
+ }
+ else // m_updateFrom >= from
+ {
+ int updateLast = wxMax(m_updateFrom + m_updateCount,
+ from + count);
+ m_updateFrom = from;
+ m_updateCount = updateLast - m_updateFrom;
+ }
+ }
+}
+
+void wxListBox::RefreshItem(int n)
+{
+ switch ( m_updateCount )
+ {
+ case 0:
+ // refresh this item only
+ m_updateFrom = n;
+ m_updateCount = 1;
+ break;
+
+ case -1:
+ // we refresh everything anyhow
+ break;
+
+ default:
+ // add this item to the others which we have to refresh
+ if ( m_updateFrom < n )
+ {
+ if ( m_updateCount < n - m_updateFrom + 1 )
+ m_updateCount = n - m_updateFrom + 1;
+ }
+ else // n <= m_updateFrom
+ {
+ m_updateCount += m_updateFrom - n;
+ m_updateFrom = n;
+ }
+ }
+}
+
+void wxListBox::RefreshAll()
+{
+ m_updateCount = -1;
+}
+
+void wxListBox::RefreshHorzScrollbar()
+{
+ m_maxWidth = 0; // recalculate it
+ m_updateScrollbarX = TRUE;
+}
+
+void wxListBox::UpdateScrollbars()
+{
+ wxSize size = GetClientSize();
+
+ // is our height enough to show all items?
+ int nLines = GetCount();
+ wxCoord lineHeight = GetLineHeight();
+ bool showScrollbarY = nLines*lineHeight > size.y;
+
+ // check the width too if required
+ wxCoord charWidth, maxWidth;
+ bool showScrollbarX;
+ if ( HasHorzScrollbar() )
+ {
+ charWidth = GetCharWidth();
+ maxWidth = GetMaxWidth();
+ showScrollbarX = maxWidth > size.x;
+ }
+ else // never show it
+ {
+ charWidth = maxWidth = 0;
+ showScrollbarX = FALSE;
+ }
+
+ // what should be the scrollbar range now?
+ int scrollRangeX = showScrollbarX
+ ? (maxWidth + charWidth - 1) / charWidth + 2 // FIXME
+ : 0;
+ int scrollRangeY = showScrollbarY
+ ? nLines +
+ (size.y % lineHeight + lineHeight - 1) / lineHeight
+ : 0;
+
+ // reset scrollbars if something changed: either the visibility status
+ // or the range of a scrollbar which is shown
+ if ( (showScrollbarY != m_showScrollbarY) ||
+ (showScrollbarX != m_showScrollbarX) ||
+ (showScrollbarY && (scrollRangeY != m_scrollRangeY)) ||
+ (showScrollbarX && (scrollRangeX != m_scrollRangeX)) )
+ {
+ int x, y;
+ GetViewStart(&x, &y);
+ SetScrollbars(charWidth, lineHeight,
+ scrollRangeX, scrollRangeY,
+ x, y);
+
+ m_showScrollbarX = showScrollbarX;
+ m_showScrollbarY = showScrollbarY;
+
+ m_scrollRangeX = scrollRangeX;
+ m_scrollRangeY = scrollRangeY;
+ }
+}
+
+void wxListBox::UpdateItems()
+{
+ // only refresh the items which must be refreshed
+ if ( m_updateCount == -1 )
+ {
+ // refresh all
+ wxLogTrace(_T("listbox"), _T("Refreshing all"));
+
+ Refresh();
+ }
+ else
+ {
+ wxSize size = GetClientSize();
+ wxRect rect;
+ rect.width = size.x;
+ rect.height = size.y;
+ rect.y += m_updateFrom*GetLineHeight();
+ rect.height = m_updateCount*GetLineHeight();
+
+ // we don't need to calculate x position as we always refresh the
+ // entire line(s)
+ CalcScrolledPosition(0, rect.y, NULL, &rect.y);
+
+ wxLogTrace(_T("listbox"), _T("Refreshing items %d..%d (%d-%d)"),
+ m_updateFrom, m_updateFrom + m_updateCount - 1,
+ rect.GetTop(), rect.GetBottom());
+
+ Refresh(TRUE, &rect);
+ }
+}
+
+void wxListBox::OnIdle(wxIdleEvent& event)
+{
+ if ( m_updateScrollbarY || m_updateScrollbarX )
+ {
+ UpdateScrollbars();
+
+ m_updateScrollbarX =
+ m_updateScrollbarY = FALSE;
+ }
+
+ if ( m_currentChanged )
+ {
+ DoEnsureVisible(m_current);
+
+ m_currentChanged = FALSE;
+ }
+
+ if ( m_updateCount )
+ {
+ UpdateItems();
+
+ m_updateCount = 0;
+ }
+
+ event.Skip();
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+wxBorder wxListBox::GetDefaultBorder() const
+{
+ return wxBORDER_SUNKEN;
+}
+
+void wxListBox::DoDraw(wxControlRenderer *renderer)
+{
+ // adjust the DC to account for scrolling
+ wxDC& dc = renderer->GetDC();
+ PrepareDC(dc);
+ dc.SetFont(GetFont());
+
+ // get the update rect
+ wxRect rectUpdate = GetUpdateClientRect();
+
+ int yTop, yBottom;
+ CalcUnscrolledPosition(0, rectUpdate.GetTop(), NULL, &yTop);
+ CalcUnscrolledPosition(0, rectUpdate.GetBottom(), NULL, &yBottom);
+
+ // get the items which must be redrawn
+ wxCoord lineHeight = GetLineHeight();
+ size_t itemFirst = yTop / lineHeight,
+ itemLast = (yBottom + lineHeight - 1) / lineHeight,
+ itemMax = m_strings.GetCount();
+
+ if ( itemFirst >= itemMax )
+ return;
+
+ if ( itemLast > itemMax )
+ itemLast = itemMax;
+
+ // do draw them
+ wxLogTrace(_T("listbox"), _T("Repainting items %d..%d"),
+ itemFirst, itemLast);
+
+ DoDrawRange(renderer, itemFirst, itemLast);
+}
+
+void wxListBox::DoDrawRange(wxControlRenderer *renderer,
+ int itemFirst, int itemLast)
+{
+ renderer->DrawItems(this, itemFirst, itemLast);
+}
+
+// ----------------------------------------------------------------------------
+// size calculations
+// ----------------------------------------------------------------------------
+
+bool wxListBox::SetFont(const wxFont& font)
+{
+ if ( !wxControl::SetFont(font) )
+ return FALSE;
+
+ CalcItemsPerPage();
+
+ RefreshAll();
+
+ return TRUE;
+}
+
+void wxListBox::CalcItemsPerPage()
+{
+ m_lineHeight = GetRenderer()->GetListboxItemHeight(GetCharHeight());
+ m_itemsPerPage = GetClientSize().y / m_lineHeight;
+}
+
+int wxListBox::GetItemsPerPage() const
+{
+ if ( !m_itemsPerPage )
+ {
+ wxConstCast(this, wxListBox)->CalcItemsPerPage();
+ }
+
+ return m_itemsPerPage;
+}
+
+wxCoord wxListBox::GetLineHeight() const
+{
+ if ( !m_lineHeight )
+ {
+ wxConstCast(this, wxListBox)->CalcItemsPerPage();
+ }
+
+ return m_lineHeight;
+}
+
+wxCoord wxListBox::GetMaxWidth() const
+{
+ if ( m_maxWidth == 0 )
+ {
+ wxListBox *self = wxConstCast(this, wxListBox);
+ wxCoord width;
+ size_t count = m_strings.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ GetTextExtent(m_strings[n], &width, NULL);
+ if ( width > m_maxWidth )
+ {
+ self->m_maxWidth = width;
+ self->m_maxWidthItem = n;
+ }
+ }
+ }
+
+ return m_maxWidth;
+}
+
+void wxListBox::OnSize(wxSizeEvent& event)
+{
+ // recalculate the number of items per page
+ CalcItemsPerPage();
+
+ // the scrollbars might [dis]appear
+ m_updateScrollbarX =
+ m_updateScrollbarY = TRUE;
+
+ event.Skip();
+}
+
+void wxListBox::DoSetFirstItem(int n)
+{
+ SetCurrentItem(n);
+}
+
+void wxListBox::DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags)
+{
+ if ( GetWindowStyle() & wxLB_INT_HEIGHT )
+ {
+ // we must round up the height to an entire number of rows
+
+ // the client area must contain an int number of rows, so take borders
+ // into account
+ wxRect rectBorders = GetRenderer()->GetBorderDimensions(GetBorder());
+ wxCoord hBorders = rectBorders.y + rectBorders.height;
+
+ wxCoord hLine = GetLineHeight();
+ height = ((height - hBorders + hLine - 1) / hLine)*hLine + hBorders;
+ }
+
+ wxListBoxBase::DoSetSize(x, y, width, height);
+}
+
+wxSize wxListBox::DoGetBestClientSize() const
+{
+ wxCoord width = 0,
+ height = 0;
+
+ size_t count = m_strings.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ wxCoord w,h;
+ GetTextExtent(m_strings[n], &w, &h);
+
+ if ( w > width )
+ width = w;
+ if ( h > height )
+ height = h;
+ }
+
+ // if the listbox is empty, still give it some non zero (even if
+ // arbitrary) size - otherwise, leave small margin around the strings
+ if ( !width )
+ width = 100;
+ else
+ width += 3*GetCharWidth();
+
+ if ( !height )
+ height = GetCharHeight();
+
+ // we need the height of the entire listbox, not just of one line
+ height *= wxMax(count, 7);
+
+ return wxSize(width, height);
+}
+
+// ----------------------------------------------------------------------------
+// listbox actions
+// ----------------------------------------------------------------------------
+
+bool wxListBox::SendEvent(wxEventType type, int item)
+{
+ // don't generate select events while the mouse is captured, we will only
+ // send them once it is released
+ if ( (type == wxEVT_COMMAND_LISTBOX_SELECTED) && (GetCapture() == this) )
+ return FALSE;
+
+ wxCommandEvent event(type, m_windowId);
+ event.SetEventObject(this);
+
+ // use the current item by default
+ if ( item == -1 )
+ {
+ item = m_current;
+ }
+
+ // client data and string parameters only make sense if we have an item
+ if ( item != -1 )
+ {
+ if ( HasClientObjectData() )
+ event.SetClientObject(GetClientObject(item));
+ else if ( HasClientUntypedData() )
+ event.SetClientData(GetClientData(item));
+
+ event.SetString(GetString(item));
+ }
+
+ event.m_commandInt = item;
+
+ return GetEventHandler()->ProcessEvent(event);
+}
+
+void wxListBox::SetCurrentItem(int n)
+{
+ if ( n != m_current )
+ {
+ if ( m_current != -1 )
+ RefreshItem(m_current);
+
+ m_current = n;
+
+ if ( m_current != -1 )
+ {
+ m_currentChanged = TRUE;
+
+ RefreshItem(m_current);
+ }
+ }
+ //else: nothing to do
+}
+
+bool wxListBox::FindItem(const wxString& prefix, bool strictlyAfter)
+{
+ int count = GetCount();
+ if ( !count )
+ {
+ // empty listbox, we can't find anything in it
+ return FALSE;
+ }
+
+ // start either from the current item or from the next one if strictlyAfter
+ // is true
+ int first;
+ if ( strictlyAfter )
+ {
+ // the following line will set first correctly to 0 if there is no
+ // selection (m_current == -1)
+ first = m_current == count - 1 ? 0 : m_current + 1;
+ }
+ else // start with the current
+ {
+ first = m_current == -1 ? 0 : m_current;
+ }
+
+ int last = first == 0 ? count - 1 : first - 1;
+
+ // if this is not true we'd never exit from the loop below!
+ wxASSERT_MSG( first < count && last < count, _T("logic error") );
+
+ // precompute it outside the loop
+ size_t len = prefix.length();
+
+ // loop over all items in the listbox
+ for ( int item = first; item != last; item < count - 1 ? item++ : item = 0 )
+ {
+ if ( wxStrnicmp(m_strings[item], prefix, len) == 0 )
+ {
+ SetCurrentItem(item);
+
+ if ( !(GetWindowStyle() & wxLB_MULTIPLE) )
+ {
+ DeselectAll(item);
+ SelectAndNotify(item);
+
+ if ( GetWindowStyle() & wxLB_EXTENDED )
+ AnchorSelection(item);
+ }
+
+ return TRUE;
+ }
+ }
+
+ // nothing found
+ return FALSE;
+}
+
+void wxListBox::EnsureVisible(int n)
+{
+ if ( m_updateScrollbarY )
+ {
+ UpdateScrollbars();
+
+ m_updateScrollbarX =
+ m_updateScrollbarY = FALSE;
+ }
+
+ DoEnsureVisible(n);
+}
+
+void wxListBox::DoEnsureVisible(int n)
+{
+ if ( !m_showScrollbarY )
+ {
+ // nothing to do - everything is shown anyhow
+ return;
+ }
+
+ int first;
+ GetViewStart(0, &first);
+ if ( first > n )
+ {
+ // we need to scroll upwards, so make the current item appear on top
+ // of the shown range
+ Scroll(0, n);
+ }
+ else
+ {
+ int last = first + GetClientSize().y / GetLineHeight() - 1;
+ if ( last < n )
+ {
+ // scroll down: the current item appears at the bottom of the
+ // range
+ Scroll(0, n - (last - first));
+ }
+ }
+}
+
+void wxListBox::ChangeCurrent(int diff)
+{
+ int current = m_current == -1 ? 0 : m_current;
+
+ current += diff;
+
+ int last = GetCount() - 1;
+ if ( current < 0 )
+ current = 0;
+ else if ( current > last )
+ current = last;
+
+ SetCurrentItem(current);
+}
+
+void wxListBox::ExtendSelection(int itemTo)
+{
+ // if we don't have the explicit values for selection start/end, make them
+ // up
+ if ( m_selAnchor == -1 )
+ m_selAnchor = m_current;
+
+ if ( itemTo == -1 )
+ itemTo = m_current;
+
+ // swap the start/end of selection range if necessary
+ int itemFrom = m_selAnchor;
+ if ( itemFrom > itemTo )
+ {
+ int itemTmp = itemFrom;
+ itemFrom = itemTo;
+ itemTo = itemTmp;
+ }
+
+ // the selection should now include all items in the range between the
+ // anchor and the specified item and only them
+
+ int n;
+ for ( n = 0; n < itemFrom; n++ )
+ {
+ Deselect(n);
+ }
+
+ for ( ; n <= itemTo; n++ )
+ {
+ SetSelection(n);
+ }
+
+ int count = GetCount();
+ for ( ; n < count; n++ )
+ {
+ Deselect(n);
+ }
+}
+
+void wxListBox::Select(bool sel, int item)
+{
+ if ( item != -1 )
+ {
+ // go to this item first
+ SetCurrentItem(item);
+ }
+
+ // the current item is the one we want to change: either it was just
+ // changed above to be the same as item or item == -1 in which we case we
+ // are supposed to use the current one anyhow
+ if ( m_current != -1 )
+ {
+ // [de]select it
+ SetSelection(m_current, sel);
+ }
+}
+
+void wxListBox::SelectAndNotify(int item)
+{
+ Select(TRUE, item);
+
+ SendEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+}
+
+void wxListBox::Activate(int item)
+{
+ if ( item != -1 )
+ SetCurrentItem(item);
+ else
+ item = m_current;
+
+ if ( !(GetWindowStyle() & wxLB_MULTIPLE) )
+ {
+ DeselectAll(item);
+ }
+
+ if ( item != -1 )
+ {
+ Select(TRUE, item);
+
+ SendEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// input handling
+// ----------------------------------------------------------------------------
+
+bool wxListBox::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ int item = (int)numArg;
+
+ if ( action == wxACTION_LISTBOX_SETFOCUS )
+ SetCurrentItem(item);
+ else if ( action == wxACTION_LISTBOX_ACTIVATE )
+ Activate(item);
+ else if ( action == wxACTION_LISTBOX_TOGGLE )
+ {
+ if ( item == -1 )
+ item = m_current;
+
+ if ( IsSelected(item) )
+ Unselect(item);
+ else
+ SelectAndNotify(item);
+ }
+ else if ( action == wxACTION_LISTBOX_SELECT )
+ {
+ DeselectAll(item);
+ SelectAndNotify(item);
+ }
+ else if ( action == wxACTION_LISTBOX_SELECTADD )
+ Select(TRUE, item);
+ else if ( action == wxACTION_LISTBOX_UNSELECT )
+ Select(FALSE, item);
+ else if ( action == wxACTION_LISTBOX_MOVEDOWN )
+ ChangeCurrent(1);
+ else if ( action == wxACTION_LISTBOX_MOVEUP )
+ ChangeCurrent(-1);
+ else if ( action == wxACTION_LISTBOX_PAGEDOWN )
+ ChangeCurrent(GetItemsPerPage());
+ else if ( action == wxACTION_LISTBOX_PAGEUP )
+ ChangeCurrent(-GetItemsPerPage());
+ else if ( action == wxACTION_LISTBOX_START )
+ SetCurrentItem(0);
+ else if ( action == wxACTION_LISTBOX_END )
+ SetCurrentItem(GetCount() - 1);
+ else if ( action == wxACTION_LISTBOX_UNSELECTALL )
+ DeselectAll(item);
+ else if ( action == wxACTION_LISTBOX_EXTENDSEL )
+ ExtendSelection(item);
+ else if ( action == wxACTION_LISTBOX_FIND )
+ FindNextItem(strArg);
+ else if ( action == wxACTION_LISTBOX_ANCHOR )
+ AnchorSelection(item == -1 ? m_current : item);
+ else if ( action == wxACTION_LISTBOX_SELECTALL ||
+ action == wxACTION_LISTBOX_SELTOGGLE )
+ wxFAIL_MSG(_T("unimplemented yet"));
+ else
+ return wxControl::PerformAction(action, numArg, strArg);
+
+ return TRUE;
+}
+
+// ============================================================================
+// implementation of wxStdListboxInputHandler
+// ============================================================================
+
+wxStdListboxInputHandler::wxStdListboxInputHandler(wxInputHandler *handler,
+ bool toggleOnPressAlways)
+ : wxStdInputHandler(handler)
+{
+ m_btnCapture = 0;
+ m_toggleOnPressAlways = toggleOnPressAlways;
+ m_actionMouse = wxACTION_NONE;
+ m_trackMouseOutside = TRUE;
+}
+
+int wxStdListboxInputHandler::HitTest(const wxListBox *lbox,
+ const wxMouseEvent& event)
+{
+ int item = HitTestUnsafe(lbox, event);
+
+ return FixItemIndex(lbox, item);
+}
+
+int wxStdListboxInputHandler::HitTestUnsafe(const wxListBox *lbox,
+ const wxMouseEvent& event)
+{
+ wxPoint pt = event.GetPosition();
+ pt -= lbox->GetClientAreaOrigin();
+ int y;
+ lbox->CalcUnscrolledPosition(0, pt.y, NULL, &y);
+ return y / lbox->GetLineHeight();
+}
+
+int wxStdListboxInputHandler::FixItemIndex(const wxListBox *lbox,
+ int item)
+{
+ if ( item < 0 )
+ {
+ // mouse is above the first item
+ item = 0;
+ }
+ else if ( item >= lbox->GetCount() )
+ {
+ // mouse is below the last item
+ item = lbox->GetCount() - 1;
+ }
+
+ return item;
+}
+
+bool wxStdListboxInputHandler::IsValidIndex(const wxListBox *lbox, int item)
+{
+ return item >= 0 && item < lbox->GetCount();
+}
+
+wxControlAction
+wxStdListboxInputHandler::SetupCapture(wxListBox *lbox,
+ const wxMouseEvent& event,
+ int item)
+{
+ // we currently only allow selecting with the left mouse button, if we
+ // do need to allow using other buttons too we might use the code
+ // inside #if 0
+#if 0
+ m_btnCapture = event.LeftDown()
+ ? 1
+ : event.RightDown()
+ ? 3
+ : 2;
+#else
+ m_btnCapture = 1;
+#endif // 0/1
+
+ wxControlAction action;
+ if ( lbox->HasMultipleSelection() )
+ {
+ if ( lbox->GetWindowStyle() & wxLB_MULTIPLE )
+ {
+ if ( m_toggleOnPressAlways )
+ {
+ // toggle the item right now
+ action = wxACTION_LISTBOX_TOGGLE;
+ }
+ //else: later
+
+ m_actionMouse = wxACTION_LISTBOX_SETFOCUS;
+ }
+ else // wxLB_EXTENDED listbox
+ {
+ // simple click in an extended sel listbox clears the old
+ // selection and adds the clicked item to it then, ctrl-click
+ // toggles an item to it and shift-click adds a range between
+ // the old selection anchor and the clicked item
+ if ( event.ControlDown() )
+ {
+ lbox->PerformAction(wxACTION_LISTBOX_ANCHOR, item);
+
+ action = wxACTION_LISTBOX_TOGGLE;
+ }
+ else if ( event.ShiftDown() )
+ {
+ action = wxACTION_LISTBOX_EXTENDSEL;
+ }
+ else // simple click
+ {
+ lbox->PerformAction(wxACTION_LISTBOX_ANCHOR, item);
+
+ action = wxACTION_LISTBOX_SELECT;
+ }
+
+ m_actionMouse = wxACTION_LISTBOX_EXTENDSEL;
+ }
+ }
+ else // single selection
+ {
+ m_actionMouse =
+ action = wxACTION_LISTBOX_SELECT;
+ }
+
+ // by default we always do track it
+ m_trackMouseOutside = TRUE;
+
+ return action;
+}
+
+bool wxStdListboxInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ // we're only interested in the key press events
+ if ( pressed && !event.AltDown() )
+ {
+ bool isMoveCmd = TRUE;
+ int style = control->GetWindowStyle();
+
+ wxControlAction action;
+ wxString strArg;
+
+ int keycode = event.GetKeyCode();
+ switch ( keycode )
+ {
+ // movement
+ case WXK_UP: action = wxACTION_LISTBOX_MOVEUP; break;
+ case WXK_DOWN: action = wxACTION_LISTBOX_MOVEDOWN; break;
+ case WXK_PRIOR: action = wxACTION_LISTBOX_PAGEUP; break;
+ case WXK_NEXT: action = wxACTION_LISTBOX_PAGEDOWN; break;
+ case WXK_HOME: action = wxACTION_LISTBOX_START; break;
+ case WXK_END: action = wxACTION_LISTBOX_END; break;
+
+ // selection
+ case WXK_SPACE:
+ if ( style & wxLB_MULTIPLE )
+ {
+ action = wxACTION_LISTBOX_TOGGLE;
+ isMoveCmd = FALSE;
+ }
+ break;
+
+ case WXK_RETURN:
+ action = wxACTION_LISTBOX_ACTIVATE;
+ isMoveCmd = FALSE;
+ break;
+
+ default:
+ if ( (keycode < 255) && wxIsalnum(keycode) )
+ {
+ action = wxACTION_LISTBOX_FIND;
+ strArg = (wxChar)keycode;
+ }
+ }
+
+ if ( !!action )
+ {
+ control->PerformAction(action, -1, strArg);
+
+ if ( isMoveCmd )
+ {
+ if ( style & wxLB_SINGLE )
+ {
+ // the current item is always the one selected
+ control->PerformAction(wxACTION_LISTBOX_SELECT);
+ }
+ else if ( style & wxLB_EXTENDED )
+ {
+ if ( event.ShiftDown() )
+ control->PerformAction(wxACTION_LISTBOX_EXTENDSEL);
+ else
+ {
+ // select the item and make it the new selection anchor
+ control->PerformAction(wxACTION_LISTBOX_SELECT);
+ control->PerformAction(wxACTION_LISTBOX_ANCHOR);
+ }
+ }
+ //else: nothing to do for multiple selection listboxes
+ }
+
+ return TRUE;
+ }
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdListboxInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ wxListBox *lbox = wxStaticCast(control, wxListBox);
+ int item = HitTest(lbox, event);
+ wxControlAction action;
+
+ // when the left mouse button is pressed, capture the mouse and track the
+ // item under mouse (if the mouse leaves the window, we will still be
+ // getting the mouse move messages generated by wxScrollWindow)
+ if ( event.LeftDown() )
+ {
+ // capture the mouse to track the selected item
+ lbox->CaptureMouse();
+
+ action = SetupCapture(lbox, event, item);
+ }
+ else if ( m_btnCapture && event.ButtonUp(m_btnCapture) )
+ {
+ // when the left mouse button is released, release the mouse too
+ wxWindow *winCapture = wxWindow::GetCapture();
+ if ( winCapture )
+ {
+ winCapture->ReleaseMouse();
+ m_btnCapture = 0;
+
+ // generate the last event to triiger sending the selection event
+ action = m_actionMouse;
+ }
+ //else: the mouse wasn't presed over the listbox, only released here
+ }
+ else if ( event.LeftDClick() )
+ {
+ action = wxACTION_LISTBOX_ACTIVATE;
+ }
+
+ if ( !!action )
+ {
+ lbox->PerformAction(action, item);
+
+ return TRUE;
+ }
+
+ return wxStdInputHandler::HandleMouse(control, event);
+}
+
+bool wxStdListboxInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ wxWindow *winCapture = wxWindow::GetCapture();
+ if ( winCapture && (event.GetEventObject() == winCapture) )
+ {
+ wxListBox *lbox = wxStaticCast(control, wxListBox);
+
+ if ( !m_btnCapture || !m_trackMouseOutside )
+ {
+ // someone captured the mouse for us (we always set m_btnCapture
+ // when we do it ourselves): in this case we only react to
+ // the mouse messages when they happen inside the listbox
+ if ( lbox->HitTest(event.GetPosition()) != wxHT_WINDOW_INSIDE )
+ return FALSE;
+ }
+
+ int item = HitTest(lbox, event);
+ if ( !m_btnCapture )
+ {
+ // now that we have the mouse inside the listbox, do capture it
+ // normally - but ensure that we will still ignore the outside
+ // events
+ SetupCapture(lbox, event, item);
+
+ m_trackMouseOutside = FALSE;
+ }
+
+ if ( IsValidIndex(lbox, item) )
+ {
+ lbox->PerformAction(m_actionMouse, item);
+ }
+ // else: don't pass invalid index to the listbox
+ }
+ else // we don't have capture any more
+ {
+ if ( m_btnCapture )
+ {
+ // if we lost capture unexpectedly (someone else took the capture
+ // from us), return to a consistent state
+ m_btnCapture = 0;
+ }
+ }
+
+ return wxStdInputHandler::HandleMouseMove(control, event);
+}
+
+#endif // wxUSE_LISTBOX
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/menu.cpp
+// Purpose: wxMenuItem, wxMenu and wxMenuBar implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univmenuitem.h"
+ #pragma implementation "univmenu.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/dynarray.h"
+ #include "wx/control.h" // for FindAccelIndex()
+ #include "wx/menu.h"
+ #include "wx/settings.h"
+ #include "wx/accel.h"
+ #include "wx/log.h"
+#endif // WX_PRECOMP
+
+#if wxUSE_MENUS
+
+#include "wx/popupwin.h"
+#include "wx/evtloop.h"
+
+#include "wx/univ/renderer.h"
+
+#ifdef __WXMSW__
+ #include "wx/msw/private.h"
+#endif // __WXMSW__
+
+// ----------------------------------------------------------------------------
+// wxMenuInfo contains all extra information about top level menus we need
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxMenuInfo
+{
+public:
+ // ctor
+ wxMenuInfo(const wxString& text)
+ {
+ SetLabel(text);
+ SetEnabled();
+ }
+
+ // modifiers
+
+ void SetLabel(const wxString& text)
+ {
+ // remember the accel char (may be -1 if none)
+ m_indexAccel = wxControl::FindAccelIndex(text, &m_label);
+
+ // calculate the width later, after the menu bar is created
+ m_width = 0;
+ }
+
+ void SetEnabled(bool enabled = TRUE) { m_isEnabled = enabled; }
+
+ // accessors
+
+ const wxString& GetLabel() const { return m_label; }
+ bool IsEnabled() const { return m_isEnabled; }
+ wxCoord GetWidth(wxMenuBar *menubar) const
+ {
+ if ( !m_width )
+ {
+ wxConstCast(this, wxMenuInfo)->CalcWidth(menubar);
+ }
+
+ return m_width;
+ }
+
+ int GetAccelIndex() const { return m_indexAccel; }
+
+private:
+ void CalcWidth(wxMenuBar *menubar)
+ {
+ wxSize size;
+ wxClientDC dc(menubar);
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+ dc.GetTextExtent(m_label, &size.x, &size.y);
+
+ // adjust for the renderer we use and store the width
+ m_width = menubar->GetRenderer()->GetMenuBarItemSize(size).x;
+ }
+
+ wxString m_label;
+ wxCoord m_width;
+ int m_indexAccel;
+ bool m_isEnabled;
+};
+
+#include "wx/arrimpl.cpp"
+
+WX_DEFINE_OBJARRAY(wxMenuInfoArray);
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow: a popup window showing a menu
+// ----------------------------------------------------------------------------
+
+class wxPopupMenuWindow : public wxPopupTransientWindow
+{
+public:
+ wxPopupMenuWindow(wxWindow *parent, wxMenu *menu);
+
+ // override the base class version to select the first item initially
+ virtual void Popup(wxWindow *focus = NULL);
+
+ // override the base class version to dismiss any open submenus
+ virtual void Dismiss();
+
+ // notify the menu when the window disappears from screen
+ virtual void OnDismiss();
+
+ // called when a submenu is dismissed
+ void OnSubmenuDismiss() { m_hasOpenSubMenu = FALSE; }
+
+ // get the currently selected item (may be NULL)
+ wxMenuItem *GetCurrentItem() const
+ {
+ return m_nodeCurrent ? m_nodeCurrent->GetData() : NULL;
+ }
+
+ // find the menu item at given position
+ wxMenuItemList::Node *GetMenuItemFromPoint(const wxPoint& pt) const;
+
+ // refresh the given item
+ void RefreshItem(wxMenuItem *item);
+
+ // preselect the first item
+ void SelectFirst() { SetCurrent(m_menu->GetMenuItems().GetFirst()); }
+
+ // process the key event, return TRUE if done
+ bool ProcessKeyDown(int key);
+
+ // process mouse move event
+ void ProcessMouseMove(const wxPoint& pt);
+
+ // don't dismiss the popup window if the parent menu was clicked
+ virtual bool ProcessLeftDown(wxMouseEvent& event);
+
+protected:
+ // how did we perform this operation?
+ enum InputMethod
+ {
+ WithKeyboard,
+ WithMouse
+ };
+
+ // draw the menu inside this window
+ virtual void DoDraw(wxControlRenderer *renderer);
+
+ // event handlers
+ void OnLeftUp(wxMouseEvent& event);
+ void OnMouseMove(wxMouseEvent& event);
+ void OnMouseLeave(wxMouseEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+
+ // reset the current item and node
+ void ResetCurrent();
+
+ // set the current node and item withotu refreshing anything
+ void SetCurrent(wxMenuItemList::Node *node);
+
+ // change the current item refreshing the old and new items
+ void ChangeCurrent(wxMenuItemList::Node *node);
+
+ // activate item, i.e. call either ClickItem() or OpenSubmenu() depending
+ // on what it is, return TRUE if something was done (i.e. it's not a
+ // separator...)
+ bool ActivateItem(wxMenuItem *item, InputMethod how = WithKeyboard);
+
+ // send the event about the item click
+ void ClickItem(wxMenuItem *item);
+
+ // show the submenu for this item
+ void OpenSubmenu(wxMenuItem *item, InputMethod how = WithKeyboard);
+
+ // can this tiem be opened?
+ bool CanOpen(wxMenuItem *item)
+ {
+ return item && item->IsEnabled() && item->IsSubMenu();
+ }
+
+ // dismiss the menu and all parent menus too
+ void DismissAndNotify();
+
+ // react to dimissing this menu and also dismiss the parent if
+ // dismissParent
+ void HandleDismiss(bool dismissParent);
+
+ // do we have an open submenu?
+ bool HasOpenSubmenu() const { return m_hasOpenSubMenu; }
+
+ // get previous node after the current one
+ wxMenuItemList::Node *GetPrevNode() const;
+
+ // get previous node before the given one, wrapping if it's the first one
+ wxMenuItemList::Node *GetPrevNode(wxMenuItemList::Node *node) const;
+
+ // get next node after the current one
+ wxMenuItemList::Node *GetNextNode() const;
+
+ // get next node after the given one, wrapping if it's the last one
+ wxMenuItemList::Node *GetNextNode(wxMenuItemList::Node *node) const;
+
+private:
+ // the menu we show
+ wxMenu *m_menu;
+
+ // the menu node corresponding to the current item
+ wxMenuItemList::Node *m_nodeCurrent;
+
+ // do we currently have an opened submenu?
+ bool m_hasOpenSubMenu;
+
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// wxMenuKbdRedirector: an event handler which redirects kbd input to wxMenu
+// ----------------------------------------------------------------------------
+
+class wxMenuKbdRedirector : public wxEvtHandler
+{
+public:
+ wxMenuKbdRedirector(wxMenu *menu) { m_menu = menu; }
+
+ virtual bool ProcessEvent(wxEvent& event)
+ {
+ if ( event.GetEventType() == wxEVT_KEY_DOWN )
+ {
+ return m_menu->ProcessKeyDown(((wxKeyEvent &)event).GetKeyCode());
+ }
+ else
+ {
+ return wxEvtHandler::ProcessEvent(event);
+ }
+ }
+
+private:
+ wxMenu *m_menu;
+};
+
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
+IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
+IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
+
+BEGIN_EVENT_TABLE(wxPopupMenuWindow, wxPopupTransientWindow)
+ EVT_KEY_DOWN(wxPopupMenuWindow::OnKeyDown)
+
+ EVT_LEFT_UP(wxPopupMenuWindow::OnLeftUp)
+ EVT_MOTION(wxPopupMenuWindow::OnMouseMove)
+ EVT_LEAVE_WINDOW(wxPopupMenuWindow::OnMouseLeave)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(wxMenuBar, wxMenuBarBase)
+ EVT_KILL_FOCUS(wxMenuBar::OnKillFocus)
+
+ EVT_KEY_DOWN(wxMenuBar::OnKeyDown)
+
+ EVT_LEFT_DOWN(wxMenuBar::OnLeftDown)
+ EVT_MOTION(wxMenuBar::OnMouseMove)
+END_EVENT_TABLE()
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow
+// ----------------------------------------------------------------------------
+
+wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu)
+{
+ m_menu = menu;
+ m_hasOpenSubMenu = FALSE;
+
+ ResetCurrent();
+
+ (void)Create(parent, wxBORDER_RAISED);
+
+ SetCursor(wxCURSOR_ARROW);
+}
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow current item/node handling
+// ----------------------------------------------------------------------------
+
+void wxPopupMenuWindow::ResetCurrent()
+{
+ SetCurrent(NULL);
+}
+
+void wxPopupMenuWindow::SetCurrent(wxMenuItemList::Node *node)
+{
+ m_nodeCurrent = node;
+}
+
+void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::Node *node)
+{
+ if ( node != m_nodeCurrent )
+ {
+ if ( m_nodeCurrent )
+ {
+ wxMenuItem *item = m_nodeCurrent->GetData();
+ wxCHECK_RET( item, _T("no current item?") );
+
+ // if it was the currently opened menu, close it
+ if ( item->IsSubMenu() && item->GetSubMenu()->IsShown() )
+ {
+ item->GetSubMenu()->Dismiss();
+ OnSubmenuDismiss();
+ }
+
+ RefreshItem(item);
+ }
+
+ m_nodeCurrent = node;
+
+ if ( m_nodeCurrent )
+ RefreshItem(m_nodeCurrent->GetData());
+ }
+}
+
+wxMenuItemList::Node *wxPopupMenuWindow::GetPrevNode() const
+{
+ wxMenuItemList::Node *node = m_nodeCurrent;
+ if ( !node )
+ {
+ // start from the end if no current item
+ node = m_menu->GetMenuItems().GetLast();
+ }
+
+ return GetPrevNode(node);
+}
+
+wxMenuItemList::Node *
+wxPopupMenuWindow::GetPrevNode(wxMenuItemList::Node *node) const
+{
+ if ( node )
+ {
+ node = node->GetPrevious();
+ if ( !node )
+ {
+ node = m_menu->GetMenuItems().GetLast();
+ }
+ }
+ //else: the menu is empty
+
+ return node;
+}
+
+wxMenuItemList::Node *wxPopupMenuWindow::GetNextNode() const
+{
+ wxMenuItemList::Node *node = m_nodeCurrent;
+ if ( !node )
+ {
+ // start from the beginning if no current item
+ node = m_menu->GetMenuItems().GetFirst();
+ }
+
+ return GetNextNode(node);
+}
+
+wxMenuItemList::Node *
+wxPopupMenuWindow::GetNextNode(wxMenuItemList::Node *node) const
+{
+ if ( node )
+ {
+ node = node->GetNext();
+ if ( !node )
+ {
+ node = m_menu->GetMenuItems().GetFirst();
+ }
+ }
+ //else: the menu is empty
+
+ return node;
+}
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow popup/dismiss
+// ----------------------------------------------------------------------------
+
+void wxPopupMenuWindow::Popup(wxWindow *focus)
+{
+ // check that the current item had been properly reset before
+ wxASSERT_MSG( !m_nodeCurrent ||
+ m_nodeCurrent == m_menu->GetMenuItems().GetFirst(),
+ _T("menu current item preselected incorrectly") );
+
+ wxPopupTransientWindow::Popup(focus);
+
+#ifdef __WXMSW__
+ // ensure that this window is really on top of everything: without using
+ // SetWindowPos() it can be covered by its parent menu which is not
+ // really what we want
+ wxMenu *menuParent = m_menu->GetParent();
+ if ( menuParent )
+ {
+ wxPopupMenuWindow *win = menuParent->m_popupMenu;
+
+ // if we're shown, the parent menu must be also shown
+ wxCHECK_RET( win, _T("parent menu is not shown?") );
+
+ if ( !::SetWindowPos(GetHwndOf(win), GetHwnd(),
+ 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW) )
+ {
+ wxLogLastError(_T("SetWindowPos(HWND_TOP)"));
+ }
+
+ Refresh();
+ }
+#endif // __WXMSW__
+}
+
+void wxPopupMenuWindow::Dismiss()
+{
+ if ( HasOpenSubmenu() )
+ {
+ wxMenuItem *item = GetCurrentItem();
+ wxCHECK_RET( item && item->IsSubMenu(), _T("where is our open submenu?") );
+
+ wxPopupMenuWindow *win = item->GetSubMenu()->m_popupMenu;
+ wxCHECK_RET( win, _T("opened submenu is not opened?") );
+
+ win->Dismiss();
+ OnSubmenuDismiss();
+ }
+
+ wxPopupTransientWindow::Dismiss();
+}
+
+void wxPopupMenuWindow::OnDismiss()
+{
+ // when we are dismissed because the user clicked elsewhere or we lost
+ // focus in any other way, hide the parent menu as well
+ HandleDismiss(TRUE);
+}
+
+void wxPopupMenuWindow::HandleDismiss(bool dismissParent)
+{
+ ResetCurrent();
+
+ m_menu->OnDismiss(dismissParent);
+}
+
+void wxPopupMenuWindow::DismissAndNotify()
+{
+ Dismiss();
+ HandleDismiss(TRUE);
+}
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow geometry
+// ----------------------------------------------------------------------------
+
+wxMenuItemList::Node *
+wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const
+{
+ // we only use the y coord normally, but still check x in case the point is
+ // outside the window completely
+ if ( wxWindow::HitTest(pt) == wxHT_WINDOW_INSIDE )
+ {
+ wxCoord y = 0;
+ for ( wxMenuItemList::Node *node = m_menu->GetMenuItems().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxMenuItem *item = node->GetData();
+ y += item->GetHeight();
+ if ( y > pt.y )
+ {
+ // found
+ return node;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow drawing
+// ----------------------------------------------------------------------------
+
+void wxPopupMenuWindow::RefreshItem(wxMenuItem *item)
+{
+ wxCHECK_RET( item, _T("can't refresh NULL item") );
+
+ wxASSERT_MSG( IsShown(), _T("can't refresh menu which is not shown") );
+
+ // FIXME: -1 here because of SetLogicalOrigin(1, 1) in DoDraw()
+ RefreshRect(wxRect(0, item->GetPosition() - 1,
+ m_menu->GetGeometryInfo().GetSize().x, item->GetHeight()));
+}
+
+void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer)
+{
+ // no clipping so far - do we need it? I don't think so as the menu is
+ // never partially covered as it is always on top of everything
+
+ wxDC& dc = renderer->GetDC();
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+
+ // FIXME: this should be done in the renderer, however when it is fixed
+ // wxPopupMenuWindow::RefreshItem() should be changed too!
+ dc.SetLogicalOrigin(1, 1);
+
+ wxRenderer *rend = renderer->GetRenderer();
+
+ wxCoord y = 0;
+ const wxMenuGeometryInfo& gi = m_menu->GetGeometryInfo();
+ for ( wxMenuItemList::Node *node = m_menu->GetMenuItems().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxMenuItem *item = node->GetData();
+
+ if ( item->IsSeparator() )
+ {
+ rend->DrawMenuSeparator(dc, y, gi);
+ }
+ else // not a separator
+ {
+ int flags = 0;
+ if ( item->IsCheckable() )
+ {
+ flags |= wxCONTROL_CHECKABLE;
+
+ if ( item->IsChecked() )
+ {
+ flags |= wxCONTROL_CHECKED;
+ }
+ }
+
+ if ( !item->IsEnabled() )
+ flags |= wxCONTROL_DISABLED;
+
+ if ( item->IsSubMenu() )
+ flags |= wxCONTROL_ISSUBMENU;
+
+ if ( item == GetCurrentItem() )
+ flags |= wxCONTROL_SELECTED;
+
+ rend->DrawMenuItem
+ (
+ dc,
+ y,
+ gi,
+ item->GetLabel(),
+ item->GetAccelString(),
+ // strangely enough, for unchecked item we use the
+ // "checked" bitmap because this is the default one - this
+ // explains this strange boolean expression
+ item->GetBitmap(!item->IsCheckable() || item->IsChecked()),
+ flags,
+ item->GetAccelIndex()
+ );
+ }
+
+ y += item->GetHeight();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow actions
+// ----------------------------------------------------------------------------
+
+void wxPopupMenuWindow::ClickItem(wxMenuItem *item)
+{
+ wxCHECK_RET( item, _T("can't click NULL item") );
+
+ wxASSERT_MSG( !item->IsSeparator() && !item->IsSubMenu(),
+ _T("can't click this item") );
+
+ m_menu->ClickItem(item);
+
+ // close all menus
+ DismissAndNotify();
+}
+
+void wxPopupMenuWindow::OpenSubmenu(wxMenuItem *item, InputMethod how)
+{
+ wxCHECK_RET( item, _T("can't open NULL submenu") );
+
+ wxMenu *submenu = item->GetSubMenu();
+ wxCHECK_RET( submenu, _T("can only open submenus!") );
+
+ // FIXME: should take into account the border width
+ submenu->Popup(ClientToScreen(wxPoint(0, item->GetPosition())),
+ wxSize(m_menu->GetGeometryInfo().GetSize().x, 0),
+ how == WithKeyboard /* preselect first item then */);
+
+ m_hasOpenSubMenu = TRUE;
+}
+
+bool wxPopupMenuWindow::ActivateItem(wxMenuItem *item, InputMethod how)
+{
+ // don't activate disabled items
+ if ( !item || !item->IsEnabled() )
+ {
+ return FALSE;
+ }
+
+ // normal menu items generate commands, submenus can be opened and
+ // the separators don't do anything
+ if ( item->IsSubMenu() )
+ {
+ OpenSubmenu(item, how);
+ }
+ else if ( !item->IsSeparator() )
+ {
+ ClickItem(item);
+ }
+ else // separator, can't activate
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxPopupMenuWindow input handling
+// ----------------------------------------------------------------------------
+
+bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event)
+{
+ // wxPopupWindowHandler dismisses the window when the mouse is clicked
+ // outside it which is usually just fine, but there is one case when we
+ // don't want to do it: if the mouse was clicked on the parent submenu item
+ // which opens this menu, so check for it
+
+ wxPoint pos = event.GetPosition();
+ if ( HitTest(pos.x, pos.y) == wxHT_WINDOW_OUTSIDE )
+ {
+ wxMenu *menu = m_menu->GetParent();
+ if ( menu )
+ {
+ wxPopupMenuWindow *win = menu->m_popupMenu;
+
+ wxCHECK_MSG( win, FALSE, _T("parent menu not shown?") );
+
+ pos = ClientToScreen(pos);
+ if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
+ {
+ // eat the event
+ return TRUE;
+ }
+ //else: it is outside the parent menu as well, do dismiss this one
+ }
+ }
+
+ return FALSE;
+}
+
+void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event)
+{
+ wxMenuItemList::Node *node = GetMenuItemFromPoint(event.GetPosition());
+ if ( node )
+ {
+ ActivateItem(node->GetData(), WithMouse);
+ }
+}
+
+void wxPopupMenuWindow::OnMouseMove(wxMouseEvent& event)
+{
+ const wxPoint pt = event.GetPosition();
+
+ // we need to ignore extra mouse events: example when this happens is when
+ // the mouse is on the menu and we open a submenu from keyboard - Windows
+ // then sends us a dummy mouse move event, we (correctly) determine that it
+ // happens in the parent menu and so immediately close the just opened
+ // submenu!
+#ifdef __WXMSW__
+ static wxPoint s_ptLast;
+ wxPoint ptCur = ClientToScreen(pt);
+ if ( ptCur == s_ptLast )
+ {
+ return;
+ }
+
+ s_ptLast = ptCur;
+#endif // __WXMSW__
+
+ ProcessMouseMove(pt);
+
+ event.Skip();
+}
+
+void wxPopupMenuWindow::ProcessMouseMove(const wxPoint& pt)
+{
+ wxMenuItemList::Node *node = GetMenuItemFromPoint(pt);
+
+ // don't reset current to NULL here, we only do it when the mouse leaves
+ // the window (see below)
+ if ( node )
+ {
+ if ( node != m_nodeCurrent )
+ {
+ ChangeCurrent(node);
+
+ wxMenuItem *item = GetCurrentItem();
+ if ( CanOpen(item) )
+ {
+ OpenSubmenu(item, WithMouse);
+ }
+ }
+ //else: same item, nothing to do
+ }
+ else // not on an item
+ {
+ // the last open submenu forwards the mouse move messages to its
+ // parent, so if the mouse moves to another item of the parent menu,
+ // this menu is closed and this other item is selected - in the similar
+ // manner, the top menu forwards the mouse moves to the menubar which
+ // allows to select another top level menu by just moving the mouse
+
+ // we need to translate our client coords to the client coords of the
+ // window we forward this event to
+ wxPoint ptScreen = ClientToScreen(pt);
+
+ // if the mouse is outside this menu, let the parent one to
+ // process it
+ wxMenu *menuParent = m_menu->GetParent();
+ if ( menuParent )
+ {
+ wxPopupMenuWindow *win = menuParent->m_popupMenu;
+
+ // if we're shown, the parent menu must be also shown
+ wxCHECK_RET( win, _T("parent menu is not shown?") );
+
+ win->ProcessMouseMove(win->ScreenToClient(ptScreen));
+ }
+ else // no parent menu
+ {
+ wxMenuBar *menubar = m_menu->GetMenuBar();
+ if ( menubar )
+ {
+ if ( menubar->ProcessMouseEvent(
+ menubar->ScreenToClient(ptScreen)) )
+ {
+ // menubar has closed this menu and opened another one, probably
+ return;
+ }
+ }
+ }
+ //else: top level popup menu, no other processing to do
+ }
+}
+
+void wxPopupMenuWindow::OnMouseLeave(wxMouseEvent& event)
+{
+ // due to the artefact of mouse events generation under MSW, we actually
+ // may get the mouse leave event after the menu had been already dismissed
+ // and calling ChangeCurrent() would then assert, so don't do it
+ if ( IsShown() )
+ {
+ // we shouldn't change the current them if our submenu is opened and
+ // mouse moved there, in this case the submenu is responsable for
+ // handling it
+ bool resetCurrent;
+ if ( HasOpenSubmenu() )
+ {
+ wxMenuItem *item = GetCurrentItem();
+ wxCHECK_RET( CanOpen(item), _T("where is our open submenu?") );
+
+ wxPopupMenuWindow *win = item->GetSubMenu()->m_popupMenu;
+ wxCHECK_RET( win, _T("submenu is opened but not shown?") );
+
+ // only handle this event if the mouse is not inside the submenu
+ wxPoint pt = ClientToScreen(event.GetPosition());
+ resetCurrent =
+ win->HitTest(win->ScreenToClient(pt)) == wxHT_WINDOW_OUTSIDE;
+ }
+ else
+ {
+ // this menu is the last opened
+ resetCurrent = TRUE;
+ }
+
+ if ( resetCurrent )
+ {
+ ChangeCurrent(NULL);
+ }
+ }
+
+ event.Skip();
+}
+
+void wxPopupMenuWindow::OnKeyDown(wxKeyEvent& event)
+{
+ if ( !ProcessKeyDown(event.GetKeyCode()) )
+ {
+ event.Skip();
+ }
+}
+
+bool wxPopupMenuWindow::ProcessKeyDown(int key)
+{
+ wxMenuItem *item = GetCurrentItem();
+
+ // first let the opened submenu to have it (no test for IsEnabled() here,
+ // the keys navigate even in a disabled submenu if we had somehow managed
+ // to open it inspit of this)
+ if ( HasOpenSubmenu() )
+ {
+ wxCHECK_MSG( CanOpen(item), FALSE,
+ _T("has open submenu but another item selected?") );
+
+ if ( item->GetSubMenu()->ProcessKeyDown(key) )
+ return TRUE;
+ }
+
+ bool processed = TRUE;
+
+ // handle the up/down arrows, home, end, esc and return here, pass the
+ // left/right arrows to the menu bar except when the right arrow can be
+ // used to open a submenu
+ switch ( key )
+ {
+ case WXK_LEFT:
+ // if we're not a top level menu, close us, else leave this to the
+ // menubar
+ if ( !m_menu->GetParent() )
+ {
+ processed = FALSE;
+ break;
+ }
+
+ // fall through
+
+ case WXK_ESCAPE:
+ // close just this menu
+ Dismiss();
+ HandleDismiss(FALSE);
+ break;
+
+ case WXK_RETURN:
+ processed = ActivateItem(item);
+ break;
+
+ case WXK_HOME:
+ ChangeCurrent(m_menu->GetMenuItems().GetFirst());
+ break;
+
+ case WXK_END:
+ ChangeCurrent(m_menu->GetMenuItems().GetLast());
+ break;
+
+ case WXK_UP:
+ case WXK_DOWN:
+ {
+ bool up = key == WXK_UP;
+
+ wxMenuItemList::Node *nodeStart = up ? GetPrevNode()
+ : GetNextNode(),
+ *node = nodeStart;
+ while ( node && node->GetData()->IsSeparator() )
+ {
+ node = up ? GetPrevNode(node) : GetNextNode(node);
+
+ if ( node == nodeStart )
+ {
+ // nothing but separators and disabled items in this
+ // menu, break out
+ node = NULL;
+ }
+ }
+
+ if ( node )
+ {
+ ChangeCurrent(node);
+ }
+ else
+ {
+ processed = FALSE;
+ }
+ }
+ break;
+
+ case WXK_RIGHT:
+ // don't try to reopen an already opened menu
+ if ( !HasOpenSubmenu() && CanOpen(item) )
+ {
+ OpenSubmenu(item);
+ }
+ else
+ {
+ processed = FALSE;
+ }
+ break;
+
+ default:
+ // look for the menu item starting with this letter
+ if ( wxIsalnum(key) )
+ {
+ // we want to start from the item after this one because
+ // if we're already on the item with the given accel we want to
+ // go to the next one, not to stay in place
+ wxMenuItemList::Node *nodeStart = GetNextNode();
+
+ // do we have more than one item with this accel?
+ bool notUnique = FALSE;
+
+ // translate everything to lower case before comparing
+ wxChar chAccel = wxTolower(key);
+
+ // loop through all items searching for the item with this
+ // accel
+ wxMenuItemList::Node *node = nodeStart,
+ *nodeFound = NULL;
+ for ( ;; )
+ {
+ item = node->GetData();
+
+ int idxAccel = item->GetAccelIndex();
+ if ( idxAccel != -1 &&
+ wxTolower(item->GetLabel()[(size_t)idxAccel])
+ == chAccel )
+ {
+ // ok, found an item with this accel
+ if ( !nodeFound )
+ {
+ // store it but continue searching as we need to
+ // know if it's the only item with this accel or if
+ // there are more
+ nodeFound = node;
+ }
+ else // we already had found such item
+ {
+ notUnique = TRUE;
+
+ // no need to continue further, we won't find
+ // anything we don't already know
+ break;
+ }
+ }
+
+ // we want to iterate over all items wrapping around if
+ // necessary
+ node = GetNextNode(node);
+ if ( node == nodeStart )
+ {
+ // we've seen all nodes
+ break;
+ }
+ }
+
+ if ( nodeFound )
+ {
+ item = nodeFound->GetData();
+
+ // go to this item anyhow
+ ChangeCurrent(nodeFound);
+
+ if ( !notUnique && item->IsEnabled() )
+ {
+ // unique item with this accel - activate it
+ processed = ActivateItem(item);
+ }
+ //else: just select it but don't activate as the user might
+ // have wanted to activate another item
+
+ // skip "processed = FALSE" below
+ break;
+ }
+ }
+
+ processed = FALSE;
+ }
+
+ return processed;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu
+// ----------------------------------------------------------------------------
+
+void wxMenu::Init()
+{
+ m_geometry = NULL;
+
+ m_popupMenu = NULL;
+}
+
+wxMenu::~wxMenu()
+{
+ delete m_geometry;
+ delete m_popupMenu;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu and wxMenuGeometryInfo
+// ----------------------------------------------------------------------------
+
+wxMenuGeometryInfo::~wxMenuGeometryInfo()
+{
+}
+
+const wxMenuGeometryInfo& wxMenu::GetGeometryInfo() const
+{
+ if ( !m_geometry )
+ {
+ if ( m_popupMenu )
+ {
+ wxConstCast(this, wxMenu)->m_geometry =
+ m_popupMenu->GetRenderer()->GetMenuGeometry(m_popupMenu, *this);
+ }
+ else
+ {
+ wxFAIL_MSG( _T("can't get geometry without window") );
+ }
+ }
+
+ return *m_geometry;
+}
+
+void wxMenu::InvalidateGeometryInfo()
+{
+ if ( m_geometry )
+ {
+ delete m_geometry;
+ m_geometry = NULL;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu adding/removing items
+// ----------------------------------------------------------------------------
+
+void wxMenu::OnItemAdded(wxMenuItem *item)
+{
+ InvalidateGeometryInfo();
+
+#if wxUSE_ACCEL
+ AddAccelFor(item);
+#endif // wxUSE_ACCEL
+
+ // the submenus of a popup menu should have the same invoking window as it
+ // has
+ if ( m_invokingWindow && item->IsSubMenu() )
+ {
+ item->GetSubMenu()->SetInvokingWindow(m_invokingWindow);
+ }
+}
+
+bool wxMenu::DoAppend(wxMenuItem *item)
+{
+ if ( !wxMenuBase::DoAppend(item) )
+ return FALSE;
+
+ OnItemAdded(item);
+
+ return TRUE;
+}
+
+bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
+{
+ if ( !wxMenuBase::DoInsert(pos, item) )
+ return FALSE;
+
+ OnItemAdded(item);
+
+ return TRUE;
+}
+
+wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
+{
+ wxMenuItem *itemOld = wxMenuBase::DoRemove(item);
+
+ if ( itemOld )
+ {
+ InvalidateGeometryInfo();
+
+#if wxUSE_ACCEL
+ RemoveAccelFor(item);
+#endif // wxUSE_ACCEL
+ }
+
+ return itemOld;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu attaching/detaching
+// ----------------------------------------------------------------------------
+
+void wxMenu::Attach(wxMenuBarBase *menubar)
+{
+ wxMenuBase::Attach(menubar);
+
+ wxCHECK_RET( m_menuBar, _T("menubar can't be NULL after attaching") );
+
+ // unfortunately, we can't use m_menuBar->GetEventHandler() here because,
+ // if the menubar is currently showing a menu, its event handler is a
+ // temporary one installed by wxPopupWindow and so will disappear soon any
+ // any attempts to use it from the newly attached menu would result in a
+ // crash
+ //
+ // so we use the menubar itself, even if it's a pity as it means we can't
+ // redirect all menu events by changing the menubar handler (FIXME)
+ SetNextHandler(m_menuBar);
+}
+
+void wxMenu::Detach()
+{
+ wxMenuBase::Detach();
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu misc functions
+// ----------------------------------------------------------------------------
+
+wxWindow *wxMenu::GetRootWindow() const
+{
+ if ( m_menuBar )
+ {
+ // simple case - a normal menu attached to the menubar
+ return m_menuBar;
+ }
+
+ // we're a popup menu but the trouble is that only the top level popup menu
+ // has a pointer to the invoking window, so we must walk up the menu chain
+ // if needed
+ wxWindow *win = GetInvokingWindow();
+ if ( win )
+ {
+ // we already have it
+ return win;
+ }
+
+ wxMenu *menu = GetParent();
+ while ( menu )
+ {
+ win = menu->GetInvokingWindow();
+ if ( win )
+ break;
+
+ menu = menu->GetParent();
+ }
+
+ // we're probably going to crash in the caller anyhow, but try to detect
+ // this error as soon as possible
+ wxASSERT_MSG( win, _T("menu without any associated window?") );
+
+ // also remember it in this menu so that we don't have to search for it the
+ // next time
+ wxConstCast(this, wxMenu)->m_invokingWindow = win;
+
+ return win;
+}
+
+wxRenderer *wxMenu::GetRenderer() const
+{
+ // we're going to crash without renderer!
+ wxCHECK_MSG( m_popupMenu, NULL, _T("neither popup nor menubar menu?") );
+
+ return m_popupMenu->GetRenderer();
+}
+
+void wxMenu::RefreshItem(wxMenuItem *item)
+{
+ // the item geometry changed, so our might have changed as well
+ InvalidateGeometryInfo();
+
+ if ( IsShown() )
+ {
+ // this would be a bug in IsShown()
+ wxCHECK_RET( m_popupMenu, _T("must have popup window if shown!") );
+
+ // recalc geometry to update the item height and such
+ (void)GetGeometryInfo();
+
+ m_popupMenu->RefreshItem(item);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu showing and hiding
+// ----------------------------------------------------------------------------
+
+bool wxMenu::IsShown() const
+{
+ return m_popupMenu && m_popupMenu->IsShown();
+}
+
+void wxMenu::OnDismiss(bool dismissParent)
+{
+ if ( m_menuParent )
+ {
+ // always notify the parent about submenu disappearance
+ wxPopupMenuWindow *win = m_menuParent->m_popupMenu;
+ if ( win )
+ {
+ win->OnSubmenuDismiss();
+ }
+ else
+ {
+ wxFAIL_MSG( _T("parent menu not shown?") );
+ }
+
+ // and if we dismiss everything, propagate to parent
+ if ( dismissParent )
+ {
+ // dismissParent is recursive
+ m_menuParent->Dismiss();
+ m_menuParent->OnDismiss(TRUE);
+ }
+ }
+ else // no parent menu
+ {
+ // notify the menu bar if we're a top level menu
+ if ( m_menuBar )
+ {
+ m_menuBar->OnDismissMenu(dismissParent);
+ }
+ else // popup menu
+ {
+ wxCHECK_RET( m_invokingWindow, _T("what kind of menu is this?") );
+
+ m_invokingWindow->DismissPopupMenu();
+ SetInvokingWindow(NULL);
+ }
+ }
+}
+
+void wxMenu::Popup(const wxPoint& pos, const wxSize& size, bool selectFirst)
+{
+ // create the popup window if not done yet
+ if ( !m_popupMenu )
+ {
+ m_popupMenu = new wxPopupMenuWindow(GetRootWindow(), this);
+ }
+
+ // select the first item unless disabled
+ if ( selectFirst )
+ {
+ m_popupMenu->SelectFirst();
+ }
+
+ // the geometry might have changed since the last time we were shown, so
+ // always resize
+ m_popupMenu->SetClientSize(GetGeometryInfo().GetSize());
+
+ // position it as specified
+ m_popupMenu->Position(pos, size);
+
+ // the menu can't have the focus itself (it is a Windows limitation), so
+ // always keep the focus at the originating window
+ wxWindow *focus = GetRootWindow();
+
+ wxASSERT_MSG( focus, _T("no window to keep focus on?") );
+
+ // and show it
+ m_popupMenu->Popup(focus);
+}
+
+void wxMenu::Dismiss()
+{
+ wxCHECK_RET( IsShown(), _T("can't dismiss hidden menu") );
+
+ m_popupMenu->Dismiss();
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu event processing
+// ----------------------------------------------------------------------------
+
+bool wxMenu::ProcessKeyDown(int key)
+{
+ wxCHECK_MSG( m_popupMenu, FALSE,
+ _T("can't process key events if not shown") );
+
+ return m_popupMenu->ProcessKeyDown(key);
+}
+
+bool wxMenu::ClickItem(wxMenuItem *item)
+{
+ int isChecked;
+ if ( item->IsCheckable() )
+ {
+ // update the item state
+ isChecked = !item->IsChecked();
+
+ item->Check(isChecked != 0);
+ }
+ else
+ {
+ // not applicabled
+ isChecked = -1;
+ }
+
+ return SendEvent(item->GetId(), isChecked);
+}
+
+// ----------------------------------------------------------------------------
+// wxMenu accel support
+// ----------------------------------------------------------------------------
+
+#if wxUSE_ACCEL
+
+bool wxMenu::ProcessAccelEvent(const wxKeyEvent& event)
+{
+ // do we have an item for this accel?
+ wxMenuItem *item = m_accelTable.GetMenuItem(event);
+ if ( item && item->IsEnabled() )
+ {
+ return ClickItem(item);
+ }
+
+ // try our submenus
+ for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ const wxMenuItem *item = node->GetData();
+ if ( item->IsSubMenu() && item->IsEnabled() )
+ {
+ // try its elements
+ if ( item->GetSubMenu()->ProcessAccelEvent(event) )
+ {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+void wxMenu::AddAccelFor(wxMenuItem *item)
+{
+ wxAcceleratorEntry *accel = item->GetAccel();
+ if ( accel )
+ {
+ accel->SetMenuItem(item);
+
+ m_accelTable.Add(*accel);
+
+ delete accel;
+ }
+}
+
+void wxMenu::RemoveAccelFor(wxMenuItem *item)
+{
+ wxAcceleratorEntry *accel = item->GetAccel();
+ if ( accel )
+ {
+ m_accelTable.Remove(*accel);
+
+ delete accel;
+ }
+}
+
+#endif // wxUSE_ACCEL
+
+// ----------------------------------------------------------------------------
+// wxMenuItem construction
+// ----------------------------------------------------------------------------
+
+wxMenuItem::wxMenuItem(wxMenu *parentMenu,
+ int id,
+ const wxString& text,
+ const wxString& help,
+ bool isCheckable,
+ wxMenu *subMenu)
+{
+ m_id = id;
+ m_parentMenu = parentMenu;
+ m_subMenu = subMenu;
+
+ m_text = text;
+ m_help = help;
+
+ m_isCheckable = isCheckable;
+ m_isEnabled = TRUE;
+ m_isChecked = FALSE;
+
+ m_posY =
+ m_height = -1;
+
+ UpdateAccelInfo();
+}
+
+wxMenuItem::~wxMenuItem()
+{
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuItemBase methods implemented here
+// ----------------------------------------------------------------------------
+
+/* static */
+wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
+ int id,
+ const wxString& name,
+ const wxString& help,
+ bool isCheckable,
+ wxMenu *subMenu)
+{
+ return new wxMenuItem(parentMenu, id, name, help, isCheckable, subMenu);
+}
+
+/* static */
+wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
+{
+ return wxStripMenuCodes(text);
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuItem operations
+// ----------------------------------------------------------------------------
+
+void wxMenuItem::NotifyMenu()
+{
+ m_parentMenu->RefreshItem(this);
+}
+
+void wxMenuItem::UpdateAccelInfo()
+{
+ m_indexAccel = wxControl::FindAccelIndex(m_text);
+
+ // will be empty if the text contains no TABs - ok
+ m_strAccel = m_text.AfterFirst(_T('\t'));
+}
+
+void wxMenuItem::SetText(const wxString& text)
+{
+ if ( text != m_text )
+ {
+ // first call the base class version to change m_text
+ wxMenuItemBase::SetText(text);
+
+ UpdateAccelInfo();
+
+ NotifyMenu();
+ }
+}
+
+void wxMenuItem::SetCheckable(bool checkable)
+{
+ if ( checkable != m_isCheckable )
+ {
+ wxMenuItemBase::SetCheckable(checkable);
+
+ NotifyMenu();
+ }
+}
+
+void wxMenuItem::SetBitmaps(const wxBitmap& bmpChecked,
+ const wxBitmap& bmpUnchecked)
+{
+ m_bmpChecked = bmpChecked;
+ m_bmpUnchecked = bmpUnchecked;
+
+ NotifyMenu();
+}
+
+void wxMenuItem::Enable(bool enable)
+{
+ if ( enable != m_isEnabled )
+ {
+ wxMenuItemBase::Enable(enable);
+
+ NotifyMenu();
+ }
+}
+
+void wxMenuItem::Check(bool check)
+{
+ if ( check != m_isChecked )
+ {
+ wxMenuItemBase::Check(check);
+
+ NotifyMenu();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar creation
+// ----------------------------------------------------------------------------
+
+void wxMenuBar::Init()
+{
+ m_frameLast = NULL;
+
+ m_current = -1;
+
+ m_menuShown = NULL;
+
+ m_shouldShowMenu = FALSE;
+}
+
+void wxMenuBar::Attach(wxFrame *frame)
+{
+ // maybe you really wanted to call Detach()?
+ wxCHECK_RET( frame, _T("wxMenuBar::Attach(NULL) called") );
+
+ wxMenuBarBase::Attach(frame);
+
+ if ( IsCreated() )
+ {
+ // reparent if necessary
+ if ( m_frameLast != frame )
+ {
+ Reparent(frame);
+ }
+
+ // show it back - was hidden by Detach()
+ Show();
+ }
+ else // not created yet, do it now
+ {
+ // we have no way to return the error from here anyhow :-(
+ (void)Create(frame, -1);
+
+ SetCursor(wxCURSOR_ARROW);
+
+ SetFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
+ }
+
+ // remember the last frame which had us to avoid unnecessarily reparenting
+ // above
+ m_frameLast = frame;
+}
+
+void wxMenuBar::Detach()
+{
+ // don't delete the window because we may be reattached later, just hide it
+ if ( m_frameLast )
+ {
+ Hide();
+ }
+
+ wxMenuBarBase::Detach();
+}
+
+wxMenuBar::~wxMenuBar()
+{
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar adding/removing items
+// ----------------------------------------------------------------------------
+
+bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
+{
+ return Insert(GetCount(), menu, title);
+}
+
+bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
+{
+ if ( !wxMenuBarBase::Insert(pos, menu, title) )
+ return FALSE;
+
+ wxMenuInfo *info = new wxMenuInfo(title);
+ m_menuInfos.Insert(info, pos);
+
+ RefreshAllItemsAfter(pos);
+
+ return TRUE;
+}
+
+wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
+{
+ wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
+
+ if ( menuOld )
+ {
+ wxMenuInfo& info = m_menuInfos[pos];
+
+ info.SetLabel(title);
+
+ // even if the old menu was disabled, the new one is not any more
+ info.SetEnabled();
+
+ // even if we change only this one, the new label has different width,
+ // so we need to refresh everything beyond this item as well
+ RefreshAllItemsAfter(pos);
+ }
+
+ return menuOld;
+}
+
+wxMenu *wxMenuBar::Remove(size_t pos)
+{
+ wxMenu *menuOld = wxMenuBarBase::Remove(pos);
+
+ if ( menuOld )
+ {
+ m_menuInfos.RemoveAt(pos);
+
+ // this doesn't happen too often, so don't try to be too smart - just
+ // refresh everything
+ Refresh();
+ }
+
+ return menuOld;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar top level menus access
+// ----------------------------------------------------------------------------
+
+wxCoord wxMenuBar::GetItemWidth(size_t pos) const
+{
+ return m_menuInfos[pos].GetWidth(wxConstCast(this, wxMenuBar));
+}
+
+void wxMenuBar::EnableTop(size_t pos, bool enable)
+{
+ wxCHECK_RET( pos < GetCount(), _T("invalid index in EnableTop") );
+
+ if ( enable != m_menuInfos[pos].IsEnabled() )
+ {
+ m_menuInfos[pos].SetEnabled(enable);
+
+ RefreshItem(pos);
+ }
+ //else: nothing to do
+}
+
+bool wxMenuBar::IsEnabledTop(size_t pos) const
+{
+ wxCHECK_MSG( pos < GetCount(), FALSE, _T("invalid index in IsEnabledTop") );
+
+ return m_menuInfos[pos].IsEnabled();
+}
+
+void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
+{
+ wxCHECK_RET( pos < GetCount(), _T("invalid index in EnableTop") );
+
+ if ( label != m_menuInfos[pos].GetLabel() )
+ {
+ m_menuInfos[pos].SetLabel(label);
+
+ RefreshItem(pos);
+ }
+ //else: nothing to do
+}
+
+wxString wxMenuBar::GetLabelTop(size_t pos) const
+{
+ wxCHECK_MSG( pos < GetCount(), _T(""), _T("invalid index in GetLabelTop") );
+
+ return m_menuInfos[pos].GetLabel();
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar drawing
+// ----------------------------------------------------------------------------
+
+void wxMenuBar::RefreshAllItemsAfter(size_t pos)
+{
+ wxRect rect = GetItemRect(pos);
+ rect.width = GetClientSize().x - rect.x;
+ RefreshRect(rect);
+}
+
+void wxMenuBar::RefreshItem(size_t pos)
+{
+ wxCHECK_RET( pos != (size_t)-1,
+ _T("invalid item in wxMenuBar::RefreshItem") );
+
+ RefreshRect(GetItemRect(pos));
+}
+
+void wxMenuBar::DoDraw(wxControlRenderer *renderer)
+{
+ wxDC& dc = renderer->GetDC();
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+
+ // redraw only the items which must be redrawn
+
+ // we don't have to use GetUpdateClientRect() here because our client rect
+ // is the same as total one
+ wxRect rectUpdate = GetUpdateRegion().GetBox();
+
+ int flagsMenubar = GetStateFlags();
+
+ wxRect rect;
+ rect.y = 0;
+ rect.height = GetClientSize().y;
+
+ wxCoord x = 0;
+ size_t count = GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( x > rectUpdate.GetRight() )
+ {
+ // all remaining items are to the right of rectUpdate
+ break;
+ }
+
+ rect.x = x;
+ rect.width = GetItemWidth(n);
+ x += rect.width;
+ if ( x < rectUpdate.x )
+ {
+ // this item is still to the left of rectUpdate
+ continue;
+ }
+
+ int flags = flagsMenubar;
+ if ( m_current != -1 && n == (size_t)m_current )
+ {
+ flags |= wxCONTROL_SELECTED;
+ }
+
+ if ( !IsEnabledTop(n) )
+ {
+ flags |= wxCONTROL_DISABLED;
+ }
+
+ GetRenderer()->DrawMenuBarItem
+ (
+ dc,
+ rect,
+ m_menuInfos[n].GetLabel(),
+ flags,
+ m_menuInfos[n].GetAccelIndex()
+ );
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar geometry
+// ----------------------------------------------------------------------------
+
+wxRect wxMenuBar::GetItemRect(size_t pos) const
+{
+ wxASSERT_MSG( pos < GetCount(), _T("invalid menu bar item index") );
+
+ wxRect rect;
+ rect.x =
+ rect.y = 0;
+ rect.height = GetClientSize().y;
+
+ for ( size_t n = 0; n < pos; n++ )
+ {
+ rect.x += GetItemWidth(n);
+ }
+
+ rect.width = GetItemWidth(pos);
+
+ return rect;
+}
+
+wxSize wxMenuBar::DoGetBestClientSize() const
+{
+ wxSize size;
+ if ( GetMenuCount() > 0 )
+ {
+ wxClientDC dc(wxConstCast(this, wxMenuBar));
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+ dc.GetTextExtent(GetLabelTop(0), &size.x, &size.y);
+
+ // adjust for the renderer we use
+ size = GetRenderer()->GetMenuBarItemSize(size);
+ }
+ else // empty menubar
+ {
+ size.x =
+ size.y = 0;
+ }
+
+ // the width is arbitrary, of course, for horizontal menubar
+ size.x = 100;
+
+ return size;
+}
+
+int wxMenuBar::GetMenuFromPoint(const wxPoint& pos) const
+{
+ if ( pos.x < 0 || pos.y < 0 || pos.y > GetClientSize().y )
+ return -1;
+
+ // do find it
+ wxCoord x = 0;
+ size_t count = GetCount();
+ for ( size_t item = 0; item < count; item++ )
+ {
+ x += GetItemWidth(item);
+
+ if ( x > pos.x )
+ {
+ return item;
+ }
+ }
+
+ // to the right of the last menu item
+ return -1;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar menu operations
+// ----------------------------------------------------------------------------
+
+void wxMenuBar::SelectMenu(size_t pos)
+{
+ SetFocus();
+ CaptureMouse();
+
+ DoSelectMenu(pos);
+}
+
+void wxMenuBar::DoSelectMenu(size_t pos)
+{
+ wxCHECK_RET( pos < GetCount(), _T("invalid menu index in DoSelectMenu") );
+
+ if ( m_current != -1 )
+ {
+ // close the previous menu
+ if ( IsShowingMenu() )
+ {
+ // restore m_shouldShowMenu flag after DismissMenu() which resets
+ // it to FALSE
+ bool old = m_shouldShowMenu;
+
+ DismissMenu();
+
+ m_shouldShowMenu = old;
+ }
+
+ RefreshItem((size_t)m_current);
+ }
+
+ m_current = pos;
+
+ RefreshItem(pos);
+}
+
+void wxMenuBar::PopupMenu(size_t pos)
+{
+ wxCHECK_RET( pos < GetCount(), _T("invalid menu index in PopupCurrentMenu") );
+
+ SetFocus();
+ DoSelectMenu(pos);
+ PopupCurrentMenu();
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar input handing
+// ----------------------------------------------------------------------------
+
+/*
+ Note that wxMenuBar doesn't use wxInputHandler but handles keyboard and
+ mouse in the same way under all platforms. This is because it doesn't derive
+ from wxControl (which works with input handlers) but directly from wxWindow.
+
+ Also, menu bar input handling is rather simple, so maybe it's not really
+ worth making it themeable - at least I've decided against doing it now as it
+ would merging the changes back into trunk more difficult. But it still could
+ be done later if really needed.
+ */
+
+void wxMenuBar::OnKillFocus(wxFocusEvent& event)
+{
+ if ( m_current != -1 )
+ {
+ RefreshItem((size_t)m_current);
+
+ m_current = -1;
+ }
+
+ event.Skip();
+}
+
+void wxMenuBar::OnLeftDown(wxMouseEvent& event)
+{
+ if ( HasCapture() )
+ {
+ OnDismiss();
+
+ event.Skip();
+ }
+ else // we didn't have mouse capture, capture it now
+ {
+ m_current = GetMenuFromPoint(event.GetPosition());
+ if ( m_current == -1 )
+ {
+ // unfortunately, we can't prevent wxMSW from giving us the focus,
+ // so we can only give it back
+ GiveAwayFocus();
+ }
+ else // on item
+ {
+ CaptureMouse();
+
+ // show it as selected
+ RefreshItem((size_t)m_current);
+
+ // show the menu
+ PopupCurrentMenu(FALSE /* don't select first item - as Windows does */);
+ }
+ }
+}
+
+void wxMenuBar::OnMouseMove(wxMouseEvent& event)
+{
+ if ( HasCapture() )
+ {
+ (void)ProcessMouseEvent(event.GetPosition());
+ }
+ else
+ {
+ event.Skip();
+ }
+}
+
+bool wxMenuBar::ProcessMouseEvent(const wxPoint& pt)
+{
+ // a hack to ignore the extra mouse events MSW sends us: this is similar to
+ // wxUSE_MOUSEEVENT_HACK in wxWin itself but it isn't enough for us here as
+ // we get the messages from different windows (old and new popup menus for
+ // example)
+#ifdef __WXMSW__
+ static wxPoint s_ptLast;
+ if ( pt == s_ptLast )
+ {
+ return FALSE;
+ }
+
+ s_ptLast = pt;
+#endif // __WXMSW__
+
+ int currentNew = GetMenuFromPoint(pt);
+ if ( (currentNew == -1) || (currentNew == m_current) )
+ {
+ return FALSE;
+ }
+
+ // select the new active item
+ DoSelectMenu(currentNew);
+
+ // show the menu if we know that we should, even if we hadn't been showing
+ // it before (this may happen if the previous menu was disabled)
+ if ( m_shouldShowMenu )
+ {
+ // open the new menu if the old one we closed had been opened
+ PopupCurrentMenu(FALSE /* don't select first item - as Windows does */);
+ }
+
+ return TRUE;
+}
+
+void wxMenuBar::OnKeyDown(wxKeyEvent& event)
+{
+ // the current item must have been set before
+ wxCHECK_RET( m_current != -1, _T("where is current item?") );
+
+ int key = event.GetKeyCode();
+
+ // first let the menu have it
+ if ( IsShowingMenu() && m_menuShown->ProcessKeyDown(key) )
+ {
+ return;
+ }
+
+ // cycle through the menu items when left/right arrows are pressed and open
+ // the menu when up/down one is
+ switch ( key )
+ {
+ case WXK_MENU:
+ // Alt must be processed at wxWindow level too
+ event.Skip();
+ // fall through
+
+ case WXK_ESCAPE:
+ // remove the selection and give the focus away
+ if ( m_current != -1 )
+ {
+ if ( IsShowingMenu() )
+ {
+ DismissMenu();
+ }
+
+ OnDismiss();
+ }
+ break;
+
+ case WXK_LEFT:
+ case WXK_RIGHT:
+ {
+ size_t count = GetCount();
+ if ( count == 1 )
+ {
+ // the item won't change anyhow
+ break;
+ }
+ //else: otherwise, it will
+
+ // remember if we were showing a menu - if we did, we should
+ // show the new menu after changing the item
+ bool wasMenuOpened = IsShowingMenu();
+ if ( wasMenuOpened )
+ {
+ DismissMenu();
+ }
+
+ // cast is safe as we tested for -1 above
+ size_t currentNew = (size_t)m_current;
+
+ if ( key == WXK_LEFT )
+ {
+ if ( currentNew-- == 0 )
+ currentNew = count - 1;
+ }
+ else // right
+ {
+ if ( ++currentNew == (int)count )
+ currentNew = 0;
+ }
+
+ DoSelectMenu(currentNew);
+
+ if ( wasMenuOpened )
+ {
+ PopupCurrentMenu();
+ }
+ }
+ break;
+
+ case WXK_DOWN:
+ case WXK_UP:
+ case WXK_RETURN:
+ // open the menu
+ PopupCurrentMenu();
+ break;
+
+ default:
+ // letters open the corresponding menu
+ {
+ bool unique;
+ int idxFound = FindNextItemForAccel(m_current, key, &unique);
+
+ if ( idxFound != -1 )
+ {
+ if ( IsShowingMenu() )
+ {
+ DismissMenu();
+ }
+
+ DoSelectMenu((size_t)idxFound);
+
+ // if the item is not unique, just select it but don't
+ // activate as the user might have wanted to activate
+ // another item
+ //
+ // also, don't try to open a disabled menu
+ if ( unique && IsEnabledTop((size_t)idxFound) )
+ {
+ // open the menu
+ PopupCurrentMenu();
+ }
+
+ // skip the "event.Skip()" below
+ break;
+ }
+ }
+
+ event.Skip();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar accel handling
+// ----------------------------------------------------------------------------
+
+int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const
+{
+ if ( !wxIsalnum(key) )
+ {
+ // we only support letters/digits as accels
+ return -1;
+ }
+
+ // do we have more than one item with this accel?
+ if ( unique )
+ *unique = TRUE;
+
+ // translate everything to lower case before comparing
+ wxChar chAccel = wxTolower(key);
+
+ // the index of the item with this accel
+ int idxFound = -1;
+
+ // loop through all items searching for the item with this
+ // accel starting at the item after the current one
+ int count = GetCount();
+ int n = idxStart == -1 ? 0 : idxStart + 1;
+
+ if ( n == count )
+ {
+ // wrap
+ n = 0;
+ }
+
+ idxStart = n;
+ for ( ;; )
+ {
+ const wxMenuInfo& info = m_menuInfos[n];
+
+ int idxAccel = info.GetAccelIndex();
+ if ( idxAccel != -1 &&
+ wxTolower(info.GetLabel()[(size_t)idxAccel])
+ == chAccel )
+ {
+ // ok, found an item with this accel
+ if ( idxFound == -1 )
+ {
+ // store it but continue searching as we need to
+ // know if it's the only item with this accel or if
+ // there are more
+ idxFound = n;
+ }
+ else // we already had found such item
+ {
+ if ( unique )
+ *unique = FALSE;
+
+ // no need to continue further, we won't find
+ // anything we don't already know
+ break;
+ }
+ }
+
+ // we want to iterate over all items wrapping around if
+ // necessary
+ if ( ++n == count )
+ {
+ // wrap
+ n = 0;
+ }
+
+ if ( n == idxStart )
+ {
+ // we've seen all items
+ break;
+ }
+ }
+
+ return idxFound;
+}
+
+#if wxUSE_ACCEL
+
+bool wxMenuBar::ProcessAccelEvent(const wxKeyEvent& event)
+{
+ size_t n = 0;
+ for ( wxMenuList::Node *node = m_menus.GetFirst();
+ node;
+ node = node->GetNext(), n++ )
+ {
+ // accels of the items in the disabled menus shouldn't work
+ if ( m_menuInfos[n].IsEnabled() )
+ {
+ if ( node->GetData()->ProcessAccelEvent(event) )
+ {
+ // menu processed it
+ return TRUE;
+ }
+ }
+ }
+
+ // not found
+ return FALSE;
+}
+
+#endif // wxUSE_ACCEL
+
+// ----------------------------------------------------------------------------
+// wxMenuBar menus showing
+// ----------------------------------------------------------------------------
+
+void wxMenuBar::PopupCurrentMenu(bool selectFirst)
+{
+ wxCHECK_RET( m_current != -1, _T("no menu to popup") );
+
+ // forgot to call DismissMenu()?
+ wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menu at once!") );
+
+ // in any case, we should show it - even if we won't
+ m_shouldShowMenu = TRUE;
+
+ if ( IsEnabledTop(m_current) )
+ {
+ // remember the menu we show
+ m_menuShown = GetMenu(m_current);
+
+ // we don't show the menu at all if it has no items
+ if ( !m_menuShown->IsEmpty() )
+ {
+ // position it correctly: note that we must use screen coords and
+ // that we pass 0 as width to position the menu exactly below the
+ // item, not to the right of it
+ wxRect rectItem = GetItemRect(m_current);
+ m_menuShown->Popup(ClientToScreen(rectItem.GetPosition()),
+ wxSize(0, rectItem.GetHeight()),
+ selectFirst);
+ }
+ else
+ {
+ // reset it back as no menu is shown
+ m_menuShown = NULL;
+ }
+ }
+ //else: don't show disabled menu
+}
+
+void wxMenuBar::DismissMenu()
+{
+ wxCHECK_RET( m_menuShown, _T("can't dismiss menu if none is shown") );
+
+ m_menuShown->Dismiss();
+ OnDismissMenu();
+}
+
+void wxMenuBar::OnDismissMenu(bool dismissMenuBar)
+{
+ m_shouldShowMenu = FALSE;
+ m_menuShown = NULL;
+ if ( dismissMenuBar )
+ {
+ OnDismiss();
+ }
+}
+
+void wxMenuBar::OnDismiss()
+{
+ ReleaseCapture();
+
+ if ( m_current != -1 )
+ {
+ RefreshItem((size_t)m_current);
+
+ m_current = -1;
+ }
+
+ GiveAwayFocus();
+}
+
+void wxMenuBar::GiveAwayFocus()
+{
+ GetFrame()->SetFocus();
+}
+
+// ----------------------------------------------------------------------------
+// popup menu support
+// ----------------------------------------------------------------------------
+
+wxEventLoop *wxWindow::ms_evtLoopPopup = NULL;
+
+bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
+{
+ wxCHECK_MSG( !ms_evtLoopPopup, FALSE,
+ _T("can't show more than one popup menu at a time") );
+
+#ifdef __WXMSW__
+ // we need to change the cursor before showing the menu as, apparently, no
+ // cursor changes took place while the mouse is captured
+ wxCursor cursorOld = GetCursor();
+ SetCursor(wxCURSOR_ARROW);
+#endif // __WXMSW__
+
+#if 0
+ // flash any delayed log messages before showing the menu, otherwise it
+ // could be dismissed (because it would lose focus) immediately after being
+ // shown
+ wxLog::FlushActive();
+
+ // some controls update themselves from OnIdle() call - let them do it
+ wxIdleEvent event;
+ wxTheApp->ProcessEvent(event);
+
+ // if the window hadn't been refreshed yet, the menu can adversely affect
+ // its next OnPaint() handler execution - i.e. scrolled window refresh
+ // logic breaks then as it scrolls part of the menu which hadn't been there
+ // when the update event was generated into view
+ Update();
+#endif // 0
+
+ menu->SetInvokingWindow(this);
+ menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0));
+
+ // this is not very useful if the menu was popped up because of the mouse
+ // click but I think it is nice to do when it appears because of a key
+ // press (i.e. Windows menu key)
+ //
+ // Windows itself doesn't do it, but IMHO this is nice
+ WarpPointer(x, y);
+
+ // we have to redirect all keyboard input to the menu temporarily
+ PushEventHandler(new wxMenuKbdRedirector(menu));
+
+ // enter the local modal loop
+ ms_evtLoopPopup = new wxEventLoop;
+ ms_evtLoopPopup->Run();
+
+ delete ms_evtLoopPopup;
+ ms_evtLoopPopup = NULL;
+
+ // remove the handler
+ PopEventHandler(TRUE /* delete it */);
+
+ menu->SetInvokingWindow(NULL);
+
+#ifdef __WXMSW__
+ SetCursor(cursorOld);
+#endif // __WXMSW__
+
+ return TRUE;
+}
+
+void wxWindow::DismissPopupMenu()
+{
+ wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
+
+ ms_evtLoopPopup->Exit();
+}
+
+#endif // wxUSE_MENUS
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/notebook.cpp
+// Purpose: wxNotebook implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 01.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univnotebook.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_NOTEBOOK
+
+#include "wx/imaglist.h"
+#include "wx/notebook.h"
+
+#include "wx/spinbutt.h"
+
+#include "wx/univ/renderer.h"
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+static const size_t INVALID_PAGE = (size_t)-1;
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+class wxNotebookSpinBtn : public wxSpinButton
+{
+public:
+ wxNotebookSpinBtn(wxNotebook *nb)
+ : wxSpinButton(nb, -1,
+ wxDefaultPosition, wxDefaultSize,
+ nb->IsVertical() ? wxSP_VERTICAL : wxSP_HORIZONTAL)
+ {
+ m_nb = nb;
+ }
+
+protected:
+ void OnSpin(wxSpinEvent& event)
+ {
+ m_nb->PerformAction(wxACTION_NOTEBOOK_GOTO, event.GetPosition());
+ }
+
+private:
+ wxNotebook *m_nb;
+
+ DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(wxNotebookSpinBtn, wxSpinButton)
+ EVT_SPIN(-1, wxNotebookSpinBtn::OnSpin)
+END_EVENT_TABLE()
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
+
+// ----------------------------------------------------------------------------
+// wxNotebook creation
+// ----------------------------------------------------------------------------
+
+void wxNotebook::Init()
+{
+ m_sel = INVALID_PAGE;
+
+ m_heightTab =
+ m_widthMax = 0;
+
+ m_firstVisible =
+ m_lastVisible =
+ m_lastFullyVisible = 0;
+
+ m_offset = 0;
+
+ m_spinbtn = NULL;
+}
+
+bool wxNotebook::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+{
+ if ( !wxControl::Create(parent, id, pos, size, style,
+ wxDefaultValidator, name) )
+ return FALSE;
+
+ m_sizePad = GetRenderer()->GetTabPadding();
+
+ SetBestSize(size);
+
+ CreateInputHandler(wxINP_HANDLER_NOTEBOOK);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook page titles and images
+// ----------------------------------------------------------------------------
+
+wxString wxNotebook::GetPageText(int nPage) const
+{
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), _T(""), _T("invalid notebook page") );
+
+ return m_titles[nPage];
+}
+
+bool wxNotebook::SetPageText(int nPage, const wxString& strText)
+{
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
+
+ if ( strText != m_titles[nPage] )
+ {
+ m_accels[nPage] = FindAccelIndex(strText, &m_titles[nPage]);
+
+ if ( FixedSizeTabs() )
+ {
+ // it's enough to just reresh this one
+ RefreshTab(nPage);
+ }
+ else // var width tabs
+ {
+ // we need to resize the tab to fit the new string
+ ResizeTab(nPage);
+ }
+ }
+
+ return TRUE;
+}
+
+int wxNotebook::GetPageImage(int nPage) const
+{
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") );
+
+ return m_images[nPage];
+}
+
+bool wxNotebook::SetPageImage(int nPage, int nImage)
+{
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
+
+ wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
+ _T("invalid image index in SetPageImage()") );
+
+ if ( nImage != m_images[nPage] )
+ {
+ // if the item didn't have an icon before or, on the contrary, did have
+ // it but has lost it now, its size will change - but if the icon just
+ // changes, it won't
+ bool tabSizeChanges = nImage == -1 || m_images[nPage] == -1;
+ m_images[nPage] = nImage;
+
+ if ( tabSizeChanges )
+ RefreshAllTabs();
+ else
+ RefreshTab(nPage);
+ }
+
+ return TRUE;
+}
+
+wxNotebook::~wxNotebook()
+{
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook page switching
+// ----------------------------------------------------------------------------
+
+int wxNotebook::SetSelection(int nPage)
+{
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") );
+
+ if ( (size_t)nPage == m_sel )
+ {
+ // don't do anything if there is nothing to do
+ return m_sel;
+ }
+
+ if ( m_sel != INVALID_PAGE )
+ {
+ RefreshTab(m_sel);
+
+ m_pages[m_sel]->Hide();
+ }
+
+ m_sel = nPage;
+
+ if ( m_sel != INVALID_PAGE ) // this is impossible - but test nevertheless
+ {
+ if ( HasSpinBtn() )
+ {
+ // keep it in sync
+ m_spinbtn->SetValue(m_sel);
+ }
+
+ if ( m_sel < m_firstVisible )
+ {
+ // selection is to the left of visible part of tabs
+ ScrollTo(m_sel);
+ }
+ else if ( m_sel > m_lastFullyVisible )
+ {
+ // selection is to the right of visible part of tabs
+ ScrollLastTo(m_sel);
+ }
+ else // we already see this tab
+ {
+ // no need to scroll
+ RefreshTab(m_sel);
+ }
+
+ m_pages[m_sel]->SetSize(GetPageRect());
+ m_pages[m_sel]->Show();
+ }
+
+ return m_sel;
+}
+
+void wxNotebook::ChangePage(int nPage)
+{
+ wxCHECK_RET( IS_VALID_PAGE(nPage), _T("invalid notebook page") );
+
+ if ( (size_t)nPage == m_sel )
+ {
+ // nothing to do
+ return;
+ }
+
+ wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId);
+ event.SetSelection(nPage);
+ event.SetOldSelection(m_sel);
+ event.SetEventObject(this);
+ if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
+ {
+ // program doesn't allow the page change
+ return;
+ }
+
+ SetSelection(nPage);
+
+ event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
+ GetEventHandler()->ProcessEvent(event);
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook pages adding/deleting
+// ----------------------------------------------------------------------------
+
+bool wxNotebook::InsertPage(int nPage,
+ wxNotebookPage *pPage,
+ const wxString& strText,
+ bool bSelect,
+ int imageId)
+{
+ int nPages = GetPageCount();
+ wxCHECK_MSG( nPage == nPages || IS_VALID_PAGE(nPage), FALSE,
+ _T("invalid notebook page in InsertPage()") );
+
+ // modify the data
+ m_pages.Insert(pPage, nPage);
+
+ wxString label;
+ m_accels.Insert(FindAccelIndex(strText, &label), nPage);
+ m_titles.Insert(label, nPage);
+
+ m_images.Insert(imageId, nPage);
+
+ // cache the tab geometry here
+ wxSize sizeTab = CalcTabSize(nPage);
+
+ if ( sizeTab.y > m_heightTab )
+ m_heightTab = sizeTab.y;
+
+ if ( FixedSizeTabs() && sizeTab.x > m_widthMax )
+ m_widthMax = sizeTab.x;
+
+ m_widths.Insert(sizeTab.x, nPage);
+
+ // spin button may appear if we didn't have it before - but even if we did,
+ // its range should change, so update it unconditionally
+ UpdateSpinBtn();
+
+ // if the tab has just appeared, we have to relayout everything, otherwise
+ // it's enough to just redraw the tabs
+ if ( nPages == 0 )
+ {
+ // always select the first tab to have at least some selection
+ bSelect = TRUE;
+
+ Relayout();
+ }
+ else // not the first tab
+ {
+ RefreshAllTabs();
+ }
+
+ if ( bSelect )
+ {
+ SetSelection(nPage);
+ }
+ else // pages added to the notebook are initially hidden
+ {
+ pPage->Hide();
+ }
+
+ return TRUE;
+}
+
+bool wxNotebook::DeleteAllPages()
+{
+ if ( !wxNotebookBase::DeleteAllPages() )
+ return FALSE;
+
+ // clear the other arrays as well
+ m_titles.Clear();
+ m_images.Clear();
+ m_accels.Clear();
+ m_widths.Clear();
+
+ // it is not valid any longer
+ m_sel = INVALID_PAGE;
+
+ // spin button is not needed any more
+ UpdateSpinBtn();
+
+ Relayout();
+
+ return TRUE;
+}
+
+wxNotebookPage *wxNotebook::DoRemovePage(int nPage)
+{
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL, _T("invalid notebook page") );
+
+ wxNotebookPage *page = m_pages[nPage];
+ m_pages.RemoveAt(nPage);
+ m_titles.RemoveAt(nPage);
+ m_accels.RemoveAt(nPage);
+ m_widths.RemoveAt(nPage);
+ m_images.RemoveAt(nPage);
+
+ // the spin button might not be needed any more
+ if ( HasSpinBtn() )
+ {
+ UpdateSpinBtn();
+ }
+
+ int count = GetPageCount();
+ if ( count )
+ {
+ if ( m_sel == (size_t)nPage )
+ {
+ // avoid sending event to this page which doesn't exist in the
+ // notebook any more
+ m_sel = INVALID_PAGE;
+
+ SetSelection(nPage == count ? nPage - 1 : nPage);
+ }
+ else if ( m_sel > (size_t)nPage )
+ {
+ // no need to change selection, just adjust the index
+ m_sel--;
+ }
+ }
+ else // no more tabs left
+ {
+ m_sel = INVALID_PAGE;
+ }
+
+ // have to refresh everything
+ Relayout();
+
+ return page;
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook drawing
+// ----------------------------------------------------------------------------
+
+void wxNotebook::RefreshCurrent()
+{
+ if ( m_sel != INVALID_PAGE )
+ {
+ RefreshTab(m_sel);
+ }
+}
+
+void wxNotebook::RefreshTab(int page)
+{
+ wxCHECK_RET( IS_VALID_PAGE(page), _T("invalid notebook page") );
+
+ wxRect rect = GetTabRect(page);
+ if ( (size_t)page == m_sel )
+ {
+ const wxSize indent = GetRenderer()->GetTabIndent();
+ rect.Inflate(indent.x, indent.y);
+ }
+
+ RefreshRect(rect);
+}
+
+void wxNotebook::RefreshAllTabs()
+{
+ wxRect rect = GetAllTabsRect();
+ if ( rect.width || rect.height )
+ {
+ RefreshRect(rect);
+ }
+ //else: we don't have tabs at all
+}
+
+void wxNotebook::DoDrawTab(wxDC& dc, const wxRect& rect, size_t n)
+{
+ wxBitmap bmp;
+ if ( HasImage(n) )
+ {
+ int image = m_images[n];
+
+#ifdef __WXMSW__ // FIXME
+ int w, h;
+ m_imageList->GetSize(n, w, h);
+ bmp.Create(w, h);
+ wxMemoryDC dc;
+ dc.SelectObject(bmp);
+ dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
+ m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL, TRUE);
+#else
+ bmp = *m_imageList->GetBitmap(image);
+#endif
+ }
+
+ int flags = 0;
+ if ( n == m_sel )
+ {
+ flags |= wxCONTROL_SELECTED;
+
+ if ( IsFocused() )
+ flags |= wxCONTROL_FOCUSED;
+ }
+
+ GetRenderer()->DrawTab
+ (
+ dc,
+ rect,
+ GetTabOrientation(),
+ m_titles[n],
+ bmp,
+ flags,
+ m_accels[n]
+ );
+}
+
+void wxNotebook::DoDraw(wxControlRenderer *renderer)
+{
+ //wxRect rectUpdate = GetUpdateClientRect(); -- unused
+
+ wxDC& dc = renderer->GetDC();
+ dc.SetFont(GetFont());
+ dc.SetTextForeground(GetForegroundColour());
+
+ // redraw the border - it's simpler to always do it instead of checking
+ // whether this needs to be done
+ GetRenderer()->DrawBorder(dc, wxBORDER_RAISED, GetPagePart());
+
+ // avoid overwriting the spin button
+ if ( HasSpinBtn() )
+ {
+ wxRect rectTabs = GetAllTabsRect();
+ wxSize sizeSpinBtn = m_spinbtn->GetSize();
+
+ if ( IsVertical() )
+ rectTabs.height -= sizeSpinBtn.y;
+ else
+ rectTabs.width -= sizeSpinBtn.x;
+
+ dc.SetClippingRegion(rectTabs);
+ }
+
+ wxRect rect = GetTabsPart();
+ bool isVertical = IsVertical();
+
+ wxRect rectSel;
+ for ( size_t n = m_firstVisible; n < m_lastVisible; n++ )
+ {
+ GetTabSize(n, &rect.width, &rect.height);
+
+ if ( n == m_sel )
+ {
+ // don't redraw it now as this tab has to be drawn over the other
+ // ones as it takes more place and spills over to them
+ rectSel = rect;
+ }
+ else // not selected tab
+ {
+ // unfortunately we can't do this because the selected tab hangs
+ // over its neighbours and so we might need to refresh more tabs -
+ // of course, we could still avoid rereshing some of them with more
+ // complicated checks, but it doesn't seem too bad to refresh all
+ // of them, I still don't see flicker, so leaving as is for now
+
+ //if ( rectUpdate.Intersects(rect) )
+ {
+ DoDrawTab(dc, rect, n);
+ }
+ //else: doesn't need to be refreshed
+ }
+
+ // move the rect to the next tab
+ if ( isVertical )
+ rect.y += rect.height;
+ else
+ rect.x += rect.width;
+ }
+
+ // now redraw the selected tab
+ if ( rectSel.width )
+ {
+ DoDrawTab(dc, rectSel, m_sel);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook geometry
+// ----------------------------------------------------------------------------
+
+int wxNotebook::HitTest(const wxPoint& pt) const
+{
+ // first check that it is in this window at all
+ if ( !GetClientRect().Inside(pt) )
+ {
+ return -1;
+ }
+
+ wxRect rectTabs = GetAllTabsRect();
+
+ switch ( GetTabOrientation() )
+ {
+ default:
+ wxFAIL_MSG(_T("unknown tab orientation"));
+ // fall through
+
+ case wxTOP:
+ if ( pt.y > rectTabs.GetBottom() )
+ return -1;
+ break;
+
+ case wxBOTTOM:
+ if ( pt.y < rectTabs.y )
+ return -1;
+ break;
+
+ case wxLEFT:
+ if ( pt.x > rectTabs.GetRight() )
+ return -1;
+ break;
+
+ case wxRIGHT:
+ if ( pt.x < rectTabs.x )
+ return -1;
+ break;
+ }
+
+ for ( size_t n = m_firstVisible; n < m_lastVisible; n++ )
+ {
+ GetTabSize(n, &rectTabs.width, &rectTabs.height);
+
+ if ( rectTabs.Inside(pt) )
+ return n;
+
+ // move the rectTabs to the next tab
+ if ( IsVertical() )
+ rectTabs.y += rectTabs.height;
+ else
+ rectTabs.x += rectTabs.width;
+ }
+
+ return -1;
+}
+
+bool wxNotebook::IsVertical() const
+{
+ wxDirection dir = GetTabOrientation();
+
+ return dir == wxLEFT || dir == wxRIGHT;
+}
+
+wxDirection wxNotebook::GetTabOrientation() const
+{
+ long style = GetWindowStyle();
+ if ( style & wxNB_BOTTOM )
+ return wxBOTTOM;
+ else if ( style & wxNB_RIGHT )
+ return wxRIGHT;
+ else if ( style & wxNB_LEFT )
+ return wxLEFT;
+
+ // wxNB_TOP == 0 so we don't have to test for it
+ return wxTOP;
+}
+
+wxRect wxNotebook::GetTabRect(int page) const
+{
+ wxRect rect;
+ wxCHECK_MSG( IS_VALID_PAGE(page), rect, _T("invalid notebook page") );
+
+ // calc the size of this tab and of the preceding ones
+ wxCoord widthThis, widthBefore;
+ if ( FixedSizeTabs() )
+ {
+ widthThis = m_widthMax;
+ widthBefore = page*m_widthMax;
+ }
+ else
+ {
+ widthBefore = 0;
+ for ( int n = 0; n < page; n++ )
+ {
+ widthBefore += m_widths[n];
+ }
+
+ widthThis = m_widths[page];
+ }
+
+ rect = GetTabsPart();
+ if ( IsVertical() )
+ {
+ rect.y += widthBefore - m_offset;
+ rect.height = widthThis;
+ }
+ else // horz
+ {
+ rect.x += widthBefore - m_offset;
+ rect.width = widthThis;
+ }
+
+ return rect;
+}
+
+wxRect wxNotebook::GetAllTabsRect() const
+{
+ wxRect rect;
+
+ if ( GetPageCount() )
+ {
+ const wxSize indent = GetRenderer()->GetTabIndent();
+ wxSize size = GetClientSize();
+
+ if ( IsVertical() )
+ {
+ rect.width = m_heightTab + indent.x;
+ rect.x = GetTabOrientation() == wxLEFT ? 0 : size.x - rect.width;
+ rect.y = 0;
+ rect.height = size.y;
+ }
+ else // horz
+ {
+ rect.x = 0;
+ rect.width = size.x;
+ rect.height = m_heightTab + indent.y;
+ rect.y = GetTabOrientation() == wxTOP ? 0 : size.y - rect.height;
+ }
+ }
+ //else: no pages
+
+ return rect;
+}
+
+wxRect wxNotebook::GetTabsPart() const
+{
+ wxRect rect = GetAllTabsRect();
+
+ wxDirection dir = GetTabOrientation();
+
+ const wxSize indent = GetRenderer()->GetTabIndent();
+ if ( IsVertical() )
+ {
+ rect.x += indent.y;
+ rect.y += indent.x;
+ }
+ else // horz
+ {
+ rect.x += indent.x;
+ if ( dir == wxTOP )
+ {
+ rect.y += indent.y;
+ rect.height -= indent.y;
+ }
+ else // wxBOTTOM
+ {
+ rect.height -= indent.y;
+ }
+ }
+
+ return rect;
+}
+
+void wxNotebook::GetTabSize(int page, wxCoord *w, wxCoord *h) const
+{
+ wxCHECK_RET( w && h, _T("NULL pointer in GetTabSize") );
+
+ if ( IsVertical() )
+ {
+ // width and height have inverted meaning
+ wxCoord *tmp = w;
+ w = h;
+ h = tmp;
+ }
+
+ // height is always fixed
+ *h = m_heightTab;
+
+ // width may also be fixed and be the same for all tabs
+ *w = GetTabWidth(page);
+}
+
+void wxNotebook::SetTabSize(const wxSize& sz)
+{
+ wxCHECK_RET( FixedSizeTabs(), _T("SetTabSize() ignored") );
+
+ if ( IsVertical() )
+ {
+ m_heightTab = sz.x;
+ m_widthMax = sz.y;
+ }
+ else // horz
+ {
+ m_widthMax = sz.x;
+ m_heightTab = sz.y;
+ }
+}
+
+wxSize wxNotebook::CalcTabSize(int page) const
+{
+ // NB: don't use m_widthMax, m_heightTab or m_widths here because this
+ // method is called to calculate them
+
+ wxSize size;
+
+ wxCHECK_MSG( IS_VALID_PAGE(page), size, _T("invalid notebook page") );
+
+ GetTextExtent(m_titles[page], &size.x, &size.y);
+
+ if ( HasImage(page) )
+ {
+ wxSize sizeImage;
+ m_imageList->GetSize(m_images[page], sizeImage.x, sizeImage.y);
+
+ size.x += sizeImage.x + 5; // FIXME: hard coded margin
+
+ if ( sizeImage.y > size.y )
+ size.y = sizeImage.y;
+ }
+
+ size.x += 2*m_sizePad.x;
+ size.y += 2*m_sizePad.y;
+
+ return size;
+}
+
+void wxNotebook::ResizeTab(int page)
+{
+ wxSize sizeTab = CalcTabSize(page);
+
+ // we only need full relayout if the page size changes
+ bool needsRelayout = FALSE;
+
+ if ( IsVertical() )
+ {
+ // swap coordinates
+ wxCoord tmp = sizeTab.x;
+ sizeTab.x = sizeTab.y;
+ sizeTab.y = tmp;
+ }
+
+ if ( sizeTab.y > m_heightTab )
+ {
+ needsRelayout = TRUE;
+
+ m_heightTab = sizeTab.y;
+ }
+
+ m_widths[page] = sizeTab.x;
+
+ if ( sizeTab.x > m_widthMax )
+ m_widthMax = sizeTab.x;
+
+ // the total of the tabs has changed too
+ UpdateSpinBtn();
+
+ if ( needsRelayout )
+ Relayout();
+ else
+ RefreshAllTabs();
+}
+
+void wxNotebook::SetPadding(const wxSize& padding)
+{
+ if ( padding != m_sizePad )
+ {
+ m_sizePad = padding;
+
+ Relayout();
+ }
+}
+
+void wxNotebook::Relayout()
+{
+ if ( GetPageCount() )
+ {
+ RefreshAllTabs();
+
+ UpdateSpinBtn();
+
+ if ( m_sel != INVALID_PAGE )
+ {
+ // resize the currently shown page
+ wxRect rectPage = GetPageRect();
+
+ m_pages[m_sel]->SetSize(rectPage);
+
+ // also scroll it into view if needed (note that m_lastVisible
+ // was updated by the call to UpdateSpinBtn() above, this is why it
+ // is needed here)
+ if ( HasSpinBtn() )
+ {
+ if ( m_sel < m_firstVisible )
+ {
+ // selection is to the left of visible part of tabs
+ ScrollTo(m_sel);
+ }
+ else if ( m_sel > m_lastFullyVisible )
+ {
+ // selection is to the right of visible part of tabs
+ ScrollLastTo(m_sel);
+ }
+ }
+ }
+ }
+ else // we have no pages
+ {
+ // just refresh everything
+ Refresh();
+ }
+}
+
+wxRect wxNotebook::GetPagePart() const
+{
+ wxRect rectPage = GetClientRect();
+
+ if ( GetPageCount() )
+ {
+ wxRect rectTabs = GetAllTabsRect();
+ wxDirection dir = GetTabOrientation();
+ if ( IsVertical() )
+ {
+ rectPage.width -= rectTabs.width;
+ if ( dir == wxLEFT )
+ rectPage.x += rectTabs.width;
+ }
+ else // horz
+ {
+ rectPage.height -= rectTabs.height;
+ if ( dir == wxTOP )
+ rectPage.y += rectTabs.height;
+ }
+ }
+ //else: no pages at all
+
+ return rectPage;
+}
+
+wxRect wxNotebook::GetPageRect() const
+{
+ wxRect rect = GetPagePart();
+
+ // leave space for the border
+ wxRect rectBorder = GetRenderer()->GetBorderDimensions(wxBORDER_RAISED);
+
+ // FIXME: hardcoded +2!
+ rect.Inflate(-(rectBorder.x + rectBorder.width + 2),
+ -(rectBorder.y + rectBorder.height + 2));
+
+ return rect;
+}
+
+wxSize wxNotebook::GetSizeForPage(const wxSize& size) const
+{
+ wxSize sizeNb = size;
+ wxRect rect = GetAllTabsRect();
+ if ( IsVertical() )
+ sizeNb.x += rect.width;
+ else
+ sizeNb.y += rect.height;
+
+ return sizeNb;
+}
+
+void wxNotebook::SetPageSize(const wxSize& size)
+{
+ SetClientSize(GetSizeForPage(size));
+}
+
+wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
+{
+ return AdjustSize(GetSizeForPage(sizePage));
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook spin button
+// ----------------------------------------------------------------------------
+
+bool wxNotebook::HasSpinBtn() const
+{
+ return m_spinbtn && m_spinbtn->IsShown();
+}
+
+void wxNotebook::CalcLastVisibleTab()
+{
+ bool isVertical = IsVertical();
+
+ wxCoord width = GetClientSize().x;
+
+ wxRect rect = GetTabsPart();
+
+ size_t count = GetPageCount();
+
+ wxCoord widthLast = 0;
+ size_t n;
+ for ( n = m_firstVisible; n < count; n++ )
+ {
+ GetTabSize(n, &rect.width, &rect.height);
+ if ( rect.GetRight() > width )
+ {
+ break;
+ }
+
+ // remember it to use below
+ widthLast = rect.GetRight();
+
+ // move the rect to the next tab
+ if ( isVertical )
+ rect.y += rect.height;
+ else
+ rect.x += rect.width;
+ }
+
+ if ( n == m_firstVisible )
+ {
+ // even the first tab isn't fully visible - but still pretend it is as
+ // we have to show something
+ m_lastFullyVisible = m_firstVisible;
+ }
+ else // more than one tab visible
+ {
+ m_lastFullyVisible = n - 1;
+
+ // but is it really fully visible? it shouldn't overlap with the spin
+ // button if it is present (again, even if the first button does
+ // overlap with it, we pretend that it doesn't as there is not much
+ // else we can do)
+ if ( (m_lastFullyVisible > m_firstVisible) && HasSpinBtn() )
+ {
+ // adjust width to be the width before the spin button
+ wxSize sizeSpinBtn = m_spinbtn->GetSize();
+ if ( IsVertical() )
+ width -= sizeSpinBtn.y;
+ else
+ width -= sizeSpinBtn.x;
+
+ if ( widthLast > width )
+ {
+ // the last button overlaps with spin button, so take he
+ // previous one
+ m_lastFullyVisible--;
+ }
+ }
+ }
+
+ if ( n == count )
+ {
+ // everything is visible
+ m_lastVisible = n;
+ }
+ else
+ {
+ // this tab is still (partially) visible, so m_lastVisible is the
+ // next tab (remember, this is "exclusive" last)
+ m_lastVisible = n + 1;
+
+ }
+}
+
+void wxNotebook::UpdateSpinBtn()
+{
+ // first decide if we need a spin button
+ bool allTabsShown;
+
+ size_t count = (size_t)GetPageCount();
+ if ( count == 0 )
+ {
+ // this case is special, get rid of it immediately: everything is
+ // visible and we don't need any spin buttons
+ allTabsShown = TRUE;
+
+ // have to reset them manually as we don't call CalcLastVisibleTab()
+ m_firstVisible =
+ m_lastVisible =
+ m_lastFullyVisible = 0;
+ }
+ else
+ {
+ CalcLastVisibleTab();
+
+ // if all tabs after the first visible one are shown, it doesn't yet
+ // mean that all tabs are shown - so we go backwards until we arrive to
+ // the beginning (then all tabs are indeed shown) or find a tab such
+ // that not all tabs after it are shown
+ while ( (m_lastFullyVisible == count - 1) && (m_firstVisible > 0) )
+ {
+ // this is equivalent to ScrollTo(m_firstVisible - 1) but more
+ // efficient
+ m_offset -= GetTabWidth(m_firstVisible--);
+
+ // reclaculate after m_firstVisible change
+ CalcLastVisibleTab();
+ }
+
+ allTabsShown = m_lastFullyVisible == count - 1;
+ }
+
+ if ( !allTabsShown )
+ {
+ if ( !m_spinbtn )
+ {
+ // create it once only
+ m_spinbtn = new wxNotebookSpinBtn(this);
+
+ // set the correct value to keep it in sync
+ m_spinbtn->SetValue(m_sel);
+ }
+
+ // position it correctly
+ PositionSpinBtn();
+
+ // and show it
+ m_spinbtn->Show();
+
+ // also set/update the range
+ m_spinbtn->SetRange(0, count - 1);
+
+ // update m_lastFullyVisible once again as it might have changed
+ // because the spin button appeared
+ //
+ // FIXME: might do it more efficiently
+ CalcLastVisibleTab();
+ }
+ else // all tabs are visible, we don't need spin button
+ {
+ if ( m_spinbtn )
+ {
+ m_spinbtn->Hide();
+ }
+ }
+}
+
+void wxNotebook::PositionSpinBtn()
+{
+ if ( !m_spinbtn )
+ return;
+
+ wxCoord wBtn, hBtn;
+ m_spinbtn->GetSize(&wBtn, &hBtn);
+
+ wxRect rectTabs = GetAllTabsRect();
+
+ wxCoord x, y;
+ switch ( GetTabOrientation() )
+ {
+ default:
+ wxFAIL_MSG(_T("unknown tab orientation"));
+ // fall through
+
+ case wxTOP:
+ x = rectTabs.GetRight() - wBtn;
+ y = rectTabs.GetBottom() - hBtn;
+ break;
+
+ case wxBOTTOM:
+ x = rectTabs.GetRight() - wBtn;
+ y = rectTabs.GetTop();
+ break;
+
+ case wxLEFT:
+ x = rectTabs.GetRight() - wBtn;
+ y = rectTabs.GetBottom() - hBtn;
+ break;
+
+ case wxRIGHT:
+ x = rectTabs.GetLeft();
+ y = rectTabs.GetBottom() - hBtn;
+ break;
+ }
+
+ m_spinbtn->Move(x, y);
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook scrolling
+// ----------------------------------------------------------------------------
+
+void wxNotebook::ScrollTo(int page)
+{
+ wxCHECK_RET( IS_VALID_PAGE(page), _T("invalid notebook page") );
+
+ // set the first visible tab and offset (easy)
+ m_firstVisible = (size_t)page;
+ m_offset = 0;
+ for ( size_t n = 0; n < m_firstVisible; n++ )
+ {
+ m_offset += GetTabWidth(n);
+ }
+
+ // find the last visible tab too
+ CalcLastVisibleTab();
+
+ RefreshAllTabs();
+}
+
+void wxNotebook::ScrollLastTo(int page)
+{
+ wxCHECK_RET( IS_VALID_PAGE(page), _T("invalid notebook page") );
+
+ // go backwards until we find the first tab which can be made visible
+ // without hiding the given one
+ wxSize size = GetClientSize();
+ wxCoord widthAll = IsVertical() ? size.y : size.x,
+ widthTabs = GetTabWidth(page);
+
+ // the total width is less than the width of the window if we have the spin
+ // button
+ if ( HasSpinBtn() )
+ {
+ wxSize sizeSpinBtn = m_spinbtn->GetSize();
+ if ( IsVertical() )
+ widthAll -= sizeSpinBtn.y;
+ else
+ widthAll -= sizeSpinBtn.x;
+ }
+
+ m_firstVisible = page;
+ while ( (m_firstVisible > 0) && (widthTabs <= widthAll) )
+ {
+ widthTabs += GetTabWidth(--m_firstVisible);
+ }
+
+ if ( widthTabs > widthAll )
+ {
+ // take one step back (that it is forward) if we can
+ if ( m_firstVisible < (size_t)GetPageCount() - 1 )
+ m_firstVisible++;
+ }
+
+ // go to it
+ ScrollTo(m_firstVisible);
+
+ // consitency check: the page we were asked to show should be shown
+ wxASSERT_MSG( (size_t)page < m_lastVisible, _T("bug in ScrollLastTo") );
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook sizing/moving
+// ----------------------------------------------------------------------------
+
+wxSize wxNotebook::DoGetBestClientSize() const
+{
+ // calculate the max page size
+ wxSize size(0, 0);
+
+ size_t count = GetPageCount();
+ if ( count )
+ {
+ for ( size_t n = 0; n < count; n++ )
+ {
+ wxSize sizePage = m_pages[n]->GetSize();
+
+ if ( size.x < sizePage.x )
+ size.x = sizePage.x;
+ if ( size.y < sizePage.y )
+ size.y = sizePage.y;
+ }
+ }
+ else // no pages
+ {
+ // use some arbitrary default size
+ size.x =
+ size.y = 100;
+ }
+
+ return GetSizeForPage(size);
+}
+
+void wxNotebook::DoMoveWindow(int x, int y, int width, int height)
+{
+ wxControl::DoMoveWindow(x, y, width, height);
+
+ // move the spin ctrl too (NOP if it doesn't exist)
+ PositionSpinBtn();
+}
+
+void wxNotebook::DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags)
+{
+ wxControl::DoSetSize(x, y, width, height, sizeFlags);
+
+ Relayout();
+}
+
+// ----------------------------------------------------------------------------
+// wxNotebook input processing
+// ----------------------------------------------------------------------------
+
+bool wxNotebook::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ if ( action == wxACTION_NOTEBOOK_NEXT )
+ ChangePage(GetNextPage(TRUE));
+ else if ( action == wxACTION_NOTEBOOK_PREV )
+ ChangePage(GetNextPage(FALSE));
+ else if ( action == wxACTION_NOTEBOOK_GOTO )
+ ChangePage((int)numArg);
+ else
+ return wxControl::PerformAction(action, numArg, strArg);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxStdNotebookInputHandler
+// ----------------------------------------------------------------------------
+
+wxStdNotebookInputHandler::wxStdNotebookInputHandler(wxInputHandler *inphand)
+ : wxStdInputHandler(inphand)
+{
+}
+
+bool wxStdNotebookInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ // ignore the key releases
+ if ( pressed )
+ {
+ wxNotebook *notebook = wxStaticCast(control, wxNotebook);
+
+ int page = 0;
+ wxControlAction action;
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_UP:
+ if ( notebook->IsVertical() )
+ action = wxACTION_NOTEBOOK_PREV;
+ break;
+
+ case WXK_LEFT:
+ if ( !notebook->IsVertical() )
+ action = wxACTION_NOTEBOOK_PREV;
+ break;
+
+ case WXK_DOWN:
+ if ( notebook->IsVertical() )
+ action = wxACTION_NOTEBOOK_NEXT;
+ break;
+
+ case WXK_RIGHT:
+ if ( !notebook->IsVertical() )
+ action = wxACTION_NOTEBOOK_NEXT;
+ break;
+
+ case WXK_HOME:
+ action = wxACTION_NOTEBOOK_GOTO;
+ // page = 0; -- already has this value
+ break;
+
+ case WXK_END:
+ action = wxACTION_NOTEBOOK_GOTO;
+ page = notebook->GetPageCount() - 1;
+ break;
+ }
+
+ if ( !!action )
+ {
+ return control->PerformAction(action, page);
+ }
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdNotebookInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ if ( event.ButtonDown(1) )
+ {
+ wxNotebook *notebook = wxStaticCast(control, wxNotebook);
+ int page = notebook->HitTest(event.GetPosition());
+ if ( page != -1 )
+ {
+ control->PerformAction(wxACTION_NOTEBOOK_GOTO, page);
+
+ return FALSE;
+ }
+ }
+
+ return wxStdInputHandler::HandleMouse(control, event);
+}
+
+bool wxStdNotebookInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ return wxStdInputHandler::HandleMouseMove(control, event);
+}
+
+bool wxStdNotebookInputHandler::HandleFocus(wxControl *control,
+ const wxFocusEvent& event)
+{
+ HandleFocusChange(control);
+
+ return FALSE;
+}
+
+bool wxStdNotebookInputHandler::HandleActivation(wxControl *control,
+ bool WXUNUSED(activated))
+{
+ // we react to the focus change in the same way as to the [de]activation
+ HandleFocusChange(control);
+
+ return FALSE;
+}
+
+void wxStdNotebookInputHandler::HandleFocusChange(wxControl *control)
+{
+ wxNotebook *notebook = wxStaticCast(control, wxNotebook);
+ notebook->RefreshCurrent();
+}
+
+#endif // wxUSE_NOTEBOOK
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/radiobox.cpp
+// Purpose: wxRadioBox implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 11.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univradiobox.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_RADIOBOX
+
+#ifndef WX_PRECOMP
+ #include "wx/dcclient.h"
+ #include "wx/radiobox.h"
+ #include "wx/radiobut.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/theme.h"
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/colschem.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+static const int BUTTON_BORDER_X = 2;
+static const int BUTTON_BORDER_Y = 4;
+
+static const int BOX_BORDER_X = 2;
+static const int BOX_BORDER_Y = 2;
+
+// ----------------------------------------------------------------------------
+// wxRadioBox event handler
+// ----------------------------------------------------------------------------
+
+class wxRadioHookHandler : public wxEvtHandler
+{
+public:
+ wxRadioHookHandler(wxRadioBox *radio) { m_radio = radio; }
+
+ virtual bool ProcessEvent(wxEvent& event)
+ {
+ // we intercept the command events from radio buttons
+ if ( event.GetEventType() == wxEVT_COMMAND_RADIOBUTTON_SELECTED )
+ {
+ m_radio->OnRadioButton(event);
+ }
+ else if ( event.GetEventType() == wxEVT_KEY_DOWN )
+ {
+ if ( m_radio->OnKeyDown((wxKeyEvent &)event) )
+ {
+ return TRUE;
+ }
+ }
+
+ // just pass it on
+ return GetNextHandler()->ProcessEvent(event);
+ }
+
+private:
+ wxRadioBox *m_radio;
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
+
+// ----------------------------------------------------------------------------
+// wxRadioBox creation
+// ----------------------------------------------------------------------------
+
+void wxRadioBox::Init()
+{
+ m_selection = -1;
+ m_majorDim = 0;
+}
+
+bool wxRadioBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString *choices,
+ int majorDim,
+ long style,
+ const wxValidator& val,
+ const wxString& name)
+{
+ // for compatibility with the other ports which don't handle (yet?)
+ // wxRA_LEFTTORIGHT and wxRA_TOPTOBOTTOM flags, we add them ourselves if
+ // not specified
+ if ( !(style & (wxRA_LEFTTORIGHT | wxRA_TOPTOBOTTOM)) )
+ {
+ // horizontal radiobox use left to right layout
+ if ( style & wxRA_HORIZONTAL )
+ {
+ style |= wxRA_LEFTTORIGHT;
+ }
+ else if ( style & wxRA_VERTICAL )
+ {
+ style |= wxRA_TOPTOBOTTOM;
+ }
+ else
+ {
+ wxFAIL_MSG( _T("you must specify wxRA_XXX style!") );
+
+ // use default
+ style = wxRA_HORIZONTAL | wxRA_LEFTTORIGHT;
+ }
+ }
+
+ if ( !wxStaticBox::Create(parent, id, title, pos, size, style, name) )
+ return FALSE;
+
+#if wxUSE_VALIDATORS
+ SetValidator(val);
+#endif // wxUSE_VALIDATORS
+
+ Append(n, choices);
+
+ // majorDim default value is 0 which means make one row/column
+ SetMajorDim(majorDim == 0 ? n : majorDim);
+
+ if ( size == wxDefaultSize )
+ {
+ SetClientSize(DoGetBestClientSize());
+ }
+
+ // radiobox should already have selection so select at least one item
+ SetSelection(0);
+
+ return TRUE;
+}
+
+wxRadioBox::~wxRadioBox()
+{
+ // remove the event handlers we pushed on them from all buttons and delete
+ // the buttons themselves: this must be done as the user code expects them
+ // to disappear now and not some time later when they will be deleted by
+ // our (common) parent
+ size_t count = m_buttons.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ m_buttons[n]->PopEventHandler(TRUE /* delete it */);
+
+ delete m_buttons[n];
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxRadioBox init
+// ----------------------------------------------------------------------------
+
+void wxRadioBox::SetMajorDim(int majorDim)
+{
+ wxCHECK_RET( majorDim != 0, _T("major radiobox dimension can't be 0") );
+
+ m_majorDim = majorDim;
+
+ int minorDim = (GetCount() + m_majorDim - 1) / m_majorDim;
+
+ if ( GetWindowStyle() & wxRA_SPECIFY_COLS )
+ {
+ m_numCols = majorDim;
+ m_numRows = minorDim;
+ }
+ else // wxRA_SPECIFY_ROWS
+ {
+ m_numCols = minorDim;
+ m_numRows = majorDim;
+ }
+}
+
+void wxRadioBox::Append(int count, const wxString *choices)
+{
+ if ( !count )
+ return;
+
+ wxWindow *parent = GetParent();
+ m_buttons.Alloc(count);
+ for ( int n = 0; n < count; n++ )
+ {
+ // make the first button in the box the start of new group by giving it
+ // wxRB_GROUP style
+ wxRadioButton *btn = new wxRadioButton(parent, -1, choices[n],
+ wxDefaultPosition,
+ wxDefaultSize,
+ n == 0 ? wxRB_GROUP : 0);
+
+ // we want to get the events from the buttons to translate it into
+ btn->PushEventHandler(new wxRadioHookHandler(this));
+ m_buttons.Add(btn);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// selection
+// ----------------------------------------------------------------------------
+
+void wxRadioBox::SetSelection(int n)
+{
+ wxCHECK_RET( IsValid(n), _T("invalid index in wxRadioBox::SetSelection") );
+
+ m_selection = n;
+
+ wxRadioButton *btn = m_buttons[n];
+
+ // the selected button is always focused in the radiobox
+ btn->SetFocus();
+
+ // this will also unselect the previously selected button in our group
+ btn->SetValue(TRUE);
+}
+
+int wxRadioBox::GetSelection() const
+{
+ return m_selection;
+}
+
+void wxRadioBox::SendRadioEvent()
+{
+ wxCHECK_RET( m_selection != -1, _T("no active radio button") );
+
+ wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, GetId());
+ InitCommandEvent(event);
+ event.SetInt(m_selection);
+ event.SetString(GetString(m_selection));
+
+ Command(event);
+}
+
+void wxRadioBox::OnRadioButton(wxEvent& event)
+{
+ int n = m_buttons.Index((wxRadioButton *)event.GetEventObject());
+ wxCHECK_RET( n != wxNOT_FOUND, _T("click from alien radio button") );
+
+ m_selection = n;
+
+ SendRadioEvent();
+}
+
+// ----------------------------------------------------------------------------
+// methods forwarded to the buttons
+// ----------------------------------------------------------------------------
+
+wxString wxRadioBox::GetString(int n) const
+{
+ wxCHECK_MSG( IsValid(n), _T(""),
+ _T("invalid index in wxRadioBox::GetString") );
+
+ return m_buttons[n]->GetLabel();
+}
+
+void wxRadioBox::SetString(int n, const wxString& label)
+{
+ wxCHECK_RET( IsValid(n), _T("invalid index in wxRadioBox::SetString") );
+
+ m_buttons[n]->SetLabel(label);
+}
+
+void wxRadioBox::Enable(int n, bool enable)
+{
+ wxCHECK_RET( IsValid(n), _T("invalid index in wxRadioBox::Enable") );
+
+ m_buttons[n]->Enable(enable);
+}
+
+void wxRadioBox::Show(int n, bool show)
+{
+ wxCHECK_RET( IsValid(n), _T("invalid index in wxRadioBox::Show") );
+
+ m_buttons[n]->Show(show);
+}
+
+// ----------------------------------------------------------------------------
+// methods forwarded to the static box
+// ----------------------------------------------------------------------------
+
+bool wxRadioBox::Enable(bool enable)
+{
+ return wxStaticBox::Enable(enable);
+}
+
+bool wxRadioBox::Show(bool show)
+{
+ return wxStaticBox::Show(show);
+}
+
+wxString wxRadioBox::GetLabel() const
+{
+ return wxStaticBox::GetLabel();
+}
+
+void wxRadioBox::SetLabel(const wxString& label)
+{
+ wxStaticBox::SetLabel(label);
+}
+
+// ----------------------------------------------------------------------------
+// buttons positioning
+// ----------------------------------------------------------------------------
+
+wxSize wxRadioBox::GetMaxButtonSize() const
+{
+ int widthMax, heightMax, width, height;
+ widthMax = heightMax = 0;
+
+ int count = GetCount();
+ for ( int n = 0; n < count; n++ )
+ {
+ m_buttons[n]->GetBestSize(&width, &height);
+
+ if ( width > widthMax )
+ widthMax = width;
+ if ( height > heightMax )
+ heightMax = height;
+ }
+
+ return wxSize(widthMax + BUTTON_BORDER_X, heightMax + BUTTON_BORDER_Y);
+}
+
+wxSize wxRadioBox::DoGetBestClientSize() const
+{
+ wxSize sizeBtn = GetMaxButtonSize();
+
+ sizeBtn.x *= m_numCols;
+ sizeBtn.y *= m_numRows;
+
+ // add a border around all buttons
+ sizeBtn.x += 2*BOX_BORDER_X;
+ sizeBtn.y += 2*BOX_BORDER_Y;
+
+ // account for the area taken by static box
+ wxRect rect = GetBorderGeometry();
+ sizeBtn.x += rect.x + rect.width;
+ sizeBtn.y += rect.y + rect.height;
+
+ return sizeBtn;
+}
+
+void wxRadioBox::DoMoveWindow(int x0, int y0, int width, int height)
+{
+ wxStaticBox::DoMoveWindow(x0, y0, width, height);
+
+ wxSize sizeBtn = GetMaxButtonSize();
+ wxPoint ptOrigin = GetBoxAreaOrigin();
+
+ x0 += ptOrigin.x + BOX_BORDER_X;
+ y0 += ptOrigin.y + BOX_BORDER_Y;
+
+ int x = x0,
+ y = y0;
+
+ int count = GetCount();
+ for ( int n = 0; n < count; n++ )
+ {
+ m_buttons[n]->SetSize(x, y, sizeBtn.x, sizeBtn.y);
+
+ if ( GetWindowStyle() & wxRA_TOPTOBOTTOM )
+ {
+ // from top to bottom
+ if ( (n + 1) % m_numRows )
+ {
+ // continue in this column
+ y += sizeBtn.y;
+ }
+ else
+ {
+ // start a new column
+ x += sizeBtn.x;
+ y = y0;
+ }
+ }
+ else // wxRA_LEFTTORIGHT: mirror the code above
+ {
+ // from left to right
+ if ( (n + 1) % m_numCols )
+ {
+ // continue in this row
+ x += sizeBtn.x;
+ }
+ else
+ {
+ // start a new row
+ y += sizeBtn.y;
+ x = x0;
+ }
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// keyboard navigation
+// ----------------------------------------------------------------------------
+
+bool wxRadioBox::OnKeyDown(wxKeyEvent& event)
+{
+ wxDirection dir;
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_UP:
+ dir = wxUP;
+ break;
+
+ case WXK_LEFT:
+ dir = wxLEFT;
+ break;
+
+ case WXK_DOWN:
+ dir = wxDOWN;
+ break;
+
+ case WXK_RIGHT:
+ dir = wxRIGHT;
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ int selOld = GetSelection();
+ int selNew = GetNextItem(selOld, dir, GetWindowStyle());
+ if ( selNew != selOld )
+ {
+ SetSelection(selNew);
+
+ // emulate the button click
+ SendRadioEvent();
+ }
+
+ return TRUE;
+}
+
+#endif // wxUSE_RADIOBOX
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/radiobut.cpp
+// Purpose: wxRadioButton implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univradiobut.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_RADIOBTN
+
+#ifndef WX_PRECOMP
+ #include "wx/dcclient.h"
+ #include "wx/radiobut.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/theme.h"
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/colschem.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
+
+// ----------------------------------------------------------------------------
+// wxRadioButton
+// ----------------------------------------------------------------------------
+
+bool wxRadioButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ if ( !wxCheckBox::Create(parent, id, label, pos, size, style,
+ wxDefaultValidator, name) )
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// radio button methods
+// ----------------------------------------------------------------------------
+
+void wxRadioButton::OnCheck()
+{
+ // clear all others radio buttons in our group: for this we need to
+ // find the radio button which is the first in the group, i.e. the one
+ // with wxRB_GROUP style
+ const wxWindowList& siblings = GetParent()->GetChildren();
+ wxWindowList::Node *nodeStart = siblings.Find(this);
+ while ( nodeStart )
+ {
+ // stop if we found a radio button with wxRB_GROUP style or it we
+ // are at the first control
+ if ( !nodeStart->GetPrevious() ||
+ (nodeStart->GetData()->GetWindowStyle() & wxRB_GROUP) )
+ break;
+
+ nodeStart = nodeStart->GetPrevious();
+ }
+
+ // now clear all radio buttons from the starting one until the next
+ // one with wxRB_GROUP style
+ while ( nodeStart )
+ {
+ wxWindow *win = nodeStart->GetData();
+ if ( win != this )
+ {
+ wxRadioButton *btn = wxDynamicCast(win, wxRadioButton);
+ if ( btn )
+ {
+ btn->ClearValue();
+ }
+ }
+
+ nodeStart = nodeStart->GetNext();
+ if ( !nodeStart ||
+ (nodeStart->GetData()->GetWindowStyle() & wxRB_GROUP) )
+ {
+ // we reached the next group
+ break;
+ }
+ }
+}
+
+void wxRadioButton::ChangeValue(bool value)
+{
+ if ( value == IsChecked() )
+ return;
+
+ if ( !IsChecked() )
+ {
+ wxCheckBox::ChangeValue(value);
+ }
+ else // attempt to clear a radio button - this can't be done
+ {
+ // but still refresh as our PRESSED flag changed
+ Refresh();
+ }
+}
+
+void wxRadioButton::ClearValue()
+{
+ if ( IsChecked() )
+ {
+ SetValue(FALSE);
+ }
+}
+
+void wxRadioButton::SendEvent()
+{
+ wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, GetId());
+ InitCommandEvent(event);
+ event.SetInt(IsChecked());
+ Command(event);
+}
+
+// ----------------------------------------------------------------------------
+// overridden wxCheckBox methods
+// ----------------------------------------------------------------------------
+
+wxSize wxRadioButton::GetBitmapSize() const
+{
+ wxBitmap bmp = GetBitmap(State_Normal, Status_Checked);
+ return bmp.Ok() ? wxSize(bmp.GetWidth(), bmp.GetHeight())
+ : GetRenderer()->GetRadioBitmapSize();
+}
+
+void wxRadioButton::DoDraw(wxControlRenderer *renderer)
+{
+ wxDC& dc = renderer->GetDC();
+ dc.SetFont(GetFont());
+ dc.SetTextForeground(GetForegroundColour());
+
+ int flags = GetStateFlags();
+ Status status = GetStatus();
+ if ( status == Status_Checked )
+ flags |= wxCONTROL_CHECKED;
+
+ renderer->GetRenderer()->
+ DrawRadioButton(dc,
+ GetLabel(),
+ GetBitmap(GetState(flags), status),
+ renderer->GetRect(),
+ flags,
+ GetWindowStyle() & wxALIGN_RIGHT ? wxALIGN_RIGHT
+ : wxALIGN_LEFT,
+ GetAccelIndex());
+}
+
+#endif // wxUSE_RADIOBTN
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/renderer.cpp
+// Purpose: wxControlRenderer implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "renderer.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/control.h"
+ #include "wx/checklst.h"
+ #include "wx/listbox.h"
+ #include "wx/scrolbar.h"
+ #include "wx/dc.h"
+#endif // WX_PRECOMP
+
+#include "wx/image.h"
+
+#include "wx/univ/theme.h"
+#include "wx/univ/renderer.h"
+#include "wx/univ/colschem.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxRenderer: drawing helpers
+// ----------------------------------------------------------------------------
+
+void wxRenderer::StandardDrawFrame(wxDC& dc,
+ const wxRect& rectFrame,
+ const wxRect& rectLabel)
+{
+ // draw left, bottom and right lines entirely
+ DrawVerticalLine(dc, rectFrame.GetLeft(),
+ rectFrame.GetTop(), rectFrame.GetBottom() - 2);
+ DrawHorizontalLine(dc, rectFrame.GetBottom() - 1,
+ rectFrame.GetLeft(), rectFrame.GetRight());
+ DrawVerticalLine(dc, rectFrame.GetRight() - 1,
+ rectFrame.GetTop(), rectFrame.GetBottom() - 1);
+
+ // and 2 parts of the top line
+ DrawHorizontalLine(dc, rectFrame.GetTop(),
+ rectFrame.GetLeft() + 1, rectLabel.GetLeft());
+ DrawHorizontalLine(dc, rectFrame.GetTop(),
+ rectLabel.GetRight(), rectFrame.GetRight() - 2);
+}
+
+/* static */
+void wxRenderer::StandardDrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart, int selEnd,
+ int flags)
+{
+ if ( (selStart == -1) || !(flags & wxCONTROL_FOCUSED) )
+ {
+ // just draw it as is
+ dc.DrawText(text, rect.x, rect.y);
+ }
+ else // we have selection
+ {
+ wxCoord width,
+ x = rect.x;
+
+ // draw the part before selection
+ wxString s(text, (size_t)selStart);
+ if ( !s.empty() )
+ {
+ dc.DrawText(s, x, rect.y);
+
+ dc.GetTextExtent(s, &width, NULL);
+ x += width;
+ }
+
+ // draw the selection itself
+ s = wxString(text.c_str() + selStart, text.c_str() + selEnd);
+ if ( !s.empty() )
+ {
+ wxColour colFg = dc.GetTextForeground(),
+ colBg = dc.GetTextBackground();
+ dc.SetTextForeground(wxTHEME_COLOUR(HIGHLIGHT_TEXT));
+ dc.SetTextBackground(wxTHEME_COLOUR(HIGHLIGHT));
+ dc.SetBackgroundMode(wxSOLID);
+
+ dc.DrawText(s, x, rect.y);
+ dc.GetTextExtent(s, &width, NULL);
+ x += width;
+
+ dc.SetBackgroundMode(wxTRANSPARENT);
+ dc.SetTextBackground(colBg);
+ dc.SetTextForeground(colFg);
+ }
+
+ // draw the final part
+ s = text.c_str() + selEnd;
+ if ( !s.empty() )
+ {
+ dc.DrawText(s, x, rect.y);
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxRenderer: scrollbar geometry
+// ----------------------------------------------------------------------------
+
+/* static */
+void wxRenderer::StandardScrollBarThumbSize(wxCoord length,
+ int thumbPos,
+ int thumbSize,
+ int range,
+ wxCoord *thumbStart,
+ wxCoord *thumbEnd)
+{
+ // the thumb can't be made less than this number of pixels
+ static const wxCoord thumbMinWidth = 8; // FIXME: should be configurable
+
+ *thumbStart = (length*thumbPos) / range;
+ *thumbEnd = (length*(thumbPos + thumbSize)) / range;
+
+ if ( *thumbEnd - *thumbStart < thumbMinWidth )
+ {
+ // adjust the end if possible
+ if ( *thumbStart <= length - thumbMinWidth )
+ {
+ // yes, just make it wider
+ *thumbEnd = *thumbStart + thumbMinWidth;
+ }
+ else // it is at the bottom of the scrollbar
+ {
+ // so move it a bit up
+ *thumbStart = length - thumbMinWidth;
+ *thumbEnd = length;
+ }
+ }
+}
+
+/* static */
+wxRect wxRenderer::StandardGetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos,
+ const wxSize& sizeArrow)
+{
+ if ( thumbPos == -1 )
+ {
+ thumbPos = scrollbar->GetThumbPosition();
+ }
+
+ wxSize sizeTotal = scrollbar->GetClientSize();
+ wxCoord *start, *width, length, arrow;
+ wxRect rect;
+ if ( scrollbar->IsVertical() )
+ {
+ rect.x = 0;
+ rect.width = sizeTotal.x;
+ length = sizeTotal.y;
+ start = &rect.y;
+ width = &rect.height;
+ arrow = sizeArrow.y;
+ }
+ else // horizontal
+ {
+ rect.y = 0;
+ rect.height = sizeTotal.y;
+ length = sizeTotal.x;
+ start = &rect.x;
+ width = &rect.width;
+ arrow = sizeArrow.x;
+ }
+
+ switch ( elem )
+ {
+ case wxScrollBar::Element_Arrow_Line_1:
+ *start = 0;
+ *width = arrow;
+ break;
+
+ case wxScrollBar::Element_Arrow_Line_2:
+ *start = length - arrow;
+ *width = arrow;
+ break;
+
+ case wxScrollBar::Element_Arrow_Page_1:
+ case wxScrollBar::Element_Arrow_Page_2:
+ // we don't have them at all
+ break;
+
+ case wxScrollBar::Element_Thumb:
+ case wxScrollBar::Element_Bar_1:
+ case wxScrollBar::Element_Bar_2:
+ // we need to calculate the thumb position - do it
+ {
+ length -= 2*arrow;
+ wxCoord thumbStart, thumbEnd;
+ int range = scrollbar->GetRange();
+ if ( !range )
+ {
+ thumbStart =
+ thumbEnd = 0;
+ }
+ else
+ {
+ StandardScrollBarThumbSize(length,
+ thumbPos,
+ scrollbar->GetThumbSize(),
+ range,
+ &thumbStart,
+ &thumbEnd);
+ }
+
+ if ( elem == wxScrollBar::Element_Thumb )
+ {
+ *start = thumbStart;
+ *width = thumbEnd - thumbStart;
+ }
+ else if ( elem == wxScrollBar::Element_Bar_1 )
+ {
+ *start = 0;
+ *width = thumbStart;
+ }
+ else // elem == wxScrollBar::Element_Bar_2
+ {
+ *start = thumbEnd;
+ *width = length - thumbEnd;
+ }
+
+ // everything is relative to the start of the shaft so far
+ *start += arrow;
+ }
+ break;
+
+ case wxScrollBar::Element_Max:
+ default:
+ wxFAIL_MSG( _T("unknown scrollbar element") );
+ }
+
+ return rect;
+}
+
+/* static */
+wxCoord wxRenderer::StandardScrollBarSize(const wxScrollBar *scrollbar,
+ const wxSize& sizeArrowSB)
+{
+ wxCoord sizeArrow, sizeTotal;
+ if ( scrollbar->GetWindowStyle() & wxVERTICAL )
+ {
+ sizeArrow = sizeArrowSB.y;
+ sizeTotal = scrollbar->GetSize().y;
+ }
+ else // horizontal
+ {
+ sizeArrow = sizeArrowSB.x;
+ sizeTotal = scrollbar->GetSize().x;
+ }
+
+ return sizeTotal - 2*sizeArrow;
+}
+
+/* static */
+wxCoord wxRenderer::StandardScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos,
+ const wxSize& sizeArrow)
+{
+ int range = scrollbar->GetRange();
+ if ( !range )
+ {
+ // the only valid position anyhow
+ return 0;
+ }
+
+ if ( thumbPos == -1 )
+ {
+ // by default use the current thumb position
+ thumbPos = scrollbar->GetThumbPosition();
+ }
+
+ return ( thumbPos*StandardScrollBarSize(scrollbar, sizeArrow) ) / range
+ + (scrollbar->IsVertical() ? sizeArrow.y : sizeArrow.x);
+}
+
+/* static */
+int wxRenderer::StandardPixelToScrollbar(const wxScrollBar *scrollbar,
+ wxCoord coord,
+ const wxSize& sizeArrow)
+{
+ return ( (coord - (scrollbar->IsVertical() ? sizeArrow.y : sizeArrow.x)) *
+ scrollbar->GetRange() ) /
+ StandardScrollBarSize(scrollbar, sizeArrow);
+}
+
+/* static */
+wxHitTest wxRenderer::StandardHitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt,
+ const wxSize& sizeArrowSB)
+{
+ // we only need to work with either x or y coord depending on the
+ // orientation, choose one (but still check the other one to verify if the
+ // mouse is in the window at all)
+ wxCoord coord, sizeArrow, sizeTotal;
+ wxSize size = scrollbar->GetSize();
+ if ( scrollbar->GetWindowStyle() & wxVERTICAL )
+ {
+ if ( pt.x < 0 || pt.x > size.x )
+ return wxHT_NOWHERE;
+
+ coord = pt.y;
+ sizeArrow = sizeArrowSB.y;
+ sizeTotal = size.y;
+ }
+ else // horizontal
+ {
+ if ( pt.y < 0 || pt.y > size.y )
+ return wxHT_NOWHERE;
+
+ coord = pt.x;
+ sizeArrow = sizeArrowSB.x;
+ sizeTotal = size.x;
+ }
+
+ // test for the arrows first as it's faster
+ if ( coord < 0 || coord > sizeTotal )
+ {
+ return wxHT_NOWHERE;
+ }
+ else if ( coord < sizeArrow )
+ {
+ return wxHT_SCROLLBAR_ARROW_LINE_1;
+ }
+ else if ( coord > sizeTotal - sizeArrow )
+ {
+ return wxHT_SCROLLBAR_ARROW_LINE_2;
+ }
+ else
+ {
+ // calculate the thumb position in pixels
+ sizeTotal -= 2*sizeArrow;
+ wxCoord thumbStart, thumbEnd;
+ int range = scrollbar->GetRange();
+ if ( !range )
+ {
+ // clicking the scrollbar without range has no effect
+ return wxHT_NOWHERE;
+ }
+ else
+ {
+ StandardScrollBarThumbSize(sizeTotal,
+ scrollbar->GetThumbPosition(),
+ scrollbar->GetThumbSize(),
+ range,
+ &thumbStart,
+ &thumbEnd);
+ }
+
+ // now compare with the thumb position
+ coord -= sizeArrow;
+ if ( coord < thumbStart )
+ return wxHT_SCROLLBAR_BAR_1;
+ else if ( coord > thumbEnd )
+ return wxHT_SCROLLBAR_BAR_2;
+ else
+ return wxHT_SCROLLBAR_THUMB;
+ }
+}
+
+wxRenderer::~wxRenderer()
+{
+}
+
+// ----------------------------------------------------------------------------
+// wxControlRenderer
+// ----------------------------------------------------------------------------
+
+wxControlRenderer::wxControlRenderer(wxWindow *window,
+ wxDC& dc,
+ wxRenderer *renderer)
+ : m_dc(dc)
+{
+ m_window = window;
+ m_renderer = renderer;
+
+ wxSize size = m_window->GetClientSize();
+ m_rect.x =
+ m_rect.y = 0;
+ m_rect.width = size.x;
+ m_rect.height = size.y;
+}
+
+void wxControlRenderer::DrawLabel(const wxBitmap& bitmap,
+ wxCoord marginX, wxCoord marginY)
+{
+ m_dc.SetFont(m_window->GetFont());
+ m_dc.SetTextForeground(m_window->GetForegroundColour());
+
+ wxString label = m_window->GetLabel();
+ if ( !label.empty() || bitmap.Ok() )
+ {
+ wxRect rectLabel = m_rect;
+ if ( bitmap.Ok() )
+ {
+ rectLabel.Inflate(-marginX, -marginY);
+ }
+
+ wxControl *ctrl = wxStaticCast(m_window, wxControl);
+
+ m_renderer->DrawButtonLabel(m_dc,
+ label,
+ bitmap,
+ rectLabel,
+ m_window->GetStateFlags(),
+ ctrl->GetAlignment(),
+ ctrl->GetAccelIndex());
+ }
+}
+
+void wxControlRenderer::DrawFrame()
+{
+ m_dc.SetFont(m_window->GetFont());
+ m_dc.SetTextForeground(m_window->GetForegroundColour());
+ m_dc.SetTextBackground(m_window->GetBackgroundColour());
+
+ wxControl *ctrl = wxStaticCast(m_window, wxControl);
+
+ m_renderer->DrawFrame(m_dc,
+ m_window->GetLabel(),
+ m_rect,
+ m_window->GetStateFlags(),
+ ctrl->GetAlignment(),
+ ctrl->GetAccelIndex());
+}
+
+void wxControlRenderer::DrawButtonBorder()
+{
+ int flags = m_window->GetStateFlags();
+
+ m_renderer->DrawButtonBorder(m_dc, m_rect, flags, &m_rect);
+
+ m_renderer->DrawBackground(m_dc, wxTHEME_BG_COLOUR(m_window), m_rect, flags);
+}
+
+void wxControlRenderer::DrawBitmap(const wxBitmap& bitmap)
+{
+ int style = m_window->GetWindowStyle();
+ DrawBitmap(m_dc, bitmap, m_rect,
+ style & wxALIGN_MASK,
+ style & wxBI_EXPAND ? wxEXPAND : wxSTRETCH_NOT);
+}
+
+/* static */
+void wxControlRenderer::DrawBitmap(wxDC &dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int alignment,
+ wxStretch stretch)
+{
+ // we may change the bitmap if we stretch it
+ wxBitmap bmp = bitmap;
+ if ( !bmp.Ok() )
+ return;
+
+ int width = bmp.GetWidth(),
+ height = bmp.GetHeight();
+
+ wxCoord x = 0,
+ y = 0;
+ if ( stretch & wxTILE )
+ {
+ // tile the bitmap
+ for ( ; x < rect.width; x += width )
+ {
+ for ( y = 0; y < rect.height; y += height )
+ {
+ // no need to use mask here as we cover the entire window area
+ dc.DrawBitmap(bmp, x, y);
+ }
+ }
+ }
+ else if ( stretch & wxEXPAND )
+ {
+ // stretch bitmap to fill the entire control
+ bmp = wxImage(bmp).Scale(rect.width, rect.height).ConvertToBitmap();
+ }
+ else // not stretched, not tiled
+ {
+ if ( alignment & wxALIGN_RIGHT )
+ {
+ x = rect.GetRight() - width;
+ }
+ else if ( alignment & wxALIGN_CENTRE )
+ {
+ x = (rect.GetLeft() + rect.GetRight() - width + 1) / 2;
+ }
+ else // alignment & wxALIGN_LEFT
+ {
+ x = rect.GetLeft();
+ }
+
+ if ( alignment & wxALIGN_BOTTOM )
+ {
+ y = rect.GetBottom() - height;
+ }
+ else if ( alignment & wxALIGN_CENTRE_VERTICAL )
+ {
+ y = (rect.GetTop() + rect.GetBottom() - height + 1) / 2;
+ }
+ else // alignment & wxALIGN_TOP
+ {
+ y = rect.GetTop();
+ }
+ }
+
+ // do draw it
+ dc.DrawBitmap(bmp, x, y, TRUE /* use mask */);
+}
+
+void wxControlRenderer::DrawScrollbar(const wxScrollBar *scrollbar,
+ int thumbPosOld)
+{
+ // we will only redraw the parts which must be redrawn and not everything
+ wxRegion rgnUpdate = scrollbar->GetUpdateRegion();
+
+ {
+ wxRect rectUpdate = rgnUpdate.GetBox();
+ wxLogTrace(_T("scrollbar"),
+ _T("%s redraw: update box is (%d, %d)-(%d, %d)"),
+ scrollbar->IsVertical() ? _T("vert") : _T("horz"),
+ rectUpdate.GetLeft(),
+ rectUpdate.GetTop(),
+ rectUpdate.GetRight(),
+ rectUpdate.GetBottom());
+
+#if 0 //def WXDEBUG_SCROLLBAR
+ static bool s_refreshDebug = FALSE;
+ if ( s_refreshDebug )
+ {
+ wxClientDC dc(wxConstCast(scrollbar, wxScrollBar));
+ dc.SetBrush(*wxRED_BRUSH);
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rectUpdate);
+
+ // under Unix we use "--sync" X option for this
+ #ifdef __WXMSW__
+ ::GdiFlush();
+ ::Sleep(200);
+ #endif // __WXMSW__
+ }
+#endif // WXDEBUG_SCROLLBAR
+ }
+
+ wxOrientation orient = scrollbar->IsVertical() ? wxVERTICAL
+ : wxHORIZONTAL;
+
+ // the shaft
+ for ( int nBar = 0; nBar < 2; nBar++ )
+ {
+ wxScrollBar::Element elem =
+ (wxScrollBar::Element)(wxScrollBar::Element_Bar_1 + nBar);
+
+ wxRect rectBar = m_renderer->GetScrollbarRect(scrollbar, elem);
+
+ if ( rgnUpdate.Contains(rectBar) )
+ {
+ wxLogTrace(_T("scrollbar"),
+ _T("drawing bar part %d at (%d, %d)-(%d, %d)"),
+ nBar + 1,
+ rectBar.GetLeft(),
+ rectBar.GetTop(),
+ rectBar.GetRight(),
+ rectBar.GetBottom());
+
+ m_renderer->DrawScrollbarShaft(m_dc,
+ orient,
+ rectBar,
+ scrollbar->GetState(elem));
+ }
+ }
+
+ // arrows
+ for ( int nArrow = 0; nArrow < 2; nArrow++ )
+ {
+ wxScrollBar::Element elem =
+ (wxScrollBar::Element)(wxScrollBar::Element_Arrow_Line_1 + nArrow);
+
+ wxRect rectArrow = m_renderer->GetScrollbarRect(scrollbar, elem);
+ if ( rgnUpdate.Contains(rectArrow) )
+ {
+ wxLogTrace(_T("scrollbar"),
+ _T("drawing arrow %d at (%d, %d)-(%d, %d)"),
+ nArrow + 1,
+ rectArrow.GetLeft(),
+ rectArrow.GetTop(),
+ rectArrow.GetRight(),
+ rectArrow.GetBottom());
+
+ scrollbar->GetArrows().DrawArrow
+ (
+ (wxScrollArrows::Arrow)nArrow,
+ m_dc,
+ rectArrow,
+ TRUE // draw a scrollbar arrow, not just an arrow
+ );
+ }
+ }
+
+ // TODO: support for page arrows
+
+ // and the thumb
+ wxScrollBar::Element elem = wxScrollBar::Element_Thumb;
+ wxRect rectThumb = m_renderer->GetScrollbarRect(scrollbar, elem);
+ if ( rectThumb.width && rectThumb.height && rgnUpdate.Contains(rectThumb) )
+ {
+ wxLogTrace(_T("scrollbar"),
+ _T("drawing thumb at (%d, %d)-(%d, %d)"),
+ rectThumb.GetLeft(),
+ rectThumb.GetTop(),
+ rectThumb.GetRight(),
+ rectThumb.GetBottom());
+
+ m_renderer->DrawScrollbarThumb(m_dc,
+ orient,
+ rectThumb,
+ scrollbar->GetState(elem));
+ }
+}
+
+void wxControlRenderer::DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+{
+ wxASSERT_MSG( x1 == x2 || y1 == y2,
+ _T("line must be either horizontal or vertical") );
+
+ if ( x1 == x2 )
+ m_renderer->DrawVerticalLine(m_dc, x1, y1, y2);
+ else // horizontal
+ m_renderer->DrawHorizontalLine(m_dc, y1, x1, x2);
+}
+
+#if wxUSE_LISTBOX
+
+void wxControlRenderer::DrawItems(const wxListBox *lbox,
+ size_t itemFirst, size_t itemLast)
+{
+ DoDrawItems(lbox, itemFirst, itemLast);
+}
+
+void wxControlRenderer::DoDrawItems(const wxListBox *lbox,
+ size_t itemFirst, size_t itemLast,
+ bool isCheckLbox)
+{
+ // prepare for the drawing: calc the initial position
+ wxCoord lineHeight = lbox->GetLineHeight();
+
+ // note that SetClippingRegion() needs the physical (unscrolled)
+ // coordinates while we use the logical (scrolled) ones for the drawing
+ // itself
+ wxRect rect;
+ wxSize size = lbox->GetClientSize();
+ rect.width = size.x;
+ rect.height = size.y;
+
+ // keep the text inside the client rect or we will overwrite the vertical
+ // scrollbar for the long strings
+ m_dc.SetClippingRegion(rect.x, rect.y, rect.width + 1, rect.height + 1);
+
+ // adjust the rect position now
+ lbox->CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y);
+ rect.y += itemFirst*lineHeight;
+ rect.height = lineHeight;
+
+ // the rect should go to the right visible border so adjust the width if x
+ // is shifted (rightmost point should stay the same)
+ rect.width -= rect.x;
+
+ // we'll keep the text colour unchanged
+ m_dc.SetTextForeground(lbox->GetForegroundColour());
+
+ // an item should have the focused rect only when the lbox has focus, so
+ // make sure that we never set wxCONTROL_FOCUSED flag if it doesn't
+ int itemCurrent = wxWindow::FindFocus() == (wxWindow *)lbox // cast needed
+ ? lbox->GetCurrentItem()
+ : -1;
+ for ( size_t n = itemFirst; n < itemLast; n++ )
+ {
+ int flags = 0;
+ if ( (int)n == itemCurrent )
+ flags |= wxCONTROL_FOCUSED;
+ if ( lbox->IsSelected(n) )
+ flags |= wxCONTROL_SELECTED;
+
+#if wxUSE_CHECKLISTBOX
+ if ( isCheckLbox )
+ {
+ wxCheckListBox *checklstbox = wxStaticCast(lbox, wxCheckListBox);
+ if ( checklstbox->IsChecked(n) )
+ flags |= wxCONTROL_CHECKED;
+
+ m_renderer->DrawCheckItem(m_dc, lbox->GetString(n),
+ wxNullBitmap,
+ rect,
+ flags);
+ }
+ else
+#endif // wxUSE_CHECKLISTBOX
+ {
+ m_renderer->DrawItem(m_dc, lbox->GetString(n), rect, flags);
+ }
+
+ rect.y += lineHeight;
+ }
+}
+
+#endif // wxUSE_LISTBOX
+
+#if wxUSE_CHECKLISTBOX
+
+void wxControlRenderer::DrawCheckItems(const wxCheckListBox *lbox,
+ size_t itemFirst, size_t itemLast)
+{
+ DoDrawItems(lbox, itemFirst, itemLast, TRUE);
+}
+
+#endif // wxUSE_CHECKLISTBOX
+
+#if wxUSE_GAUGE
+
+void wxControlRenderer::DrawProgressBar(const wxGauge *gauge)
+{
+ // draw background
+ m_dc.SetBrush(wxBrush(m_window->GetBackgroundColour(), wxSOLID));
+ m_dc.SetPen(*wxTRANSPARENT_PEN);
+ m_dc.DrawRectangle(m_rect);
+
+ int max = gauge->GetRange();
+ if ( !max )
+ {
+ // nothing to draw
+ return;
+ }
+
+ // calc the filled rect
+ int pos = gauge->GetValue();
+ int left = max - pos;
+
+ wxRect rect = m_rect;
+ rect.Deflate(1); // FIXME this depends on the border width
+
+ m_dc.SetBrush(wxBrush(m_window->GetForegroundColour(), wxSOLID));
+
+ if ( gauge->IsSmooth() )
+ {
+ // just draw the rectangle in one go
+ if ( gauge->IsVertical() )
+ {
+ // vert bars grow from bottom to top
+ wxCoord dy = ((rect.height - 1) * left) / max;
+ rect.y += dy;
+ rect.height -= dy;
+ }
+ else // horizontal
+ {
+ // grow from left to right
+ rect.width -= ((rect.width - 1) * left) / max;
+ }
+
+ m_dc.DrawRectangle(rect);
+ }
+ else // discrete
+ {
+ wxSize sizeStep = m_renderer->GetProgressBarStep();
+ int step = gauge->IsVertical() ? sizeStep.y : sizeStep.x;
+
+ // we divide by it below!
+ wxCHECK_RET( step, _T("invalid wxGauge step") );
+
+ // round up to make the progress appear to start faster
+ int lenTotal = gauge->IsVertical() ? rect.height : rect.width;
+ int steps = ((lenTotal + step - 1) * pos) / (max * step);
+
+ // calc the coords of one small rect
+ wxCoord *px, dx, dy;
+ if ( gauge->IsVertical() )
+ {
+ // draw from bottom to top: so first set y to the bottom
+ rect.y += rect.height - 1;
+
+ // then adjust the height
+ rect.height = step;
+
+ // and then adjust y again to be what it should for the first rect
+ rect.y -= rect.height;
+
+ // we are going up
+ step = -step;
+
+ // remember that this will be the coord which will change
+ px = &rect.y;
+
+ dy = 1;
+ dx = 0;
+ }
+ else // horizontal
+ {
+ // don't leave 2 empty pixels in the beginning
+ rect.x--;
+
+ px = &rect.x;
+ rect.width = step;
+
+ dy = 0;
+ dx = 1;
+ }
+
+ for ( int n = 0; n < steps; n++ )
+ {
+ wxRect rectSegment = rect;
+ rectSegment.Deflate(dx, dy);
+
+ m_dc.DrawRectangle(rectSegment);
+
+ *px += step;
+ if ( *px < 1 )
+ {
+ // this can only happen for the last step of vertical gauge
+ rect.height = *px - step - 1;
+ *px = 1;
+ }
+ else if ( *px > lenTotal - step )
+ {
+ // this can only happen for the last step of horizontal gauge
+ rect.width = lenTotal - *px - 1;
+ }
+ }
+ }
+}
+
+#endif // wxUSE_GAUGE
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/univ/scrarrow.cpp
+// Purpose: wxScrollArrows class implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 22.01.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univscrarrow.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif
+
+#include "wx/univ/scrtimer.h"
+#include "wx/univ/scrarrow.h"
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ----------------------------------------------------------------------------
+// wxScrollArrowCaptureData: contains the data used while the arrow is being
+// pressed by the user
+// ----------------------------------------------------------------------------
+
+struct wxScrollArrowCaptureData
+{
+ wxScrollArrowCaptureData()
+ {
+ m_arrowPressed = wxScrollArrows::Arrow_None;
+ m_window = NULL;
+ m_btnCapture = -1;
+ m_timerScroll = NULL;
+ }
+
+ ~wxScrollArrowCaptureData()
+ {
+ if ( m_window )
+ m_window->ReleaseMouse();
+
+ delete m_timerScroll;
+ }
+
+ // the arrow being held pressed (may be Arrow_None)
+ wxScrollArrows::Arrow m_arrowPressed;
+
+ // the mouse button which started the capture (-1 if none)
+ int m_btnCapture;
+
+ // the window which has captured the mouse
+ wxWindow *m_window;
+
+ // the timer for generating the scroll events
+ wxScrollTimer *m_timerScroll;
+};
+
+// ----------------------------------------------------------------------------
+// wxScrollArrowTimer: a wxScrollTimer which calls OnArrow()
+// ----------------------------------------------------------------------------
+
+class wxScrollArrowTimer : public wxScrollTimer
+{
+public:
+ wxScrollArrowTimer(wxControlWithArrows *control,
+ wxScrollArrows::Arrow arrow)
+ {
+ m_control = control;
+ m_arrow = arrow;
+
+ StartAutoScroll();
+ }
+
+protected:
+ virtual bool DoNotify()
+ {
+ return m_control->OnArrow(m_arrow);
+ }
+
+ wxControlWithArrows *m_control;
+ wxScrollArrows::Arrow m_arrow;
+};
+
+// ============================================================================
+// implementation of wxScrollArrows
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// con/destruction
+// ----------------------------------------------------------------------------
+
+wxScrollArrows::wxScrollArrows(wxControlWithArrows *control)
+{
+ m_control = control;
+ m_captureData = NULL;
+}
+
+wxScrollArrows::~wxScrollArrows()
+{
+ // it should have been destroyed
+ wxASSERT_MSG( !m_captureData, _T("memory leak in wxScrollArrows") );
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+void wxScrollArrows::DrawArrow(Arrow arrow,
+ wxDC& dc,
+ const wxRect& rect,
+ bool scrollbarLike) const
+{
+ static const wxDirection arrowDirs[2][Arrow_Max] =
+ {
+ { wxLEFT, wxRIGHT },
+ { wxUP, wxDOWN }
+ };
+
+ void (wxRenderer::*pfn)(wxDC&, wxDirection, const wxRect&, int) =
+ scrollbarLike ? &wxRenderer::DrawScrollbarArrow
+ : &wxRenderer::DrawArrow;
+
+ (m_control->GetRenderer()->*pfn)
+ (
+ dc,
+ arrowDirs[m_control->IsVertical()][arrow],
+ rect,
+ m_control->GetArrowState(arrow)
+ );
+}
+
+// ----------------------------------------------------------------------------
+// input handling
+// ----------------------------------------------------------------------------
+
+void wxScrollArrows::UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const
+{
+ m_control->SetArrowFlag(arrow, wxCONTROL_CURRENT, arrow == arrowCur);
+}
+
+bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const
+{
+ Arrow arrow;
+ if ( event.Leaving() )
+ {
+ // no arrow has mouse if it left the window completely
+ arrow = Arrow_None;
+ }
+ else // Moving() or Entering(), treat them the same here
+ {
+ arrow = m_control->HitTest(event.GetPosition());
+ }
+
+ if ( m_captureData )
+ {
+ // the mouse is captured, we may want to pause scrolling if it goes
+ // outside the arrow or to resume it if we had paused it before
+ wxTimer *timer = m_captureData->m_timerScroll;
+ if ( !timer->IsRunning() )
+ {
+ // timer is paused
+ if ( arrow == m_captureData->m_arrowPressed )
+ {
+ // resume now
+ m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, TRUE);
+ timer->Start();
+
+ return TRUE;
+ }
+ }
+ else if ( 1 ) //FIXME: m_control->ShouldPauseScrolling() )
+ {
+ // we may want to stop it
+ if ( arrow != m_captureData->m_arrowPressed )
+ {
+ // stop as the mouse left the arrow
+ m_control->SetArrowFlag(m_captureData->m_arrowPressed,
+ wxCONTROL_PRESSED, FALSE);
+ timer->Stop();
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+ }
+
+ // reset the wxCONTROL_CURRENT flag for the arrows which don't have the
+ // mouse and set it for the one which has
+ UpdateCurrentFlag(Arrow_First, arrow);
+ UpdateCurrentFlag(Arrow_Second, arrow);
+
+ // return TRUE if it was really an event for an arrow
+ return !event.Leaving() && arrow != Arrow_None;
+}
+
+bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const
+{
+ int btn = event.GetButton();
+ if ( btn == -1 )
+ {
+ // we only care about button press/release events
+ return FALSE;
+ }
+
+ if ( event.ButtonDown() || event.ButtonDClick() )
+ {
+ if ( !m_captureData )
+ {
+ Arrow arrow = m_control->HitTest(event.GetPosition());
+ if ( arrow == Arrow_None )
+ {
+ // mouse pressed over something else
+ return FALSE;
+ }
+
+ if ( m_control->GetArrowState(arrow) & wxCONTROL_DISABLED )
+ {
+ // don't allow to press disabled arrows
+ return TRUE;
+ }
+
+ wxConstCast(this, wxScrollArrows)->m_captureData =
+ new wxScrollArrowCaptureData;
+ m_captureData->m_arrowPressed = arrow;
+ m_captureData->m_btnCapture = btn;
+ m_captureData->m_window = m_control->GetWindow();
+ m_captureData->m_window->CaptureMouse();
+
+ // start scrolling
+ m_captureData->m_timerScroll =
+ new wxScrollArrowTimer(m_control, arrow);
+
+ m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, TRUE);
+ }
+ //else: mouse already captured, nothing to do
+ }
+ // release mouse if the *same* button went up
+ else if ( m_captureData && (btn == m_captureData->m_btnCapture) )
+ {
+ Arrow arrow = m_captureData->m_arrowPressed;
+
+ delete m_captureData;
+ wxConstCast(this, wxScrollArrows)->m_captureData = NULL;
+
+ m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, FALSE);
+ }
+ else
+ {
+ // we don't process this
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/scrolbar.cpp
+// Purpose: wxScrollBar implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univscrolbar.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_SCROLLBAR
+
+#ifndef WX_PRECOMP
+ #include "wx/timer.h"
+
+ #include "wx/dcclient.h"
+ #include "wx/scrolbar.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/scrtimer.h"
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+#define WXDEBUG_SCROLLBAR
+
+#ifndef __WXDEBUG__
+ #undef WXDEBUG_SCROLLBAR
+#endif // !__WXDEBUG__
+
+// ----------------------------------------------------------------------------
+// wxScrollBarTimer: this class is used to repeatedly scroll the scrollbar
+// when the mouse is help pressed on the arrow or on the bar. It generates the
+// given scroll action command periodically.
+// ----------------------------------------------------------------------------
+
+class wxScrollBarTimer : public wxScrollTimer
+{
+public:
+ wxScrollBarTimer(wxStdScrollBarInputHandler *handler,
+ const wxControlAction& action,
+ wxScrollBar *control);
+
+protected:
+ virtual bool DoNotify();
+
+private:
+ wxStdScrollBarInputHandler *m_handler;
+ wxControlAction m_action;
+ wxScrollBar *m_control;
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
+
+BEGIN_EVENT_TABLE(wxScrollBar, wxScrollBarBase)
+ EVT_IDLE(wxScrollBar::OnIdle)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+#ifdef __VISUALC__
+ // warning C4355: 'this' : used in base member initializer list
+ #pragma warning(disable:4355) // so what? disable it...
+#endif
+
+wxScrollBar::wxScrollBar()
+ : m_arrows(this)
+{
+ Init();
+}
+
+wxScrollBar::wxScrollBar(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+ : m_arrows(this)
+{
+ Init();
+
+ (void)Create(parent, id, pos, size, style, validator, name);
+}
+
+#ifdef __VISUALC__
+ // warning C4355: 'this' : used in base member initializer list
+ #pragma warning(default:4355)
+#endif
+
+void wxScrollBar::Init()
+{
+ m_range =
+ m_thumbSize =
+ m_thumbPos =
+ m_pageSize = 0;
+
+ m_thumbPosOld = -1;
+
+ for ( size_t n = 0; n < WXSIZEOF(m_elementsState); n++ )
+ {
+ m_elementsState[n] = 0;
+ }
+
+ m_dirty = FALSE;
+}
+
+bool wxScrollBar::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ // the scrollbars never have the border
+ style &= ~wxBORDER_MASK;
+
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ SetBestSize(size);
+
+ // override the cursor of the target window (if any)
+ SetCursor(wxCURSOR_ARROW);
+
+ CreateInputHandler(wxINP_HANDLER_SCROLLBAR);
+
+ return TRUE;
+}
+
+wxScrollBar::~wxScrollBar()
+{
+}
+
+// ----------------------------------------------------------------------------
+// scrollbar API
+// ----------------------------------------------------------------------------
+
+void wxScrollBar::DoSetThumb(int pos)
+{
+ // don't assert hecks here, we're a private function which is meant to be
+ // called with any args at all
+ if ( pos < 0 )
+ {
+ pos = 0;
+ }
+ else if ( pos > m_range - m_thumbSize )
+ {
+ pos = m_range - m_thumbSize;
+ }
+
+ if ( m_thumbPos == pos )
+ {
+ // nothing changed, avoid refreshes which would provoke flicker
+ return;
+ }
+
+ if ( m_thumbPosOld == -1 )
+ {
+ // remember the old thumb position
+ m_thumbPosOld = m_thumbPos;
+ }
+
+ m_thumbPos = pos;
+
+ // we have to refresh the part of the bar which was under the thumb and the
+ // thumb itself
+ m_elementsState[Element_Thumb] |= wxCONTROL_DIRTY;
+ m_elementsState[m_thumbPos > m_thumbPosOld
+ ? Element_Bar_1 : Element_Bar_2] |= wxCONTROL_DIRTY;
+ m_dirty = TRUE;
+}
+
+int wxScrollBar::GetThumbPosition() const
+{
+ return m_thumbPos;
+}
+
+int wxScrollBar::GetThumbSize() const
+{
+ return m_thumbSize;
+}
+
+int wxScrollBar::GetPageSize() const
+{
+ return m_pageSize;
+}
+
+int wxScrollBar::GetRange() const
+{
+ return m_range;
+}
+
+void wxScrollBar::SetThumbPosition(int pos)
+{
+ wxCHECK_RET( pos >= 0 && pos <= m_range, _T("thumb position out of range") );
+
+ DoSetThumb(pos);
+}
+
+void wxScrollBar::SetScrollbar(int position, int thumbSize,
+ int range, int pageSize,
+ bool refresh)
+{
+ // we only refresh everythign when the range changes, thumb position
+ // changes are handled in OnIdle
+ bool needsRefresh = (range != m_range) ||
+ (thumbSize != m_thumbSize) ||
+ (pageSize != m_pageSize);
+
+ // set all parameters
+ m_range = range;
+ m_thumbSize = thumbSize;
+ SetThumbPosition(position);
+ m_pageSize = pageSize;
+
+ // ignore refresh parameter unless we really need to refresh everything -
+ // there ir a lot of existing code which just calls SetScrollbar() without
+ // specifying the last parameter even though it doesn't need at all to
+ // refresh the window immediately
+ if ( refresh && needsRefresh )
+ {
+ // and update the window
+ Refresh();
+ Update();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxScrollBar::DoGetBestClientSize() const
+{
+ // this dimension is completely arbitrary
+ static const wxCoord SIZE = 140;
+
+ wxSize size = m_renderer->GetScrollbarArrowSize();
+ if ( IsVertical() )
+ {
+ size.y = SIZE;
+ }
+ else // horizontal
+ {
+ size.x = SIZE;
+ }
+
+ return size;
+}
+
+wxScrollArrows::Arrow wxScrollBar::HitTest(const wxPoint& pt) const
+{
+ switch ( m_renderer->HitTestScrollbar(this, pt) )
+ {
+ case wxHT_SCROLLBAR_ARROW_LINE_1:
+ return wxScrollArrows::Arrow_First;
+
+ case wxHT_SCROLLBAR_ARROW_LINE_2:
+ return wxScrollArrows::Arrow_Second;
+
+ default:
+ return wxScrollArrows::Arrow_None;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+void wxScrollBar::OnIdle(wxIdleEvent& event)
+{
+ if ( m_dirty )
+ {
+ for ( size_t n = 0; n < WXSIZEOF(m_elementsState); n++ )
+ {
+ if ( m_elementsState[n] & wxCONTROL_DIRTY )
+ {
+ wxRect rect = GetRenderer()->GetScrollbarRect(this, (Element)n);
+
+ if ( rect.width && rect.height )
+ {
+ // we try to avoid redrawing the entire shaft (which might
+ // be quite long) if possible by only redrawing the area
+ // wich really changed
+ if ( (n == Element_Bar_1 || n == Element_Bar_2) &&
+ (m_thumbPosOld != -1) )
+ {
+ // the less efficient but more reliable (i.e. this will
+ // probably work everywhere) version: refresh the
+ // distance covered by thumb since the last update
+#if 0
+ wxRect rectOld =
+ GetRenderer()->GetScrollbarRect(this,
+ (Element)n,
+ m_thumbPosOld);
+ if ( IsVertical() )
+ {
+ if ( n == Element_Bar_1 )
+ rect.SetTop(rectOld.GetBottom());
+ else
+ rect.SetBottom(rectOld.GetBottom());
+ }
+ else // horizontal
+ {
+ if ( n == Element_Bar_1 )
+ rect.SetLeft(rectOld.GetRight());
+ else
+ rect.SetRight(rectOld.GetRight());
+ }
+#else // efficient version: only repaint the area occupied by
+ // the thumb previously - we can't do better than this
+ rect = GetRenderer()->GetScrollbarRect(this,
+ Element_Thumb,
+ m_thumbPosOld);
+#endif // 0/1
+ }
+
+#ifdef WXDEBUG_SCROLLBAR
+ static bool s_refreshDebug = FALSE;
+ if ( s_refreshDebug )
+ {
+ wxClientDC dc(this);
+ dc.SetBrush(*wxCYAN_BRUSH);
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rect);
+
+ // under Unix we use "--sync" X option for this
+ #ifdef __WXMSW__
+ ::GdiFlush();
+ ::Sleep(200);
+ #endif // __WXMSW__
+ }
+#endif // WXDEBUG_SCROLLBAR
+
+ Refresh(TRUE, &rect);
+ }
+
+ m_elementsState[n] &= ~wxCONTROL_DIRTY;
+ }
+ }
+
+ m_dirty = FALSE;
+ }
+
+ event.Skip();
+}
+
+void wxScrollBar::DoDraw(wxControlRenderer *renderer)
+{
+ renderer->DrawScrollbar(this, m_thumbPosOld);
+
+ // clear all dirty flags
+ m_dirty = FALSE;
+ m_thumbPosOld = -1;
+}
+
+// ----------------------------------------------------------------------------
+// state flags
+// ----------------------------------------------------------------------------
+
+static inline wxScrollBar::Element ElementForArrow(wxScrollArrows::Arrow arrow)
+{
+ return arrow == wxScrollArrows::Arrow_First
+ ? wxScrollBar::Element_Arrow_Line_1
+ : wxScrollBar::Element_Arrow_Line_2;
+}
+
+int wxScrollBar::GetArrowState(wxScrollArrows::Arrow arrow) const
+{
+ return GetState(ElementForArrow(arrow));
+}
+
+void wxScrollBar::SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set)
+{
+ Element which = ElementForArrow(arrow);
+ int state = GetState(which);
+ if ( set )
+ state |= flag;
+ else
+ state &= ~flag;
+
+ SetState(which, state);
+}
+
+int wxScrollBar::GetState(Element which) const
+{
+ // if the entire scrollbar is disabled, all of its elements are too
+ int flags = m_elementsState[which];
+ if ( !IsEnabled() )
+ flags |= wxCONTROL_DISABLED;
+
+ return flags;
+}
+
+void wxScrollBar::SetState(Element which, int flags)
+{
+ if ( (int)(m_elementsState[which] & ~wxCONTROL_DIRTY) != flags )
+ {
+ m_elementsState[which] = flags | wxCONTROL_DIRTY;
+
+ m_dirty = TRUE;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// input processing
+// ----------------------------------------------------------------------------
+
+bool wxScrollBar::OnArrow(wxScrollArrows::Arrow arrow)
+{
+ int oldThumbPos = GetThumbPosition();
+ PerformAction(arrow == wxScrollArrows::Arrow_First
+ ? wxACTION_SCROLL_LINE_UP
+ : wxACTION_SCROLL_LINE_DOWN);
+
+ // did we scroll till the end?
+ return GetThumbPosition() != oldThumbPos;
+}
+
+bool wxScrollBar::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ int thumbOld = m_thumbPos;
+
+ bool notify = FALSE; // send an event about the change?
+
+ wxEventType scrollType;
+
+ // test for thumb move first as these events happen in quick succession
+ if ( action == wxACTION_SCROLL_THUMB_MOVE )
+ {
+ DoSetThumb(numArg);
+
+ scrollType = wxEVT_SCROLLWIN_THUMBTRACK;
+ }
+ else if ( action == wxACTION_SCROLL_LINE_UP )
+ {
+ scrollType = wxEVT_SCROLLWIN_LINEUP;
+ ScrollLines(-1);
+ }
+ else if ( action == wxACTION_SCROLL_LINE_DOWN )
+ {
+ scrollType = wxEVT_SCROLLWIN_LINEDOWN;
+ ScrollLines(1);
+ }
+ else if ( action == wxACTION_SCROLL_PAGE_UP )
+ {
+ scrollType = wxEVT_SCROLLWIN_PAGEUP;
+ ScrollPages(-1);
+ }
+ else if ( action == wxACTION_SCROLL_PAGE_DOWN )
+ {
+ scrollType = wxEVT_SCROLLWIN_PAGEDOWN;
+ ScrollPages(1);
+ }
+ else if ( action == wxACTION_SCROLL_START )
+ {
+ scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
+ ScrollToStart();
+ }
+ else if ( action == wxACTION_SCROLL_END )
+ {
+ scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
+ ScrollToEnd();
+ }
+ else if ( action == wxACTION_SCROLL_THUMB_DRAG )
+ {
+ // we won't use it but this line suppresses the compiler
+ // warning about "variable may be used without having been
+ // initialized"
+ scrollType = wxEVT_NULL;
+ }
+ else if ( action == wxACTION_SCROLL_THUMB_RELEASE )
+ {
+ // always notify about this
+ notify = TRUE;
+ scrollType = wxEVT_SCROLLWIN_THUMBRELEASE;
+ }
+ else
+ return wxControl::PerformAction(action, numArg, strArg);
+
+ // has scrollbar position changed?
+ bool changed = m_thumbPos != thumbOld;
+ if ( notify || changed )
+ {
+ wxScrollWinEvent event(scrollType, m_thumbPos,
+ IsVertical() ? wxVERTICAL : wxHORIZONTAL);
+ event.SetEventObject(this);
+ GetParent()->GetEventHandler()->ProcessEvent(event);
+ }
+
+ return TRUE;
+}
+
+void wxScrollBar::ScrollToStart()
+{
+ DoSetThumb(0);
+}
+
+void wxScrollBar::ScrollToEnd()
+{
+ DoSetThumb(m_range - m_thumbSize);
+}
+
+void wxScrollBar::ScrollLines(int nLines)
+{
+ DoSetThumb(m_thumbPos + nLines);
+}
+
+void wxScrollBar::ScrollPages(int nPages)
+{
+ DoSetThumb(m_thumbPos + nPages*m_pageSize);
+}
+
+// ============================================================================
+// scroll bar input handler
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxScrollBarTimer
+// ----------------------------------------------------------------------------
+
+wxScrollBarTimer::wxScrollBarTimer(wxStdScrollBarInputHandler *handler,
+ const wxControlAction& action,
+ wxScrollBar *control)
+{
+ m_handler = handler;
+ m_action = action;
+ m_control = control;
+}
+
+bool wxScrollBarTimer::DoNotify()
+{
+ return m_handler->OnScrollTimer(m_control, m_action);
+}
+
+// ----------------------------------------------------------------------------
+// wxStdScrollBarInputHandler
+// ----------------------------------------------------------------------------
+
+wxStdScrollBarInputHandler::wxStdScrollBarInputHandler(wxRenderer *renderer,
+ wxInputHandler *handler)
+ : wxStdInputHandler(handler)
+{
+ m_renderer = renderer;
+ m_winCapture = NULL;
+ m_htLast = wxHT_NOWHERE;
+ m_timerScroll = NULL;
+}
+
+wxStdScrollBarInputHandler::~wxStdScrollBarInputHandler()
+{
+ // normally, it's NULL by now but just in case the user somehow managed to
+ // keep the mouse captured until now...
+ delete m_timerScroll;
+}
+
+void wxStdScrollBarInputHandler::SetElementState(wxScrollBar *control,
+ int flag,
+ bool doIt)
+{
+ if ( m_htLast > wxHT_SCROLLBAR_FIRST && m_htLast < wxHT_SCROLLBAR_LAST )
+ {
+ wxScrollBar::Element
+ elem = (wxScrollBar::Element)(m_htLast - wxHT_SCROLLBAR_FIRST - 1);
+
+ int flags = control->GetState(elem);
+ if ( doIt )
+ flags |= flag;
+ else
+ flags &= ~flag;
+ control->SetState(elem, flags);
+ }
+}
+
+bool wxStdScrollBarInputHandler::OnScrollTimer(wxScrollBar *scrollbar,
+ const wxControlAction& action)
+{
+ int oldThumbPos = scrollbar->GetThumbPosition();
+ scrollbar->PerformAction(action);
+ if ( scrollbar->GetThumbPosition() != oldThumbPos )
+ return TRUE;
+
+ // we scrolled till the end
+ m_timerScroll->Stop();
+
+ return FALSE;
+}
+
+void wxStdScrollBarInputHandler::StopScrolling(wxScrollBar *control)
+{
+ // return everything to the normal state
+ if ( m_winCapture )
+ {
+ m_winCapture->ReleaseMouse();
+ m_winCapture = NULL;
+ }
+
+ m_btnCapture = -1;
+
+ if ( m_timerScroll )
+ {
+ delete m_timerScroll;
+ m_timerScroll = NULL;
+ }
+
+ // unpress the arrow and highlight the current element
+ Press(control, FALSE);
+}
+
+wxCoord
+wxStdScrollBarInputHandler::GetMouseCoord(const wxScrollBar *scrollbar,
+ const wxMouseEvent& event) const
+{
+ wxPoint pt = event.GetPosition();
+ return scrollbar->GetWindowStyle() & wxVERTICAL ? pt.y : pt.x;
+}
+
+void wxStdScrollBarInputHandler::HandleThumbMove(wxScrollBar *scrollbar,
+ const wxMouseEvent& event)
+{
+ int thumbPos = GetMouseCoord(scrollbar, event) - m_ofsMouse;
+ thumbPos = m_renderer->PixelToScrollbar(scrollbar, thumbPos);
+ scrollbar->PerformAction(wxACTION_SCROLL_THUMB_MOVE, thumbPos);
+}
+
+bool wxStdScrollBarInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ // we only react to the key presses here
+ if ( pressed )
+ {
+ wxControlAction action;
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_DOWN:
+ case WXK_RIGHT: action = wxACTION_SCROLL_LINE_DOWN; break;
+ case WXK_UP:
+ case WXK_LEFT: action = wxACTION_SCROLL_LINE_UP; break;
+ case WXK_HOME: action = wxACTION_SCROLL_START; break;
+ case WXK_END: action = wxACTION_SCROLL_END; break;
+ case WXK_PRIOR: action = wxACTION_SCROLL_PAGE_UP; break;
+ case WXK_NEXT: action = wxACTION_SCROLL_PAGE_DOWN; break;
+ }
+
+ if ( !!action )
+ {
+ control->PerformAction(action);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdScrollBarInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ // is this a click event from an acceptable button?
+ int btn = event.GetButton();
+ if ( (btn != -1) && IsAllowedButton(btn) )
+ {
+ // determine which part of the window mouse is in
+ wxScrollBar *scrollbar = wxStaticCast(control, wxScrollBar);
+ wxHitTest ht = m_renderer->HitTestScrollbar
+ (
+ scrollbar,
+ event.GetPosition()
+ );
+
+ // when the mouse is pressed on any scrollbar element, we capture it
+ // and hold capture until the same mouse button is released
+ if ( event.ButtonDown() || event.ButtonDClick() )
+ {
+ if ( !m_winCapture )
+ {
+ m_btnCapture = btn;
+ m_winCapture = control;
+ m_winCapture->CaptureMouse();
+
+ // generate the command
+ bool hasAction = TRUE;
+ wxControlAction action;
+ switch ( ht )
+ {
+ case wxHT_SCROLLBAR_ARROW_LINE_1:
+ action = wxACTION_SCROLL_LINE_UP;
+ break;
+
+ case wxHT_SCROLLBAR_ARROW_LINE_2:
+ action = wxACTION_SCROLL_LINE_DOWN;
+ break;
+
+ case wxHT_SCROLLBAR_BAR_1:
+ action = wxACTION_SCROLL_PAGE_UP;
+ m_ptStartScrolling = event.GetPosition();
+ break;
+
+ case wxHT_SCROLLBAR_BAR_2:
+ action = wxACTION_SCROLL_PAGE_DOWN;
+ m_ptStartScrolling = event.GetPosition();
+ break;
+
+ case wxHT_SCROLLBAR_THUMB:
+ control->PerformAction(wxACTION_SCROLL_THUMB_DRAG);
+ m_ofsMouse = GetMouseCoord(scrollbar, event) -
+ m_renderer->ScrollbarToPixel(scrollbar);
+
+ // fall through: there is no immediate action
+
+ default:
+ hasAction = FALSE;
+ }
+
+ // remove highlighting
+ Highlight(scrollbar, FALSE);
+ m_htLast = ht;
+
+ // and press the arrow or highlight thumb now instead
+ if ( m_htLast == wxHT_SCROLLBAR_THUMB )
+ Highlight(scrollbar, TRUE);
+ else
+ Press(scrollbar, TRUE);
+
+ // start dragging
+ if ( hasAction )
+ {
+ m_timerScroll = new wxScrollBarTimer(this, action,
+ scrollbar);
+ m_timerScroll->StartAutoScroll();
+ }
+ //else: no (immediate) action
+
+ }
+ //else: mouse already captured, nothing to do
+ }
+ // release mouse if the *same* button went up
+ else if ( btn == m_btnCapture )
+ {
+ if ( m_winCapture )
+ {
+ StopScrolling(scrollbar);
+
+ // if we were dragging the thumb, send the last event
+ if ( m_htLast == wxHT_SCROLLBAR_THUMB )
+ {
+ scrollbar->PerformAction(wxACTION_SCROLL_THUMB_RELEASE);
+ }
+
+ m_htLast = ht;
+ Highlight(scrollbar, TRUE);
+ }
+ else
+ {
+ // this is not supposed to happen as the button can't go up
+ // without going down previously and then we'd have
+ // m_winCapture by now
+ wxFAIL_MSG( _T("logic error in mouse capturing code") );
+ }
+ }
+ }
+
+ return wxStdInputHandler::HandleMouse(control, event);
+}
+
+bool wxStdScrollBarInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ wxScrollBar *scrollbar = wxStaticCast(control, wxScrollBar);
+
+ if ( m_winCapture )
+ {
+ if ( (m_htLast == wxHT_SCROLLBAR_THUMB) && event.Moving() )
+ {
+ // make the thumb follow the mouse by keeping the same offset
+ // between the mouse position and the top/left of the thumb
+ HandleThumbMove(scrollbar, event);
+
+ return TRUE;
+ }
+
+ // no other changes are possible while the mouse is captured
+ return FALSE;
+ }
+
+ bool isArrow = scrollbar->GetArrows().HandleMouseMove(event);
+
+ if ( event.Moving() )
+ {
+ wxHitTest ht = m_renderer->HitTestScrollbar
+ (
+ scrollbar,
+ event.GetPosition()
+ );
+ if ( ht == m_htLast )
+ {
+ // nothing changed
+ return FALSE;
+ }
+
+#ifdef DEBUG_MOUSE
+ wxLogDebug("Scrollbar::OnMouseMove: ht = %d", ht);
+#endif // DEBUG_MOUSE
+
+ Highlight(scrollbar, FALSE);
+ m_htLast = ht;
+
+ if ( !isArrow )
+ Highlight(scrollbar, TRUE);
+ //else: already done by wxScrollArrows::HandleMouseMove
+ }
+ else if ( event.Leaving() )
+ {
+ if ( !isArrow )
+ Highlight(scrollbar, FALSE);
+
+ m_htLast = wxHT_NOWHERE;
+ }
+ else // event.Entering()
+ {
+ // we don't process this event
+ return FALSE;
+ }
+
+ // we did something
+ return TRUE;
+}
+
+#endif // wxUSE_SCROLLBAR
+
+// ----------------------------------------------------------------------------
+// wxScrollTimer
+// ----------------------------------------------------------------------------
+
+wxScrollTimer::wxScrollTimer()
+{
+ m_skipNext = FALSE;
+}
+
+void wxScrollTimer::StartAutoScroll()
+{
+ // start scrolling immediately
+ if ( !DoNotify() )
+ {
+ // ... and end it too
+ return;
+ }
+
+ // there is an initial delay before the scrollbar starts scrolling -
+ // implement it by ignoring the first timer expiration and only start
+ // scrolling from the second one
+ m_skipNext = TRUE;
+ Start(200); // FIXME: hardcoded delay
+}
+
+void wxScrollTimer::Notify()
+{
+ if ( m_skipNext )
+ {
+ // scroll normally now - reduce the delay
+ Stop();
+ Start(50); // FIXME: hardcoded delay
+
+ m_skipNext = FALSE;
+ }
+ else
+ {
+ // if DoNotify() returns false, we're already deleted by the timer
+ // event handler, so don't do anything else here
+ (void)DoNotify();
+ }
+}
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/scrthumb.cpp
+// Purpose: wxScrollThumb and related classes
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 13.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univscrthumb.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/window.h"
+#endif // WX_PRECOMP
+
+#include "wx/univ/scrtimer.h"
+#include "wx/univ/scrthumb.h"
+
+// ----------------------------------------------------------------------------
+// wxScrollThumbCaptureData: the struct used while dragging the scroll thumb
+// ----------------------------------------------------------------------------
+
+struct WXDLLEXPORT wxScrollThumbCaptureData
+{
+ // start mouse capture after the user clicked the mouse button btn on this
+ // part of the control
+ wxScrollThumbCaptureData(wxScrollThumb::Shaft part,
+ int btn,
+ wxControlWithThumb *control)
+ {
+ m_shaftPart = part;
+ m_btnCapture = btn;
+ m_timerScroll = NULL;
+
+ m_window = control->GetWindow();
+ m_window->CaptureMouse();
+ }
+
+ // release mouse
+ ~wxScrollThumbCaptureData()
+ {
+ if ( m_window )
+ {
+ m_window->ReleaseMouse();
+ }
+
+ delete m_timerScroll;
+ }
+
+ // the thumb part being held pressed
+ wxScrollThumb::Shaft m_shaftPart;
+
+ // the mouse button which started the capture (-1 if none)
+ int m_btnCapture;
+
+ // the window which has captured the mouse
+ wxWindow *m_window;
+
+ // the offset between the mouse position and the start of the thumb which
+ // is kept constant while dragging the thumb
+ wxCoord m_ofsMouse;
+
+ // the timer for generating the scroll events when scrolling by page
+ wxScrollTimer *m_timerScroll;
+};
+
+// ----------------------------------------------------------------------------
+// wxScrollTimer: the timer used when the arrow is kept pressed
+// ----------------------------------------------------------------------------
+
+class wxScrollThumbTimer : public wxScrollTimer
+{
+public:
+ wxScrollThumbTimer(wxControlWithThumb *control,
+ wxScrollThumb::Shaft shaftPart)
+ {
+ m_control = control;
+ switch ( shaftPart )
+ {
+ case wxScrollThumb::Shaft_Above:
+ m_inc = -1;
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unexpected shaft part in wxScrollThumbTimer"));
+ // fall through
+
+ case wxScrollThumb::Shaft_Below:
+ m_inc = 1;
+ break;
+ }
+
+ m_control->OnPageScrollStart();
+
+ StartAutoScroll();
+ }
+
+protected:
+ virtual bool DoNotify()
+ {
+ return m_control->OnPageScroll(m_inc);
+ }
+
+ wxControlWithThumb *m_control;
+ int m_inc;
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxScrollThumb constructor and dtor
+// ----------------------------------------------------------------------------
+
+wxScrollThumb::wxScrollThumb(wxControlWithThumb *control)
+{
+ m_shaftPart = Shaft_None;
+ m_control = control;
+ m_captureData = NULL;
+}
+
+wxScrollThumb::~wxScrollThumb()
+{
+ // it should have been destroyed
+ wxASSERT_MSG( !m_captureData, _T("memory leak in wxScrollThumb") );
+}
+
+// ----------------------------------------------------------------------------
+// wxScrollThumb mouse handling
+// ----------------------------------------------------------------------------
+
+bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const
+{
+ // is this a click event?
+ int btn = event.GetButton();
+ if ( btn == -1 )
+ {
+ // no...
+ return FALSE;
+ }
+
+ // when the mouse is pressed on any scrollbar element, we capture it
+ // and hold capture until the same mouse button is released
+ if ( event.ButtonDown() || event.ButtonDClick() )
+ {
+ if ( HasCapture() )
+ {
+ // mouse already captured, nothing to do
+ return FALSE;
+ }
+
+ // determine which part of the window the user clicked in
+ Shaft shaftPart = m_control->HitTest(event.GetPosition());
+
+ if ( shaftPart == Shaft_None )
+ {
+ // mouse pressed over something else
+ return FALSE;
+ }
+
+ // capture the mouse
+ wxConstCast(this, wxScrollThumb)->m_captureData =
+ new wxScrollThumbCaptureData(shaftPart, btn, m_control);
+
+ // modify the visual appearance before sending the event which will
+ // cause a redraw
+ m_control->SetShaftPartState(shaftPart, wxCONTROL_PRESSED);
+
+ if ( shaftPart == Shaft_Thumb )
+ {
+ // save the mouse offset from the thumb position - we will keep it
+ // constant while dragging the thumb
+ m_captureData->m_ofsMouse =
+ GetMouseCoord(event) - m_control->ThumbPosToPixel();
+
+ // generate an additional event if we start dragging the thumb
+ m_control->OnThumbDragStart(GetThumbPos(event));
+ }
+ else // not the thumb
+ {
+ // start timer for auto scrolling when the user presses the mouse
+ // in the shaft above or below the thumb
+ m_captureData->m_timerScroll =
+ new wxScrollThumbTimer(m_control, shaftPart);
+ }
+ }
+ // release mouse if the *same* button went up
+ else if ( HasCapture() && (btn == m_captureData->m_btnCapture) )
+ {
+ Shaft shaftPart = m_captureData->m_shaftPart;
+
+ // if we were dragging the thumb, send the one last event
+ if ( shaftPart == Shaft_Thumb )
+ {
+ m_control->OnThumbDragEnd(GetThumbPos(event));
+ }
+
+ // release the mouse and free capture data
+ delete m_captureData;
+ wxConstCast(this, wxScrollThumb)->m_captureData = NULL;
+
+ m_control->SetShaftPartState(shaftPart, wxCONTROL_PRESSED, FALSE);
+ }
+ else // another mouse button released
+ {
+ // we don't process this
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+bool wxScrollThumb::HandleMouseMove(const wxMouseEvent& event) const
+{
+ if ( HasCapture() )
+ {
+ if ( (m_captureData->m_shaftPart == Shaft_Thumb) && event.Moving() )
+ {
+ // make the thumb follow the mouse by keeping the same offset
+ // between the mouse position and the top/left of the thumb
+ m_control->OnThumbDrag(GetThumbPos(event));
+ }
+
+ // we process all mouse events while the mouse is captured by us
+ return TRUE;
+ }
+ else // no capture
+ {
+ Shaft shaftPart;
+ if ( event.Leaving() )
+ {
+ // no part of the shaft has mouse if it left the window completely
+ shaftPart = Shaft_None;
+ }
+ else // Moving() or Entering(), treat them the same here
+ {
+ shaftPart = m_control->HitTest(event.GetPosition());
+ }
+
+ if ( shaftPart != m_shaftPart )
+ {
+ // update the highlighted state
+ m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, FALSE);
+ wxConstCast(this, wxScrollThumb)->m_shaftPart = shaftPart;
+ m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, TRUE);
+ }
+
+ // if the event happened on the shaft, it was for us and we processed
+ // it
+ return shaftPart != Shaft_None;
+ }
+}
+
+wxCoord wxScrollThumb::GetMouseCoord(const wxMouseEvent& event) const
+{
+ wxPoint pt = event.GetPosition();
+ return m_control->IsVertical() ? pt.y : pt.x;
+}
+
+int wxScrollThumb::GetThumbPos(const wxMouseEvent& event) const
+{
+ wxCHECK_MSG( m_captureData && m_captureData->m_shaftPart == Shaft_Thumb, 0,
+ _T("can't be called when thumb is not dragged") );
+
+ int x = GetMouseCoord(event) - m_captureData->m_ofsMouse;
+ return m_control->PixelToThumbPos(x);
+}
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/slider.cpp
+// Purpose: implementation of the universal version of wxSlider
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 09.02.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ There is some discrepancy in wxSL_LABELS style handling between wxMSW and
+ wxGTK: the latter handles it natively and shows only the current value of
+ the slider on the side corresponding to wxSL_TOP/BOTTOM/LEFT/RIGHT style
+ given (which can be combined with wxSL_HORIZONTAL/VERTICAL) while wxMSW
+ emulates this somehow and shows the min and max values near the ends of the
+ slider and the current value in a separate static box nearby.
+
+ We currently follow wxGTK except that wxSL_HORIZONTAL slider can only have
+ the label displayed on top or bottom of it and wxSL_VERTICAL - to the left
+ or right.
+
+ What we really need is probably a more fine grain control on labels, i.e. we
+ should be able to select if we show nothign at all, the current value only
+ or the value and the limits - the current approach is just that of the
+ greatest common denominator.
+
+ TODO:
+
+ +0. add ticks support
+ 1. support for all orientations
+ 2. draw the slider thumb highlighted when it is dragged
+ ?3. manual ticks support?
+ */
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univslider.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/dc.h"
+#endif
+
+#include "wx/slider.h"
+
+#if wxUSE_SLIDER
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// the margin between the slider and the label (FIXME: hardcoded)
+static const wxCoord SLIDER_LABEL_MARGIN = 2;
+
+// ============================================================================
+// implementation of wxSlider
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
+
+BEGIN_EVENT_TABLE(wxSlider, wxControl)
+ EVT_SIZE(wxSlider::OnSize)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// wxSlider creation
+// ----------------------------------------------------------------------------
+
+#ifdef __VISUALC__
+ // warning C4355: 'this' : used in base member initializer list
+ #pragma warning(disable:4355)
+#endif
+
+wxSlider::wxSlider()
+ : m_thumb(this)
+{
+ Init();
+}
+
+wxSlider::wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+ : m_thumb(this)
+{
+ Init();
+
+ (void)Create(parent, id, value, minValue, maxValue,
+ pos, size, style, validator, name);
+}
+
+#ifdef __VISUALC__
+ // warning C4355: 'this' : used in base member initializer list
+ #pragma warning(default:4355)
+#endif
+
+void wxSlider::Init()
+{
+ m_min =
+ m_max =
+ m_value = 0;
+
+ m_tickFreq = 1;
+
+ m_lineSize =
+ m_pageSize = 0;
+
+ m_thumbSize = 0;
+ m_thumbFlags = 0;
+}
+
+bool wxSlider::Create(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ if ( !wxSliderBase::Create(parent, id, pos, size, style,
+ validator, name) )
+ return FALSE;
+
+ SetRange(minValue, maxValue);
+ SetValue(value);
+
+ // call this after setting the range as the best size depends (at least if
+ // we have wxSL_LABELS style) on the range
+ SetBestSize(size);
+
+ CreateInputHandler(wxINP_HANDLER_SLIDER);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider range and value
+// ----------------------------------------------------------------------------
+
+int wxSlider::GetValue() const
+{
+ return m_value;
+}
+
+int wxSlider::NormalizeValue(int value) const
+{
+ if ( value < m_min )
+ return m_min;
+ else if ( value > m_max )
+ return m_max;
+ else
+ return value;
+}
+
+bool wxSlider::ChangeValueBy(int inc)
+{
+ return ChangeValueTo(NormalizeValue(m_value + inc));
+}
+
+bool wxSlider::ChangeValueTo(int value)
+{
+ // this method is protected and we should only call it with normalized
+ // value!
+ wxCHECK_MSG( IsInRange(value), FALSE, _T("invalid slider value") );
+
+ // check if the value is going to change at all
+ if ( value == m_value )
+ return FALSE;
+
+ // refresh the old thumb position
+ RefreshThumb();
+
+ m_value = value;
+
+ // and the new one
+ RefreshThumb();
+
+ // generate the event
+ wxCommandEvent event(wxEVT_COMMAND_SLIDER_UPDATED, GetId());
+ event.SetInt(m_value);
+ event.SetEventObject(this);
+
+ (void)GetEventHandler()->ProcessEvent(event);
+
+ return TRUE;
+}
+
+void wxSlider::SetValue(int value)
+{
+ value = NormalizeValue(value);
+
+ if ( m_value != value )
+ {
+ m_value = value;
+
+ Refresh();
+ }
+}
+
+void wxSlider::SetRange(int minValue, int maxValue)
+{
+ if ( minValue > maxValue )
+ {
+ // swap them, we always want min to be less than max
+ int tmp = minValue;
+ minValue = maxValue;
+ maxValue = tmp;
+ }
+
+ if ( m_min != minValue || m_max != maxValue )
+ {
+ m_min = minValue;
+ m_max = maxValue;
+
+ // reset the value to make sure it is in the new range
+ SetValue(m_value);
+
+ // the size of the label rect might have changed
+ if ( HasLabels() )
+ {
+ CalcGeometry();
+ }
+
+ Refresh();
+ }
+ //else: nothing changed
+}
+
+int wxSlider::GetMin() const
+{
+ return m_min;
+}
+
+int wxSlider::GetMax() const
+{
+ return m_max;
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider line/page/thumb size
+// ----------------------------------------------------------------------------
+
+void wxSlider::SetLineSize(int lineSize)
+{
+ wxCHECK_RET( lineSize > 0, _T("invalid slider line size") );
+
+ m_lineSize = lineSize;
+}
+
+void wxSlider::SetPageSize(int pageSize)
+{
+ wxCHECK_RET( pageSize > 0, _T("invalid slider page size") );
+
+ m_pageSize = pageSize;
+}
+
+int wxSlider::GetLineSize() const
+{
+ if ( !m_lineSize )
+ {
+ // the default line increment is 1
+ wxConstCast(this, wxSlider)->m_lineSize = 1;
+ }
+
+ return m_lineSize;
+}
+
+int wxSlider::GetPageSize() const
+{
+ if ( !m_pageSize )
+ {
+ // the default page increment is 1/10 of the range
+ wxConstCast(this, wxSlider)->m_pageSize = (m_max - m_min) / 10;
+ }
+
+ return m_pageSize;
+}
+
+void wxSlider::SetThumbLength(int lenPixels)
+{
+ wxCHECK_RET( lenPixels > 0, _T("invalid slider thumb size") );
+
+ // use m_thumbSize here directly and not GetThumbLength() to avoid setting
+ // it to the default value as we don't need it
+ if ( lenPixels != m_thumbSize )
+ {
+ m_thumbSize = lenPixels;
+
+ Refresh();
+ }
+}
+
+int wxSlider::GetThumbLength() const
+{
+ if ( !m_thumbSize )
+ {
+ wxSize sz = GetDefaultThumbSize();
+ return IsVert() ? sz.y : sz.x;
+ }
+
+ return m_thumbSize;
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider ticks
+// ----------------------------------------------------------------------------
+
+void wxSlider::SetTickFreq(int n, int WXUNUSED(dummy))
+{
+ if ( n != m_tickFreq )
+ {
+ m_tickFreq = n;
+
+ Refresh();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxSlider::CalcLabelSize() const
+{
+ wxSize size;
+
+ // there is no sense in trying to calc the labels size if we haven't got
+ // any, the caller must check for it
+ wxCHECK_MSG( HasLabels(), size, _T("shouldn't be called") );
+
+ wxCoord w1, h1, w2, h2;
+ GetTextExtent(FormatValue(m_min), &w1, &h1);
+ GetTextExtent(FormatValue(m_max), &w2, &h2);
+
+ size.x = wxMax(w1, w2);
+ size.y = wxMax(h1, h2);
+
+ return size;
+}
+
+wxSize wxSlider::DoGetBestClientSize() const
+{
+ // this dimension is completely arbitrary
+ static const wxCoord SLIDER_WIDTH = 100;
+
+ // first calculate the size of the slider itself: i.e. the shaft and the
+ // thumb
+ wxCoord height = GetRenderer()->GetSliderDim();
+
+ wxSize size;
+ if ( IsVert() )
+ {
+ size.x = height;
+ size.y = SLIDER_WIDTH;
+ }
+ else // horizontal
+ {
+ size.x = SLIDER_WIDTH;
+ size.y = height;
+ }
+
+ // add space for ticks
+ if ( HasTicks() )
+ {
+ wxCoord lenTick = GetRenderer()->GetSliderTickLen();
+
+ if ( IsVert() )
+ size.x += lenTick;
+ else
+ size.y += lenTick;
+ }
+
+ // if we have the label, reserve enough space for it
+ if ( HasLabels() )
+ {
+ wxSize sizeLabels = CalcLabelSize();
+
+ if ( IsVert() )
+ size.x += sizeLabels.x + SLIDER_LABEL_MARGIN;
+ else
+ size.y += sizeLabels.y + SLIDER_LABEL_MARGIN;
+ }
+
+ return size;
+}
+
+void wxSlider::OnSize(wxSizeEvent& event)
+{
+ CalcGeometry();
+
+ event.Skip();
+}
+
+const wxRect& wxSlider::GetSliderRect() const
+{
+ if ( m_rectSlider.width < 0 )
+ {
+ wxConstCast(this, wxSlider)->CalcGeometry();
+ }
+
+ return m_rectSlider;
+}
+
+void wxSlider::CalcGeometry()
+{
+ /*
+ recalc the label and slider positions, this looks like this for
+ wxSL_HORIZONTAL | wxSL_TOP slider:
+
+ LLL lll
+ -------------------------
+ | T | <-- this is the slider rect
+ | HHHHHHHHHHHHHHHTHHHHH |
+ | T |
+ | * * * * * * * *|
+ -------------------------
+
+ LLL is m_rectLabel as calculated here and lll is the real rect used for
+ label drawing in OnDraw() (TTT indicated the thumb position and *s are
+ the ticks)
+
+ in the wxSL_VERTICAL | wxSL_RIGHT case the picture is like this:
+
+ ------ LLL
+ | H |
+ | H *|
+ | H |
+ | H *|
+ | H |
+ | H *|
+ | H |
+ |TTT*| lll
+ | H |
+ | H *|
+ ------
+ */
+
+ wxRect rectTotal = GetClientRect();
+ if ( HasLabels() )
+ {
+ wxSize sizeLabels = CalcLabelSize();
+
+ m_rectSlider = rectTotal;
+ m_rectLabel = wxRect(rectTotal.GetPosition(), sizeLabels);
+
+ // split the rect
+ if ( IsVert() )
+ {
+ sizeLabels.x += SLIDER_LABEL_MARGIN;
+
+ if ( GetWindowStyle() & wxSL_LEFT )
+ {
+ // shrink and offset the slider to the right
+ m_rectSlider.x += sizeLabels.x;
+ m_rectSlider.width -= sizeLabels.x;
+ }
+ else // wxSL_RIGHT
+ {
+ // just shrink the slider and move the label to the right
+ m_rectSlider.width -= sizeLabels.x;
+
+ m_rectLabel.x += m_rectSlider.width + SLIDER_LABEL_MARGIN;
+ }
+ }
+ else // horizontal
+ {
+ // same logic as above but x/y are trasnposed
+ sizeLabels.y += SLIDER_LABEL_MARGIN;
+
+ if ( GetWindowStyle() & wxSL_TOP )
+ {
+ m_rectSlider.y += sizeLabels.y;
+ m_rectSlider.height -= sizeLabels.y;
+ }
+ else // wxSL_BOTTOM
+ {
+ m_rectSlider.height -= sizeLabels.y;
+
+ m_rectLabel.y += m_rectSlider.height + SLIDER_LABEL_MARGIN;
+ }
+ }
+ }
+ else // no labels
+ {
+ // the slider takes the whole client rect
+ m_rectSlider = rectTotal;
+ }
+
+ // now adjust for ticks too
+ if ( HasTicks() )
+ {
+ wxCoord lenTick = GetRenderer()->GetSliderTickLen();
+
+ if ( IsVert() )
+ {
+ m_rectSlider.width -= lenTick;
+ }
+ else // horizontal
+ {
+ m_rectSlider.height -= lenTick;
+ }
+
+ // note that we must compute m_rectSlider first as GetShaftRect() uses
+ // it
+ m_rectTicks = GetShaftRect();
+
+ if ( IsVert() )
+ {
+ m_rectTicks.x = m_rectSlider.x + m_rectSlider.width;
+ m_rectTicks.width = lenTick;
+ }
+ else // horizontal
+ {
+ m_rectTicks.y = m_rectSlider.y + m_rectSlider.height;
+ m_rectTicks.height = lenTick;
+ }
+
+ }
+}
+
+wxSize wxSlider::GetDefaultThumbSize() const
+{
+ return GetRenderer()->GetSliderThumbSize(GetSliderRect(), GetOrientation());
+}
+
+wxSize wxSlider::GetThumbSize() const
+{
+ wxSize sizeThumb = GetDefaultThumbSize();
+
+ // if we have our own thumb length (set by the user), use it instead of the
+ // default value
+ if ( m_thumbSize )
+ {
+ if ( IsVert() )
+ sizeThumb.y = m_thumbSize;
+ else
+ sizeThumb.x = m_thumbSize;
+ }
+
+ return sizeThumb;
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider thumb geometry
+// ----------------------------------------------------------------------------
+
+wxRect wxSlider::GetShaftRect() const
+{
+ return GetRenderer()->GetSliderShaftRect(m_rectSlider, GetOrientation());
+}
+
+void wxSlider::CalcThumbRect(const wxRect *rectShaftIn,
+ wxRect *rectThumbOut,
+ wxRect *rectLabelOut,
+ int value) const
+{
+ if ( value == INVALID_THUMB_VALUE )
+ {
+ // use the current if not specified
+ value = m_value;
+ }
+
+ bool isVertical = IsVert();
+
+ wxRect rectShaft;
+ if ( rectShaftIn )
+ {
+ rectShaft = *rectShaftIn;
+ }
+ else // no shaft rect provided, calc it
+ {
+ rectShaft = GetShaftRect();
+ }
+
+ wxCoord lenShaft,
+ lenThumb,
+ *p;
+ wxRect rectThumb(rectShaft.GetPosition(), GetThumbSize());
+ if ( isVertical )
+ {
+ rectThumb.x += (rectShaft.width - rectThumb.width) / 2;
+
+ lenThumb = rectThumb.height;
+ lenShaft = rectShaft.height;
+ p = &rectThumb.y;
+ }
+ else // horz
+ {
+ rectThumb.y += (rectShaft.height - rectThumb.height) / 2;
+
+ lenThumb = rectThumb.width;
+ lenShaft = rectShaft.width;
+ p = &rectThumb.x;
+ }
+
+ // the thumb must always be entirely inside the shaft limits, so the max
+ // position is not at lenShaft but at lenShaft - thumbSize
+ if ( m_max != m_min )
+ {
+ *p += ((lenShaft - lenThumb)*(value - m_min))/(m_max - m_min);
+ }
+
+ // calc the label rect
+ if ( HasLabels() && rectLabelOut )
+ {
+ wxRect rectLabel = m_rectLabel;
+
+ // centre the label relatively to the thumb position
+ if ( isVertical )
+ {
+ rectLabel.y =
+ rectThumb.y + (rectThumb.height - m_rectLabel.height)/2;
+ }
+ else // horz
+ {
+ rectLabel.x =
+ rectThumb.x + (rectThumb.width - m_rectLabel.width)/2;
+ }
+
+ *rectLabelOut = rectLabel;
+ }
+
+ if ( rectThumbOut )
+ *rectThumbOut = rectThumb;
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider drawing
+// ----------------------------------------------------------------------------
+
+wxString wxSlider::FormatValue(int value) const
+{
+ return wxString::Format(_T("%d"), value);
+}
+
+void wxSlider::DoDraw(wxControlRenderer *renderer)
+{
+ wxRenderer *rend = GetRenderer();
+ wxDC& dc = renderer->GetDC();
+ wxRect rectUpdate = GetUpdateClientRect();
+
+ bool isVertical = IsVert();
+ wxOrientation orient = GetOrientation();
+ int flags = GetStateFlags();
+
+ // first draw the shaft
+ wxRect rectShaft = rend->GetSliderShaftRect(m_rectSlider, orient);
+ if ( rectUpdate.Intersects(rectShaft) )
+ {
+ rend->DrawSliderShaft(dc, m_rectSlider, orient, flags);
+ }
+
+ // calculate the thumb position in pixels and draw it
+ wxRect rectThumb, rectLabel;
+ CalcThumbRect(&rectShaft, &rectThumb, &rectLabel);
+
+ if ( rectUpdate.Intersects(rectThumb) )
+ {
+ rend->DrawSliderThumb(dc, rectThumb, orient, flags | m_thumbFlags);
+ }
+
+ // then draw the ticks
+ if ( HasTicks() && rectUpdate.Intersects(m_rectTicks) )
+ {
+ rend->DrawSliderTicks(dc, m_rectTicks, rectThumb.GetSize(), orient,
+ m_min, m_max, m_tickFreq);
+ }
+
+ // finally, draw the label near the thumb
+ if ( HasLabels() && rectUpdate.Intersects(rectLabel) )
+ {
+ // align it to be close to the shaft
+ int align;
+ if ( isVertical )
+ {
+ align = wxALIGN_CENTRE_VERTICAL |
+ (GetWindowStyle() & wxSL_RIGHT ? wxALIGN_LEFT
+ : wxALIGN_RIGHT);
+ }
+ else // horz
+ {
+ align = wxALIGN_CENTRE;
+ }
+
+ dc.SetFont(GetFont());
+ dc.SetTextForeground(GetForegroundColour());
+
+ // the slider label is never drawn focused
+ rend->DrawLabel(dc, FormatValue(m_value), rectLabel,
+ flags & ~wxCONTROL_FOCUSED, align);
+ }
+}
+
+void wxSlider::RefreshThumb()
+{
+ wxRect rectThumb, rectLabel;
+ CalcThumbRect(NULL, &rectThumb, &rectLabel);
+
+ Refresh(TRUE /* erase background */, &rectThumb);
+ if ( HasLabels() )
+ {
+ Refresh(TRUE, &rectLabel);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider input processing
+// ----------------------------------------------------------------------------
+
+bool wxSlider::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ if ( action == wxACTION_SLIDER_START )
+ {
+ ChangeValueTo(m_min);
+ }
+ else if ( action == wxACTION_SLIDER_END )
+ {
+ ChangeValueTo(m_max);
+ }
+ else if ( action == wxACTION_SLIDER_PAGE_CHANGE )
+ {
+ ChangeValueBy(numArg * GetPageSize());
+ }
+ else if ( action == wxACTION_SLIDER_LINE_UP )
+ {
+ ChangeValueBy(-GetLineSize());
+ }
+ else if ( action == wxACTION_SLIDER_PAGE_UP )
+ {
+ return PerformAction(wxACTION_SLIDER_PAGE_CHANGE, -1);
+ }
+ else if ( action == wxACTION_SLIDER_LINE_DOWN )
+ {
+ ChangeValueBy(GetLineSize());
+ }
+ else if ( action == wxACTION_SLIDER_PAGE_DOWN )
+ {
+ return PerformAction(wxACTION_SLIDER_PAGE_CHANGE, 1);
+ }
+ else if ( action == wxACTION_SLIDER_THUMB_DRAG )
+ {
+ // no special processing for it
+ return TRUE;
+ }
+ else if ( action == wxACTION_SLIDER_THUMB_MOVE ||
+ action == wxACTION_SLIDER_THUMB_RELEASE )
+ {
+ ChangeValueTo((int)numArg);
+ }
+ else
+ {
+ return wxControl::PerformAction(action, numArg, strArg);
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxSlider implementation of wxControlWithThumb interface
+// ----------------------------------------------------------------------------
+
+wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const
+{
+ wxRect rectShaft = GetShaftRect();
+ if ( !rectShaft.Inside(pt) )
+ {
+ return wxScrollThumb::Shaft_None;
+ }
+
+ // inside the shaft, where is it relatively to the thumb?
+ wxRect rectThumb;
+ CalcThumbRect(&rectShaft, &rectThumb, NULL);
+
+ // the position to test and the start and end of the thumb
+ wxCoord x, x1, x2;
+ if ( IsVert() )
+ {
+ x = pt.y;
+ x1 = rectThumb.GetTop();
+ x2 = rectThumb.GetBottom();
+ }
+ else // horz
+ {
+ x = pt.x;
+ x1 = rectThumb.GetLeft();
+ x2 = rectThumb.GetRight();
+ }
+
+ if ( x < x1 )
+ {
+ // or to the left
+ return wxScrollThumb::Shaft_Above;
+ }
+
+ if ( x > x2 )
+ {
+ // or to the right
+ return wxScrollThumb::Shaft_Below;
+ }
+
+ // where else can it be?
+ return wxScrollThumb::Shaft_Thumb;
+}
+
+wxCoord wxSlider::ThumbPosToPixel() const
+{
+ wxRect rectThumb;
+ CalcThumbRect(NULL, &rectThumb, NULL);
+
+ return IsVert() ? rectThumb.y : rectThumb.x;
+}
+
+int wxSlider::PixelToThumbPos(wxCoord x) const
+{
+ wxRect rectShaft = GetShaftRect();
+ wxSize sizeThumb = GetThumbSize();
+
+ wxCoord x0, len;
+ if ( IsVert() )
+ {
+ x0 = rectShaft.y;
+ len = rectShaft.height - sizeThumb.y;
+ }
+ else // horz
+ {
+ x0 = rectShaft.x;
+ len = rectShaft.width - sizeThumb.x;
+ }
+
+ int pos = m_min;
+ if ( len > 0 )
+ {
+ if ( x > x0 )
+ {
+ pos += ((x - x0) * (m_max - m_min)) / len;
+ if ( pos > m_max )
+ pos = m_max;
+ }
+ //else: x <= x0, leave pos = min
+ }
+
+ return pos;
+}
+
+void wxSlider::SetShaftPartState(wxScrollThumb::Shaft shaftPart,
+ int flag,
+ bool set)
+{
+ // for now we ignore the flags for the shaft as no renderer uses them
+ // anyhow
+ if ( shaftPart == wxScrollThumb::Shaft_Thumb )
+ {
+ if ( set )
+ m_thumbFlags |= flag;
+ else
+ m_thumbFlags &= ~flag;
+
+ RefreshThumb();
+ }
+}
+
+void wxSlider::OnThumbDragStart(int pos)
+{
+ PerformAction(wxACTION_SLIDER_THUMB_DRAG, pos);
+}
+
+void wxSlider::OnThumbDrag(int pos)
+{
+ PerformAction(wxACTION_SLIDER_THUMB_MOVE, pos);
+}
+
+void wxSlider::OnThumbDragEnd(int pos)
+{
+ PerformAction(wxACTION_SLIDER_THUMB_RELEASE, pos);
+}
+
+void wxSlider::OnPageScrollStart()
+{
+ // we do nothing here
+}
+
+bool wxSlider::OnPageScroll(int pageInc)
+{
+ int value = GetValue();
+ PerformAction(wxACTION_SLIDER_PAGE_CHANGE, pageInc);
+
+ return GetValue() != value;
+}
+
+// ----------------------------------------------------------------------------
+// wxStdSliderButtonInputHandler
+// ----------------------------------------------------------------------------
+
+bool wxStdSliderButtonInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ if ( pressed )
+ {
+ int keycode = event.GetKeyCode();
+
+ wxControlAction action;
+ switch ( keycode )
+ {
+ case WXK_HOME:
+ action = wxACTION_SLIDER_START;
+ break;
+
+ case WXK_END:
+ action = wxACTION_SLIDER_END;
+ break;
+
+ case WXK_LEFT:
+ case WXK_UP:
+ action = wxACTION_SLIDER_LINE_UP;
+ break;
+
+ case WXK_RIGHT:
+ case WXK_DOWN:
+ action = wxACTION_SLIDER_LINE_DOWN;
+ break;
+
+ case WXK_PRIOR:
+ action = wxACTION_SLIDER_PAGE_UP;
+ break;
+
+ case WXK_NEXT:
+ action = wxACTION_SLIDER_PAGE_DOWN;
+ break;
+ }
+
+ if ( !!action )
+ {
+ control->PerformAction(action);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdSliderButtonInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ wxSlider *slider = wxStaticCast(control, wxSlider);
+
+ if ( slider->GetThumb().HandleMouse(event) )
+ {
+ // processed by the thumb
+ return FALSE;
+ }
+
+ return wxStdInputHandler::HandleMouse(control, event);
+}
+
+bool wxStdSliderButtonInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ wxSlider *slider = wxStaticCast(control, wxSlider);
+
+ if ( slider->GetThumb().HandleMouseMove(event) )
+ {
+ // processed by the thumb
+ return FALSE;
+ }
+
+ return wxStdInputHandler::HandleMouseMove(control, event);
+}
+
+bool wxStdSliderButtonInputHandler::HandleFocus(wxControl *control,
+ const wxFocusEvent& event)
+{
+ // slider's appearance changes when it gets/loses focus
+ return TRUE;
+}
+
+#endif // wxUSE_SLIDER
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/spinbutt.cpp
+// Purpose: implementation of the universal version of wxSpinButton
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 21.01.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "spinbutbase.h"
+ #pragma implementation "univspinbutt.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif
+
+#include "wx/spinbutt.h"
+
+#if wxUSE_SPINBTN
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ============================================================================
+// implementation of wxSpinButton
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
+IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+#ifdef __VISUALC__
+ // warning C4355: 'this' : used in base member initializer list
+ #pragma warning(disable:4355) // so what? disable it...
+#endif
+
+wxSpinButton::wxSpinButton()
+ : m_arrows(this)
+{
+ Init();
+}
+
+wxSpinButton::wxSpinButton(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+ : m_arrows(this)
+{
+ Init();
+
+ (void)Create(parent, id, pos, size, style, name);
+}
+
+#ifdef __VISUALC__
+ // warning C4355: 'this' : used in base member initializer list
+ #pragma warning(default:4355)
+#endif
+
+void wxSpinButton::Init()
+{
+ for ( size_t n = 0; n < WXSIZEOF(m_arrowsState); n++ )
+ {
+ m_arrowsState[n] = 0;
+ }
+
+ m_value = 0;
+}
+
+bool wxSpinButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+{
+ // the spin buttons never have the border
+ style &= ~wxBORDER_MASK;
+
+ if ( !wxSpinButtonBase::Create(parent, id, pos, size, style,
+ wxDefaultValidator, name) )
+ return FALSE;
+
+ SetBestSize(size);
+
+ CreateInputHandler(wxINP_HANDLER_SPINBTN);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// value access
+// ----------------------------------------------------------------------------
+
+void wxSpinButton::SetRange(int minVal, int maxVal)
+{
+ wxSpinButtonBase::SetRange(minVal, maxVal);
+
+ // because the arrows disabled state might have changed - we don't check if
+ // it really changed or not because SetRange() is called rarely enough and
+ // son an extre refresh here doesn't really hurt
+ Refresh();
+}
+
+int wxSpinButton::GetValue() const
+{
+ return m_value;
+}
+
+void wxSpinButton::SetValue(int val)
+{
+ if ( val != m_value )
+ {
+ m_value = val;
+
+ Refresh();
+ }
+}
+
+int wxSpinButton::NormalizeValue(int value) const
+{
+ if ( value > m_max )
+ {
+ if ( GetWindowStyleFlag() & wxSP_WRAP )
+ value = m_min + (value - m_max) % (m_max - m_min);
+ else
+ value = m_max;
+ }
+ else if ( value < m_min )
+ {
+ if ( GetWindowStyleFlag() & wxSP_WRAP )
+ value = m_max - (m_min - value) % (m_max - m_min);
+ else
+ value = m_min;
+ }
+
+ return value;
+}
+
+bool wxSpinButton::ChangeValue(int inc)
+{
+ int valueNew = NormalizeValue(m_value + inc);
+
+ if ( valueNew == m_value )
+ {
+ // nothing changed - most likely because we are already at min/max
+ // value
+ return FALSE;
+ }
+
+ wxSpinEvent event(inc > 0 ? wxEVT_SCROLL_LINEUP : wxEVT_SCROLL_LINEDOWN,
+ GetId());
+ event.SetPosition(valueNew);
+ event.SetEventObject(this);
+
+ if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
+ {
+ // programm has vetoed the event
+ return FALSE;
+ }
+
+ m_value = valueNew;
+
+ // send wxEVT_SCROLL_THUMBTRACK as well
+ event.SetEventType(wxEVT_SCROLL_THUMBTRACK);
+ (void)GetEventHandler()->ProcessEvent(event);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// size calculations
+// ----------------------------------------------------------------------------
+
+wxSize wxSpinButton::DoGetBestClientSize() const
+{
+ // a spin button has by default the same size as two scrollbar arrows put
+ // together
+ wxSize size = m_renderer->GetScrollbarArrowSize();
+ if ( IsVertical() )
+ {
+ size.y *= 2;
+ }
+ else
+ {
+ size.x *= 2;
+ }
+
+ return size;
+}
+
+// ----------------------------------------------------------------------------
+// wxControlWithArrows methods
+// ----------------------------------------------------------------------------
+
+int wxSpinButton::GetArrowState(wxScrollArrows::Arrow arrow) const
+{
+ int state = m_arrowsState[arrow];
+
+ // the arrow may also be disabled: either because the control is completely
+ // disabled
+ bool disabled = !IsEnabled();
+
+ if ( !disabled && !(GetWindowStyleFlag() & wxSP_WRAP) )
+ {
+ // ... or because we can't go any further - note that this never
+ // happens if we just wrap
+ if ( IsVertical() )
+ {
+ if ( arrow == wxScrollArrows::Arrow_First )
+ disabled = m_value == m_max;
+ else
+ disabled = m_value == m_min;
+ }
+ else // horizontal
+ {
+ if ( arrow == wxScrollArrows::Arrow_First )
+ disabled = m_value == m_min;
+ else
+ disabled = m_value == m_max;
+ }
+ }
+
+ if ( disabled )
+ {
+ state |= wxCONTROL_DISABLED;
+ }
+
+ return state;
+}
+
+void wxSpinButton::SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set)
+{
+ int state = m_arrowsState[arrow];
+ if ( set )
+ state |= flag;
+ else
+ state &= ~flag;
+
+ if ( state != m_arrowsState[arrow] )
+ {
+ m_arrowsState[arrow] = state;
+ Refresh();
+ }
+}
+
+bool wxSpinButton::OnArrow(wxScrollArrows::Arrow arrow)
+{
+ int valueOld = GetValue();
+
+ wxControlAction action;
+ if ( arrow == wxScrollArrows::Arrow_First )
+ action = IsVertical() ? wxACTION_SPIN_INC : wxACTION_SPIN_DEC;
+ else
+ action = IsVertical() ? wxACTION_SPIN_DEC : wxACTION_SPIN_INC;
+
+ PerformAction(action);
+
+ // did we scroll to the end?
+ return GetValue() != valueOld;
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+void wxSpinButton::DoDraw(wxControlRenderer *renderer)
+{
+ wxRect rectArrow1, rectArrow2;
+ CalcArrowRects(&rectArrow1, &rectArrow2);
+
+ wxDC& dc = renderer->GetDC();
+ m_arrows.DrawArrow(wxScrollArrows::Arrow_First, dc, rectArrow1);
+ m_arrows.DrawArrow(wxScrollArrows::Arrow_Second, dc, rectArrow2);
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+void wxSpinButton::CalcArrowRects(wxRect *rect1, wxRect *rect2) const
+{
+ // calculate the rectangles for both arrows: note that normally the 2
+ // arrows are adjacent to each other but if the total control width/height
+ // is odd, we can have 1 pixel between them
+ wxRect rectTotal = GetClientRect();
+
+ *rect1 =
+ *rect2 = rectTotal;
+ if ( IsVertical() )
+ {
+ rect1->height /= 2;
+ rect2->height /= 2;
+
+ rect2->y += rect1->height;
+ if ( rectTotal.height % 2 )
+ rect2->y++;
+ }
+ else // horizontal
+ {
+ rect1->width /= 2;
+ rect2->width /= 2;
+
+ rect2->x += rect1->width;
+ if ( rectTotal.width % 2 )
+ rect2->x++;
+ }
+}
+
+wxScrollArrows::Arrow wxSpinButton::HitTest(const wxPoint& pt) const
+{
+ wxRect rectArrow1, rectArrow2;
+ CalcArrowRects(&rectArrow1, &rectArrow2);
+
+ if ( rectArrow1.Inside(pt) )
+ return wxScrollArrows::Arrow_First;
+ else if ( rectArrow2.Inside(pt) )
+ return wxScrollArrows::Arrow_Second;
+ else
+ return wxScrollArrows::Arrow_None;
+}
+
+// ----------------------------------------------------------------------------
+// input processing
+// ----------------------------------------------------------------------------
+
+bool wxSpinButton::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ if ( action == wxACTION_SPIN_INC )
+ ChangeValue(+1);
+ else if ( action == wxACTION_SPIN_DEC )
+ ChangeValue(-1);
+ else
+ return wxControl::PerformAction(action, numArg, strArg);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxStdSpinButtonInputHandler
+// ----------------------------------------------------------------------------
+
+wxStdSpinButtonInputHandler::
+wxStdSpinButtonInputHandler(wxInputHandler *inphand)
+ : wxStdInputHandler(inphand)
+{
+}
+
+bool wxStdSpinButtonInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ if ( pressed )
+ {
+ wxControlAction action;
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_DOWN:
+ case WXK_RIGHT:
+ action = wxACTION_SPIN_DEC;
+ break;
+
+ case WXK_UP:
+ case WXK_LEFT:
+ action = wxACTION_SPIN_INC;
+ break;
+ }
+
+ if ( !!action )
+ {
+ control->PerformAction(action);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdSpinButtonInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ wxSpinButton *spinbtn = wxStaticCast(control, wxSpinButton);
+
+ if ( spinbtn->GetArrows().HandleMouse(event) )
+ {
+ // don't refresh, everything is already done
+ return FALSE;
+ }
+
+ return wxStdInputHandler::HandleMouse(control, event);
+}
+
+bool wxStdSpinButtonInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ wxSpinButton *spinbtn = wxStaticCast(control, wxSpinButton);
+
+ if ( spinbtn->GetArrows().HandleMouseMove(event) )
+ {
+ // processed by the arrows
+ return FALSE;
+ }
+
+ return wxStdInputHandler::HandleMouseMove(control, event);
+}
+
+
+#endif // wxUSE_SPINBTN
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/statbmp.cpp
+// Purpose: wxStaticBitmap implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univstatbmp.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_STATBMP
+
+#ifndef WX_PRECOMP
+ #include "wx/dc.h"
+ #include "wx/icon.h"
+ #include "wx/statbmp.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/theme.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
+
+// ----------------------------------------------------------------------------
+// wxStaticBitmap
+// ----------------------------------------------------------------------------
+
+bool wxStaticBitmap::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap &label,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name)
+{
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ // set bitmap first
+ SetBitmap(label);
+
+ // and adjust our size to fit it after this
+ SetBestSize(size);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// bitmap/icon setting/getting and converting between
+// ----------------------------------------------------------------------------
+
+void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
+{
+ m_bitmap = bitmap;
+}
+
+void wxStaticBitmap::SetIcon(const wxIcon& icon)
+{
+#ifdef __WXMSW__
+ m_bitmap.CopyFromIcon(icon);
+#else
+ m_bitmap = (const wxBitmap&)icon;
+#endif
+}
+
+wxIcon wxStaticBitmap::GetIcon() const
+{
+ wxIcon icon;
+#ifdef __WXMSW__
+ icon.CopyFromBitmap(m_bitmap);
+#else
+ icon = (const wxIcon&)m_bitmap;
+#endif
+ return icon;
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+void wxStaticBitmap::DoDraw(wxControlRenderer *renderer)
+{
+ wxControl::DoDraw(renderer);
+ renderer->DrawBitmap(GetBitmap());
+}
+
+#endif // wxUSE_STATBMP
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/statbox.cpp
+// Purpose: wxStaticBox implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univstatbox.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_STATBOX
+
+#ifndef WX_PRECOMP
+ #include "wx/dc.h"
+ #include "wx/statbox.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/renderer.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
+
+// ----------------------------------------------------------------------------
+// wxStaticBox
+// ----------------------------------------------------------------------------
+
+bool wxStaticBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name)
+{
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ SetLabel(label);
+
+ return TRUE;
+}
+
+void wxStaticBox::DoDraw(wxControlRenderer *renderer)
+{
+ // we never have a border, so don't call the base class version which draws
+ // it
+ renderer->DrawFrame();
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+wxRect wxStaticBox::GetBorderGeometry() const
+{
+ // FIXME should use the renderer here
+ wxRect rect;
+ rect.width =
+ rect.x = GetCharWidth() / 2 + 1;
+ rect.y = GetCharHeight() + 1;
+ rect.height = rect.y / 2;
+
+ return rect;
+}
+
+wxPoint wxStaticBox::GetBoxAreaOrigin() const
+{
+ wxPoint pt = wxControl::GetClientAreaOrigin();
+ wxRect rect = GetBorderGeometry();
+ pt.x += rect.x;
+ pt.y += rect.y;
+
+ return pt;
+}
+
+#if 0
+void wxStaticBox::DoSetClientSize(int width, int height)
+{
+ wxRect rect = GetBorderGeometry();
+
+ wxControl::DoSetClientSize(width + rect.x + rect.width,
+ height + rect.y + rect.height);
+}
+
+void wxStaticBox::DoGetClientSize(int *width, int *height) const
+{
+ wxControl::DoGetClientSize(width, height);
+
+ wxRect rect = GetBorderGeometry();
+ if ( width )
+ *width -= rect.x + rect.width;
+ if ( height )
+ *height -= rect.y + rect.height;
+}
+
+#endif // 0
+
+#endif // wxUSE_STATBOX
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/statline.cpp
+// Purpose: wxStaticLine implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univstatline.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_STATLINE
+
+#ifndef WX_PRECOMP
+ #include "wx/dc.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/statline.h"
+
+#include "wx/univ/renderer.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
+
+// ----------------------------------------------------------------------------
+// wxStaticLine
+// ----------------------------------------------------------------------------
+
+bool wxStaticLine::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name)
+{
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ wxSize sizeReal = AdjustSize(size);
+ if ( sizeReal != size )
+ SetSize(sizeReal);
+
+ return TRUE;
+}
+
+void wxStaticLine::DoDraw(wxControlRenderer *renderer)
+{
+ // we never have a border, so don't call the base class version whcih draws
+ // it
+ wxSize sz = GetSize();
+ wxCoord x2, y2;
+ if ( IsVertical() )
+ {
+ x2 = 0;
+ y2 = sz.y;
+ }
+ else // horizontal
+ {
+ x2 = sz.x;
+ y2 = 0;
+ }
+
+ renderer->DrawLine(0, 0, x2, y2);
+}
+
+#endif // wxUSE_STATLINE
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/stattext.cpp
+// Purpose: wxStaticText
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univstattext.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_STATTEXT
+
+#ifndef WX_PRECOMP
+ #include "wx/dcclient.h"
+ #include "wx/stattext.h"
+ #include "wx/validate.h"
+#endif
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/theme.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+bool wxStaticText::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name)
+{
+ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ SetLabel(label);
+ SetBestSize(size);
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// size management
+// ----------------------------------------------------------------------------
+
+void wxStaticText::SetLabel(const wxString& label)
+{
+ wxControl::SetLabel(label);
+}
+
+wxSize wxStaticText::DoGetBestClientSize() const
+{
+ wxStaticText *self = wxConstCast(this, wxStaticText);
+ wxClientDC dc(self);
+ dc.SetFont(GetFont());
+ wxCoord width, height;
+ dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
+
+ return wxSize(width, height);
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+void wxStaticText::DoDraw(wxControlRenderer *renderer)
+{
+ renderer->DrawLabel();
+}
+
+#endif // wxUSE_STATTEXT
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/textctrl.cpp
+// Purpose: wxTextCtrl
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ TODO
+
++ 1. update vert scrollbar when any line length changes for WrapLines()
++ 2. cursor movement ("Hello,^" -> "^verse!" on Arrow Down)?
+ -> maybe save the x position and use it instead of current in handling
+ DOWN/UP actions (this would make up/down always return the cursor to
+ the same location)?
+ 3. split file into chunks
++? 4. rewrite Replace() refresh logic to deal with wrapping lines
++? 5. cache info found by GetPartOfWrappedLine() - performance must be horrible
+ with lots of text
+
+ 6. backspace refreshes too much (until end of line)
+ */
+
+/*
+ Optimisation hints from PureQuantify:
+
+ +1. wxStringTokenize is the slowest part of Replace
+ 2. GetDC/ReleaseDC are very slow, avoid calling them several times
+ +3. GetCharHeight() should be cached too
+ 4. wxClientDC construction/destruction in HitTestLine is horribly expensive
+
+ For line wrapping controls HitTest2 takes 50% of program time. The results
+ of GetRowsPerLine and GetPartOfWrappedLine *MUST* be cached.
+
+ Search for "OPT!" for things which must be optimized.
+ */
+
+/*
+ Some terminology:
+
+ Everywhere in this file LINE refers to a logical line of text, and ROW to a
+ physical line of text on the display. They are the same unless WrapLines()
+ is TRUE in which case a single LINE may correspond to multiple ROWs.
+
+ A text position is an unsigned int (which for reasons of compatibility is
+ still a long) from 0 to GetLastPosition() inclusive. The positions
+ correspond to the gaps between the letters so the position 0 is just
+ before the first character and the last position is the one beyond the last
+ character. For an empty text control GetLastPosition() returns 0.
+
+ Lines and columns returned/accepted by XYToPosition() and PositionToXY()
+ start from 0. The y coordinate is a LINE, not a ROW. Columns correspond to
+ the characters, the first column of a line is the first character in it,
+ the last one is length(line text). For compatibility, again, lines and
+ columns are also longs.
+
+ When translating lines/column coordinates to/from positions, the line and
+ column give the character after the given position. Thus, GetLastPosition()
+ doesn't have any corresponding column.
+
+ An example of positions and lines/columns for a control without wrapping
+ containing the text "Hello, Universe!\nGoodbye"
+
+ 1 1 1 1 1 1 1
+ pos: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6
+ H e l l o , U n i v e r s e ! line 0
+ col: 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1
+ 0 1 2 3 4 5
+
+ pos: 1 1 1 2 2 2 2 2
+ 7 8 9 0 1 2 3 4
+ G o o d b y e line 1
+ col: 0 1 2 3 4 5 6
+
+
+ The same example for a control with line wrap assuming "Universe" is too
+ long to fit on the same line with "Hello,":
+
+ pos: 0 1 2 3 4 5
+ H e l l o , line 0 (row 0)
+ col: 0 1 2 3 4 5
+
+ 1 1 1 1 1 1 1
+ pos: 6 7 8 9 0 1 2 3 4 5 6
+ U n i v e r s e ! line 0 (row 1)
+ col: 6 7 8 9 1 1 1 1 1 1
+ 0 1 2 3 4 5
+
+ (line 1 == row 2 same as above)
+
+ Note that there is still the same number of columns and positions and that
+ there is no (logical) position at the end of the first ROW. This position
+ is identified with the preceding one (which is not how Windows does it: it
+ identifies it with the next one, i.e. the first position of the next line,
+ but much more logical IMHO).
+ */
+
+/*
+ Search for "OPT" for possible optimizations
+
+ A possible global optimization would be to always store the coords in the
+ text in triplets (pos, col, line) and update them simultaneously instead of
+ recalculating col and line from pos each time it is needed. Currently we
+ only do it for the current position but we might also do it for the
+ selection start and end.
+ */
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univtextctrl.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_TEXTCTRL
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+
+ #include "wx/dcclient.h"
+ #include "wx/validate.h"
+ #include "wx/textctrl.h"
+#endif
+
+#include "wx/clipbrd.h"
+#include "wx/textfile.h"
+
+#include "wx/caret.h"
+
+#include "wx/univ/inphand.h"
+#include "wx/univ/renderer.h"
+#include "wx/univ/colschem.h"
+#include "wx/univ/theme.h"
+
+#include "wx/cmdproc.h"
+
+// turn extra wxTextCtrl-specific debugging on/off
+#define WXDEBUG_TEXT
+
+// turn wxTextCtrl::Replace() debugging on (slows down code a *lot*!)
+#define WXDEBUG_TEXT_REPLACE
+
+#ifndef __WXDEBUG__
+ #undef WXDEBUG_TEXT
+ #undef WXDEBUG_TEXT_REPLACE
+#endif
+
+// wxStringTokenize only needed for debug checks
+#ifdef WXDEBUG_TEXT_REPLACE
+ #include "wx/tokenzr.h"
+#endif // WXDEBUG_TEXT_REPLACE
+
+// ----------------------------------------------------------------------------
+// private functions
+// ----------------------------------------------------------------------------
+
+// exchange two positions so that from is always less than or equal to to
+static inline void OrderPositions(wxTextPos& from, wxTextPos& to)
+{
+ if ( from > to )
+ {
+ wxTextPos tmp = from;
+ from = to;
+ to = tmp;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// names of text ctrl commands
+#define wxTEXT_COMMAND_INSERT _T("insert")
+#define wxTEXT_COMMAND_REMOVE _T("remove")
+
+// the value which is never used for text position, even not -1 which is
+// sometimes used for some special meaning
+static const wxTextPos INVALID_POS_VALUE = -2;
+
+// overlap between pages (when using PageUp/Dn) in lines
+static const size_t PAGE_OVERLAP_IN_LINES = 1;
+
+// ----------------------------------------------------------------------------
+// private data of wxTextCtrl
+// ----------------------------------------------------------------------------
+
+// the data only used by single line text controls
+struct WXDLLEXPORT wxTextSingleLineData
+{
+ // the position of the first visible pixel and the first visible column
+ wxCoord m_ofsHorz;
+ wxTextCoord m_colStart;
+
+ // and the last ones (m_posLastVisible is the width but m_colLastVisible
+ // is an absolute value)
+ wxCoord m_posLastVisible;
+ wxTextCoord m_colLastVisible;
+
+ // def ctor
+ wxTextSingleLineData()
+ {
+ m_colStart = 0;
+ m_ofsHorz = 0;
+
+ m_colLastVisible = -1;
+ m_posLastVisible = -1;
+ }
+
+};
+
+// the data only used by multi line text controls
+struct WXDLLEXPORT wxTextMultiLineData
+{
+ // the lines of text
+ wxArrayString m_lines;
+
+ // the current ranges of the scrollbars
+ int m_scrollRangeX,
+ m_scrollRangeY;
+
+ // should we adjust the horz/vert scrollbar?
+ bool m_updateScrollbarX,
+ m_updateScrollbarY;
+
+ // the max line length in pixels
+ wxCoord m_widthMax;
+
+ // the index of the line which has the length of m_widthMax
+ wxTextCoord m_lineLongest;
+
+ // the rect in which text appears: it is even less than m_rectText because
+ // only the last _complete_ line is shown, hence there is an unoccupied
+ // horizontal band at the bottom of it
+ wxRect m_rectTextReal;
+
+ // the x-coordinate of the caret before we started moving it vertically:
+ // this is used to ensure that moving the caret up and then down will
+ // return it to the same position as if we always round it in one direction
+ // we would shift it in that direction
+ //
+ // when m_xCaret == -1, we don't have any remembered position
+ wxCoord m_xCaret;
+
+ // the def ctor
+ wxTextMultiLineData()
+ {
+ m_scrollRangeX =
+ m_scrollRangeY = 0;
+
+ m_updateScrollbarX =
+ m_updateScrollbarY = FALSE;
+
+ m_widthMax = -1;
+ m_lineLongest = 0;
+
+ m_xCaret = -1;
+ }
+};
+
+// the data only used by multi line text controls in line wrap mode
+class WXDLLEXPORT wxWrappedLineData
+{
+ // these functions set all our values, so give them access to them
+friend void wxTextCtrl::LayoutLine(wxTextCoord line,
+ wxWrappedLineData& lineData) const;
+friend void wxTextCtrl::LayoutLines(wxTextCoord) const;
+
+public:
+ // def ctor
+ wxWrappedLineData()
+ {
+ m_rowFirst = -1;
+ }
+
+ // get the start of any row (remember that accessing m_rowsStart doesn't work
+ // for the first one)
+ wxTextCoord GetRowStart(wxTextCoord row) const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ return row ? m_rowsStart[row - 1] : 0;
+ }
+
+ // get the length of the row (using the total line length which we don't
+ // have here but need to calculate the length of the last row, so it must
+ // be given to us)
+ wxTextCoord GetRowLength(wxTextCoord row, wxTextCoord lenLine) const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ // note that m_rowsStart[row] is the same as GetRowStart(row + 1) (but
+ // slightly more efficient) and lenLine is the same as the start of the
+ // first row of the next line
+ return ((size_t)row == m_rowsStart.GetCount() ? lenLine : m_rowsStart[row])
+ - GetRowStart(row);
+ }
+
+ // return the width of the row in pixels
+ wxCoord GetRowWidth(wxTextCoord row) const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ return m_rowsWidth[row];
+ }
+
+ // return the number of rows
+ size_t GetRowCount() const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ return m_rowsStart.GetCount() + 1;
+ }
+
+ // return the number of additional (i.e. after the first one) rows
+ size_t GetExtraRowCount() const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ return m_rowsStart.GetCount();
+ }
+
+ // return the first row of this line
+ wxTextCoord GetFirstRow() const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ return m_rowFirst;
+ }
+
+ // return the first row of the next line
+ wxTextCoord GetNextRow() const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ return m_rowFirst + m_rowsStart.GetCount() + 1;
+ }
+
+ // this just provides direct access to m_rowsStart aerray for efficiency
+ wxTextCoord GetExtraRowStart(wxTextCoord row) const
+ {
+ wxASSERT_MSG( IsValid(), _T("this line hadn't been laid out") );
+
+ return m_rowsStart[row];
+ }
+
+ // this code is unused any longer
+#if 0
+ // return TRUE if the column is in the start of the last row (hence the row
+ // it is in is not wrapped)
+ bool IsLastRow(wxTextCoord colRowStart) const
+ {
+ return colRowStart == GetRowStart(m_rowsStart.GetCount());
+ }
+
+ // return TRUE if the column is the last column of the row starting in
+ // colRowStart
+ bool IsLastColInRow(wxTextCoord colRowStart,
+ wxTextCoord colRowEnd,
+ wxTextCoord lenLine) const
+ {
+ // find the row which starts with colRowStart
+ size_t nRows = GetRowCount();
+ for ( size_t n = 0; n < nRows; n++ )
+ {
+ if ( GetRowStart(n) == colRowStart )
+ {
+ wxTextCoord colNextRowStart = n == nRows - 1
+ ? lenLine
+ : GetRowStart(n + 1);
+
+ wxASSERT_MSG( colRowEnd < colNextRowStart,
+ _T("this column is not in this row at all!") );
+
+ return colRowEnd == colNextRowStart - 1;
+ }
+ }
+
+ // caller got it wrong
+ wxFAIL_MSG( _T("this column is not in the start of the row!") );
+
+ return FALSE;
+ }
+#endif // 0
+
+ // is this row the last one in its line?
+ bool IsLastRow(wxTextCoord row) const
+ {
+ return (size_t)row == GetExtraRowCount();
+ }
+
+ // the line is valid if it had been laid out correctly: note that just
+ // shiwting the line (because one of previous lines changed) doesn't make
+ // it invalid
+ bool IsValid() const { return !m_rowsWidth.IsEmpty(); }
+
+ // invalidating line will relayout it
+ void Invalidate() { m_rowsWidth.Empty(); }
+
+private:
+ // for each line we remember the starting columns of all its rows after the
+ // first one (which always starts at 0), i.e. if a line is wrapped twice
+ // (== takes 3 rows) its m_rowsStart[0] may be 10 and m_rowsStart[1] == 15
+ wxArrayLong m_rowsStart;
+
+ // and the width of each row in pixels (this array starts from 0, as usual)
+ wxArrayInt m_rowsWidth;
+
+ // and also its starting row (0 for the first line, first lines'
+ // m_rowsStart.GetCount() + 1 for the second &c): it is set to -1 initially
+ // and this means that the struct hadn't yet been initialized
+ wxTextCoord m_rowFirst;
+
+ // the last modification "time"-stamp used by LayoutLines()
+ size_t m_timestamp;
+};
+
+WX_DECLARE_OBJARRAY(wxWrappedLineData, wxArrayWrappedLinesData);
+#include "wx/arrimpl.cpp"
+WX_DEFINE_OBJARRAY(wxArrayWrappedLinesData);
+
+struct WXDLLEXPORT wxTextWrappedData : public wxTextMultiLineData
+{
+ // the width of the column to the right of the text rect used for the
+ // indicator mark display for the wrapped lines
+ wxCoord m_widthMark;
+
+ // the data for each line
+ wxArrayWrappedLinesData m_linesData;
+
+ // flag telling us to recalculate all starting rows starting from this line
+ // (if it is -1, we don't have to recalculate anything) - it is set when
+ // the number of the rows in the middle of the control changes
+ wxTextCoord m_rowFirstInvalid;
+
+ // the current timestamp used by LayoutLines()
+ size_t m_timestamp;
+
+ // invalidate starting rows of all lines (NOT rows!) after this one
+ void InvalidateLinesBelow(wxTextCoord line)
+ {
+ if ( m_rowFirstInvalid == -1 || m_rowFirstInvalid > line )
+ {
+ m_rowFirstInvalid = line;
+ }
+ }
+
+ // check if this line is valid: i.e. before the first invalid one
+ bool IsValidLine(wxTextCoord line) const
+ {
+ return ((m_rowFirstInvalid == -1) || (line < m_rowFirstInvalid)) &&
+ m_linesData[line].IsValid();
+ }
+
+ // def ctor
+ wxTextWrappedData()
+ {
+ m_widthMark = 0;
+ m_rowFirstInvalid = -1;
+ m_timestamp = 0;
+ }
+};
+
+// ----------------------------------------------------------------------------
+// private classes for undo/redo management
+// ----------------------------------------------------------------------------
+
+/*
+ We use custom versions of wxWindows command processor to implement undo/redo
+ as we want to avoid storing the backpointer to wxTextCtrl in wxCommand
+ itself: this is a waste of memory as all commands in the given command
+ processor always have the same associated wxTextCtrl and so it makes sense
+ to store the backpointer there.
+
+ As for the rest of the implementation, it's fairly standard: we have 2
+ command classes corresponding to adding and removing text.
+ */
+
+// a command corresponding to a wxTextCtrl action
+class wxTextCtrlCommand : public wxCommand
+{
+public:
+ wxTextCtrlCommand(const wxString& name) : wxCommand(TRUE, name) { }
+
+ // we don't use these methods as they don't make sense for us as we need a
+ // wxTextCtrl to be applied
+ virtual bool Do() { wxFAIL_MSG(_T("shouldn't be called")); return FALSE; }
+ virtual bool Undo() { wxFAIL_MSG(_T("shouldn't be called")); return FALSE; }
+
+ // instead, our command processor uses these methods
+ virtual bool Do(wxTextCtrl *text) = 0;
+ virtual bool Undo(wxTextCtrl *text) = 0;
+};
+
+// insert text command
+class wxTextCtrlInsertCommand : public wxTextCtrlCommand
+{
+public:
+ wxTextCtrlInsertCommand(const wxString& textToInsert)
+ : wxTextCtrlCommand(wxTEXT_COMMAND_INSERT), m_text(textToInsert)
+ {
+ m_from = -1;
+ }
+
+ // combine the 2 commands together
+ void Append(wxTextCtrlInsertCommand *other);
+
+ virtual bool CanUndo() const;
+ virtual bool Do(wxTextCtrl *text);
+ virtual bool Undo(wxTextCtrl *text);
+
+private:
+ // the text we insert
+ wxString m_text;
+
+ // the position where we inserted the text
+ wxTextPos m_from;
+};
+
+// remove text command
+class wxTextCtrlRemoveCommand : public wxTextCtrlCommand
+{
+public:
+ wxTextCtrlRemoveCommand(wxTextPos from, wxTextPos to)
+ : wxTextCtrlCommand(wxTEXT_COMMAND_REMOVE)
+ {
+ m_from = from;
+ m_to = to;
+ }
+
+ virtual bool CanUndo() const;
+ virtual bool Do(wxTextCtrl *text);
+ virtual bool Undo(wxTextCtrl *text);
+
+private:
+ // the range of text to delete
+ wxTextPos m_from,
+ m_to;
+
+ // the text which was deleted when this command was Do()ne
+ wxString m_textDeleted;
+};
+
+// a command processor for a wxTextCtrl
+class wxTextCtrlCommandProcessor : public wxCommandProcessor
+{
+public:
+ wxTextCtrlCommandProcessor(wxTextCtrl *text)
+ {
+ m_compressInserts = FALSE;
+
+ m_text = text;
+ }
+
+ // override Store() to compress multiple wxTextCtrlInsertCommand into one
+ virtual void Store(wxCommand *command);
+
+ // stop compressing insert commands when this is called
+ void StopCompressing() { m_compressInserts = FALSE; }
+
+ // accessors
+ wxTextCtrl *GetTextCtrl() const { return m_text; }
+ bool IsCompressing() const { return m_compressInserts; }
+
+protected:
+ virtual bool DoCommand(wxCommand& cmd)
+ { return ((wxTextCtrlCommand &)cmd).Do(m_text); }
+ virtual bool UndoCommand(wxCommand& cmd)
+ { return ((wxTextCtrlCommand &)cmd).Undo(m_text); }
+
+ // check if this command is a wxTextCtrlInsertCommand and return it casted
+ // to the right type if it is or NULL otherwise
+ wxTextCtrlInsertCommand *IsInsertCommand(wxCommand *cmd);
+
+private:
+ // the control we're associated with
+ wxTextCtrl *m_text;
+
+ // if the flag is TRUE we're compressing subsequent insert commands into
+ // one so that the entire typing could be undone in one call to Undo()
+ bool m_compressInserts;
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
+ EVT_CHAR(wxTextCtrl::OnChar)
+
+ EVT_SIZE(wxTextCtrl::OnSize)
+
+ EVT_IDLE(wxTextCtrl::OnIdle)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::Init()
+{
+ m_selAnchor =
+ m_selStart =
+ m_selEnd = -1;
+
+ m_isModified = FALSE;
+ m_isEditable = TRUE;
+
+ m_posLast =
+ m_curPos =
+ m_curCol =
+ m_curRow = 0;
+
+ m_heightLine =
+ m_widthAvg = -1;
+
+ // init wxScrollHelper
+ SetWindow(this);
+
+ // init the undo manager
+ m_cmdProcessor = new wxTextCtrlCommandProcessor(this);
+
+ // no data yet
+ m_data.data = NULL;
+}
+
+bool wxTextCtrl::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ if ( style & wxTE_MULTILINE )
+ {
+ // for compatibility with wxMSW we create the controls with vertical
+ // scrollbar always shown unless they have wxTE_RICH style (because
+ // Windows text controls always has vert scrollbar but richedit one
+ // doesn't)
+ if ( !(style & wxTE_RICH) )
+ {
+ style |= wxALWAYS_SHOW_SB;
+ }
+
+ if ( style & wxTE_WORDWRAP )
+ {
+ // wrapping words means wrapping, hence no horz scrollbar
+ style &= ~wxHSCROLL;
+ }
+
+ // TODO: support wxTE_NO_VSCROLL (?)
+
+ // create data object for normal multiline or for controls with line
+ // wrap as needed
+ if ( style & wxHSCROLL )
+ m_data.mdata = new wxTextMultiLineData;
+ else
+ m_data.wdata = new wxTextWrappedData;
+ }
+ else
+ {
+ // this doesn't make sense for single line controls
+ style &= ~wxHSCROLL;
+
+ // create data object for single line controls
+ m_data.sdata = new wxTextSingleLineData;
+ }
+
+ if ( !wxControl::Create(parent, id, pos, size, style,
+ validator, name) )
+ {
+ return FALSE;
+ }
+
+ SetCursor(wxCURSOR_IBEAM);
+
+ if ( style & wxTE_MULTILINE )
+ {
+ // we should always have at least one line in a multiline control
+ MData().m_lines.Add(wxEmptyString);
+
+ if ( !(style & wxHSCROLL) )
+ {
+ WData().m_linesData.Add(new wxWrappedLineData);
+ WData().InvalidateLinesBelow(0);
+ }
+
+ // we might support it but it's quite useless and other ports don't
+ // support it anyhow
+ wxASSERT_MSG( !(style & wxTE_PASSWORD),
+ _T("wxTE_PASSWORD can't be used with multiline ctrls") );
+ }
+
+ RecalcFontMetrics();
+ SetValue(value);
+ SetBestSize(size);
+
+ m_isEditable = !(style & wxTE_READONLY);
+
+ CreateCaret();
+ InitInsertionPoint();
+
+ // we can't show caret right now as we're not shown yet and so it would
+ // result in garbage on the screen - we'll do it after first OnPaint()
+ m_hasCaret = FALSE;
+
+ CreateInputHandler(wxINP_HANDLER_TEXTCTRL);
+
+ return TRUE;
+}
+
+wxTextCtrl::~wxTextCtrl()
+{
+ delete m_cmdProcessor;
+
+ if ( m_data.data )
+ {
+ if ( IsSingleLine() )
+ delete m_data.sdata;
+ else if ( WrapLines() )
+ delete m_data.wdata;
+ else
+ delete m_data.mdata;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// set/get the value
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::SetValue(const wxString& value)
+{
+ if ( IsSingleLine() && (value == GetValue()) )
+ {
+ // nothing changed
+ return;
+ }
+
+ Replace(0, GetLastPosition(), value);
+
+ if ( IsSingleLine() )
+ {
+ SetInsertionPoint(0);
+ }
+
+ // TODO: should we generate the event or not, finally?
+}
+
+const wxArrayString& wxTextCtrl::GetLines() const
+{
+ return MData().m_lines;
+}
+
+size_t wxTextCtrl::GetLineCount() const
+{
+ return MData().m_lines.GetCount();
+}
+
+wxString wxTextCtrl::GetValue() const
+{
+ // for multiline controls we don't always store the total value but only
+ // recompute it when asked - and to invalidate it we just empty it in
+ // Replace()
+ if ( !IsSingleLine() && m_value.empty() )
+ {
+ // recalculate: note that we always do it for empty multilien control,
+ // but then it's so quick that it's not important
+
+ // the first line is special as there is no \n before it, so it's
+ // outside the loop
+ const wxArrayString& lines = GetLines();
+ wxTextCtrl *self = wxConstCast(this, wxTextCtrl);
+ self->m_value << lines[0u];
+ size_t count = lines.GetCount();
+ for ( size_t n = 1; n < count; n++ )
+ {
+ self->m_value << _T('\n') << lines[n];
+ }
+ }
+
+ return m_value;
+}
+
+void wxTextCtrl::Clear()
+{
+ SetValue(_T(""));
+}
+
+bool wxTextCtrl::ReplaceLine(wxTextCoord line,
+ const wxString& text)
+{
+ if ( WrapLines() )
+ {
+ // first, we have to relayout the line entirely
+ //
+ // OPT: we might try not to recalc the unchanged part of line
+
+ wxWrappedLineData& lineData = WData().m_linesData[line];
+
+ // if we had some number of rows before, use this number, otherwise
+ // just make sure that the test below (rowsNew != rowsOld) will be true
+ int rowsOld;
+ if ( lineData.IsValid() )
+ {
+ rowsOld = lineData.GetExtraRowCount();
+ }
+ else // line wasn't laid out yet
+ {
+ // assume it changed entirely as we can't do anything better
+ rowsOld = -1;
+ }
+
+ // now change the line
+ MData().m_lines[line] = text;
+
+ // OPT: we choose to lay it our immediately instead of delaying it
+ // until it is needed because it allows us to avoid invalidating
+ // lines further down if the number of rows didn't chnage, but
+ // maybe we can imporve this even further?
+ LayoutLine(line, lineData);
+
+ int rowsNew = lineData.GetExtraRowCount();
+
+ if ( rowsNew != rowsOld )
+ {
+ // we have to update the line wrap marks as this is normally done
+ // by LayoutLines() which we bypassed by calling LayoutLine()
+ // directly
+ wxTextCoord rowFirst = lineData.GetFirstRow(),
+ rowCount = wxMax(rowsOld, rowsNew);
+ RefreshLineWrapMarks(rowFirst, rowFirst + rowCount);
+
+ // next, if this is not the last line, as the number of rows in it
+ // changed, we need to shift all the lines below it
+ if ( (size_t)line < WData().m_linesData.GetCount() )
+ {
+ // number of rows changed shifting all lines below
+ WData().InvalidateLinesBelow(line + 1);
+ }
+
+ // the number of rows changed
+ return TRUE;
+ }
+ }
+ else // no line wrap
+ {
+ MData().m_lines[line] = text;
+ }
+
+ // the number of rows didn't change
+ return FALSE;
+}
+
+void wxTextCtrl::RemoveLine(wxTextCoord line)
+{
+ MData().m_lines.RemoveAt(line);
+ if ( WrapLines() )
+ {
+ // we need to recalculate all the starting rows from this line, but we
+ // can avoid doing it if this line was never calculated: this means
+ // that we will recalculate all lines below it anyhow later if needed
+ if ( WData().IsValidLine(line) )
+ {
+ WData().InvalidateLinesBelow(line);
+ }
+
+ WData().m_linesData.RemoveAt(line);
+ }
+}
+
+void wxTextCtrl::InsertLine(wxTextCoord line, const wxString& text)
+{
+ MData().m_lines.Insert(text, line);
+ if ( WrapLines() )
+ {
+ WData().m_linesData.Insert(new wxWrappedLineData, line);
+
+ // invalidate everything below it
+ WData().InvalidateLinesBelow(line);
+ }
+}
+
+void wxTextCtrl::Replace(wxTextPos from, wxTextPos to, const wxString& text)
+{
+ wxTextCoord colStart, colEnd,
+ lineStart, lineEnd;
+
+ if ( (from > to) ||
+ !PositionToXY(from, &colStart, &lineStart) ||
+ !PositionToXY(to, &colEnd, &lineEnd) )
+ {
+ wxFAIL_MSG(_T("invalid range in wxTextCtrl::Replace"));
+
+ return;
+ }
+
+#ifdef WXDEBUG_TEXT_REPLACE
+ // a straighforward (but very inefficient) way of calculating what the new
+ // value should be
+ wxString textTotal = GetValue();
+ wxString textTotalNew(textTotal, (size_t)from);
+ textTotalNew += text;
+ if ( (size_t)to < textTotal.length() )
+ textTotalNew += textTotal.c_str() + (size_t)to;
+#endif // WXDEBUG_TEXT_REPLACE
+
+ // remember the old selection and reset it immediately: we must do it
+ // before calling Refresh(anything) as, at least under GTK, this leads to
+ // an _immediate_ repaint (under MSW it is delayed) and hence parts of
+ // text would be redrawn as selected if we didn't reset the selection
+ int selStartOld = m_selStart,
+ selEndOld = m_selEnd;
+
+ m_selStart =
+ m_selEnd = -1;
+
+ if ( IsSingleLine() )
+ {
+ // replace the part of the text with the new value
+ wxString valueNew(m_value, (size_t)from);
+
+ // remember it for later use
+ wxCoord startNewText = GetTextWidth(valueNew);
+
+ valueNew += text;
+ if ( (size_t)to < m_value.length() )
+ {
+ valueNew += m_value.c_str() + (size_t)to;
+ }
+
+ // we usually refresh till the end of line except of the most common case
+ // when some text is appended to the end of the string in which case we
+ // refresh just it
+ wxCoord widthNewText;
+
+ if ( (size_t)from < m_value.length() )
+ {
+ // refresh till the end of line
+ widthNewText = 0;
+ }
+ else // text appended, not replaced
+ {
+ // refresh only the new text
+ widthNewText = GetTextWidth(text);
+ }
+
+ m_value = valueNew;
+
+ // force SData().m_colLastVisible update
+ SData().m_colLastVisible = -1;
+
+ // repaint
+ RefreshPixelRange(0, startNewText, widthNewText);
+ }
+ else // multiline
+ {
+ //OPT: special case for replacements inside single line?
+
+ /*
+ Join all the lines in the replacement range into one string, then
+ replace a part of it with the new text and break it into lines again.
+ */
+
+ // (0) we want to know if this replacement changes the number of rows
+ // as if it does we need to refresh everything below the changed
+ // text (it will be shifted...) and we can avoid it if there is no
+ // row relayout
+ bool rowsNumberChanged = FALSE;
+
+ // (1) join lines
+ const wxArrayString& linesOld = GetLines();
+ wxString textOrig;
+ wxTextCoord line;
+ for ( line = lineStart; line <= lineEnd; line++ )
+ {
+ if ( line > lineStart )
+ {
+ // from the previous line
+ textOrig += _T('\n');
+ }
+
+ textOrig += linesOld[line];
+ }
+
+ // we need to append the '\n' for the last line unless there is no
+ // following line
+ size_t countOld = linesOld.GetCount();
+
+ // (2) replace text in the combined string
+
+ // (2a) leave the part before replaced area unchanged
+ wxString textNew(textOrig, colStart);
+
+ // these values will be used to refresh the changed area below
+ wxCoord widthNewText,
+ startNewText = GetTextWidth(textNew);
+ if ( (size_t)colStart == linesOld[lineStart].length() )
+ {
+ // text appended, refresh just enough to show the new text
+ widthNewText = GetTextWidth(text.BeforeFirst(_T('\n')));
+ }
+ else // text inserted, refresh till the end of line
+ {
+ widthNewText = 0;
+ }
+
+ // (2b) insert new text
+ textNew += text;
+
+ // (2c) and append the end of the old text
+
+ // adjust for index shift: to is relative to colStart, not 0
+ size_t toRel = (size_t)((to - from) + colStart);
+ if ( toRel < textOrig.length() )
+ {
+ textNew += textOrig.c_str() + toRel;
+ }
+
+ // (3) break it into lines
+
+ wxArrayString lines;
+ const wxChar *curLineStart = textNew.c_str();
+ for ( const wxChar *p = textNew.c_str(); ; p++ )
+ {
+ // end of line/text?
+ if ( !*p || *p == _T('\n') )
+ {
+ lines.Add(wxString(curLineStart, p));
+ if ( !*p )
+ break;
+
+ curLineStart = p + 1;
+ }
+ }
+
+#ifdef WXDEBUG_TEXT_REPLACE
+ // (3a) all empty tokens should be counted as replacing with "foo" and
+ // with "foo\n" should have different effects
+ wxArrayString lines2 = wxStringTokenize(textNew, _T("\n"),
+ wxTOKEN_RET_EMPTY_ALL);
+
+ if ( lines2.IsEmpty() )
+ {
+ lines2.Add(wxEmptyString);
+ }
+
+ wxASSERT_MSG( lines.GetCount() == lines2.GetCount(),
+ _T("Replace() broken") );
+ for ( size_t n = 0; n < lines.GetCount(); n++ )
+ {
+ wxASSERT_MSG( lines[n] == lines2[n], _T("Replace() broken") );
+ }
+#endif // WXDEBUG_TEXT_REPLACE
+
+ // (3b) special case: if we replace everything till the end we need to
+ // keep an empty line or the lines would disappear completely
+ // (this also takes care of never leaving m_lines empty)
+ if ( ((size_t)lineEnd == countOld - 1) && lines.IsEmpty() )
+ {
+ lines.Add(wxEmptyString);
+ }
+
+ size_t nReplaceCount = lines.GetCount(),
+ nReplaceLine = 0;
+
+ // (4) merge into the array
+
+ // (4a) replace
+ for ( line = lineStart; line <= lineEnd; line++, nReplaceLine++ )
+ {
+ if ( nReplaceLine < nReplaceCount )
+ {
+ // we have the replacement line for this one
+ if ( ReplaceLine(line, lines[nReplaceLine]) )
+ {
+ rowsNumberChanged = TRUE;
+ }
+
+ UpdateMaxWidth(line);
+ }
+ else // no more replacement lines
+ {
+ // (4b) delete all extra lines (note that we need to delete
+ // them backwards because indices shift while we do it)
+ bool deletedLongestLine = FALSE;
+ for ( wxTextCoord lineDel = lineEnd; lineDel >= line; lineDel-- )
+ {
+ if ( lineDel == MData().m_lineLongest )
+ {
+ // we will need to recalc the max line width
+ deletedLongestLine = TRUE;
+ }
+
+ RemoveLine(lineDel);
+ }
+
+ if ( deletedLongestLine )
+ {
+ RecalcMaxWidth();
+ }
+
+ // even the line number changed
+ rowsNumberChanged = TRUE;
+
+ // update line to exit the loop
+ line = lineEnd + 1;
+ }
+ }
+
+ // (4c) insert the new lines
+ if ( nReplaceLine < nReplaceCount )
+ {
+ // even the line number changed
+ rowsNumberChanged = TRUE;
+
+ do
+ {
+ InsertLine(++lineEnd, lines[nReplaceLine++]);
+
+ UpdateMaxWidth(lineEnd);
+ }
+ while ( nReplaceLine < nReplaceCount );
+ }
+
+ // (5) now refresh the changed area
+
+ // update the (cached) last position first as refresh functions use it
+ m_posLast += text.length() - to + from;
+
+ // we may optimize refresh if the number of rows didn't change - but if
+ // it did we have to refresh everything below the part we chanegd as
+ // well as it might have moved
+ if ( !rowsNumberChanged )
+ {
+ // refresh the line we changed
+ if ( !WrapLines() )
+ {
+ RefreshPixelRange(lineStart++, startNewText, widthNewText);
+ }
+ else
+ {
+ //OPT: we shouldn't refresh the unchanged part of the line in
+ // this case, but instead just refresh the tail of it - the
+ // trouble is that we don't know here where does this tail
+ // start
+ }
+
+ // number of rows didn't change, refresh the updated rows and the
+ // last one
+ if ( lineStart <= lineEnd )
+ RefreshLineRange(lineStart, lineEnd);
+ }
+ else // rows number did change
+ {
+ if ( !WrapLines() )
+ {
+ // refresh only part of the first line
+ RefreshPixelRange(lineStart++, startNewText, widthNewText);
+ }
+ //else: we have to refresh everything as some part of the text
+ // could be in the previous row before but moved to the next
+ // one now (due to word wrap)
+
+ wxTextCoord lineEnd = GetLines().GetCount() - 1;
+ if ( lineStart <= lineEnd )
+ RefreshLineRange(lineStart, lineEnd);
+
+ // refresh text rect left below
+ RefreshLineRange(lineEnd + 1, 0);
+
+ // the vert scrollbar might [dis]appear
+ MData().m_updateScrollbarY = TRUE;
+ }
+
+ // must recalculate it - will do later
+ m_value.clear();
+ }
+
+#ifdef WXDEBUG_TEXT_REPLACE
+ // optimized code above should give the same result as straightforward
+ // computation in the beginning
+ wxASSERT_MSG( GetValue() == textTotalNew, _T("error in Replace()") );
+#endif // WXDEBUG_TEXT_REPLACE
+
+ // update the current position: note that we always put the cursor at the
+ // end of the replacement text
+ DoSetInsertionPoint(from + text.length());
+
+ // and the selection: this is complicated by the fact that selection coords
+ // must be first updated to reflect change in text coords, i.e. if we had
+ // selection from 17 to 19 and we just removed this range, we don't have to
+ // refresh anything, so we can't just use ClearSelection() here
+ if ( selStartOld != -1 )
+ {
+ // refresh the parst of the selection outside the changed text (which
+ // we already refreshed)
+ if ( selStartOld < from )
+ RefreshTextRange(selStartOld, from);
+ if ( to < selEndOld )
+ RefreshTextRange(to, selEndOld);
+
+ }
+
+ // now call it to do the rest (not related to refreshing)
+ ClearSelection();
+}
+
+void wxTextCtrl::Remove(wxTextPos from, wxTextPos to)
+{
+ // Replace() only works with correctly ordered arguments, so exchange them
+ // if necessary
+ OrderPositions(from, to);
+
+ Replace(from, to, _T(""));
+}
+
+void wxTextCtrl::WriteText(const wxString& text)
+{
+ // replace the selection with the new text
+ RemoveSelection();
+
+ Replace(m_curPos, m_curPos, text);
+}
+
+void wxTextCtrl::AppendText(const wxString& text)
+{
+ SetInsertionPointEnd();
+ WriteText(text);
+}
+
+// ----------------------------------------------------------------------------
+// current position
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::SetInsertionPoint(wxTextPos pos)
+{
+ wxCHECK_RET( pos >= 0 && pos <= GetLastPosition(),
+ _T("insertion point position out of range") );
+
+ // don't do anything if it didn't change
+ if ( pos != m_curPos )
+ {
+ DoSetInsertionPoint(pos);
+ }
+
+ if ( !IsSingleLine() )
+ {
+ // moving cursor should reset the stored abscissa (even if the cursor
+ // position didn't actually change!)
+ MData().m_xCaret = -1;
+ }
+
+ ClearSelection();
+}
+
+void wxTextCtrl::InitInsertionPoint()
+{
+ // so far always put it in the beginning
+ DoSetInsertionPoint(0);
+
+ // this will also set the selection anchor correctly
+ ClearSelection();
+}
+
+void wxTextCtrl::MoveInsertionPoint(wxTextPos pos)
+{
+ wxASSERT_MSG( pos >= 0 && pos <= GetLastPosition(),
+ _T("DoSetInsertionPoint() can only be called with valid pos") );
+
+ m_curPos = pos;
+ PositionToXY(m_curPos, &m_curCol, &m_curRow);
+}
+
+void wxTextCtrl::DoSetInsertionPoint(wxTextPos pos)
+{
+ MoveInsertionPoint(pos);
+
+ ShowPosition(pos);
+}
+
+void wxTextCtrl::SetInsertionPointEnd()
+{
+ SetInsertionPoint(GetLastPosition());
+}
+
+wxTextPos wxTextCtrl::GetInsertionPoint() const
+{
+ return m_curPos;
+}
+
+wxTextPos wxTextCtrl::GetLastPosition() const
+{
+ wxTextPos pos;
+ if ( IsSingleLine() )
+ {
+ pos = m_value.length();
+ }
+ else // multiline
+ {
+#ifdef WXDEBUG_TEXT
+ pos = 0;
+ size_t nLineCount = GetLineCount();
+ for ( size_t nLine = 0; nLine < nLineCount; nLine++ )
+ {
+ // +1 is because the positions at the end of this line and of the
+ // start of the next one are different
+ pos += GetLines()[nLine].length() + 1;
+ }
+
+ if ( pos > 0 )
+ {
+ // the last position is at the end of the last line, not in the
+ // beginning of the next line after it
+ pos--;
+ }
+
+ // more probable reason of this would be to forget to update m_posLast
+ wxASSERT_MSG( pos == m_posLast, _T("bug in GetLastPosition()") );
+#endif // WXDEBUG_TEXT
+
+ pos = m_posLast;
+ }
+
+ return pos;
+}
+
+// ----------------------------------------------------------------------------
+// selection
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::GetSelection(wxTextPos* from, wxTextPos* to) const
+{
+ if ( from )
+ *from = m_selStart;
+ if ( to )
+ *to = m_selEnd;
+}
+
+wxString wxTextCtrl::GetSelectionText() const
+{
+ wxString sel;
+
+ if ( HasSelection() )
+ {
+ if ( IsSingleLine() )
+ {
+ sel = m_value.Mid(m_selStart, m_selEnd - m_selStart);
+ }
+ else // multiline
+ {
+ wxTextCoord colStart, lineStart,
+ colEnd, lineEnd;
+ PositionToXY(m_selStart, &colStart, &lineStart);
+ PositionToXY(m_selEnd, &colEnd, &lineEnd);
+
+ // as always, we need to check for the special case when the start
+ // and end line are the same
+ if ( lineEnd == lineStart )
+ {
+ sel = GetLines()[lineStart].Mid(colStart, colEnd - colStart);
+ }
+ else // sel on multiple lines
+ {
+ // take the end of the first line
+ sel = GetLines()[lineStart].c_str() + colStart;
+ sel += _T('\n');
+
+ // all intermediate ones
+ for ( wxTextCoord line = lineStart + 1; line < lineEnd; line++ )
+ {
+ sel << GetLines()[line] << _T('\n');
+ }
+
+ // and the start of the last one
+ sel += GetLines()[lineEnd].Left(colEnd);
+ }
+ }
+ }
+
+ return sel;
+}
+
+void wxTextCtrl::SetSelection(wxTextPos from, wxTextPos to)
+{
+ // selecting till -1 is the same as selecting to the end
+ if ( to == -1 && from != -1 )
+ {
+ to = GetLastPosition();
+ }
+
+ if ( from == -1 || to == from )
+ {
+ ClearSelection();
+ }
+ else // valid sel range
+ {
+ OrderPositions(from, to);
+
+ wxCHECK_RET( to <= GetLastPosition(),
+ _T("invalid range in wxTextCtrl::SetSelection") );
+
+ if ( from != m_selStart || to != m_selEnd )
+ {
+ // we need to use temp vars as RefreshTextRange() may call DoDraw()
+ // directly and so m_selStart/End must be reset by then
+ wxTextPos selStartOld = m_selStart,
+ selEndOld = m_selEnd;
+
+ m_selStart = from;
+ m_selEnd = to;
+
+ wxLogTrace(_T("text"), _T("Selection range is %ld-%ld"),
+ m_selStart, m_selEnd);
+
+ // refresh only the part of text which became (un)selected if
+ // possible
+ if ( selStartOld == m_selStart )
+ {
+ RefreshTextRange(selEndOld, m_selEnd);
+ }
+ else if ( selEndOld == m_selEnd )
+ {
+ RefreshTextRange(m_selStart, selStartOld);
+ }
+ else
+ {
+ // OPT: could check for other cases too but it is probably not
+ // worth it as the two above are the most common ones
+ if ( selStartOld != -1 )
+ RefreshTextRange(selStartOld, selEndOld);
+ if ( m_selStart != -1 )
+ RefreshTextRange(m_selStart, m_selEnd);
+ }
+
+ // we need to fully repaint the invalidated areas of the window
+ // before scrolling it (from DoSetInsertionPoint which is typically
+ // called after SetSelection()), otherwise they may stay unpainted
+ m_targetWindow->Update();
+ }
+ //else: nothing to do
+
+ // the insertion point is put at the end of selection
+ DoSetInsertionPoint(to);
+ }
+}
+
+void wxTextCtrl::ClearSelection()
+{
+ if ( HasSelection() )
+ {
+ // we need to use temp vars as RefreshTextRange() may call DoDraw()
+ // directly (see above as well)
+ wxTextPos selStart = m_selStart,
+ selEnd = m_selEnd;
+
+ // no selection any more
+ m_selStart =
+ m_selEnd = -1;
+
+ // refresh the old selection
+ RefreshTextRange(selStart, selEnd);
+ }
+
+ // the anchor should be moved even if there was no selection previously
+ m_selAnchor = m_curPos;
+}
+
+void wxTextCtrl::RemoveSelection()
+{
+ if ( !HasSelection() )
+ return;
+
+ Remove(m_selStart, m_selEnd);
+}
+
+bool wxTextCtrl::GetSelectedPartOfLine(wxTextCoord line,
+ wxTextPos *start, wxTextPos *end) const
+{
+ if ( start )
+ *start = -1;
+ if ( end )
+ *end = -1;
+
+ if ( !HasSelection() )
+ {
+ // no selection at all, hence no selection in this line
+ return FALSE;
+ }
+
+ wxTextCoord lineStart, colStart;
+ PositionToXY(m_selStart, &colStart, &lineStart);
+ if ( lineStart > line )
+ {
+ // this line is entirely above the selection
+ return FALSE;
+ }
+
+ wxTextCoord lineEnd, colEnd;
+ PositionToXY(m_selEnd, &colEnd, &lineEnd);
+ if ( lineEnd < line )
+ {
+ // this line is entirely below the selection
+ return FALSE;
+ }
+
+ if ( line == lineStart )
+ {
+ if ( start )
+ *start = colStart;
+ if ( end )
+ *end = lineEnd == lineStart ? colEnd : GetLineLength(line);
+ }
+ else if ( line == lineEnd )
+ {
+ if ( start )
+ *start = lineEnd == lineStart ? colStart : 0;
+ if ( end )
+ *end = colEnd;
+ }
+ else // the line is entirely inside the selection
+ {
+ if ( start )
+ *start = 0;
+ if ( end )
+ *end = GetLineLength(line);
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// flags
+// ----------------------------------------------------------------------------
+
+bool wxTextCtrl::IsModified() const
+{
+ return m_isModified;
+}
+
+bool wxTextCtrl::IsEditable() const
+{
+ // disabled control can never be edited
+ return m_isEditable && IsEnabled();
+}
+
+void wxTextCtrl::DiscardEdits()
+{
+ m_isModified = FALSE;
+}
+
+void wxTextCtrl::SetEditable(bool editable)
+{
+ if ( editable != m_isEditable )
+ {
+ m_isEditable = editable;
+
+ // the caret (dis)appears
+ CreateCaret();
+
+ // the appearance of the control might have changed
+ Refresh();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// col/lines <-> position correspondence
+// ----------------------------------------------------------------------------
+
+/*
+ A few remarks about this stuff:
+
+ o The numbering of the text control columns/rows starts from 0.
+ o Start of first line is position 0, its last position is line.length()
+ o Start of the next line is the last position of the previous line + 1
+ */
+
+int wxTextCtrl::GetLineLength(wxTextCoord line) const
+{
+ if ( IsSingleLine() )
+ {
+ wxASSERT_MSG( line == 0, _T("invalid GetLineLength() parameter") );
+
+ return m_value.length();
+ }
+ else // multiline
+ {
+ wxCHECK_MSG( (size_t)line < GetLineCount(), -1,
+ _T("line index out of range") );
+
+ return GetLines()[line].length();
+ }
+}
+
+wxString wxTextCtrl::GetLineText(wxTextCoord line) const
+{
+ if ( IsSingleLine() )
+ {
+ wxASSERT_MSG( line == 0, _T("invalid GetLineLength() parameter") );
+
+ return m_value;
+ }
+ else // multiline
+ {
+ wxCHECK_MSG( (size_t)line < GetLineCount(), _T(""),
+ _T("line index out of range") );
+
+ return GetLines()[line];
+ }
+}
+
+int wxTextCtrl::GetNumberOfLines() const
+{
+ // there is always 1 line, even if the text is empty
+ return IsSingleLine() ? 1 : GetLineCount();
+}
+
+wxTextPos wxTextCtrl::XYToPosition(wxTextCoord x, wxTextCoord y) const
+{
+ // note that this method should accept any values of x and y and return -1
+ // if they are out of range
+ if ( IsSingleLine() )
+ {
+ return x > GetLastPosition() || y > 0 ? -1 : x;
+ }
+ else // multiline
+ {
+ if ( (size_t)y >= GetLineCount() )
+ {
+ // this position is below the text
+ return GetLastPosition();
+ }
+
+ wxTextPos pos = 0;
+ for ( size_t nLine = 0; nLine < (size_t)y; nLine++ )
+ {
+ // +1 is because the positions at the end of this line and of the
+ // start of the next one are different
+ pos += GetLines()[nLine].length() + 1;
+ }
+
+ // take into account also the position in line
+ if ( (size_t)x > GetLines()[y].length() )
+ {
+ // don't return position in the next line
+ x = GetLines()[y].length();
+ }
+
+ return pos + x;
+ }
+}
+
+bool wxTextCtrl::PositionToXY(wxTextPos pos,
+ wxTextCoord *x, wxTextCoord *y) const
+{
+ if ( IsSingleLine() )
+ {
+ if ( (size_t)pos > m_value.length() )
+ return FALSE;
+
+ if ( x )
+ *x = pos;
+ if ( y )
+ *y = 0;
+
+ return TRUE;
+ }
+ else // multiline
+ {
+ wxTextPos posCur = 0;
+ size_t nLineCount = GetLineCount();
+ for ( size_t nLine = 0; nLine < nLineCount; nLine++ )
+ {
+ // +1 is because the start the start of the next line is one
+ // position after the end of this one
+ wxTextPos posNew = posCur + GetLines()[nLine].length() + 1;
+ if ( posNew > pos )
+ {
+ // we've found the line, now just calc the column
+ if ( x )
+ *x = pos - posCur;
+
+ if ( y )
+ *y = nLine;
+
+#ifdef WXDEBUG_TEXT
+ wxASSERT_MSG( XYToPosition(pos - posCur, nLine) == pos,
+ _T("XYToPosition() or PositionToXY() broken") );
+#endif // WXDEBUG_TEXT
+
+ return TRUE;
+ }
+ else // go further down
+ {
+ posCur = posNew;
+ }
+ }
+
+ // beyond the last line
+ return FALSE;
+ }
+}
+
+wxTextCoord wxTextCtrl::GetRowsPerLine(wxTextCoord line) const
+{
+ // a normal line has one row
+ wxTextCoord numRows = 1;
+
+ if ( WrapLines() )
+ {
+ // add the number of additional rows
+ numRows += WData().m_linesData[line].GetExtraRowCount();
+ }
+
+ return numRows;
+}
+
+wxTextCoord wxTextCtrl::GetRowCount() const
+{
+ wxTextCoord count = GetLineCount();
+ if ( WrapLines() )
+ {
+ count = GetFirstRowOfLine(count - 1) +
+ WData().m_linesData[count - 1].GetRowCount();
+ }
+
+ return count;
+}
+
+wxTextCoord wxTextCtrl::GetRowAfterLine(wxTextCoord line) const
+{
+ if ( !WrapLines() )
+ return line + 1;
+
+ if ( !WData().IsValidLine(line) )
+ {
+ LayoutLines(line);
+ }
+
+ return WData().m_linesData[line].GetNextRow();
+}
+
+wxTextCoord wxTextCtrl::GetFirstRowOfLine(wxTextCoord line) const
+{
+ if ( !WrapLines() )
+ return line;
+
+ if ( !WData().IsValidLine(line) )
+ {
+ LayoutLines(line);
+ }
+
+ return WData().m_linesData[line].GetFirstRow();
+}
+
+bool wxTextCtrl::PositionToLogicalXY(wxTextPos pos,
+ wxCoord *xOut,
+ wxCoord *yOut) const
+{
+ wxTextCoord col, line;
+
+ // optimization for special (but common) case when we already have the col
+ // and line
+ if ( pos == m_curPos )
+ {
+ col = m_curCol;
+ line = m_curRow;
+ }
+ else // must really calculate col/line from pos
+ {
+ if ( !PositionToXY(pos, &col, &line) )
+ return FALSE;
+ }
+
+ int hLine = GetLineHeight();
+ wxCoord x, y;
+ wxString textLine = GetLineText(line);
+ if ( IsSingleLine() || !WrapLines() )
+ {
+ x = GetTextWidth(textLine.Left(col));
+ y = line*hLine;
+ }
+ else // difficult case: multline control with line wrap
+ {
+ y = GetFirstRowOfLine(line);
+
+ wxTextCoord colRowStart;
+ y += GetRowInLine(line, col, &colRowStart);
+
+ y *= hLine;
+
+ // x is the width of the text before this position in this row
+ x = GetTextWidth(textLine.Mid(colRowStart, col - colRowStart));
+ }
+
+ if ( xOut )
+ *xOut = x;
+ if ( yOut )
+ *yOut = y;
+
+ return TRUE;
+}
+
+bool wxTextCtrl::PositionToDeviceXY(wxTextPos pos,
+ wxCoord *xOut,
+ wxCoord *yOut) const
+{
+ wxCoord x, y;
+ if ( !PositionToLogicalXY(pos, &x, &y) )
+ return FALSE;
+
+ // finally translate the logical text rect coords into physical client
+ // coords
+ CalcScrolledPosition(m_rectText.x + x, m_rectText.y + y, xOut, yOut);
+
+ return TRUE;
+}
+
+wxPoint wxTextCtrl::GetCaretPosition() const
+{
+ wxCoord xCaret, yCaret;
+ if ( !PositionToDeviceXY(m_curPos, &xCaret, &yCaret) )
+ {
+ wxFAIL_MSG( _T("Caret can't be beyond the text!") );
+ }
+
+ return wxPoint(xCaret, yCaret);
+}
+
+// pos may be -1 to show the current position
+void wxTextCtrl::ShowPosition(wxTextPos pos)
+{
+ HideCaret();
+
+ if ( IsSingleLine() )
+ {
+ ShowHorzPosition(GetTextWidth(m_value.Left(pos)));
+ }
+ else if ( MData().m_scrollRangeX || MData().m_scrollRangeY ) // multiline with scrollbars
+ {
+ int xStart, yStart;
+ GetViewStart(&xStart, &yStart);
+
+ if ( pos == -1 )
+ pos = m_curPos;
+
+ wxCoord x, y;
+ PositionToLogicalXY(pos, &x, &y);
+
+ wxRect rectText = GetRealTextArea();
+
+ // scroll the position vertically into view: if it is currently above
+ // it, make it the first one, otherwise the last one
+ if ( MData().m_scrollRangeY )
+ {
+ y /= GetLineHeight();
+
+ if ( y < yStart )
+ {
+ Scroll(0, y);
+ }
+ else // we are currently in or below the view area
+ {
+ // find the last row currently shown
+ wxTextCoord yEnd;
+
+ if ( WrapLines() )
+ {
+ // to find the last row we need to use the generic HitTest
+ wxTextCoord col;
+
+ // OPT this is a bit silly: we undo this in HitTest(), so
+ // it would be better to factor out the common
+ // functionality into a separate function (OTOH it
+ // won't probably save us that much)
+ wxPoint pt(0, rectText.height - 1);
+ pt += GetClientAreaOrigin();
+ pt += m_rectText.GetPosition();
+ HitTest(pt, &col, &yEnd);
+
+ // find the row inside the line
+ yEnd = GetFirstRowOfLine(yEnd) + GetRowInLine(yEnd, col);
+ }
+ else
+ {
+ // finding the last line is easy if each line has exactly
+ // one row
+ yEnd = yStart + rectText.height / GetLineHeight() - 1;
+ }
+
+ if ( yEnd < y )
+ {
+ // scroll down: the current item should appear at the
+ // bottom of the view
+ Scroll(0, y - (yEnd - yStart));
+ }
+ }
+ }
+
+ // scroll the position horizontally into view
+ //
+ // we follow what I believe to be Windows behaviour here, that is if
+ // the position is already entirely in the view we do nothing, but if
+ // we do have to scroll the window to bring it into view, we scroll it
+ // not just enough to show the position but slightly more so that this
+ // position is at 1/3 of the window width from the closest border to it
+ // (I'm not sure that Windows does exactly this but it looks like this)
+ if ( MData().m_scrollRangeX )
+ {
+ // unlike for the rows, xStart doesn't correspond to the starting
+ // column as they all have different widths, so we need to
+ // translate everything to pixels
+
+ // we want the text between x and x2 be entirely inside the view
+ // (i.e. the current character)
+
+ // make xStart the first visible pixel (and not position)
+ int wChar = GetAverageWidth();
+ xStart *= wChar;
+
+ if ( x < xStart )
+ {
+ // we want the position of this column be 1/3 to the right of
+ // the left edge
+ x -= rectText.width / 3;
+ if ( x < 0 )
+ x = 0;
+ Scroll(x / wChar, y);
+ }
+ else // maybe we're beyond the right border of the view?
+ {
+ wxTextCoord col, row;
+ if ( PositionToXY(pos, &col, &row) )
+ {
+ wxString lineText = GetLineText(row);
+ wxCoord x2 = x + GetTextWidth(lineText[(size_t)col]);
+ if ( x2 > xStart + rectText.width )
+ {
+ // we want the position of this column be 1/3 to the
+ // left of the right edge, i.e. 2/3 right of the left
+ // one
+ x2 -= (2*rectText.width)/3;
+ if ( x2 < 0 )
+ x2 = 0;
+ Scroll(x2 / wChar, row);
+ }
+ }
+ }
+ }
+ }
+ //else: multiline but no scrollbars, hence nothing to do
+
+ ShowCaret();
+}
+
+// ----------------------------------------------------------------------------
+// word stuff
+// ----------------------------------------------------------------------------
+
+/*
+ TODO: we could have (easy to do) vi-like options for word movement, i.e.
+ distinguish between inlusive/exclusive words and between words and
+ WORDS (in vim sense) and also, finally, make the set of characters
+ which make up a word configurable - currently we use the exclusive
+ WORDS only (coincidentally, this is what Windows edit control does)
+
+ For future references, here is what vim help says:
+
+ A word consists of a sequence of letters, digits and underscores, or
+ a sequence of other non-blank characters, separated with white space
+ (spaces, tabs, <EOL>). This can be changed with the 'iskeyword'
+ option.
+
+ A WORD consists of a sequence of non-blank characters, separated with
+ white space. An empty line is also considered to be a word and a
+ WORD.
+ */
+
+static inline bool IsWordChar(wxChar ch)
+{
+ return !wxIsspace(ch);
+}
+
+wxTextPos wxTextCtrl::GetWordStart() const
+{
+ if ( m_curPos == -1 || m_curPos == 0 )
+ return 0;
+
+ if ( m_curCol == 0 )
+ {
+ // go to the end of the previous line
+ return m_curPos - 1;
+ }
+
+ // it shouldn't be possible to learn where the word starts in the password
+ // text entry zone
+ if ( IsPassword() )
+ return 0;
+
+ // start at the previous position
+ const wxChar *p0 = GetLineText(m_curRow).c_str();
+ const wxChar *p = p0 + m_curCol - 1;
+
+ // find the end of the previous word
+ while ( (p > p0) && !IsWordChar(*p) )
+ p--;
+
+ // now find the beginning of this word
+ while ( (p > p0) && IsWordChar(*p) )
+ p--;
+
+ // we might have gone too far
+ if ( !IsWordChar(*p) )
+ p++;
+
+ return (m_curPos - m_curCol) + p - p0;
+}
+
+wxTextPos wxTextCtrl::GetWordEnd() const
+{
+ if ( m_curPos == -1 )
+ return 0;
+
+ wxString line = GetLineText(m_curRow);
+ if ( (size_t)m_curCol == line.length() )
+ {
+ // if we're on the last position in the line, go to the next one - if
+ // it exists
+ wxTextPos pos = m_curPos;
+ if ( pos < GetLastPosition() )
+ pos++;
+
+ return pos;
+ }
+
+ // it shouldn't be possible to learn where the word ends in the password
+ // text entry zone
+ if ( IsPassword() )
+ return GetLastPosition();
+
+ // start at the current position
+ const wxChar *p0 = line.c_str();
+ const wxChar *p = p0 + m_curCol;
+
+ // find the start of the next word
+ while ( *p && !IsWordChar(*p) )
+ p++;
+
+ // now find the end of it
+ while ( *p && IsWordChar(*p) )
+ p++;
+
+ // and find the start of the next word
+ while ( *p && !IsWordChar(*p) )
+ p++;
+
+ return (m_curPos - m_curCol) + p - p0;
+}
+
+// ----------------------------------------------------------------------------
+// clipboard stuff
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::Copy()
+{
+#if wxUSE_CLIPBOARD
+ if ( HasSelection() )
+ {
+ wxClipboardLocker clipLock;
+
+ // wxTextFile::Translate() is needed to transform all '\n' into "\r\n"
+ wxString text = wxTextFile::Translate(GetTextToShow(GetSelectionText()));
+ wxTextDataObject *data = new wxTextDataObject(text);
+ wxTheClipboard->SetData(data);
+ }
+#endif // wxUSE_CLIPBOARD
+}
+
+void wxTextCtrl::Cut()
+{
+ (void)DoCut();
+}
+
+bool wxTextCtrl::DoCut()
+{
+ if ( !HasSelection() )
+ return FALSE;
+
+ Copy();
+
+ RemoveSelection();
+
+ return TRUE;
+}
+
+void wxTextCtrl::Paste()
+{
+ (void)DoPaste();
+}
+
+bool wxTextCtrl::DoPaste()
+{
+#if wxUSE_CLIPBOARD
+ wxClipboardLocker clipLock;
+
+ wxTextDataObject data;
+ if ( wxTheClipboard->IsSupported(data.GetFormat())
+ && wxTheClipboard->GetData(data) )
+ {
+ // reverse transformation: '\r\n\" -> '\n'
+ wxString text = wxTextFile::Translate(data.GetText(),
+ wxTextFileType_Unix);
+ if ( !text.empty() )
+ {
+ WriteText(text);
+
+ return TRUE;
+ }
+ }
+#endif // wxUSE_CLIPBOARD
+
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// Undo and redo
+// ----------------------------------------------------------------------------
+
+wxTextCtrlInsertCommand *
+wxTextCtrlCommandProcessor::IsInsertCommand(wxCommand *command)
+{
+ return (wxTextCtrlInsertCommand *)
+ (command && (command->GetName() == wxTEXT_COMMAND_INSERT)
+ ? command : NULL);
+}
+
+void wxTextCtrlCommandProcessor::Store(wxCommand *command)
+{
+ wxTextCtrlInsertCommand *cmdIns = IsInsertCommand(command);
+ if ( cmdIns )
+ {
+ if ( IsCompressing() )
+ {
+ wxTextCtrlInsertCommand *
+ cmdInsLast = IsInsertCommand(GetCurrentCommand());
+
+ // it is possible that we don't have any last command at all if,
+ // for example, it was undone since the last Store(), so deal with
+ // this case too
+ if ( cmdInsLast )
+ {
+ cmdInsLast->Append(cmdIns);
+
+ delete cmdIns;
+
+ // don't need to call the base class version
+ return;
+ }
+ }
+
+ // append the following insert commands to this one
+ m_compressInserts = TRUE;
+
+ // let the base class version will do the job normally
+ }
+ else // not an insert command
+ {
+ // stop compressing insert commands - this won't work with the last
+ // command not being an insert one anyhow
+ StopCompressing();
+
+ // let the base class version will do the job normally
+ }
+
+ wxCommandProcessor::Store(command);
+}
+
+void wxTextCtrlInsertCommand::Append(wxTextCtrlInsertCommand *other)
+{
+ m_text += other->m_text;
+}
+
+bool wxTextCtrlInsertCommand::CanUndo() const
+{
+ return m_from != -1;
+}
+
+bool wxTextCtrlInsertCommand::Do(wxTextCtrl *text)
+{
+ // the text is going to be inserted at the current position, remember where
+ // exactly it is
+ m_from = text->GetInsertionPoint();
+
+ // and now do insert it
+ text->WriteText(m_text);
+
+ return TRUE;
+}
+
+bool wxTextCtrlInsertCommand::Undo(wxTextCtrl *text)
+{
+ wxCHECK_MSG( CanUndo(), FALSE, _T("impossible to undo insert cmd") );
+
+ // remove the text from where we inserted it
+ text->Remove(m_from, m_from + m_text.length());
+
+ return TRUE;
+}
+
+bool wxTextCtrlRemoveCommand::CanUndo() const
+{
+ // if we were executed, we should have the text we removed
+ return !m_textDeleted.empty();
+}
+
+bool wxTextCtrlRemoveCommand::Do(wxTextCtrl *text)
+{
+ text->SetSelection(m_from, m_to);
+ m_textDeleted = text->GetSelectionText();
+ text->RemoveSelection();
+
+ return TRUE;
+}
+
+bool wxTextCtrlRemoveCommand::Undo(wxTextCtrl *text)
+{
+ // it is possible that the text was deleted and that we can't restore text
+ // at the same position we removed it any more
+ wxTextPos posLast = text->GetLastPosition();
+ text->SetInsertionPoint(m_from > posLast ? posLast : m_from);
+ text->WriteText(m_textDeleted);
+
+ return TRUE;
+}
+
+void wxTextCtrl::Undo()
+{
+ // the caller must check it
+ wxASSERT_MSG( CanUndo(), _T("can't call Undo() if !CanUndo()") );
+
+ m_cmdProcessor->Undo();
+}
+
+void wxTextCtrl::Redo()
+{
+ // the caller must check it
+ wxASSERT_MSG( CanRedo(), _T("can't call Undo() if !CanUndo()") );
+
+ m_cmdProcessor->Redo();
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+ return IsEditable() && m_cmdProcessor->CanUndo();
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+ return IsEditable() && m_cmdProcessor->CanRedo();
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxTextCtrl::DoGetBestClientSize() const
+{
+ // when we're called for the very first time from Create() we must
+ // calculate the font metrics here because we can't do it before calling
+ // Create() (there is no window yet and wxGTK crashes) but we need them
+ // here
+ if ( m_heightLine == -1 )
+ {
+ wxConstCast(this, wxTextCtrl)->RecalcFontMetrics();
+ }
+
+ wxCoord w, h;
+ GetTextExtent(GetTextToShow(GetLineText(0)), &w, &h);
+
+ int wChar = GetAverageWidth(),
+ hChar = GetLineHeight();
+
+ int widthMin = wxMax(10*wChar, 100);
+ if ( w < widthMin )
+ w = widthMin;
+ if ( h < hChar )
+ h = hChar;
+
+ if ( !IsSingleLine() )
+ {
+ // let the control have a reasonable number of lines
+ int lines = GetNumberOfLines();
+ if ( lines < 5 )
+ lines = 5;
+ else if ( lines > 10 )
+ lines = 10;
+ h *= 10;
+ }
+
+ wxRect rectText;
+ rectText.width = w;
+ rectText.height = h;
+ wxRect rectTotal = GetRenderer()->GetTextTotalArea(this, rectText);
+ return wxSize(rectTotal.width, rectTotal.height);
+}
+
+void wxTextCtrl::UpdateTextRect()
+{
+ wxRect rectTotal(wxPoint(0, 0), GetClientSize());
+ wxCoord *extraSpace = WrapLines() ? &WData().m_widthMark : NULL;
+ m_rectText = GetRenderer()->GetTextClientArea(this, rectTotal, extraSpace);
+
+ // code elsewhere is confused by negative rect size
+ if ( m_rectText.width <= 0 )
+ m_rectText.width = 1;
+ if ( m_rectText.height <= 0 )
+ m_rectText.height = 1;
+
+ if ( !IsSingleLine() )
+ {
+ // invalidate it so that GetRealTextArea() will recalc it
+ MData().m_rectTextReal.width = 0;
+
+ // only scroll this rect when the window is scrolled: note that we have
+ // to scroll not only the text but the line wrap marks too if we show
+ // them
+ wxRect rectText = GetRealTextArea();
+ if ( extraSpace && *extraSpace )
+ {
+ rectText.width += *extraSpace;
+ }
+ SetTargetRect(rectText);
+
+ // relayout all lines
+ if ( WrapLines() )
+ {
+ WData().m_rowFirstInvalid = 0;
+
+ // increase timestamp: this means that the lines which had been
+ // laid out before will be relayd out the next time LayoutLines()
+ // is called because their timestamp will be smaller than the
+ // current one
+ WData().m_timestamp++;
+ }
+ }
+
+ UpdateLastVisible();
+}
+
+void wxTextCtrl::UpdateLastVisible()
+{
+ // this method is only used for horizontal "scrollbarless" scrolling which
+ // is used only with single line controls
+ if ( !IsSingleLine() )
+ return;
+
+ // use (efficient) HitTestLine to find the last visible character
+ wxString text = m_value.Mid((size_t)SData().m_colStart /* to the end */);
+ wxTextCoord col;
+ switch ( HitTestLine(text, m_rectText.width, &col) )
+ {
+ case wxTE_HT_BEYOND:
+ // everything is visible
+ SData().m_colLastVisible = text.length();
+
+ // calc it below
+ SData().m_posLastVisible = -1;
+ break;
+
+ /*
+ case wxTE_HT_BEFORE:
+ case wxTE_HT_BELOW:
+ */
+ default:
+ wxFAIL_MSG(_T("unexpected HitTestLine() return value"));
+ // fall through
+
+ case wxTE_HT_ON_TEXT:
+ if ( col > 0 )
+ {
+ // the last entirely seen character is the previous one because
+ // this one is only partly visible - unless the width of the
+ // string is exactly the max width
+ SData().m_posLastVisible = GetTextWidth(text.Truncate(col + 1));
+ if ( SData().m_posLastVisible > m_rectText.width )
+ {
+ // this character is not entirely visible, take the
+ // previous one
+ col--;
+
+ // recalc it
+ SData().m_posLastVisible = -1;
+ }
+ //else: we can just see it
+
+ SData().m_colLastVisible = col;
+ }
+ break;
+ }
+
+ // calculate the width of the text really shown
+ if ( SData().m_posLastVisible == -1 )
+ {
+ SData().m_posLastVisible = GetTextWidth(text.Truncate(SData().m_colLastVisible + 1));
+ }
+
+ // current value is relative the start of the string text which starts at
+ // SData().m_colStart, we need an absolute offset into string
+ SData().m_colLastVisible += SData().m_colStart;
+
+ wxLogTrace(_T("text"), _T("Last visible column/position is %d/%ld"),
+ SData().m_colLastVisible, SData().m_posLastVisible);
+}
+
+void wxTextCtrl::OnSize(wxSizeEvent& event)
+{
+ UpdateTextRect();
+
+ if ( !IsSingleLine() )
+ {
+#if 0
+ // update them immediately because if we are called for the first time,
+ // we need to create them in order for the base class version to
+ // position the scrollbars correctly - if we don't do it now, it won't
+ // happen at all if we don't get more size events
+ UpdateScrollbars();
+#endif // 0
+
+ MData().m_updateScrollbarX =
+ MData().m_updateScrollbarY = TRUE;
+ }
+
+ event.Skip();
+}
+
+wxCoord wxTextCtrl::GetTotalWidth() const
+{
+ wxCoord w;
+ CalcUnscrolledPosition(m_rectText.width, 0, &w, NULL);
+ return w;
+}
+
+wxCoord wxTextCtrl::GetTextWidth(const wxString& text) const
+{
+ wxCoord w;
+ GetTextExtent(GetTextToShow(text), &w, NULL);
+ return w;
+}
+
+wxRect wxTextCtrl::GetRealTextArea() const
+{
+ // for single line text control it's just the same as text rect
+ if ( IsSingleLine() )
+ return m_rectText;
+
+ // the real text area always holds an entire number of lines, so the only
+ // difference with the text area is a narrow strip along the bottom border
+ wxRect rectText = MData().m_rectTextReal;
+ if ( !rectText.width )
+ {
+ // recalculate it
+ rectText = m_rectText;
+
+ // when we're called for the very first time, the line height might not
+ // had been calculated yet, so do get it now
+ wxTextCtrl *self = wxConstCast(this, wxTextCtrl);
+ self->RecalcFontMetrics();
+
+ int hLine = GetLineHeight();
+ rectText.height = (m_rectText.height / hLine) * hLine;
+
+ // cache the result
+ self->MData().m_rectTextReal = rectText;
+ }
+
+ return rectText;
+}
+
+wxTextCoord wxTextCtrl::GetRowInLine(wxTextCoord line,
+ wxTextCoord col,
+ wxTextCoord *colRowStart) const
+{
+ wxASSERT_MSG( WrapLines(), _T("shouldn't be called") );
+
+ const wxWrappedLineData& lineData = WData().m_linesData[line];
+
+ if ( !WData().IsValidLine(line) )
+ LayoutLines(line);
+
+ // row is here counted a bit specially: 0 is the 2nd row of the line (1st
+ // extra row)
+ size_t row = 0,
+ rowMax = lineData.GetExtraRowCount();
+ if ( rowMax )
+ {
+ row = 0;
+ while ( (row < rowMax) && (col >= lineData.GetExtraRowStart(row)) )
+ row++;
+
+ // it's ok here that row is 1 greater than needed: like this, it is
+ // counted as a normal (and not extra) row
+ }
+ //else: only one row anyhow
+
+ if ( colRowStart )
+ {
+ // +1 because we need a real row number, not the extra row one
+ *colRowStart = lineData.GetRowStart(row);
+
+ // this can't happen, of course
+ wxASSERT_MSG( *colRowStart <= col, _T("GetRowInLine() is broken") );
+ }
+
+ return row;
+}
+
+void wxTextCtrl::LayoutLine(wxTextCoord line, wxWrappedLineData& lineData) const
+{
+ // FIXME: this uses old GetPartOfWrappedLine() which is not used anywhere
+ // else now and has rather awkward interface for our needs here
+
+ lineData.m_rowsStart.Empty();
+ lineData.m_rowsWidth.Empty();
+
+ const wxString& text = GetLineText(line);
+ wxCoord widthRow;
+ size_t colRowStart = 0;
+ do
+ {
+ size_t lenRow = GetPartOfWrappedLine
+ (
+ text.c_str() + colRowStart,
+ &widthRow
+ );
+
+ // remember the start of this row (not for the first one as
+ // it's always 0) and its width
+ if ( colRowStart )
+ lineData.m_rowsStart.Add(colRowStart);
+ lineData.m_rowsWidth.Add(widthRow);
+
+ colRowStart += lenRow;
+ }
+ while ( colRowStart < text.length() );
+
+ // put the current timestamp on it
+ lineData.m_timestamp = WData().m_timestamp;
+}
+
+void wxTextCtrl::LayoutLines(wxTextCoord lineLast) const
+{
+ wxASSERT_MSG( WrapLines(), _T("should only be used for line wrapping") );
+
+ // if we were called, some line was dirty and if it was dirty we must have
+ // had m_rowFirstInvalid set to something too
+ wxTextCoord lineFirst = WData().m_rowFirstInvalid;
+ wxASSERT_MSG( lineFirst != -1, _T("nothing to layout?") );
+
+ wxTextCoord rowFirst, rowCur;
+ if ( lineFirst )
+ {
+ // start after the last known valid line
+ const wxWrappedLineData& lineData = WData().m_linesData[lineFirst - 1];
+ rowFirst = lineData.GetFirstRow() + lineData.GetRowCount();
+ }
+ else // no valid lines, start at row 0
+ {
+ rowFirst = 0;
+ }
+
+ rowCur = rowFirst;
+ for ( wxTextCoord line = lineFirst; line <= lineLast; line++ )
+ {
+ // set the starting row for this line
+ wxWrappedLineData& lineData = WData().m_linesData[line];
+ lineData.m_rowFirst = rowCur;
+
+ // had the line been already broken into rows?
+ //
+ // if so, compare its timestamp with the current one: if nothing has
+ // been changed, don't relayout it
+ if ( !lineData.IsValid() ||
+ (lineData.m_timestamp < WData().m_timestamp) )
+ {
+ // now do break it in rows
+ LayoutLine(line, lineData);
+ }
+
+ rowCur += lineData.GetRowCount();
+ }
+
+ // we are now valid at least up to this line, but if it is the last one we
+ // just don't have any more invalid rows at all
+ if ( (size_t)lineLast == WData().m_linesData.GetCount() -1 )
+ {
+ lineLast = -1;
+ }
+
+ wxTextCtrl *self = wxConstCast(this, wxTextCtrl);
+ self->WData().m_rowFirstInvalid = lineLast;
+
+ // also refresh the line end indicators (FIXME shouldn't do it always!)
+ self->RefreshLineWrapMarks(rowFirst, rowCur);
+}
+
+size_t wxTextCtrl::GetPartOfWrappedLine(const wxChar* text,
+ wxCoord *widthReal) const
+{
+ // this function is slow, it shouldn't be called unless really needed
+ wxASSERT_MSG( WrapLines(), _T("shouldn't be called") );
+
+ wxString s(text);
+ wxTextCoord col;
+ wxCoord wReal = -1;
+ switch ( HitTestLine(s, m_rectText.width, &col) )
+ {
+ /*
+ case wxTE_HT_BEFORE:
+ case wxTE_HT_BELOW:
+ */
+ default:
+ wxFAIL_MSG(_T("unexpected HitTestLine() return value"));
+ // fall through
+
+ case wxTE_HT_ON_TEXT:
+ if ( col > 0 )
+ {
+ // the last entirely seen character is the previous one because
+ // this one is only partly visible - unless the width of the
+ // string is exactly the max width
+ wReal = GetTextWidth(s.Truncate(col + 1));
+ if ( wReal > m_rectText.width )
+ {
+ // this character is not entirely visible, take the
+ // previous one
+ col--;
+
+ // recalc the width
+ wReal = -1;
+ }
+ //else: we can just see it
+
+ // wrap at any character or only at words boundaries?
+ if ( !(GetWindowStyle() & wxTE_LINEWRAP) )
+ {
+ // find the (last) not word char before this word
+ wxTextCoord colWordStart;
+ for ( colWordStart = col;
+ colWordStart && IsWordChar(s[(size_t)colWordStart]);
+ colWordStart-- )
+ ;
+
+ if ( colWordStart > 0 )
+ {
+ if ( colWordStart != col )
+ {
+ // will have to recalc the real width
+ wReal = -1;
+
+ col = colWordStart;
+ }
+ }
+ //else: only a single word, have to wrap it here
+ }
+ }
+ break;
+
+ case wxTE_HT_BEYOND:
+ break;
+ }
+
+ // we return the number of characters, not the index of the last one
+ if ( (size_t)col < s.length() )
+ {
+ // but don't return more than this (empty) string has
+ col++;
+ }
+
+ if ( widthReal )
+ {
+ if ( wReal == -1 )
+ {
+ // calc it if not done yet
+ wReal = GetTextWidth(s.Truncate(col));
+ }
+
+ *widthReal = wReal;
+ }
+
+ // VZ: old, horribly inefficient code which can still be used for checking
+ // the result (in line, not word, wrap mode only) - to be removed later
+#if 0
+ wxTextCtrl *self = wxConstCast(this, wxTextCtrl);
+ wxClientDC dc(self);
+ dc.SetFont(GetFont());
+ self->DoPrepareDC(dc);
+
+ wxCoord widthMax = m_rectText.width;
+
+ // the text which we can keep in this ROW
+ wxString str;
+ wxCoord w, wOld;
+ for ( wOld = w = 0; *text && (w <= widthMax); )
+ {
+ wOld = w;
+ str += *text++;
+ dc.GetTextExtent(str, &w, NULL);
+ }
+
+ if ( w > widthMax )
+ {
+ // if we wrapped, the last letter was one too much
+ if ( str.length() > 1 )
+ {
+ // remove it
+ str.erase(str.length() - 1, 1);
+ }
+ else // but always keep at least one letter in each row
+ {
+ // the real width then is the last value of w and not teh one
+ // before last
+ wOld = w;
+ }
+ }
+ else // we didn't wrap
+ {
+ wOld = w;
+ }
+
+ wxASSERT( col == str.length() );
+
+ if ( widthReal )
+ {
+ wxASSERT( *widthReal == wOld );
+
+ *widthReal = wOld;
+ }
+
+ //return str.length();
+#endif
+
+ return col;
+}
+
+// OPT: this function is called a lot - would be nice to optimize it but I
+// don't really know how yet
+wxTextCtrlHitTestResult wxTextCtrl::HitTestLine(const wxString& line,
+ wxCoord x,
+ wxTextCoord *colOut) const
+{
+ wxTextCtrlHitTestResult res = wxTE_HT_ON_TEXT;
+
+ int col;
+ wxTextCtrl *self = wxConstCast(this, wxTextCtrl);
+ wxClientDC dc(self);
+ dc.SetFont(GetFont());
+ self->DoPrepareDC(dc);
+
+ wxCoord width;
+ dc.GetTextExtent(line, &width, NULL);
+ if ( x >= width )
+ {
+ // clicking beyond the end of line is equivalent to clicking at
+ // the end of it, so return the last line column
+ col = line.length();
+ if ( col )
+ {
+ // unless the line is empty and so doesn't have any column at all -
+ // in this case return 0, what else can we do?
+ col--;
+ }
+
+ res = wxTE_HT_BEYOND;
+ }
+ else if ( x < 0 )
+ {
+ col = 0;
+
+ res = wxTE_HT_BEFORE;
+ }
+ else // we're inside the line
+ {
+ // now calculate the column: first, approximate it with fixed-width
+ // value and then calculate the correct value iteratively: note that
+ // we use the first character of the line instead of (average)
+ // GetCharWidth(): it is common to have lines of dashes, for example,
+ // and this should give us much better approximation in such case
+ //
+ // OPT: maybe using (cache) m_widthAvg would be still faster? profile!
+ dc.GetTextExtent(line[0], &width, NULL);
+
+ col = x / width;
+ if ( col < 0 )
+ {
+ col = 0;
+ }
+ else if ( (size_t)col > line.length() )
+ {
+ col = line.length();
+ }
+
+ // matchDir is the direction in which we should move to reach the
+ // character containing the given position
+ enum
+ {
+ Match_Left = -1,
+ Match_None = 0,
+ Match_Right = 1
+ } matchDir = Match_None;
+ for ( ;; )
+ {
+ // check that we didn't go beyond the line boundary
+ if ( col < 0 )
+ {
+ col = 0;
+ break;
+ }
+ if ( (size_t)col > line.length() )
+ {
+ col = line.length();
+ break;
+ }
+
+ wxString strBefore(line, (size_t)col);
+ dc.GetTextExtent(strBefore, &width, NULL);
+ if ( width > x )
+ {
+ if ( matchDir == Match_Right )
+ {
+ // we were going to the right and, finally, moved beyond
+ // the original position - stop on the previous one
+ col--;
+
+ break;
+ }
+
+ if ( matchDir == Match_None )
+ {
+ // we just started iterating, now we know that we should
+ // move to the left
+ matchDir = Match_Left;
+ }
+ //else: we are still to the right of the target, continue
+ }
+ else // width < x
+ {
+ // invert the logic above
+ if ( matchDir == Match_Left )
+ {
+ // with the exception that we don't need to backtrack here
+ break;
+ }
+
+ if ( matchDir == Match_None )
+ {
+ // go to the right
+ matchDir = Match_Right;
+ }
+ }
+
+ // this is not supposed to happen
+ wxASSERT_MSG( matchDir, _T("logic error in wxTextCtrl::HitTest") );
+
+ if ( matchDir == Match_Right )
+ col++;
+ else
+ col--;
+ }
+ }
+
+ // check that we calculated it correctly
+#ifdef WXDEBUG_TEXT
+ if ( res == wxTE_HT_ON_TEXT )
+ {
+ wxCoord width1;
+ wxString text = line.Left(col);
+ dc.GetTextExtent(text, &width1, NULL);
+ if ( (size_t)col < line.length() )
+ {
+ wxCoord width2;
+
+ text += line[col];
+ dc.GetTextExtent(text, &width2, NULL);
+
+ wxASSERT_MSG( (width1 <= x) && (x < width2),
+ _T("incorrect HitTestLine() result") );
+ }
+ else // we return last char
+ {
+ wxASSERT_MSG( x >= width1, _T("incorrect HitTestLine() result") );
+ }
+ }
+#endif // WXDEBUG_TEXT
+
+ if ( colOut )
+ *colOut = col;
+
+ return res;
+}
+
+wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pos,
+ wxTextCoord *colOut,
+ wxTextCoord *rowOut) const
+{
+ return HitTest2(pos.y, pos.x, 0, rowOut, colOut, NULL, NULL);
+}
+
+wxTextCtrlHitTestResult wxTextCtrl::HitTestLogical(const wxPoint& pos,
+ wxTextCoord *colOut,
+ wxTextCoord *rowOut) const
+{
+ return HitTest2(pos.y, pos.x, 0, rowOut, colOut, NULL, NULL, FALSE);
+}
+
+wxTextCtrlHitTestResult wxTextCtrl::HitTest2(wxCoord y0,
+ wxCoord x10,
+ wxCoord x20,
+ wxTextCoord *rowOut,
+ wxTextCoord *colStart,
+ wxTextCoord *colEnd,
+ wxTextCoord *colRowStartOut,
+ bool deviceCoords) const
+{
+ // is the point in the text area or to the right or below it?
+ wxTextCtrlHitTestResult res = wxTE_HT_ON_TEXT;
+
+ // translate the window coords x0 and y0 into the client coords in the text
+ // area by adjusting for both the client and text area offsets (unless this
+ // was already done)
+ int x1, y;
+ if ( deviceCoords )
+ {
+ wxPoint pt = GetClientAreaOrigin() + m_rectText.GetPosition();
+ CalcUnscrolledPosition(x10 - pt.x, y0 - pt.y, &x1, &y);
+ }
+ else
+ {
+ y = y0;
+ x1 = x10;
+ }
+
+ // calculate the row (it is really a LINE, not a ROW)
+ wxTextCoord row;
+
+ // these vars are used only for WrapLines() case
+ wxTextCoord colRowStart = 0;
+ size_t rowLen = 0;
+
+ if ( colRowStartOut )
+ *colRowStartOut = 0;
+
+ int hLine = GetLineHeight();
+ if ( y < 0 )
+ {
+ // and clicking before it is the same as clicking on the first one
+ row = 0;
+
+ res = wxTE_HT_BEFORE;
+ }
+ else // y >= 0
+ {
+ wxTextCoord rowLast = GetNumberOfLines() - 1;
+ row = y / hLine;
+ if ( IsSingleLine() || !WrapLines() )
+ {
+ // in this case row calculation is simple as all lines have the
+ // same height and so row is the same as line
+ if ( row > rowLast )
+ {
+ // clicking below the text is the same as clicking on the last
+ // line
+ row = rowLast;
+
+ res = wxTE_HT_BELOW;
+ }
+ }
+ else // multline control with line wrap
+ {
+ // use binary search to find the line containing this row
+ const wxArrayWrappedLinesData& linesData = WData().m_linesData;
+ size_t lo = 0,
+ hi = linesData.GetCount(),
+ cur;
+ while ( lo < hi )
+ {
+ cur = (lo + hi)/2;
+ const wxWrappedLineData& lineData = linesData[cur];
+ if ( !WData().IsValidLine(cur) )
+ LayoutLines(cur);
+ wxTextCoord rowFirst = lineData.GetFirstRow();
+
+ if ( row < rowFirst )
+ {
+ hi = cur;
+ }
+ else
+ {
+ // our row is after the first row of the cur line:
+ // obviously, if cur is the last line, it contains this
+ // row, otherwise we have to test that it is before the
+ // first row of the next line
+ bool found = cur == linesData.GetCount() - 1;
+ if ( found )
+ {
+ // if the row is beyond the end of text, adjust it to
+ // be the last one and set res accordingly
+ if ( (size_t)(row - rowFirst) >= lineData.GetRowCount() )
+ {
+ res = wxTE_HT_BELOW;
+
+ row = lineData.GetRowCount() + rowFirst - 1;
+ }
+ }
+ else // not the last row
+ {
+ const wxWrappedLineData&
+ lineNextData = linesData[cur + 1];
+ if ( !WData().IsValidLine(cur + 1) )
+ LayoutLines(cur + 1);
+ found = row < lineNextData.GetFirstRow();
+ }
+
+ if ( found )
+ {
+ colRowStart = lineData.GetRowStart(row - rowFirst);
+ rowLen = lineData.GetRowLength(row - rowFirst,
+ GetLines()[cur].length());
+ row = cur;
+
+ break;
+ }
+ else
+ {
+ lo = cur;
+ }
+ }
+ }
+ }
+ }
+
+ if ( res == wxTE_HT_ON_TEXT )
+ {
+ // now find the position in the line
+ wxString lineText = GetLineText(row),
+ rowText;
+
+ if ( colRowStart || rowLen )
+ {
+ // look in this row only, not in whole line
+ rowText = lineText.Mid(colRowStart, rowLen);
+ }
+ else
+ {
+ // just take the whole string
+ rowText = lineText;
+ }
+
+ if ( colStart )
+ {
+ res = HitTestLine(GetTextToShow(rowText), x1, colStart);
+
+ if ( colRowStart )
+ {
+ if ( colRowStartOut )
+ {
+ // give them the column offset in this ROW in pixels
+ *colRowStartOut = colRowStart;
+ }
+
+ // take into account that the ROW doesn't start in the
+ // beginning of the LINE
+ *colStart += colRowStart;
+ }
+
+ if ( colEnd )
+ {
+ // the hit test result we return is for x1, so throw out
+ // the result for x2 here
+ int x2 = x1 + x20 - x10;
+ (void)HitTestLine(GetTextToShow(rowText), x2, colEnd);
+
+ *colEnd += colRowStart;
+ }
+ }
+ }
+ else // before/after vertical text span
+ {
+ if ( colStart )
+ {
+ // fill the column with the first/last position in the
+ // corresponding line
+ if ( res == wxTE_HT_BEFORE )
+ *colStart = 0;
+ else // res == wxTE_HT_BELOW
+ *colStart = GetLineText(GetNumberOfLines() - 1).length();
+ }
+ }
+
+ if ( rowOut )
+ {
+ // give them the row in text coords (as is)
+ *rowOut = row;
+ }
+
+ return res;
+}
+
+bool wxTextCtrl::GetLineAndRow(wxTextCoord row,
+ wxTextCoord *lineOut,
+ wxTextCoord *rowInLineOut) const
+{
+ wxTextCoord line,
+ rowInLine = 0;
+
+ if ( row < 0 )
+ return FALSE;
+
+ int nLines = GetNumberOfLines();
+ if ( WrapLines() )
+ {
+ const wxArrayWrappedLinesData& linesData = WData().m_linesData;
+ for ( line = 0; line < nLines; line++ )
+ {
+ if ( !WData().IsValidLine(line) )
+ LayoutLines(line);
+
+ if ( row < linesData[line].GetNextRow() )
+ {
+ // we found the right line
+ rowInLine = row - linesData[line].GetFirstRow();
+
+ break;
+ }
+ }
+
+ if ( line == nLines )
+ {
+ // the row is out of range
+ return FALSE;
+ }
+ }
+ else // no line wrapping, everything is easy
+ {
+ if ( row >= nLines )
+ return FALSE;
+
+ line = row;
+ }
+
+ if ( lineOut )
+ *lineOut = line;
+ if ( rowInLineOut )
+ *rowInLineOut = rowInLine;
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// scrolling
+// ----------------------------------------------------------------------------
+
+/*
+ wxTextCtrl has not one but two scrolling mechanisms: one is semi-automatic
+ scrolling in both horizontal and vertical direction implemented using
+ wxScrollHelper and the second one is manual scrolling implemented using
+ SData().m_ofsHorz and used by the single line controls without scroll bar.
+
+ The first version (the standard one) always scrolls by fixed amount which is
+ fine for vertical scrolling as all lines have the same height but is rather
+ ugly for horizontal scrolling if proportional font is used. This is why we
+ manually update and use SData().m_ofsHorz which contains the length of the string
+ which is hidden beyond the left borde. An important property of text
+ controls using this kind of scrolling is that an entire number of characters
+ is always shown and that parts of characters never appear on display -
+ neither in the leftmost nor rightmost positions.
+
+ Once again, for multi line controls SData().m_ofsHorz is always 0 and scrolling is
+ done as usual for wxScrollWindow.
+ */
+
+void wxTextCtrl::ShowHorzPosition(wxCoord pos)
+{
+ wxASSERT_MSG( IsSingleLine(), _T("doesn't work for multiline") );
+
+ // pos is the logical position to show
+
+ // SData().m_ofsHorz is the fisrt logical position shown
+ if ( pos < SData().m_ofsHorz )
+ {
+ // scroll backwards
+ wxTextCoord col;
+ HitTestLine(m_value, pos, &col);
+ ScrollText(col);
+ }
+ else
+ {
+ wxCoord width = m_rectText.width;
+ if ( !width )
+ {
+ // if we are called from the ctor, m_rectText is not initialized
+ // yet, so do it now
+ UpdateTextRect();
+ width = m_rectText.width;
+ }
+
+ // SData().m_ofsHorz + width is the last logical position shown
+ if ( pos > SData().m_ofsHorz + width)
+ {
+ // scroll forward
+ wxTextCoord col;
+ HitTestLine(m_value, pos - width, &col);
+ ScrollText(col + 1);
+ }
+ }
+}
+
+// scroll the window horizontally so that the first visible character becomes
+// the one at this position
+void wxTextCtrl::ScrollText(wxTextCoord col)
+{
+ wxASSERT_MSG( IsSingleLine(),
+ _T("ScrollText() is for single line controls only") );
+
+ // never scroll beyond the left border
+ if ( col < 0 )
+ col = 0;
+
+ // OPT: could only get the extent of the part of the string between col
+ // and SData().m_colStart
+ wxCoord ofsHorz = GetTextWidth(GetLineText(0).Left(col));
+
+ if ( ofsHorz != SData().m_ofsHorz )
+ {
+ // remember the last currently used pixel
+ int posLastVisible = SData().m_posLastVisible;
+ if ( posLastVisible == -1 )
+ {
+ // this may happen when we're called very early, during the
+ // controls construction
+ UpdateLastVisible();
+
+ posLastVisible = SData().m_posLastVisible;
+ }
+
+ // NB1: to scroll to the right, offset must be negative, hence the
+ // order of operands
+ int dx = SData().m_ofsHorz - ofsHorz;
+
+ // NB2: we call Refresh() below which results in a call to
+ // DoDraw(), so we must update SData().m_ofsHorz before calling it
+ SData().m_ofsHorz = ofsHorz;
+ SData().m_colStart = col;
+
+ // after changing m_colStart, recalc the last visible position: we need
+ // to recalc the last visible position beore scrolling in order to make
+ // it appear exactly at the right edge of the text area after scrolling
+ UpdateLastVisible();
+
+#if 0 // do we?
+ if ( dx < 0 )
+ {
+ // we want to force the update of it after scrolling
+ SData().m_colLastVisible = -1;
+ }
+#endif
+
+ // scroll only the rectangle inside which there is the text
+ wxRect rect = m_rectText;
+ rect.width = posLastVisible;
+
+ rect = ScrollNoRefresh(dx, 0, &rect);
+
+ /*
+ we need to manually refresh the part which ScrollWindow() doesn't
+ refresh (with new API this means the part outside the rect returned
+ by ScrollNoRefresh): indeed, if we had this:
+
+ ********o
+
+ where '*' is text and 'o' is blank area at the end (too small to
+ hold the next char) then after scrolling by 2 positions to the left
+ we're going to have
+
+ ******RRo
+
+ where 'R' is the area refreshed by ScrollWindow() - but we still
+ need to refresh the 'o' at the end as it may be now big enough to
+ hold the new character shifted into view.
+
+ when we are scrolling to the right, we need to update this rect as
+ well because it might have contained something before but doesn't
+ contain anything any more
+ */
+
+ // we can combine both rectangles into one when scrolling to the left,
+ // but we need two separate Refreshes() otherwise
+ if ( dx > 0 )
+ {
+ // refresh the uncovered part on the left
+ Refresh(TRUE, &rect);
+
+ // and now the area on the right
+ rect.x = m_rectText.x + posLastVisible;
+ rect.width = m_rectText.width - posLastVisible;
+ }
+ else // scrolling to the left
+ {
+ // just extend the rect covering the uncovered area to the edge of
+ // the text rect
+ rect.width += m_rectText.width - posLastVisible;
+ }
+
+ Refresh(TRUE, &rect);
+
+ // I don't know exactly why is this needed here but without it we may
+ // scroll the window again (from the same method) before the previously
+ // invalidated area is repainted when typing *very* quickly - and this
+ // may lead to the display corruption
+ Update();
+ }
+}
+
+void wxTextCtrl::CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
+{
+ if ( IsSingleLine() )
+ {
+ // we don't use wxScrollHelper
+ if ( xx )
+ *xx = x + SData().m_ofsHorz;
+ if ( yy )
+ *yy = y;
+ }
+ else
+ {
+ // let the base class do it
+ wxScrollHelper::CalcUnscrolledPosition(x, y, xx, yy);
+ }
+}
+
+void wxTextCtrl::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
+{
+ if ( IsSingleLine() )
+ {
+ // we don't use wxScrollHelper
+ if ( xx )
+ *xx = x - SData().m_ofsHorz;
+ if ( yy )
+ *yy = y;
+ }
+ else
+ {
+ // let the base class do it
+ wxScrollHelper::CalcScrolledPosition(x, y, xx, yy);
+ }
+}
+
+void wxTextCtrl::DoPrepareDC(wxDC& dc)
+{
+ // for single line controls we only have to deal with SData().m_ofsHorz and it's
+ // useless to call base class version as they don't use normal scrolling
+ if ( IsSingleLine() && SData().m_ofsHorz )
+ {
+ // adjust the DC origin if the text is shifted
+ wxPoint pt = dc.GetDeviceOrigin();
+ dc.SetDeviceOrigin(pt.x - SData().m_ofsHorz, pt.y);
+ }
+ else
+ {
+ wxScrollHelper::DoPrepareDC(dc);
+ }
+}
+
+void wxTextCtrl::UpdateMaxWidth(wxTextCoord line)
+{
+ // OPT!
+
+ // check if the max width changes after this line was modified
+ wxCoord widthMaxOld = MData().m_widthMax,
+ width;
+ GetTextExtent(GetLineText(line), &width, NULL);
+
+ if ( line == MData().m_lineLongest )
+ {
+ // this line was the longest one, is it still?
+ if ( width > MData().m_widthMax )
+ {
+ MData().m_widthMax = width;
+ }
+ else if ( width < MData().m_widthMax )
+ {
+ // we need to find the new longest line
+ RecalcMaxWidth();
+ }
+ //else: its length didn't change, nothing to do
+ }
+ else // it wasn't the longest line, but maybe it became it?
+ {
+ // GetMaxWidth() and not MData().m_widthMax as it might be not calculated yet
+ if ( width > GetMaxWidth() )
+ {
+ MData().m_widthMax = width;
+ MData().m_lineLongest = line;
+ }
+ }
+
+ MData().m_updateScrollbarX = MData().m_widthMax != widthMaxOld;
+}
+
+void wxTextCtrl::RecalcFontMetrics()
+{
+ m_heightLine = GetCharHeight();
+ m_widthAvg = GetCharWidth();
+}
+
+void wxTextCtrl::RecalcMaxWidth()
+{
+ wxASSERT_MSG( !IsSingleLine(), _T("only used for multiline") );
+
+ MData().m_widthMax = -1;
+ (void)GetMaxWidth();
+}
+
+wxCoord wxTextCtrl::GetMaxWidth() const
+{
+ if ( MData().m_widthMax == -1 )
+ {
+ // recalculate it
+
+ // OPT: should we remember the widths of all the lines?
+
+ wxTextCtrl *self = wxConstCast(this, wxTextCtrl);
+ wxClientDC dc(self);
+ dc.SetFont(GetFont());
+
+ self->MData().m_widthMax = 0;
+
+ size_t count = GetLineCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ wxCoord width;
+ dc.GetTextExtent(GetLines()[n], &width, NULL);
+ if ( width > MData().m_widthMax )
+ {
+ // remember the width and the line which has it
+ self->MData().m_widthMax = width;
+ self->MData().m_lineLongest = n;
+ }
+ }
+ }
+
+ wxASSERT_MSG( MData().m_widthMax != -1, _T("should have at least 1 line") );
+
+ return MData().m_widthMax;
+}
+
+void wxTextCtrl::UpdateScrollbars()
+{
+ wxASSERT_MSG( !IsSingleLine(), _T("only used for multiline") );
+
+ wxSize size = GetRealTextArea().GetSize();
+
+ // is our height enough to show all items?
+ wxTextCoord nRows = GetRowCount();
+ wxCoord lineHeight = GetLineHeight();
+ bool showScrollbarY = nRows*lineHeight > size.y;
+
+ // is our width enough to show the longest line?
+ wxCoord charWidth, maxWidth;
+ bool showScrollbarX;
+ if ( !WrapLines() )
+ {
+ charWidth = GetAverageWidth();
+ maxWidth = GetMaxWidth();
+ showScrollbarX = maxWidth > size.x;
+ }
+ else // never show the horz scrollbar
+ {
+ // just to suppress compiler warnings about using uninit vars below
+ charWidth = maxWidth = 0;
+
+ showScrollbarX = FALSE;
+ }
+
+ // calc the scrollbars ranges
+ int scrollRangeX = showScrollbarX
+ ? (maxWidth + 2*charWidth - 1) / charWidth
+ : 0;
+ int scrollRangeY = showScrollbarY ? nRows : 0;
+
+ int scrollRangeXOld = MData().m_scrollRangeX,
+ scrollRangeYOld = MData().m_scrollRangeY;
+ if ( (scrollRangeY != scrollRangeYOld) || (scrollRangeX != scrollRangeXOld) )
+ {
+ int x, y;
+ GetViewStart(&x, &y);
+
+#if 0
+ // we want to leave the scrollbars at the same position which means
+ // that x and y have to be adjusted as the number of positions may have
+ // changed
+ //
+ // the number of positions is calculated from knowing that last
+ // position = range - thumbSize and thumbSize == pageSize which is
+ // equal to the window width / pixelsPerLine
+ if ( scrollRangeXOld )
+ {
+ x *= scrollRangeX - m_rectText.width / charWidth;
+ x /= scrollRangeXOld - m_rectText.width / charWidth;
+ }
+
+ if ( scrollRangeYOld )
+ y *= scrollRangeY / scrollRangeYOld;
+#endif // 0
+
+ SetScrollbars(charWidth, lineHeight,
+ scrollRangeX, scrollRangeY,
+ x, y,
+ TRUE /* no refresh */);
+
+ if ( scrollRangeXOld )
+ {
+ x *= scrollRangeX - m_rectText.width / charWidth;
+ x /= scrollRangeXOld - m_rectText.width / charWidth;
+ Scroll(x, y);
+ }
+
+ MData().m_scrollRangeX = scrollRangeX;
+ MData().m_scrollRangeY = scrollRangeY;
+
+ // bring the current position in view
+ ShowPosition(-1);
+ }
+
+ MData().m_updateScrollbarX =
+ MData().m_updateScrollbarY = FALSE;
+}
+
+void wxTextCtrl::OnIdle(wxIdleEvent& event)
+{
+ // notice that single line text control never has scrollbars
+ if ( !IsSingleLine() &&
+ (MData().m_updateScrollbarX || MData().m_updateScrollbarY) )
+ {
+ UpdateScrollbars();
+ }
+
+ event.Skip();
+}
+
+bool wxTextCtrl::SendAutoScrollEvents(wxScrollWinEvent& event) const
+{
+ bool forward = event.GetEventType() == wxEVT_SCROLLWIN_LINEDOWN;
+ if ( event.GetOrientation() == wxHORIZONTAL )
+ {
+ return forward ? m_curCol <= GetLineLength(m_curRow) : m_curCol > 0;
+ }
+ else // wxVERTICAL
+ {
+ return forward ? m_curRow < GetNumberOfLines() : m_curRow > 0;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// refresh
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::RefreshSelection()
+{
+ if ( HasSelection() )
+ {
+ RefreshTextRange(m_selStart, m_selEnd);
+ }
+}
+
+void wxTextCtrl::RefreshLineRange(wxTextCoord lineFirst, wxTextCoord lineLast)
+{
+ wxASSERT_MSG( lineFirst <= lineLast || !lineLast,
+ _T("no lines to refresh") );
+
+ wxRect rect;
+ // rect.x is already 0
+ rect.width = m_rectText.width;
+ wxCoord h = GetLineHeight();
+
+ wxTextCoord rowFirst;
+ if ( lineFirst < GetNumberOfLines() )
+ {
+ rowFirst = GetFirstRowOfLine(lineFirst);
+ }
+ else // lineFirst == GetNumberOfLines()
+ {
+ // lineFirst may be beyond the last line only if we refresh till
+ // the end, otherwise it's illegal
+ wxASSERT_MSG( lineFirst == GetNumberOfLines() && !lineLast,
+ _T("invalid line range") );
+
+ rowFirst = GetRowAfterLine(lineFirst - 1);
+ }
+
+ rect.y = rowFirst*h;
+
+ if ( lineLast )
+ {
+ // refresh till this line (inclusive)
+ wxTextCoord rowLast = GetRowAfterLine(lineLast);
+
+ rect.height = (rowLast - rowFirst + 1)*h;
+ }
+ else // lineLast == 0 means to refresh till the end
+ {
+ // FIXME: calc it exactly
+ rect.height = 32000;
+ }
+
+ RefreshTextRect(rect);
+}
+
+void wxTextCtrl::RefreshTextRange(wxTextPos start, wxTextPos end)
+{
+ wxCHECK_RET( start != -1 && end != -1,
+ _T("invalid RefreshTextRange() arguments") );
+
+ // accept arguments in any order as it is more conenient for the caller
+ OrderPositions(start, end);
+
+ // this is acceptable but we don't do anything in this case
+ if ( start == end )
+ return;
+
+ wxTextPos colStart, lineStart;
+ if ( !PositionToXY(start, &colStart, &lineStart) )
+ {
+ // the range is entirely beyond the end of the text, nothing to do
+ return;
+ }
+
+ wxTextCoord colEnd, lineEnd;
+ if ( !PositionToXY(end, &colEnd, &lineEnd) )
+ {
+ // the range spans beyond the end of text, refresh to the end
+ colEnd = -1;
+ lineEnd = GetNumberOfLines() - 1;
+ }
+
+ // refresh all lines one by one
+ for ( wxTextCoord line = lineStart; line <= lineEnd; line++ )
+ {
+ // refresh the first line from the start of the range to the end, the
+ // intermediate ones entirely and the last one from the beginning to
+ // the end of the range
+ wxTextPos posStart = line == lineStart ? colStart : 0;
+ size_t posCount;
+ if ( (line != lineEnd) || (colEnd == -1) )
+ {
+ // intermediate line or the last one but we need to refresh it
+ // until the end anyhow - do it
+ posCount = wxSTRING_MAXLEN;
+ }
+ else // last line
+ {
+ // refresh just the positions in between the start and the end one
+ posCount = colEnd - posStart;
+ }
+
+ if ( posCount )
+ RefreshColRange(line, posStart, posCount);
+ }
+}
+
+void wxTextCtrl::RefreshColRange(wxTextCoord line,
+ wxTextPos start,
+ size_t count)
+{
+ wxString text = GetLineText(line);
+
+ wxASSERT_MSG( (size_t)start <= text.length() && count,
+ _T("invalid RefreshColRange() parameter") );
+
+ RefreshPixelRange(line,
+ GetTextWidth(text.Left((size_t)start)),
+ GetTextWidth(text.Mid((size_t)start, (size_t)count)));
+}
+
+// this method accepts "logical" coords in the sense that they are coordinates
+// in a logical line but it can span several rows if we wrap lines and
+// RefreshPixelRange() will then refresh several rows
+void wxTextCtrl::RefreshPixelRange(wxTextCoord line,
+ wxCoord start,
+ wxCoord width)
+{
+ // we will use line text only in line wrap case
+ wxString text;
+ if ( WrapLines() )
+ {
+ text = GetLineText(line);
+ }
+
+ // special case: width == 0 means to refresh till the end of line
+ if ( width == 0 )
+ {
+ // refresh till the end of visible line
+ width = GetTotalWidth();
+
+ if ( WrapLines() )
+ {
+ // refresh till the end of text
+ wxCoord widthAll = GetTextWidth(text);
+
+ // extend width to the end of ROW
+ width = widthAll - widthAll % width + width;
+ }
+
+ // no need to refresh beyond the end of line
+ width -= start;
+ }
+ //else: just refresh the specified part
+
+ wxCoord h = GetLineHeight();
+ wxRect rect;
+ rect.x = start;
+ rect.y = GetFirstRowOfLine(line)*h;
+ rect.height = h;
+
+ if ( WrapLines() )
+ {
+ // (1) skip all rows which we don't touch at all
+ const wxWrappedLineData& lineData = WData().m_linesData[line];
+ if ( !WData().IsValidLine(line) )
+ LayoutLines(line);
+
+ wxCoord wLine = 0; // suppress compiler warning about uninit var
+ size_t rowLast = lineData.GetRowCount(),
+ row = 0;
+ while ( (row < rowLast) &&
+ (rect.x > (wLine = lineData.GetRowWidth(row++))) )
+ {
+ rect.x -= wLine;
+ rect.y += h;
+ }
+
+ // (2) now refresh all lines except the last one: note that the first
+ // line is refreshed from the given start to the end, all the next
+ // ones - entirely
+ while ( (row < rowLast) && (width > wLine - rect.x) )
+ {
+ rect.width = GetTotalWidth() - rect.x;
+ RefreshTextRect(rect);
+
+ width -= wLine - rect.x;
+ rect.x = 0;
+ rect.y += h;
+
+ wLine = lineData.GetRowWidth(row++);
+ }
+
+ // (3) the code below will refresh the last line
+ }
+
+ rect.width = width;
+
+ RefreshTextRect(rect);
+}
+
+void wxTextCtrl::RefreshTextRect(const wxRect& rectClient, bool textOnly)
+{
+ wxRect rect;
+ CalcScrolledPosition(rectClient.x, rectClient.y, &rect.x, &rect.y);
+ rect.width = rectClient.width;
+ rect.height = rectClient.height;
+
+ // account for the text area offset
+ rect.Offset(m_rectText.GetPosition());
+
+ // don't refresh beyond the text area unless we're refreshing the line wrap
+ // marks in which case textOnly is FALSE
+ if ( textOnly )
+ {
+ if ( rect.GetRight() > m_rectText.GetRight() )
+ {
+ rect.SetRight(m_rectText.GetRight());
+
+ if ( rect.width <= 0 )
+ {
+ // nothing to refresh
+ return;
+ }
+ }
+ }
+
+ // check the bottom boundary always, even for the line wrap marks
+ if ( rect.GetBottom() > m_rectText.GetBottom() )
+ {
+ rect.SetBottom(m_rectText.GetBottom());
+
+ if ( rect.height <= 0 )
+ {
+ // nothing to refresh
+ return;
+ }
+ }
+
+ // never refresh before the visible rect
+ if ( rect.x < m_rectText.x )
+ rect.x = m_rectText.x;
+
+ if ( rect.y < m_rectText.y )
+ rect.y = m_rectText.y;
+
+ wxLogTrace(_T("text"), _T("Refreshing (%d, %d)-(%d, %d)"),
+ rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
+
+ Refresh(TRUE, &rect);
+}
+
+void wxTextCtrl::RefreshLineWrapMarks(wxTextCoord rowFirst,
+ wxTextCoord rowLast)
+{
+ if ( WData().m_widthMark )
+ {
+ wxRect rectMarks;
+ rectMarks.x = m_rectText.width;
+ rectMarks.width = WData().m_widthMark;
+ rectMarks.y = rowFirst*GetLineHeight();
+ rectMarks.height = (rowLast - rowFirst)*GetLineHeight();
+
+ RefreshTextRect(rectMarks, FALSE /* don't limit to text area */);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// border drawing
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::DoDrawBorder(wxDC& dc, const wxRect& rect)
+{
+ m_renderer->DrawTextBorder(dc, GetBorder(), rect, GetStateFlags());
+}
+
+// ----------------------------------------------------------------------------
+// client area drawing
+// ----------------------------------------------------------------------------
+
+/*
+ Several remarks about wxTextCtrl redraw logic:
+
+ 1. only the regions which must be updated are redrawn, this means that we
+ never Refresh() the entire window but use RefreshPixelRange() and
+ ScrollWindow() which only refresh small parts of it and iterate over the
+ update region in our DoDraw()
+
+ 2. the text displayed on the screen is obtained using GetTextToShow(): it
+ should be used for all drawing/measuring
+ */
+
+wxString wxTextCtrl::GetTextToShow(const wxString& text) const
+{
+ wxString textShown;
+ if ( IsPassword() )
+ textShown = wxString(_T('*'), text.length());
+ else
+ textShown = text;
+
+ return textShown;
+}
+
+void wxTextCtrl::DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate)
+{
+ // debugging trick to see the update rect visually
+#ifdef WXDEBUG_TEXT
+ static int s_countUpdates = -1;
+ if ( s_countUpdates != -1 )
+ {
+ wxWindowDC dc(this);
+ dc.SetBrush(*(++s_countUpdates % 2 ? wxRED_BRUSH : wxGREEN_BRUSH));
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rectUpdate);
+ }
+#endif // WXDEBUG_TEXT
+
+ // calculate the range lineStart..lineEnd of lines to redraw
+ wxTextCoord lineStart, lineEnd;
+ if ( IsSingleLine() )
+ {
+ lineStart =
+ lineEnd = 0;
+ }
+ else // multiline
+ {
+ wxPoint pt = rectUpdate.GetPosition();
+ (void)HitTest(pt, NULL, &lineStart);
+
+ pt.y += rectUpdate.height;
+ (void)HitTest(pt, NULL, &lineEnd);
+ }
+
+ // prepare for drawing
+ wxCoord hLine = GetLineHeight();
+
+ // these vars will be used for hit testing of the current row
+ wxCoord y = rectUpdate.y;
+ const wxCoord x1 = rectUpdate.x;
+ const wxCoord x2 = rectUpdate.x + rectUpdate.width;
+
+ wxRect rectText;
+ rectText.height = hLine;
+ wxCoord yClient = y - GetClientAreaOrigin().y;
+
+ // we want to always start at the top of the line, otherwise if we redraw a
+ // rect whose top is in the middle of a line, we'd draw this line shifted
+ yClient -= (yClient - m_rectText.y) % hLine;
+
+ if ( IsSingleLine() )
+ {
+ rectText.y = yClient;
+ }
+ else // multiline, adjust for scrolling
+ {
+ CalcUnscrolledPosition(0, yClient, NULL, &rectText.y);
+ }
+
+ wxRenderer *renderer = GetRenderer();
+
+ // do draw the invalidated parts of each line: note that we iterate here
+ // over ROWs, not over LINEs
+ for ( wxTextCoord line = lineStart;
+ y < rectUpdate.y + rectUpdate.height;
+ y += hLine,
+ rectText.y += hLine )
+ {
+ // calculate the update rect in text positions for this line
+ wxTextCoord colStart, colEnd, colRowStart;
+ wxTextCtrlHitTestResult ht = HitTest2(y, x1, x2,
+ &line, &colStart, &colEnd,
+ &colRowStart);
+
+ if ( (ht == wxTE_HT_BEYOND) || (ht == wxTE_HT_BELOW) )
+ {
+ wxASSERT_MSG( line <= lineEnd, _T("how did we get that far?") );
+
+ if ( line == lineEnd )
+ {
+ // we redrew everything
+ break;
+ }
+
+ // the update rect is beyond the end of line, no need to redraw
+ // anything on this line - but continue with the remaining ones
+ continue;
+ }
+
+ // for single line controls we may additionally cut off everything
+ // which is to the right of the last visible position
+ if ( IsSingleLine() )
+ {
+ // don't show the columns which are scrolled out to the left
+ if ( colStart < SData().m_colStart )
+ colStart = SData().m_colStart;
+
+ // colEnd may be less than colStart if colStart was changed by the
+ // assignment above
+ if ( colEnd < colStart )
+ colEnd = colStart;
+
+ // don't draw the chars beyond the rightmost one
+ if ( SData().m_colLastVisible == -1 )
+ {
+ // recalculate this rightmost column
+ UpdateLastVisible();
+ }
+
+ if ( colStart > SData().m_colLastVisible )
+ {
+ // don't bother redrawing something that is beyond the last
+ // visible position
+ continue;
+ }
+
+ if ( colEnd > SData().m_colLastVisible )
+ {
+ colEnd = SData().m_colLastVisible;
+ }
+ }
+
+ // extract the part of line we need to redraw
+ wxString textLine = GetTextToShow(GetLineText(line));
+ wxString text = textLine.Mid(colStart, colEnd - colStart + 1);
+
+ // now deal with the selection: only do something if at least part of
+ // the line is selected
+ wxTextPos selStart, selEnd;
+ if ( GetSelectedPartOfLine(line, &selStart, &selEnd) )
+ {
+ // and if this part is (at least partly) in the current row
+ if ( (selStart <= colEnd) &&
+ (selEnd >= wxMax(colStart, colRowStart)) )
+ {
+ // these values are relative to the start of the line while the
+ // string passed to DrawTextLine() is only part of it, so
+ // adjust the selection range accordingly
+ selStart -= colStart;
+ selEnd -= colStart;
+
+ if ( selStart < 0 )
+ selStart = 0;
+
+ if ( (size_t)selEnd >= text.length() )
+ selEnd = text.length();
+ }
+ else
+ {
+ // reset selStart and selEnd to avoid passing them to
+ // DrawTextLine() below
+ selStart =
+ selEnd = -1;
+ }
+ }
+
+ // calculate the text coords on screen
+ wxASSERT_MSG( colStart >= colRowStart, _T("invalid string part") );
+ wxCoord ofsStart = GetTextWidth(
+ textLine.Mid(colRowStart,
+ colStart - colRowStart));
+ rectText.x = m_rectText.x + ofsStart;
+ rectText.width = GetTextWidth(text);
+
+ // do draw the text
+ renderer->DrawTextLine(dc, text, rectText, selStart, selEnd,
+ GetStateFlags());
+ wxLogTrace(_T("text"), _T("Line %ld: positions %ld-%ld redrawn."),
+ line, colStart, colEnd);
+ }
+}
+
+void wxTextCtrl::DoDrawLineWrapMarks(wxDC& dc, const wxRect& rectUpdate)
+{
+ wxASSERT_MSG( WrapLines() && WData().m_widthMark,
+ _T("shouldn't be called at all") );
+
+ wxRenderer *renderer = GetRenderer();
+
+ wxRect rectMark;
+ rectMark.x = rectUpdate.x;
+ rectMark.width = rectUpdate.width;
+ wxCoord yTop = GetClientAreaOrigin().y;
+ CalcUnscrolledPosition(0, rectUpdate.y - yTop, NULL, &rectMark.y);
+ wxCoord hLine = GetLineHeight();
+ rectMark.height = hLine;
+
+ wxTextCoord line, rowInLine;
+
+ wxCoord yBottom;
+ CalcUnscrolledPosition(0, rectUpdate.GetBottom() - yTop, NULL, &yBottom);
+ for ( ; rectMark.y < yBottom; rectMark.y += hLine )
+ {
+ if ( !GetLineAndRow(rectMark.y / hLine, &line, &rowInLine) )
+ {
+ // we went beyond the end of text
+ break;
+ }
+
+ // is this row continued on the next one?
+ if ( !WData().m_linesData[line].IsLastRow(rowInLine) )
+ {
+ renderer->DrawLineWrapMark(dc, rectMark);
+ }
+ }
+}
+
+void wxTextCtrl::DoDraw(wxControlRenderer *renderer)
+{
+ // hide the caret while we're redrawing the window and show it after we are
+ // done with it
+ wxCaretSuspend cs(this);
+
+ // prepare the DC
+ wxDC& dc = renderer->GetDC();
+ dc.SetFont(GetFont());
+ dc.SetTextForeground(GetForegroundColour());
+
+ // get the intersection of the update region with the text area: note that
+ // the update region is in window coords and text area is in the client
+ // ones, so it must be shifted before computing intersection
+ wxRegion rgnUpdate = GetUpdateRegion();
+ wxRect rectTextArea = GetRealTextArea();
+ wxPoint pt = GetClientAreaOrigin();
+ wxRect rectTextAreaAdjusted = rectTextArea;
+ rectTextAreaAdjusted.x += pt.x;
+ rectTextAreaAdjusted.y += pt.y;
+ rgnUpdate.Intersect(rectTextAreaAdjusted);
+
+ // even though the drawing is already clipped to the update region, we must
+ // explicitly clip it to the rect we will use as otherwise parts of letters
+ // might be drawn outside of it (if even a small part of a charater is
+ // inside, HitTest() will return its column and DrawText() can't draw only
+ // the part of the character, of course)
+#ifdef __WXMSW__
+ // FIXME: is this really a bug in wxMSW?
+ rectTextArea.width--;
+#endif // __WXMSW__
+ dc.SetClippingRegion(rectTextArea);
+
+ // adjust for scrolling
+ DoPrepareDC(dc);
+
+ // and now refresh the invalidated parts of the window
+ wxRegionIterator iter(rgnUpdate);
+ for ( ; iter.HaveRects(); iter++ )
+ {
+ wxRect r = iter.GetRect();
+
+ // this is a workaround for wxGTK::wxRegion bug
+#ifdef __WXGTK__
+ if ( !r.width || !r.height )
+ {
+ // ignore invalid rect
+ continue;
+ }
+#endif // __WXGTK__
+
+ DoDrawTextInRect(dc, r);
+ }
+
+ // now redraw the line wrap marks (if we draw them)
+ if ( WrapLines() && WData().m_widthMark )
+ {
+ // this is the rect inside which line wrap marks are drawn
+ wxRect rectMarks;
+ rectMarks.x = rectTextAreaAdjusted.GetRight() + 1;
+ rectMarks.y = rectTextAreaAdjusted.y;
+ rectMarks.width = WData().m_widthMark;
+ rectMarks.height = rectTextAreaAdjusted.height;
+
+ rgnUpdate = GetUpdateRegion();
+ rgnUpdate.Intersect(rectMarks);
+
+ wxRect rectUpdate = rgnUpdate.GetBox();
+ if ( rectUpdate.width && rectUpdate.height )
+ {
+ // the marks are outside previously set clipping region
+ dc.DestroyClippingRegion();
+
+ DoDrawLineWrapMarks(dc, rectUpdate);
+ }
+ }
+
+ // show caret first time only: we must show it after drawing the text or
+ // the display can be corrupted when it's hidden
+ if ( !m_hasCaret && GetCaret() )
+ {
+ ShowCaret();
+
+ m_hasCaret = TRUE;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// caret
+// ----------------------------------------------------------------------------
+
+bool wxTextCtrl::SetFont(const wxFont& font)
+{
+ if ( !wxControl::SetFont(font) )
+ return FALSE;
+
+ // and refresh everything, of course
+ InitInsertionPoint();
+ ClearSelection();
+
+ // update geometry parameters
+ UpdateTextRect();
+ RecalcFontMetrics();
+ if ( !IsSingleLine() )
+ {
+ UpdateScrollbars();
+ RecalcMaxWidth();
+ }
+
+ // recreate it, in fact
+ CreateCaret();
+
+ Refresh();
+
+ return TRUE;
+}
+
+bool wxTextCtrl::Enable(bool enable)
+{
+ if ( !wxTextCtrlBase::Enable(enable) )
+ return FALSE;
+
+ ShowCaret(enable);
+
+ return TRUE;
+}
+
+void wxTextCtrl::CreateCaret()
+{
+ wxCaret *caret;
+
+ if ( IsEditable() )
+ {
+ // FIXME use renderer
+ caret = new wxCaret(this, 1, GetLineHeight());
+#ifndef __WXMSW__
+ caret->SetBlinkTime(0);
+#endif // __WXMSW__
+ }
+ else
+ {
+ // read only controls don't have the caret
+ caret = (wxCaret *)NULL;
+ }
+
+ // SetCaret() will delete the old caret if any
+ SetCaret(caret);
+}
+
+void wxTextCtrl::ShowCaret(bool show)
+{
+ wxCaret *caret = GetCaret();
+ if ( caret )
+ {
+ // (re)position caret correctly
+ caret->Move(GetCaretPosition());
+
+ // and show it there
+ caret->Show(show);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// vertical scrolling (multiline only)
+// ----------------------------------------------------------------------------
+
+size_t wxTextCtrl::GetLinesPerPage() const
+{
+ if ( IsSingleLine() )
+ return 1;
+
+ return GetRealTextArea().height / GetLineHeight();
+}
+
+wxTextPos wxTextCtrl::GetPositionAbove()
+{
+ wxCHECK_MSG( !IsSingleLine(), INVALID_POS_VALUE,
+ _T("can't move cursor vertically in a single line control") );
+
+ // move the cursor up by one ROW not by one LINE: this means that
+ // we should really use HitTest() and not just go to the same
+ // position in the previous line
+ wxPoint pt = GetCaretPosition() - m_rectText.GetPosition();
+ if ( MData().m_xCaret == -1 )
+ {
+ // remember the initial cursor abscissa
+ MData().m_xCaret = pt.x;
+ }
+ else
+ {
+ // use the remembered abscissa
+ pt.x = MData().m_xCaret;
+ }
+
+ CalcUnscrolledPosition(pt.x, pt.y, &pt.x, &pt.y);
+ pt.y -= GetLineHeight();
+
+ wxTextCoord col, row;
+ if ( HitTestLogical(pt, &col, &row) == wxTE_HT_BEFORE )
+ {
+ // can't move further
+ return INVALID_POS_VALUE;
+ }
+
+ return XYToPosition(col, row);
+}
+
+wxTextPos wxTextCtrl::GetPositionBelow()
+{
+ wxCHECK_MSG( !IsSingleLine(), INVALID_POS_VALUE,
+ _T("can't move cursor vertically in a single line control") );
+
+ // see comments for wxACTION_TEXT_UP
+ wxPoint pt = GetCaretPosition() - m_rectText.GetPosition();
+ if ( MData().m_xCaret == -1 )
+ {
+ // remember the initial cursor abscissa
+ MData().m_xCaret = pt.x;
+ }
+ else
+ {
+ // use the remembered abscissa
+ pt.x = MData().m_xCaret;
+ }
+
+ CalcUnscrolledPosition(pt.x, pt.y, &pt.x, &pt.y);
+ pt.y += GetLineHeight();
+
+ wxTextCoord col, row;
+ if ( HitTestLogical(pt, &col, &row) == wxTE_HT_BELOW )
+ {
+ // can't go further down
+ return INVALID_POS_VALUE;
+ }
+
+ // note that wxTE_HT_BEYOND is ok: it happens when we go down
+ // from a longer line to a shorter one, for example (OTOH
+ // wxTE_HT_BEFORE can never happen)
+ return XYToPosition(col, row);
+}
+
+// ----------------------------------------------------------------------------
+// input
+// ----------------------------------------------------------------------------
+
+bool wxTextCtrl::PerformAction(const wxControlAction& actionOrig,
+ long numArg,
+ const wxString& strArg)
+{
+ // has the text changed as result of this action?
+ bool textChanged = FALSE;
+
+ // the remembered cursor abscissa for multiline text controls is usually
+ // reset after each user action but for ones which do use it (UP and DOWN
+ // for example) we shouldn't do it - as indicated by this flag
+ bool rememberAbscissa = FALSE;
+
+ // the command this action corresponds to or NULL if this action doesn't
+ // change text at all or can't be undone
+ wxTextCtrlCommand *command = (wxTextCtrlCommand *)NULL;
+
+ wxString action;
+ bool del = FALSE,
+ sel = FALSE;
+ if ( actionOrig.StartsWith(wxACTION_TEXT_PREFIX_DEL, &action) )
+ {
+ if ( IsEditable() )
+ del = TRUE;
+ }
+ else if ( actionOrig.StartsWith(wxACTION_TEXT_PREFIX_SEL, &action) )
+ {
+ sel = TRUE;
+ }
+ else // not selection nor delete action
+ {
+ action = actionOrig;
+ }
+
+ // set newPos to -2 as it can't become equal to it in the assignments below
+ // (but it can become -1)
+ wxTextPos newPos = INVALID_POS_VALUE;
+
+ if ( action == wxACTION_TEXT_HOME )
+ {
+ newPos = m_curPos - m_curCol;
+ }
+ else if ( action == wxACTION_TEXT_END )
+ {
+ newPos = m_curPos + GetLineLength(m_curRow) - m_curCol;
+ }
+ else if ( (action == wxACTION_TEXT_GOTO) ||
+ (action == wxACTION_TEXT_FIRST) ||
+ (action == wxACTION_TEXT_LAST) )
+ {
+ if ( action == wxACTION_TEXT_FIRST )
+ numArg = 0;
+ else if ( action == wxACTION_TEXT_LAST )
+ numArg = GetLastPosition();
+ //else: numArg already contains the position
+
+ newPos = numArg;
+ }
+ else if ( action == wxACTION_TEXT_UP )
+ {
+ if ( !IsSingleLine() )
+ {
+ newPos = GetPositionAbove();
+
+ if ( newPos != INVALID_POS_VALUE )
+ {
+ // remember where the cursor original had been
+ rememberAbscissa = TRUE;
+ }
+ }
+ }
+ else if ( action == wxACTION_TEXT_DOWN )
+ {
+ if ( !IsSingleLine() )
+ {
+ newPos = GetPositionBelow();
+
+ if ( newPos != INVALID_POS_VALUE )
+ {
+ // remember where the cursor original had been
+ rememberAbscissa = TRUE;
+ }
+ }
+ }
+ else if ( action == wxACTION_TEXT_LEFT )
+ {
+ newPos = m_curPos - 1;
+ }
+ else if ( action == wxACTION_TEXT_WORD_LEFT )
+ {
+ newPos = GetWordStart();
+ }
+ else if ( action == wxACTION_TEXT_RIGHT )
+ {
+ newPos = m_curPos + 1;
+ }
+ else if ( action == wxACTION_TEXT_WORD_RIGHT )
+ {
+ newPos = GetWordEnd();
+ }
+ else if ( action == wxACTION_TEXT_INSERT )
+ {
+ if ( IsEditable() && !strArg.empty() )
+ {
+ // inserting text can be undone
+ command = new wxTextCtrlInsertCommand(strArg);
+
+ textChanged = TRUE;
+ }
+ }
+ else if ( (action == wxACTION_TEXT_PAGE_UP) ||
+ (action == wxACTION_TEXT_PAGE_DOWN) )
+ {
+ if ( !IsSingleLine() )
+ {
+ size_t count = GetLinesPerPage();
+ if ( count > PAGE_OVERLAP_IN_LINES )
+ {
+ // pages should overlap slightly to allow the reader to keep
+ // orientation in the text
+ count -= PAGE_OVERLAP_IN_LINES;
+ }
+
+ // remember where the cursor original had been
+ rememberAbscissa = TRUE;
+
+ bool goUp = action == wxACTION_TEXT_PAGE_UP;
+ for ( size_t line = 0; line < count; line++ )
+ {
+ wxTextPos pos = goUp ? GetPositionAbove() : GetPositionBelow();
+ if ( pos == INVALID_POS_VALUE )
+ {
+ // can't move further
+ break;
+ }
+
+ MoveInsertionPoint(pos);
+ newPos = pos;
+ }
+
+ // we implement the Unix scrolling model here: cursor will always
+ // be on the first line after Page Down and on the last one after
+ // Page Up
+ //
+ // Windows programs usually keep the cursor line offset constant
+ // but do we really need it?
+ wxCoord y;
+ if ( goUp )
+ {
+ // find the line such that when it is the first one, the
+ // current position is in the last line
+ wxTextPos pos = 0;
+ for ( size_t line = 0; line < count; line++ )
+ {
+ pos = GetPositionAbove();
+ if ( pos == INVALID_POS_VALUE )
+ break;
+
+ MoveInsertionPoint(pos);
+ }
+
+ MoveInsertionPoint(newPos);
+
+ PositionToLogicalXY(pos, NULL, &y);
+ }
+ else // scrolled down
+ {
+ PositionToLogicalXY(newPos, NULL, &y);
+ }
+
+ // scroll vertically only
+ Scroll(-1, y);
+ }
+ }
+ else if ( action == wxACTION_TEXT_SEL_WORD )
+ {
+ SetSelection(GetWordStart(), GetWordEnd());
+ }
+ else if ( action == wxACTION_TEXT_ANCHOR_SEL )
+ {
+ newPos = numArg;
+ }
+ else if ( action == wxACTION_TEXT_EXTEND_SEL )
+ {
+ SetSelection(m_selAnchor, numArg);
+ }
+ else if ( action == wxACTION_TEXT_COPY )
+ {
+ Copy();
+ }
+ else if ( action == wxACTION_TEXT_CUT )
+ {
+ if ( IsEditable() )
+ Cut();
+ }
+ else if ( action == wxACTION_TEXT_PASTE )
+ {
+ if ( IsEditable() )
+ Paste();
+ }
+ else if ( action == wxACTION_TEXT_UNDO )
+ {
+ if ( CanUndo() )
+ Undo();
+ }
+ else if ( action == wxACTION_TEXT_REDO )
+ {
+ if ( CanRedo() )
+ Redo();
+ }
+ else
+ {
+ return wxControl::PerformAction(action, numArg, strArg);
+ }
+
+ if ( newPos != INVALID_POS_VALUE )
+ {
+ // bring the new position into the range
+ if ( newPos < 0 )
+ newPos = 0;
+
+ wxTextPos posLast = GetLastPosition();
+ if ( newPos > posLast )
+ newPos = posLast;
+
+ if ( del )
+ {
+ // if we have the selection, remove just it
+ wxTextPos from, to;
+ if ( HasSelection() )
+ {
+ from = m_selStart;
+ to = m_selEnd;
+ }
+ else
+ {
+ // otherwise delete everything between current position and
+ // the new one
+ if ( m_curPos != newPos )
+ {
+ from = m_curPos;
+ to = newPos;
+ }
+ else // nothing to delete
+ {
+ // prevent test below from working
+ from = INVALID_POS_VALUE;
+
+ // and this is just to silent the compiler warning
+ to = 0;
+ }
+ }
+
+ if ( from != INVALID_POS_VALUE )
+ {
+ command = new wxTextCtrlRemoveCommand(from, to);
+ }
+ }
+ else // cursor movement command
+ {
+ // just go there
+ DoSetInsertionPoint(newPos);
+
+ if ( sel )
+ {
+ SetSelection(m_selAnchor, m_curPos);
+ }
+ else // simple movement
+ {
+ // clear the existing selection
+ ClearSelection();
+ }
+ }
+
+ if ( !rememberAbscissa && !IsSingleLine() )
+ {
+ MData().m_xCaret = -1;
+ }
+ }
+
+ if ( command )
+ {
+ // execute and remember it to be able to undo it later
+ m_cmdProcessor->Submit(command);
+
+ // undoable commands always change text
+ textChanged = TRUE;
+ }
+ else // no undoable command
+ {
+ // m_cmdProcessor->StopCompressing()
+ }
+
+ if ( textChanged )
+ {
+ wxASSERT_MSG( IsEditable(), _T("non editable control changed?") );
+
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+ InitCommandEvent(event);
+ event.SetString(GetValue());
+ GetEventHandler()->ProcessEvent(event);
+
+ // as the text changed...
+ m_isModified = TRUE;
+ }
+
+ return TRUE;
+}
+
+void wxTextCtrl::OnChar(wxKeyEvent& event)
+{
+ // only process the key events from "simple keys" here
+ if ( !event.HasModifiers() )
+ {
+ int keycode = event.GetKeyCode();
+ if ( keycode == WXK_RETURN )
+ {
+ if ( IsSingleLine() || (GetWindowStyle() & wxTE_PROCESS_ENTER) )
+ {
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, GetId());
+ InitCommandEvent(event);
+ event.SetString(GetValue());
+ GetEventHandler()->ProcessEvent(event);
+ }
+ else // interpret <Enter> normally: insert new line
+ {
+ PerformAction(wxACTION_TEXT_INSERT, -1, _T('\n'));
+ }
+ }
+ else if ( keycode < 255 && isprint(keycode) )
+ {
+ PerformAction(wxACTION_TEXT_INSERT, -1, (wxChar)keycode);
+
+ // skip event.Skip() below
+ return;
+ }
+ }
+#ifdef __WXDEBUG__
+ // Ctrl-R refreshes the control in debug mode
+ else if ( event.ControlDown() && event.GetKeyCode() == 'r' )
+ Refresh();
+#endif // __WXDEBUG__
+
+ event.Skip();
+}
+
+// ----------------------------------------------------------------------------
+// wxStdTextCtrlInputHandler
+// ----------------------------------------------------------------------------
+
+wxStdTextCtrlInputHandler::wxStdTextCtrlInputHandler(wxInputHandler *inphand)
+ : wxStdInputHandler(inphand)
+{
+ m_winCapture = (wxTextCtrl *)NULL;
+}
+
+/* static */
+wxTextPos wxStdTextCtrlInputHandler::HitTest(const wxTextCtrl *text,
+ const wxPoint& pt)
+{
+ wxTextCoord col, row;
+ wxTextCtrlHitTestResult ht = text->HitTest(pt, &col, &row);
+
+ wxTextPos pos = text->XYToPosition(col, row);
+
+ // if the point is after the last column we must adjust the position to be
+ // the last position in the line (unless it is already the last)
+ if ( (ht == wxTE_HT_BEYOND) && (pos < text->GetLastPosition()) )
+ {
+ pos++;
+ }
+
+ return pos;
+}
+
+bool wxStdTextCtrlInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ // we're only interested in key presses
+ if ( !pressed )
+ return FALSE;
+
+ int keycode = event.GetKeyCode();
+
+ wxControlAction action;
+ wxString str;
+ bool ctrlDown = event.ControlDown(),
+ shiftDown = event.ShiftDown();
+ if ( shiftDown )
+ {
+ action = wxACTION_TEXT_PREFIX_SEL;
+ }
+
+ // the only key combination with Alt we recognize is Alt-Bksp for undo, so
+ // treat it first separately
+ if ( event.AltDown() )
+ {
+ if ( keycode == WXK_BACK && !ctrlDown && !shiftDown )
+ action = wxACTION_TEXT_UNDO;
+ }
+ else switch ( keycode )
+ {
+ // cursor movement
+ case WXK_HOME:
+ action << (ctrlDown ? wxACTION_TEXT_FIRST
+ : wxACTION_TEXT_HOME);
+ break;
+
+ case WXK_END:
+ action << (ctrlDown ? wxACTION_TEXT_LAST
+ : wxACTION_TEXT_END);
+ break;
+
+ case WXK_UP:
+ if ( !ctrlDown )
+ action << wxACTION_TEXT_UP;
+ break;
+
+ case WXK_DOWN:
+ if ( !ctrlDown )
+ action << wxACTION_TEXT_DOWN;
+ break;
+
+ case WXK_LEFT:
+ action << (ctrlDown ? wxACTION_TEXT_WORD_LEFT
+ : wxACTION_TEXT_LEFT);
+ break;
+
+ case WXK_RIGHT:
+ action << (ctrlDown ? wxACTION_TEXT_WORD_RIGHT
+ : wxACTION_TEXT_RIGHT);
+ break;
+
+ case WXK_PAGEDOWN:
+ case WXK_NEXT:
+ // we don't map Ctrl-PgUp/Dn to anything special - what should it
+ // to? for now, it's the same as without control
+ action << wxACTION_TEXT_PAGE_DOWN;
+ break;
+
+ case WXK_PAGEUP:
+ case WXK_PRIOR:
+ action << wxACTION_TEXT_PAGE_UP;
+ break;
+
+ // delete
+ case WXK_DELETE:
+ if ( !ctrlDown )
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_RIGHT;
+ break;
+
+ case WXK_BACK:
+ if ( !ctrlDown )
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_LEFT;
+ break;
+
+ // something else
+ default:
+ // reset the action as it could be already set to one of the
+ // prefixes
+ action = wxACTION_NONE;
+
+ if ( ctrlDown )
+ {
+ switch ( keycode )
+ {
+ case 'A':
+ action = wxACTION_TEXT_REDO;
+ break;
+
+ case 'C':
+ action = wxACTION_TEXT_COPY;
+ break;
+
+ case 'V':
+ action = wxACTION_TEXT_PASTE;
+ break;
+
+ case 'X':
+ action = wxACTION_TEXT_CUT;
+ break;
+
+ case 'Z':
+ action = wxACTION_TEXT_UNDO;
+ break;
+ }
+ }
+ }
+
+ if ( (action != wxACTION_NONE) && (action != wxACTION_TEXT_PREFIX_SEL) )
+ {
+ control->PerformAction(action, -1, str);
+
+ return TRUE;
+ }
+
+ return wxStdInputHandler::HandleKey(control, event, pressed);
+}
+
+bool wxStdTextCtrlInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ if ( event.LeftDown() )
+ {
+ wxASSERT_MSG( !m_winCapture, _T("left button going down twice?") );
+
+ wxTextCtrl *text = wxStaticCast(control, wxTextCtrl);
+
+ m_winCapture = text;
+ m_winCapture->CaptureMouse();
+
+ text->HideCaret();
+
+ wxTextPos pos = HitTest(text, event.GetPosition());
+ if ( pos != -1 )
+ {
+ text->PerformAction(wxACTION_TEXT_ANCHOR_SEL, pos);
+ }
+ }
+ else if ( event.LeftDClick() )
+ {
+ // select the word the cursor is on
+ control->PerformAction(wxACTION_TEXT_SEL_WORD);
+ }
+ else if ( event.LeftUp() )
+ {
+ if ( m_winCapture )
+ {
+ m_winCapture->ShowCaret();
+
+ m_winCapture->ReleaseMouse();
+ m_winCapture = (wxTextCtrl *)NULL;
+ }
+ }
+
+ return wxStdInputHandler::HandleMouse(control, event);
+}
+
+bool wxStdTextCtrlInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ if ( m_winCapture )
+ {
+ // track it
+ wxTextCtrl *text = wxStaticCast(m_winCapture, wxTextCtrl);
+ wxTextPos pos = HitTest(text, event.GetPosition());
+ if ( pos != -1 )
+ {
+ text->PerformAction(wxACTION_TEXT_EXTEND_SEL, pos);
+ }
+ }
+
+ return wxStdInputHandler::HandleMouseMove(control, event);
+}
+
+bool wxStdTextCtrlInputHandler::HandleFocus(wxControl *control,
+ const wxFocusEvent& event)
+{
+ wxTextCtrl *text = wxStaticCast(control, wxTextCtrl);
+
+ // the selection appearance changes depending on whether we have the focus
+ text->RefreshSelection();
+
+ // never refresh entirely
+ return FALSE;
+}
+
+#endif // wxUSE_TEXTCTRL
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/theme.cpp
+// Purpose: implementation of wxTheme
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "theme.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/log.h"
+#endif // WX_PRECOMP
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/theme.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+wxThemeInfo *wxTheme::ms_allThemes = (wxThemeInfo *)NULL;
+wxTheme *wxTheme::ms_theme = (wxTheme *)NULL;
+
+// ----------------------------------------------------------------------------
+// "dynamic" theme creation
+// ----------------------------------------------------------------------------
+
+wxThemeInfo::wxThemeInfo(Constructor c,
+ const wxChar *n,
+ const wxChar *d)
+ : name(n), desc(d), ctor(c)
+{
+ // insert us (in the head of) the linked list
+ next = wxTheme::ms_allThemes;
+ wxTheme::ms_allThemes = this;
+}
+
+/* static */ wxTheme *wxTheme::Create(const wxString& name)
+{
+ // find the theme in the list by name
+ wxThemeInfo *info = ms_allThemes;
+ while ( info )
+ {
+ if ( name == info->name )
+ {
+ return info->ctor();
+ }
+
+ info = info->next;
+ }
+
+ return (wxTheme *)NULL;
+}
+
+// ----------------------------------------------------------------------------
+// the default theme (called by wxApp::OnInitGui)
+// ----------------------------------------------------------------------------
+
+/* static */ bool wxTheme::CreateDefault()
+{
+ if ( ms_theme )
+ {
+ // we already have a theme
+ return TRUE;
+ }
+
+ wxString nameDefTheme;
+
+ // use the environment variable first
+ const wxChar *p = wxGetenv(_T("WXTHEME"));
+ if ( p )
+ {
+ nameDefTheme = p;
+ }
+ else // use native theme by default
+ {
+ #if defined(__WXMSW__)
+ nameDefTheme = _T("win32");
+ #elif defined(__WXGTK__)
+ nameDefTheme = _T("gtk");
+ #endif
+ }
+
+ ms_theme = Create(nameDefTheme);
+
+ // fallback to the first one in the list
+ if ( !ms_theme && ms_allThemes )
+ {
+ ms_theme = ms_allThemes->ctor();
+ }
+
+ // abort if still nothing
+ if ( !ms_theme )
+ {
+ wxLogError(_("Failed to initialize GUI: no built-in themes found."));
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* static */ wxTheme *wxTheme::Set(wxTheme *theme)
+{
+ wxTheme *themeOld = ms_theme;
+ ms_theme = theme;
+ return themeOld;
+}
+
+// ----------------------------------------------------------------------------
+// assorted trivial dtors
+// ----------------------------------------------------------------------------
+
+wxTheme::~wxTheme()
+{
+}
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/themes/gtk.cpp
+// Purpose: wxUniversal theme implementing GTK-like LNF
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/log.h"
+ #include "wx/dcmemory.h"
+ #include "wx/window.h"
+
+ #include "wx/button.h"
+ #include "wx/checkbox.h"
+ #include "wx/listbox.h"
+ #include "wx/checklst.h"
+ #include "wx/scrolbar.h"
+ #include "wx/slider.h"
+ #include "wx/textctrl.h"
+#endif // WX_PRECOMP
+
+#include "wx/notebook.h"
+#include "wx/spinbutt.h"
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/colschem.h"
+#include "wx/univ/theme.h"
+
+// ----------------------------------------------------------------------------
+// constants (to be removed, for testing only)
+// ----------------------------------------------------------------------------
+
+static const size_t BORDER_THICKNESS = 1;
+
+// ----------------------------------------------------------------------------
+// wxGTKRenderer: draw the GUI elements in GTK style
+// ----------------------------------------------------------------------------
+
+class wxGTKRenderer : public wxRenderer
+{
+public:
+ wxGTKRenderer(const wxColourScheme *scheme);
+
+ // implement the base class pure virtuals
+ virtual void DrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL);
+ virtual void DrawButtonLabel(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL);
+ virtual void DrawBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL);
+ virtual void DrawHorizontalLine(wxDC& dc,
+ wxCoord y, wxCoord x1, wxCoord x2);
+ virtual void DrawVerticalLine(wxDC& dc,
+ wxCoord x, wxCoord y1, wxCoord y2);
+ virtual void DrawFrame(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT,
+ int indexAccel = -1);
+ virtual void DrawTextBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL);
+ virtual void DrawButtonBorder(wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL);
+ virtual void DrawArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawScrollbarArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawScrollbarThumb(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawScrollbarShaft(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawScrollCorner(wxDC& dc,
+ const wxRect& rect);
+ virtual void DrawItem(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawCheckButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1);
+
+ virtual void DrawRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1);
+
+ virtual void DrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart = -1,
+ int selEnd = -1,
+ int flags = 0);
+ virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect);
+ virtual void DrawTab(wxDC& dc,
+ const wxRect& rect,
+ wxDirection dir,
+ const wxString& label,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int indexAccel = -1);
+
+ virtual void DrawSliderShaft(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0,
+ wxRect *rectShaft = NULL);
+ virtual void DrawSliderThumb(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0);
+ virtual void DrawSliderTicks(wxDC& dc,
+ const wxRect& rect,
+ const wxSize& sizeThumb,
+ wxOrientation orient,
+ int start,
+ int end,
+ int step,
+ int flags)
+ {
+ // we don't have the ticks in GTK version
+ }
+
+ virtual void DrawMenuBarItem(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags = 0,
+ int indexAccel = -1);
+ virtual void DrawMenuItem(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geometryInfo,
+ const wxString& label,
+ const wxString& accel,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int indexAccel = -1);
+ virtual void DrawMenuSeparator(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geomInfo);
+
+ virtual void GetComboBitmaps(wxBitmap *bmpNormal,
+ wxBitmap *bmpPressed,
+ wxBitmap *bmpDisabled);
+
+ virtual void AdjustSize(wxSize *size, const wxWindow *window);
+ virtual wxRect GetBorderDimensions(wxBorder border) const;
+ virtual bool AreScrollbarsInsideBorder() const;
+
+ // geometry and hit testing
+ virtual wxSize GetScrollbarArrowSize() const
+ { return m_sizeScrollbarArrow; }
+ virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos = -1) const;
+ virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar);
+ virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt) const;
+ virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos = -1);
+ virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
+ virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
+ { return fontHeight + 2; }
+ virtual wxSize GetCheckBitmapSize() const
+ { return wxSize(10, 10); }
+ virtual wxSize GetRadioBitmapSize() const
+ { return wxSize(11, 11); }
+ virtual wxCoord GetCheckItemMargin() const
+ { return 2; }
+
+ virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
+ const wxRect& rect);
+ virtual wxRect GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rect,
+ wxCoord *extraSpaceBeyond);
+
+ virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
+ virtual wxSize GetTabPadding() const { return wxSize(6, 6); }
+
+ virtual wxCoord GetSliderDim() const { return 15; }
+ virtual wxCoord GetSliderTickLen() const { return 0; }
+ virtual wxRect GetSliderShaftRect(const wxRect& rect,
+ wxOrientation orient) const;
+ virtual wxSize GetSliderThumbSize(const wxRect& rect,
+ wxOrientation orient) const;
+ virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
+
+ virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
+ virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
+ const wxMenu& menu) const;
+
+ // helpers for "wxBitmap wxColourScheme::Get()"
+ void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
+ void DrawUncheckBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
+
+protected:
+ // DrawBackground() helpers
+
+ // get the colour to use for background
+ wxColour GetBackgroundColour(int flags) const
+ {
+ if ( flags & wxCONTROL_PRESSED )
+ return wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED);
+ else if ( flags & wxCONTROL_CURRENT )
+ return wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT);
+ else
+ return wxSCHEME_COLOUR(m_scheme, CONTROL);
+ }
+
+ // draw the background with any colour, not only the default one(s)
+ void DoDrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect);
+
+ // DrawBorder() helpers: all of them shift and clip the DC after drawing
+ // the border
+
+ // just draw a rectangle with the given pen
+ void DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen);
+
+ // draw the lower left part of rectangle
+ void DrawHalfRect(wxDC& dc, wxRect *rect, const wxPen& pen);
+
+ // draw the rectange using the first brush for the left and top sides and
+ // the second one for the bottom and right ones
+ void DrawShadedRect(wxDC& dc, wxRect *rect,
+ const wxPen& pen1, const wxPen& pen2);
+
+ // as DrawShadedRect() but the pixels in the bottom left and upper right
+ // border are drawn with the pen1, not pen2
+ void DrawAntiShadedRect(wxDC& dc, wxRect *rect,
+ const wxPen& pen1, const wxPen& pen2);
+
+ // used for drawing opened rectangles - draws only one side of it at once
+ // (and doesn't adjust the rect)
+ void DrawAntiShadedRectSide(wxDC& dc,
+ const wxRect& rect,
+ const wxPen& pen1,
+ const wxPen& pen2,
+ wxDirection dir);
+
+ // draw an opened rect for the arrow in given direction
+ void DrawArrowBorder(wxDC& dc,
+ wxRect *rect,
+ wxDirection dir);
+
+ // draw two sides of the rectangle
+ void DrawThumbBorder(wxDC& dc,
+ wxRect *rect,
+ wxOrientation orient);
+
+ // draw the normal 3D border
+ void DrawRaisedBorder(wxDC& dc, wxRect *rect);
+
+ // just as DrawRaisedBorder() except that the bottom left and up right
+ // pixels of the interior rect are drawn in another colour (i.e. the inner
+ // rect is drawn with DrawAntiShadedRect() and not DrawShadedRect())
+ void DrawAntiRaisedBorder(wxDC& dc, wxRect *rect);
+
+ // returns the size of the arrow for the scrollbar (depends on
+ // orientation)
+ wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar) const
+ {
+ wxSize size;
+ if ( scrollbar->IsVertical() )
+ {
+ size = m_sizeScrollbarArrow;
+ }
+ else
+ {
+ size.x = m_sizeScrollbarArrow.y;
+ size.y = m_sizeScrollbarArrow.x;
+ }
+
+ return size;
+ }
+
+ // get the line wrap indicator bitmap
+ wxBitmap GetLineWrapBitmap();
+
+ // DrawCheckBitmap and DrawRadioBitmap helpers
+
+ // draw the check bitmaps once and cache them for later use
+ wxBitmap GetCheckBitmap(int flags);
+
+ // draw a /\ or \/ line from (x1, y1) to (x2, y1) passing by the point
+ // ((x1 + x2)/2, y2)
+ void DrawUpZag(wxDC& dc,
+ wxCoord x1, wxCoord x2,
+ wxCoord y1, wxCoord y2);
+ void DrawDownZag(wxDC& dc,
+ wxCoord x1, wxCoord x2,
+ wxCoord y1, wxCoord y2);
+
+ // draw the radio button bitmap for the given state
+ void DrawRadioBitmap(wxDC& dc, const wxRect& rect, int flags);
+
+ // draw check/radio - the bitmap must be a valid one by now
+ void DoDrawCheckOrRadioBitmap(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rectTotal,
+ int flags,
+ wxAlignment align,
+ int indexAccel);
+
+private:
+ const wxColourScheme *m_scheme;
+
+ // data
+ wxSize m_sizeScrollbarArrow;
+
+ // GDI objects
+ wxPen m_penBlack,
+ m_penDarkGrey,
+ m_penGrey,
+ m_penLightGrey,
+ m_penHighlight;
+
+ // the checkbox bitmaps: first row is for the normal, second for the
+ // pressed state and the columns are for checked and unchecked status
+ // respectively
+ wxBitmap m_bitmapsCheckbox[2][2];
+
+ // the line wrap bitmap (drawn at the end of wrapped lines)
+ wxBitmap m_bmpLineWrap;
+};
+
+// ----------------------------------------------------------------------------
+// wxGTKInputHandler and derived classes: process the keyboard and mouse
+// messages according to GTK standards
+// ----------------------------------------------------------------------------
+
+class wxGTKInputHandler : public wxInputHandler
+{
+public:
+ wxGTKInputHandler(wxGTKRenderer *renderer);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
+
+protected:
+ wxGTKRenderer *m_renderer;
+};
+
+class wxGTKScrollBarInputHandler : public wxStdScrollBarInputHandler
+{
+public:
+ wxGTKScrollBarInputHandler(wxRenderer *renderer, wxInputHandler *handler)
+ : wxStdScrollBarInputHandler(renderer, handler) { }
+
+protected:
+ virtual void Highlight(wxScrollBar *scrollbar, bool doIt)
+ {
+ // only arrows and the thumb can be highlighted
+ if ( !IsArrow() && m_htLast != wxHT_SCROLLBAR_THUMB )
+ return;
+
+ wxStdScrollBarInputHandler::Highlight(scrollbar, doIt);
+ }
+
+ virtual void Press(wxScrollBar *scrollbar, bool doIt)
+ {
+ // only arrows can be pressed
+ if ( !IsArrow() )
+ return;
+
+ wxStdScrollBarInputHandler::Press(scrollbar, doIt);
+ }
+
+ virtual bool IsAllowedButton(int WXUNUSED(button)) { return TRUE; }
+
+ bool IsArrow() const
+ {
+ return m_htLast == wxHT_SCROLLBAR_ARROW_LINE_1 ||
+ m_htLast == wxHT_SCROLLBAR_ARROW_LINE_2;
+ }
+};
+
+class wxGTKCheckboxInputHandler : public wxStdCheckboxInputHandler
+{
+public:
+ wxGTKCheckboxInputHandler(wxInputHandler *handler)
+ : wxStdCheckboxInputHandler(handler) { }
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+};
+
+class wxGTKTextCtrlInputHandler : public wxStdTextCtrlInputHandler
+{
+public:
+ wxGTKTextCtrlInputHandler(wxInputHandler *handler)
+ : wxStdTextCtrlInputHandler(handler) { }
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+};
+
+// ----------------------------------------------------------------------------
+// wxGTKColourScheme: uses the standard GTK colours
+// ----------------------------------------------------------------------------
+
+class wxGTKColourScheme : public wxColourScheme
+{
+public:
+ virtual wxColour Get(StdColour col) const;
+ virtual wxColour GetBackground(wxWindow *win) const;
+};
+
+// ----------------------------------------------------------------------------
+// wxGTKTheme
+// ----------------------------------------------------------------------------
+
+WX_DEFINE_ARRAY(wxInputHandler *, wxArrayHandlers);
+
+class wxGTKTheme : public wxTheme
+{
+public:
+ wxGTKTheme();
+ virtual ~wxGTKTheme();
+
+ virtual wxRenderer *GetRenderer() { return m_renderer; }
+ virtual wxInputHandler *GetInputHandler(const wxString& control);
+ virtual wxColourScheme *GetColourScheme() { return m_scheme; }
+
+private:
+ // get the default input handler
+ wxInputHandler *GetDefaultInputHandler();
+
+ wxGTKRenderer *m_renderer;
+
+ // the names of the already created handlers and the handlers themselves
+ // (these arrays are synchronized)
+ wxSortedArrayString m_handlerNames;
+ wxArrayHandlers m_handlers;
+
+ wxGTKInputHandler *m_handlerDefault;
+
+ wxGTKColourScheme *m_scheme;
+
+ WX_DECLARE_THEME(gtk)
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+WX_IMPLEMENT_THEME(wxGTKTheme, gtk, wxTRANSLATE("GTK+ theme"));
+
+// ----------------------------------------------------------------------------
+// wxGTKTheme
+// ----------------------------------------------------------------------------
+
+wxGTKTheme::wxGTKTheme()
+{
+ m_scheme = new wxGTKColourScheme;
+ m_renderer = new wxGTKRenderer(m_scheme);
+ m_handlerDefault = NULL;
+}
+
+wxGTKTheme::~wxGTKTheme()
+{
+ size_t count = m_handlers.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( m_handlers[n] != m_handlerDefault )
+ delete m_handlers[n];
+ }
+
+ delete m_handlerDefault;
+ delete m_renderer;
+ delete m_scheme;
+}
+
+wxInputHandler *wxGTKTheme::GetDefaultInputHandler()
+{
+ if ( !m_handlerDefault )
+ {
+ m_handlerDefault = new wxGTKInputHandler(m_renderer);
+ }
+
+ return m_handlerDefault;
+}
+
+wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control)
+{
+ wxInputHandler *handler;
+ int n = m_handlerNames.Index(control);
+ if ( n == wxNOT_FOUND )
+ {
+ // create a new handler
+ if ( control == wxINP_HANDLER_SCROLLBAR )
+ handler = new wxGTKScrollBarInputHandler(m_renderer,
+ GetDefaultInputHandler());
+#if wxUSE_BUTTON
+ else if ( control == wxINP_HANDLER_BUTTON )
+ handler = new wxStdButtonInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_CHECKBOX
+#if wxUSE_CHECKBOX
+ else if ( control == wxINP_HANDLER_CHECKBOX )
+ handler = new wxGTKCheckboxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_CHECKBOX
+#if wxUSE_COMBOBOX
+ else if ( control == wxINP_HANDLER_COMBOBOX )
+ handler = new wxStdComboBoxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_COMBOBOX
+#if wxUSE_LISTBOX
+ else if ( control == wxINP_HANDLER_LISTBOX )
+ handler = new wxStdListboxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_LISTBOX
+#if wxUSE_CHECKLISTBOX
+ else if ( control == wxINP_HANDLER_CHECKLISTBOX )
+ handler = new wxStdCheckListboxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_CHECKLISTBOX
+#if wxUSE_TEXTCTRL
+ else if ( control == wxINP_HANDLER_TEXTCTRL )
+ handler = new wxGTKTextCtrlInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_TEXTCTRL
+#if wxUSE_SLIDER
+ else if ( control == wxINP_HANDLER_SLIDER )
+ handler = new wxStdSliderButtonInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_SLIDER
+#if wxUSE_SPINBTN
+ else if ( control == wxINP_HANDLER_SPINBTN )
+ handler = new wxStdSpinButtonInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_SPINBTN
+#if wxUSE_NOTEBOOK
+ else if ( control == wxINP_HANDLER_NOTEBOOK )
+ handler = new wxStdNotebookInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_NOTEBOOK
+ else
+ handler = GetDefaultInputHandler();
+
+ n = m_handlerNames.Add(control);
+ m_handlers.Insert(handler, n);
+ }
+ else // we already have it
+ {
+ handler = m_handlers[n];
+ }
+
+ return handler;
+}
+
+// ============================================================================
+// wxGTKColourScheme
+// ============================================================================
+
+wxColour wxGTKColourScheme::GetBackground(wxWindow *win) const
+{
+ wxColour col;
+ if ( win->UseBgCol() )
+ {
+ // use the user specified colour
+ col = win->GetBackgroundColour();
+ }
+
+ if ( win->IsContainerWindow() )
+ {
+ // doesn't depend on the state
+ if ( !col.Ok() )
+ {
+ col = Get(WINDOW);
+ }
+ }
+ else
+ {
+ int flags = win->GetStateFlags();
+
+ // the colour set by the user should be used for the normal state
+ // and for the states for which we don't have any specific colours
+ if ( !col.Ok() || (flags != 0) )
+ {
+ if ( wxDynamicCast(win, wxScrollBar) )
+ col = Get(SCROLLBAR);
+ else if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() )
+ col = Get(CONTROL_CURRENT);
+ else if ( flags & wxCONTROL_PRESSED )
+ col = Get(CONTROL_PRESSED);
+ else
+ col = Get(CONTROL);
+ }
+ }
+
+ return col;
+}
+
+wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) const
+{
+ switch ( col )
+ {
+ case WINDOW: return *wxWHITE;
+
+ case SHADOW_DARK: return *wxBLACK;
+ case SHADOW_HIGHLIGHT: return *wxWHITE;
+ case SHADOW_IN: return wxColour(0xd6d6d6);
+ case SHADOW_OUT: return wxColour(0x969696);
+
+ case CONTROL: return wxColour(0xd6d6d6);
+ case CONTROL_PRESSED: return wxColour(0xc3c3c3);
+ case CONTROL_CURRENT: return wxColour(0xeaeaea);
+
+ case CONTROL_TEXT: return *wxBLACK;
+ case CONTROL_TEXT_DISABLED:
+ return wxColour(0x757575);
+ case CONTROL_TEXT_DISABLED_SHADOW:
+ return *wxWHITE;
+
+ case SCROLLBAR:
+ case SCROLLBAR_PRESSED: return wxColour(0xc3c3c3);
+
+ case HIGHLIGHT: return wxColour(0x9c0000);
+ case HIGHLIGHT_TEXT: return wxColour(0xffffff);
+
+ case MAX:
+ default:
+ wxFAIL_MSG(_T("invalid standard colour"));
+ return *wxBLACK;
+ }
+}
+
+// ============================================================================
+// wxGTKRenderer
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// construction
+// ----------------------------------------------------------------------------
+
+wxGTKRenderer::wxGTKRenderer(const wxColourScheme *scheme)
+{
+ // init data
+ m_scheme = scheme;
+ m_sizeScrollbarArrow = wxSize(15, 14);
+
+ // init pens
+ m_penBlack = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_DARK), 0, wxSOLID);
+ m_penDarkGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_OUT), 0, wxSOLID);
+ m_penGrey = wxPen(wxSCHEME_COLOUR(scheme, SCROLLBAR), 0, wxSOLID);
+ m_penLightGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_IN), 0, wxSOLID);
+ m_penHighlight = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_HIGHLIGHT), 0, wxSOLID);
+}
+
+// ----------------------------------------------------------------------------
+// border stuff
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen)
+{
+ // draw
+ dc.SetPen(pen);
+ dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ dc.DrawRectangle(*rect);
+
+ // adjust the rect
+ rect->Inflate(-1);
+}
+
+void wxGTKRenderer::DrawHalfRect(wxDC& dc, wxRect *rect, const wxPen& pen)
+{
+ // draw the bottom and right sides
+ dc.SetPen(pen);
+ dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
+ rect->GetRight() + 1, rect->GetBottom());
+ dc.DrawLine(rect->GetRight(), rect->GetTop(),
+ rect->GetRight(), rect->GetBottom());
+
+ // adjust the rect
+ rect->width--;
+ rect->height--;
+}
+
+void wxGTKRenderer::DrawShadedRect(wxDC& dc, wxRect *rect,
+ const wxPen& pen1, const wxPen& pen2)
+{
+ // draw the rectangle
+ dc.SetPen(pen1);
+ dc.DrawLine(rect->GetLeft(), rect->GetTop(),
+ rect->GetLeft(), rect->GetBottom());
+ dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(),
+ rect->GetRight(), rect->GetTop());
+ dc.SetPen(pen2);
+ dc.DrawLine(rect->GetRight(), rect->GetTop(),
+ rect->GetRight(), rect->GetBottom());
+ dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
+ rect->GetRight() + 1, rect->GetBottom());
+
+ // adjust the rect
+ rect->Inflate(-1);
+}
+
+void wxGTKRenderer::DrawAntiShadedRectSide(wxDC& dc,
+ const wxRect& rect,
+ const wxPen& pen1,
+ const wxPen& pen2,
+ wxDirection dir)
+{
+ dc.SetPen(dir == wxLEFT || dir == wxUP ? pen1 : pen2);
+
+ switch ( dir )
+ {
+ case wxLEFT:
+ dc.DrawLine(rect.GetLeft(), rect.GetTop(),
+ rect.GetLeft(), rect.GetBottom() + 1);
+ break;
+
+ case wxUP:
+ dc.DrawLine(rect.GetLeft(), rect.GetTop(),
+ rect.GetRight() + 1, rect.GetTop());
+ break;
+
+ case wxRIGHT:
+ dc.DrawLine(rect.GetRight(), rect.GetTop(),
+ rect.GetRight(), rect.GetBottom() + 1);
+ break;
+
+ case wxDOWN:
+ dc.DrawLine(rect.GetLeft(), rect.GetBottom(),
+ rect.GetRight() + 1, rect.GetBottom());
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown rectangle side"));
+ }
+}
+
+void wxGTKRenderer::DrawAntiShadedRect(wxDC& dc, wxRect *rect,
+ const wxPen& pen1, const wxPen& pen2)
+{
+ // draw the rectangle
+ dc.SetPen(pen1);
+ dc.DrawLine(rect->GetLeft(), rect->GetTop(),
+ rect->GetLeft(), rect->GetBottom() + 1);
+ dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(),
+ rect->GetRight() + 1, rect->GetTop());
+ dc.SetPen(pen2);
+ dc.DrawLine(rect->GetRight(), rect->GetTop() + 1,
+ rect->GetRight(), rect->GetBottom());
+ dc.DrawLine(rect->GetLeft() + 1, rect->GetBottom(),
+ rect->GetRight() + 1, rect->GetBottom());
+
+ // adjust the rect
+ rect->Inflate(-1);
+}
+
+void wxGTKRenderer::DrawRaisedBorder(wxDC& dc, wxRect *rect)
+{
+ DrawShadedRect(dc, rect, m_penHighlight, m_penBlack);
+ DrawShadedRect(dc, rect, m_penLightGrey, m_penDarkGrey);
+}
+
+void wxGTKRenderer::DrawAntiRaisedBorder(wxDC& dc, wxRect *rect)
+{
+ DrawShadedRect(dc, rect, m_penHighlight, m_penBlack);
+ DrawAntiShadedRect(dc, rect, m_penLightGrey, m_penDarkGrey);
+}
+
+void wxGTKRenderer::DrawBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rectTotal,
+ int flags,
+ wxRect *rectIn)
+{
+ size_t width;
+
+ wxRect rect = rectTotal;
+
+ switch ( border )
+ {
+ case wxBORDER_SUNKEN:
+ for ( width = 0; width < BORDER_THICKNESS; width++ )
+ {
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
+ }
+ break;
+
+ case wxBORDER_STATIC:
+ DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ break;
+
+ case wxBORDER_RAISED:
+ for ( width = 0; width < BORDER_THICKNESS; width++ )
+ {
+ DrawRaisedBorder(dc, &rect);
+ }
+ break;
+
+ case wxBORDER_DOUBLE:
+ DrawShadedRect(dc, &rect, m_penLightGrey, m_penBlack);
+ DrawShadedRect(dc, &rect, m_penHighlight, m_penDarkGrey);
+ DrawRect(dc, &rect, m_penLightGrey);
+ break;
+
+ case wxBORDER_SIMPLE:
+ DrawRect(dc, &rect, m_penBlack);
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown border type"));
+ // fall through
+
+ case wxBORDER_DEFAULT:
+ case wxBORDER_NONE:
+ break;
+ }
+
+ if ( rectIn )
+ *rectIn = rect;
+}
+
+wxRect wxGTKRenderer::GetBorderDimensions(wxBorder border) const
+{
+ wxCoord width;
+ switch ( border )
+ {
+ case wxBORDER_RAISED:
+ case wxBORDER_SUNKEN:
+ width = 2*BORDER_THICKNESS;
+ break;
+
+ case wxBORDER_SIMPLE:
+ case wxBORDER_STATIC:
+ width = 1;
+ break;
+
+ case wxBORDER_DOUBLE:
+ width = 3;
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown border type"));
+ // fall through
+
+ case wxBORDER_DEFAULT:
+ case wxBORDER_NONE:
+ width = 0;
+ break;
+ }
+
+ wxRect rect;
+ rect.x =
+ rect.y =
+ rect.width =
+ rect.height = width;
+
+ return rect;
+}
+
+bool wxGTKRenderer::AreScrollbarsInsideBorder() const
+{
+ // no, the scrollbars are outside the border in GTK+
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// special borders
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawTextBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rectOrig,
+ int flags,
+ wxRect *rectIn)
+{
+ wxRect rect = rectOrig;
+
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ DrawRect(dc, &rect, m_penBlack);
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ }
+ else // !focused
+ {
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ DrawAntiShadedRect(dc, &rect, m_penBlack, m_penHighlight);
+ }
+
+ if ( rectIn )
+ *rectIn = rect;
+}
+
+void wxGTKRenderer::DrawButtonBorder(wxDC& dc,
+ const wxRect& rectTotal,
+ int flags,
+ wxRect *rectIn)
+{
+ wxRect rect = rectTotal;
+
+ if ( flags & wxCONTROL_PRESSED )
+ {
+ // button pressed: draw a black border around it and an inward shade
+ DrawRect(dc, &rect, m_penBlack);
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ DrawAntiShadedRect(dc, &rect, m_penBlack, m_penDarkGrey);
+ }
+ else
+ {
+ // button not pressed
+
+ if ( flags & wxCONTROL_ISDEFAULT )
+ {
+ // TODO
+ }
+
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ // button is currently default: add an extra border around it
+ DrawRect(dc, &rect, m_penBlack);
+ }
+
+ // now draw a normal button
+ DrawShadedRect(dc, &rect, m_penHighlight, m_penBlack);
+ DrawAntiShadedRect(dc, &rect,
+ wxPen(GetBackgroundColour(flags), 0, wxSOLID),
+ m_penDarkGrey);
+ }
+
+ if ( rectIn )
+ {
+ *rectIn = rect;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// lines and frames
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawHorizontalLine(wxDC& dc,
+ wxCoord y, wxCoord x1, wxCoord x2)
+{
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x1, y, x2 + 1, y);
+ dc.SetPen(m_penHighlight);
+ y++;
+ dc.DrawLine(x1, y, x2 + 1, y);
+}
+
+void wxGTKRenderer::DrawVerticalLine(wxDC& dc,
+ wxCoord x, wxCoord y1, wxCoord y2)
+{
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x, y1, x, y2 + 1);
+ dc.SetPen(m_penHighlight);
+ x++;
+ dc.DrawLine(x, y1, x, y2 + 1);
+}
+
+void wxGTKRenderer::DrawFrame(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags,
+ int alignment,
+ int indexAccel)
+{
+ wxCoord height = 0; // of the label
+ wxRect rectFrame = rect;
+ if ( !label.empty() )
+ {
+ // the text should touch the top border of the rect, so the frame
+ // itself should be lower
+ dc.GetTextExtent(label, NULL, &height);
+ rectFrame.y += height / 2;
+ rectFrame.height -= height / 2;
+
+ // TODO: the +4 should be customizable
+
+ wxRect rectText;
+ rectText.x = rectFrame.x + 4;
+ rectText.y = rect.y;
+ rectText.width = rectFrame.width - 8;
+ rectText.height = height;
+
+ wxRect rectLabel;
+ DrawLabel(dc, label, rectText, flags, alignment, indexAccel, &rectLabel);
+ rectLabel.x -= 1;
+ rectLabel.width += 2;
+
+ StandardDrawFrame(dc, rectFrame, rectLabel);
+
+ // GTK+ does it like this
+ dc.SetPen(m_penHighlight);
+ dc.DrawPoint(rectText.x, rectFrame.y);
+ dc.DrawPoint(rectText.x + rectLabel.width - 3, rectFrame.y);
+ }
+ else
+ {
+ // just draw the complete frame
+ DrawShadedRect(dc, &rectFrame, m_penDarkGrey, m_penHighlight);
+ DrawShadedRect(dc, &rectFrame, m_penHighlight, m_penDarkGrey);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// label
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags,
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounds)
+{
+ DrawButtonLabel(dc, label, wxNullBitmap, rect, flags,
+ alignment, indexAccel, rectBounds);
+}
+
+void wxGTKRenderer::DrawButtonLabel(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int flags,
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounds)
+{
+ if ( flags & wxCONTROL_DISABLED )
+ {
+ // make the text grey and draw a shade for it
+ dc.SetTextForeground(*wxWHITE); // FIXME hardcoded colour
+ wxRect rectShadow = rect;
+ rectShadow.x++;
+ rectShadow.y++;
+ dc.DrawLabel(label, rectShadow, alignment, indexAccel);
+ dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, CONTROL_TEXT_DISABLED));
+ }
+
+ dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
+}
+
+void wxGTKRenderer::DrawItem(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags)
+{
+ wxLogTrace(_T("listbox"), _T("drawing item '%s' at (%d, %d)-(%d, %d)"),
+ label.c_str(),
+ rect.x, rect.y,
+ rect.x + rect.width, rect.y + rect.height);
+
+ wxColour colFg;
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ dc.SetBrush(wxBrush(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT), wxSOLID));
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rect);
+
+ colFg = dc.GetTextForeground();
+ dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT_TEXT));
+ }
+
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ wxRect rectFocus = rect;
+ DrawRect(dc, &rectFocus, m_penBlack);
+ }
+
+ wxRect rectText = rect;
+ rectText.x += 2;
+ rectText.y++;
+ dc.DrawLabel(label, wxNullBitmap, rectText);
+
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ dc.SetBackgroundMode(wxTRANSPARENT);
+ }
+
+ // restore the text colour
+ if ( colFg.Ok() )
+ {
+ dc.SetTextForeground(colFg);
+ }
+}
+
+void wxGTKRenderer::DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags)
+{
+ wxRect rectBitmap = rect;
+ rectBitmap.x -= 1;
+ rectBitmap.width = GetCheckBitmapSize().x;
+ // never draw the focus rect around the check indicators here
+ DrawCheckButton(dc, _T(""), bitmap, rectBitmap, flags & ~wxCONTROL_FOCUSED);
+
+ wxRect rectLabel = rect;
+ wxCoord shift = rectBitmap.width + 2*GetCheckItemMargin();
+ rectLabel.x += shift;
+ rectLabel.width -= shift;
+ DrawItem(dc, label, rectLabel, flags);
+}
+
+// ----------------------------------------------------------------------------
+// check/radion buttons
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawUncheckBitmap(wxDC& dc,
+ const wxRect& rectTotal,
+ bool isPressed)
+{
+ wxRect rect = rectTotal;
+ DrawAntiRaisedBorder(dc, &rect);
+
+ wxColour col = wxSCHEME_COLOUR(m_scheme, SHADOW_IN);
+ dc.SetPen(wxPen(col, 0, wxSOLID));
+ dc.DrawPoint(rect.GetRight() - 1, rect.GetBottom() - 1);
+
+ if ( isPressed )
+ col = wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED);
+ //else: it is SHADOW_IN, leave as is
+
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.SetBrush(wxBrush(col, wxSOLID));
+ dc.DrawRectangle(rect);
+}
+
+void wxGTKRenderer::DrawCheckBitmap(wxDC& dc, const wxRect& rectTotal)
+{
+ wxRect rect = rectTotal;
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
+
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.SetBrush(wxBrush(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), wxSOLID));
+ dc.DrawRectangle(rect);
+}
+
+void wxGTKRenderer::DrawRadioBitmap(wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ wxCoord x = rect.x,
+ y = rect.y,
+ xRight = rect.GetRight(),
+ yBottom = rect.GetBottom();
+
+ wxCoord yMid = (y + yBottom) / 2;
+
+ // this looks ugly when the background colour of the control is not the
+ // same ours - radiobox is not transparent as it should be
+#if 0
+ // first fill the middle: as FloodFill() is not implemented on all
+ // platforms, this is the only thing to do
+ wxColour colBg = flags & wxCONTROL_CURRENT
+ ? wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT)
+ : wxSCHEME_COLOUR(m_scheme, SHADOW_IN);
+ dc.SetBrush(wxBrush(colBg, wxSOLID));
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rect);
+#endif // 0
+
+ // then draw the upper half
+ dc.SetPen(flags & wxCONTROL_CHECKED ? m_penDarkGrey : m_penHighlight);
+ DrawUpZag(dc, x, xRight, yMid, y);
+ DrawUpZag(dc, x + 1, xRight - 1, yMid, y + 1);
+
+ bool drawIt = TRUE;
+ if ( flags & wxCONTROL_CHECKED )
+ dc.SetPen(m_penBlack);
+ else if ( flags & wxCONTROL_PRESSED )
+ dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), 0, wxSOLID));
+ else // unchecked and unpressed
+ drawIt = FALSE;
+
+ if ( drawIt )
+ DrawUpZag(dc, x + 2, xRight - 2, yMid, y + 2);
+
+ // and then the lower one
+ dc.SetPen(flags & wxCONTROL_CHECKED ? m_penHighlight : m_penBlack);
+ DrawDownZag(dc, x, xRight, yMid, yBottom);
+ if ( !(flags & wxCONTROL_CHECKED) )
+ dc.SetPen(m_penDarkGrey);
+ DrawDownZag(dc, x + 1, xRight - 1, yMid, yBottom - 1);
+
+ if ( !(flags & wxCONTROL_CHECKED) )
+ drawIt = TRUE; // with the same pen
+ else if ( flags & wxCONTROL_PRESSED )
+ {
+ dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), 0, wxSOLID));
+ drawIt = TRUE;
+ }
+ else // checked and unpressed
+ drawIt = FALSE;
+
+ if ( drawIt )
+ DrawDownZag(dc, x + 2, xRight - 2, yMid, yBottom - 2);
+}
+
+void wxGTKRenderer::DrawUpZag(wxDC& dc,
+ wxCoord x1,
+ wxCoord x2,
+ wxCoord y1,
+ wxCoord y2)
+{
+ wxCoord xMid = (x1 + x2) / 2;
+ dc.DrawLine(x1, y1, xMid, y2);
+ dc.DrawLine(xMid, y2, x2 + 1, y1 + 1);
+}
+
+void wxGTKRenderer::DrawDownZag(wxDC& dc,
+ wxCoord x1,
+ wxCoord x2,
+ wxCoord y1,
+ wxCoord y2)
+{
+ wxCoord xMid = (x1 + x2) / 2;
+ dc.DrawLine(x1 + 1, y1 + 1, xMid, y2);
+ dc.DrawLine(xMid, y2, x2, y1);
+}
+
+wxBitmap wxGTKRenderer::GetCheckBitmap(int flags)
+{
+ if ( !m_bitmapsCheckbox[0][0].Ok() )
+ {
+ // init the bitmaps once only
+ wxRect rect;
+ wxSize size = GetCheckBitmapSize();
+ rect.width = size.x;
+ rect.height = size.y;
+ for ( int i = 0; i < 2; i++ )
+ {
+ for ( int j = 0; j < 2; j++ )
+ m_bitmapsCheckbox[i][j].Create(rect.width, rect.height);
+ }
+
+ wxMemoryDC dc;
+
+ // normal checked
+ dc.SelectObject(m_bitmapsCheckbox[0][0]);
+ DrawCheckBitmap(dc, rect);
+
+ // normal unchecked
+ dc.SelectObject(m_bitmapsCheckbox[0][1]);
+ DrawUncheckBitmap(dc, rect, FALSE);
+
+ // pressed checked
+ m_bitmapsCheckbox[1][0] = m_bitmapsCheckbox[0][0];
+
+ // pressed unchecked
+ dc.SelectObject(m_bitmapsCheckbox[1][1]);
+ DrawUncheckBitmap(dc, rect, TRUE);
+ }
+
+ int row = flags & wxCONTROL_PRESSED ? 1 : 0;
+ int col = flags & wxCONTROL_CHECKED ? 0 : 1;
+
+ return m_bitmapsCheckbox[row][col];
+}
+
+wxBitmap wxGTKRenderer::GetLineWrapBitmap()
+{
+ if ( !m_bmpLineWrap.Ok() )
+ {
+ // the line wrap bitmap as used by GTK+
+ #define line_wrap_width 6
+ #define line_wrap_height 9
+ static const char line_wrap_bits[] =
+ {
+ 0x1e, 0x3e, 0x30, 0x30, 0x39, 0x1f, 0x0f, 0x0f, 0x1f,
+ };
+
+ wxBitmap bmpLineWrap(line_wrap_bits, line_wrap_width, line_wrap_height);
+ if ( !bmpLineWrap.Ok() )
+ {
+ wxFAIL_MSG( _T("Failed to create line wrap XBM") );
+ }
+ else
+ {
+ m_bmpLineWrap = bmpLineWrap;
+ }
+ }
+
+ return m_bmpLineWrap;
+}
+
+void wxGTKRenderer::DrawCheckButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmapOrig,
+ const wxRect& rectTotal,
+ int flags,
+ wxAlignment align,
+ int indexAccel)
+{
+ wxBitmap bitmap;
+ if ( bitmapOrig.Ok() )
+ {
+ bitmap = bitmapOrig;
+ }
+ else
+ {
+ bitmap = GetCheckBitmap(flags);
+ }
+
+ DoDrawCheckOrRadioBitmap(dc, label, bitmap, rectTotal,
+ flags, align, indexAccel);
+}
+
+void wxGTKRenderer::DoDrawCheckOrRadioBitmap(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rectTotal,
+ int flags,
+ wxAlignment align,
+ int indexAccel)
+{
+ wxRect rect = rectTotal;
+
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ // draw the focus border around everything
+ DrawRect(dc, &rect, m_penBlack);
+ }
+ else
+ {
+ // the border does not offset the string under GTK
+ rect.Inflate(-1);
+ }
+
+ // calculate the position of the bitmap and of the label
+ wxCoord xBmp,
+ yBmp = rect.y + (rect.height - bitmap.GetHeight()) / 2;
+
+ wxRect rectLabel;
+ dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
+ rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2;
+
+ if ( align == wxALIGN_RIGHT )
+ {
+ xBmp = rect.GetRight() - bitmap.GetWidth();
+ rectLabel.x = rect.x + 2;
+ rectLabel.SetRight(xBmp);
+ }
+ else // normal (checkbox to the left of the text) case
+ {
+ xBmp = rect.x + 2;
+ rectLabel.x = xBmp + bitmap.GetWidth() + 4;
+ rectLabel.SetRight(rect.GetRight());
+ }
+
+ dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
+
+ DrawLabel(dc, label, rectLabel, flags,
+ wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, indexAccel);
+}
+
+void wxGTKRenderer::DrawRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmapOrig,
+ const wxRect& rectTotal,
+ int flags,
+ wxAlignment align,
+ int indexAccel)
+{
+ wxBitmap bitmap;
+ if ( bitmapOrig.Ok() )
+ {
+ bitmap = bitmapOrig;
+ }
+ else
+ {
+ wxRect rect;
+ wxSize size = GetRadioBitmapSize();
+ rect.width = size.x;
+ rect.height = size.y;
+ bitmap.Create(rect.width, rect.height);
+ wxMemoryDC dc;
+ dc.SelectObject(bitmap);
+ dc.SetBackground(*wxLIGHT_GREY_BRUSH);
+ dc.Clear();
+ DrawRadioBitmap(dc, rect, flags);
+ bitmap.SetMask(new wxMask(bitmap, *wxLIGHT_GREY));
+ }
+
+ DoDrawCheckOrRadioBitmap(dc, label, bitmap, rectTotal,
+ flags, align, indexAccel);
+}
+
+// ----------------------------------------------------------------------------
+// text control
+// ----------------------------------------------------------------------------
+
+wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl *text,
+ const wxRect& rect)
+{
+ wxRect rectTotal = rect;
+ rectTotal.Inflate(2);
+ return rectTotal;
+}
+
+wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rect,
+ wxCoord *extraSpaceBeyond)
+{
+ wxRect rectText = rect;
+ rectText.Inflate(-2);
+
+ if ( text->WrapLines() )
+ {
+ // leave enough for the line wrap bitmap indicator
+ wxCoord widthMark = GetLineWrapBitmap().GetWidth() + 2;
+
+ rectText.width -= widthMark;
+
+ if ( extraSpaceBeyond )
+ *extraSpaceBeyond = widthMark;
+ }
+
+ return rectText;
+}
+
+void wxGTKRenderer::DrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart,
+ int selEnd,
+ int flags)
+{
+ // TODO: GTK+ draws selection even for unfocused controls, just with
+ // different colours
+ StandardDrawTextLine(dc, text, rect, selStart, selEnd, flags);
+}
+
+void wxGTKRenderer::DrawLineWrapMark(wxDC& dc, const wxRect& rect)
+{
+ wxBitmap bmpLineWrap = GetLineWrapBitmap();
+
+ // for a mono bitmap he colours it appears in depends on the current text
+ // colours, so set them correctly
+ wxColour colFgOld;
+ if ( bmpLineWrap.GetDepth() == 1 )
+ {
+ colFgOld = dc.GetTextForeground();
+
+ // FIXME: I wonder what should we do if the background is black too?
+ dc.SetTextForeground(*wxBLACK);
+ }
+
+ dc.DrawBitmap(bmpLineWrap,
+ rect.x, rect.y + (rect.height - bmpLineWrap.GetHeight())/2);
+
+ if ( colFgOld.Ok() )
+ {
+ // restore old colour
+ dc.SetTextForeground(colFgOld);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// notebook
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawTab(wxDC& dc,
+ const wxRect& rectOrig,
+ wxDirection dir,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ int flags,
+ int indexAccel)
+{
+ wxRect rect = rectOrig;
+
+ // the current tab is drawn indented (to the top for default case) and
+ // bigger than the other ones
+ const wxSize indent = GetTabIndent();
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ switch ( dir )
+ {
+ default:
+ wxFAIL_MSG(_T("invaild notebook tab orientation"));
+ // fall through
+
+ case wxTOP:
+ rect.Inflate(indent.x, 0);
+ rect.y -= indent.y;
+ rect.height += indent.y;
+ break;
+
+ case wxBOTTOM:
+ rect.Inflate(indent.x, 0);
+ rect.height += indent.y;
+ break;
+
+ case wxLEFT:
+ case wxRIGHT:
+ wxFAIL_MSG(_T("TODO"));
+ break;
+ }
+ }
+
+ // selected tab has different colour
+ wxColour col = flags & wxCONTROL_SELECTED
+ ? wxSCHEME_COLOUR(m_scheme, SHADOW_IN)
+ : wxSCHEME_COLOUR(m_scheme, SCROLLBAR);
+ DoDrawBackground(dc, col, rect);
+
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ // draw the focus rect
+ wxRect rectBorder = rect;
+ rectBorder.Deflate(4, 3);
+ if ( dir == wxBOTTOM )
+ rectBorder.Offset(0, -1);
+
+ DrawRect(dc, &rectBorder, m_penBlack);
+ }
+
+ // draw the text, image and the focus around them (if necessary)
+ wxRect rectLabel = rect;
+ rectLabel.Deflate(1, 1);
+ dc.DrawLabel(label, bitmap, rectLabel, wxALIGN_CENTRE, indexAccel);
+
+ // now draw the tab itself
+ wxCoord x = rect.x,
+ y = rect.y,
+ x2 = rect.GetRight(),
+ y2 = rect.GetBottom();
+ switch ( dir )
+ {
+ default:
+ case wxTOP:
+ dc.SetPen(m_penHighlight);
+ dc.DrawLine(x, y2, x, y);
+ dc.DrawLine(x + 1, y, x2, y);
+
+ dc.SetPen(m_penBlack);
+ dc.DrawLine(x2, y2, x2, y);
+
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x2 - 1, y2, x2 - 1, y + 1);
+
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ dc.SetPen(m_penLightGrey);
+
+ // overwrite the part of the border below this tab
+ dc.DrawLine(x + 1, y2 + 1, x2 - 1, y2 + 1);
+
+ // and the shadow of the tab to the left of us
+ dc.DrawLine(x + 1, y + 2, x + 1, y2 + 1);
+ }
+ break;
+
+ case wxBOTTOM:
+ dc.SetPen(m_penHighlight);
+
+ // we need to continue one pixel further to overwrite the corner of
+ // the border for the selected tab
+ dc.DrawLine(x, y - (flags & wxCONTROL_SELECTED ? 1 : 0),
+ x, y2);
+
+ // it doesn't work like this (TODO: implement it properly)
+#if 0
+ // erase the corner of the tab to the right
+ dc.SetPen(m_penLightGrey);
+ dc.DrawPoint(x2 - 1, y - 2);
+ dc.DrawPoint(x2 - 2, y - 2);
+ dc.DrawPoint(x2 - 2, y - 1);
+#endif // 0
+
+ dc.SetPen(m_penBlack);
+ dc.DrawLine(x + 1, y2, x2, y2);
+ dc.DrawLine(x2, y, x2, y2);
+
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x + 2, y2 - 1, x2 - 1, y2 - 1);
+ dc.DrawLine(x2 - 1, y, x2 - 1, y2);
+
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ dc.SetPen(m_penLightGrey);
+
+ // overwrite the part of the (double!) border above this tab
+ dc.DrawLine(x + 1, y - 1, x2 - 1, y - 1);
+ dc.DrawLine(x + 1, y - 2, x2 - 1, y - 2);
+
+ // and the shadow of the tab to the left of us
+ dc.DrawLine(x + 1, y2 - 1, x + 1, y - 1);
+ }
+ break;
+
+ case wxLEFT:
+ case wxRIGHT:
+ wxFAIL_MSG(_T("TODO"));
+ }
+}
+
+// ----------------------------------------------------------------------------
+// slider
+// ----------------------------------------------------------------------------
+
+wxSize wxGTKRenderer::GetSliderThumbSize(const wxRect& rect,
+ wxOrientation orient) const
+{
+ static const wxCoord SLIDER_THUMB_LENGTH = 30;
+
+ wxSize size;
+
+ wxRect rectShaft = GetSliderShaftRect(rect, orient);
+ if ( orient == wxHORIZONTAL )
+ {
+ size.x = wxMin(SLIDER_THUMB_LENGTH, rectShaft.width);
+ size.y = rectShaft.height;
+ }
+ else // vertical
+ {
+ size.y = wxMin(SLIDER_THUMB_LENGTH, rectShaft.height);
+ size.x = rectShaft.width;
+ }
+
+ return size;
+}
+
+wxRect wxGTKRenderer::GetSliderShaftRect(const wxRect& rect,
+ wxOrientation WXUNUSED(orient)) const
+{
+ return rect.Deflate(2*BORDER_THICKNESS, 2*BORDER_THICKNESS);
+}
+
+void wxGTKRenderer::DrawSliderShaft(wxDC& dc,
+ const wxRect& rectOrig,
+ wxOrientation orient,
+ int flags,
+ wxRect *rectShaft)
+{
+ wxRect rect = rectOrig;
+
+ // draw the border first
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ DrawRect(dc, &rect, m_penBlack);
+ DrawAntiShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
+ }
+ else // not focused, normal
+ {
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ DrawAntiShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
+ }
+
+ // and the background
+ DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rect);
+
+ if ( rectShaft )
+ *rectShaft = rect;
+}
+
+void wxGTKRenderer::DrawSliderThumb(wxDC& dc,
+ const wxRect& rectOrig,
+ wxOrientation orient,
+ int flags)
+{
+ // draw the thumb border
+ wxRect rect = rectOrig;
+ DrawAntiRaisedBorder(dc, &rect);
+
+ // draw the handle in the middle
+ if ( orient == wxVERTICAL )
+ {
+ rect.height = 2*BORDER_THICKNESS;
+ rect.y = rectOrig.y + (rectOrig.height - rect.height) / 2;
+ }
+ else // horz
+ {
+ rect.width = 2*BORDER_THICKNESS;
+ rect.x = rectOrig.x + (rectOrig.width - rect.width) / 2;
+ }
+
+ DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+}
+
+// ----------------------------------------------------------------------------
+// menu and menubar
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawMenuBarItem(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags,
+ int indexAccel)
+{
+ DrawLabel(dc, label, rect, flags, wxALIGN_CENTRE, indexAccel);
+}
+
+void wxGTKRenderer::DrawMenuItem(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geometryInfo,
+ const wxString& label,
+ const wxString& accel,
+ const wxBitmap& bitmap,
+ int flags,
+ int indexAccel)
+{
+ wxFAIL_MSG(_T("TODO"));
+}
+
+void wxGTKRenderer::DrawMenuSeparator(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geomInfo)
+{
+ wxFAIL_MSG(_T("TODO"));
+}
+
+wxSize wxGTKRenderer::GetMenuBarItemSize(const wxSize& sizeText) const
+{
+ return sizeText;
+}
+
+wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win,
+ const wxMenu& menu) const
+{
+ wxFAIL_MSG(_T("TODO"));
+
+ return NULL;
+}
+
+// ----------------------------------------------------------------------------
+// combobox
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
+ wxBitmap *bmpPressed,
+ wxBitmap *bmpDisabled)
+{
+ // TODO
+}
+
+// ----------------------------------------------------------------------------
+// background
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DoDrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect)
+{
+ wxBrush brush(col, wxSOLID);
+ dc.SetBrush(brush);
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rect);
+}
+
+void wxGTKRenderer::DrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect,
+ int flags)
+{
+ wxColour colBg = col.Ok() ? col : GetBackgroundColour(flags);
+ DoDrawBackground(dc, colBg, rect);
+}
+
+// ----------------------------------------------------------------------------
+// scrollbar
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::DrawArrowBorder(wxDC& dc,
+ wxRect *rect,
+ wxDirection dir)
+{
+ static const wxDirection sides[] =
+ {
+ wxUP, wxLEFT, wxRIGHT, wxDOWN
+ };
+
+ wxRect rect1, rect2, rectInner;
+ rect1 =
+ rect2 =
+ rectInner = *rect;
+
+ rect2.Inflate(-1);
+ rectInner.Inflate(-2);
+
+ DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), *rect);
+
+ // find the side not to draw and also adjust the rectangles to compensate
+ // for it
+ wxDirection sideToOmit;
+ switch ( dir )
+ {
+ case wxUP:
+ sideToOmit = wxDOWN;
+ rect2.height += 1;
+ rectInner.height += 1;
+ break;
+
+ case wxDOWN:
+ sideToOmit = wxUP;
+ rect2.y -= 1;
+ rect2.height += 1;
+ rectInner.y -= 2;
+ rectInner.height += 1;
+ break;
+
+ case wxLEFT:
+ sideToOmit = wxRIGHT;
+ rect2.width += 1;
+ rectInner.width += 1;
+ break;
+
+ case wxRIGHT:
+ sideToOmit = wxLEFT;
+ rect2.x -= 1;
+ rect2.width += 1;
+ rectInner.x -= 2;
+ rectInner.width += 1;
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown arrow direction"));
+ return;
+ }
+
+ // the outer rect first
+ size_t n;
+ for ( n = 0; n < WXSIZEOF(sides); n++ )
+ {
+ wxDirection side = sides[n];
+ if ( side == sideToOmit )
+ continue;
+
+ DrawAntiShadedRectSide(dc, rect1, m_penDarkGrey, m_penHighlight, side);
+ }
+
+ // and then the inner one
+ for ( n = 0; n < WXSIZEOF(sides); n++ )
+ {
+ wxDirection side = sides[n];
+ if ( side == sideToOmit )
+ continue;
+
+ DrawAntiShadedRectSide(dc, rect2, m_penBlack, m_penGrey, side);
+ }
+
+ *rect = rectInner;
+}
+
+void wxGTKRenderer::DrawScrollbarArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rectArrow,
+ int flags)
+{
+ // first of all, draw the border around it - but we don't want the border
+ // on the side opposite to the arrow point
+ wxRect rect = rectArrow;
+ DrawArrowBorder(dc, &rect, dir);
+
+ // then the arrow itself
+ DrawArrow(dc, dir, rect, flags);
+}
+
+// gtk_default_draw_arrow() takes ~350 lines and we can't do much better here
+// these people are just crazy :-(
+void wxGTKRenderer::DrawArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags)
+{
+ enum
+ {
+ Point_First,
+ Point_Second,
+ Point_Third,
+ Point_Max
+ };
+
+ wxPoint ptArrow[Point_Max];
+
+ wxColour colInside = GetBackgroundColour(flags);
+ wxPen penShadow[4];
+ if ( flags & wxCONTROL_DISABLED )
+ {
+ penShadow[0] = m_penDarkGrey;
+ penShadow[1] = m_penDarkGrey;
+ penShadow[2] = wxNullPen;
+ penShadow[3] = wxNullPen;
+ }
+ else if ( flags & wxCONTROL_PRESSED )
+ {
+ penShadow[0] = m_penDarkGrey;
+ penShadow[1] = m_penHighlight;
+ penShadow[2] = wxNullPen;
+ penShadow[3] = m_penBlack;
+ }
+ else // normal arrow
+ {
+ penShadow[0] = m_penHighlight;
+ penShadow[1] = m_penBlack;
+ penShadow[2] = m_penDarkGrey;
+ penShadow[3] = wxNullPen;
+ }
+
+ wxCoord middle;
+ if ( dir == wxUP || dir == wxDOWN )
+ {
+ // horz middle
+ middle = (rect.GetRight() + rect.GetLeft() + 1) / 2;
+ }
+ else // horz arrow
+ {
+ middle = (rect.GetTop() + rect.GetBottom() + 1) / 2;
+ }
+
+ // draw the arrow interior
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.SetBrush(wxBrush(colInside, wxSOLID));
+
+ switch ( dir )
+ {
+ case wxUP:
+ ptArrow[Point_First].x = rect.GetLeft();
+ ptArrow[Point_First].y = rect.GetBottom();
+ ptArrow[Point_Second].x = middle;
+ ptArrow[Point_Second].y = rect.GetTop();
+ ptArrow[Point_Third].x = rect.GetRight();
+ ptArrow[Point_Third].y = rect.GetBottom();
+ break;
+
+ case wxDOWN:
+ ptArrow[Point_First] = rect.GetPosition();
+ ptArrow[Point_Second].x = middle;
+ ptArrow[Point_Second].y = rect.GetBottom();
+ ptArrow[Point_Third].x = rect.GetRight();
+ ptArrow[Point_Third].y = rect.GetTop();
+ break;
+
+ case wxLEFT:
+ ptArrow[Point_First].x = rect.GetRight();
+ ptArrow[Point_First].y = rect.GetTop();
+ ptArrow[Point_Second].x = rect.GetLeft();
+ ptArrow[Point_Second].y = middle;
+ ptArrow[Point_Third].x = rect.GetRight();
+ ptArrow[Point_Third].y = rect.GetBottom();
+ break;
+
+ case wxRIGHT:
+ ptArrow[Point_First] = rect.GetPosition();
+ ptArrow[Point_Second].x = rect.GetRight();
+ ptArrow[Point_Second].y = middle;
+ ptArrow[Point_Third].x = rect.GetLeft();
+ ptArrow[Point_Third].y = rect.GetBottom();
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown arrow direction"));
+ }
+
+ dc.DrawPolygon(WXSIZEOF(ptArrow), ptArrow);
+
+ // draw the arrow border
+ dc.SetPen(penShadow[0]);
+ switch ( dir )
+ {
+ case wxUP:
+ dc.DrawLine(ptArrow[Point_Second], ptArrow[Point_First]);
+ dc.DrawPoint(ptArrow[Point_First]);
+ if ( penShadow[3].Ok() )
+ {
+ dc.SetPen(penShadow[3]);
+ dc.DrawLine(ptArrow[Point_First].x + 1, ptArrow[Point_First].y,
+ ptArrow[Point_Second].x, ptArrow[Point_Second].y);
+ }
+ dc.SetPen(penShadow[1]);
+ dc.DrawLine(ptArrow[Point_Second].x + 1, ptArrow[Point_Second].y + 1,
+ ptArrow[Point_Third].x, ptArrow[Point_Third].y);
+ dc.DrawPoint(ptArrow[Point_Third]);
+ dc.DrawLine(ptArrow[Point_Third].x - 2, ptArrow[Point_Third].y,
+ ptArrow[Point_First].x + 1, ptArrow[Point_First].y);
+ if ( penShadow[2].Ok() )
+ {
+ dc.SetPen(penShadow[2]);
+ dc.DrawLine(ptArrow[Point_Third].x - 1, ptArrow[Point_Third].y,
+ ptArrow[Point_Second].x, ptArrow[Point_Second].y + 1);
+ dc.DrawLine(ptArrow[Point_Third].x - 1, ptArrow[Point_Third].y - 1,
+ ptArrow[Point_First].x + 2, ptArrow[Point_First].y - 1);
+ }
+ break;
+
+ case wxDOWN:
+ dc.DrawLine(ptArrow[Point_First], ptArrow[Point_Second]);
+ dc.DrawLine(ptArrow[Point_First].x + 2, ptArrow[Point_First].y,
+ ptArrow[Point_Third].x - 1, ptArrow[Point_Third].y);
+ if ( penShadow[2].Ok() )
+ {
+ dc.SetPen(penShadow[2]);
+ dc.DrawLine(ptArrow[Point_Second].x, ptArrow[Point_Second].y - 1,
+ ptArrow[Point_Third].x - 1, ptArrow[Point_Third].y - 1);
+ }
+ dc.SetPen(penShadow[1]);
+ dc.DrawLine(ptArrow[Point_Second], ptArrow[Point_Third]);
+ dc.DrawPoint(ptArrow[Point_Third]);
+ break;
+
+ case wxLEFT:
+ dc.DrawLine(ptArrow[Point_Second], ptArrow[Point_First]);
+ dc.DrawPoint(ptArrow[Point_First]);
+ if ( penShadow[2].Ok() )
+ {
+ dc.SetPen(penShadow[2]);
+ dc.DrawLine(ptArrow[Point_Third].x - 1, ptArrow[Point_Third].y,
+ ptArrow[Point_First].x - 1, ptArrow[Point_First].y + 2);
+ dc.DrawLine(ptArrow[Point_Third].x, ptArrow[Point_Third].y,
+ ptArrow[Point_Second].x + 2, ptArrow[Point_Second].y + 1);
+ }
+ dc.SetPen(penShadow[1]);
+ dc.DrawLine(ptArrow[Point_Third].x, ptArrow[Point_Third].y,
+ ptArrow[Point_First].x, ptArrow[Point_First].y + 1);
+ dc.DrawLine(ptArrow[Point_Second].x + 1, ptArrow[Point_Second].y + 1,
+ ptArrow[Point_Third].x - 1, ptArrow[Point_Third].y);
+ break;
+
+ case wxRIGHT:
+ dc.DrawLine(ptArrow[Point_First], ptArrow[Point_Third]);
+ dc.DrawLine(ptArrow[Point_First].x + 2, ptArrow[Point_First].y + 1,
+ ptArrow[Point_Second].x, ptArrow[Point_Second].y);
+ dc.SetPen(penShadow[1]);
+ dc.DrawLine(ptArrow[Point_Second], ptArrow[Point_Third]);
+ dc.DrawPoint(ptArrow[Point_Third]);
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown arrow direction"));
+ return;
+ }
+}
+
+void wxGTKRenderer::DrawThumbBorder(wxDC& dc,
+ wxRect *rect,
+ wxOrientation orient)
+{
+ if ( orient == wxVERTICAL )
+ {
+ DrawAntiShadedRectSide(dc, *rect, m_penDarkGrey, m_penHighlight,
+ wxLEFT);
+ DrawAntiShadedRectSide(dc, *rect, m_penDarkGrey, m_penHighlight,
+ wxRIGHT);
+ rect->Inflate(-1, 0);
+
+ DrawAntiShadedRectSide(dc, *rect, m_penBlack, m_penGrey,
+ wxLEFT);
+ DrawAntiShadedRectSide(dc, *rect, m_penBlack, m_penGrey,
+ wxRIGHT);
+ rect->Inflate(-1, 0);
+ }
+ else
+ {
+ DrawAntiShadedRectSide(dc, *rect, m_penDarkGrey, m_penHighlight,
+ wxUP);
+ DrawAntiShadedRectSide(dc, *rect, m_penDarkGrey, m_penHighlight,
+ wxDOWN);
+ rect->Inflate(0, -1);
+
+ DrawAntiShadedRectSide(dc, *rect, m_penBlack, m_penGrey,
+ wxUP);
+ DrawAntiShadedRectSide(dc, *rect, m_penBlack, m_penGrey,
+ wxDOWN);
+ rect->Inflate(0, -1);
+ }
+}
+
+void wxGTKRenderer::DrawScrollbarThumb(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags)
+{
+ // the thumb is never pressed never has focus border under GTK and the
+ // scrollbar background never changes at all
+ int flagsThumb = flags & ~(wxCONTROL_PRESSED | wxCONTROL_FOCUSED);
+
+ // we don't want the border in the direction of the scrollbar movement
+ wxRect rectThumb = rect;
+ DrawThumbBorder(dc, &rectThumb, orient);
+
+ DrawButtonBorder(dc, rectThumb, flagsThumb, &rectThumb);
+ DrawBackground(dc, wxNullColour, rectThumb, flagsThumb);
+}
+
+void wxGTKRenderer::DrawScrollbarShaft(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags)
+{
+ wxRect rectBar = rect;
+ DrawThumbBorder(dc, &rectBar, orient);
+ DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rectBar);
+}
+
+void wxGTKRenderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
+{
+ DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
+}
+
+wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos) const
+{
+ // as GTK scrollbars can't be disabled, it makes no sense to remove the
+ // thumb for a scrollbar with range 0 - instead, make it fill the entire
+ // scrollbar shaft
+ if ( (elem == wxScrollBar::Element_Thumb) && !scrollbar->GetRange() )
+ {
+ elem = wxScrollBar::Element_Bar_2;
+ }
+
+ return StandardGetScrollbarRect(scrollbar, elem,
+ thumbPos,
+ GetScrollbarArrowSize(scrollbar));
+}
+
+wxCoord wxGTKRenderer::GetScrollbarSize(const wxScrollBar *scrollbar)
+{
+ return StandardScrollBarSize(scrollbar, GetScrollbarArrowSize(scrollbar));
+}
+
+wxHitTest wxGTKRenderer::HitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt) const
+{
+ return StandardHitTestScrollbar(scrollbar, pt,
+ GetScrollbarArrowSize(scrollbar));
+}
+
+wxCoord wxGTKRenderer::ScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos)
+{
+ return StandardScrollbarToPixel(scrollbar, thumbPos,
+ GetScrollbarArrowSize(scrollbar));
+}
+
+int wxGTKRenderer::PixelToScrollbar(const wxScrollBar *scrollbar,
+ wxCoord coord)
+{
+ return StandardPixelToScrollbar(scrollbar, coord,
+ GetScrollbarArrowSize(scrollbar));
+}
+
+// ----------------------------------------------------------------------------
+// size adjustments
+// ----------------------------------------------------------------------------
+
+void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
+{
+ if ( wxDynamicCast(window, wxButton) )
+ {
+ // TODO: this is ad hoc...
+ size->x += 3*window->GetCharWidth();
+ if ( size->x < 80 )
+ size->x = 80;
+ wxCoord minBtnHeight = 22;
+ if ( size->y < minBtnHeight )
+ size->y = minBtnHeight;
+
+ // button border width
+ size->y += 4;
+ }
+ else if ( wxDynamicCast(window, wxScrollBar) )
+ {
+ // we only set the width of vert scrollbars and height of the
+ // horizontal ones
+ if ( window->GetWindowStyle() & wxSB_HORIZONTAL )
+ size->y = m_sizeScrollbarArrow.x;
+ else
+ size->x = m_sizeScrollbarArrow.x;
+ }
+ else
+ {
+ // take into account the border width
+ wxRect rectBorder = GetBorderDimensions(window->GetBorder());
+ size->x += rectBorder.x + rectBorder.width;
+ size->y += rectBorder.y + rectBorder.height;
+ }
+}
+
+// ============================================================================
+// wxInputHandler
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxGTKInputHandler
+// ----------------------------------------------------------------------------
+
+wxGTKInputHandler::wxGTKInputHandler(wxGTKRenderer *renderer)
+{
+ m_renderer = renderer;
+}
+
+bool wxGTKInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ return FALSE;
+}
+
+bool wxGTKInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ // clicking on the control gives it focus
+ if ( event.ButtonDown() )
+ {
+ control->SetFocus();
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+bool wxGTKInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ if ( event.Entering() )
+ {
+ control->SetCurrent(TRUE);
+ }
+ else if ( event.Leaving() )
+ {
+ control->SetCurrent(FALSE);
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxGTKCheckboxInputHandler
+// ----------------------------------------------------------------------------
+
+bool wxGTKCheckboxInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ if ( pressed )
+ {
+ int keycode = event.GetKeyCode();
+ if ( keycode == WXK_SPACE || keycode == WXK_RETURN )
+ {
+ control->PerformAction(wxACTION_CHECKBOX_TOGGLE);
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// wxGTKTextCtrlInputHandler
+// ----------------------------------------------------------------------------
+
+bool wxGTKTextCtrlInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ // handle only GTK-specific text bindings here, the others are handled in
+ // the base class
+ if ( pressed )
+ {
+ wxControlAction action;
+ int keycode = event.GetKeyCode();
+ if ( event.ControlDown() )
+ {
+ switch ( keycode )
+ {
+ case 'A':
+ action = wxACTION_TEXT_HOME;
+ break;
+
+ case 'B':
+ action = wxACTION_TEXT_LEFT;
+ break;
+
+ case 'D':
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_RIGHT;
+ break;
+
+ case 'E':
+ action = wxACTION_TEXT_END;
+ break;
+
+ case 'F':
+ action = wxACTION_TEXT_RIGHT;
+ break;
+
+ case 'H':
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_LEFT;
+ break;
+
+ case 'K':
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_END;
+ break;
+
+ case 'N':
+ action = wxACTION_TEXT_DOWN;
+ break;
+
+ case 'P':
+ action = wxACTION_TEXT_UP;
+ break;
+
+ case 'U':
+ //delete the entire line
+ control->PerformAction(wxACTION_TEXT_HOME);
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_END;
+ break;
+
+ case 'W':
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_WORD_LEFT;
+ break;
+ }
+ }
+ else if ( event.AltDown() )
+ {
+ switch ( keycode )
+ {
+ case 'B':
+ action = wxACTION_TEXT_WORD_LEFT;
+ break;
+
+ case 'D':
+ action << wxACTION_TEXT_PREFIX_DEL << wxACTION_TEXT_WORD_RIGHT;
+ break;
+
+ case 'F':
+ action = wxACTION_TEXT_WORD_RIGHT;
+ break;
+ }
+ }
+
+ if ( action != wxACTION_NONE )
+ {
+ control->PerformAction(action);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
+}
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/themes/win32.cpp
+// Purpose: wxUniversal theme implementing Win32-like LNF
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/timer.h"
+ #include "wx/intl.h"
+ #include "wx/dc.h"
+ #include "wx/window.h"
+
+ #include "wx/dcmemory.h"
+
+ #include "wx/button.h"
+ #include "wx/listbox.h"
+ #include "wx/checklst.h"
+ #include "wx/scrolbar.h"
+ #include "wx/slider.h"
+ #include "wx/textctrl.h"
+#endif // WX_PRECOMP
+
+#include "wx/notebook.h"
+#include "wx/spinbutt.h"
+
+#include "wx/univ/scrtimer.h"
+
+#include "wx/univ/renderer.h"
+#include "wx/univ/inphand.h"
+#include "wx/univ/colschem.h"
+#include "wx/univ/theme.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+static const int BORDER_THICKNESS = 2;
+
+// the offset between the label and focus rect around it
+static const int FOCUS_RECT_OFFSET_X = 1;
+static const int FOCUS_RECT_OFFSET_Y = 1;
+
+enum IndicatorType
+{
+ IndicatorType_Check,
+ IndicatorType_Radio,
+ IndicatorType_Menu,
+ IndicatorType_Max
+};
+
+enum IndicatorState
+{
+ IndicatorState_Normal,
+ IndicatorState_Pressed, // this one is for check/radioboxes
+ IndicatorState_Selected = IndicatorState_Pressed, // for menus
+ IndicatorState_Disabled,
+ IndicatorState_SelectedDisabled, // only for the menus
+ IndicatorState_Max
+};
+
+enum IndicatorStatus
+{
+ IndicatorStatus_Checked,
+ IndicatorStatus_Unchecked,
+ IndicatorStatus_Max
+};
+
+// ----------------------------------------------------------------------------
+// wxWin32Renderer: draw the GUI elements in Win32 style
+// ----------------------------------------------------------------------------
+
+class wxWin32Renderer : public wxRenderer
+{
+public:
+ // constants
+ enum wxArrowDirection
+ {
+ Arrow_Left,
+ Arrow_Right,
+ Arrow_Up,
+ Arrow_Down,
+ Arrow_Max
+ };
+
+ enum wxArrowStyle
+ {
+ Arrow_Normal,
+ Arrow_Disabled,
+ Arrow_Pressed,
+ Arrow_Inversed,
+ Arrow_InversedDisabled,
+ Arrow_StateMax
+ };
+
+ // ctor
+ wxWin32Renderer(const wxColourScheme *scheme);
+
+ // implement the base class pure virtuals
+ virtual void DrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL);
+ virtual void DrawButtonLabel(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL);
+ virtual void DrawBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL);
+ virtual void DrawHorizontalLine(wxDC& dc,
+ wxCoord y, wxCoord x1, wxCoord x2);
+ virtual void DrawVerticalLine(wxDC& dc,
+ wxCoord x, wxCoord y1, wxCoord y2);
+ virtual void DrawFrame(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT,
+ int indexAccel = -1);
+ virtual void DrawTextBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL);
+ virtual void DrawButtonBorder(wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxRect *rectIn = (wxRect *)NULL);
+ virtual void DrawArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawScrollbarArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags = 0)
+ { DrawArrow(dc, dir, rect, flags); }
+ virtual void DrawScrollbarThumb(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawScrollbarShaft(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawScrollCorner(wxDC& dc,
+ const wxRect& rect);
+ virtual void DrawItem(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0);
+ virtual void DrawCheckButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1);
+ virtual void DrawRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0,
+ wxAlignment align = wxALIGN_LEFT,
+ int indexAccel = -1);
+ virtual void DrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart = -1,
+ int selEnd = -1,
+ int flags = 0);
+ virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect);
+ virtual void DrawTab(wxDC& dc,
+ const wxRect& rect,
+ wxDirection dir,
+ const wxString& label,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int indexAccel = -1);
+
+ virtual void DrawSliderShaft(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0,
+ wxRect *rectShaft = NULL);
+ virtual void DrawSliderThumb(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags = 0);
+ virtual void DrawSliderTicks(wxDC& dc,
+ const wxRect& rect,
+ const wxSize& sizeThumb,
+ wxOrientation orient,
+ int start,
+ int end,
+ int step = 1,
+ int flags = 0);
+
+ virtual void DrawMenuBarItem(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags = 0,
+ int indexAccel = -1);
+ virtual void DrawMenuItem(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geometryInfo,
+ const wxString& label,
+ const wxString& accel,
+ const wxBitmap& bitmap = wxNullBitmap,
+ int flags = 0,
+ int indexAccel = -1);
+ virtual void DrawMenuSeparator(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geomInfo);
+
+ virtual void GetComboBitmaps(wxBitmap *bmpNormal,
+ wxBitmap *bmpPressed,
+ wxBitmap *bmpDisabled);
+
+ virtual void AdjustSize(wxSize *size, const wxWindow *window);
+ virtual wxRect GetBorderDimensions(wxBorder border) const;
+ virtual bool AreScrollbarsInsideBorder() const;
+
+ virtual wxSize GetScrollbarArrowSize() const
+ { return m_sizeScrollbarArrow; }
+ virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos = -1) const;
+ virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar);
+ virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt) const;
+ virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos = -1);
+ virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
+ virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
+ { return fontHeight + 2; }
+ virtual wxSize GetCheckBitmapSize() const
+ { return wxSize(13, 13); }
+ virtual wxSize GetRadioBitmapSize() const
+ { return wxSize(12, 12); }
+ virtual wxCoord GetCheckItemMargin() const
+ { return 0; }
+
+ virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
+ const wxRect& rect);
+ virtual wxRect GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rect,
+ wxCoord *extraSpaceBeyond);
+
+ virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
+ virtual wxSize GetTabPadding() const { return wxSize(6, 5); }
+
+ virtual wxCoord GetSliderDim() const { return 20; }
+ virtual wxCoord GetSliderTickLen() const { return 4; }
+ virtual wxRect GetSliderShaftRect(const wxRect& rect,
+ wxOrientation orient) const;
+ virtual wxSize GetSliderThumbSize(const wxRect& rect,
+ wxOrientation orient) const;
+ virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
+
+ virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
+ virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
+ const wxMenu& menu) const;
+
+protected:
+ // helper of DrawLabel() and DrawCheckOrRadioButton()
+ void DoDrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL,
+ const wxPoint& focusOffset
+ = wxPoint(FOCUS_RECT_OFFSET_X, FOCUS_RECT_OFFSET_Y));
+
+ // common part of DrawLabel() and DrawItem()
+ void DrawFocusRect(wxDC& dc, const wxRect& rect);
+
+ // DrawLabel() and DrawButtonLabel() helper
+ void DrawLabelShadow(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int alignment,
+ int indexAccel);
+
+ // DrawButtonBorder() helper
+ void DoDrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect);
+
+ // DrawBorder() helpers: all of them shift and clip the DC after drawing
+ // the border
+
+ // just draw a rectangle with the given pen
+ void DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen);
+
+ // draw the lower left part of rectangle
+ void DrawHalfRect(wxDC& dc, wxRect *rect, const wxPen& pen);
+
+ // draw the rectange using the first brush for the left and top sides and
+ // the second one for the bottom and right ones
+ void DrawShadedRect(wxDC& dc, wxRect *rect,
+ const wxPen& pen1, const wxPen& pen2);
+
+ // draw the normal 3D border
+ void DrawRaisedBorder(wxDC& dc, wxRect *rect);
+
+ // draw the sunken 3D border
+ void DrawSunkenBorder(wxDC& dc, wxRect *rect);
+
+ // draw the border used for scrollbar arrows
+ void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = FALSE);
+
+ // public DrawArrow()s helper
+ void DrawArrow(wxDC& dc, const wxRect& rect,
+ wxArrowDirection arrowDir, wxArrowStyle arrowStyle);
+
+ // DrawArrowButton is used by DrawScrollbar and DrawComboButton
+ void DrawArrowButton(wxDC& dc, const wxRect& rect,
+ wxArrowDirection arrowDir,
+ wxArrowStyle arrowStyle);
+
+ // DrawCheckButton/DrawRadioButton helper
+ void DrawCheckOrRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags,
+ wxAlignment align,
+ int indexAccel,
+ wxCoord focusOffsetY);
+
+ // draw a normal or transposed line (useful for using the same code fo both
+ // horizontal and vertical widgets)
+ void DrawLine(wxDC& dc,
+ wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ bool transpose = FALSE)
+ {
+ if ( transpose )
+ dc.DrawLine(y1, x1, y2, x2);
+ else
+ dc.DrawLine(x1, y1, x2, y2);
+ }
+
+ // get the standard check/radio button bitmap
+ wxBitmap GetIndicator(IndicatorType indType, int flags);
+ wxBitmap GetCheckBitmap(int flags)
+ { return GetIndicator(IndicatorType_Check, flags); }
+ wxBitmap GetRadioBitmap(int flags)
+ { return GetIndicator(IndicatorType_Radio, flags); }
+
+private:
+ const wxColourScheme *m_scheme;
+
+ // the sizing parameters (TODO make them changeable)
+ wxSize m_sizeScrollbarArrow;
+
+ // GDI objects we use for drawing
+ wxColour m_colDarkGrey,
+ m_colHighlight;
+
+ wxPen m_penBlack,
+ m_penDarkGrey,
+ m_penLightGrey,
+ m_penHighlight;
+
+ // first row is for the normal state, second - for the disabled
+ wxBitmap m_bmpArrows[Arrow_StateMax][Arrow_Max];
+};
+
+// ----------------------------------------------------------------------------
+// wxWin32InputHandler and derived classes: process the keyboard and mouse
+// messages according to Windows standards
+// ----------------------------------------------------------------------------
+
+class wxWin32InputHandler : public wxInputHandler
+{
+public:
+ wxWin32InputHandler(wxWin32Renderer *renderer);
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxControl *control,
+ const wxMouseEvent& event);
+
+protected:
+ wxWin32Renderer *m_renderer;
+};
+
+class wxWin32ScrollBarInputHandler : public wxStdScrollBarInputHandler
+{
+public:
+ wxWin32ScrollBarInputHandler(wxWin32Renderer *renderer,
+ wxInputHandler *handler);
+
+ virtual bool HandleMouse(wxControl *control, const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
+
+ virtual bool OnScrollTimer(wxScrollBar *scrollbar,
+ const wxControlAction& action);
+
+protected:
+ virtual bool IsAllowedButton(int button) { return button == 1; }
+
+ virtual void Highlight(wxScrollBar *scrollbar, bool doIt)
+ {
+ // we don't highlight anything
+ }
+
+ // the first and last event which caused the thumb to move
+ wxMouseEvent m_eventStartDrag,
+ m_eventLastDrag;
+
+ // have we paused the scrolling because the mouse moved?
+ bool m_scrollPaused;
+
+ // we remember the interval of the timer to be able to restart it
+ int m_interval;
+};
+
+class wxWin32CheckboxInputHandler : public wxStdCheckboxInputHandler
+{
+public:
+ wxWin32CheckboxInputHandler(wxInputHandler *handler)
+ : wxStdCheckboxInputHandler(handler) { }
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+};
+
+class wxWin32TextCtrlInputHandler : public wxStdTextCtrlInputHandler
+{
+public:
+ wxWin32TextCtrlInputHandler(wxInputHandler *handler)
+ : wxStdTextCtrlInputHandler(handler) { }
+
+ virtual bool HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed);
+};
+
+// ----------------------------------------------------------------------------
+// wxWin32ColourScheme: uses (default) Win32 colours
+// ----------------------------------------------------------------------------
+
+class wxWin32ColourScheme : public wxColourScheme
+{
+public:
+ virtual wxColour Get(StdColour col) const;
+ virtual wxColour GetBackground(wxWindow *win) const;
+};
+
+// ----------------------------------------------------------------------------
+// wxWin32Theme
+// ----------------------------------------------------------------------------
+
+WX_DEFINE_ARRAY(wxInputHandler *, wxArrayHandlers);
+
+class wxWin32Theme : public wxTheme
+{
+public:
+ wxWin32Theme();
+ virtual ~wxWin32Theme();
+
+ virtual wxRenderer *GetRenderer() { return m_renderer; }
+ virtual wxInputHandler *GetInputHandler(const wxString& control);
+ virtual wxColourScheme *GetColourScheme();
+
+private:
+ // get the default input handler
+ wxInputHandler *GetDefaultInputHandler();
+
+ wxWin32Renderer *m_renderer;
+
+ // the names of the already created handlers and the handlers themselves
+ // (these arrays are synchronized)
+ wxSortedArrayString m_handlerNames;
+ wxArrayHandlers m_handlers;
+
+ wxWin32InputHandler *m_handlerDefault;
+
+ wxWin32ColourScheme *m_scheme;
+
+ WX_DECLARE_THEME(win32)
+};
+
+// ----------------------------------------------------------------------------
+// standard bitmaps
+// ----------------------------------------------------------------------------
+
+// menu bitmaps
+
+static const char *checked_menu_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"9 9 2 1",
+"w c None",
+"b c black",
+/* pixels */
+"wwwwwwwww",
+"wwwwwwwbw",
+"wwwwwwbbw",
+"wbwwwbbbw",
+"wbbwbbbww",
+"wbbbbbwww",
+"wwbbbwwww",
+"wwwbwwwww",
+"wwwwwwwww"
+};
+
+static const char *selected_checked_menu_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"9 9 2 1",
+"w c None",
+"b c white",
+/* pixels */
+"wwwwwwwww",
+"wwwwwwwbw",
+"wwwwwwbbw",
+"wbwwwbbbw",
+"wbbwbbbww",
+"wbbbbbwww",
+"wwbbbwwww",
+"wwwbwwwww",
+"wwwwwwwww"
+};
+
+static const char *disabled_checked_menu_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"9 9 3 1",
+"w c None",
+"b c #7f7f7f",
+"W c #e0e0e0",
+/* pixels */
+"wwwwwwwww",
+"wwwwwwwbw",
+"wwwwwwbbW",
+"wbwwwbbbW",
+"wbbwbbbWW",
+"wbbbbbWWw",
+"wwbbbWWww",
+"wwwbWWwww",
+"wwwwWwwww"
+};
+
+static const char *selected_disabled_checked_menu_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"9 9 2 1",
+"w c None",
+"b c #7f7f7f",
+/* pixels */
+"wwwwwwwww",
+"wwwwwwwbw",
+"wwwwwwbbw",
+"wbwwwbbbw",
+"wbbwbbbww",
+"wbbbbbwww",
+"wwbbbwwww",
+"wwwbwwwww",
+"wwwwwwwww"
+};
+
+// checkbox and radiobox bitmaps below
+
+static const char *checked_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"13 13 5 1",
+"w c white",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+"ddddddddddddh",
+"dbbbbbbbbbbgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwbwgh",
+"dbwwwwwwbbwgh",
+"dbwbwwwbbbwgh",
+"dbwbbwbbbwwgh",
+"dbwbbbbbwwwgh",
+"dbwwbbbwwwwgh",
+"dbwwwbwwwwwgh",
+"dbwwwwwwwwwgh",
+"dgggggggggggh",
+"hhhhhhhhhhhhh"
+};
+
+static const char *pressed_checked_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"13 13 4 1",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+"ddddddddddddh",
+"dbbbbbbbbbbgh",
+"dbggggggggggh",
+"dbgggggggbggh",
+"dbggggggbbggh",
+"dbgbgggbbbggh",
+"dbgbbgbbbgggh",
+"dbgbbbbbggggh",
+"dbggbbbgggggh",
+"dbgggbggggggh",
+"dbggggggggggh",
+"dgggggggggggh",
+"hhhhhhhhhhhhh"
+};
+
+static const char *pressed_disabled_checked_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"13 13 4 1",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+"ddddddddddddh",
+"dbbbbbbbbbbgh",
+"dbggggggggggh",
+"dbgggggggdggh",
+"dbggggggddggh",
+"dbgdgggdddggh",
+"dbgddgdddgggh",
+"dbgdddddggggh",
+"dbggdddgggggh",
+"dbgggdggggggh",
+"dbggggggggggh",
+"dgggggggggggh",
+"hhhhhhhhhhhhh"
+};
+
+static const char *checked_item_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"13 13 3 1",
+"w c white",
+"b c black",
+"d c #808080",
+/* pixels */
+"wwwwwwwwwwwww",
+"wdddddddddddw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwbwdw",
+"wdwwwwwwbbwdw",
+"wdwbwwwbbbwdw",
+"wdwbbwbbbwwdw",
+"wdwbbbbbwwwdw",
+"wdwwbbbwwwwdw",
+"wdwwwbwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdddddddddddw",
+"wwwwwwwwwwwww"
+};
+
+static const char *unchecked_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"13 13 5 1",
+"w c white",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+"ddddddddddddh",
+"dbbbbbbbbbbgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dbwwwwwwwwwgh",
+"dgggggggggggh",
+"hhhhhhhhhhhhh"
+};
+
+static const char *pressed_unchecked_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"13 13 4 1",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+"ddddddddddddh",
+"dbbbbbbbbbbgh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"dbggggggggggh",
+"hhhhhhhhhhhhh"
+};
+
+static const char *unchecked_item_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"13 13 2 1",
+"w c white",
+"d c #808080",
+/* pixels */
+"wwwwwwwwwwwww",
+"wdddddddddddw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdwwwwwwwwwdw",
+"wdddddddddddw",
+"wwwwwwwwwwwww"
+};
+
+static const char *checked_radio_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"12 12 6 1",
+" c None",
+"w c white",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+" dddd ",
+" ddbbbbdd ",
+" dbbwwwwbbh ",
+" dbwwwwwwgh ",
+"dbwwwbbwwwgh",
+"dbwwbbbbwwgh",
+"dbwwbbbbwwgh",
+"dbwwwbbwwwgh",
+" dbwwwwwwgh ",
+" dggwwwwggh ",
+" hhgggghh ",
+" hhhh "
+};
+
+static const char *pressed_checked_radio_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"12 12 6 1",
+" c None",
+"w c white",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+" dddd ",
+" ddbbbbdd ",
+" dbbggggbbh ",
+" dbgggggggh ",
+"dbgggbbggggh",
+"dbggbbbbgggh",
+"dbggbbbbgggh",
+"dbgggbbggggh",
+" dbgggggggh ",
+" dggggggggh ",
+" hhgggghh ",
+" hhhh "
+};
+
+static const char *pressed_disabled_checked_radio_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"12 12 6 1",
+" c None",
+"w c white",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+" dddd ",
+" ddbbbbdd ",
+" dbbggggbbh ",
+" dbgggggggh ",
+"dbgggddggggh",
+"dbggddddgggh",
+"dbggddddgggh",
+"dbgggddggggh",
+" dbgggggggh ",
+" dggggggggh ",
+" hhgggghh ",
+" hhhh ",
+};
+
+static const char *unchecked_radio_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"12 12 6 1",
+" c None",
+"w c white",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+" dddd ",
+" ddbbbbdd ",
+" dbbwwwwbbh ",
+" dbwwwwwwgh ",
+"dbwwwwwwwwgh",
+"dbwwwwwwwwgh",
+"dbwwwwwwwwgh",
+"dbwwwwwwwwgh",
+" dbwwwwwwgh ",
+" dggwwwwggh ",
+" hhgggghh ",
+" hhhh "
+};
+
+static const char *pressed_unchecked_radio_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"12 12 6 1",
+" c None",
+"w c white",
+"b c black",
+"d c #7f7f7f",
+"g c #c0c0c0",
+"h c #e0e0e0",
+/* pixels */
+" dddd ",
+" ddbbbbdd ",
+" dbbggggbbh ",
+" dbgggggggh ",
+"dbgggggggggh",
+"dbgggggggggh",
+"dbgggggggggh",
+"dbgggggggggh",
+" dbgggggggh ",
+" dggggggggh ",
+" hhgggghh ",
+" hhhh "
+};
+
+static const char **
+ bmpIndicators[IndicatorType_Max][IndicatorState_Max][IndicatorStatus_Max] =
+{
+ // checkboxes first
+ {
+ // normal state
+ { checked_xpm, unchecked_xpm },
+
+ // pressed state
+ { pressed_checked_xpm, pressed_unchecked_xpm },
+
+ // disabled state
+ { pressed_disabled_checked_xpm, pressed_unchecked_xpm },
+ },
+
+ // radio
+ {
+ // normal state
+ { checked_radio_xpm, unchecked_radio_xpm },
+
+ // pressed state
+ { pressed_checked_radio_xpm, pressed_unchecked_radio_xpm },
+
+ // disabled state
+ { pressed_disabled_checked_radio_xpm, pressed_unchecked_radio_xpm },
+ },
+
+ // menu
+ {
+ // normal state
+ { checked_menu_xpm, NULL },
+
+ // selected state
+ { selected_checked_menu_xpm, NULL },
+
+ // disabled state
+ { disabled_checked_menu_xpm, NULL },
+
+ // disabled selected state
+ { selected_disabled_checked_menu_xpm, NULL },
+ }
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+WX_IMPLEMENT_THEME(wxWin32Theme, win32, wxTRANSLATE("Win32 theme"));
+
+// ----------------------------------------------------------------------------
+// wxWin32Theme
+// ----------------------------------------------------------------------------
+
+wxWin32Theme::wxWin32Theme()
+{
+ m_scheme = new wxWin32ColourScheme;
+ m_renderer = new wxWin32Renderer(m_scheme);
+ m_handlerDefault = NULL;
+}
+
+wxWin32Theme::~wxWin32Theme()
+{
+ size_t count = m_handlers.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( m_handlers[n] != m_handlerDefault )
+ delete m_handlers[n];
+ }
+
+ delete m_handlerDefault;
+
+ delete m_renderer;
+ delete m_scheme;
+}
+
+wxInputHandler *wxWin32Theme::GetDefaultInputHandler()
+{
+ if ( !m_handlerDefault )
+ {
+ m_handlerDefault = new wxWin32InputHandler(m_renderer);
+ }
+
+ return m_handlerDefault;
+}
+
+wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control)
+{
+ wxInputHandler *handler;
+ int n = m_handlerNames.Index(control);
+ if ( n == wxNOT_FOUND )
+ {
+ // create a new handler
+ if ( control == wxINP_HANDLER_SCROLLBAR )
+ handler = new wxWin32ScrollBarInputHandler(m_renderer,
+ GetDefaultInputHandler());
+#if wxUSE_BUTTON
+ else if ( control == wxINP_HANDLER_BUTTON )
+ handler = new wxStdButtonInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_BUTTON
+#if wxUSE_CHECKBOX
+ else if ( control == wxINP_HANDLER_CHECKBOX )
+ handler = new wxWin32CheckboxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_CHECKBOX
+#if wxUSE_COMBOBOX
+ else if ( control == wxINP_HANDLER_COMBOBOX )
+ handler = new wxStdComboBoxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_COMBOBOX
+#if wxUSE_LISTBOX
+ else if ( control == wxINP_HANDLER_LISTBOX )
+ handler = new wxStdListboxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_LISTBOX
+#if wxUSE_CHECKLISTBOX
+ else if ( control == wxINP_HANDLER_CHECKLISTBOX )
+ handler = new wxStdCheckListboxInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_CHECKLISTBOX
+#if wxUSE_TEXTCTRL
+ else if ( control == wxINP_HANDLER_TEXTCTRL )
+ handler = new wxWin32TextCtrlInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_TEXTCTRL
+#if wxUSE_SLIDER
+ else if ( control == wxINP_HANDLER_SLIDER )
+ handler = new wxStdSliderButtonInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_SLIDER
+#if wxUSE_SPINBTN
+ else if ( control == wxINP_HANDLER_SPINBTN )
+ handler = new wxStdSpinButtonInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_SPINBTN
+#if wxUSE_NOTEBOOK
+ else if ( control == wxINP_HANDLER_NOTEBOOK )
+ handler = new wxStdNotebookInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_NOTEBOOK
+ else
+ handler = GetDefaultInputHandler();
+
+ n = m_handlerNames.Add(control);
+ m_handlers.Insert(handler, n);
+ }
+ else // we already have it
+ {
+ handler = m_handlers[n];
+ }
+
+ return handler;
+}
+
+wxColourScheme *wxWin32Theme::GetColourScheme()
+{
+ return m_scheme;
+}
+
+// ============================================================================
+// wxWin32ColourScheme
+// ============================================================================
+
+wxColour wxWin32ColourScheme::GetBackground(wxWindow *win) const
+{
+ wxColour col;
+ if ( win->UseBgCol() )
+ {
+ // use the user specified colour
+ col = win->GetBackgroundColour();
+ }
+
+ if ( win->IsContainerWindow() )
+ {
+ wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
+ if ( text )
+ {
+ if ( !text->IsEnabled() ) // not IsEditable()
+ col = Get(CONTROL);
+ //else: execute code below
+ }
+
+ if ( !col.Ok() )
+ {
+ // doesn't depend on the state
+ col = Get(WINDOW);
+ }
+ }
+ else
+ {
+ int flags = win->GetStateFlags();
+
+ // the colour set by the user should be used for the normal state
+ // and for the states for which we don't have any specific colours
+ if ( !col.Ok() || (flags != 0) )
+ {
+ if ( wxDynamicCast(win, wxScrollBar) )
+ col = Get(flags & wxCONTROL_PRESSED ? SCROLLBAR_PRESSED
+ : SCROLLBAR);
+ else
+ col = Get(CONTROL);
+ }
+ }
+
+ return col;
+}
+
+wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
+{
+ switch ( col )
+ {
+ case WINDOW: return *wxWHITE;
+
+ case CONTROL_PRESSED:
+ case CONTROL_CURRENT:
+ case CONTROL: return wxColour(0xc0c0c0);
+
+ case CONTROL_TEXT: return *wxBLACK;
+
+ case SCROLLBAR: return wxColour(0xe0e0e0);
+ case SCROLLBAR_PRESSED: return *wxBLACK;
+
+ case HIGHLIGHT: return wxColour(0x800000);
+ case HIGHLIGHT_TEXT: return wxColour(0xffffff);
+
+ case SHADOW_DARK: return *wxBLACK;
+
+ case CONTROL_TEXT_DISABLED:
+ case SHADOW_HIGHLIGHT: return wxColour(0xe0e0e0);
+
+ case SHADOW_IN: return wxColour(0xc0c0c0);
+
+ case CONTROL_TEXT_DISABLED_SHADOW:
+ case SHADOW_OUT: return wxColour(0x7f7f7f);
+
+ case MAX:
+ default:
+ wxFAIL_MSG(_T("invalid standard colour"));
+ return *wxBLACK;
+ }
+}
+
+// ============================================================================
+// wxWin32Renderer
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// construction
+// ----------------------------------------------------------------------------
+
+wxWin32Renderer::wxWin32Renderer(const wxColourScheme *scheme)
+{
+ // init data
+ m_scheme = scheme;
+ m_sizeScrollbarArrow = wxSize(16, 16);
+
+ // init colours and pens
+ m_penBlack = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_DARK), 0, wxSOLID);
+
+ m_colDarkGrey = wxSCHEME_COLOUR(scheme, SHADOW_OUT);
+ m_penDarkGrey = wxPen(m_colDarkGrey, 0, wxSOLID);
+
+ m_penLightGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_IN), 0, wxSOLID);
+
+ m_colHighlight = wxSCHEME_COLOUR(scheme, SHADOW_HIGHLIGHT);
+ m_penHighlight = wxPen(m_colHighlight, 0, wxSOLID);
+
+ // init the arrow bitmaps
+ static const size_t ARROW_WIDTH = 7;
+ static const size_t ARROW_LENGTH = 4;
+
+ wxMask *mask;
+ wxMemoryDC dcNormal,
+ dcDisabled,
+ dcInverse;
+ for ( size_t n = 0; n < Arrow_Max; n++ )
+ {
+ bool isVertical = n > Arrow_Right;
+ int w, h;
+ if ( isVertical )
+ {
+ w = ARROW_WIDTH;
+ h = ARROW_LENGTH;
+ }
+ else
+ {
+ h = ARROW_WIDTH;
+ w = ARROW_LENGTH;
+ }
+
+ // disabled arrow is larger because of the shadow
+ m_bmpArrows[Arrow_Normal][n].Create(w, h);
+ m_bmpArrows[Arrow_Disabled][n].Create(w + 1, h + 1);
+
+ dcNormal.SelectObject(m_bmpArrows[Arrow_Normal][n]);
+ dcDisabled.SelectObject(m_bmpArrows[Arrow_Disabled][n]);
+
+ dcNormal.SetBackground(*wxWHITE_BRUSH);
+ dcDisabled.SetBackground(*wxWHITE_BRUSH);
+ dcNormal.Clear();
+ dcDisabled.Clear();
+
+ dcNormal.SetPen(m_penBlack);
+ dcDisabled.SetPen(m_penDarkGrey);
+
+ // calculate the position of the point of the arrow
+ wxCoord x1, y1;
+ if ( isVertical )
+ {
+ x1 = (ARROW_WIDTH - 1)/2;
+ y1 = n == Arrow_Up ? 0 : ARROW_LENGTH - 1;
+ }
+ else // horizontal
+ {
+ x1 = n == Arrow_Left ? 0 : ARROW_LENGTH - 1;
+ y1 = (ARROW_WIDTH - 1)/2;
+ }
+
+ wxCoord x2 = x1,
+ y2 = y1;
+
+ if ( isVertical )
+ x2++;
+ else
+ y2++;
+
+ for ( size_t i = 0; i < ARROW_LENGTH; i++ )
+ {
+ dcNormal.DrawLine(x1, y1, x2, y2);
+ dcDisabled.DrawLine(x1, y1, x2, y2);
+
+ if ( isVertical )
+ {
+ x1--;
+ x2++;
+
+ if ( n == Arrow_Up )
+ {
+ y1++;
+ y2++;
+ }
+ else // down arrow
+ {
+ y1--;
+ y2--;
+ }
+ }
+ else // left or right arrow
+ {
+ y1--;
+ y2++;
+
+ if ( n == Arrow_Left )
+ {
+ x1++;
+ x2++;
+ }
+ else
+ {
+ x1--;
+ x2--;
+ }
+ }
+ }
+
+ // draw the shadow for the disabled one
+ dcDisabled.SetPen(m_penHighlight);
+ switch ( n )
+ {
+ case Arrow_Left:
+ y1 += 2;
+ dcDisabled.DrawLine(x1, y1, x2, y2);
+ break;
+
+ case Arrow_Right:
+ x1 = ARROW_LENGTH - 1;
+ y1 = (ARROW_WIDTH - 1)/2 + 1;
+ x2 = 0;
+ y2 = ARROW_WIDTH;
+ dcDisabled.DrawLine(x1, y1, x2, y2);
+ dcDisabled.DrawLine(++x1, y1, x2, ++y2);
+ break;
+
+ case Arrow_Up:
+ x1 += 2;
+ dcDisabled.DrawLine(x1, y1, x2, y2);
+ break;
+
+ case Arrow_Down:
+ x1 = ARROW_WIDTH - 1;
+ y1 = 1;
+ x2 = (ARROW_WIDTH - 1)/2;
+ y2 = ARROW_LENGTH;
+ dcDisabled.DrawLine(x1, y1, x2, y2);
+ dcDisabled.DrawLine(++x1, y1, x2, ++y2);
+ break;
+
+ }
+
+ // create the inversed bitmap but only for the right arrow as we only
+ // use it for the menus
+ if ( n == Arrow_Right )
+ {
+ m_bmpArrows[Arrow_Inversed][n].Create(w, h);
+ dcInverse.SelectObject(m_bmpArrows[Arrow_Inversed][n]);
+ dcInverse.Clear();
+ dcInverse.Blit(0, 0, w, h,
+ &dcNormal, 0, 0,
+ wxXOR);
+ dcInverse.SelectObject(wxNullBitmap);
+
+ mask = new wxMask(m_bmpArrows[Arrow_Inversed][n], *wxBLACK);
+ m_bmpArrows[Arrow_Inversed][n].SetMask(mask);
+
+ m_bmpArrows[Arrow_InversedDisabled][n].Create(w, h);
+ dcInverse.SelectObject(m_bmpArrows[Arrow_InversedDisabled][n]);
+ dcInverse.Clear();
+ dcInverse.Blit(0, 0, w, h,
+ &dcDisabled, 0, 0,
+ wxXOR);
+ dcInverse.SelectObject(wxNullBitmap);
+
+ mask = new wxMask(m_bmpArrows[Arrow_InversedDisabled][n], *wxBLACK);
+ m_bmpArrows[Arrow_InversedDisabled][n].SetMask(mask);
+ }
+
+ dcNormal.SelectObject(wxNullBitmap);
+ dcDisabled.SelectObject(wxNullBitmap);
+
+ mask = new wxMask(m_bmpArrows[Arrow_Normal][n], *wxWHITE);
+ m_bmpArrows[Arrow_Normal][n].SetMask(mask);
+ mask = new wxMask(m_bmpArrows[Arrow_Disabled][n], *wxWHITE);
+ m_bmpArrows[Arrow_Disabled][n].SetMask(mask);
+
+ m_bmpArrows[Arrow_Pressed][n] = m_bmpArrows[Arrow_Normal][n];
+ }
+}
+
+// ----------------------------------------------------------------------------
+// border stuff
+// ----------------------------------------------------------------------------
+
+/*
+ The raised border in Win32 looks like this:
+
+ IIIIIIIIIIIIIIIIIIIIIIB
+ I GB
+ I GB I = white (HILIGHT)
+ I GB H = light grey (LIGHT)
+ I GB G = dark grey (SHADOI)
+ I GB B = black (DKSHADOI)
+ I GB I = hIghlight (COLOR_3DHILIGHT)
+ I GB
+ IGGGGGGGGGGGGGGGGGGGGGB
+ BBBBBBBBBBBBBBBBBBBBBBB
+
+ The sunken border looks like this:
+
+ GGGGGGGGGGGGGGGGGGGGGGI
+ GBBBBBBBBBBBBBBBBBBBBHI
+ GB HI
+ GB HI
+ GB HI
+ GB HI
+ GB HI
+ GB HI
+ GHHHHHHHHHHHHHHHHHHHHHI
+ IIIIIIIIIIIIIIIIIIIIIII
+
+ The static border (used for the controls which don't get focus) is like
+ this:
+
+ GGGGGGGGGGGGGGGGGGGGGGW
+ G W
+ G W
+ G W
+ G W
+ G W
+ G W
+ G W
+ WWWWWWWWWWWWWWWWWWWWWWW
+
+ The most complicated is the double border:
+
+ HHHHHHHHHHHHHHHHHHHHHHB
+ HWWWWWWWWWWWWWWWWWWWWGB
+ HWHHHHHHHHHHHHHHHHHHHGB
+ HWH HGB
+ HWH HGB
+ HWH HGB
+ HWH HGB
+ HWHHHHHHHHHHHHHHHHHHHGB
+ HGGGGGGGGGGGGGGGGGGGGGB
+ BBBBBBBBBBBBBBBBBBBBBBB
+
+ And the simple border is, well, simple:
+
+ BBBBBBBBBBBBBBBBBBBBBBB
+ B B
+ B B
+ B B
+ B B
+ B B
+ B B
+ B B
+ B B
+ BBBBBBBBBBBBBBBBBBBBBBB
+*/
+
+void wxWin32Renderer::DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen)
+{
+ // draw
+ dc.SetPen(pen);
+ dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ dc.DrawRectangle(*rect);
+
+ // adjust the rect
+ rect->Inflate(-1);
+}
+
+void wxWin32Renderer::DrawHalfRect(wxDC& dc, wxRect *rect, const wxPen& pen)
+{
+ // draw the bottom and right sides
+ dc.SetPen(pen);
+ dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
+ rect->GetRight() + 1, rect->GetBottom());
+ dc.DrawLine(rect->GetRight(), rect->GetTop(),
+ rect->GetRight(), rect->GetBottom());
+
+ // adjust the rect
+ rect->width--;
+ rect->height--;
+}
+
+void wxWin32Renderer::DrawShadedRect(wxDC& dc, wxRect *rect,
+ const wxPen& pen1, const wxPen& pen2)
+{
+ // draw the rectangle
+ dc.SetPen(pen1);
+ dc.DrawLine(rect->GetLeft(), rect->GetTop(),
+ rect->GetLeft(), rect->GetBottom());
+ dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(),
+ rect->GetRight(), rect->GetTop());
+ dc.SetPen(pen2);
+ dc.DrawLine(rect->GetRight(), rect->GetTop(),
+ rect->GetRight(), rect->GetBottom());
+ dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
+ rect->GetRight() + 1, rect->GetBottom());
+
+ // adjust the rect
+ rect->Inflate(-1);
+}
+
+void wxWin32Renderer::DrawRaisedBorder(wxDC& dc, wxRect *rect)
+{
+ DrawShadedRect(dc, rect, m_penHighlight, m_penBlack);
+ DrawShadedRect(dc, rect, m_penLightGrey, m_penDarkGrey);
+}
+
+void wxWin32Renderer::DrawSunkenBorder(wxDC& dc, wxRect *rect)
+{
+ DrawShadedRect(dc, rect, m_penDarkGrey, m_penHighlight);
+ DrawShadedRect(dc, rect, m_penBlack, m_penLightGrey);
+}
+
+void wxWin32Renderer::DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed)
+{
+ if ( isPressed )
+ {
+ DrawRect(dc, rect, m_penDarkGrey);
+
+ // the arrow is usually drawn inside border of width 2 and is offset by
+ // another pixel in both directions when it's pressed - as the border
+ // in this case is more narrow as well, we have to adjust rect like
+ // this:
+ rect->Inflate(-1);
+ rect->x++;
+ rect->y++;
+ }
+ else
+ {
+ DrawShadedRect(dc, rect, m_penLightGrey, m_penBlack);
+ DrawShadedRect(dc, rect, m_penHighlight, m_penDarkGrey);
+ }
+}
+
+void wxWin32Renderer::DrawBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rectTotal,
+ int WXUNUSED(flags),
+ wxRect *rectIn)
+{
+ int i;
+
+ wxRect rect = rectTotal;
+
+ switch ( border )
+ {
+ case wxBORDER_SUNKEN:
+ for ( i = 0; i < BORDER_THICKNESS / 2; i++ )
+ {
+ DrawSunkenBorder(dc, &rect);
+ }
+ break;
+
+ case wxBORDER_STATIC:
+ DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ break;
+
+ case wxBORDER_RAISED:
+ for ( i = 0; i < BORDER_THICKNESS / 2; i++ )
+ {
+ DrawRaisedBorder(dc, &rect);
+ }
+ break;
+
+ case wxBORDER_DOUBLE:
+ DrawArrowBorder(dc, &rect);
+ DrawRect(dc, &rect, m_penLightGrey);
+ break;
+
+ case wxBORDER_SIMPLE:
+ for ( i = 0; i < BORDER_THICKNESS / 2; i++ )
+ {
+ DrawRect(dc, &rect, m_penBlack);
+ }
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown border type"));
+ // fall through
+
+ case wxBORDER_DEFAULT:
+ case wxBORDER_NONE:
+ break;
+ }
+
+ if ( rectIn )
+ *rectIn = rect;
+}
+
+wxRect wxWin32Renderer::GetBorderDimensions(wxBorder border) const
+{
+ wxCoord width;
+ switch ( border )
+ {
+ case wxBORDER_RAISED:
+ case wxBORDER_SUNKEN:
+ width = BORDER_THICKNESS;
+ break;
+
+ case wxBORDER_SIMPLE:
+ case wxBORDER_STATIC:
+ width = 1;
+ break;
+
+ case wxBORDER_DOUBLE:
+ width = 3;
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown border type"));
+ // fall through
+
+ case wxBORDER_DEFAULT:
+ case wxBORDER_NONE:
+ width = 0;
+ break;
+ }
+
+ wxRect rect;
+ rect.x =
+ rect.y =
+ rect.width =
+ rect.height = width;
+
+ return rect;
+}
+
+bool wxWin32Renderer::AreScrollbarsInsideBorder() const
+{
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// borders
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawTextBorder(wxDC& dc,
+ wxBorder border,
+ const wxRect& rect,
+ int flags,
+ wxRect *rectIn)
+{
+ // text controls are not special under windows
+ DrawBorder(dc, border, rect, flags, rectIn);
+}
+
+void wxWin32Renderer::DrawButtonBorder(wxDC& dc,
+ const wxRect& rectTotal,
+ int flags,
+ wxRect *rectIn)
+{
+ wxRect rect = rectTotal;
+
+ if ( flags & wxCONTROL_PRESSED )
+ {
+ // button pressed: draw a double border around it
+ DrawRect(dc, &rect, m_penBlack);
+ DrawRect(dc, &rect, m_penDarkGrey);
+ }
+ else
+ {
+ // button not pressed
+
+ if ( flags & (wxCONTROL_FOCUSED | wxCONTROL_ISDEFAULT) )
+ {
+ // button either default or focused (or both): add an extra border around it
+ DrawRect(dc, &rect, m_penBlack);
+ }
+
+ // now draw a normal button
+ DrawShadedRect(dc, &rect, m_penHighlight, m_penBlack);
+ DrawHalfRect(dc, &rect, m_penDarkGrey);
+ }
+
+ if ( rectIn )
+ {
+ *rectIn = rect;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// lines and frame
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawHorizontalLine(wxDC& dc,
+ wxCoord y, wxCoord x1, wxCoord x2)
+{
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x1, y, x2 + 1, y);
+ dc.SetPen(m_penHighlight);
+ y++;
+ dc.DrawLine(x1, y, x2 + 1, y);
+}
+
+void wxWin32Renderer::DrawVerticalLine(wxDC& dc,
+ wxCoord x, wxCoord y1, wxCoord y2)
+{
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x, y1, x, y2 + 1);
+ dc.SetPen(m_penHighlight);
+ x++;
+ dc.DrawLine(x, y1, x, y2 + 1);
+}
+
+void wxWin32Renderer::DrawFrame(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags,
+ int alignment,
+ int indexAccel)
+{
+ wxCoord height = 0; // of the label
+ wxRect rectFrame = rect;
+ if ( !label.empty() )
+ {
+ // the text should touch the top border of the rect, so the frame
+ // itself should be lower
+ dc.GetTextExtent(label, NULL, &height);
+ rectFrame.y += height / 2;
+ rectFrame.height -= height / 2;
+
+ // we have to draw each part of the frame individually as we can't
+ // erase the background beyond the label as it might contain some
+ // pixmap already, so drawing everything and then overwriting part of
+ // the frame with label doesn't work
+
+ // TODO: the +5 and space insertion should be customizable
+
+ wxRect rectText;
+ rectText.x = rectFrame.x + 5;
+ rectText.y = rect.y;
+ rectText.width = rectFrame.width - 7; // +2 border width
+ rectText.height = height;
+
+ wxString label2;
+ label2 << _T(' ') << label << _T(' ');
+ if ( indexAccel != -1 )
+ {
+ // adjust it as we prepended a space
+ indexAccel++;
+ }
+
+ wxRect rectLabel;
+ DrawLabel(dc, label2, rectText, flags, alignment, indexAccel, &rectLabel);
+
+ StandardDrawFrame(dc, rectFrame, rectLabel);
+ }
+ else
+ {
+ // just draw the complete frame
+ DrawShadedRect(dc, &rectFrame, m_penDarkGrey, m_penHighlight);
+ DrawShadedRect(dc, &rectFrame, m_penHighlight, m_penDarkGrey);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// label
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawFocusRect(wxDC& dc, const wxRect& rect)
+{
+ // VZ: this doesn't work under Windows, the dotted pen has dots of 3
+ // pixels each while we really need dots here... PS_ALTERNATE might
+ // work, but it is for NT 5 only
+#if 0
+ DrawRect(dc, &rect, wxPen(*wxBLACK, 0, wxDOT));
+#else
+ // draw the pixels manually: note that to behave in the same manner as
+ // DrawRect(), we must exclude the bottom and right borders from the
+ // rectangle
+ wxCoord x1 = rect.GetLeft(),
+ y1 = rect.GetTop(),
+ x2 = rect.GetRight(),
+ y2 = rect.GetBottom();
+
+ dc.SetPen(wxPen(*wxBLACK, 0, wxSOLID));
+
+ // this seems to be closer than what Windows does than wxINVERT although
+ // I'm still not sure if it's correct
+ dc.SetLogicalFunction(wxAND_REVERSE);
+
+ wxCoord z;
+ for ( z = x1 + 1; z < x2; z += 2 )
+ dc.DrawPoint(z, rect.GetTop());
+
+ wxCoord shift = z == x2 ? 0 : 1;
+ for ( z = y1 + shift; z < y2; z += 2 )
+ dc.DrawPoint(x2, z);
+
+ shift = z == y2 ? 0 : 1;
+ for ( z = x2 - shift; z > x1; z -= 2 )
+ dc.DrawPoint(z, y2);
+
+ shift = z == x1 ? 0 : 1;
+ for ( z = y2 - shift; z > y1; z -= 2 )
+ dc.DrawPoint(x1, z);
+
+ dc.SetLogicalFunction(wxCOPY);
+#endif // 0/1
+}
+
+void wxWin32Renderer::DrawLabelShadow(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int alignment,
+ int indexAccel)
+{
+ // draw shadow of the text
+ dc.SetTextForeground(m_colHighlight);
+ wxRect rectShadow = rect;
+ rectShadow.x++;
+ rectShadow.y++;
+ dc.DrawLabel(label, rectShadow, alignment, indexAccel);
+
+ // make the text grey
+ dc.SetTextForeground(m_colDarkGrey);
+}
+
+void wxWin32Renderer::DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags,
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounds)
+{
+ DoDrawLabel(dc, label, rect, flags, alignment, indexAccel, rectBounds);
+}
+
+void wxWin32Renderer::DoDrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags,
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounds,
+ const wxPoint& focusOffset)
+{
+ // the underscores are not drawn for focused controls in wxMSW
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ indexAccel = -1;
+ }
+
+ if ( flags & wxCONTROL_DISABLED )
+ {
+ // the combination of wxCONTROL_SELECTED and wxCONTROL_DISABLED
+ // currently only can happen for a menu item and it seems that Windows
+ // doesn't draw the shadow in this case, so we don't do it neither
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ // just make the label text greyed out
+ dc.SetTextForeground(m_colDarkGrey);
+ }
+ else // draw normal disabled label
+ {
+ DrawLabelShadow(dc, label, rect, alignment, indexAccel);
+ }
+ }
+
+ wxRect rectLabel;
+ dc.DrawLabel(label, wxNullBitmap, rect, alignment, indexAccel, &rectLabel);
+
+ if ( flags & wxCONTROL_DISABLED )
+ {
+ // restore the fg colour
+ dc.SetTextForeground(*wxBLACK);
+ }
+
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ if ( focusOffset.x || focusOffset.y )
+ {
+ // before calling Inflate(), ensure that we will have a valid rect
+ // afterwards
+ if ( rectLabel.x < focusOffset.x )
+ rectLabel.x = focusOffset.x;
+
+ if ( rectLabel.y < focusOffset.y )
+ rectLabel.y = focusOffset.y;
+
+ rectLabel.Inflate(focusOffset.x, focusOffset.y);
+ }
+
+ DrawFocusRect(dc, rectLabel);
+ }
+
+ if ( rectBounds )
+ *rectBounds = rectLabel;
+}
+
+void wxWin32Renderer::DrawButtonLabel(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int flags,
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounds)
+{
+ // the underscores are not drawn for focused controls in wxMSW
+ if ( flags & wxCONTROL_PRESSED )
+ {
+ indexAccel = -1;
+ }
+
+ wxRect rectLabel = rect;
+ if ( !label.empty() )
+ {
+ // shift the label if a button is pressed
+ if ( flags & wxCONTROL_PRESSED )
+ {
+ rectLabel.x++;
+ rectLabel.y++;
+ }
+
+ if ( flags & wxCONTROL_DISABLED )
+ {
+ DrawLabelShadow(dc, label, rectLabel, alignment, indexAccel);
+ }
+
+ // leave enough space for the focus rectangle
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ rectLabel.Inflate(-2);
+ }
+ }
+
+ dc.DrawLabel(label, image, rectLabel, alignment, indexAccel, rectBounds);
+
+ if ( !label.empty() && (flags & wxCONTROL_FOCUSED) )
+ {
+ if ( flags & wxCONTROL_PRESSED )
+ {
+ // the focus rectangle is never pressed, so undo the shift done
+ // above
+ rectLabel.x--;
+ rectLabel.y--;
+ rectLabel.width--;
+ rectLabel.height--;
+ }
+
+ DrawFocusRect(dc, rectLabel);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// (check)listbox items
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawItem(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags)
+{
+ wxDCTextColourChanger colChanger(dc);
+
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ colChanger.Set(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT_TEXT));
+
+ wxColour colBg = wxSCHEME_COLOUR(m_scheme, HIGHLIGHT);
+ dc.SetBrush(wxBrush(colBg, wxSOLID));
+ dc.SetPen(wxPen(colBg, 0, wxSOLID));
+ dc.DrawRectangle(rect);
+ }
+
+ wxRect rectText = rect;
+ rectText.x += 2;
+ rectText.width -= 2;
+ dc.DrawLabel(label, wxNullBitmap, rectText);
+
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ DrawFocusRect(dc, rect);
+ }
+}
+
+void wxWin32Renderer::DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags)
+{
+ wxBitmap bmp;
+ if ( bitmap.Ok() )
+ {
+ bmp = bitmap;
+ }
+ else // use default bitmap
+ {
+ bmp = wxBitmap(flags & wxCONTROL_CHECKED ? checked_item_xpm
+ : unchecked_item_xpm);
+ }
+
+ dc.DrawBitmap(bmp, rect.x, rect.y + (rect.height - bmp.GetHeight()) / 2 - 1,
+ TRUE /* use mask */);
+
+ wxRect rectLabel = rect;
+ int bmpWidth = bmp.GetWidth();
+ rectLabel.x += bmpWidth;
+ rectLabel.width -= bmpWidth;
+
+ DrawItem(dc, label, rectLabel, flags);
+}
+
+// ----------------------------------------------------------------------------
+// check/radio buttons
+// ----------------------------------------------------------------------------
+
+wxBitmap wxWin32Renderer::GetIndicator(IndicatorType indType, int flags)
+{
+ IndicatorState indState;
+ if ( flags & wxCONTROL_SELECTED )
+ indState = flags & wxCONTROL_DISABLED ? IndicatorState_SelectedDisabled
+ : IndicatorState_Selected;
+ else if ( flags & wxCONTROL_DISABLED )
+ indState = IndicatorState_Disabled;
+ else if ( flags & wxCONTROL_PRESSED )
+ indState = IndicatorState_Pressed;
+ else
+ indState = IndicatorState_Normal;
+
+ IndicatorStatus indStatus = flags & wxCONTROL_CHECKED
+ ? IndicatorStatus_Checked
+ : IndicatorStatus_Unchecked;
+
+ const char **xpm = bmpIndicators[indType][indState][indStatus];
+ return xpm ? wxBitmap(xpm) : wxNullBitmap;
+}
+
+void wxWin32Renderer::DrawCheckOrRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags,
+ wxAlignment align,
+ int indexAccel,
+ wxCoord focusOffsetY)
+{
+ // calculate the position of the bitmap and of the label
+ wxCoord heightBmp = bitmap.GetHeight();
+ wxCoord xBmp,
+ yBmp = rect.y + (rect.height - heightBmp) / 2;
+
+ wxRect rectLabel;
+ dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
+ rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2;
+
+ // align label vertically with the bitmap - looks nicer like this
+ rectLabel.y -= (rectLabel.height - heightBmp) % 2;
+
+ // calc horz position
+ if ( align == wxALIGN_RIGHT )
+ {
+ xBmp = rect.GetRight() - bitmap.GetWidth();
+ rectLabel.x = rect.x + 3;
+ rectLabel.SetRight(xBmp);
+ }
+ else // normal (checkbox to the left of the text) case
+ {
+ xBmp = rect.x;
+ rectLabel.x = xBmp + bitmap.GetWidth() + 5;
+ rectLabel.SetRight(rect.GetRight());
+ }
+
+ dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
+
+ DoDrawLabel(
+ dc, label, rectLabel,
+ flags,
+ wxALIGN_LEFT | wxALIGN_TOP,
+ indexAccel,
+ NULL, // we don't need bounding rect
+ // use custom vert focus rect offset
+ wxPoint(FOCUS_RECT_OFFSET_X, focusOffsetY)
+ );
+}
+
+void wxWin32Renderer::DrawRadioButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags,
+ wxAlignment align,
+ int indexAccel)
+{
+ DrawCheckOrRadioButton(dc, label,
+ bitmap.Ok() ? bitmap : GetRadioBitmap(flags),
+ rect, flags, align, indexAccel,
+ FOCUS_RECT_OFFSET_Y); // default focus rect offset
+}
+
+void wxWin32Renderer::DrawCheckButton(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags,
+ wxAlignment align,
+ int indexAccel)
+{
+ DrawCheckOrRadioButton(dc, label,
+ bitmap.Ok() ? bitmap : GetCheckBitmap(flags),
+ rect, flags, align, indexAccel,
+ 0); // no focus rect offset for checkboxes
+}
+
+// ----------------------------------------------------------------------------
+// text control
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawTextLine(wxDC& dc,
+ const wxString& text,
+ const wxRect& rect,
+ int selStart,
+ int selEnd,
+ int flags)
+{
+ // nothing special to do here
+ StandardDrawTextLine(dc, text, rect, selStart, selEnd, flags);
+}
+
+void wxWin32Renderer::DrawLineWrapMark(wxDC& dc, const wxRect& rect)
+{
+ // we don't draw them
+}
+
+// ----------------------------------------------------------------------------
+// notebook
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawTab(wxDC& dc,
+ const wxRect& rectOrig,
+ wxDirection dir,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ int flags,
+ int indexAccel)
+{
+ wxRect rect = rectOrig;
+
+ // the current tab is drawn indented (to the top for default case) and
+ // bigger than the other ones
+ const wxSize indent = GetTabIndent();
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ switch ( dir )
+ {
+ default:
+ wxFAIL_MSG(_T("invaild notebook tab orientation"));
+ // fall through
+
+ case wxTOP:
+ rect.Inflate(indent.x, 0);
+ rect.y -= indent.y;
+ rect.height += indent.y;
+ break;
+
+ case wxBOTTOM:
+ rect.Inflate(indent.x, 0);
+ rect.height += indent.y;
+ break;
+
+ case wxLEFT:
+ case wxRIGHT:
+ wxFAIL_MSG(_T("TODO"));
+ break;
+ }
+ }
+
+ // draw the text, image and the focus around them (if necessary)
+ wxRect rectLabel = rect;
+ rectLabel.Deflate(1, 1);
+ DrawButtonLabel(dc, label, bitmap, rectLabel,
+ flags, wxALIGN_CENTRE, indexAccel);
+
+ // now draw the tab border itself (maybe use DrawRoundedRectangle()?)
+ static const wxCoord CUTOFF = 2; // radius of the rounded corner
+ wxCoord x = rect.x,
+ y = rect.y,
+ x2 = rect.GetRight(),
+ y2 = rect.GetBottom();
+
+ // FIXME: all this code will break if the tab indent or the border width,
+ // it is tied to the fact that both of them are equal to 2
+ switch ( dir )
+ {
+ default:
+ case wxTOP:
+ dc.SetPen(m_penHighlight);
+ dc.DrawLine(x, y2, x, y + CUTOFF);
+ dc.DrawLine(x, y + CUTOFF, x + CUTOFF, y);
+ dc.DrawLine(x + CUTOFF, y, x2 - CUTOFF + 1, y);
+
+ dc.SetPen(m_penBlack);
+ dc.DrawLine(x2, y2, x2, y + CUTOFF);
+ dc.DrawLine(x2, y + CUTOFF, x2 - CUTOFF, y);
+
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x2 - 1, y2, x2 - 1, y + CUTOFF - 1);
+
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ dc.SetPen(m_penLightGrey);
+
+ // overwrite the part of the border below this tab
+ dc.DrawLine(x + 1, y2 + 1, x2 - 1, y2 + 1);
+
+ // and the shadow of the tab to the left of us
+ dc.DrawLine(x + 1, y + CUTOFF + 1, x + 1, y2 + 1);
+ }
+ break;
+
+ case wxBOTTOM:
+ dc.SetPen(m_penHighlight);
+ // we need to continue one pixel further to overwrite the corner of
+ // the border for the selected tab
+ dc.DrawLine(x, y - (flags & wxCONTROL_SELECTED ? 1 : 0),
+ x, y2 - CUTOFF);
+ dc.DrawLine(x, y2 - CUTOFF, x + CUTOFF, y2);
+
+ dc.SetPen(m_penBlack);
+ dc.DrawLine(x + CUTOFF, y2, x2 - CUTOFF + 1, y2);
+ dc.DrawLine(x2, y, x2, y2 - CUTOFF);
+ dc.DrawLine(x2, y2 - CUTOFF, x2 - CUTOFF, y2);
+
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(x + CUTOFF, y2 - 1, x2 - CUTOFF + 1, y2 - 1);
+ dc.DrawLine(x2 - 1, y, x2 - 1, y2 - CUTOFF + 1);
+
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ dc.SetPen(m_penLightGrey);
+
+ // overwrite the part of the (double!) border above this tab
+ dc.DrawLine(x + 1, y - 1, x2 - 1, y - 1);
+ dc.DrawLine(x + 1, y - 2, x2 - 1, y - 2);
+
+ // and the shadow of the tab to the left of us
+ dc.DrawLine(x + 1, y2 - CUTOFF, x + 1, y - 1);
+ }
+ break;
+
+ case wxLEFT:
+ case wxRIGHT:
+ wxFAIL_MSG(_T("TODO"));
+ }
+}
+
+// ----------------------------------------------------------------------------
+// slider
+// ----------------------------------------------------------------------------
+
+wxSize wxWin32Renderer::GetSliderThumbSize(const wxRect& rect,
+ wxOrientation orient) const
+{
+ wxSize size;
+
+ wxRect rectShaft = GetSliderShaftRect(rect, orient);
+ if ( orient == wxHORIZONTAL )
+ {
+ size.y = rect.height - 6;
+ size.x = wxMin(size.y / 2, rectShaft.width);
+ }
+ else // vertical
+ {
+ size.x = rect.width - 6;
+ size.y = wxMin(size.x / 2, rectShaft.height);
+ }
+
+ return size;
+}
+
+wxRect wxWin32Renderer::GetSliderShaftRect(const wxRect& rectOrig,
+ wxOrientation orient) const
+{
+ static const wxCoord SLIDER_MARGIN = 6;
+
+ wxRect rect = rectOrig;
+
+ if ( orient == wxHORIZONTAL )
+ {
+ // make the rect of minimal width and centre it
+ rect.height = 2*BORDER_THICKNESS;
+ rect.y = rectOrig.y + (rectOrig.height - rect.height) / 2;
+ if ( rect.y < 0 )
+ rect.y = 0;
+
+ // leave margins on the sides
+ rect.Deflate(SLIDER_MARGIN, 0);
+ }
+ else // vertical
+ {
+ // same as above but in other direction
+ rect.width = 2*BORDER_THICKNESS;
+ rect.x = rectOrig.x + (rectOrig.width - rect.width) / 2;
+ if ( rect.x < 0 )
+ rect.x = 0;
+
+ rect.Deflate(0, SLIDER_MARGIN);
+ }
+
+ return rect;
+}
+
+void wxWin32Renderer::DrawSliderShaft(wxDC& dc,
+ const wxRect& rectOrig,
+ wxOrientation orient,
+ int flags,
+ wxRect *rectShaft)
+{
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ DrawFocusRect(dc, rectOrig);
+ }
+
+ wxRect rect = GetSliderShaftRect(rectOrig, orient);
+
+ if ( rectShaft )
+ *rectShaft = rect;
+
+ DrawSunkenBorder(dc, &rect);
+}
+
+void wxWin32Renderer::DrawSliderThumb(wxDC& dc,
+ const wxRect& rect,
+ wxOrientation orient,
+ int flags)
+{
+ /*
+ we are drawing a shape of this form
+
+ HHHHHHB <--- y
+ H DB
+ H DB
+ H DB where H is hightlight colour
+ H DB D dark grey
+ H DB B black
+ H DB
+ H DB <--- y3
+ H DB
+ HDB
+ B <--- y2
+
+ ^ ^ ^
+ | | |
+ x x3 x2
+
+ The interior of this shape is filled with the hatched brush if the thumb
+ is pressed.
+ */
+
+ DrawBackground(dc, wxNullColour, rect, flags);
+
+ bool transpose = orient == wxVERTICAL;
+
+ wxCoord x, y, x2, y2;
+ if ( transpose )
+ {
+ x = rect.y;
+ y = rect.x;
+ x2 = rect.GetBottom();
+ y2 = rect.GetRight();
+ }
+ else
+ {
+ x = rect.x;
+ y = rect.y;
+ x2 = rect.GetRight();
+ y2 = rect.GetBottom();
+ }
+
+ // the size of the pointed part of the thumb
+ wxCoord sizeArrow = (transpose ? rect.height : rect.width) / 2;
+
+ wxCoord x3 = x + sizeArrow,
+ y3 = y2 - sizeArrow;
+
+ dc.SetPen(m_penHighlight);
+ DrawLine(dc, x, y, x2, y, transpose);
+ DrawLine(dc, x, y + 1, x, y2 - sizeArrow, transpose);
+ DrawLine(dc, x, y3, x3, y2, transpose);
+
+ dc.SetPen(m_penBlack);
+ DrawLine(dc, x3, y2, x2, y3, transpose);
+ DrawLine(dc, x2, y3, x2, y - 1, transpose);
+
+ dc.SetPen(m_penDarkGrey);
+ DrawLine(dc, x3, y2 - 1, x2 - 1, y3, transpose);
+ DrawLine(dc, x2 - 1, y3, x2 - 1, y, transpose);
+
+ if ( flags & wxCONTROL_PRESSED )
+ {
+ // TODO: MSW fills the entire area inside, not just the rect
+ wxRect rectInt = rect;
+ if ( transpose )
+ rectInt.SetRight(y3);
+ else
+ rectInt.SetBottom(y3);
+ rectInt.Deflate(2);
+
+ static const char *stipple_xpm[] = {
+ /* columns rows colors chars-per-pixel */
+ "2 2 2 1",
+ " c None",
+ "w c white",
+ /* pixels */
+ "w ",
+ " w",
+ };
+ dc.SetBrush(wxBrush(stipple_xpm));
+
+ dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, SHADOW_HIGHLIGHT));
+ dc.SetTextBackground(wxSCHEME_COLOUR(m_scheme, CONTROL));
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rectInt);
+ }
+}
+
+void wxWin32Renderer::DrawSliderTicks(wxDC& dc,
+ const wxRect& rect,
+ const wxSize& sizeThumb,
+ wxOrientation orient,
+ int start,
+ int end,
+ int step,
+ int flags)
+{
+ if ( end == start )
+ {
+ // empty slider?
+ return;
+ }
+
+ // the variable names correspond to horizontal case, but they can be used
+ // for both orientations
+ wxCoord x1, x2, y1, y2, len, widthThumb;
+ if ( orient == wxHORIZONTAL )
+ {
+ x1 = rect.GetLeft();
+ x2 = rect.GetRight();
+
+ // draw from bottom to top to leave one pixel space between the ticks
+ // and the slider as Windows do
+ y1 = rect.GetBottom();
+ y2 = rect.GetTop();
+
+ len = rect.width;
+
+ widthThumb = sizeThumb.x;
+ }
+ else // vertical
+ {
+ x1 = rect.GetTop();
+ x2 = rect.GetBottom();
+
+ y1 = rect.GetRight();
+ y2 = rect.GetLeft();
+
+ len = rect.height;
+
+ widthThumb = sizeThumb.y;
+ }
+
+ // the first tick should be positioned in such way that a thumb drawn in
+ // the first position points down directly to it
+ x1 += widthThumb / 2;
+ x2 -= widthThumb / 2;
+
+ // this also means that we have slightly less space for the ticks in
+ // between the first and the last
+ len -= widthThumb;
+
+ dc.SetPen(m_penBlack);
+
+ int range = end - start;
+ for ( int n = 0; n < range; n += step )
+ {
+ wxCoord x = x1 + (len*n) / range;
+
+ DrawLine(dc, x, y1, x, y2, orient == wxVERTICAL);
+ }
+
+ // always draw the line at the end position
+ DrawLine(dc, x2, y1, x2, y2, orient == wxVERTICAL);
+}
+
+// ----------------------------------------------------------------------------
+// menu and menubar
+// ----------------------------------------------------------------------------
+
+// wxWin32MenuGeometryInfo: the wxMenuGeometryInfo used by wxWin32Renderer
+class WXDLLEXPORT wxWin32MenuGeometryInfo : public wxMenuGeometryInfo
+{
+public:
+ virtual wxSize GetSize() const { return m_size; }
+
+ wxCoord GetLabelOffset() const { return m_ofsLabel; }
+ wxCoord GetAccelOffset() const { return m_ofsAccel; }
+
+ wxCoord GetItemHeight() const { return m_heightItem; }
+
+private:
+ // the total size of the menu
+ wxSize m_size;
+
+ // the offset of the start of the menu item label
+ wxCoord m_ofsLabel;
+
+ // the offset of the start of the accel label
+ wxCoord m_ofsAccel;
+
+ // the height of a normal (not separator) item
+ wxCoord m_heightItem;
+
+ friend wxMenuGeometryInfo *wxWin32Renderer::
+ GetMenuGeometry(wxWindow *, const wxMenu&) const;
+};
+
+// FIXME: all constants are hardcoded but shouldn't be
+static const wxCoord MENU_LEFT_MARGIN = 9;
+static const wxCoord MENU_RIGHT_MARGIN = 18;
+static const wxCoord MENU_VERT_MARGIN = 3;
+
+// the margin around bitmap/check marks (on each side)
+static const wxCoord MENU_BMP_MARGIN = 2;
+
+// the margin between the labels and accel strings
+static const wxCoord MENU_ACCEL_MARGIN = 8;
+
+// the separator height in pixels: in fact, strangely enough, the real height
+// is 2 but Windows adds one extra pixel in the bottom margin, so take it into
+// account here
+static const wxCoord MENU_SEPARATOR_HEIGHT = 3;
+
+// the size of the standard checkmark bitmap
+static const wxCoord MENU_CHECK_SIZE = 9;
+
+void wxWin32Renderer::DrawMenuBarItem(wxDC& dc,
+ const wxRect& rectOrig,
+ const wxString& label,
+ int flags,
+ int indexAccel)
+{
+ wxRect rect = rectOrig;
+ rect.height--;
+
+ wxDCTextColourChanger colChanger(dc);
+
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ colChanger.Set(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT_TEXT));
+
+ wxColour colBg = wxSCHEME_COLOUR(m_scheme, HIGHLIGHT);
+ dc.SetBrush(wxBrush(colBg, wxSOLID));
+ dc.SetPen(wxPen(colBg, 0, wxSOLID));
+ dc.DrawRectangle(rect);
+ }
+
+ // don't draw the focus rect around menu bar items
+ DrawLabel(dc, label, rect, flags & ~wxCONTROL_FOCUSED,
+ wxALIGN_CENTRE, indexAccel);
+}
+
+void wxWin32Renderer::DrawMenuItem(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& gi,
+ const wxString& label,
+ const wxString& accel,
+ const wxBitmap& bitmap,
+ int flags,
+ int indexAccel)
+{
+ const wxWin32MenuGeometryInfo& geometryInfo =
+ (const wxWin32MenuGeometryInfo&)gi;
+
+ wxRect rect;
+ rect.x = 0;
+ rect.y = y;
+ rect.width = geometryInfo.GetSize().x;
+ rect.height = geometryInfo.GetItemHeight();
+
+ // draw the selected item specially
+ wxDCTextColourChanger colChanger(dc);
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ colChanger.Set(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT_TEXT));
+
+ wxColour colBg = wxSCHEME_COLOUR(m_scheme, HIGHLIGHT);
+ dc.SetBrush(wxBrush(colBg, wxSOLID));
+ dc.SetPen(wxPen(colBg, 0, wxSOLID));
+ dc.DrawRectangle(rect);
+ }
+
+ // draw the bitmap: use the bitmap provided or the standard checkmark for
+ // the checkable items
+ wxBitmap bmp = bitmap;
+ if ( !bmp.Ok() && (flags & wxCONTROL_CHECKED) )
+ {
+ bmp = GetIndicator(IndicatorType_Menu, flags);
+ }
+
+ if ( bmp.Ok() )
+ {
+ rect.SetRight(geometryInfo.GetLabelOffset());
+ wxControlRenderer::DrawBitmap(dc, bmp, rect);
+ }
+
+ // draw the label
+ rect.x = geometryInfo.GetLabelOffset();
+ rect.SetRight(geometryInfo.GetAccelOffset());
+
+ DrawLabel(dc, label, rect, flags, wxALIGN_CENTRE_VERTICAL, indexAccel);
+
+ // draw the accel string
+ rect.x = geometryInfo.GetAccelOffset();
+ rect.SetRight(geometryInfo.GetSize().x);
+
+ // NB: no accel index here
+ DrawLabel(dc, accel, rect, flags, wxALIGN_CENTRE_VERTICAL);
+
+ // draw the submenu indicator
+ if ( flags & wxCONTROL_ISSUBMENU )
+ {
+ rect.x = geometryInfo.GetSize().x - MENU_RIGHT_MARGIN;
+ rect.width = MENU_RIGHT_MARGIN;
+
+ wxArrowStyle arrowStyle;
+ if ( flags & wxCONTROL_DISABLED )
+ arrowStyle = flags & wxCONTROL_SELECTED ? Arrow_InversedDisabled
+ : Arrow_Disabled;
+ else if ( flags & wxCONTROL_SELECTED )
+ arrowStyle = Arrow_Inversed;
+ else
+ arrowStyle = Arrow_Normal;
+
+ DrawArrow(dc, rect, Arrow_Right, arrowStyle);
+ }
+}
+
+void wxWin32Renderer::DrawMenuSeparator(wxDC& dc,
+ wxCoord y,
+ const wxMenuGeometryInfo& geomInfo)
+{
+ DrawHorizontalLine(dc, y + MENU_VERT_MARGIN, 0, geomInfo.GetSize().x);
+}
+
+wxSize wxWin32Renderer::GetMenuBarItemSize(const wxSize& sizeText) const
+{
+ wxSize size = sizeText;
+
+ // FIXME: menubar height is configurable under Windows
+ size.x += 12;
+ size.y += 6;
+
+ return size;
+}
+
+wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
+ const wxMenu& menu) const
+{
+ // prepare the dc: for now we draw all the items with the system font
+ wxClientDC dc(win);
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+
+ // the height of a normal item
+ wxCoord heightText = dc.GetCharHeight();
+
+ // the total height
+ wxCoord height = 0;
+
+ // the max length of label and accel strings: the menu width is the sum of
+ // them, even if they're for different items (as the accels should be
+ // aligned)
+ //
+ // the max length of the bitmap is never 0 as Windows always leaves enough
+ // space for a check mark indicator
+ wxCoord widthLabelMax = 0,
+ widthAccelMax = 0,
+ widthBmpMax = MENU_LEFT_MARGIN;
+
+ for ( wxMenuItemList::Node *node = menu.GetMenuItems().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ // height of this item
+ wxCoord h;
+
+ wxMenuItem *item = node->GetData();
+ if ( item->IsSeparator() )
+ {
+ h = MENU_SEPARATOR_HEIGHT;
+ }
+ else // not separator
+ {
+ h = heightText;
+
+ wxCoord widthLabel;
+ dc.GetTextExtent(item->GetLabel(), &widthLabel, NULL);
+ if ( widthLabel > widthLabelMax )
+ {
+ widthLabelMax = widthLabel;
+ }
+
+ wxCoord widthAccel;
+ dc.GetTextExtent(item->GetAccelString(), &widthAccel, NULL);
+ if ( widthAccel > widthAccelMax )
+ {
+ widthAccelMax = widthAccel;
+ }
+
+ const wxBitmap& bmp = item->GetBitmap();
+ if ( bmp.Ok() )
+ {
+ wxCoord widthBmp = bmp.GetWidth();
+ if ( widthBmp > widthBmpMax )
+ widthBmpMax = widthBmp;
+ }
+ //else if ( item->IsCheckable() ): no need to check for this as
+ // MENU_LEFT_MARGIN is big enough to show the check mark
+ }
+
+ h += 2*MENU_VERT_MARGIN;
+
+ // remember the item position and height
+ item->SetGeometry(height, h);
+
+ height += h;
+ }
+
+ // bundle the metrics into a struct and return it
+ wxWin32MenuGeometryInfo *gi = new wxWin32MenuGeometryInfo;
+
+ gi->m_ofsLabel = widthBmpMax + 2*MENU_BMP_MARGIN;
+ gi->m_ofsAccel = gi->m_ofsLabel + widthLabelMax;
+ if ( widthAccelMax > 0 )
+ {
+ // if we actually have any accesl, add a margin
+ gi->m_ofsAccel += MENU_ACCEL_MARGIN;
+ }
+
+ gi->m_heightItem = heightText + 2*MENU_VERT_MARGIN;
+
+ gi->m_size.x = gi->m_ofsAccel + widthAccelMax + MENU_RIGHT_MARGIN;
+ gi->m_size.y = height;
+
+ return gi;
+}
+
+// ----------------------------------------------------------------------------
+// combobox
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::GetComboBitmaps(wxBitmap *bmpNormal,
+ wxBitmap *bmpPressed,
+ wxBitmap *bmpDisabled)
+{
+ static const wxCoord widthCombo = 16;
+ static const wxCoord heightCombo = 17;
+
+ wxMemoryDC dcMem;
+
+ if ( bmpNormal )
+ {
+ bmpNormal->Create(widthCombo, heightCombo);
+ dcMem.SelectObject(*bmpNormal);
+ DrawArrowButton(dcMem, wxRect(0, 0, widthCombo, heightCombo),
+ Arrow_Down, Arrow_Normal);
+ }
+
+ if ( bmpPressed )
+ {
+ bmpPressed->Create(widthCombo, heightCombo);
+ dcMem.SelectObject(*bmpPressed);
+ DrawArrowButton(dcMem, wxRect(0, 0, widthCombo, heightCombo),
+ Arrow_Down, Arrow_Pressed);
+ }
+
+ if ( bmpDisabled )
+ {
+ bmpDisabled->Create(widthCombo, heightCombo);
+ dcMem.SelectObject(*bmpDisabled);
+ DrawArrowButton(dcMem, wxRect(0, 0, widthCombo, heightCombo),
+ Arrow_Down, Arrow_Disabled);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// background
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DoDrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect)
+{
+ wxBrush brush(col, wxSOLID);
+ dc.SetBrush(brush);
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rect);
+}
+
+void wxWin32Renderer::DrawBackground(wxDC& dc,
+ const wxColour& col,
+ const wxRect& rect,
+ int flags)
+{
+ // just fill it with the given or default bg colour
+ wxColour colBg = col.Ok() ? col : wxSCHEME_COLOUR(m_scheme, CONTROL);
+ DoDrawBackground(dc, colBg, rect);
+}
+
+// ----------------------------------------------------------------------------
+// scrollbar
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags)
+{
+ // get the bitmap for this arrow
+ wxArrowDirection arrowDir;
+ switch ( dir )
+ {
+ case wxLEFT: arrowDir = Arrow_Left; break;
+ case wxRIGHT: arrowDir = Arrow_Right; break;
+ case wxUP: arrowDir = Arrow_Up; break;
+ case wxDOWN: arrowDir = Arrow_Down; break;
+
+ default:
+ wxFAIL_MSG(_T("unknown arrow direction"));
+ return;
+ }
+
+ wxArrowStyle arrowStyle;
+ if ( flags & wxCONTROL_PRESSED )
+ {
+ // can't be pressed and disabled
+ arrowStyle = Arrow_Pressed;
+ }
+ else
+ {
+ arrowStyle = flags & wxCONTROL_DISABLED ? Arrow_Disabled : Arrow_Normal;
+ }
+
+ DrawArrowButton(dc, rect, arrowDir, arrowStyle);
+}
+
+void wxWin32Renderer::DrawArrow(wxDC& dc,
+ const wxRect& rect,
+ wxArrowDirection arrowDir,
+ wxArrowStyle arrowStyle)
+{
+ const wxBitmap& bmp = m_bmpArrows[arrowStyle][arrowDir];
+
+ // under Windows the arrows always have the same size so just centre it in
+ // the provided rectangle
+ wxCoord x = rect.x + (rect.width - bmp.GetWidth()) / 2,
+ y = rect.y + (rect.height - bmp.GetHeight()) / 2;
+
+ // Windows does it like this...
+ if ( arrowDir == Arrow_Left )
+ x--;
+
+ // draw it
+ dc.DrawBitmap(bmp, x, y, TRUE /* use mask */);
+}
+
+void wxWin32Renderer::DrawArrowButton(wxDC& dc,
+ const wxRect& rectAll,
+ wxArrowDirection arrowDir,
+ wxArrowStyle arrowStyle)
+{
+ wxRect rect = rectAll;
+ DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
+ DrawArrowBorder(dc, &rect, arrowStyle == Arrow_Pressed);
+ DrawArrow(dc, rect, arrowDir, arrowStyle);
+}
+
+void wxWin32Renderer::DrawScrollbarThumb(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rect,
+ int flags)
+{
+ // we don't use the flags, the thumb never changes appearance
+ wxRect rectThumb = rect;
+ DrawArrowBorder(dc, &rectThumb);
+ DrawBackground(dc, wxNullColour, rectThumb);
+}
+
+void wxWin32Renderer::DrawScrollbarShaft(wxDC& dc,
+ wxOrientation orient,
+ const wxRect& rectBar,
+ int flags)
+{
+ wxColourScheme::StdColour col = flags & wxCONTROL_PRESSED
+ ? wxColourScheme::SCROLLBAR_PRESSED
+ : wxColourScheme::SCROLLBAR;
+ DoDrawBackground(dc, m_scheme->Get(col), rectBar);
+}
+
+void wxWin32Renderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
+{
+ DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
+}
+
+wxRect wxWin32Renderer::GetScrollbarRect(const wxScrollBar *scrollbar,
+ wxScrollBar::Element elem,
+ int thumbPos) const
+{
+ return StandardGetScrollbarRect(scrollbar, elem,
+ thumbPos, m_sizeScrollbarArrow);
+}
+
+wxCoord wxWin32Renderer::GetScrollbarSize(const wxScrollBar *scrollbar)
+{
+ return StandardScrollBarSize(scrollbar, m_sizeScrollbarArrow);
+}
+
+wxHitTest wxWin32Renderer::HitTestScrollbar(const wxScrollBar *scrollbar,
+ const wxPoint& pt) const
+{
+ return StandardHitTestScrollbar(scrollbar, pt, m_sizeScrollbarArrow);
+}
+
+wxCoord wxWin32Renderer::ScrollbarToPixel(const wxScrollBar *scrollbar,
+ int thumbPos)
+{
+ return StandardScrollbarToPixel(scrollbar, thumbPos, m_sizeScrollbarArrow);
+}
+
+int wxWin32Renderer::PixelToScrollbar(const wxScrollBar *scrollbar,
+ wxCoord coord)
+{
+ return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow);
+}
+
+// ----------------------------------------------------------------------------
+// text control geometry
+// ----------------------------------------------------------------------------
+
+static inline int GetTextBorderWidth()
+{
+ return 1;
+}
+
+wxRect wxWin32Renderer::GetTextTotalArea(const wxTextCtrl *text,
+ const wxRect& rect)
+{
+ wxRect rectTotal = rect;
+
+ wxCoord widthBorder = GetTextBorderWidth();
+ if ( rectTotal.x < widthBorder )
+ rectTotal.x = widthBorder;
+ if ( rectTotal.y < widthBorder )
+ rectTotal.y = widthBorder;
+
+ rectTotal.Inflate(widthBorder);
+
+ // this is what Windows does
+ rectTotal.height++;
+
+ return rectTotal;
+}
+
+wxRect wxWin32Renderer::GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rect,
+ wxCoord *extraSpaceBeyond)
+{
+ wxRect rectText = rect;
+
+ // undo GetTextTotalArea()
+ if ( rectText.height > 0 )
+ rectText.height--;
+
+ wxCoord widthBorder = GetTextBorderWidth();
+ if ( rectText.width < 2*widthBorder )
+ rectText.width = 2*widthBorder;
+ if ( rectText.height < 2*widthBorder )
+ rectText.height = 2*widthBorder;
+
+ rectText.Inflate(-widthBorder);
+
+ if ( extraSpaceBeyond )
+ *extraSpaceBeyond = 0;
+
+ return rectText;
+}
+
+// ----------------------------------------------------------------------------
+// size adjustments
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::AdjustSize(wxSize *size, const wxWindow *window)
+{
+#if wxUSE_SCROLLBAR
+ if ( wxDynamicCast(window, wxScrollBar) )
+ {
+ // we only set the width of vert scrollbars and height of the
+ // horizontal ones
+ if ( window->GetWindowStyle() & wxSB_HORIZONTAL )
+ size->y = m_sizeScrollbarArrow.y;
+ else
+ size->x = m_sizeScrollbarArrow.x;
+
+ // skip border width adjustments, they don't make sense for us
+ return;
+ }
+#endif // wxUSE_SCROLLBAR/!wxUSE_SCROLLBAR
+
+#if wxUSE_BUTTON
+ if ( wxDynamicCast(window, wxButton) )
+ {
+ // TODO
+ size->x += 3*window->GetCharWidth();
+#if 0 // do allow creating small buttons if wanted
+ wxSize sizeDef = wxButton::GetDefaultSize();
+ if ( size->x < sizeDef.x )
+ size->x = sizeDef.x;
+#endif // 0
+
+ wxCoord heightBtn = (11*(window->GetCharHeight() + 8))/10;
+ if ( size->y < heightBtn - 8 )
+ size->y = heightBtn;
+ else
+ size->y += 9;
+
+ // no border width adjustments for buttons
+ return;
+ }
+#endif // wxUSE_BUTTON
+
+ // take into account the border width
+ wxRect rectBorder = GetBorderDimensions(window->GetBorder());
+ size->x += rectBorder.x + rectBorder.width;
+ size->y += rectBorder.y + rectBorder.height;
+}
+
+// ============================================================================
+// wxInputHandler
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxWin32InputHandler
+// ----------------------------------------------------------------------------
+
+wxWin32InputHandler::wxWin32InputHandler(wxWin32Renderer *renderer)
+{
+ m_renderer = renderer;
+}
+
+bool wxWin32InputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ return FALSE;
+}
+
+bool wxWin32InputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// wxWin32ScrollBarInputHandler
+// ----------------------------------------------------------------------------
+
+wxWin32ScrollBarInputHandler::
+wxWin32ScrollBarInputHandler(wxWin32Renderer *renderer,
+ wxInputHandler *handler)
+ : wxStdScrollBarInputHandler(renderer, handler)
+{
+ m_scrollPaused = FALSE;
+ m_interval = 0;
+}
+
+bool wxWin32ScrollBarInputHandler::OnScrollTimer(wxScrollBar *scrollbar,
+ const wxControlAction& action)
+{
+ // stop if went beyond the position of the original click (this can only
+ // happen when we scroll by pages)
+ bool stop = FALSE;
+ if ( action == wxACTION_SCROLL_PAGE_DOWN )
+ {
+ stop = m_renderer->HitTestScrollbar(scrollbar, m_ptStartScrolling)
+ != wxHT_SCROLLBAR_BAR_2;
+ }
+ else if ( action == wxACTION_SCROLL_PAGE_UP )
+ {
+ stop = m_renderer->HitTestScrollbar(scrollbar, m_ptStartScrolling)
+ != wxHT_SCROLLBAR_BAR_1;
+ }
+
+ if ( stop )
+ {
+ StopScrolling(scrollbar);
+
+ scrollbar->Refresh();
+
+ return FALSE;
+ }
+
+ return wxStdScrollBarInputHandler::OnScrollTimer(scrollbar, action);
+}
+
+bool wxWin32ScrollBarInputHandler::HandleMouse(wxControl *control,
+ const wxMouseEvent& event)
+{
+ // remember the current state
+ bool wasDraggingThumb = m_htLast == wxHT_SCROLLBAR_THUMB;
+
+ // do process the message
+ bool rc = wxStdScrollBarInputHandler::HandleMouse(control, event);
+
+ // analyse the changes
+ if ( !wasDraggingThumb && (m_htLast == wxHT_SCROLLBAR_THUMB) )
+ {
+ // we just started dragging the thumb, remember its initial position to
+ // be able to restore it if the drag is cancelled later
+ m_eventStartDrag = event;
+ }
+
+ return rc;
+}
+
+bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxControl *control,
+ const wxMouseEvent& event)
+{
+ // we don't highlight scrollbar elements, so there is no need to process
+ // mouse move events normally - only do it while mouse is captured (i.e.
+ // when we're dragging the thumb or pressing on something)
+ if ( !m_winCapture )
+ return FALSE;
+
+ if ( event.Entering() )
+ {
+ // we're not interested in this at all
+ return FALSE;
+ }
+
+ wxScrollBar *scrollbar = wxStaticCast(control, wxScrollBar);
+ wxHitTest ht;
+ if ( m_scrollPaused )
+ {
+ // check if the mouse returned to its original location
+
+ if ( event.Leaving() )
+ {
+ // it surely didn't
+ return FALSE;
+ }
+
+ ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
+ if ( ht == m_htLast )
+ {
+ // yes it did, resume scrolling
+ m_scrollPaused = FALSE;
+ if ( m_timerScroll )
+ {
+ // we were scrolling by line/page, restart timer
+ m_timerScroll->Start(m_interval);
+
+ Press(scrollbar, TRUE);
+ }
+ else // we were dragging the thumb
+ {
+ // restore its last location
+ HandleThumbMove(scrollbar, m_eventLastDrag);
+ }
+
+ return TRUE;
+ }
+ }
+ else // normal case, scrolling hasn't been paused
+ {
+ // if we're scrolling the scrollbar because the arrow or the shaft was
+ // pressed, check that the mouse stays on the same scrollbar element
+
+ if ( event.Moving() )
+ {
+ ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
+ }
+ else // event.Leaving()
+ {
+ ht = wxHT_NOWHERE;
+ }
+
+ // if we're dragging the thumb and the mouse stays in the scrollbar, it
+ // is still ok - we only want to catch the case when the mouse leaves
+ // the scrollbar here
+ if ( m_htLast == wxHT_SCROLLBAR_THUMB && ht != wxHT_NOWHERE )
+ {
+ ht = wxHT_SCROLLBAR_THUMB;
+ }
+
+ if ( ht != m_htLast )
+ {
+ // what were we doing? 2 possibilities: either an arrow/shaft was
+ // pressed in which case we have a timer and so we just stop it or
+ // we were dragging the thumb
+ if ( m_timerScroll )
+ {
+ // pause scrolling
+ m_interval = m_timerScroll->GetInterval();
+ m_timerScroll->Stop();
+ m_scrollPaused = TRUE;
+
+ // unpress the arrow
+ Press(scrollbar, FALSE);
+ }
+ else // we were dragging the thumb
+ {
+ // remember the current thumb position to be able to restore it
+ // if the mouse returns to it later
+ m_eventLastDrag = event;
+
+ // and restore the original position (before dragging) of the
+ // thumb for now
+ HandleThumbMove(scrollbar, m_eventStartDrag);
+ }
+
+ return TRUE;
+ }
+ }
+
+ return wxStdScrollBarInputHandler::HandleMouseMove(control, event);
+}
+
+// ----------------------------------------------------------------------------
+// wxWin32CheckboxInputHandler
+// ----------------------------------------------------------------------------
+
+bool wxWin32CheckboxInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ if ( pressed )
+ {
+ wxControlAction action;
+ int keycode = event.GetKeyCode();
+ switch ( keycode )
+ {
+ case WXK_SPACE:
+ action = wxACTION_CHECKBOX_TOGGLE;
+ break;
+
+ case WXK_SUBTRACT:
+ case WXK_NUMPAD_SUBTRACT:
+ action = wxACTION_CHECKBOX_CHECK;
+ break;
+
+ case WXK_ADD:
+ case WXK_NUMPAD_ADD:
+ case WXK_NUMPAD_EQUAL:
+ action = wxACTION_CHECKBOX_CLEAR;
+ break;
+ }
+
+ if ( !!action )
+ {
+ control->PerformAction(action);
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// wxWin32TextCtrlInputHandler
+// ----------------------------------------------------------------------------
+
+bool wxWin32TextCtrlInputHandler::HandleKey(wxControl *control,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ // handle only MSW-specific text bindings here, the others are handled in
+ // the base class
+ if ( pressed )
+ {
+ int keycode = event.GetKeyCode();
+
+ wxControlAction action;
+ if ( keycode == WXK_DELETE && event.ShiftDown() )
+ {
+ action = wxACTION_TEXT_CUT;
+ }
+ else if ( keycode == WXK_INSERT )
+ {
+ if ( event.ControlDown() )
+ action = wxACTION_TEXT_COPY;
+ else if ( event.ShiftDown() )
+ action = wxACTION_TEXT_PASTE;
+ }
+
+ if ( action != wxACTION_NONE )
+ {
+ control->PerformAction(action);
+
+ return TRUE;
+ }
+ }
+
+ return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
+}
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: univ/window.cpp
+// Purpose: implementation of extra wxWindow methods for wxUniv port
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univwindow.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/window.h"
+ #include "wx/dcclient.h"
+ #include "wx/dcmemory.h"
+ #include "wx/event.h"
+ #include "wx/scrolbar.h"
+ #include "wx/menu.h"
+#endif // WX_PRECOMP
+
+#include "wx/univ/colschem.h"
+#include "wx/univ/renderer.h"
+#include "wx/univ/theme.h"
+
+#if wxUSE_CARET
+ #include "wx/caret.h"
+#endif // wxUSE_CARET
+
+// turn Refresh() debugging on/off
+#define WXDEBUG_REFRESH
+
+#ifndef __WXDEBUG__
+ #undef WXDEBUG_REFRESH
+#endif
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// event tables
+// ----------------------------------------------------------------------------
+
+// we can't use wxWindowNative here as it won't be expanded inside the macro
+#if defined(__WXMSW__)
+ IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowMSW)
+#elif defined(__WXGTK__)
+ IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowGTK)
+#elif defined(__WXMGL__)
+ IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowMGL)
+#endif
+
+BEGIN_EVENT_TABLE(wxWindow, wxWindowNative)
+ EVT_SIZE(wxWindow::OnSize)
+
+#if wxUSE_ACCEL || wxUSE_MENUS
+ EVT_KEY_DOWN(wxWindow::OnKeyDown)
+#endif // wxUSE_ACCEL
+
+#if wxUSE_MENUS
+ EVT_CHAR(wxWindow::OnChar)
+ EVT_KEY_UP(wxWindow::OnKeyUp)
+#endif // wxUSE_MENUS
+
+ EVT_PAINT(wxWindow::OnPaint)
+ EVT_NC_PAINT(wxWindow::OnNcPaint)
+ EVT_ERASE_BACKGROUND(wxWindow::OnErase)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+void wxWindow::Init()
+{
+ m_scrollbarVert =
+ m_scrollbarHorz = (wxScrollBar *)NULL;
+
+ m_isCurrent = FALSE;
+
+ m_renderer = wxTheme::Get()->GetRenderer();
+}
+
+bool wxWindow::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+{
+ // we add wxCLIP_CHILDREN and wxNO_FULL_REPAINT_ON_RESIZE because without
+ // these styles we can't get rid of flicker on wxMSW
+ if ( !wxWindowNative::Create(parent, id, pos, size,
+ style |
+ wxCLIP_CHILDREN |
+ wxNO_FULL_REPAINT_ON_RESIZE, name) )
+ {
+ return FALSE;
+ }
+
+ // if we should always have the scrollbar, do show it
+ if ( GetWindowStyle() & wxALWAYS_SHOW_SB )
+ {
+ m_scrollbarVert = new wxScrollBar(this, -1,
+ wxDefaultPosition, wxDefaultSize,
+ wxSB_VERTICAL);
+
+ // and position it
+ PositionScrollbars();
+ }
+
+ // the colours/fonts are default
+ m_hasBgCol =
+ m_hasFgCol =
+ m_hasFont = FALSE;
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// background pixmap
+// ----------------------------------------------------------------------------
+
+void wxWindow::SetBackground(const wxBitmap& bitmap,
+ int alignment,
+ wxStretch stretch)
+{
+ m_bitmapBg = bitmap;
+ m_alignBgBitmap = alignment;
+ m_stretchBgBitmap = stretch;
+}
+
+const wxBitmap& wxWindow::GetBackgroundBitmap(int *alignment,
+ wxStretch *stretch) const
+{
+ if ( m_bitmapBg.Ok() )
+ {
+ if ( alignment )
+ *alignment = m_alignBgBitmap;
+ if ( stretch )
+ *stretch = m_stretchBgBitmap;
+ }
+
+ return m_bitmapBg;
+}
+
+// ----------------------------------------------------------------------------
+// painting
+// ----------------------------------------------------------------------------
+
+// the event handler executed when the window background must be painted
+void wxWindow::OnErase(wxEraseEvent& event)
+{
+ if ( !m_renderer )
+ {
+ event.Skip();
+
+ return;
+ }
+
+ DoDrawBackground(*event.GetDC());
+
+ // if we have both scrollbars, we also have a square in the corner between
+ // them which we must paint
+ if ( m_scrollbarVert && m_scrollbarHorz )
+ {
+ wxSize size = GetSize();
+ wxRect rectClient = GetClientRect(),
+ rectBorder = m_renderer->GetBorderDimensions(GetBorder());
+
+ wxRect rectCorner;
+ rectCorner.x = rectClient.GetRight() + 1;
+ rectCorner.y = rectClient.GetBottom() + 1;
+ rectCorner.SetRight(size.x - rectBorder.width);
+ rectCorner.SetBottom(size.y - rectBorder.height);
+
+ if ( GetUpdateRegion().Contains(rectCorner) )
+ {
+ m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner);
+ }
+ }
+}
+
+// the event handlers executed when the window must be repainted
+void wxWindow::OnNcPaint(wxPaintEvent& event)
+{
+ if ( m_renderer )
+ {
+ // get the window rect
+ wxRect rect;
+ wxSize size = GetSize();
+ rect.x =
+ rect.y = 0;
+ rect.width = size.x;
+ rect.height = size.y;
+
+ // if the scrollbars are outside the border, we must adjust the rect to
+ // exclude them
+ if ( !m_renderer->AreScrollbarsInsideBorder() )
+ {
+ wxScrollBar *scrollbar = GetScrollbar(wxVERTICAL);
+ if ( scrollbar )
+ rect.width -= scrollbar->GetSize().x;
+
+ scrollbar = GetScrollbar(wxHORIZONTAL);
+ if ( scrollbar )
+ rect.height -= scrollbar->GetSize().y;
+ }
+
+ // get the DC and draw the border on it
+ wxWindowDC dc(this);
+ DoDrawBorder(dc, rect);
+ }
+}
+
+void wxWindow::OnPaint(wxPaintEvent& event)
+{
+ if ( !m_renderer )
+ {
+ // it is a native control which paints itself
+ event.Skip();
+ }
+ else
+ {
+ // get the DC to use and create renderer on it
+ wxPaintDC dc(this);
+ wxControlRenderer renderer(this, dc, m_renderer);
+
+ // draw the control
+ DoDraw(&renderer);
+ }
+}
+
+bool wxWindow::DoDrawBackground(wxDC& dc)
+{
+ // FIXME: leaving this code in leads to partial bg redraws sometimes under
+ // MSW
+ wxRect rect;
+#ifndef __WXMSW__
+ rect = GetUpdateRegion().GetBox();
+ if ( !rect.width && !rect.height )
+#endif
+ {
+ wxSize size = GetSize();
+ rect.width = size.x;
+ rect.height = size.y;
+ }
+
+ if ( GetBackgroundBitmap().Ok() )
+ {
+ // get the bitmap and the flags
+ int alignment;
+ wxStretch stretch;
+ wxBitmap bmp = GetBackgroundBitmap(&alignment, &stretch);
+ wxControlRenderer::DrawBitmap(dc, bmp, rect, alignment, stretch);
+ }
+ else // just fill it with bg colour if no bitmap
+ {
+ m_renderer->DrawBackground(dc, wxTHEME_BG_COLOUR(this),
+ rect, GetStateFlags());
+ }
+
+ return TRUE;
+}
+
+void wxWindow::EraseBackground(wxDC& dc, const wxRect& rect)
+{
+ // TODO: handle bg bitmaps here!
+
+ m_renderer->DrawBackground(dc, wxTHEME_BG_COLOUR(this), rect, GetStateFlags());
+}
+
+void wxWindow::DoDrawBorder(wxDC& dc, const wxRect& rect)
+{
+ // draw outline unless the update region is enitrely inside it in which
+ // case we don't need to do it
+#if 0 // doesn't seem to work, why?
+ if ( wxRegion(rect).Contains(GetUpdateRegion().GetBox()) != wxInRegion )
+#endif
+ {
+ m_renderer->DrawBorder(dc, GetBorder(), rect, GetStateFlags());
+ }
+}
+
+void wxWindow::DoDraw(wxControlRenderer *renderer)
+{
+}
+
+void wxWindow::Refresh(bool eraseBackground, const wxRect *rectClient)
+{
+ wxRect rectWin;
+ wxPoint pt = GetClientAreaOrigin();
+
+ wxSize size = GetClientSize();
+
+ if ( rectClient )
+ {
+ rectWin = *rectClient;
+
+ // don't refresh anything beyond the client area (scrollbars for
+ // example)
+ if ( rectWin.GetRight() > size.x )
+ rectWin.SetRight(size.x);
+ if ( rectWin.GetBottom() > size.y )
+ rectWin.SetBottom(size.y);
+
+ rectWin.Offset(pt);
+ }
+ else // refresh the entire client area
+ {
+ rectWin.x = pt.x;
+ rectWin.y = pt.y;
+ rectWin.width = size.x;
+ rectWin.height = size.y;
+ }
+
+ // debugging helper
+#ifdef WXDEBUG_REFRESH
+ static bool s_refreshDebug = FALSE;
+ if ( s_refreshDebug )
+ {
+ wxWindowDC dc(this);
+ dc.SetBrush(*wxCYAN_BRUSH);
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(rectWin);
+
+ // under Unix we use "--sync" X option for this
+ #ifdef __WXMSW__
+ ::GdiFlush();
+ ::Sleep(200);
+ #endif // __WXMSW__
+ }
+#endif // WXDEBUG_REFRESH
+
+ wxWindowNative::Refresh(eraseBackground, &rectWin);
+}
+
+// ----------------------------------------------------------------------------
+// state flags
+// ----------------------------------------------------------------------------
+
+bool wxWindow::Enable(bool enable)
+{
+ if ( !wxWindowNative::Enable(enable) )
+ return FALSE;
+
+ // disabled window can't keep focus
+ if ( FindFocus() == this )
+ {
+ GetParent()->SetFocus();
+ }
+
+ if ( m_renderer )
+ {
+ // a window with renderer is drawn by ourselves and it has to be
+ // refreshed to reflect its new status
+ Refresh();
+ }
+
+ return TRUE;
+}
+
+bool wxWindow::IsFocused() const
+{
+ wxWindow *self = wxConstCast(this, wxWindow);
+ return self->FindFocus() == self;
+}
+
+bool wxWindow::IsPressed() const
+{
+ return FALSE;
+}
+
+bool wxWindow::IsDefault() const
+{
+ return FALSE;
+}
+
+bool wxWindow::IsCurrent() const
+{
+ return m_isCurrent;
+}
+
+bool wxWindow::SetCurrent(bool doit)
+{
+ if ( doit == m_isCurrent )
+ return FALSE;
+
+ m_isCurrent = doit;
+
+ if ( CanBeHighlighted() )
+ Refresh();
+
+ return TRUE;
+}
+
+int wxWindow::GetStateFlags() const
+{
+ int flags = 0;
+ if ( !IsEnabled() )
+ flags |= wxCONTROL_DISABLED;
+
+ // the following states are only possible if our application is active - if
+ // it is not, even our default/focused controls shouldn't appear as such
+ if ( wxTheApp->IsActive() )
+ {
+ if ( IsCurrent() )
+ flags |= wxCONTROL_CURRENT;
+ if ( IsFocused() )
+ flags |= wxCONTROL_FOCUSED;
+ if ( IsPressed() )
+ flags |= wxCONTROL_PRESSED;
+ if ( IsDefault() )
+ flags |= wxCONTROL_ISDEFAULT;
+ }
+
+ return flags;
+}
+
+// ----------------------------------------------------------------------------
+// size
+// ----------------------------------------------------------------------------
+
+void wxWindow::OnSize(wxSizeEvent& event)
+{
+ if ( m_scrollbarVert || m_scrollbarHorz )
+ {
+ PositionScrollbars();
+ }
+
+ event.Skip();
+}
+
+wxSize wxWindow::DoGetBestSize() const
+{
+ return AdjustSize(DoGetBestClientSize());
+}
+
+wxSize wxWindow::DoGetBestClientSize() const
+{
+ return wxWindowNative::DoGetBestSize();
+}
+
+wxSize wxWindow::AdjustSize(const wxSize& size) const
+{
+ wxSize sz = size;
+ if ( m_renderer )
+ m_renderer->AdjustSize(&sz, this);
+ return sz;
+}
+
+wxPoint wxWindow::GetClientAreaOrigin() const
+{
+ wxPoint pt = wxWindowBase::GetClientAreaOrigin();
+
+ if ( m_renderer )
+ pt += m_renderer->GetBorderDimensions(GetBorder()).GetPosition();
+
+ return pt;
+}
+
+void wxWindow::DoGetClientSize(int *width, int *height) const
+{
+ int w, h;
+ wxWindowNative::DoGetClientSize(&w, &h);
+
+ // we assume that the scrollbars are positioned correctly (by a previous
+ // call to PositionScrollbars()) here
+
+ wxRect rectBorder;
+ if ( m_renderer )
+ rectBorder = m_renderer->GetBorderDimensions(GetBorder());
+
+ bool inside = m_renderer->AreScrollbarsInsideBorder();
+
+ if ( width )
+ {
+ // in any case, take account of the scrollbar
+ if ( m_scrollbarVert )
+ w -= m_scrollbarVert->GetSize().x;
+
+ // if we don't have scrollbar or if it is outside the border (and not
+ // blended into it), take account of the right border as well
+ if ( !m_scrollbarVert || inside )
+ w -= rectBorder.width;
+
+ // and always account for the left border
+ *width = w - rectBorder.x;
+
+ // we shouldn't return invalid width
+ if ( *width < 0 )
+ *width = 0;
+ }
+
+ if ( height )
+ {
+ if ( m_scrollbarHorz )
+ h -= m_scrollbarHorz->GetSize().y;
+
+ if ( !m_scrollbarHorz || inside )
+ h -= rectBorder.height;
+
+ *height = h - rectBorder.y;
+
+ // we shouldn't return invalid height
+ if ( *height < 0 )
+ *height = 0;
+ }
+}
+
+void wxWindow::DoSetClientSize(int width, int height)
+{
+ // take into account the borders
+ wxRect rectBorder = m_renderer->GetBorderDimensions(GetBorder());
+ width += rectBorder.x;
+ height += rectBorder.y;
+
+ // and the scrollbars (as they may be offset into the border, use the
+ // scrollbar position, not size - this supposes that PositionScrollbars()
+ // had been called before)
+ bool inside = m_renderer->AreScrollbarsInsideBorder();
+ wxSize size = GetSize();
+ if ( m_scrollbarVert )
+ width += size.x - m_scrollbarVert->GetPosition().x;
+ if ( !m_scrollbarVert || inside )
+ width += rectBorder.width;
+
+ if ( m_scrollbarHorz )
+ height += size.y - m_scrollbarHorz->GetPosition().y;
+ if ( !m_scrollbarHorz || inside )
+ height += rectBorder.height;
+
+ wxWindowNative::DoSetClientSize(width, height);
+}
+
+wxHitTest wxWindow::DoHitTest(wxCoord x, wxCoord y) const
+{
+ wxHitTest ht = wxWindowNative::DoHitTest(x, y);
+ if ( ht == wxHT_WINDOW_INSIDE )
+ {
+ if ( m_scrollbarVert && x >= m_scrollbarVert->GetPosition().x )
+ {
+ // it can still be changed below because it may also be the corner
+ ht = wxHT_WINDOW_VERT_SCROLLBAR;
+ }
+
+ if ( m_scrollbarHorz && y >= m_scrollbarHorz->GetPosition().y )
+ {
+ ht = ht == wxHT_WINDOW_VERT_SCROLLBAR ? wxHT_WINDOW_CORNER
+ : wxHT_WINDOW_HORZ_SCROLLBAR;
+ }
+ }
+
+ return ht;
+}
+
+// ----------------------------------------------------------------------------
+// scrolling: we implement it entirely ourselves except for ScrollWindow()
+// function which is supposed to be (efficiently) implemented by the native
+// window class
+// ----------------------------------------------------------------------------
+
+void wxWindow::RefreshScrollbars()
+{
+ if ( m_scrollbarHorz )
+ m_scrollbarHorz->Refresh();
+
+ if ( m_scrollbarVert )
+ m_scrollbarVert->Refresh();
+}
+
+void wxWindow::PositionScrollbars()
+{
+ // do not use GetClientSize/Rect as it relies on the scrollbars being
+ // correctly positioned
+
+ wxSize size = GetSize();
+ wxBorder border = GetBorder();
+ wxRect rectBorder = m_renderer->GetBorderDimensions(border);
+ bool inside = m_renderer->AreScrollbarsInsideBorder();
+
+ int height = m_scrollbarHorz ? m_scrollbarHorz->GetSize().y : 0;
+ int width = m_scrollbarVert ? m_scrollbarVert->GetSize().x : 0;
+
+ wxRect rectBar;
+ if ( m_scrollbarVert )
+ {
+ rectBar.x = size.x - width;
+ if ( inside )
+ rectBar.x -= rectBorder.width;
+ rectBar.width = width;
+ rectBar.y = 0;
+ if ( inside )
+ rectBar.y += rectBorder.y;
+ rectBar.height = size.y - height;
+ if ( inside )
+ rectBar.height -= rectBorder.y + rectBorder.height;
+
+ m_scrollbarVert->SetSize(rectBar, wxSIZE_NO_ADJUSTMENTS);
+ }
+
+ if ( m_scrollbarHorz )
+ {
+ rectBar.y = size.y - height;
+ if ( inside )
+ rectBar.y -= rectBorder.height;
+ rectBar.height = height;
+ rectBar.x = 0;
+ if ( inside )
+ rectBar.x += rectBorder.x;
+ rectBar.width = size.x - width;
+ if ( inside )
+ rectBar.width -= rectBorder.x + rectBorder.width;
+
+ m_scrollbarHorz->SetSize(rectBar, wxSIZE_NO_ADJUSTMENTS);
+ }
+
+ RefreshScrollbars();
+}
+
+void wxWindow::SetScrollbar(int orient,
+ int pos,
+ int pageSize,
+ int range,
+ bool refresh)
+{
+ bool hasClientSizeChanged = FALSE;
+ wxScrollBar *scrollbar = GetScrollbar(orient);
+ if ( range )
+ {
+ if ( !scrollbar )
+ {
+ // create it
+ scrollbar = new wxScrollBar(this, -1,
+ wxDefaultPosition, wxDefaultSize,
+ orient & wxVERTICAL ? wxSB_VERTICAL
+ : wxSB_HORIZONTAL);
+ if ( orient & wxVERTICAL )
+ m_scrollbarVert = scrollbar;
+ else
+ m_scrollbarHorz = scrollbar;
+
+ // the client area diminished as we created a scrollbar
+ hasClientSizeChanged = TRUE;
+
+ PositionScrollbars();
+ }
+ else if ( GetWindowStyle() & wxALWAYS_SHOW_SB )
+ {
+ // we might have disabled it before
+ scrollbar->Enable();
+ }
+
+ scrollbar->SetScrollbar(pos, pageSize, range, pageSize, refresh);
+ }
+ else // no range means no scrollbar
+ {
+ if ( scrollbar )
+ {
+ // wxALWAYS_SHOW_SB only applies to the vertical scrollbar
+ if ( (orient & wxVERTICAL) && (GetWindowStyle() & wxALWAYS_SHOW_SB) )
+ {
+ // just disable the scrollbar
+ scrollbar->SetScrollbar(pos, pageSize, range, pageSize, refresh);
+ scrollbar->Disable();
+ }
+ else // really remove the scrollbar
+ {
+ delete scrollbar;
+
+ if ( orient & wxVERTICAL )
+ m_scrollbarVert = NULL;
+ else
+ m_scrollbarHorz = NULL;
+
+ // the client area increased as we removed a scrollbar
+ hasClientSizeChanged = TRUE;
+
+ // the size of the remaining scrollbar must be adjusted
+ if ( m_scrollbarHorz || m_scrollbarVert )
+ {
+ PositionScrollbars();
+ }
+ }
+ }
+ }
+
+ // give the window a chance to relayout
+ if ( hasClientSizeChanged )
+ {
+ wxSizeEvent event(GetSize());
+ (void)GetEventHandler()->ProcessEvent(event);
+ }
+}
+
+void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
+{
+ wxScrollBar *scrollbar = GetScrollbar(orient);
+ wxCHECK_RET( scrollbar, _T("no scrollbar to set position for") );
+
+ scrollbar->SetThumbPosition(pos);
+ if ( refresh )
+ Refresh();
+}
+
+int wxWindow::GetScrollPos(int orient) const
+{
+ wxScrollBar *scrollbar = GetScrollbar(orient);
+ return scrollbar ? scrollbar->GetThumbPosition() : 0;
+}
+
+int wxWindow::GetScrollThumb(int orient) const
+{
+ wxScrollBar *scrollbar = GetScrollbar(orient);
+ return scrollbar ? scrollbar->GetThumbSize() : 0;
+}
+
+int wxWindow::GetScrollRange(int orient) const
+{
+ wxScrollBar *scrollbar = GetScrollbar(orient);
+ return scrollbar ? scrollbar->GetRange() : 0;
+}
+
+void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
+{
+ // before scrolling it, ensure that we don't have any unpainted areas
+ Update();
+
+ wxRect r;
+
+ if ( dx )
+ {
+ r = ScrollNoRefresh(dx, 0, rect);
+ Refresh(TRUE /* erase bkgnd */, &r);
+ }
+
+ if ( dy )
+ {
+ r = ScrollNoRefresh(0, dy, rect);
+ Refresh(TRUE /* erase bkgnd */, &r);
+ }
+}
+
+wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal)
+{
+ wxASSERT_MSG( !dx || !dy, _T("can't be used for diag scrolling") );
+
+ // the rect to refresh (which we will calculate)
+ wxRect rect;
+
+ if ( !dx && !dy )
+ {
+ // nothing to do
+ return rect;
+ }
+
+ // calculate the part of the window which we can just redraw in the new
+ // location
+ wxSize sizeTotal = rectTotal ? rectTotal->GetSize() : GetClientSize();
+
+ wxLogTrace(_T("scroll"), _T("rect is %dx%d, scroll by %d, %d"),
+ sizeTotal.x, sizeTotal.y, dx, dy);
+
+ // the initial and end point of the region we move in client coords
+ wxPoint ptSource, ptDest;
+ if ( rectTotal )
+ {
+ ptSource = rectTotal->GetPosition();
+ ptDest = rectTotal->GetPosition();
+ }
+
+ // the size of this region
+ wxSize size;
+ size.x = sizeTotal.x - abs(dx);
+ size.y = sizeTotal.y - abs(dy);
+ if ( size.x <= 0 || size.y <= 0 )
+ {
+ // just redraw everything as nothing of the displayed image will stay
+ wxLogTrace(_T("scroll"), _T("refreshing everything"));
+
+ rect = rectTotal ? *rectTotal : wxRect(0, 0, sizeTotal.x, sizeTotal.y);
+ }
+ else // move the part which doesn't change to the new location
+ {
+ // note that when we scroll the canvas in some direction we move the
+ // block which doesn't need to be refreshed in the opposite direction
+
+ if ( dx < 0 )
+ {
+ // scroll to the right, move to the left
+ ptSource.x -= dx;
+ }
+ else
+ {
+ // scroll to the left, move to the right
+ ptDest.x += dx;
+ }
+
+ if ( dy < 0 )
+ {
+ // scroll down, move up
+ ptSource.y -= dy;
+ }
+ else
+ {
+ // scroll up, move down
+ ptDest.y += dy;
+ }
+
+#if wxUSE_CARET
+ // we need to hide the caret before moving or it will erase itself at
+ // the wrong (old) location
+ wxCaret *caret = GetCaret();
+ if ( caret )
+ caret->Hide();
+#endif // wxUSE_CARET
+
+ // do move
+ wxClientDC dc(this);
+ wxBitmap bmp(size.x, size.y);
+ wxMemoryDC dcMem;
+ dcMem.SelectObject(bmp);
+
+ dcMem.Blit(wxPoint(0, 0), size, &dc, ptSource
+#if defined(__WXGTK__) && !defined(__WX_DC_BLIT_FIXED__)
+ + GetClientAreaOrigin()
+#endif // broken wxGTK wxDC::Blit
+ );
+ dc.Blit(ptDest, size, &dcMem, wxPoint(0, 0));
+
+ wxLogTrace(_T("scroll"),
+ _T("Blit: (%d, %d) of size %dx%d -> (%d, %d)"),
+ ptSource.x, ptSource.y,
+ size.x, size.y,
+ ptDest.x, ptDest.y);
+
+ // and now repaint the uncovered area
+
+ // FIXME: We repaint the intersection of these rectangles twice - is
+ // it bad? I don't think so as it is rare to scroll the window
+ // diagonally anyhow and so adding extra logic to compute
+ // rectangle intersection is probably not worth the effort
+
+ rect.x = ptSource.x;
+ rect.y = ptSource.y;
+
+ if ( dx )
+ {
+ if ( dx < 0 )
+ {
+ // refresh the area along the right border
+ rect.x += size.x + dx;
+ rect.width = -dx;
+ }
+ else
+ {
+ // refresh the area along the left border
+ rect.width = dx;
+ }
+
+ rect.height = sizeTotal.y;
+
+ wxLogTrace(_T("scroll"), _T("refreshing (%d, %d)-(%d, %d)"),
+ rect.x, rect.y,
+ rect.GetRight() + 1, rect.GetBottom() + 1);
+ }
+
+ if ( dy )
+ {
+ if ( dy < 0 )
+ {
+ // refresh the area along the bottom border
+ rect.y += size.y + dy;
+ rect.height = -dy;
+ }
+ else
+ {
+ // refresh the area along the top border
+ rect.height = dy;
+ }
+
+ rect.width = sizeTotal.x;
+
+ wxLogTrace(_T("scroll"), _T("refreshing (%d, %d)-(%d, %d)"),
+ rect.x, rect.y,
+ rect.GetRight() + 1, rect.GetBottom() + 1);
+ }
+
+#if wxUSE_CARET
+ if ( caret )
+ caret->Show();
+#endif // wxUSE_CARET
+ }
+
+ return rect;
+}
+
+// ----------------------------------------------------------------------------
+// colours/fonts
+// ----------------------------------------------------------------------------
+
+bool wxWindow::SetBackgroundColour(const wxColour& colour)
+{
+ if ( !wxWindowNative::SetBackgroundColour(colour) )
+ return FALSE;
+
+ m_hasBgCol = TRUE;
+
+ return TRUE;
+}
+
+bool wxWindow::SetForegroundColour(const wxColour& colour)
+{
+ if ( !wxWindowNative::SetForegroundColour(colour) )
+ return FALSE;
+
+ m_hasFgCol = TRUE;
+
+ return TRUE;
+}
+
+bool wxWindow::SetFont(const wxFont& font)
+{
+ if ( !wxWindowNative::SetFont(font) )
+ return FALSE;
+
+ m_hasFont = TRUE;
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// mouse capture
+// ----------------------------------------------------------------------------
+
+struct WXDLLEXPORT wxWindowNext
+{
+ wxWindow *win;
+ wxWindowNext *next;
+} *wxWindow::ms_winCaptureNext = NULL;
+
+void wxWindow::CaptureMouse()
+{
+ wxWindow *winOld = GetCapture();
+ if ( winOld )
+ {
+ // save it on stack
+ wxWindowNext *item = new wxWindowNext;
+ item->win = winOld;
+ item->next = ms_winCaptureNext;
+ ms_winCaptureNext = item;
+ }
+ //else: no mouse capture to save
+
+ wxWindowNative::CaptureMouse();
+}
+
+void wxWindow::ReleaseMouse()
+{
+ wxWindowNative::ReleaseMouse();
+
+ if ( ms_winCaptureNext )
+ {
+ ms_winCaptureNext->win->CaptureMouse();
+
+ wxWindowNext *item = ms_winCaptureNext;
+ ms_winCaptureNext = item->next;
+ delete item;
+ }
+ //else: stack is empty, no previous capture
+}
+
+// ----------------------------------------------------------------------------
+// accelerators and menu hot keys
+// ----------------------------------------------------------------------------
+
+#if wxUSE_MENUS
+ // the last window over which Alt was pressed (used by OnKeyUp)
+ wxWindow *wxWindow::ms_winLastAltPress = NULL;
+#endif // wxUSE_MENUS
+
+#if wxUSE_ACCEL || wxUSE_MENUS
+
+void wxWindow::OnKeyDown(wxKeyEvent& event)
+{
+#if wxUSE_MENUS
+ int key = event.GetKeyCode();
+ if ( !event.ControlDown() && (key == WXK_MENU || key == WXK_F10) )
+ {
+ ms_winLastAltPress = this;
+
+ // it can't be an accel anyhow
+ return;
+ }
+
+ ms_winLastAltPress = NULL;
+#endif // wxUSE_MENUS
+
+#if wxUSE_ACCEL
+ for ( wxWindow *win = this; win; win = win->GetParent() )
+ {
+ int command = win->GetAcceleratorTable()->GetCommand(event);
+ if ( command != -1 )
+ {
+ wxCommandEvent eventCmd(wxEVT_COMMAND_MENU_SELECTED, command);
+ if ( win->GetEventHandler()->ProcessEvent(eventCmd) )
+ {
+ // skip "event.Skip()" below
+ return;
+ }
+ }
+
+ if ( win->IsTopLevel() )
+ {
+ // try the frame menu bar
+#if wxUSE_MENUS
+ wxFrame *frame = wxDynamicCast(win, wxFrame);
+ if ( frame )
+ {
+ wxMenuBar *menubar = frame->GetMenuBar();
+ if ( menubar && menubar->ProcessAccelEvent(event) )
+ {
+ // skip "event.Skip()" below
+ return;
+ }
+ }
+#endif // wxUSE_MENUS
+
+ // don't propagate accels from the child frame to the parent one
+ break;
+ }
+ }
+#endif // wxUSE_ACCEL
+
+ event.Skip();
+}
+
+#endif // wxUSE_ACCEL
+
+#if wxUSE_MENUS
+
+wxMenuBar *wxWindow::GetParentFrameMenuBar() const
+{
+ for ( const wxWindow *win = this; win; win = win->GetParent() )
+ {
+ if ( win->IsTopLevel() )
+ {
+ wxFrame *frame = wxDynamicCast(win, wxFrame);
+ if ( frame )
+ {
+ return frame->GetMenuBar();
+ }
+
+ // don't look further - we don't want to return the menubar of the
+ // parent frame
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+void wxWindow::OnChar(wxKeyEvent& event)
+{
+ if ( event.AltDown() && !event.ControlDown() )
+ {
+ int key = event.GetKeyCode();
+
+ wxMenuBar *menubar = GetParentFrameMenuBar();
+ if ( menubar )
+ {
+ int item = menubar->FindNextItemForAccel(-1, key);
+ if ( item != -1 )
+ {
+ menubar->PopupMenu((size_t)item);
+
+ // skip "event.Skip()" below
+ return;
+ }
+ }
+ }
+
+ event.Skip();
+}
+
+void wxWindow::OnKeyUp(wxKeyEvent& event)
+{
+ int key = event.GetKeyCode();
+ if ( !event.HasModifiers() && (key == WXK_MENU || key == WXK_F10) )
+ {
+ // only process Alt release specially if there were no other key
+ // presses since Alt had been pressed and if both events happened in
+ // the same window
+ if ( ms_winLastAltPress == this )
+ {
+ wxMenuBar *menubar = GetParentFrameMenuBar();
+ if ( menubar && this != menubar )
+ {
+ menubar->SelectMenu(0);
+ }
+ }
+ }
+ else
+ {
+ event.Skip();
+ }
+
+ // in any case reset it
+ ms_winLastAltPress = NULL;
+}
+
+#endif // wxUSE_MENUS
+
wxNativeEncodingInfo info;
wxGetNativeFontEncoding(encoding, &info);
+#if wxUSE_FONTMAP
if ( !wxTestFontEncoding(info) )
{
// ask font mapper for a replacement
(void)wxTheFontMapper->GetAltForEncoding(encoding, &info);
}
+#endif // wxUSE_FONTMAP
wxString pattern;
pattern.Printf(wxT("-*-*-*-*-*-*-*-*-*-*-%c-*-%s-%s"),
if ( !wxGetNativeFontEncoding(encoding, &info) ||
!wxTestFontEncoding(info) )
{
+#if wxUSE_FONTMAP
if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
+#endif // wxUSE_FONTMAP
{
// unspported encoding - replace it with the default
//
int wxThread::GetCPUCount()
{
-#if defined(__LINUX__)
+#if defined(__LINUX__) && wxUSE_FFILE
// read from proc (can't use wxTextFile here because it's a special file:
// it has 0 size but still can be read from)
wxLogNull nolog;
// wxStream classes to support IO redirection in wxExecute
// ----------------------------------------------------------------------------
+#if wxUSE_STREAMS
+
class wxProcessFileInputStream : public wxInputStream
{
public:
return ret;
}
+#endif // wxUSE_STREAMS
+
long wxExecute(wxChar **argv,
bool sync,
wxProcess *process)
// pipe initialization: construction of the wxStreams
if ( process && process->IsRedirected() )
{
+#if wxUSE_STREAMS
// These two streams are relative to this process.
wxOutputStream *outStream = new wxProcessFileOutputStream(pipeIn[1]);
wxInputStream *inStream = new wxProcessFileInputStream(pipeOut[0]);
wxInputStream *errStream = new wxProcessFileInputStream(pipeErr[0]);
+ process->SetPipeStreams(inStream, outStream, errStream);
+#endif // wxUSE_STREAMS
+
close(pipeIn[0]); // close reading side
close(pipeOut[1]); // close writing side
close(pipeErr[1]); // close writing side
-
- process->SetPipeStreams(inStream, outStream, errStream);
}
#if wxUSE_GUI