Add wxNativeWindow allowing to easily embed native widgets in wx.
Implement the class for wxMSW, wxGTK and wxOSX/Cocoa, show it in the widgets sample and add documentation for it.
This commit is contained in:
16
Makefile.in
16
Makefile.in
@@ -5975,6 +5975,7 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS = \
|
|||||||
monodll_osx_cocoa_menu.o \
|
monodll_osx_cocoa_menu.o \
|
||||||
monodll_osx_cocoa_menuitem.o \
|
monodll_osx_cocoa_menuitem.o \
|
||||||
monodll_osx_cocoa_msgdlg.o \
|
monodll_osx_cocoa_msgdlg.o \
|
||||||
|
monodll_cocoa_nativewin.o \
|
||||||
monodll_cocoa_nonownedwnd.o \
|
monodll_cocoa_nonownedwnd.o \
|
||||||
monodll_osx_cocoa_notebook.o \
|
monodll_osx_cocoa_notebook.o \
|
||||||
monodll_osx_cocoa_radiobut.o \
|
monodll_osx_cocoa_radiobut.o \
|
||||||
@@ -8351,6 +8352,7 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1 = \
|
|||||||
monolib_osx_cocoa_menu.o \
|
monolib_osx_cocoa_menu.o \
|
||||||
monolib_osx_cocoa_menuitem.o \
|
monolib_osx_cocoa_menuitem.o \
|
||||||
monolib_osx_cocoa_msgdlg.o \
|
monolib_osx_cocoa_msgdlg.o \
|
||||||
|
monolib_cocoa_nativewin.o \
|
||||||
monolib_cocoa_nonownedwnd.o \
|
monolib_cocoa_nonownedwnd.o \
|
||||||
monolib_osx_cocoa_notebook.o \
|
monolib_osx_cocoa_notebook.o \
|
||||||
monolib_osx_cocoa_radiobut.o \
|
monolib_osx_cocoa_radiobut.o \
|
||||||
@@ -10884,6 +10886,7 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2 = \
|
|||||||
coredll_osx_cocoa_menu.o \
|
coredll_osx_cocoa_menu.o \
|
||||||
coredll_osx_cocoa_menuitem.o \
|
coredll_osx_cocoa_menuitem.o \
|
||||||
coredll_osx_cocoa_msgdlg.o \
|
coredll_osx_cocoa_msgdlg.o \
|
||||||
|
coredll_cocoa_nativewin.o \
|
||||||
coredll_cocoa_nonownedwnd.o \
|
coredll_cocoa_nonownedwnd.o \
|
||||||
coredll_osx_cocoa_notebook.o \
|
coredll_osx_cocoa_notebook.o \
|
||||||
coredll_osx_cocoa_radiobut.o \
|
coredll_osx_cocoa_radiobut.o \
|
||||||
@@ -12663,6 +12666,7 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3 = \
|
|||||||
corelib_osx_cocoa_menu.o \
|
corelib_osx_cocoa_menu.o \
|
||||||
corelib_osx_cocoa_menuitem.o \
|
corelib_osx_cocoa_menuitem.o \
|
||||||
corelib_osx_cocoa_msgdlg.o \
|
corelib_osx_cocoa_msgdlg.o \
|
||||||
|
corelib_cocoa_nativewin.o \
|
||||||
corelib_cocoa_nonownedwnd.o \
|
corelib_cocoa_nonownedwnd.o \
|
||||||
corelib_osx_cocoa_notebook.o \
|
corelib_osx_cocoa_notebook.o \
|
||||||
corelib_osx_cocoa_radiobut.o \
|
corelib_osx_cocoa_radiobut.o \
|
||||||
@@ -18308,6 +18312,9 @@ monodll_osx_cocoa_menuitem.o: $(srcdir)/src/osx/cocoa/menuitem.mm $(MONODLL_ODEP
|
|||||||
monodll_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(MONODLL_ODEP)
|
monodll_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(MONODLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
||||||
|
|
||||||
|
monodll_cocoa_nativewin.o: $(srcdir)/src/osx/cocoa/nativewin.mm $(MONODLL_ODEP)
|
||||||
|
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nativewin.mm
|
||||||
|
|
||||||
monodll_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(MONODLL_ODEP)
|
monodll_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(MONODLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
||||||
|
|
||||||
@@ -24233,6 +24240,9 @@ monolib_osx_cocoa_menuitem.o: $(srcdir)/src/osx/cocoa/menuitem.mm $(MONOLIB_ODEP
|
|||||||
monolib_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(MONOLIB_ODEP)
|
monolib_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(MONOLIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
||||||
|
|
||||||
|
monolib_cocoa_nativewin.o: $(srcdir)/src/osx/cocoa/nativewin.mm $(MONOLIB_ODEP)
|
||||||
|
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nativewin.mm
|
||||||
|
|
||||||
monolib_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(MONOLIB_ODEP)
|
monolib_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(MONOLIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
||||||
|
|
||||||
@@ -30839,6 +30849,9 @@ coredll_osx_cocoa_menuitem.o: $(srcdir)/src/osx/cocoa/menuitem.mm $(COREDLL_ODEP
|
|||||||
coredll_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(COREDLL_ODEP)
|
coredll_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(COREDLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
$(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
||||||
|
|
||||||
|
coredll_cocoa_nativewin.o: $(srcdir)/src/osx/cocoa/nativewin.mm $(COREDLL_ODEP)
|
||||||
|
$(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nativewin.mm
|
||||||
|
|
||||||
coredll_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(COREDLL_ODEP)
|
coredll_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(COREDLL_ODEP)
|
||||||
$(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
$(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
||||||
|
|
||||||
@@ -35240,6 +35253,9 @@ corelib_osx_cocoa_menuitem.o: $(srcdir)/src/osx/cocoa/menuitem.mm $(CORELIB_ODEP
|
|||||||
corelib_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(CORELIB_ODEP)
|
corelib_osx_cocoa_msgdlg.o: $(srcdir)/src/osx/cocoa/msgdlg.mm $(CORELIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
$(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/msgdlg.mm
|
||||||
|
|
||||||
|
corelib_cocoa_nativewin.o: $(srcdir)/src/osx/cocoa/nativewin.mm $(CORELIB_ODEP)
|
||||||
|
$(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nativewin.mm
|
||||||
|
|
||||||
corelib_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(CORELIB_ODEP)
|
corelib_cocoa_nonownedwnd.o: $(srcdir)/src/osx/cocoa/nonownedwnd.mm $(CORELIB_ODEP)
|
||||||
$(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
$(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/nonownedwnd.mm
|
||||||
|
|
||||||
|
@@ -854,6 +854,12 @@ dnl ### begin block 20_COND_TOOLKIT_OSX_COCOA_USE_GUI_1[wx.bkl] ###
|
|||||||
COND_TOOLKIT_OSX_COCOA_USE_GUI_1=""
|
COND_TOOLKIT_OSX_COCOA_USE_GUI_1=""
|
||||||
fi
|
fi
|
||||||
AC_SUBST(COND_TOOLKIT_OSX_COCOA_USE_GUI_1)
|
AC_SUBST(COND_TOOLKIT_OSX_COCOA_USE_GUI_1)
|
||||||
|
dnl ### begin block 20_COND_TOOLKIT_OSX_COCOA_WXUNIV_0[../../samples/widgets/widgets.bkl] ###
|
||||||
|
COND_TOOLKIT_OSX_COCOA_WXUNIV_0="#"
|
||||||
|
if test "x$TOOLKIT" = "xOSX_COCOA" -a "x$WXUNIV" = "x0" ; then
|
||||||
|
COND_TOOLKIT_OSX_COCOA_WXUNIV_0=""
|
||||||
|
fi
|
||||||
|
AC_SUBST(COND_TOOLKIT_OSX_COCOA_WXUNIV_0)
|
||||||
dnl ### begin block 20_COND_TOOLKIT_OSX_IPHONE[../../demos/bombs/bombs.bkl,../../demos/forty/forty.bkl,../../demos/fractal/fractal.bkl,../../demos/life/life.bkl,../../demos/poem/poem.bkl,../../samples/access/access.bkl,../../samples/animate/anitest.bkl,../../samples/artprov/artprov.bkl,../../samples/aui/auidemo.bkl,../../samples/calendar/calendar.bkl,../../samples/caret/caret.bkl,../../samples/clipboard/clipboard.bkl,../../samples/collpane/collpane.bkl,../../samples/combo/combo.bkl,../../samples/config/config.bkl,../../samples/controls/controls.bkl,../../samples/dataview/dataview.bkl,../../samples/debugrpt/debugrpt.bkl,../../samples/dialogs/dialogs.bkl,../../samples/dialup/dialup.bkl,../../samples/display/display.bkl,../../samples/dll/dll.bkl,../../samples/dnd/dnd.bkl,../../samples/docview/docview.bkl,../../samples/dragimag/dragimag.bkl,../../samples/drawing/drawing.bkl,../../samples/erase/erase.bkl,../../samples/event/event.bkl,../../samples/except/except.bkl,../../samples/exec/exec.bkl,../../samples/font/font.bkl,../../samples/fswatcher/fswatcher.bkl,../../samples/grid/grid.bkl,../../samples/help/help.bkl,../../samples/htlbox/htlbox.bkl,../../samples/html/about/about.bkl,../../samples/html/help/help.bkl,../../samples/html/helpview/helpview.bkl,../../samples/html/htmlctrl/htmlctrl.bkl,../../samples/html/printing/printing.bkl,../../samples/html/test/test.bkl,../../samples/html/virtual/virtual.bkl,../../samples/html/widget/widget.bkl,../../samples/html/zip/zip.bkl,../../samples/image/image.bkl,../../samples/internat/internat.bkl,../../samples/ipc/ipc.bkl,../../samples/joytest/joytest.bkl,../../samples/keyboard/keyboard.bkl,../../samples/layout/layout.bkl,../../samples/listctrl/listctrl.bkl,../../samples/mdi/mdi.bkl,../../samples/mediaplayer/mediaplayer.bkl,../../samples/memcheck/memcheck.bkl,../../samples/menu/menu.bkl,../../samples/minimal-mariano/minimal.bkl,../../samples/minimal/minimal.bkl,../../samples/nativdlg/nativdlg.bkl,../../samples/notebook/notebook.bkl,../../samples/oleauto/oleauto.bkl,../../samples/opengl/cube/cube.bkl,../../samples/opengl/isosurf/isosurf.bkl,../../samples/opengl/penguin/penguin.bkl,../../samples/ownerdrw/ownerdrw.bkl,../../samples/popup/popup.bkl,../../samples/power/power.bkl,../../samples/preferences/preferences.bkl,../../samples/printing/printing.bkl,../../samples/propgrid/propgrid.bkl,../../samples/regtest/regtest.bkl,../../samples/render/render.bkl,../../samples/ribbon/ribbon.bkl,../../samples/richtext/richtext.bkl,../../samples/sashtest/sashtest.bkl,../../samples/scroll/scroll.bkl,../../samples/shaped/shaped.bkl,../../samples/sockets/sockets.bkl,../../samples/sound/sound.bkl,../../samples/splash/splash.bkl,../../samples/splitter/splitter.bkl,../../samples/statbar/statbar.bkl,../../samples/stc/stctest.bkl,../../samples/svg/svgtest.bkl,../../samples/taborder/taborder.bkl,../../samples/taskbar/taskbar.bkl,../../samples/taskbarbutton/taskbarbutton.bkl,../../samples/text/text.bkl,../../samples/thread/thread.bkl,../../samples/toolbar/toolbar.bkl,../../samples/treectrl/treectrl.bkl,../../samples/treelist/treelist.bkl,../../samples/typetest/typetest.bkl,../../samples/uiaction/uiaction.bkl,../../samples/validate/validate.bkl,../../samples/vscroll/vscroll.bkl,../../samples/webview/webview.bkl,../../samples/widgets/widgets.bkl,../../samples/wizard/wizard.bkl,../../samples/wrapsizer/wrapsizer.bkl,../../samples/xrc/xrcdemo.bkl,../../samples/xti/xti.bkl,../../tests/benchmarks/bench.bkl,../../tests/test.bkl,../../utils/helpview/src/helpview.bkl,../../utils/screenshotgen/src/screenshotgen.bkl,wx.bkl] ###
|
dnl ### begin block 20_COND_TOOLKIT_OSX_IPHONE[../../demos/bombs/bombs.bkl,../../demos/forty/forty.bkl,../../demos/fractal/fractal.bkl,../../demos/life/life.bkl,../../demos/poem/poem.bkl,../../samples/access/access.bkl,../../samples/animate/anitest.bkl,../../samples/artprov/artprov.bkl,../../samples/aui/auidemo.bkl,../../samples/calendar/calendar.bkl,../../samples/caret/caret.bkl,../../samples/clipboard/clipboard.bkl,../../samples/collpane/collpane.bkl,../../samples/combo/combo.bkl,../../samples/config/config.bkl,../../samples/controls/controls.bkl,../../samples/dataview/dataview.bkl,../../samples/debugrpt/debugrpt.bkl,../../samples/dialogs/dialogs.bkl,../../samples/dialup/dialup.bkl,../../samples/display/display.bkl,../../samples/dll/dll.bkl,../../samples/dnd/dnd.bkl,../../samples/docview/docview.bkl,../../samples/dragimag/dragimag.bkl,../../samples/drawing/drawing.bkl,../../samples/erase/erase.bkl,../../samples/event/event.bkl,../../samples/except/except.bkl,../../samples/exec/exec.bkl,../../samples/font/font.bkl,../../samples/fswatcher/fswatcher.bkl,../../samples/grid/grid.bkl,../../samples/help/help.bkl,../../samples/htlbox/htlbox.bkl,../../samples/html/about/about.bkl,../../samples/html/help/help.bkl,../../samples/html/helpview/helpview.bkl,../../samples/html/htmlctrl/htmlctrl.bkl,../../samples/html/printing/printing.bkl,../../samples/html/test/test.bkl,../../samples/html/virtual/virtual.bkl,../../samples/html/widget/widget.bkl,../../samples/html/zip/zip.bkl,../../samples/image/image.bkl,../../samples/internat/internat.bkl,../../samples/ipc/ipc.bkl,../../samples/joytest/joytest.bkl,../../samples/keyboard/keyboard.bkl,../../samples/layout/layout.bkl,../../samples/listctrl/listctrl.bkl,../../samples/mdi/mdi.bkl,../../samples/mediaplayer/mediaplayer.bkl,../../samples/memcheck/memcheck.bkl,../../samples/menu/menu.bkl,../../samples/minimal-mariano/minimal.bkl,../../samples/minimal/minimal.bkl,../../samples/nativdlg/nativdlg.bkl,../../samples/notebook/notebook.bkl,../../samples/oleauto/oleauto.bkl,../../samples/opengl/cube/cube.bkl,../../samples/opengl/isosurf/isosurf.bkl,../../samples/opengl/penguin/penguin.bkl,../../samples/ownerdrw/ownerdrw.bkl,../../samples/popup/popup.bkl,../../samples/power/power.bkl,../../samples/preferences/preferences.bkl,../../samples/printing/printing.bkl,../../samples/propgrid/propgrid.bkl,../../samples/regtest/regtest.bkl,../../samples/render/render.bkl,../../samples/ribbon/ribbon.bkl,../../samples/richtext/richtext.bkl,../../samples/sashtest/sashtest.bkl,../../samples/scroll/scroll.bkl,../../samples/shaped/shaped.bkl,../../samples/sockets/sockets.bkl,../../samples/sound/sound.bkl,../../samples/splash/splash.bkl,../../samples/splitter/splitter.bkl,../../samples/statbar/statbar.bkl,../../samples/stc/stctest.bkl,../../samples/svg/svgtest.bkl,../../samples/taborder/taborder.bkl,../../samples/taskbar/taskbar.bkl,../../samples/taskbarbutton/taskbarbutton.bkl,../../samples/text/text.bkl,../../samples/thread/thread.bkl,../../samples/toolbar/toolbar.bkl,../../samples/treectrl/treectrl.bkl,../../samples/treelist/treelist.bkl,../../samples/typetest/typetest.bkl,../../samples/uiaction/uiaction.bkl,../../samples/validate/validate.bkl,../../samples/vscroll/vscroll.bkl,../../samples/webview/webview.bkl,../../samples/widgets/widgets.bkl,../../samples/wizard/wizard.bkl,../../samples/wrapsizer/wrapsizer.bkl,../../samples/xrc/xrcdemo.bkl,../../samples/xti/xti.bkl,../../tests/benchmarks/bench.bkl,../../tests/test.bkl,../../utils/helpview/src/helpview.bkl,../../utils/screenshotgen/src/screenshotgen.bkl,wx.bkl] ###
|
||||||
COND_TOOLKIT_OSX_IPHONE="#"
|
COND_TOOLKIT_OSX_IPHONE="#"
|
||||||
if test "x$TOOLKIT" = "xOSX_IPHONE" ; then
|
if test "x$TOOLKIT" = "xOSX_IPHONE" ; then
|
||||||
|
@@ -2545,6 +2545,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
src/osx/cocoa/menu.mm
|
src/osx/cocoa/menu.mm
|
||||||
src/osx/cocoa/menuitem.mm
|
src/osx/cocoa/menuitem.mm
|
||||||
src/osx/cocoa/msgdlg.mm
|
src/osx/cocoa/msgdlg.mm
|
||||||
|
src/osx/cocoa/nativewin.mm
|
||||||
src/osx/cocoa/nonownedwnd.mm
|
src/osx/cocoa/nonownedwnd.mm
|
||||||
src/osx/cocoa/notebook.mm
|
src/osx/cocoa/notebook.mm
|
||||||
src/osx/cocoa/radiobut.mm
|
src/osx/cocoa/radiobut.mm
|
||||||
|
@@ -2149,6 +2149,7 @@ OSX_COCOA_SRC =
|
|||||||
src/osx/cocoa/menu.mm
|
src/osx/cocoa/menu.mm
|
||||||
src/osx/cocoa/menuitem.mm
|
src/osx/cocoa/menuitem.mm
|
||||||
src/osx/cocoa/msgdlg.mm
|
src/osx/cocoa/msgdlg.mm
|
||||||
|
src/osx/cocoa/nativewin.mm
|
||||||
src/osx/cocoa/nonownedwnd.mm
|
src/osx/cocoa/nonownedwnd.mm
|
||||||
src/osx/cocoa/notebook.mm
|
src/osx/cocoa/notebook.mm
|
||||||
src/osx/cocoa/radiobut.mm
|
src/osx/cocoa/radiobut.mm
|
||||||
|
6
configure
vendored
6
configure
vendored
@@ -715,6 +715,7 @@ COND_TOOLKIT_QT
|
|||||||
COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0
|
COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0
|
||||||
COND_TOOLKIT_OSX_IPHONE_USE_GUI_1
|
COND_TOOLKIT_OSX_IPHONE_USE_GUI_1
|
||||||
COND_TOOLKIT_OSX_IPHONE
|
COND_TOOLKIT_OSX_IPHONE
|
||||||
|
COND_TOOLKIT_OSX_COCOA_WXUNIV_0
|
||||||
COND_TOOLKIT_OSX_COCOA_USE_GUI_1
|
COND_TOOLKIT_OSX_COCOA_USE_GUI_1
|
||||||
COND_TOOLKIT_OSX_COCOA
|
COND_TOOLKIT_OSX_COCOA
|
||||||
COND_TOOLKIT_OSX_CARBON_USE_GUI_1
|
COND_TOOLKIT_OSX_CARBON_USE_GUI_1
|
||||||
@@ -40051,6 +40052,11 @@ EOF
|
|||||||
COND_TOOLKIT_OSX_COCOA_USE_GUI_1=""
|
COND_TOOLKIT_OSX_COCOA_USE_GUI_1=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
COND_TOOLKIT_OSX_COCOA_WXUNIV_0="#"
|
||||||
|
if test "x$TOOLKIT" = "xOSX_COCOA" -a "x$WXUNIV" = "x0" ; then
|
||||||
|
COND_TOOLKIT_OSX_COCOA_WXUNIV_0=""
|
||||||
|
fi
|
||||||
|
|
||||||
COND_TOOLKIT_OSX_IPHONE="#"
|
COND_TOOLKIT_OSX_IPHONE="#"
|
||||||
if test "x$TOOLKIT" = "xOSX_IPHONE" ; then
|
if test "x$TOOLKIT" = "xOSX_IPHONE" ; then
|
||||||
COND_TOOLKIT_OSX_IPHONE=""
|
COND_TOOLKIT_OSX_IPHONE=""
|
||||||
|
@@ -45,6 +45,8 @@ Changes in behaviour which may result in build errors
|
|||||||
- wxQt branch implementing Qt5-based port of wxWidgets API was merged into
|
- wxQt branch implementing Qt5-based port of wxWidgets API was merged into
|
||||||
the trunk (Mariano Reingart, Google Summer of Code project).
|
the trunk (Mariano Reingart, Google Summer of Code project).
|
||||||
|
|
||||||
|
- Added wxNativeWindow allowing to embed native widgets in wxWidgets programs.
|
||||||
|
|
||||||
All:
|
All:
|
||||||
|
|
||||||
- Allow calling wxItemContainer::Add() and similar with std::vector<> argument.
|
- Allow calling wxItemContainer::Add() and similar with std::vector<> argument.
|
||||||
|
@@ -207,6 +207,7 @@ Currently the following symbols exist:
|
|||||||
decide whether some function should be overloaded for both
|
decide whether some function should be overloaded for both
|
||||||
<code>long</code> and <code>long long</code> types.}
|
<code>long</code> and <code>long long</code> types.}
|
||||||
@itemdef{wxHAS_MULTIPLE_FILEDLG_FILTERS, Defined if wxFileDialog supports multiple ('|'-separated) filters.}
|
@itemdef{wxHAS_MULTIPLE_FILEDLG_FILTERS, Defined if wxFileDialog supports multiple ('|'-separated) filters.}
|
||||||
|
@itemdef{wxHAS_NATIVE_WINDOW, Defined if wxNativeWindow class is available.}
|
||||||
@itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if <a href="http://en.wikipedia.org/wiki/Resource_(Windows)">
|
@itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if <a href="http://en.wikipedia.org/wiki/Resource_(Windows)">
|
||||||
Windows resource files</a> or OS/2 resource files are available on the current platform.}
|
Windows resource files</a> or OS/2 resource files are available on the current platform.}
|
||||||
@itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.}
|
@itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.}
|
||||||
|
@@ -12,11 +12,13 @@
|
|||||||
|
|
||||||
#include "wx/toplevel.h"
|
#include "wx/toplevel.h"
|
||||||
|
|
||||||
// this symbol can be tested in the user code to see if the current wx port has
|
// These symbols can be tested in the user code to see if the current wx port
|
||||||
// support for creating wxNativeContainerWindow from native windows
|
// has support for creating wxNativeContainerWindow and wxNativeWindow from
|
||||||
|
// native windows.
|
||||||
//
|
//
|
||||||
// be optimistic by default, we undefine it below if we don't have it finally
|
// Be optimistic by default, we undefine them below if necessary.
|
||||||
#define wxHAS_NATIVE_CONTAINER_WINDOW
|
#define wxHAS_NATIVE_CONTAINER_WINDOW
|
||||||
|
#define wxHAS_NATIVE_WINDOW
|
||||||
|
|
||||||
// we define the following typedefs for each of the platform supporting native
|
// we define the following typedefs for each of the platform supporting native
|
||||||
// windows wrapping:
|
// windows wrapping:
|
||||||
@@ -28,16 +30,16 @@
|
|||||||
// window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for
|
// window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for
|
||||||
// all platforms except GTK where we also can work with Window/XID)
|
// all platforms except GTK where we also can work with Window/XID)
|
||||||
//
|
//
|
||||||
// later we'll also have
|
// - wxNativeWindowHandle for child windows, i.e. HWND/GtkWidget*/NSControl
|
||||||
//
|
|
||||||
// - wxNativeWindowHandle for child windows (which will be wrapped by
|
|
||||||
// wxNativeWindow<T> class), it is HWND/GtkWidget*/ControlRef
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/wrapwin.h"
|
#include "wx/msw/wrapwin.h"
|
||||||
|
|
||||||
typedef HWND wxNativeContainerWindowId;
|
typedef HWND wxNativeContainerWindowId;
|
||||||
typedef HWND wxNativeContainerWindowHandle;
|
typedef HWND wxNativeContainerWindowHandle;
|
||||||
|
typedef HWND wxNativeWindowHandle;
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
// GdkNativeWindow is guint32 under GDK/X11 and gpointer under GDK/WIN32
|
// GdkNativeWindow is guint32 under GDK/X11 and gpointer under GDK/WIN32
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
typedef unsigned long wxNativeContainerWindowId;
|
typedef unsigned long wxNativeContainerWindowId;
|
||||||
@@ -45,11 +47,51 @@
|
|||||||
typedef void *wxNativeContainerWindowId;
|
typedef void *wxNativeContainerWindowId;
|
||||||
#endif
|
#endif
|
||||||
typedef GdkWindow *wxNativeContainerWindowHandle;
|
typedef GdkWindow *wxNativeContainerWindowHandle;
|
||||||
|
typedef GtkWidget *wxNativeWindowHandle;
|
||||||
|
#elif defined(__WXOSX_COCOA__)
|
||||||
|
typedef NSView *wxNativeWindowHandle;
|
||||||
|
|
||||||
|
// no support for using native TLWs yet
|
||||||
|
#undef wxHAS_NATIVE_CONTAINER_WINDOW
|
||||||
#else
|
#else
|
||||||
// no support for using native windows under this platform yet
|
// no support for using native windows under this platform yet
|
||||||
#undef wxHAS_NATIVE_CONTAINER_WINDOW
|
#undef wxHAS_NATIVE_CONTAINER_WINDOW
|
||||||
|
#undef wxHAS_NATIVE_WINDOW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef wxHAS_NATIVE_WINDOW
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxNativeWindow: for using native windows inside wxWidgets windows
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxNativeWindow : public wxWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Default ctor, Create() must be called later to really create the window.
|
||||||
|
wxNativeWindow() { }
|
||||||
|
|
||||||
|
// Create a window from an existing native window handle.
|
||||||
|
//
|
||||||
|
// Notice that this ctor doesn't take the usual pos and size parameters,
|
||||||
|
// they're taken from the window handle itself.
|
||||||
|
//
|
||||||
|
// Use GetHandle() to check if the creation was successful, it will return
|
||||||
|
// 0 if the handle was invalid.
|
||||||
|
wxNativeWindow(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle)
|
||||||
|
{
|
||||||
|
Create(parent, winid, handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Same as non-default ctor, but with a return code.
|
||||||
|
bool Create(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle);
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxDECLARE_NO_COPY_CLASS(wxNativeWindow);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // wxHAS_NATIVE_WINDOW
|
||||||
|
|
||||||
#ifdef wxHAS_NATIVE_CONTAINER_WINDOW
|
#ifdef wxHAS_NATIVE_CONTAINER_WINDOW
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
79
interface/wx/nativewin.h
Normal file
79
interface/wx/nativewin.h
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/nativewin.h
|
||||||
|
// Purpose: wxNativeWindow documentation.
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Created: 2015-07-31
|
||||||
|
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxNativeWindow
|
||||||
|
|
||||||
|
Allows to embed a native widget in an application using wxWidgets.
|
||||||
|
|
||||||
|
This class can be used as a bridge between wxWidgets and native GUI
|
||||||
|
toolkit, i.e. standard Windows controls under MSW, GTK+ widgets or Cocoa
|
||||||
|
views. Using it involves writing code specific to each platform, at the
|
||||||
|
very least for creating the native window, but possibly also to handle its
|
||||||
|
events, but this class takes care of all the generic parts.
|
||||||
|
|
||||||
|
@note Check whether @c wxHAS_NATIVE_WINDOW is defined before using this
|
||||||
|
class as it is not available under all platforms.
|
||||||
|
|
||||||
|
For example, to embed a native GTK+ "light switch" control in a wxWidgets
|
||||||
|
dialog you could do the following:
|
||||||
|
@code
|
||||||
|
#include <wx/nativewin.h>
|
||||||
|
|
||||||
|
wxNativeWindow* switch = new wxNativeWindow(parent, wxID_ANY, gtk_switch_new());
|
||||||
|
@endcode
|
||||||
|
and then use @c switch as usual, e.g. add it to a sizer to layout it
|
||||||
|
correctly. Of course, you will still have to use the native GTK+ functions
|
||||||
|
to handle its events and change or retrieve its state.
|
||||||
|
|
||||||
|
See the "native" page of the widgets sample for another example of using
|
||||||
|
it.
|
||||||
|
|
||||||
|
@since 3.1.0
|
||||||
|
|
||||||
|
@library{core}
|
||||||
|
@category{ctrl}
|
||||||
|
*/
|
||||||
|
class wxNativeWindow : public wxWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Default ctor, Create() must be called later to really create the window.
|
||||||
|
*/
|
||||||
|
wxNativeWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a window from an existing native window handle.
|
||||||
|
|
||||||
|
Notice that this ctor doesn't take the usual @c pos and @c size
|
||||||
|
parameters, they're taken from the window handle itself.
|
||||||
|
|
||||||
|
Use GetHandle() to check if the creation was successful, it will return
|
||||||
|
0 if the handle was invalid.
|
||||||
|
|
||||||
|
See Create() for the detailed parameters documentation.
|
||||||
|
*/
|
||||||
|
wxNativeWindow(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle)
|
||||||
|
|
||||||
|
/**
|
||||||
|
Really create the window after using the default ctor to create the C++
|
||||||
|
object.
|
||||||
|
|
||||||
|
@param parent A non-NULL parent window. For the platforms where the
|
||||||
|
parent is used for creating the native window (e.g. MSW), this must
|
||||||
|
be the wxWindow corresponding to the parent handle used when
|
||||||
|
creating the native window.
|
||||||
|
@param winid ID for the new window which will be used for the events
|
||||||
|
generated by it and can also be used to FindWindowById().
|
||||||
|
@param handle A valid native window handle, i.e. HWND under MSW.
|
||||||
|
@return @true if the creation was successful or @false if it failed,
|
||||||
|
typically because the supplied parameters are invalid.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle);
|
||||||
|
};
|
@@ -22,6 +22,7 @@ LIBS = @LIBS@
|
|||||||
LDFLAGS_GUI = @LDFLAGS_GUI@
|
LDFLAGS_GUI = @LDFLAGS_GUI@
|
||||||
CXX = @CXX@
|
CXX = @CXX@
|
||||||
CXXFLAGS = @CXXFLAGS@
|
CXXFLAGS = @CXXFLAGS@
|
||||||
|
OBJCXXFLAGS = @OBJCXXFLAGS@
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
|
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
|
||||||
@@ -49,6 +50,10 @@ WIDGETS_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
|
|||||||
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
||||||
-I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples $(CXXWARNINGS) \
|
-I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples $(CXXWARNINGS) \
|
||||||
$(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
|
$(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
|
||||||
|
WIDGETS_OBJCXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||||
|
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||||
|
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples \
|
||||||
|
$(CPPFLAGS) $(OBJCXXFLAGS)
|
||||||
WIDGETS_OBJECTS = \
|
WIDGETS_OBJECTS = \
|
||||||
widgets_activityindicator.o \
|
widgets_activityindicator.o \
|
||||||
widgets_bmpcombobox.o \
|
widgets_bmpcombobox.o \
|
||||||
@@ -68,6 +73,8 @@ WIDGETS_OBJECTS = \
|
|||||||
widgets_hyperlnk.o \
|
widgets_hyperlnk.o \
|
||||||
widgets_itemcontainer.o \
|
widgets_itemcontainer.o \
|
||||||
widgets_listbox.o \
|
widgets_listbox.o \
|
||||||
|
$(__NATIVE_OBJCPP_SRC_OBJECTS) \
|
||||||
|
widgets_native.o \
|
||||||
widgets_notebook.o \
|
widgets_notebook.o \
|
||||||
widgets_odcombobox.o \
|
widgets_odcombobox.o \
|
||||||
widgets_radiobox.o \
|
widgets_radiobox.o \
|
||||||
@@ -131,6 +138,8 @@ COND_PLATFORM_OS2_1___widgets___os2_emxbindcmd = $(NM) widgets$(EXEEXT) | if \
|
|||||||
@COND_TOOLKIT_OSX_IPHONE@ = $(__widgets_app_Contents_PkgInfo___depname)
|
@COND_TOOLKIT_OSX_IPHONE@ = $(__widgets_app_Contents_PkgInfo___depname)
|
||||||
@COND_TOOLKIT_COCOA@____widgets_BUNDLE_TGT_REF_DEP = \
|
@COND_TOOLKIT_COCOA@____widgets_BUNDLE_TGT_REF_DEP = \
|
||||||
@COND_TOOLKIT_COCOA@ $(__widgets_app_Contents_PkgInfo___depname)
|
@COND_TOOLKIT_COCOA@ $(__widgets_app_Contents_PkgInfo___depname)
|
||||||
|
@COND_TOOLKIT_OSX_COCOA_WXUNIV_0@__NATIVE_OBJCPP_SRC_OBJECTS \
|
||||||
|
@COND_TOOLKIT_OSX_COCOA_WXUNIV_0@ = widgets_native_wrapper.o
|
||||||
COND_MONOLITHIC_0___WXLIB_ADV_p = \
|
COND_MONOLITHIC_0___WXLIB_ADV_p = \
|
||||||
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv-$(WX_RELEASE)$(HOST_SUFFIX)
|
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||||
@COND_MONOLITHIC_0@__WXLIB_ADV_p = $(COND_MONOLITHIC_0___WXLIB_ADV_p)
|
@COND_MONOLITHIC_0@__WXLIB_ADV_p = $(COND_MONOLITHIC_0___WXLIB_ADV_p)
|
||||||
@@ -265,6 +274,12 @@ widgets_itemcontainer.o: $(srcdir)/itemcontainer.cpp
|
|||||||
widgets_listbox.o: $(srcdir)/listbox.cpp
|
widgets_listbox.o: $(srcdir)/listbox.cpp
|
||||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/listbox.cpp
|
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/listbox.cpp
|
||||||
|
|
||||||
|
widgets_native_wrapper.o: $(srcdir)/native_wrapper.mm
|
||||||
|
$(CXXC) -c -o $@ $(WIDGETS_OBJCXXFLAGS) $(srcdir)/native_wrapper.mm
|
||||||
|
|
||||||
|
widgets_native.o: $(srcdir)/native.cpp
|
||||||
|
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/native.cpp
|
||||||
|
|
||||||
widgets_notebook.o: $(srcdir)/notebook.cpp
|
widgets_notebook.o: $(srcdir)/notebook.cpp
|
||||||
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/notebook.cpp
|
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/notebook.cpp
|
||||||
|
|
||||||
|
81
samples/widgets/icons/native.xpm
Normal file
81
samples/widgets/icons/native.xpm
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/* XPM */
|
||||||
|
static const char *const native_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"16 16 59 1 ",
|
||||||
|
" c #E40000",
|
||||||
|
". c #E50000",
|
||||||
|
"X c #E70000",
|
||||||
|
"o c #EA0000",
|
||||||
|
"O c #EB0000",
|
||||||
|
"+ c #ED0000",
|
||||||
|
"@ c #F10000",
|
||||||
|
"# c #F20000",
|
||||||
|
"$ c #F60000",
|
||||||
|
"% c #FA0000",
|
||||||
|
"& c #FB0000",
|
||||||
|
"* c #FC0000",
|
||||||
|
"= c #FC0001",
|
||||||
|
"- c #FE0002",
|
||||||
|
"; c #FF2C35",
|
||||||
|
": c #FF4F4F",
|
||||||
|
"> c #75ED00",
|
||||||
|
", c #76ED00",
|
||||||
|
"< c #76EE00",
|
||||||
|
"1 c #76F000",
|
||||||
|
"2 c #77F100",
|
||||||
|
"3 c #79F600",
|
||||||
|
"4 c #7AF700",
|
||||||
|
"5 c #7BF700",
|
||||||
|
"6 c #7AF900",
|
||||||
|
"7 c #7BF900",
|
||||||
|
"8 c #7CFB00",
|
||||||
|
"9 c #7DFC00",
|
||||||
|
"0 c #7EFE00",
|
||||||
|
"q c #81FF04",
|
||||||
|
"w c #82FF07",
|
||||||
|
"e c #8AFF17",
|
||||||
|
"r c #8CFF1B",
|
||||||
|
"t c #8CFF1D",
|
||||||
|
"y c #A7FF15",
|
||||||
|
"u c #92FF26",
|
||||||
|
"i c #92FF27",
|
||||||
|
"p c #93FF29",
|
||||||
|
"a c #9AFF37",
|
||||||
|
"s c #9CFF3B",
|
||||||
|
"d c #A1FF46",
|
||||||
|
"f c #A1FF4D",
|
||||||
|
"g c #AAFF56",
|
||||||
|
"h c #A4FF5C",
|
||||||
|
"j c #A2FF68",
|
||||||
|
"k c #B0FF62",
|
||||||
|
"l c #B6FF71",
|
||||||
|
"z c #B8FF73",
|
||||||
|
"x c #C5FF67",
|
||||||
|
"c c #FFA6A6",
|
||||||
|
"v c #FFB4B4",
|
||||||
|
"b c #C0FF83",
|
||||||
|
"n c #CBFF98",
|
||||||
|
"m c #E2FFB3",
|
||||||
|
"M c #B5D9FF",
|
||||||
|
"N c #D2E6FF",
|
||||||
|
"B c #D2E7FF",
|
||||||
|
"V c #DBECFF",
|
||||||
|
"C c None",
|
||||||
|
/* pixels */
|
||||||
|
"CCCCCCVVMNCCCCCC",
|
||||||
|
"CCCBBBBBBBBBCCCC",
|
||||||
|
"CNNNNNNNNNNNNNCC",
|
||||||
|
"C-MMMMMMMMMMMMVC",
|
||||||
|
"CXoMMMMMMMMMMjsC",
|
||||||
|
"Co ;MMMMMh9>>qC",
|
||||||
|
"C+X X%Mfq7>>>>iC",
|
||||||
|
"C# y>57>>>>dC",
|
||||||
|
"C$ Xy6pe>>>>gC",
|
||||||
|
"C% X$%x3>3i2>>kC",
|
||||||
|
"C:%%X y>>>>t7>lC",
|
||||||
|
"Cco y>>>>>9tbC",
|
||||||
|
"CCv+ y>>>>>2gCC",
|
||||||
|
"CCCC# y>>>9zCCCC",
|
||||||
|
"CCCCC%y>anCCCCCC",
|
||||||
|
"CCCCCCmCCCCCCCCC"
|
||||||
|
};
|
@@ -54,6 +54,7 @@ WIDGETS_OBJECTS = \
|
|||||||
$(OBJS)\widgets_hyperlnk.obj \
|
$(OBJS)\widgets_hyperlnk.obj \
|
||||||
$(OBJS)\widgets_itemcontainer.obj \
|
$(OBJS)\widgets_itemcontainer.obj \
|
||||||
$(OBJS)\widgets_listbox.obj \
|
$(OBJS)\widgets_listbox.obj \
|
||||||
|
$(OBJS)\widgets_native.obj \
|
||||||
$(OBJS)\widgets_notebook.obj \
|
$(OBJS)\widgets_notebook.obj \
|
||||||
$(OBJS)\widgets_odcombobox.obj \
|
$(OBJS)\widgets_odcombobox.obj \
|
||||||
$(OBJS)\widgets_radiobox.obj \
|
$(OBJS)\widgets_radiobox.obj \
|
||||||
@@ -318,6 +319,9 @@ $(OBJS)\widgets_itemcontainer.obj: .\itemcontainer.cpp
|
|||||||
$(OBJS)\widgets_listbox.obj: .\listbox.cpp
|
$(OBJS)\widgets_listbox.obj: .\listbox.cpp
|
||||||
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\listbox.cpp
|
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\listbox.cpp
|
||||||
|
|
||||||
|
$(OBJS)\widgets_native.obj: .\native.cpp
|
||||||
|
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\native.cpp
|
||||||
|
|
||||||
$(OBJS)\widgets_notebook.obj: .\notebook.cpp
|
$(OBJS)\widgets_notebook.obj: .\notebook.cpp
|
||||||
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\notebook.cpp
|
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\notebook.cpp
|
||||||
|
|
||||||
|
@@ -47,6 +47,7 @@ WIDGETS_OBJECTS = \
|
|||||||
$(OBJS)\widgets_hyperlnk.o \
|
$(OBJS)\widgets_hyperlnk.o \
|
||||||
$(OBJS)\widgets_itemcontainer.o \
|
$(OBJS)\widgets_itemcontainer.o \
|
||||||
$(OBJS)\widgets_listbox.o \
|
$(OBJS)\widgets_listbox.o \
|
||||||
|
$(OBJS)\widgets_native.o \
|
||||||
$(OBJS)\widgets_notebook.o \
|
$(OBJS)\widgets_notebook.o \
|
||||||
$(OBJS)\widgets_odcombobox.o \
|
$(OBJS)\widgets_odcombobox.o \
|
||||||
$(OBJS)\widgets_radiobox.o \
|
$(OBJS)\widgets_radiobox.o \
|
||||||
@@ -307,6 +308,9 @@ $(OBJS)\widgets_itemcontainer.o: ./itemcontainer.cpp
|
|||||||
$(OBJS)\widgets_listbox.o: ./listbox.cpp
|
$(OBJS)\widgets_listbox.o: ./listbox.cpp
|
||||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
|
$(OBJS)\widgets_native.o: ./native.cpp
|
||||||
|
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
$(OBJS)\widgets_notebook.o: ./notebook.cpp
|
$(OBJS)\widgets_notebook.o: ./notebook.cpp
|
||||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
|
@@ -71,6 +71,7 @@ WIDGETS_OBJECTS = \
|
|||||||
widgets_hyperlnk.o \
|
widgets_hyperlnk.o \
|
||||||
widgets_itemcontainer.o \
|
widgets_itemcontainer.o \
|
||||||
widgets_listbox.o \
|
widgets_listbox.o \
|
||||||
|
widgets_native.o \
|
||||||
widgets_notebook.o \
|
widgets_notebook.o \
|
||||||
widgets_odcombobox.o \
|
widgets_odcombobox.o \
|
||||||
widgets_radiobox.o \
|
widgets_radiobox.o \
|
||||||
@@ -173,6 +174,9 @@ widgets_itemcontainer.o: ./itemcontainer.cpp
|
|||||||
widgets_listbox.o: ./listbox.cpp
|
widgets_listbox.o: ./listbox.cpp
|
||||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
|
widgets_native.o: ./native.cpp
|
||||||
|
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
widgets_notebook.o: ./notebook.cpp
|
widgets_notebook.o: ./notebook.cpp
|
||||||
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
|
@@ -49,6 +49,7 @@ WIDGETS_OBJECTS = \
|
|||||||
$(OBJS)\widgets_hyperlnk.obj \
|
$(OBJS)\widgets_hyperlnk.obj \
|
||||||
$(OBJS)\widgets_itemcontainer.obj \
|
$(OBJS)\widgets_itemcontainer.obj \
|
||||||
$(OBJS)\widgets_listbox.obj \
|
$(OBJS)\widgets_listbox.obj \
|
||||||
|
$(OBJS)\widgets_native.obj \
|
||||||
$(OBJS)\widgets_notebook.obj \
|
$(OBJS)\widgets_notebook.obj \
|
||||||
$(OBJS)\widgets_odcombobox.obj \
|
$(OBJS)\widgets_odcombobox.obj \
|
||||||
$(OBJS)\widgets_radiobox.obj \
|
$(OBJS)\widgets_radiobox.obj \
|
||||||
@@ -441,6 +442,9 @@ $(OBJS)\widgets_itemcontainer.obj: .\itemcontainer.cpp
|
|||||||
$(OBJS)\widgets_listbox.obj: .\listbox.cpp
|
$(OBJS)\widgets_listbox.obj: .\listbox.cpp
|
||||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\listbox.cpp
|
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\listbox.cpp
|
||||||
|
|
||||||
|
$(OBJS)\widgets_native.obj: .\native.cpp
|
||||||
|
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\native.cpp
|
||||||
|
|
||||||
$(OBJS)\widgets_notebook.obj: .\notebook.cpp
|
$(OBJS)\widgets_notebook.obj: .\notebook.cpp
|
||||||
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\notebook.cpp
|
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\notebook.cpp
|
||||||
|
|
||||||
|
281
samples/widgets/native.cpp
Normal file
281
samples/widgets/native.cpp
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Program: wxWidgets Widgets Sample
|
||||||
|
// Name: native.cpp
|
||||||
|
// Purpose: Part of the widgets sample showing native control integration
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Created: 2015-07-30
|
||||||
|
// Copyright: (c) 2015 Vadim Zeitlin
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// this file is included from native.mm which ensures that it is compiled as
|
||||||
|
// Objective C++, but it's also still compiled by the makefiles directly as C++
|
||||||
|
// source because we can't easily exclude it, so check for this and only
|
||||||
|
// compile the rest of this file once
|
||||||
|
#if !defined(__WXOSX_COCOA__) || defined(__OBJC__)
|
||||||
|
|
||||||
|
// for all others, include the necessary headers
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/app.h"
|
||||||
|
#include "wx/checkbox.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
#include "wx/menu.h"
|
||||||
|
#include "wx/sizer.h"
|
||||||
|
#endif // !WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/nativewin.h"
|
||||||
|
|
||||||
|
#ifdef wxHAS_NATIVE_WINDOW
|
||||||
|
|
||||||
|
#include "widgets.h"
|
||||||
|
|
||||||
|
#include "icons/native.xpm"
|
||||||
|
|
||||||
|
// Helper to create a menu to be shown in our button.
|
||||||
|
//
|
||||||
|
// The menu is supposed to be initially empty, don't call this more than once
|
||||||
|
// for the same object.
|
||||||
|
void BuildTestMenu(wxMenu *menu)
|
||||||
|
{
|
||||||
|
menu->Append(wxID_NEW, "Do it with a new file");
|
||||||
|
menu->Append(wxID_OPEN, "Do it with an existing file");
|
||||||
|
menu->AppendSeparator();
|
||||||
|
menu->Append(wxID_ABOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the native control in a -- necessarily -- platform-specific way.
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
|
||||||
|
#include "wx/msw/wrapcctl.h" // for BS_SPLITBUTTON
|
||||||
|
|
||||||
|
class NativeWindow : public wxNativeWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NativeWindow(wxWindow* parent)
|
||||||
|
: wxNativeWindow()
|
||||||
|
{
|
||||||
|
// When creating the native window, we must specify the valid parent
|
||||||
|
// and while we don't have to specify any position if it's going to be
|
||||||
|
// laid out by sizers, we do need the size.
|
||||||
|
const wxSize size = FromDIP(wxSize(140, 30));
|
||||||
|
|
||||||
|
HWND hwnd = ::CreateWindow
|
||||||
|
(
|
||||||
|
TEXT("BUTTON"),
|
||||||
|
TEXT("Press me to do it"),
|
||||||
|
WS_CHILD | WS_VISIBLE | BS_SPLITBUTTON,
|
||||||
|
0, 0, size.x, size.y,
|
||||||
|
(HWND)parent->GetHWND(), 0, NULL, NULL
|
||||||
|
);
|
||||||
|
if ( !hwnd )
|
||||||
|
{
|
||||||
|
wxLogError("Creating split button failed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)Create(parent, wxID_ANY, hwnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Split buttons under MSW don't show the menu on their own, unlike their
|
||||||
|
// equivalents under the other platforms, so do it manually here. This also
|
||||||
|
// shows how to handle a native event in MSW (for the specific case of
|
||||||
|
// WM_NOTIFY, more generally MSWHandleMessage() could be overridden).
|
||||||
|
virtual bool
|
||||||
|
MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE
|
||||||
|
{
|
||||||
|
const NMHDR* hdr = reinterpret_cast<NMHDR*>(lParam);
|
||||||
|
if ( hdr->code != BCN_DROPDOWN )
|
||||||
|
return wxNativeWindow::MSWOnNotify(idCtrl, lParam, result);
|
||||||
|
|
||||||
|
const NMBCDROPDOWN* dd = reinterpret_cast<NMBCDROPDOWN*>(lParam);
|
||||||
|
|
||||||
|
wxMenu menu;
|
||||||
|
BuildTestMenu(&menu);
|
||||||
|
PopupMenu(&menu, wxPoint(dd->rcButton.right, dd->rcButton.bottom));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif defined(__WXGTK__)
|
||||||
|
|
||||||
|
class NativeWindow : public wxNativeWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NativeWindow(wxWindow* parent)
|
||||||
|
: wxNativeWindow()
|
||||||
|
{
|
||||||
|
#if GTK_CHECK_VERSION(3,6,0)
|
||||||
|
BuildTestMenu(&m_menu);
|
||||||
|
|
||||||
|
GtkWidget* const widget = gtk_menu_button_new();
|
||||||
|
gtk_menu_button_set_popup(GTK_MENU_BUTTON(widget), m_menu.m_menu);
|
||||||
|
#else // GTK+ < 3.6
|
||||||
|
// Menu buttons are only available since GTK+ 3.6, so use something
|
||||||
|
// even simpler for earlier versions (including GTK+ 2) just as a
|
||||||
|
// placeholder.
|
||||||
|
GtkWidget* const widget = gtk_label_new("");
|
||||||
|
gtk_label_set_markup
|
||||||
|
(
|
||||||
|
GTK_LABEL(widget),
|
||||||
|
"<b>Sorry</b>, but your GTK+ is too old to have menu buttons."
|
||||||
|
);
|
||||||
|
#endif // GTK+ 3.6/earlier
|
||||||
|
|
||||||
|
(void)Create(parent, wxID_ANY, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxMenu m_menu;
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif defined(__WXOSX_COCOA__)
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
class NativeWindow : public wxNativeWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NativeWindow(wxWindow* parent)
|
||||||
|
: wxNativeWindow()
|
||||||
|
{
|
||||||
|
// Neither the position nor the size really matter: the former because
|
||||||
|
// the window will be positioned by the sizers, the latter because its
|
||||||
|
// "fitting" size will be used as the best size by default.
|
||||||
|
NSPopUpButton* const v = [[NSPopUpButton alloc]
|
||||||
|
initWithFrame:NSMakeRect(0, 0, 0, 0)
|
||||||
|
pullsDown:YES];
|
||||||
|
|
||||||
|
wxMenu menu;
|
||||||
|
BuildTestMenu(&menu);
|
||||||
|
[v setMenu:(NSMenu*)menu.GetHMenu()];
|
||||||
|
|
||||||
|
// In a pull down (but not pop up) buttons, items start with 1 and the
|
||||||
|
// 0-th one is used as title.
|
||||||
|
[v insertItemWithTitle:@"Press me to do it" atIndex:0];
|
||||||
|
|
||||||
|
// By default the control would disable the button title because it
|
||||||
|
// doesn't appear in the list of the menu items, prevent this from
|
||||||
|
// happening.
|
||||||
|
[v setAutoenablesItems:NO];
|
||||||
|
|
||||||
|
(void)Create(parent, wxID_ANY, v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#else // some other platform
|
||||||
|
|
||||||
|
// The sample should be updated if wxNativeCtrl is implemented for some new
|
||||||
|
// platform in wx/nativectrl.h.
|
||||||
|
#error "Native control creation not implemented for this platform"
|
||||||
|
|
||||||
|
#endif // platforms
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// NativeWidgetsPage
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class NativeWidgetsPage : public WidgetsPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NativeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
|
||||||
|
|
||||||
|
virtual wxWindow *GetWidget() const wxOVERRIDE { return m_nativeWindow; }
|
||||||
|
virtual void RecreateWidget() wxOVERRIDE;
|
||||||
|
|
||||||
|
// lazy creation of the content
|
||||||
|
virtual void CreateContent() wxOVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnCheckExpand(wxCommandEvent& event);
|
||||||
|
|
||||||
|
wxCheckBox* m_chkExpand;
|
||||||
|
|
||||||
|
wxNativeWindow* m_nativeWindow;
|
||||||
|
wxSizer* m_sizerCtrl;
|
||||||
|
|
||||||
|
DECLARE_WIDGETS_PAGE(NativeWidgetsPage)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
IMPLEMENT_WIDGETS_PAGE(NativeWidgetsPage, wxS("Native"), NATIVE_CTRLS);
|
||||||
|
|
||||||
|
NativeWidgetsPage::NativeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
|
||||||
|
: WidgetsPage(book, imaglist, native_xpm)
|
||||||
|
{
|
||||||
|
m_nativeWindow = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWidgetsPage::CreateContent()
|
||||||
|
{
|
||||||
|
wxSizer* const sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
wxSizer* const sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||||
|
m_chkExpand = new wxCheckBox(this, wxID_ANY, "&Expand to all available size");
|
||||||
|
m_chkExpand->Bind(wxEVT_CHECKBOX, &NativeWidgetsPage::OnCheckExpand, this);
|
||||||
|
sizerLeft->Add(m_chkExpand, wxSizerFlags().Border());
|
||||||
|
sizerTop->Add(sizerLeft);
|
||||||
|
|
||||||
|
m_sizerCtrl = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
RecreateWidget();
|
||||||
|
|
||||||
|
sizerTop->Add(m_sizerCtrl, wxSizerFlags(1).Expand());
|
||||||
|
SetSizer(sizerTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// operations
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void NativeWidgetsPage::RecreateWidget()
|
||||||
|
{
|
||||||
|
delete m_nativeWindow;
|
||||||
|
m_nativeWindow = new NativeWindow(this);
|
||||||
|
|
||||||
|
m_sizerCtrl->Clear();
|
||||||
|
if ( m_chkExpand->IsChecked() )
|
||||||
|
{
|
||||||
|
m_sizerCtrl->Add(m_nativeWindow, wxSizerFlags(1).Expand().Border());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_sizerCtrl->AddStretchSpacer();
|
||||||
|
m_sizerCtrl->Add(m_nativeWindow, wxSizerFlags().Centre());
|
||||||
|
m_sizerCtrl->AddStretchSpacer();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sizerCtrl->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// event handlers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void NativeWidgetsPage::OnCheckExpand(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
RecreateWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxHAS_NATIVE_WINDOW
|
||||||
|
|
||||||
|
#endif // !OSX/Cocoa compilation as Objective C source file
|
15
samples/widgets/native_wrapper.mm
Normal file
15
samples/widgets/native_wrapper.mm
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Program: wxWidgets Widgets Sample
|
||||||
|
// Name: native_wrapper.mm
|
||||||
|
// Purpose: Helper to compile native.cpp as Objective C++ code
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Created: 2015-08-02
|
||||||
|
// Copyright: (c) 2015 Vadim Zeitlin
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// As explained in widgets.bkl, we need to compile native.cpp using Objective
|
||||||
|
// C++ compiler, but there is no simple way to do it at the build system level,
|
||||||
|
// so we just include that file from this file, which has .mm extension
|
||||||
|
// ensuring that the correct compiler is used.
|
||||||
|
#include "native.cpp"
|
@@ -3,6 +3,23 @@
|
|||||||
|
|
||||||
<include file="../../build/bakefiles/common_samples.bkl"/>
|
<include file="../../build/bakefiles/common_samples.bkl"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The source file using native controls uses Cocoa under OS X, so it must
|
||||||
|
be compiled as Objective C++ which means it must have .mm extension.
|
||||||
|
But this would make it uncompilable under the other platforms and we
|
||||||
|
don't want to have two files with identical contents. Hence this hack:
|
||||||
|
we have native.mm which just includes native.cpp under OS X, while
|
||||||
|
elsewhere we just compile native.cpp directly.
|
||||||
|
-->
|
||||||
|
<set var="NATIVE_OBJCPP_SRC">
|
||||||
|
<if cond="OUT_OF_TREE_MAKEFILES=='1'">
|
||||||
|
<!-- We can't determine if we're using Cocoa or not, assume we don't -->
|
||||||
|
</if>
|
||||||
|
<if cond="TOOLKIT=='OSX_COCOA' and WXUNIV=='0'">
|
||||||
|
native_wrapper.mm
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
|
||||||
<exe id="widgets" template="wx_sample" template_append="wx_append">
|
<exe id="widgets" template="wx_sample" template_append="wx_append">
|
||||||
<sources>
|
<sources>
|
||||||
activityindicator.cpp
|
activityindicator.cpp
|
||||||
@@ -23,6 +40,8 @@
|
|||||||
hyperlnk.cpp
|
hyperlnk.cpp
|
||||||
itemcontainer.cpp
|
itemcontainer.cpp
|
||||||
listbox.cpp
|
listbox.cpp
|
||||||
|
$(NATIVE_OBJCPP_SRC)
|
||||||
|
native.cpp
|
||||||
notebook.cpp
|
notebook.cpp
|
||||||
odcombobox.cpp
|
odcombobox.cpp
|
||||||
radiobox.cpp
|
radiobox.cpp
|
||||||
|
@@ -337,6 +337,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\listbox.cpp">
|
RelativePath=".\listbox.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\native.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\notebook.cpp">
|
RelativePath=".\notebook.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -878,6 +878,10 @@
|
|||||||
RelativePath=".\listbox.cpp"
|
RelativePath=".\listbox.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\native.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\notebook.cpp"
|
RelativePath=".\notebook.cpp"
|
||||||
>
|
>
|
||||||
|
@@ -850,6 +850,10 @@
|
|||||||
RelativePath=".\listbox.cpp"
|
RelativePath=".\listbox.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\native.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\notebook.cpp"
|
RelativePath=".\notebook.cpp"
|
||||||
>
|
>
|
||||||
|
@@ -38,6 +38,45 @@
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxNativeWindow
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool
|
||||||
|
wxNativeWindow::Create(wxWindow* parent,
|
||||||
|
wxWindowID winid,
|
||||||
|
wxNativeWindowHandle widget)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( widget, false, wxS("Invalid null GtkWidget") );
|
||||||
|
|
||||||
|
// Standard wxGTK controls use PreCreation() but we never have any size
|
||||||
|
// specified at this stage, so don't bother with it.
|
||||||
|
if ( !CreateBase(parent, winid) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Add a reference to the widget to match g_object_unref() in wxWindow dtor
|
||||||
|
// (and by using the "_sink" version we avoid memory leaks when we're
|
||||||
|
// passed a newly allocated widget, as is typically the case).
|
||||||
|
m_widget = widget;
|
||||||
|
g_object_ref_sink(m_widget);
|
||||||
|
|
||||||
|
parent->DoAddChild(this);
|
||||||
|
|
||||||
|
PostCreation();
|
||||||
|
|
||||||
|
// Ensure that the best (and minimal) size is set to fully display the
|
||||||
|
// widget.
|
||||||
|
GtkRequisition req;
|
||||||
|
gtk_widget_size_request(widget, &req);
|
||||||
|
SetInitialSize(wxSize(req.width, req.height));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxNativeContainerWindow
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// TODO: we probably need equivalent code for other GDK platforms
|
// TODO: we probably need equivalent code for other GDK platforms
|
||||||
#ifdef GDK_WINDOWING_X11
|
#ifdef GDK_WINDOWING_X11
|
||||||
|
|
||||||
|
@@ -32,6 +32,57 @@
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxNativeWindow
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool
|
||||||
|
wxNativeWindow::Create(wxWindow* parent,
|
||||||
|
wxWindowID winid,
|
||||||
|
wxNativeWindowHandle hwnd)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( hwnd, false, wxS("Invalid null HWND") );
|
||||||
|
wxCHECK_MSG( parent, false, wxS("Must have a valid parent") );
|
||||||
|
wxASSERT_MSG( ::GetParent(hwnd) == GetHwndOf(parent),
|
||||||
|
wxS("The native window has incorrect parent") );
|
||||||
|
|
||||||
|
const wxRect r = wxRectFromRECT(wxGetWindowRect(hwnd));
|
||||||
|
|
||||||
|
// Skip wxWindow::Create() which would try to create a new HWND, we don't
|
||||||
|
// want this as we already have one.
|
||||||
|
if ( !CreateBase(parent, winid,
|
||||||
|
r.GetPosition(), r.GetSize(),
|
||||||
|
0, wxDefaultValidator, wxS("nativewindow")) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
parent->AddChild(this);
|
||||||
|
|
||||||
|
SubclassWin(hwnd);
|
||||||
|
|
||||||
|
if ( winid == wxID_ANY )
|
||||||
|
{
|
||||||
|
// We allocated a new ID to the control, use it at Windows level as
|
||||||
|
// well because we assume that our and MSW IDs are the same in many
|
||||||
|
// places and it seems prudent to avoid breaking this assumption.
|
||||||
|
SetId(GetId());
|
||||||
|
}
|
||||||
|
else // We used a fixed ID.
|
||||||
|
{
|
||||||
|
// For the same reason as above, check that it's the same as the one
|
||||||
|
// used by the native HWND.
|
||||||
|
wxASSERT_MSG( ::GetWindowLong(hwnd, GWL_ID) == winid,
|
||||||
|
wxS("Mismatch between wx and native IDs") );
|
||||||
|
}
|
||||||
|
|
||||||
|
InheritAttributes();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxNativeContainerWindow
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle hwnd)
|
bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle hwnd)
|
||||||
{
|
{
|
||||||
if ( !::IsWindow(hwnd) )
|
if ( !::IsWindow(hwnd) )
|
||||||
|
68
src/osx/cocoa/nativewin.mm
Normal file
68
src/osx/cocoa/nativewin.mm
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: src/osx/cocoa/nativewin.mm
|
||||||
|
// Purpose: wxNativeWindow implementation for wxOSX/Cocoa
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Created: 2015-08-01
|
||||||
|
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/nativewin.h"
|
||||||
|
|
||||||
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
bool
|
||||||
|
wxNativeWindow::Create(wxWindow* parent,
|
||||||
|
wxWindowID winid,
|
||||||
|
wxNativeWindowHandle view)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( view, false, wxS("NULL NSView pointer") );
|
||||||
|
|
||||||
|
DontCreatePeer();
|
||||||
|
|
||||||
|
if ( !wxWindow::Create(parent, winid) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// We have to ensure that the internal label is synchronized with the label
|
||||||
|
// at the native window, otherwise calling SetLabel() later might not work
|
||||||
|
// and, even worse, the native label would be reset to match the (empty) wx
|
||||||
|
// label by SetPeer().
|
||||||
|
//
|
||||||
|
// Notice that the selectors tested here are the same ones currently used
|
||||||
|
// by wxWidgetCocoaImpl::SetLabel() and this code would need to be updated
|
||||||
|
// if that method is.
|
||||||
|
//
|
||||||
|
// Also note the casts to "id" needed to suppress the "NSView may not
|
||||||
|
// respond to selector" warnings: we do test that it responds to them, so
|
||||||
|
// these warnings are not useful here.
|
||||||
|
if ( [view respondsToSelector:@selector(title)] )
|
||||||
|
m_label = wxCFStringRef::AsString([(id)view title]);
|
||||||
|
else if ( [view respondsToSelector:@selector(stringValue)] )
|
||||||
|
m_label = wxCFStringRef::AsString([(id)view stringValue]);
|
||||||
|
|
||||||
|
SetPeer(new wxWidgetCocoaImpl(this, view));
|
||||||
|
|
||||||
|
// It doesn't seem necessary to use MacPostControlCreate() here as we never
|
||||||
|
// change the native control geometry here.
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
Reference in New Issue
Block a user