From 426d19f1391a685de14a71b9fc4339bb929e441a Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 24 Sep 2009 12:36:34 +0000 Subject: [PATCH] Applied patch #9058 (add Hildon 2.0 support) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 129 +++++++++++++++++++++++++++++++++--- configure.in | 24 ++++++- include/wx/gtk/app.h | 14 ++-- include/wx/gtk/frame.h | 4 +- include/wx/gtk/menu.h | 2 +- include/wx/notifmsg.h | 2 +- setup.h.in | 4 ++ setup.h_vms | 4 ++ src/generic/notifmsgg.cpp | 8 ++- src/gtk/app.cpp | 20 ++++-- src/gtk/checklst.cpp | 5 ++ src/gtk/colordlg.cpp | 50 ++++++++++++-- src/gtk/frame.cpp | 16 +++-- src/gtk/hildon/notifmsg.cpp | 12 +++- src/gtk/menu.cpp | 10 +-- src/gtk/msgdlg.cpp | 16 +++-- src/gtk/toplevel.cpp | 31 +++++++-- src/unix/displayx11.cpp | 4 +- 18 files changed, 296 insertions(+), 59 deletions(-) diff --git a/configure b/configure index 535c97c026..5ad619a977 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 61944 2009-09-16 12:06:02Z PJC . +# From configure.in Id: configure.in 61971 2009-09-19 08:51:11Z JMS . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.1. # @@ -709,6 +709,8 @@ GNOMEVFS_CFLAGS GNOMEVFS_LIBS HILDON_CFLAGS HILDON_LIBS +HILDON2_CFLAGS +HILDON2_LIBS PYTHON COND_PYTHON CAIRO_CFLAGS @@ -1073,6 +1075,8 @@ GNOMEVFS_CFLAGS GNOMEVFS_LIBS HILDON_CFLAGS HILDON_LIBS +HILDON2_CFLAGS +HILDON2_LIBS CAIRO_CFLAGS CAIRO_LIBS GST_CFLAGS @@ -1925,7 +1929,7 @@ Optional Packages: --without-gtkprint don't use GTK printing support --without-gnomeprint don't use GNOME printing libraries --with-gnomevfs use GNOME VFS for associating MIME types - --with-hildon use Hildon framework for Nokia 770 + --with-hildon use Hildon framework for Nokia 770/800/810 --with-opengl use OpenGL (or Mesa) --with-dmalloc use dmalloc library (http://dmalloc.com/) --with-sdl use SDL for audio on Unix @@ -1986,6 +1990,10 @@ Some influential environment variables: HILDON_CFLAGS C compiler flags for HILDON, overriding pkg-config HILDON_LIBS linker flags for HILDON, overriding pkg-config + HILDON2_CFLAGS + C compiler flags for HILDON2, overriding pkg-config + HILDON2_LIBS + linker flags for HILDON2, overriding pkg-config CAIRO_CFLAGS C compiler flags for CAIRO, overriding pkg-config CAIRO_LIBS linker flags for CAIRO, overriding pkg-config @@ -2917,6 +2925,7 @@ DEFAULT_wxUSE_STD_STRING=$DEFAULT_STD_FLAG DEFAULT_wxUSE_DMALLOC=no DEFAULT_wxUSE_LIBGNOMEVFS=no DEFAULT_wxUSE_LIBHILDON=no +DEFAULT_wxUSE_LIBHILDON2=no DEFAULT_wxUSE_LIBMSPACK=no DEFAULT_wxUSE_LIBSDL=no @@ -43252,6 +43261,7 @@ fi { echo "$as_me:$LINENO: WARNING: libhildon_lgpl not found" >&5 echo "$as_me: WARNING: libhildon_lgpl not found" >&2;} wxUSE_LIBHILDON="no" + ac_hildon_lgpl=0 elif test $pkg_failed = untried; then @@ -43259,6 +43269,7 @@ elif test $pkg_failed = untried; then { echo "$as_me:$LINENO: WARNING: libhildon_lgpl not found" >&5 echo "$as_me: WARNING: libhildon_lgpl not found" >&2;} wxUSE_LIBHILDON="no" + ac_hildon_lgpl=0 else @@ -43274,8 +43285,99 @@ echo "${ECHO_T}yes" >&6; } #define wxUSE_LIBHILDON 1 _ACEOF + ac_hildon_lgpl=1 fi + + if test "$ac_hildon_lgpl" = 0 ; then + +pkg_failed=no +{ echo "$as_me:$LINENO: checking for HILDON2" >&5 +echo $ECHO_N "checking for HILDON2... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$HILDON2_CFLAGS"; then + pkg_cv_HILDON2_CFLAGS="$HILDON2_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"hildon-1 >= 1.99\"") >&5 + ($PKG_CONFIG --exists --print-errors "hildon-1 >= 1.99") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_HILDON2_CFLAGS=`$PKG_CONFIG --cflags "hildon-1 >= 1.99" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$HILDON2_LIBS"; then + pkg_cv_HILDON2_LIBS="$HILDON2_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"hildon-1 >= 1.99\"") >&5 + ($PKG_CONFIG --exists --print-errors "hildon-1 >= 1.99") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_HILDON2_LIBS=`$PKG_CONFIG --libs "hildon-1 >= 1.99" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + HILDON2_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "hildon-1 >= 1.99"` + else + HILDON2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "hildon-1 >= 1.99"` + fi + # Put the nasty error message in config.log where it belongs + echo "$HILDON2_PKG_ERRORS" >&5 + + + { echo "$as_me:$LINENO: WARNING: libhildon_1 not found" >&5 +echo "$as_me: WARNING: libhildon_1 not found" >&2;} + wxUSE_LIBHILDON2="no" + + +elif test $pkg_failed = untried; then + + { echo "$as_me:$LINENO: WARNING: libhildon_1 not found" >&5 +echo "$as_me: WARNING: libhildon_1 not found" >&2;} + wxUSE_LIBHILDON2="no" + + +else + HILDON2_CFLAGS=$pkg_cv_HILDON2_CFLAGS + HILDON2_LIBS=$pkg_cv_HILDON2_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + + EXTRALIBS_HILDON="$HILDON2_LIBS" + CFLAGS="$CFLAGS $HILDON2_CFLAGS" + CXXFLAGS="$CXXFLAGS $HILDON2_CFLAGS" + cat >>confdefs.h <<\_ACEOF +#define wxUSE_LIBHILDON2 1 +_ACEOF + + +fi + fi fi fi @@ -47457,6 +47559,9 @@ case "$TOOLKIT" in if test "$wxUSE_LIBHILDON" = "yes"; then TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon" fi + if test "$wxUSE_LIBHILDON2" = "yes"; then + TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon" + fi if test "$TOOLKIT_EXTRA" != ""; then TOOLKIT_DESC="$TOOLKIT_DESC with support for `echo $TOOLKIT_EXTRA | tr -s ' '`" @@ -51885,10 +51990,10 @@ GNOMEVFS_CFLAGS!$GNOMEVFS_CFLAGS$ac_delim GNOMEVFS_LIBS!$GNOMEVFS_LIBS$ac_delim HILDON_CFLAGS!$HILDON_CFLAGS$ac_delim HILDON_LIBS!$HILDON_LIBS$ac_delim +HILDON2_CFLAGS!$HILDON2_CFLAGS$ac_delim +HILDON2_LIBS!$HILDON2_LIBS$ac_delim PYTHON!$PYTHON$ac_delim COND_PYTHON!$COND_PYTHON$ac_delim -CAIRO_CFLAGS!$CAIRO_CFLAGS$ac_delim -CAIRO_LIBS!$CAIRO_LIBS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -51930,6 +52035,8 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +CAIRO_CFLAGS!$CAIRO_CFLAGS$ac_delim +CAIRO_LIBS!$CAIRO_LIBS$ac_delim GST_CFLAGS!$GST_CFLAGS$ac_delim GST_LIBS!$GST_LIBS$ac_delim ALL_WX_LIBS!$ALL_WX_LIBS$ac_delim @@ -52025,8 +52132,6 @@ REZ!$REZ$ac_delim SETFILE!$SETFILE$ac_delim OBJCXXFLAGS!$OBJCXXFLAGS$ac_delim GCC_PCH!$GCC_PCH$ac_delim -ICC_PCH!$ICC_PCH$ac_delim -ICC_PCH_CREATE_SWITCH!$ICC_PCH_CREATE_SWITCH$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -52068,6 +52173,8 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +ICC_PCH!$ICC_PCH$ac_delim +ICC_PCH_CREATE_SWITCH!$ICC_PCH_CREATE_SWITCH$ac_delim ICC_PCH_USE_SWITCH!$ICC_PCH_USE_SWITCH$ac_delim BK_MAKE_PCH!$BK_MAKE_PCH$ac_delim COND_BUILD_DEBUG!$COND_BUILD_DEBUG$ac_delim @@ -52163,8 +52270,6 @@ COND_PLATFORM_WIN32_1!$COND_PLATFORM_WIN32_1$ac_delim COND_SHARED_0!$COND_SHARED_0$ac_delim COND_SHARED_0_TOOLKIT_MAC_WXUNIV_0!$COND_SHARED_0_TOOLKIT_MAC_WXUNIV_0$ac_delim COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0!$COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0$ac_delim -COND_SHARED_0_TOOLKIT_PM_WXUNIV_0!$COND_SHARED_0_TOOLKIT_PM_WXUNIV_0$ac_delim -COND_SHARED_0_USE_GUI_1_USE_OPENGL_1!$COND_SHARED_0_USE_GUI_1_USE_OPENGL_1$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -52206,6 +52311,8 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +COND_SHARED_0_TOOLKIT_PM_WXUNIV_0!$COND_SHARED_0_TOOLKIT_PM_WXUNIV_0$ac_delim +COND_SHARED_0_USE_GUI_1_USE_OPENGL_1!$COND_SHARED_0_USE_GUI_1_USE_OPENGL_1$ac_delim COND_SHARED_0_USE_GUI_1_wxUSE_LIBJPEG_builtin!$COND_SHARED_0_USE_GUI_1_wxUSE_LIBJPEG_builtin$ac_delim COND_SHARED_0_USE_GUI_1_wxUSE_LIBPNG_builtin!$COND_SHARED_0_USE_GUI_1_wxUSE_LIBPNG_builtin$ac_delim COND_SHARED_0_USE_GUI_1_wxUSE_LIBTIFF_builtin!$COND_SHARED_0_USE_GUI_1_wxUSE_LIBTIFF_builtin$ac_delim @@ -52301,8 +52408,6 @@ DEREZ!$DEREZ$ac_delim SHARED!$SHARED$ac_delim WX_LIBRARY_BASENAME_NOGUI!$WX_LIBRARY_BASENAME_NOGUI$ac_delim WX_LIBRARY_BASENAME_GUI!$WX_LIBRARY_BASENAME_GUI$ac_delim -USE_GUI!$USE_GUI$ac_delim -AFMINSTALL!$AFMINSTALL$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -52344,6 +52449,8 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +USE_GUI!$USE_GUI$ac_delim +AFMINSTALL!$AFMINSTALL$ac_delim WIN32INSTALL!$WIN32INSTALL$ac_delim TOOLKIT!$TOOLKIT$ac_delim TOOLKIT_DIR!$TOOLKIT_DIR$ac_delim @@ -52384,7 +52491,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 38; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 40; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.in b/configure.in index aff441405d..725ce14a89 100644 --- a/configure.in +++ b/configure.in @@ -363,6 +363,7 @@ dnl libraries disabled by default DEFAULT_wxUSE_DMALLOC=no DEFAULT_wxUSE_LIBGNOMEVFS=no DEFAULT_wxUSE_LIBHILDON=no +DEFAULT_wxUSE_LIBHILDON2=no DEFAULT_wxUSE_LIBMSPACK=no DEFAULT_wxUSE_LIBSDL=no @@ -579,7 +580,7 @@ WX_ARG_WITH(libmspack, [ --with-libmspack use libmspack (CHM help fi WX_ARG_WITHOUT(gtkprint, [ --without-gtkprint don't use GTK printing support], wxUSE_GTKPRINT) WX_ARG_WITHOUT(gnomeprint, [ --without-gnomeprint don't use GNOME printing libraries], wxUSE_LIBGNOMEPRINT) WX_ARG_WITH(gnomevfs, [ --with-gnomevfs use GNOME VFS for associating MIME types], wxUSE_LIBGNOMEVFS) -WX_ARG_WITH(hildon, [ --with-hildon use Hildon framework for Nokia 770], wxUSE_LIBHILDON) +WX_ARG_WITH(hildon, [ --with-hildon use Hildon framework for Nokia 770/800/810], wxUSE_LIBHILDON) WX_ARG_WITH(opengl, [ --with-opengl use OpenGL (or Mesa)], wxUSE_OPENGL) fi @@ -5623,12 +5624,30 @@ if test "$WXGTK2" = 1; then CFLAGS="$CFLAGS $HILDON_CFLAGS" CXXFLAGS="$CXXFLAGS $HILDON_CFLAGS" AC_DEFINE(wxUSE_LIBHILDON) + ac_hildon_lgpl=1 ], [ AC_MSG_WARN([libhildon_lgpl not found]) wxUSE_LIBHILDON="no" + ac_hildon_lgpl=0 ] ) + + if test "$ac_hildon_lgpl" = 0 ; then + PKG_CHECK_MODULES(HILDON2, + [hildon-1 >= 1.99], + [ + EXTRALIBS_HILDON="$HILDON2_LIBS" + CFLAGS="$CFLAGS $HILDON2_CFLAGS" + CXXFLAGS="$CXXFLAGS $HILDON2_CFLAGS" + AC_DEFINE(wxUSE_LIBHILDON2) + ], + [ + AC_MSG_WARN([libhildon_1 not found]) + wxUSE_LIBHILDON2="no" + ] + ) + fi fi fi @@ -7703,6 +7722,9 @@ case "$TOOLKIT" in if test "$wxUSE_LIBHILDON" = "yes"; then TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon" fi + if test "$wxUSE_LIBHILDON2" = "yes"; then + TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon" + fi if test "$TOOLKIT_EXTRA" != ""; then TOOLKIT_DESC="$TOOLKIT_DESC with support for `echo $TOOLKIT_EXTRA | tr -s ' '`" diff --git a/include/wx/gtk/app.h b/include/wx/gtk/app.h index 0ded824a5f..4dbda35c8b 100644 --- a/include/wx/gtk/app.h +++ b/include/wx/gtk/app.h @@ -18,9 +18,9 @@ class WXDLLIMPEXP_FWD_BASE wxMutex; #endif -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 typedef struct _HildonProgram HildonProgram; -#endif // wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 //----------------------------------------------------------------------------- // wxApp @@ -60,10 +60,10 @@ public: // must return XVisualInfo pointer (it is not freed by caller) virtual void *GetXVisualInfo() { return NULL; } -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // Maemo-specific method: get the main program object - HildonProgram *GetHildonProgram() const { return m_hildonProgram; } -#endif // wxUSE_LIBHILDON + HildonProgram *GetHildonProgram(); +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // implementation only from now on // ------------------------------- @@ -85,9 +85,9 @@ private: #endif guint m_idleSourceId; -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 HildonProgram *m_hildonProgram; -#endif // wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 DECLARE_DYNAMIC_CLASS(wxApp) }; diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index c24937ec95..9d97293d52 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -53,10 +53,10 @@ public: virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); wxPoint GetClientAreaOrigin() const { return wxPoint(0, 0); } -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // in Hildon environment all frames are always shown maximized virtual bool IsMaximized() const { return true; } -#endif // wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // implementation from now on // -------------------------- diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 63692e98b0..ecbb311e61 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -49,12 +49,12 @@ public: // implementation only from now on void SetInvokingWindow( wxWindow *win ); void UnsetInvokingWindow( wxWindow *win ); + GtkWidget *m_menubar; // Public for hildon support private: // common part of Append and Insert bool GtkAppend(wxMenu *menu, const wxString& title, int pos=-1); - GtkWidget *m_menubar; wxWindow *m_invokingWindow; void Init(size_t n, wxMenu *menus[], const wxString titles[], long style); diff --git a/include/wx/notifmsg.h b/include/wx/notifmsg.h index fa64720955..39a964ec23 100644 --- a/include/wx/notifmsg.h +++ b/include/wx/notifmsg.h @@ -127,7 +127,7 @@ private: wxDECLARE_NO_COPY_CLASS(wxNotificationMessageBase); }; -#if defined(__WXGTK__) && wxUSE_LIBHILDON +#if defined(__WXGTK__) && (wxUSE_LIBHILDON || wxUSE_LIBHILDON2) #include "wx/gtk/hildon/notifmsg.h" /* TODO: provide support for diff --git a/setup.h.in b/setup.h.in index 2ec082aec9..0fc38e74c7 100644 --- a/setup.h.in +++ b/setup.h.in @@ -742,6 +742,10 @@ * Use the Hildon framework */ #define wxUSE_LIBHILDON 0 +/* + * Use the Hildon 2.0 framework + */ +#define wxUSE_LIBHILDON2 0 /* * Have glibc2 */ diff --git a/setup.h_vms b/setup.h_vms index 670bef3763..ba23bd90db 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -779,6 +779,10 @@ typedef pid_t GPid; * Use the Hildon framework */ #define wxUSE_LIBHILDON 0 +/* + * Use the Hildon 2.0 framework + */ +#define wxUSE_LIBHILDON2 0 /* * Have glibc2 */ diff --git a/src/generic/notifmsgg.cpp b/src/generic/notifmsgg.cpp index f563d7a5b1..fe90a69f45 100644 --- a/src/generic/notifmsgg.cpp +++ b/src/generic/notifmsgg.cpp @@ -27,7 +27,11 @@ #define wxUSE_LIBHILDON 0 #endif -#if wxUSE_NOTIFICATION_MESSAGE && !wxUSE_LIBHILDON +#ifndef wxUSE_LIBHILDON2 + #define wxUSE_LIBHILDON2 0 +#endif + +#if wxUSE_NOTIFICATION_MESSAGE && (!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2) #ifndef WX_PRECOMP #include "wx/dialog.h" @@ -238,4 +242,4 @@ bool wxGenericNotificationMessage::Close() return true; } -#endif // wxUSE_NOTIFICATION_MESSAGE && !wxUSE_LIBHILDON +#endif // wxUSE_NOTIFICATION_MESSAGE && (!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2) diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index a605152fbf..5e88bc492d 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -33,6 +33,10 @@ #include #endif // wxUSE_LIBHILDON +#if wxUSE_LIBHILDON2 + #include +#endif // wxUSE_LIBHILDON2 + #include //----------------------------------------------------------------------------- @@ -263,14 +267,13 @@ bool wxApp::OnInitGui() } } -#if wxUSE_LIBHILDON - m_hildonProgram = hildon_program_get_instance(); - if ( !m_hildonProgram ) +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 + if ( !GetHildonProgram() ) { wxLogError(_("Unable to initialize Hildon program")); return false; } -#endif // wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 return true; } @@ -533,3 +536,12 @@ void wxGUIAppTraits::MutexGuiLeave() gdk_threads_leave(); } #endif // wxUSE_THREADS + +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 +// Maemo-specific method: get the main program object +HildonProgram *wxApp::GetHildonProgram() +{ + return hildon_program_get_instance(); +} + +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index b61f34cf4a..43ca4f09e3 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -88,7 +88,12 @@ void wxCheckListBox::DoCreateCheckList() gtk_tree_view_column_new_with_attributes( "", renderer, "active", 0, NULL ); +#if wxUSE_LIBHILDON2 + gtk_tree_view_column_set_fixed_width(column, 40); +#else gtk_tree_view_column_set_fixed_width(column, 22); +#endif // wxUSE_LIBHILDON2/!wxUSE_LIBHILDON2 + gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_clickable(column, TRUE); diff --git a/src/gtk/colordlg.cpp b/src/gtk/colordlg.cpp index 7ffd6045f2..893311f989 100644 --- a/src/gtk/colordlg.cpp +++ b/src/gtk/colordlg.cpp @@ -30,6 +30,12 @@ #include #endif // wxUSE_LIBHILDON +#if wxUSE_LIBHILDON2 +extern "C" { + #include +} +#endif // wxUSE_LIBHILDON2 + IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) @@ -48,7 +54,9 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) #if wxUSE_LIBHILDON m_widget = hildon_color_selector_new(parentGTK); -#else // !wxUSE_LIBHILDON +#elif wxUSE_LIBHILDON2 // !wxUSE_LIBHILDON + m_widget = hildon_color_chooser_dialog_new(); +#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 wxString title(_("Choose colour")); m_widget = gtk_color_selection_dialog_new(wxGTK_CONV(title)); #endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON @@ -60,9 +68,11 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) gtk_window_set_transient_for(GTK_WINDOW(m_widget), parentGTK); } +#if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 GtkColorSelection *sel = GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel); gtk_color_selection_set_has_palette(sel, true); +#endif // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 return true; } @@ -100,7 +110,19 @@ void wxColourDialog::ColourDataToDialog() #if wxUSE_LIBHILDON HildonColorSelector * const sel = HILDON_COLOR_SELECTOR(m_widget); hildon_color_selector_set_color(sel, const_cast(col)); -#else // !wxUSE_LIBHILDON +#elif wxUSE_LIBHILDON2 + GdkColor clr; + if (col) + clr = *col; + else { + clr.pixel = 0; + clr.red = 32768; + clr.green = 32768; + clr.blue = 32768; + } + + hildon_color_chooser_dialog_set_color((HildonColorChooserDialog *)m_widget, &clr); +#else // !wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 GtkColorSelection *sel = GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel); @@ -125,7 +147,7 @@ void wxColourDialog::ColourDataToDialog() GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(sel)); g_object_set(settings, "gtk-color-palette", pal.c_str(), NULL); -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON / wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } void wxColourDialog::DialogToColourData() @@ -135,7 +157,25 @@ void wxColourDialog::DialogToColourData() const GdkColor * const clr = hildon_color_selector_get_color(sel); if ( clr ) m_data.SetColour(*clr); -#else // !wxUSE_LIBHILDON +#elif wxUSE_LIBHILDON2 // !wxUSE_LIBHILDON + const GdkColor * const + col = m_data.GetColour().Ok() ? m_data.GetColour().GetColor() : NULL; + + GdkColor clr; + if (col) + clr = *col; + else { + clr.pixel = 0; + clr.red = 32768; + clr.green = 32768; + clr.blue = 32768; + } + GdkColor new_color = clr; + hildon_color_chooser_dialog_get_color((HildonColorChooserDialog *)m_widget, &new_color); + + m_data.SetColour(new_color); +#else // !wxUSE_LIBHILDON2 + GtkColorSelection *sel = GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel); @@ -161,7 +201,7 @@ void wxColourDialog::DialogToColourData() } g_free(pal); -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON / wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } #endif // wxUSE_COLOURDLG diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 82c8f1ec54..159565870c 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -24,6 +24,10 @@ #include #endif // wxUSE_LIBHILDON +#if wxUSE_LIBHILDON2 + #include +#endif // wxUSE_LIBHILDON2 + // ---------------------------------------------------------------------------- // event tables // ---------------------------------------------------------------------------- @@ -272,15 +276,15 @@ void wxFrame::DetachMenuBar() if ( m_frameMenuBar ) { -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 hildon_window_set_menu(HILDON_WINDOW(m_widget), NULL); -#else // !wxUSE_LIBHILDON +#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 m_frameMenuBar->UnsetInvokingWindow( this ); gtk_widget_ref( m_frameMenuBar->m_widget ); gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget ); -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } wxFrameBase::DetachMenuBar(); @@ -295,10 +299,10 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) if (m_frameMenuBar) { -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 hildon_window_set_menu(HILDON_WINDOW(m_widget), GTK_MENU(m_frameMenuBar->m_menubar)); -#else // !wxUSE_LIBHILDON +#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 m_frameMenuBar->SetInvokingWindow( this ); m_frameMenuBar->SetParent(this); @@ -322,7 +326,7 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) gtk_widget_set_size_request(menuBar->m_widget, -1, -1); gtk_widget_show( m_frameMenuBar->m_widget ); -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } // make sure next size_allocate causes a wxSizeEvent m_oldClientWidth = 0; diff --git a/src/gtk/hildon/notifmsg.cpp b/src/gtk/hildon/notifmsg.cpp index 3cad17868e..e3e85d3725 100644 --- a/src/gtk/hildon/notifmsg.cpp +++ b/src/gtk/hildon/notifmsg.cpp @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 #ifndef WX_PRECOMP #endif //WX_PRECOMP @@ -31,7 +31,13 @@ #include "wx/notifmsg.h" #include "wx/toplevel.h" -#include +#if wxUSE_LIBHILDON + #include +#endif // wxUSE_LIBHILDON + +#if wxUSE_LIBHILDON2 + #include +#endif // wxUSE_LIBHILDON2 // ============================================================================ // wxNotificationMessage implementation @@ -123,4 +129,4 @@ wxNotificationMessage::~wxNotificationMessage() Close(); } -#endif // wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 9d8c346e33..2e4427ac19 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -63,12 +63,12 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st { m_invokingWindow = NULL; -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // Hildon window uses a single menu instead of a menu bar, so wxMenuBar is // the same as menu in this case m_widget = m_menubar = gtk_menu_new(); -#else // !wxUSE_LIBHILDON +#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 if (!PreCreation( NULL, wxDefaultPosition, wxDefaultSize ) || !CreateBase( NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) { @@ -92,7 +92,7 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st PostCreation(); GTKApplyWidgetStyle(); -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 g_object_ref(m_widget); @@ -249,7 +249,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos) { menu->SetLayoutDirection(GetLayoutDirection()); -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // if the menu has only one item, append it directly to the top level menu // instead of inserting a useless submenu if ( menu->GetMenuItemCount() == 1 ) @@ -269,7 +269,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos) item->SetMenuItem(menu->m_owner); } else -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 { const wxString str(wxConvertMnemonicsToGTK(title)); diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 0b2b5f9bb2..ca2fa78303 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -32,6 +32,10 @@ #include #endif // wxUSE_LIBHILDON +#if wxUSE_LIBHILDON2 + #include +#endif // wxUSE_LIBHILDON2 + IMPLEMENT_CLASS(wxMessageDialog, wxDialog) wxMessageDialog::wxMessageDialog(wxWindow *parent, @@ -84,7 +88,7 @@ void wxMessageDialog::GTKCreateMsgDialog() { GtkWindow * const parent = m_parent ? GTK_WINDOW(m_parent->m_widget) : NULL; -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 const char *stockIcon; if ( m_dialogStyle & wxICON_NONE ) stockIcon = ""; @@ -104,12 +108,16 @@ void wxMessageDialog::GTKCreateMsgDialog() m_widget = (GtkWidget *)g_object_new ( HILDON_TYPE_NOTE, +#if wxUSE_LIBHILDON "note_type", HILDON_NOTE_CONFIRMATION_BUTTON_TYPE, +#else // wxUSE_LIBHILDON + "note_type", HILDON_NOTE_TYPE_CONFIRMATION_BUTTON, +#endif // wxUSE_LIBHILDON /wxUSE_LIBHILDON2 "description", (const char *)GetFullMessage().utf8_str(), "icon", stockIcon, NULL ); -#else // !wxUSE_LIBHILDON +#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 GtkMessageType type = GTK_MESSAGE_ERROR; GtkButtonsType buttons = GTK_BUTTONS_NONE; @@ -181,7 +189,7 @@ void wxMessageDialog::GTKCreateMsgDialog() ); } #endif // GTK+ 2.6+ -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 g_object_ref(m_widget); @@ -199,7 +207,7 @@ void wxMessageDialog::GTKCreateMsgDialog() // Yes/No/Cancel dialog as GTK+ doesn't support it natively and when using // Hildon we add all the buttons manually as it doesn't support too many of // the combinations we may have -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 static const bool addButtons = true; #else // !wxUSE_LIBHILDON const bool addButtons = buttons == GTK_BUTTONS_NONE; diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index f6c6327d12..637d1fef67 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -50,6 +50,10 @@ #include #endif // wxUSE_LIBHILDON +#if wxUSE_LIBHILDON2 + #include +#endif // wxUSE_LIBHILDON2 + // ---------------------------------------------------------------------------- // data // ---------------------------------------------------------------------------- @@ -476,14 +480,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, // e.g. in wxTaskBarIconAreaGTK if (m_widget == NULL) { -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // we must create HildonWindow and not a normal GtkWindow as the latter // doesn't look correctly in Maemo environment and it must also be // registered with the main program object m_widget = hildon_window_new(); hildon_program_add_window(wxTheApp->GetHildonProgram(), HILDON_WINDOW(m_widget)); -#else // !wxUSE_LIBHILDON +#else // !wxUSE_LIBHILDON || !wxUSE_LIBHILDON2 m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) { @@ -510,7 +514,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, style |= wxFRAME_NO_TASKBAR; } } -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2 g_object_ref(m_widget); } @@ -650,14 +654,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, wxTopLevelWindowGTK::~wxTopLevelWindowGTK() { -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 // it can also be a (standard) dialog if ( HILDON_IS_WINDOW(m_widget) ) { hildon_program_remove_window(wxTheApp->GetHildonProgram(), HILDON_WINDOW(m_widget)); } -#endif // wxUSE_LIBHILDON +#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 if (m_grabbed) { @@ -905,8 +909,25 @@ void wxTopLevelWindowGTK::GTKDoGetSize(int *width, int *height) const size -= m_decorSize; if (size.x < 0) size.x = 0; if (size.y < 0) size.y = 0; +#if wxUSE_LIBHILDON2 + if (width) { + if (size.x == 720) + *width = 696; + else + *width = size.x; + } + if (height) { + if (size.y == 420) + *height = 396; + else if (size.y == 270) + *height = 246; + else + *height = size.y; + } +#else // wxUSE_LIBHILDON2 if (width) *width = size.x; if (height) *height = size.y; +#endif // wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON2 } void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags ) diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 7e0b469080..db0f37b899 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -326,7 +326,7 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) #include "wx/utils.h" -#if wxUSE_LIBHILDON +#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 void wxClientDisplayRect(int *x, int *y, int *width, int *height) { @@ -341,7 +341,7 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) *height = 396; } -#else // !wxUSE_LIBHILDON +#else // !wxUSE_LIBHILDON || !wxUSE_LIBHILDON2 #include "wx/log.h" -- 2.45.2