Native wxBitmapComboBox patch for GTK+

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53779 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-05-27 10:17:56 +00:00
parent 7a04b64409
commit e78c1d7855
9 changed files with 643 additions and 67 deletions

View File

@@ -3011,6 +3011,7 @@ COND_TOOLKIT_WINCE_ADVANCED_PLATFORM_HDR = \
@COND_TOOLKIT_X11@ wx/unix/joystick.h wx/unix/sound.h wx/unix/taskbarx11.h @COND_TOOLKIT_X11@ wx/unix/joystick.h wx/unix/sound.h wx/unix/taskbarx11.h
COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_ADVANCED_PLATFORM_NATIVE_HDR = \ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_ADVANCED_PLATFORM_NATIVE_HDR = \
wx/gtk/animate.h \ wx/gtk/animate.h \
wx/gtk/bmpcbox.h \
wx/gtk/calctrl.h \ wx/gtk/calctrl.h \
wx/gtk/dataview.h \ wx/gtk/dataview.h \
wx/gtk/hyperlink.h wx/gtk/hyperlink.h
@@ -5387,6 +5388,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS = \
COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS = \ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS = \
monodll_aboutdlg.o \ monodll_aboutdlg.o \
monodll_animate.o \ monodll_animate.o \
monodll_bmpcbox.o \
monodll_calctrl.o \ monodll_calctrl.o \
monodll_dataview.o \ monodll_dataview.o \
monodll_hyperlink.o monodll_hyperlink.o
@@ -7310,6 +7312,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_1 = \
COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 = \ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 = \
monolib_aboutdlg.o \ monolib_aboutdlg.o \
monolib_animate.o \ monolib_animate.o \
monolib_bmpcbox.o \
monolib_calctrl.o \ monolib_calctrl.o \
monolib_dataview.o \ monolib_dataview.o \
monolib_hyperlink.o monolib_hyperlink.o
@@ -11070,6 +11073,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_2 = \
COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 = \ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 = \
advdll_aboutdlg.o \ advdll_aboutdlg.o \
advdll_animate.o \ advdll_animate.o \
advdll_bmpcbox.o \
advdll_calctrl.o \ advdll_calctrl.o \
advdll_dataview.o \ advdll_dataview.o \
advdll_hyperlink.o advdll_hyperlink.o
@@ -11153,6 +11157,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_3 = \
COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 = \ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 = \
advlib_aboutdlg.o \ advlib_aboutdlg.o \
advlib_animate.o \ advlib_animate.o \
advlib_bmpcbox.o \
advlib_calctrl.o \ advlib_calctrl.o \
advlib_dataview.o \ advlib_dataview.o \
advlib_hyperlink.o advlib_hyperlink.o
@@ -18130,6 +18135,15 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monodll_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(MONODLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monodll_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(MONODLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CCC) -c -o $@ $(MONODLL_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CCC) -c -o $@ $(MONODLL_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monodll_bmpcbox.o: $(srcdir)/src/gtk/bmpcbox.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/bmpcbox.cpp
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monodll_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monodll_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp
@@ -18139,12 +18153,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp
@@ -22681,6 +22689,15 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monolib_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(MONOLIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monolib_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(MONOLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CCC) -c -o $@ $(MONOLIB_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CCC) -c -o $@ $(MONOLIB_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monolib_bmpcbox.o: $(srcdir)/src/gtk/bmpcbox.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/bmpcbox.cpp
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monolib_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monolib_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp
@@ -22690,12 +22707,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp
@@ -30901,6 +30912,15 @@ advdll_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_@advdll_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(ADVDLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@advdll_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(ADVDLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_@ $(CCC) -c -o $@ $(ADVDLL_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@ $(CCC) -c -o $@ $(ADVDLL_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@advdll_bmpcbox.o: $(srcdir)/src/gtk/bmpcbox.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/gtk/bmpcbox.cpp
@COND_TOOLKIT_MSW_WXUNIV_0@advdll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_WXUNIV_0@advdll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@advdll_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(ADVDLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@advdll_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp
@@ -30910,12 +30930,6 @@ advdll_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@advdll_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(ADVDLL_ODEP) @COND_TOOLKIT_WINCE_WXUNIV_0@advdll_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp @COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp
@COND_TOOLKIT_MSW_WXUNIV_0@advdll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_WXUNIV_0@advdll_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_MSW_WXUNIV_0@advdll_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(ADVDLL_ODEP) @COND_TOOLKIT_MSW_WXUNIV_0@advdll_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp @COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp
@@ -31186,6 +31200,15 @@ advlib_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_@advlib_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(ADVLIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@advlib_eggtrayicon.o: $(srcdir)/src/gtk1/eggtrayicon.c $(ADVLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_@ $(CCC) -c -o $@ $(ADVLIB_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@ $(CCC) -c -o $@ $(ADVLIB_CFLAGS) $(srcdir)/src/gtk1/eggtrayicon.c
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@advlib_bmpcbox.o: $(srcdir)/src/gtk/bmpcbox.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/gtk/bmpcbox.cpp
@COND_TOOLKIT_MSW_WXUNIV_0@advlib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_WXUNIV_0@advlib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@advlib_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(ADVLIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@advlib_calctrl.o: $(srcdir)/src/gtk/calctrl.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/gtk/calctrl.cpp
@@ -31195,12 +31218,6 @@ advlib_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@advlib_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(ADVLIB_ODEP) @COND_TOOLKIT_WINCE_WXUNIV_0@advlib_calctrl.o: $(srcdir)/src/msw/calctrl.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp @COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/calctrl.cpp
@COND_TOOLKIT_MSW_WXUNIV_0@advlib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_WINCE_WXUNIV_0@advlib_bmpcbox.o: $(srcdir)/src/msw/bmpcbox.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_WINCE_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/bmpcbox.cpp
@COND_TOOLKIT_MSW_WXUNIV_0@advlib_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(ADVLIB_ODEP) @COND_TOOLKIT_MSW_WXUNIV_0@advlib_datecontrols.o: $(srcdir)/src/msw/datecontrols.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp @COND_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/datecontrols.cpp

View File

@@ -2999,12 +2999,14 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<set var="ADVANCED_GTK_NATIVE_SRC" hints="files"> <set var="ADVANCED_GTK_NATIVE_SRC" hints="files">
src/gtk/aboutdlg.cpp src/gtk/aboutdlg.cpp
src/gtk/animate.cpp src/gtk/animate.cpp
src/gtk/bmpcbox.cpp
src/gtk/calctrl.cpp src/gtk/calctrl.cpp
src/gtk/dataview.cpp src/gtk/dataview.cpp
src/gtk/hyperlink.cpp src/gtk/hyperlink.cpp
</set> </set>
<set var="ADVANCED_GTK_NATIVE_HDR" hints="files"> <set var="ADVANCED_GTK_NATIVE_HDR" hints="files">
wx/gtk/animate.h wx/gtk/animate.h
wx/gtk/bmpcbox.h
wx/gtk/calctrl.h wx/gtk/calctrl.h
wx/gtk/dataview.h wx/gtk/dataview.h
wx/gtk/hyperlink.h wx/gtk/hyperlink.h

View File

@@ -25,7 +25,7 @@ class WXDLLIMPEXP_FWD_CORE wxItemContainer;
// Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which // Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
// wxBitmapComboBox implementation utilizes ownerdrawn combobox // wxBitmapComboBox implementation utilizes ownerdrawn combobox
// (either native or generic). // (either native or generic).
#if 1 #if !defined(__WXGTK__)
#define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED #define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
#endif #endif
@@ -112,6 +112,8 @@ private:
#include "wx/generic/bmpcbox.h" #include "wx/generic/bmpcbox.h"
#elif defined(__WXMSW__) #elif defined(__WXMSW__)
#include "wx/msw/bmpcbox.h" #include "wx/msw/bmpcbox.h"
#elif defined(__WXGTK__)
#include "wx/gtk/bmpcbox.h"
#else #else
#include "wx/generic/bmpcbox.h" #include "wx/generic/bmpcbox.h"
#endif #endif

145
include/wx/gtk/bmpcbox.h Normal file
View File

@@ -0,0 +1,145 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/bmpcbox.h
// Purpose: wxBitmapComboBox
// Author: Jaakko Salli
// Created: 2008-05-19
// RCS-ID: $Id:
// Copyright: (c) 2008 Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_BMPCBOX_H_
#define _WX_GTK_BMPCBOX_H_
#include "wx/combobox.h"
// ----------------------------------------------------------------------------
// wxBitmapComboBox: a wxComboBox that allows images to be shown
// in front of string items.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox,
public wxBitmapComboBoxBase
{
public:
// ctors and such
wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
{
Init();
}
wxBitmapComboBox(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr)
: wxComboBox(),
wxBitmapComboBoxBase()
{
Init();
(void)Create(parent, id, value, pos, size, n,
choices, style, validator, name);
}
wxBitmapComboBox(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
int n,
const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr);
virtual ~wxBitmapComboBox();
// Sets the image for the given item.
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
// Returns the image of the item with the given index.
virtual wxBitmap GetItemBitmap(unsigned int n) const;
// Returns size of the image used in list
virtual wxSize GetBitmapSize() const
{
return m_bitmapSize;
}
// Adds item with image to the end of the combo box.
int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData);
// Inserts item with image into the list before pos. Not valid for wxCB_SORT
// styles, use Append instead.
int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos);
int Insert(const wxString& item, const wxBitmap& bitmap,
unsigned int pos, void *clientData);
int Insert(const wxString& item, const wxBitmap& bitmap,
unsigned int pos, wxClientData *clientData);
// Override some wxTextEntry interface.
virtual void WriteText(const wxString& value);
virtual wxString GetValue() const;
virtual void Remove(long from, long to);
virtual void SetInsertionPoint(long pos);
virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void GetSelection(long *from, long *to) const;
virtual void SetSelection(int n) { wxComboBox::SetSelection(n); }
virtual int GetSelection() const { return wxComboBox::GetSelection(); }
virtual bool IsEditable() const;
virtual void SetEditable(bool editable);
protected:
virtual GtkWidget* GetConnectWidget();
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
virtual void GTKCreateComboBoxWidget();
virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text );
wxSize m_bitmapSize;
int m_bitmapCellIndex;
private:
void Init();
DECLARE_DYNAMIC_CLASS(wxBitmapComboBox)
};
#endif // _WX_GTK_BMPCBOX_H_

View File

@@ -20,7 +20,10 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString;
class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
{ {
public: public:
wxChoice(); wxChoice()
{
Init();
}
wxChoice( wxWindow *parent, wxWindowID id, wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
@@ -29,8 +32,7 @@ public:
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr ) const wxString& name = wxChoiceNameStr )
{ {
m_strings = (wxSortedArrayString *)NULL; Init();
Create(parent, id, pos, size, n, choices, style, validator, name); Create(parent, id, pos, size, n, choices, style, validator, name);
} }
wxChoice( wxWindow *parent, wxWindowID id, wxChoice( wxWindow *parent, wxWindowID id,
@@ -41,8 +43,7 @@ public:
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr ) const wxString& name = wxChoiceNameStr )
{ {
m_strings = (wxSortedArrayString *)NULL; Init();
Create(parent, id, pos, size, choices, style, validator, name); Create(parent, id, pos, size, choices, style, validator, name);
} }
virtual ~wxChoice(); virtual ~wxChoice();
@@ -85,6 +86,9 @@ protected:
// contains the client data for the items // contains the client data for the items
wxArrayPtrVoid m_clientData; wxArrayPtrVoid m_clientData;
// index to GtkListStore cell which displays the item text
int m_stringCellIndex;
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;
virtual int DoInsertItems(const wxArrayStringsAdapter& items, virtual int DoInsertItems(const wxArrayStringsAdapter& items,
unsigned int pos, unsigned int pos,
@@ -96,7 +100,13 @@ protected:
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
// in derived classes, implement this to insert list store entry
// with all items default except text
virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text );
private: private:
void Init();
DECLARE_DYNAMIC_CLASS(wxChoice) DECLARE_DYNAMIC_CLASS(wxChoice)
}; };

View File

@@ -23,7 +23,11 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
public wxTextEntry public wxTextEntry
{ {
public: public:
wxComboBox() { m_strings = NULL; } wxComboBox()
: wxChoice(), wxTextEntry()
{
Init();
}
wxComboBox(wxWindow *parent, wxComboBox(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
@@ -33,7 +37,9 @@ public:
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr) const wxString& name = wxComboBoxNameStr)
: wxChoice(), wxTextEntry()
{ {
Init();
Create(parent, id, value, pos, size, n, choices, style, validator, name); Create(parent, id, value, pos, size, n, choices, style, validator, name);
} }
@@ -45,7 +51,9 @@ public:
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr) const wxString& name = wxComboBoxNameStr)
: wxChoice(), wxTextEntry()
{ {
Init();
Create(parent, id, value, pos, size, choices, style, validator, name); Create(parent, id, value, pos, size, choices, style, validator, name);
} }
@@ -123,8 +131,14 @@ protected:
// override this and return true. // override this and return true.
virtual bool UseGTKStyleBase() const { return true; } virtual bool UseGTKStyleBase() const { return true; }
// Override in derived classes to create combo box widgets with
// custom list stores.
virtual void GTKCreateComboBoxWidget();
// return the GtkEntry part of the combobox // return the GtkEntry part of the combobox
GtkEntry *GetEntry() const; GtkEntry *GetEntry() const { return m_entry; }
GtkEntry* m_entry;
private: private:
// From wxTextEntry: // From wxTextEntry:
@@ -138,6 +152,8 @@ private:
DisableEvents(); DisableEvents();
} }
void Init();
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

361
src/gtk/bmpcbox.cpp Normal file
View File

@@ -0,0 +1,361 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/gtk/bmpcboxg.cpp
// Purpose: wxBitmapComboBox
// Author: Jaakko Salli
// Created: 2008-05-19
// RCS-ID: $Id:
// Copyright: (c) 2008 Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_BITMAPCOMBOBOX
#include "wx/bmpcbox.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#endif
#include "wx/gtk/private.h"
#ifdef __WXGTK24__
#include "wx/gtk/win_gtk.h"
#include <gobject/gvaluecollector.h>
#include <gtk/gtktreemodel.h>
#endif
// ============================================================================
// implementation
// ============================================================================
IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBox, wxComboBox)
// ----------------------------------------------------------------------------
// wxBitmapComboBox creation
// ----------------------------------------------------------------------------
void wxBitmapComboBox::Init()
{
m_bitmapCellIndex = 0;
m_stringCellIndex = 1;
m_bitmapSize = wxSize(0, 0);
}
wxBitmapComboBox::wxBitmapComboBox(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator,
const wxString& name)
: wxComboBox(),
wxBitmapComboBoxBase()
{
Init();
Create(parent,id,value,pos,size,choices,style,validator,name);
}
bool wxBitmapComboBox::Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator,
const wxString& name)
{
wxCArrayString chs(choices);
return Create(parent, id, value, pos, size, chs.GetCount(),
chs.GetStrings(), style, validator, name);
}
bool wxBitmapComboBox::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 ( !wxComboBox::Create(parent, id, value, pos, size,
n, choices, style, validator, name) )
return false;
// Select 'value' in entry-less mode
if ( !GetEntry() )
{
int n = FindString(value);
if ( n != wxNOT_FOUND )
SetSelection(n);
}
return true;
}
void wxBitmapComboBox::GTKCreateComboBoxWidget()
{
GtkListStore *store;
store = gtk_list_store_new( 2, G_TYPE_OBJECT, G_TYPE_STRING );
if ( HasFlag(wxCB_READONLY) )
{
m_widget = gtk_combo_box_new_with_model( GTK_TREE_MODEL(store) );
}
else
{
m_widget = gtk_combo_box_entry_new_with_model( GTK_TREE_MODEL(store), m_stringCellIndex );
m_entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
gtk_entry_set_editable( m_entry, TRUE );
}
// This must be called as gtk_combo_box_entry_new_with_model adds
// automatically adds one text column.
gtk_cell_layout_clear( GTK_CELL_LAYOUT(m_widget) );
GtkCellRenderer* imageRenderer = gtk_cell_renderer_pixbuf_new();
gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(m_widget),
imageRenderer, FALSE);
gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(m_widget),
imageRenderer, "pixbuf", 0);
GtkCellRenderer* textRenderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_end( GTK_CELL_LAYOUT(m_widget),
textRenderer, TRUE );
gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(m_widget),
textRenderer, "text", 1);
}
wxBitmapComboBox::~wxBitmapComboBox()
{
}
GtkWidget* wxBitmapComboBox::GetConnectWidget()
{
if ( GetEntry() )
return wxComboBox::GetConnectWidget();
return wxChoice::GetConnectWidget();
}
GdkWindow *wxBitmapComboBox::GTKGetWindow(wxArrayGdkWindows& windows) const
{
if ( GetEntry() )
return wxComboBox::GTKGetWindow(windows);
return wxChoice::GTKGetWindow(windows);
}
// ----------------------------------------------------------------------------
// Item manipulation
// ----------------------------------------------------------------------------
void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
{
if ( bitmap.IsOk() )
{
if ( m_bitmapSize.x == 0 )
{
m_bitmapSize.x = bitmap.GetWidth();
m_bitmapSize.y = bitmap.GetHeight();
}
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
GtkTreeIter iter;
if ( gtk_tree_model_iter_nth_child( model, &iter, NULL, n ) )
{
GValue value0 = { 0, };
g_value_init( &value0, G_TYPE_OBJECT );
g_value_set_object( &value0, bitmap.GetPixbuf() );
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter,
m_bitmapCellIndex, &value0 );
g_value_unset( &value0 );
}
}
}
wxBitmap wxBitmapComboBox::GetItemBitmap(unsigned int n) const
{
wxBitmap bitmap;
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
{
GValue value = { 0, };
gtk_tree_model_get_value( model, &iter,
m_bitmapCellIndex, &value );
GdkPixbuf* pixbuf = (GdkPixbuf*) g_value_get_object( &value );
if ( pixbuf )
{
g_object_ref( pixbuf );
bitmap.SetPixbuf( pixbuf );
}
g_value_unset( &value );
}
return bitmap;
}
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
{
const int n = wxComboBox::Append(item);
if ( n != wxNOT_FOUND )
SetItemBitmap(n, bitmap);
return n;
}
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
void *clientData)
{
const int n = wxComboBox::Append(item, clientData);
if ( n != wxNOT_FOUND )
SetItemBitmap(n, bitmap);
return n;
}
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
wxClientData *clientData)
{
const int n = wxComboBox::Append(item, clientData);
if ( n != wxNOT_FOUND )
SetItemBitmap(n, bitmap);
return n;
}
int wxBitmapComboBox::Insert(const wxString& item,
const wxBitmap& bitmap,
unsigned int pos)
{
const int n = wxComboBox::Insert(item, pos);
if ( n != wxNOT_FOUND )
SetItemBitmap(n, bitmap);
return n;
}
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
unsigned int pos, wxClientData *clientData)
{
const int n = wxComboBox::Insert(item, pos, clientData);
if ( n != wxNOT_FOUND )
SetItemBitmap(n, bitmap);
return n;
}
void wxBitmapComboBox::GTKInsertComboBoxTextItem( unsigned int n, const wxString& text )
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
GtkListStore *store = GTK_LIST_STORE( model );
GtkTreeIter iter;
gtk_list_store_insert( store, &iter, n );
GValue value = { 0, };
g_value_init( &value, G_TYPE_STRING );
g_value_set_string( &value, wxGTK_CONV( text ) );
gtk_list_store_set_value( store, &iter, m_stringCellIndex, &value );
g_value_unset( &value );
}
// ----------------------------------------------------------------------------
// wxTextEntry interface override
// ----------------------------------------------------------------------------
void wxBitmapComboBox::WriteText(const wxString& value)
{
if ( GetEntry() )
wxComboBox::WriteText(value);
}
wxString wxBitmapComboBox::GetValue() const
{
if ( GetEntry() )
return wxComboBox::GetValue();
return GetStringSelection();
}
void wxBitmapComboBox::Remove(long from, long to)
{
if ( GetEntry() )
wxComboBox::Remove(from, to);
}
void wxBitmapComboBox::SetInsertionPoint(long pos)
{
if ( GetEntry() )
wxComboBox::SetInsertionPoint(pos);
}
long wxBitmapComboBox::GetInsertionPoint() const
{
if ( GetEntry() )
return wxComboBox::GetInsertionPoint();
return 0;
}
long wxBitmapComboBox::GetLastPosition() const
{
if ( GetEntry() )
return wxComboBox::GetLastPosition();
return 0;
}
void wxBitmapComboBox::SetSelection(long from, long to)
{
if ( GetEntry() )
wxComboBox::SetSelection(from, to);
}
void wxBitmapComboBox::GetSelection(long *from, long *to) const
{
if ( GetEntry() )
wxComboBox::GetSelection(from, to);
}
bool wxBitmapComboBox::IsEditable() const
{
if ( GetEntry() )
return wxTextEntry::IsEditable();
return false;
}
void wxBitmapComboBox::SetEditable(bool editable)
{
if ( GetEntry() )
wxComboBox::SetEditable(editable);
}
#endif // wxUSE_BITMAPCOMBOBOX

View File

@@ -40,9 +40,10 @@ gtk_choice_changed_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControlWithItems) IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControlWithItems)
wxChoice::wxChoice() void wxChoice::Init()
: m_strings(NULL)
{ {
m_strings = (wxSortedArrayString *)NULL;
m_stringCellIndex = 0;
} }
bool wxChoice::Create( wxWindow *parent, wxWindowID id, bool wxChoice::Create( wxWindow *parent, wxWindowID id,
@@ -63,8 +64,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
long style, const wxValidator& validator, long style, const wxValidator& validator,
const wxString &name ) const wxString &name )
{ {
m_strings = NULL;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
@@ -117,6 +116,11 @@ void wxChoice::SendSelectionChangedEvent(wxEventType evt_type)
HandleWindowEvent( event ); HandleWindowEvent( event );
} }
void wxChoice::GTKInsertComboBoxTextItem( unsigned int n, const wxString& text )
{
gtk_combo_box_insert_text( GTK_COMBO_BOX( m_widget ), n, wxGTK_CONV( text ) );
}
int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos, unsigned int pos,
void **clientData, wxClientDataType type) void **clientData, wxClientDataType type)
@@ -130,7 +134,6 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
int n = wxNOT_FOUND; int n = wxNOT_FOUND;
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )
{ {
n = pos + i; n = pos + i;
@@ -139,7 +142,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
if(m_strings) if(m_strings)
n = m_strings->Add(items[i]); n = m_strings->Add(items[i]);
gtk_combo_box_insert_text( combobox, n, wxGTK_CONV( items[i] ) ); GTKInsertComboBoxTextItem( n, items[i] );
m_clientData.Insert( NULL, n ); m_clientData.Insert( NULL, n );
AssignNewItemClientData(n, clientData, i, type); AssignNewItemClientData(n, clientData, i, type);
@@ -166,9 +169,9 @@ void wxChoice::DoClear()
DisableEvents(); DisableEvents();
const unsigned int count = GetCount(); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
for (unsigned int i = 0; i < count; i++) GtkTreeModel* model = gtk_combo_box_get_model( combobox );
gtk_combo_box_remove_text( GTK_COMBO_BOX(m_widget), 0 ); gtk_list_store_clear(GTK_LIST_STORE(model));
m_clientData.Clear(); m_clientData.Clear();
@@ -185,7 +188,14 @@ void wxChoice::DoDeleteOneItem(unsigned int n)
wxCHECK_RET( m_widget != NULL, wxT("invalid control") ); wxCHECK_RET( m_widget != NULL, wxT("invalid control") );
wxCHECK_RET( IsValid(n), _T("invalid index in wxChoice::Delete") ); wxCHECK_RET( IsValid(n), _T("invalid index in wxChoice::Delete") );
gtk_combo_box_remove_text( GTK_COMBO_BOX( m_widget ), n ); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
GtkListStore* store = GTK_LIST_STORE(model);
GtkTreeIter iter;
gtk_tree_model_iter_nth_child( model, &iter,
NULL, (gint) n );
gtk_list_store_remove( store, &iter );
m_clientData.RemoveAt( n ); m_clientData.RemoveAt( n );
if ( m_strings ) if ( m_strings )
m_strings->RemoveAt( n ); m_strings->RemoveAt( n );
@@ -207,7 +217,7 @@ int wxChoice::FindString( const wxString &item, bool bCase ) const
do do
{ {
GValue value = { 0, }; GValue value = { 0, };
gtk_tree_model_get_value( model, &iter, 0, &value ); gtk_tree_model_get_value( model, &iter, m_stringCellIndex, &value );
wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) ); wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
g_value_unset( &value ); g_value_unset( &value );
@@ -240,7 +250,7 @@ void wxChoice::SetString(unsigned int n, const wxString &text)
GValue value = { 0, }; GValue value = { 0, };
g_value_init( &value, G_TYPE_STRING ); g_value_init( &value, G_TYPE_STRING );
g_value_set_string( &value, wxGTK_CONV( text ) ); g_value_set_string( &value, wxGTK_CONV( text ) );
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, 0, &value ); gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, m_stringCellIndex, &value );
g_value_unset( &value ); g_value_unset( &value );
} }
@@ -259,7 +269,7 @@ wxString wxChoice::GetString(unsigned int n) const
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n)) if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
{ {
GValue value = { 0, }; GValue value = { 0, };
gtk_tree_model_get_value( model, &iter, 0, &value ); gtk_tree_model_get_value( model, &iter, m_stringCellIndex, &value );
wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) ); wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) );
g_value_unset( &value ); g_value_unset( &value );
return tmp; return tmp;

View File

@@ -72,6 +72,11 @@ BEGIN_EVENT_TABLE(wxComboBox, wxChoice)
EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll) EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll)
END_EVENT_TABLE() END_EVENT_TABLE()
void wxComboBox::Init()
{
m_entry = NULL;
}
bool wxComboBox::Create( wxWindow *parent, wxWindowID id, bool wxComboBox::Create( wxWindow *parent, wxWindowID id,
const wxString& value, const wxString& value,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
@@ -91,8 +96,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
long style, const wxValidator& validator, long style, const wxValidator& validator,
const wxString& name ) const wxString& name )
{ {
m_strings = NULL;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
@@ -103,12 +106,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
if (HasFlag(wxCB_SORT)) if (HasFlag(wxCB_SORT))
m_strings = new wxSortedArrayString(); m_strings = new wxSortedArrayString();
m_widget = gtk_combo_box_entry_new_text(); GTKCreateComboBoxWidget();
// Set it up to trigger default item on enter key press
GtkWidget *widget = gtk_bin_get_child(GTK_BIN(m_widget));
gtk_entry_set_activates_default(GTK_ENTRY(widget),
!HasFlag(wxTE_PROCESS_ENTER));
if (HasFlag(wxBORDER_NONE)) if (HasFlag(wxBORDER_NONE))
{ {
@@ -118,23 +116,34 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
GtkEntry * const entry = GetEntry(); GtkEntry * const entry = GetEntry();
gtk_entry_set_editable( entry, TRUE ); if ( entry )
{
// Set it up to trigger default item on enter key press
gtk_entry_set_activates_default( entry,
!HasFlag(wxTE_PROCESS_ENTER) );
gtk_entry_set_editable( entry, TRUE );
}
Append(n, choices); Append(n, choices);
m_parent->DoAddChild( this ); m_parent->DoAddChild( this );
m_focusWidget = GTK_WIDGET( entry ); if ( entry )
m_focusWidget = GTK_WIDGET( entry );
PostCreation(size); PostCreation(size);
gtk_entry_set_text( entry, wxGTK_CONV(value) ); if ( entry )
{
gtk_entry_set_text( entry, wxGTK_CONV(value) );
if (style & wxCB_READONLY) if (style & wxCB_READONLY)
gtk_entry_set_editable( entry, FALSE ); gtk_entry_set_editable( entry, FALSE );
g_signal_connect_after (entry, "changed", g_signal_connect_after (entry, "changed",
G_CALLBACK (gtkcombobox_text_changed_callback), this); G_CALLBACK (gtkcombobox_text_changed_callback), this);
}
g_signal_connect_after (m_widget, "changed", g_signal_connect_after (m_widget, "changed",
G_CALLBACK (gtkcombobox_changed_callback), this); G_CALLBACK (gtkcombobox_changed_callback), this);
@@ -144,9 +153,11 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
return true; return true;
} }
GtkEntry *wxComboBox::GetEntry() const void wxComboBox::GTKCreateComboBoxWidget()
{ {
return GTK_ENTRY(GTK_BIN(m_widget)->child); m_widget = gtk_combo_box_entry_new_text();
m_entry = GTK_ENTRY(GTK_BIN(m_widget)->child);
} }
GtkEditable *wxComboBox::GetEditable() const GtkEditable *wxComboBox::GetEditable() const
@@ -159,7 +170,7 @@ void wxComboBox::OnChar( wxKeyEvent &event )
switch ( event.GetKeyCode() ) switch ( event.GetKeyCode() )
{ {
case WXK_RETURN: case WXK_RETURN:
if ( HasFlag(wxTE_PROCESS_ENTER) ) if ( HasFlag(wxTE_PROCESS_ENTER) && GetEntry() )
{ {
// GTK automatically selects an item if its in the list // GTK automatically selects an item if its in the list
wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId()); wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId());
@@ -182,8 +193,9 @@ void wxComboBox::OnChar( wxKeyEvent &event )
void wxComboBox::DisableEvents() void wxComboBox::DisableEvents()
{ {
g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child, if ( GetEntry() )
(gpointer)gtkcombobox_text_changed_callback, this); g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child,
(gpointer)gtkcombobox_text_changed_callback, this);
g_signal_handlers_block_by_func(m_widget, g_signal_handlers_block_by_func(m_widget,
(gpointer)gtkcombobox_changed_callback, this); (gpointer)gtkcombobox_changed_callback, this);
@@ -191,8 +203,9 @@ void wxComboBox::DisableEvents()
void wxComboBox::EnableEvents() void wxComboBox::EnableEvents()
{ {
g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child, if ( GetEntry() )
(gpointer)gtkcombobox_text_changed_callback, this); g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child,
(gpointer)gtkcombobox_text_changed_callback, this);
g_signal_handlers_unblock_by_func(m_widget, g_signal_handlers_unblock_by_func(m_widget,
(gpointer)gtkcombobox_changed_callback, this); (gpointer)gtkcombobox_changed_callback, this);