Nuke GTK1 from src/gtk
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37056 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -164,30 +164,12 @@ bool wxApp::Yield(bool onlyIfNeeded) | |||||||
| // wxWakeUpIdle | // wxWakeUpIdle | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| // RR/KH: The wxMutexGui calls are not needed on GTK2 according to | // RR/KH: No wxMutexGui calls are needed here according to the GTK faq, | ||||||
| // the GTK faq, http://www.gtk.org/faq/#AEN500 | // http://www.gtk.org/faq/#AEN500 - this caused problems for wxPostEvent. | ||||||
| // The calls to gdk_threads_enter() and leave() are specifically noted |  | ||||||
| // as not being necessary.  The MutexGui calls are still left in for GTK1. |  | ||||||
| // Eliminating the MutexGui calls fixes the long-standing "random" lockup |  | ||||||
| // when using wxPostEvent (which calls WakeUpIdle) from a thread. |  | ||||||
|  |  | ||||||
| void wxApp::WakeUpIdle() | void wxApp::WakeUpIdle() | ||||||
| { | { | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| #if wxUSE_THREADS |  | ||||||
|     if (!wxThread::IsMain()) |  | ||||||
|         wxMutexGuiEnter(); |  | ||||||
| #endif // wxUSE_THREADS_ |  | ||||||
| #endif // __WXGTK2__ |  | ||||||
|  |  | ||||||
|     wxapp_install_idle_handler(); |     wxapp_install_idle_handler(); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| #if wxUSE_THREADS |  | ||||||
|     if (!wxThread::IsMain()) |  | ||||||
|         wxMutexGuiLeave(); |  | ||||||
| #endif // wxUSE_THREADS_ |  | ||||||
| #endif // __WXGTK2__ |  | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -245,11 +227,7 @@ static gint wxapp_idle_callback( gpointer WXUNUSED(data) ) | |||||||
|         if (wxTopLevelWindows.GetCount() > 0) |         if (wxTopLevelWindows.GetCount() > 0) | ||||||
|         { |         { | ||||||
|             wxWindow* win = (wxWindow*) wxTopLevelWindows.GetLast()->GetData(); |             wxWindow* win = (wxWindow*) wxTopLevelWindows.GetLast()->GetData(); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             if (win->IsKindOf(CLASSINFO(wxMessageDialog))) |             if (win->IsKindOf(CLASSINFO(wxMessageDialog))) | ||||||
| #else |  | ||||||
|             if (win->IsKindOf(CLASSINFO(wxGenericMessageDialog))) |  | ||||||
| #endif |  | ||||||
|                 win->OnInternalIdle(); |                 win->OnInternalIdle(); | ||||||
|         } |         } | ||||||
|         return TRUE; |         return TRUE; | ||||||
| @@ -469,14 +447,8 @@ bool wxApp::OnInitGui() | |||||||
|     // chosen a specific visual, then derive the GdkVisual from that |     // chosen a specific visual, then derive the GdkVisual from that | ||||||
|     if (m_glVisualInfo != NULL) |     if (m_glVisualInfo != NULL) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         // seems gtk_widget_set_default_visual no longer exists? |         // seems gtk_widget_set_default_visual no longer exists? | ||||||
|         GdkVisual* vis = gtk_widget_get_default_visual(); |         GdkVisual* vis = gtk_widget_get_default_visual(); | ||||||
| #else |  | ||||||
|         GdkVisual* vis = gdkx_visual_get( |  | ||||||
|             ((XVisualInfo *) m_glVisualInfo) ->visualid ); |  | ||||||
|         gtk_widget_set_default_visual( vis ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         GdkColormap *colormap = gdk_colormap_new( vis, FALSE ); |         GdkColormap *colormap = gdk_colormap_new( vis, FALSE ); | ||||||
|         gtk_widget_set_default_colormap( colormap ); |         gtk_widget_set_default_colormap( colormap ); | ||||||
| @@ -490,13 +462,8 @@ bool wxApp::OnInitGui() | |||||||
|     else |     else | ||||||
|     if ((gdk_visual_get_best() != gdk_visual_get_system()) && (m_useBestVisual)) |     if ((gdk_visual_get_best() != gdk_visual_get_system()) && (m_useBestVisual)) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         /* seems gtk_widget_set_default_visual no longer exists? */ |         /* seems gtk_widget_set_default_visual no longer exists? */ | ||||||
|         GdkVisual* vis = gtk_widget_get_default_visual(); |         GdkVisual* vis = gtk_widget_get_default_visual(); | ||||||
| #else |  | ||||||
|         GdkVisual* vis = gdk_visual_get_best(); |  | ||||||
|         gtk_widget_set_default_visual( vis ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         GdkColormap *colormap = gdk_colormap_new( vis, FALSE ); |         GdkColormap *colormap = gdk_colormap_new( vis, FALSE ); | ||||||
|         gtk_widget_set_default_colormap( colormap ); |         gtk_widget_set_default_colormap( colormap ); | ||||||
| @@ -595,19 +562,13 @@ bool wxApp::Initialize(int& argc, wxChar **argv) | |||||||
|  |  | ||||||
|     // We should have the wxUSE_WCHAR_T test on the _outside_ |     // We should have the wxUSE_WCHAR_T test on the _outside_ | ||||||
| #if wxUSE_WCHAR_T | #if wxUSE_WCHAR_T | ||||||
|     #if defined(__WXGTK20__) |     // gtk+ 2.0 supports Unicode through UTF-8 strings | ||||||
|         // gtk+ 2.0 supports Unicode through UTF-8 strings |     wxConvCurrent = &wxConvUTF8; | ||||||
|         wxConvCurrent = &wxConvUTF8; |  | ||||||
|     #else // GTK 1.x |  | ||||||
|         if (!wxOKlibc()) |  | ||||||
|             wxConvCurrent = &wxConvLocal; |  | ||||||
|     #endif |  | ||||||
| #else // !wxUSE_WCHAR_T | #else // !wxUSE_WCHAR_T | ||||||
|     if (!wxOKlibc()) |     if (!wxOKlibc()) | ||||||
|         wxConvCurrent = (wxMBConv*) NULL; |         wxConvCurrent = (wxMBConv*) NULL; | ||||||
| #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T | #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // decide which conversion to use for the file names |     // decide which conversion to use for the file names | ||||||
|  |  | ||||||
|     // (1) this variable exists for the sole purpose of specifying the encoding |     // (1) this variable exists for the sole purpose of specifying the encoding | ||||||
| @@ -634,7 +595,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv) | |||||||
| #endif // wxUSE_INTL | #endif // wxUSE_INTL | ||||||
|     static wxConvBrokenFileNames fileconv(encName); |     static wxConvBrokenFileNames fileconv(encName); | ||||||
|     wxConvFileName = &fileconv; |     wxConvFileName = &fileconv; | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
| #if wxUSE_UNICODE | #if wxUSE_UNICODE | ||||||
|     // gtk_init() wants UTF-8, not wchar_t, so convert |     // gtk_init() wants UTF-8, not wchar_t, so convert | ||||||
|   | |||||||
| @@ -20,21 +20,15 @@ | |||||||
| #include "wx/dcmemory.h" | #include "wx/dcmemory.h" | ||||||
| #include "wx/app.h" | #include "wx/app.h" | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| #include "wx/rawbmp.h" | #include "wx/rawbmp.h" | ||||||
|     // need this to get gdk_image_new_bitmap() |     // need this to get gdk_image_new_bitmap() | ||||||
|     #define GDK_ENABLE_BROKEN |     #define GDK_ENABLE_BROKEN | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #include <gdk/gdk.h> | #include <gdk/gdk.h> | ||||||
| #include <gtk/gtk.h> | #include <gtk/gtk.h> | ||||||
| #include <gdk/gdkx.h> | #include <gdk/gdkx.h> | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ | #include <gdk/gdkimage.h> | ||||||
|     #include <gdk/gdkimage.h> |  | ||||||
| #else // GTK+ 1.2 |  | ||||||
|     #include <gdk/gdkrgb.h> |  | ||||||
| #endif // GTK+ 2.0/1.2 |  | ||||||
|  |  | ||||||
| #include "wx/math.h" | #include "wx/math.h" | ||||||
|  |  | ||||||
| @@ -240,9 +234,7 @@ public: | |||||||
|  |  | ||||||
|     GdkPixmap      *m_pixmap; |     GdkPixmap      *m_pixmap; | ||||||
|     GdkBitmap      *m_bitmap; |     GdkBitmap      *m_bitmap; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     GdkPixbuf      *m_pixbuf; |     GdkPixbuf      *m_pixbuf; | ||||||
| #endif |  | ||||||
|     wxMask         *m_mask; |     wxMask         *m_mask; | ||||||
|     int             m_width; |     int             m_width; | ||||||
|     int             m_height; |     int             m_height; | ||||||
| @@ -254,9 +246,7 @@ wxBitmapRefData::wxBitmapRefData() | |||||||
| { | { | ||||||
|     m_pixmap = (GdkPixmap *) NULL; |     m_pixmap = (GdkPixmap *) NULL; | ||||||
|     m_bitmap = (GdkBitmap *) NULL; |     m_bitmap = (GdkBitmap *) NULL; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_pixbuf = (GdkPixbuf *) NULL; |     m_pixbuf = (GdkPixbuf *) NULL; | ||||||
| #endif |  | ||||||
|     m_mask = (wxMask *) NULL; |     m_mask = (wxMask *) NULL; | ||||||
|     m_width = 0; |     m_width = 0; | ||||||
|     m_height = 0; |     m_height = 0; | ||||||
| @@ -270,10 +260,8 @@ wxBitmapRefData::~wxBitmapRefData() | |||||||
|         gdk_pixmap_unref( m_pixmap ); |         gdk_pixmap_unref( m_pixmap ); | ||||||
|     if (m_bitmap) |     if (m_bitmap) | ||||||
|         gdk_bitmap_unref( m_bitmap ); |         gdk_bitmap_unref( m_bitmap ); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (m_pixbuf) |     if (m_pixbuf) | ||||||
|         gdk_pixbuf_unref( m_pixbuf ); |         gdk_pixbuf_unref( m_pixbuf ); | ||||||
| #endif |  | ||||||
|     delete m_mask; |     delete m_mask; | ||||||
| #if wxUSE_PALETTE | #if wxUSE_PALETTE | ||||||
|     delete m_palette; |     delete m_palette; | ||||||
| @@ -321,14 +309,12 @@ bool wxBitmap::Create( int width, int height, int depth ) | |||||||
|         M_BMPDATA->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 ); |         M_BMPDATA->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 ); | ||||||
|         M_BMPDATA->m_bpp = 1; |         M_BMPDATA->m_bpp = 1; | ||||||
|     } |     } | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     else if (depth == 32) |     else if (depth == 32) | ||||||
|     { |     { | ||||||
|         M_BMPDATA->m_pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, true, |         M_BMPDATA->m_pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, true, | ||||||
|                                               8, width, height); |                                               8, width, height); | ||||||
|         M_BMPDATA->m_bpp = 32; |         M_BMPDATA->m_bpp = 32; | ||||||
|     } |     } | ||||||
| #endif |  | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|         M_BMPDATA->m_pixmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, depth ); |         M_BMPDATA->m_pixmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, depth ); | ||||||
| @@ -381,7 +367,6 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, | |||||||
|  |  | ||||||
|     wxBitmap bmp; |     wxBitmap bmp; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (HasPixbuf()) |     if (HasPixbuf()) | ||||||
|     { |     { | ||||||
|         bmp.SetWidth(width); |         bmp.SetWidth(width); | ||||||
| @@ -397,7 +382,6 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, | |||||||
|                          GDK_INTERP_BILINEAR); |                          GDK_INTERP_BILINEAR); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
| #endif // __WXGTK20__ |  | ||||||
|     { |     { | ||||||
|         GdkImage *img = (GdkImage*) NULL; |         GdkImage *img = (GdkImage*) NULL; | ||||||
|         if (GetPixmap()) |         if (GetPixmap()) | ||||||
| @@ -587,10 +571,9 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth) | |||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         if (image.HasAlpha()) |         if (image.HasAlpha()) | ||||||
|             return CreateFromImageAsPixbuf(image); |             return CreateFromImageAsPixbuf(image); | ||||||
| #endif |  | ||||||
|         return CreateFromImageAsPixmap(image); |         return CreateFromImageAsPixmap(image); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -935,7 +918,6 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img) | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image) | bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image) | ||||||
| { | { | ||||||
|     int width = image.GetWidth(); |     int width = image.GetWidth(); | ||||||
| @@ -978,7 +960,6 @@ bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image) | |||||||
|  |  | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
| wxImage wxBitmap::ConvertToImage() const | wxImage wxBitmap::ConvertToImage() const | ||||||
| { | { | ||||||
| @@ -995,7 +976,6 @@ wxImage wxBitmap::ConvertToImage() const | |||||||
|         return wxNullImage; |         return wxNullImage; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (HasPixbuf()) |     if (HasPixbuf()) | ||||||
|     { |     { | ||||||
|         GdkPixbuf *pixbuf = GetPixbuf(); |         GdkPixbuf *pixbuf = GetPixbuf(); | ||||||
| @@ -1023,7 +1003,6 @@ wxImage wxBitmap::ConvertToImage() const | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
| #endif // __WXGTK20__ |  | ||||||
|     { |     { | ||||||
|         // the colour used as transparent one in wxImage and the one it is |         // the colour used as transparent one in wxImage and the one it is | ||||||
|         // replaced with when it really occurs in the bitmap |         // replaced with when it really occurs in the bitmap | ||||||
| @@ -1223,9 +1202,7 @@ bool wxBitmap::Ok() const | |||||||
| { | { | ||||||
|     return (m_refData != NULL) && |     return (m_refData != NULL) && | ||||||
|            ( |            ( | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|               M_BMPDATA->m_pixbuf || |               M_BMPDATA->m_pixbuf || | ||||||
| #endif |  | ||||||
|               M_BMPDATA->m_bitmap || M_BMPDATA->m_pixmap |               M_BMPDATA->m_bitmap || M_BMPDATA->m_pixmap | ||||||
|            ); |            ); | ||||||
| } | } | ||||||
| @@ -1283,7 +1260,6 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const | |||||||
|     wxBitmap ret( rect.width, rect.height, M_BMPDATA->m_bpp ); |     wxBitmap ret( rect.width, rect.height, M_BMPDATA->m_bpp ); | ||||||
|     wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") ); |     wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (HasPixbuf()) |     if (HasPixbuf()) | ||||||
|     { |     { | ||||||
|         GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, |         GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, | ||||||
| @@ -1295,7 +1271,6 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const | |||||||
|                              pixbuf, 0, 0); |                              pixbuf, 0, 0); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
| #endif // __WXGTK20__ |  | ||||||
|     { |     { | ||||||
|         if (ret.GetPixmap()) |         if (ret.GetPixmap()) | ||||||
|         { |         { | ||||||
| @@ -1439,9 +1414,7 @@ void wxBitmap::SetPixmap( GdkPixmap *pixmap ) | |||||||
|         m_refData = new wxBitmapRefData(); |         m_refData = new wxBitmapRefData(); | ||||||
|  |  | ||||||
|     M_BMPDATA->m_pixmap = pixmap; |     M_BMPDATA->m_pixmap = pixmap; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     PurgeOtherRepresentations(Pixmap); |     PurgeOtherRepresentations(Pixmap); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxBitmap::SetBitmap( GdkPixmap *bitmap ) | void wxBitmap::SetBitmap( GdkPixmap *bitmap ) | ||||||
| @@ -1450,16 +1423,13 @@ void wxBitmap::SetBitmap( GdkPixmap *bitmap ) | |||||||
|         m_refData = new wxBitmapRefData(); |         m_refData = new wxBitmapRefData(); | ||||||
|  |  | ||||||
|     M_BMPDATA->m_bitmap = bitmap; |     M_BMPDATA->m_bitmap = bitmap; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     PurgeOtherRepresentations(Pixmap); |     PurgeOtherRepresentations(Pixmap); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| GdkPixmap *wxBitmap::GetPixmap() const | GdkPixmap *wxBitmap::GetPixmap() const | ||||||
| { | { | ||||||
|     wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, wxT("invalid bitmap") ); |     wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, wxT("invalid bitmap") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // create the pixmap on the fly if we use Pixbuf representation: |     // create the pixmap on the fly if we use Pixbuf representation: | ||||||
|     if (HasPixbuf() && !HasPixmap()) |     if (HasPixbuf() && !HasPixmap()) | ||||||
|     { |     { | ||||||
| @@ -1470,7 +1440,6 @@ GdkPixmap *wxBitmap::GetPixmap() const | |||||||
|                                           &M_BMPDATA->m_mask->m_bitmap, |                                           &M_BMPDATA->m_mask->m_bitmap, | ||||||
|                                           128 /*threshold*/); |                                           128 /*threshold*/); | ||||||
|     } |     } | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
|     return M_BMPDATA->m_pixmap; |     return M_BMPDATA->m_pixmap; | ||||||
| } | } | ||||||
| @@ -1489,7 +1458,6 @@ GdkBitmap *wxBitmap::GetBitmap() const | |||||||
|     return M_BMPDATA->m_bitmap; |     return M_BMPDATA->m_bitmap; | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| GdkPixbuf *wxBitmap::GetPixbuf() const | GdkPixbuf *wxBitmap::GetPixbuf() const | ||||||
| { | { | ||||||
|     wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") ); |     wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") ); | ||||||
| @@ -1569,11 +1537,8 @@ void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep) | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
| void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) | void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (bpp != 32) |     if (bpp != 32) | ||||||
|         return NULL; |         return NULL; | ||||||
|  |  | ||||||
| @@ -1593,9 +1558,6 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) | |||||||
|     data.m_stride = gdk_pixbuf_get_rowstride( pixbuf ); |     data.m_stride = gdk_pixbuf_get_rowstride( pixbuf ); | ||||||
|  |  | ||||||
|     return gdk_pixbuf_get_pixels( pixbuf ); |     return gdk_pixbuf_get_pixels( pixbuf ); | ||||||
| #else |  | ||||||
|     return NULL; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data)) | void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data)) | ||||||
| @@ -1605,18 +1567,12 @@ void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data)) | |||||||
|  |  | ||||||
| bool wxBitmap::HasAlpha() const | bool wxBitmap::HasAlpha() const | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return HasPixbuf(); |     return HasPixbuf(); | ||||||
| #else |  | ||||||
|     return false; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxBitmap::UseAlpha() | void wxBitmap::UseAlpha() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     GetPixbuf(); |     GetPixbuf(); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|   | |||||||
| @@ -224,29 +224,22 @@ void wxBitmapButton::OnSetBitmap() | |||||||
|     { |     { | ||||||
|         // initial bitmap |         // initial bitmap | ||||||
|         GtkWidget *pixmap; |         GtkWidget *pixmap; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         if (the_one.HasPixbuf()) |         if (the_one.HasPixbuf()) | ||||||
|             pixmap = gtk_image_new_from_pixbuf(the_one.GetPixbuf()); |             pixmap = gtk_image_new_from_pixbuf(the_one.GetPixbuf()); | ||||||
|         else |         else | ||||||
|             pixmap = gtk_image_new_from_pixmap(the_one.GetPixmap(), mask); |             pixmap = gtk_image_new_from_pixmap(the_one.GetPixmap(), mask); | ||||||
| #else |  | ||||||
|         pixmap = gtk_pixmap_new(the_one.GetPixmap(), mask); |  | ||||||
| #endif |  | ||||||
|         gtk_widget_show(pixmap); |         gtk_widget_show(pixmap); | ||||||
|         gtk_container_add(GTK_CONTAINER(m_widget), pixmap); |         gtk_container_add(GTK_CONTAINER(m_widget), pixmap); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     {   // subsequent bitmaps |     {   // subsequent bitmaps | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         GtkImage *pixmap = GTK_IMAGE(child); |         GtkImage *pixmap = GTK_IMAGE(child); | ||||||
|         if (the_one.HasPixbuf()) |         if (the_one.HasPixbuf()) | ||||||
|             gtk_image_set_from_pixbuf(pixmap, the_one.GetPixbuf()); |             gtk_image_set_from_pixbuf(pixmap, the_one.GetPixbuf()); | ||||||
|         else |         else | ||||||
|             gtk_image_set_from_pixmap(pixmap, the_one.GetPixmap(), mask); |             gtk_image_set_from_pixmap(pixmap, the_one.GetPixmap(), mask); | ||||||
| #else |  | ||||||
|         GtkPixmap *pixmap = GTK_PIXMAP(child); |  | ||||||
|         gtk_pixmap_set(pixmap, the_one.GetPixmap(), mask); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -76,7 +76,6 @@ gtk_button_style_set_callback( GtkWidget *m_widget, GtkStyle *WXUNUSED(style), w | |||||||
|     /* the default button has a border around it */ |     /* the default button has a border around it */ | ||||||
|     if (GTK_WIDGET_CAN_DEFAULT(m_widget)) |     if (GTK_WIDGET_CAN_DEFAULT(m_widget)) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         GtkBorder *default_border = NULL; |         GtkBorder *default_border = NULL; | ||||||
|         gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); |         gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); | ||||||
|         if (default_border) |         if (default_border) | ||||||
| @@ -87,12 +86,6 @@ gtk_button_style_set_callback( GtkWidget *m_widget, GtkStyle *WXUNUSED(style), w | |||||||
|             bottom_border += default_border->bottom; |             bottom_border += default_border->bottom; | ||||||
|             g_free( default_border ); |             g_free( default_border ); | ||||||
|         } |         } | ||||||
| #else |  | ||||||
|         left_border = 6; |  | ||||||
|         right_border = 6; |  | ||||||
|         top_border = 6; |  | ||||||
|         bottom_border = 5; |  | ||||||
| #endif |  | ||||||
|         win->DoMoveWindow( win->m_x-top_border, |         win->DoMoveWindow( win->m_x-top_border, | ||||||
|                            win->m_y-left_border, |                            win->m_y-left_border, | ||||||
|                            win->m_width+left_border+right_border, |                            win->m_width+left_border+right_border, | ||||||
| @@ -130,11 +123,7 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label, | |||||||
|         return FALSE; |         return FALSE; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_widget = gtk_button_new_with_mnemonic(""); |     m_widget = gtk_button_new_with_mnemonic(""); | ||||||
| #else |  | ||||||
|     m_widget = gtk_button_new_with_label(""); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     float x_alignment = 0.5; |     float x_alignment = 0.5; | ||||||
|     if (HasFlag(wxBU_LEFT)) |     if (HasFlag(wxBU_LEFT)) | ||||||
| @@ -197,7 +186,6 @@ void wxButton::SetDefault() | |||||||
| /* static */ | /* static */ | ||||||
| wxSize wxButtonBase::GetDefaultSize() | wxSize wxButtonBase::GetDefaultSize() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     static wxSize size = wxDefaultSize; |     static wxSize size = wxDefaultSize; | ||||||
|     if (size == wxDefaultSize) |     if (size == wxDefaultSize) | ||||||
|     { |     { | ||||||
| @@ -228,9 +216,6 @@ wxSize wxButtonBase::GetDefaultSize() | |||||||
|         gtk_widget_destroy(wnd); |         gtk_widget_destroy(wnd); | ||||||
|     } |     } | ||||||
|     return size; |     return size; | ||||||
| #else |  | ||||||
|     return wxSize(80,26); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxButton::SetLabel( const wxString &lbl ) | void wxButton::SetLabel( const wxString &lbl ) | ||||||
| @@ -246,7 +231,6 @@ void wxButton::SetLabel( const wxString &lbl ) | |||||||
|  |  | ||||||
|     const wxString labelGTK = GTKConvertMnemonics(label); |     const wxString labelGTK = GTKConvertMnemonics(label); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label)) |     if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label)) | ||||||
|     { |     { | ||||||
|         const char *stock = wxGetStockGtkID(m_windowId); |         const char *stock = wxGetStockGtkID(m_windowId); | ||||||
| @@ -262,9 +246,6 @@ void wxButton::SetLabel( const wxString &lbl ) | |||||||
|     gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE); |     gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE); | ||||||
|  |  | ||||||
|     ApplyWidgetStyle( false ); |     ApplyWidgetStyle( false ); | ||||||
| #else // GTK+ 1 |  | ||||||
|     gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV(labelGTK)); |  | ||||||
| #endif // GTK+ 2/1 |  | ||||||
| } | } | ||||||
|  |  | ||||||
| bool wxButton::Enable( bool enable ) | bool wxButton::Enable( bool enable ) | ||||||
| @@ -279,11 +260,7 @@ bool wxButton::Enable( bool enable ) | |||||||
|  |  | ||||||
| bool wxButton::IsOwnGtkWindow( GdkWindow *window ) | bool wxButton::IsOwnGtkWindow( GdkWindow *window ) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return GTK_BUTTON(m_widget)->event_window; |     return GTK_BUTTON(m_widget)->event_window; | ||||||
| #else |  | ||||||
|     return (window == m_widget->window); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) | void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) | ||||||
| @@ -313,10 +290,6 @@ wxSize wxButton::DoGetBestSize() const | |||||||
|         GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); |         GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     ret.x += 10;  // add a few pixels for sloppy (but common) themes |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     if (!HasFlag(wxBU_EXACTFIT)) |     if (!HasFlag(wxBU_EXACTFIT)) | ||||||
|     { |     { | ||||||
|         wxSize defaultSize = GetDefaultSize(); |         wxSize defaultSize = GetDefaultSize(); | ||||||
|   | |||||||
| @@ -48,7 +48,6 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) | |||||||
|  |  | ||||||
|     if (cb->m_blockEvent) return; |     if (cb->m_blockEvent) return; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // Transitions for 3state checkbox must be done manually, GTK's checkbox |     // Transitions for 3state checkbox must be done manually, GTK's checkbox | ||||||
|     // is 2state with additional "undetermined state" flag which isn't |     // is 2state with additional "undetermined state" flag which isn't | ||||||
|     // changed automatically: |     // changed automatically: | ||||||
| @@ -94,14 +93,9 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) | |||||||
|             gtk_toggle_button_set_inconsistent(toggle, false); |             gtk_toggle_button_set_inconsistent(toggle, false); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); |     wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     event.SetInt(cb->Get3StateValue()); |     event.SetInt(cb->Get3StateValue()); | ||||||
| #else |  | ||||||
|     event.SetInt(cb->GetValue()); |  | ||||||
| #endif |  | ||||||
|     event.SetEventObject(cb); |     event.SetEventObject(cb); | ||||||
|     cb->GetEventHandler()->ProcessEvent(event); |     cb->GetEventHandler()->ProcessEvent(event); | ||||||
| } | } | ||||||
| @@ -197,14 +191,9 @@ bool wxCheckBox::GetValue() const | |||||||
| { | { | ||||||
|     wxCHECK_MSG( m_widgetCheckbox != NULL, FALSE, wxT("invalid checkbox") ); |     wxCHECK_MSG( m_widgetCheckbox != NULL, FALSE, wxT("invalid checkbox") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widgetCheckbox)); |     return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widgetCheckbox)); | ||||||
| #else |  | ||||||
|     return GTK_TOGGLE_BUTTON(m_widgetCheckbox)->active; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| void wxCheckBox::DoSet3StateValue(wxCheckBoxState state) | void wxCheckBox::DoSet3StateValue(wxCheckBoxState state) | ||||||
| { | { | ||||||
|     SetValue(state != wxCHK_UNCHECKED); |     SetValue(state != wxCHK_UNCHECKED); | ||||||
| @@ -223,7 +212,6 @@ wxCheckBoxState wxCheckBox::DoGet3StateValue() const | |||||||
|         return GetValue() ? wxCHK_CHECKED : wxCHK_UNCHECKED; |         return GetValue() ? wxCHK_CHECKED : wxCHK_UNCHECKED; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| #endif |  | ||||||
|  |  | ||||||
| void wxCheckBox::SetLabel( const wxString& label ) | void wxCheckBox::SetLabel( const wxString& label ) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -45,25 +45,8 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice * | |||||||
|  |  | ||||||
|     int selection = wxNOT_FOUND; |     int selection = wxNOT_FOUND; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     selection = gtk_option_menu_get_history( GTK_OPTION_MENU(choice->GetHandle()) ); |     selection = gtk_option_menu_get_history( GTK_OPTION_MENU(choice->GetHandle()) ); | ||||||
| #else |  | ||||||
|     GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(choice->GetHandle()) ) ); |  | ||||||
|     int count = 0; |  | ||||||
|  |  | ||||||
|     GList *child = menu_shell->children; |  | ||||||
|     while (child) |  | ||||||
|     { |  | ||||||
|         GtkBin *bin = GTK_BIN( child->data ); |  | ||||||
|         if (!bin->child) |  | ||||||
|         { |  | ||||||
|             selection = count; |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|         child = child->next; |  | ||||||
|         count++; |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|     choice->m_selection_hack = selection; |     choice->m_selection_hack = selection; | ||||||
|  |  | ||||||
|     wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() ); |     wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() ); | ||||||
| @@ -355,11 +338,7 @@ int wxChoice::FindString( const wxString &string, bool bCase ) const | |||||||
|  |  | ||||||
|         wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); |         wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|          wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text( label) ) ); |          wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text( label) ) ); | ||||||
| #else |  | ||||||
|          wxString tmp( label->label ); |  | ||||||
| #endif |  | ||||||
|         if (string.IsSameAs( tmp, bCase )) |         if (string.IsSameAs( tmp, bCase )) | ||||||
|             return count; |             return count; | ||||||
|  |  | ||||||
| @@ -427,11 +406,7 @@ wxString wxChoice::GetString( int n ) const | |||||||
|  |  | ||||||
|             wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); |             wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             return wxString( wxGTK_CONV_BACK( gtk_label_get_text( label) ) ); |             return wxString( wxGTK_CONV_BACK( gtk_label_get_text( label) ) ); | ||||||
| #else |  | ||||||
|             return wxString( label->label ); |  | ||||||
| #endif |  | ||||||
|         } |         } | ||||||
|         child = child->next; |         child = child->next; | ||||||
|         count++; |         count++; | ||||||
| @@ -622,11 +597,7 @@ wxSize wxChoice::DoGetBestSize() const | |||||||
|  |  | ||||||
| bool wxChoice::IsOwnGtkWindow( GdkWindow *window ) | bool wxChoice::IsOwnGtkWindow( GdkWindow *window ) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return GTK_BUTTON(m_widget)->event_window; |     return GTK_BUTTON(m_widget)->event_window; | ||||||
| #else |  | ||||||
|     return (window == m_widget->window); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // static | // static | ||||||
|   | |||||||
| @@ -274,7 +274,6 @@ selection_handler( GtkWidget *WXUNUSED(widget), | |||||||
|     // Text data will be in UTF8 in Unicode mode. |     // Text data will be in UTF8 in Unicode mode. | ||||||
|     data->GetDataHere( selection_data->target, d ); |     data->GetDataHere( selection_data->target, d ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // NB: GTK+ requires special treatment of UTF8_STRING data, the text |     // NB: GTK+ requires special treatment of UTF8_STRING data, the text | ||||||
|     //     would show as UTF-8 data interpreted as latin1 (?) in other |     //     would show as UTF-8 data interpreted as latin1 (?) in other | ||||||
|     //     GTK+ apps if we used gtk_selection_data_set() |     //     GTK+ apps if we used gtk_selection_data_set() | ||||||
| @@ -286,7 +285,6 @@ selection_handler( GtkWidget *WXUNUSED(widget), | |||||||
|             size-1 ); |             size-1 ); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
| #endif |  | ||||||
|     { |     { | ||||||
|         gtk_selection_data_set( |         gtk_selection_data_set( | ||||||
|             selection_data, |             selection_data, | ||||||
|   | |||||||
| @@ -92,14 +92,8 @@ void wxColourRefData::FreeColour() | |||||||
| { | { | ||||||
|     if (m_colormap) |     if (m_colormap) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         if ((m_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || |         if ((m_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || | ||||||
|             (m_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) |             (m_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) | ||||||
| #else |  | ||||||
|         GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) m_colormap; |  | ||||||
|         if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || |  | ||||||
|             (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) |  | ||||||
| #endif |  | ||||||
|         { |         { | ||||||
|             int idx = m_color.pixel; |             int idx = m_color.pixel; | ||||||
|             colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; |             colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; | ||||||
| @@ -117,14 +111,8 @@ void wxColourRefData::AllocColour( GdkColormap *cmap ) | |||||||
|  |  | ||||||
|     FreeColour(); |     FreeColour(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || |     if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || | ||||||
|          (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) |          (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) | ||||||
| #else |  | ||||||
|     GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; |  | ||||||
|     if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || |  | ||||||
|         (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) |  | ||||||
| #endif |  | ||||||
|     { |     { | ||||||
|         m_hasPixel = gdk_colormap_alloc_color( cmap, &m_color, FALSE, TRUE ); |         m_hasPixel = gdk_colormap_alloc_color( cmap, &m_color, FALSE, TRUE ); | ||||||
|         int idx = m_color.pixel; |         int idx = m_color.pixel; | ||||||
|   | |||||||
| @@ -238,17 +238,11 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, | |||||||
|     // and case-sensitive |     // and case-sensitive | ||||||
|     gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE ); |     gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (style & wxNO_BORDER) |     if (style & wxNO_BORDER) | ||||||
|         g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL ); |         g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL ); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     GtkWidget *list = GTK_COMBO(m_widget)->list; |     GtkWidget *list = GTK_COMBO(m_widget)->list; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     for (int i = 0; i < n; i++) |     for (int i = 0; i < n; i++) | ||||||
|     { |     { | ||||||
|         GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( choices[i] ) ); |         GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( choices[i] ) ); | ||||||
| @@ -550,11 +544,8 @@ int wxComboBox::FindString( const wxString &item, bool bCase ) const | |||||||
|     { |     { | ||||||
|         GtkBin *bin = GTK_BIN( child->data ); |         GtkBin *bin = GTK_BIN( child->data ); | ||||||
|         GtkLabel *label = GTK_LABEL( bin->child ); |         GtkLabel *label = GTK_LABEL( bin->child ); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); |         wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); | ||||||
| #else |  | ||||||
|         wxString str( label->label ); |  | ||||||
| #endif |  | ||||||
|         if (item.IsSameAs( str , bCase ) ) |         if (item.IsSameAs( str , bCase ) ) | ||||||
|             return count; |             return count; | ||||||
|  |  | ||||||
| @@ -607,11 +598,7 @@ wxString wxComboBox::GetString( int n ) const | |||||||
|     { |     { | ||||||
|         GtkBin *bin = GTK_BIN( child->data ); |         GtkBin *bin = GTK_BIN( child->data ); | ||||||
|         GtkLabel *label = GTK_LABEL( bin->child ); |         GtkLabel *label = GTK_LABEL( bin->child ); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         str = wxGTK_CONV_BACK( gtk_label_get_text(label) ); |         str = wxGTK_CONV_BACK( gtk_label_get_text(label) ); | ||||||
| #else |  | ||||||
|         str = wxString( label->label ); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| @@ -632,11 +619,7 @@ wxString wxComboBox::GetStringSelection() const | |||||||
|     { |     { | ||||||
|         GtkBin *bin = GTK_BIN( selection->data ); |         GtkBin *bin = GTK_BIN( selection->data ); | ||||||
|         GtkLabel *label = GTK_LABEL( bin->child ); |         GtkLabel *label = GTK_LABEL( bin->child ); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); |         wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); | ||||||
| #else |  | ||||||
|         wxString tmp( label->label ); |  | ||||||
| #endif |  | ||||||
|         return tmp; |         return tmp; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -832,15 +815,10 @@ void wxComboBox::GetSelection( long* from, long* to ) const | |||||||
|     if (IsEditable()) |     if (IsEditable()) | ||||||
|     { |     { | ||||||
|         GtkEditable *editable = GTK_EDITABLE(GTK_COMBO(m_widget)->entry); |         GtkEditable *editable = GTK_EDITABLE(GTK_COMBO(m_widget)->entry); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         gint start, end; |         gint start, end; | ||||||
|         gtk_editable_get_selection_bounds(editable, & start, & end); |         gtk_editable_get_selection_bounds(editable, & start, & end); | ||||||
|         *from = start; |         *from = start; | ||||||
|         *to = end; |         *to = end; | ||||||
| #else |  | ||||||
|         *from = (long) editable->selection_start_pos; |  | ||||||
|         *to = (long) editable->selection_end_pos; |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -107,11 +107,7 @@ void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label) | |||||||
|  |  | ||||||
|     const wxString labelGTK = GTKConvertMnemonics(label); |     const wxString labelGTK = GTKConvertMnemonics(label); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gtk_label_set_text_with_mnemonic(w, wxGTK_CONV(labelGTK)); |     gtk_label_set_text_with_mnemonic(w, wxGTK_CONV(labelGTK)); | ||||||
| #else |  | ||||||
|     gtk_label_set(w, wxGTK_CONV(labelGTK)); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxControl::GTKSetLabelForFrame(GtkFrame *w, const wxString& label) | void wxControl::GTKSetLabelForFrame(GtkFrame *w, const wxString& label) | ||||||
| @@ -208,11 +204,7 @@ wxString wxControl::GTKRemoveMnemonics(const wxString& label) | |||||||
| /* static */ | /* static */ | ||||||
| wxString wxControl::GTKConvertMnemonics(const wxString& label) | wxString wxControl::GTKConvertMnemonics(const wxString& label) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return GTKProcessMnemonics(label, MNEMONICS_CONVERT); |     return GTKProcessMnemonics(label, MNEMONICS_CONVERT); | ||||||
| #else |  | ||||||
|     return GTKRemoveMnemonics(label); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| @@ -263,7 +255,6 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, | |||||||
|                               style->bg[state].blue  >> SHIFT); |                               style->bg[state].blue  >> SHIFT); | ||||||
|  |  | ||||||
|     // get the style's font |     // get the style's font | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if ( !style->font_desc ) |     if ( !style->font_desc ) | ||||||
|         style = gtk_widget_get_default_style(); |         style = gtk_widget_get_default_style(); | ||||||
|     if ( style && style->font_desc ) |     if ( style && style->font_desc ) | ||||||
| @@ -286,10 +277,6 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, | |||||||
|             attr.font = wxFont(wxString::FromAscii(font_name)); |             attr.font = wxFont(wxString::FromAscii(font_name)); | ||||||
|         g_free (font_name); |         g_free (font_name); | ||||||
|     } |     } | ||||||
| #else |  | ||||||
|     // TODO: isn't there a way to get a standard gtk 1.2 font? |  | ||||||
|     attr.font = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return attr; |     return attr; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -92,7 +92,6 @@ void gdk_wx_draw_bitmap(GdkDrawable  *drawable, | |||||||
|     wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") ); |     wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") ); | ||||||
|     wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") ); |     wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gint src_width, src_height; |     gint src_width, src_height; | ||||||
|     gdk_drawable_get_size(src, &src_width, &src_height); |     gdk_drawable_get_size(src, &src_width, &src_height); | ||||||
|     if (width == -1) width = src_width; |     if (width == -1) width = src_width; | ||||||
| @@ -106,33 +105,6 @@ void gdk_wx_draw_bitmap(GdkDrawable  *drawable, | |||||||
|                 width, height, |                 width, height, | ||||||
|                 0, 0, |                 0, 0, | ||||||
|                 1 ); |                 1 ); | ||||||
| #else |  | ||||||
|     GdkWindowPrivate *drawable_private; |  | ||||||
|     GdkWindowPrivate *src_private; |  | ||||||
|     GdkGCPrivate *gc_private; |  | ||||||
|  |  | ||||||
|     drawable_private = (GdkWindowPrivate*) drawable; |  | ||||||
|     src_private = (GdkWindowPrivate*) src; |  | ||||||
|     if (drawable_private->destroyed || src_private->destroyed) |  | ||||||
|         return; |  | ||||||
|  |  | ||||||
|     gint src_width = src_private->width; |  | ||||||
|     gint src_height = src_private->height; |  | ||||||
|  |  | ||||||
|     gc_private = (GdkGCPrivate*) gc; |  | ||||||
|  |  | ||||||
|     if (width == -1) width = src_width; |  | ||||||
|     if (height == -1) height = src_height; |  | ||||||
|  |  | ||||||
|     XCopyPlane( drawable_private->xdisplay, |  | ||||||
|                 src_private->xwindow, |  | ||||||
|                 drawable_private->xwindow, |  | ||||||
|                 gc_private->xgc, |  | ||||||
|                 xsrc, ysrc, |  | ||||||
|                 width, height, |  | ||||||
|                 xdest, ydest, |  | ||||||
|                 1 ); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -288,11 +260,9 @@ wxWindowDC::wxWindowDC() | |||||||
|     m_isMemDC = false; |     m_isMemDC = false; | ||||||
|     m_isScreenDC = false; |     m_isScreenDC = false; | ||||||
|     m_owner = (wxWindow *)NULL; |     m_owner = (wxWindow *)NULL; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_context = (PangoContext *)NULL; |     m_context = (PangoContext *)NULL; | ||||||
|     m_layout = (PangoLayout *)NULL; |     m_layout = (PangoLayout *)NULL; | ||||||
|     m_fontdesc = (PangoFontDescription *)NULL; |     m_fontdesc = (PangoFontDescription *)NULL; | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxWindowDC::wxWindowDC( wxWindow *window ) | wxWindowDC::wxWindowDC( wxWindow *window ) | ||||||
| @@ -322,11 +292,9 @@ wxWindowDC::wxWindowDC( wxWindow *window ) | |||||||
|  |  | ||||||
|     wxASSERT_MSG( widget, wxT("DC needs a widget") ); |     wxASSERT_MSG( widget, wxT("DC needs a widget") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_context = window->GtkGetPangoDefaultContext(); |     m_context = window->GtkGetPangoDefaultContext(); | ||||||
|     m_layout = pango_layout_new( m_context ); |     m_layout = pango_layout_new( m_context ); | ||||||
|     m_fontdesc = pango_font_description_copy( widget->style->font_desc ); |     m_fontdesc = pango_font_description_copy( widget->style->font_desc ); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     GtkPizza *pizza = GTK_PIZZA( widget ); |     GtkPizza *pizza = GTK_PIZZA( widget ); | ||||||
|     m_window = pizza->bin_window; |     m_window = pizza->bin_window; | ||||||
| @@ -358,12 +326,10 @@ wxWindowDC::~wxWindowDC() | |||||||
| { | { | ||||||
|     Destroy(); |     Destroy(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (m_layout) |     if (m_layout) | ||||||
|         g_object_unref( G_OBJECT( m_layout ) ); |         g_object_unref( G_OBJECT( m_layout ) ); | ||||||
|     if (m_fontdesc) |     if (m_fontdesc) | ||||||
|         pango_font_description_free( m_fontdesc ); |         pango_font_description_free( m_fontdesc ); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxWindowDC::SetUpDC() | void wxWindowDC::SetUpDC() | ||||||
| @@ -1184,7 +1150,6 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, | |||||||
|     // drawing a mono-bitmap (XBitmap) we use the current text GC |     // drawing a mono-bitmap (XBitmap) we use the current text GC | ||||||
|     if (is_mono) |     if (is_mono) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         GdkPixmap *bitmap2 = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); |         GdkPixmap *bitmap2 = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); | ||||||
|         GdkGC *gc = gdk_gc_new( bitmap2 ); |         GdkGC *gc = gdk_gc_new( bitmap2 ); | ||||||
|         gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); |         gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); | ||||||
| @@ -1195,9 +1160,6 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, | |||||||
|  |  | ||||||
|         gdk_bitmap_unref( bitmap2 ); |         gdk_bitmap_unref( bitmap2 ); | ||||||
|         gdk_gc_unref( gc ); |         gdk_gc_unref( gc ); | ||||||
| #else |  | ||||||
|         gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| @@ -1442,7 +1404,6 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, | |||||||
|  |  | ||||||
|         if (is_mono) |         if (is_mono) | ||||||
|         { |         { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             GdkPixmap *bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bm_ww, bm_hh, -1 ); |             GdkPixmap *bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bm_ww, bm_hh, -1 ); | ||||||
|             GdkGC *gc = gdk_gc_new( bitmap ); |             GdkGC *gc = gdk_gc_new( bitmap ); | ||||||
|             gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); |             gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); | ||||||
| @@ -1453,10 +1414,6 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, | |||||||
|  |  | ||||||
|             gdk_bitmap_unref( bitmap ); |             gdk_bitmap_unref( bitmap ); | ||||||
|             gdk_gc_unref( gc ); |             gdk_gc_unref( gc ); | ||||||
| #else |  | ||||||
|             // was: gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh ); |  | ||||||
|             gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, cx, cy, cw, ch ); |  | ||||||
| #endif |  | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
| @@ -1529,16 +1486,9 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) | |||||||
|  |  | ||||||
|     if (text.empty()) return; |     if (text.empty()) return; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     GdkFont *font = m_font.GetInternalFont( m_scaleY ); |  | ||||||
|  |  | ||||||
|     wxCHECK_RET( font, wxT("invalid font") ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     x = XLOG2DEV(x); |     x = XLOG2DEV(x); | ||||||
|     y = YLOG2DEV(y); |     y = YLOG2DEV(y); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     wxCHECK_RET( m_context, wxT("no Pango context") ); |     wxCHECK_RET( m_context, wxT("no Pango context") ); | ||||||
|     wxCHECK_RET( m_layout, wxT("no Pango layout") ); |     wxCHECK_RET( m_layout, wxT("no Pango layout") ); | ||||||
|     wxCHECK_RET( m_fontdesc, wxT("no Pango font description") ); |     wxCHECK_RET( m_fontdesc, wxT("no Pango font description") ); | ||||||
| @@ -1622,29 +1572,6 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) | |||||||
|     wxCoord width = w; |     wxCoord width = w; | ||||||
|     wxCoord height = h; |     wxCoord height = h; | ||||||
|  |  | ||||||
| #else // GTK+ 1.x |  | ||||||
|     wxCoord width = gdk_string_width( font, text.mbc_str() ); |  | ||||||
|     wxCoord height = font->ascent + font->descent; |  | ||||||
|  |  | ||||||
|     if ( m_backgroundMode == wxSOLID ) |  | ||||||
|     { |  | ||||||
|         gdk_gc_set_foreground( m_textGC, m_textBackgroundColour.GetColor() ); |  | ||||||
|         gdk_draw_rectangle( m_window, m_textGC, TRUE, x, y, width, height ); |  | ||||||
|         gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() ); |  | ||||||
|     } |  | ||||||
|     gdk_draw_string( m_window, font, m_textGC, x, y + font->ascent, text.mbc_str() ); |  | ||||||
|  |  | ||||||
|     /* CMB 17/7/98: simple underline: ignores scaling and underlying |  | ||||||
|        X font's XA_UNDERLINE_POSITION and XA_UNDERLINE_THICKNESS |  | ||||||
|        properties (see wxXt implementation) */ |  | ||||||
|     if (m_font.GetUnderlined()) |  | ||||||
|     { |  | ||||||
|         wxCoord ul_y = y + font->ascent; |  | ||||||
|         if (font->descent > 0) ul_y++; |  | ||||||
|         gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y); |  | ||||||
|     } |  | ||||||
| #endif // GTK+ 2.0/1.x |  | ||||||
|  |  | ||||||
|     width = wxCoord(width / m_scaleX); |     width = wxCoord(width / m_scaleX); | ||||||
|     height = wxCoord(height / m_scaleY); |     height = wxCoord(height / m_scaleY); | ||||||
|     CalcBoundingBox (x + width, y + height); |     CalcBoundingBox (x + width, y + height); | ||||||
| @@ -1671,19 +1598,9 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, | |||||||
|     wxCoord w; |     wxCoord w; | ||||||
|     wxCoord h; |     wxCoord h; | ||||||
|  |  | ||||||
| #ifdef  __WXGTK20__ |     // TODO: implement later without GdkFont for GTK 2.0 | ||||||
|     // implement later without GdkFont for GTK 2.0 |  | ||||||
|     GetTextExtent(text, &w, &h, NULL,NULL, &m_font); |     GetTextExtent(text, &w, &h, NULL,NULL, &m_font); | ||||||
|  |  | ||||||
| #else |  | ||||||
|     GdkFont *font = m_font.GetInternalFont( m_scaleY ); |  | ||||||
|  |  | ||||||
|     wxCHECK_RET( font, wxT("invalid font") ); |  | ||||||
|  |  | ||||||
|     // the size of the text |  | ||||||
|     w = gdk_string_width( font, text.mbc_str() ); |  | ||||||
|     h = font->ascent + font->descent; |  | ||||||
| #endif |  | ||||||
|     // draw the string normally |     // draw the string normally | ||||||
|     wxBitmap src(w, h); |     wxBitmap src(w, h); | ||||||
|     wxMemoryDC dc; |     wxMemoryDC dc; | ||||||
| @@ -1786,7 +1703,6 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // Set new font description |     // Set new font description | ||||||
|     if (theFont) |     if (theFont) | ||||||
|         pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description ); |         pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description ); | ||||||
| @@ -1832,52 +1748,22 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, | |||||||
|     // Reset old font description |     // Reset old font description | ||||||
|     if (theFont) |     if (theFont) | ||||||
|         pango_layout_set_font_description( m_layout, m_fontdesc ); |         pango_layout_set_font_description( m_layout, m_fontdesc ); | ||||||
| #else // GTK+ 1.x |  | ||||||
|     wxFont fontToUse = m_font; |  | ||||||
|     if (theFont) |  | ||||||
|         fontToUse = *theFont; |  | ||||||
|  |  | ||||||
|     GdkFont *font = fontToUse.GetInternalFont( m_scaleY ); |  | ||||||
|     if ( !font ) |  | ||||||
|         return; |  | ||||||
|  |  | ||||||
|     if (width) |  | ||||||
|         *width = wxCoord(gdk_string_width( font, string.mbc_str() ) / m_scaleX); |  | ||||||
|     if (height) |  | ||||||
|         *height = wxCoord((font->ascent + font->descent) / m_scaleY); |  | ||||||
|     if (descent) |  | ||||||
|         *descent = wxCoord(font->descent / m_scaleY); |  | ||||||
| #endif // GTK+ 2/1 |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxCoord wxWindowDC::GetCharWidth() const | wxCoord wxWindowDC::GetCharWidth() const | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     pango_layout_set_text( m_layout, "H", 1 ); |     pango_layout_set_text( m_layout, "H", 1 ); | ||||||
|     int w; |     int w; | ||||||
|     pango_layout_get_pixel_size( m_layout, &w, NULL ); |     pango_layout_get_pixel_size( m_layout, &w, NULL ); | ||||||
|     return w; |     return w; | ||||||
| #else |  | ||||||
|     GdkFont *font = m_font.GetInternalFont( m_scaleY ); |  | ||||||
|     wxCHECK_MSG( font, -1, wxT("invalid font") ); |  | ||||||
|  |  | ||||||
|     return wxCoord(gdk_string_width( font, "H" ) / m_scaleX); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxCoord wxWindowDC::GetCharHeight() const | wxCoord wxWindowDC::GetCharHeight() const | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     pango_layout_set_text( m_layout, "H", 1 ); |     pango_layout_set_text( m_layout, "H", 1 ); | ||||||
|     int h; |     int h; | ||||||
|     pango_layout_get_pixel_size( m_layout, NULL, &h ); |     pango_layout_get_pixel_size( m_layout, NULL, &h ); | ||||||
|     return h; |     return h; | ||||||
| #else |  | ||||||
|     GdkFont *font = m_font.GetInternalFont( m_scaleY ); |  | ||||||
|     wxCHECK_MSG( font, -1, wxT("invalid font") ); |  | ||||||
|  |  | ||||||
|     return wxCoord((font->ascent + font->descent) / m_scaleY); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxWindowDC::Clear() | void wxWindowDC::Clear() | ||||||
| @@ -1922,7 +1808,6 @@ void wxWindowDC::SetFont( const wxFont &font ) | |||||||
| { | { | ||||||
|     m_font = font; |     m_font = font; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (m_font.Ok()) |     if (m_font.Ok()) | ||||||
|     { |     { | ||||||
|         if (m_fontdesc) |         if (m_fontdesc) | ||||||
| @@ -1951,7 +1836,6 @@ void wxWindowDC::SetFont( const wxFont &font ) | |||||||
|  |  | ||||||
|         pango_layout_set_font_description( m_layout, m_fontdesc ); |         pango_layout_set_font_description( m_layout, m_fontdesc ); | ||||||
|     } |     } | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxWindowDC::SetPen( const wxPen &pen ) | void wxWindowDC::SetPen( const wxPen &pen ) | ||||||
| @@ -2433,13 +2317,7 @@ wxSize wxWindowDC::GetPPI() const | |||||||
|  |  | ||||||
| int wxWindowDC::GetDepth() const | int wxWindowDC::GetDepth() const | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return gdk_drawable_get_depth(m_window); |     return gdk_drawable_get_depth(m_window); | ||||||
| #else |  | ||||||
|     wxFAIL_MSG(wxT("not implemented")); |  | ||||||
|  |  | ||||||
|     return -1; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -27,14 +27,12 @@ wxMemoryDC::wxMemoryDC() : wxWindowDC() | |||||||
|  |  | ||||||
|     m_cmap = gtk_widget_get_default_colormap(); |     m_cmap = gtk_widget_get_default_colormap(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_context = gdk_pango_context_get(); |     m_context = gdk_pango_context_get(); | ||||||
|     // Note: The Sun customised version of Pango shipping with Solaris 10 |     // Note: The Sun customised version of Pango shipping with Solaris 10 | ||||||
|     // crashes if the language is left NULL (see bug 1374114) |     // crashes if the language is left NULL (see bug 1374114) | ||||||
|     pango_context_set_language( m_context, gtk_get_default_language() ); |     pango_context_set_language( m_context, gtk_get_default_language() ); | ||||||
|     m_layout = pango_layout_new( m_context ); |     m_layout = pango_layout_new( m_context ); | ||||||
|     m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) ); |     m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) ); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) | wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) | ||||||
| @@ -44,19 +42,15 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) | |||||||
|  |  | ||||||
|     m_cmap = gtk_widget_get_default_colormap(); |     m_cmap = gtk_widget_get_default_colormap(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_context = gdk_pango_context_get(); |     m_context = gdk_pango_context_get(); | ||||||
|     pango_context_set_language( m_context, gtk_get_default_language() ); |     pango_context_set_language( m_context, gtk_get_default_language() ); | ||||||
|     m_layout = pango_layout_new( m_context ); |     m_layout = pango_layout_new( m_context ); | ||||||
|     m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) ); |     m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) ); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxMemoryDC::~wxMemoryDC() | wxMemoryDC::~wxMemoryDC() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     g_object_unref(m_context); |     g_object_unref(m_context); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) | void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) | ||||||
| @@ -74,9 +68,7 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) | |||||||
|             m_window = m_selected.GetBitmap(); |             m_window = m_selected.GetBitmap(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         m_selected.PurgeOtherRepresentations(wxBitmap::Pixmap); |         m_selected.PurgeOtherRepresentations(wxBitmap::Pixmap); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         m_isMemDC = TRUE; |         m_isMemDC = TRUE; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -37,14 +37,12 @@ wxScreenDC::wxScreenDC() | |||||||
|     m_cmap = gdk_colormap_get_system(); |     m_cmap = gdk_colormap_get_system(); | ||||||
|     m_window = GDK_ROOT_PARENT(); |     m_window = GDK_ROOT_PARENT(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_context = gdk_pango_context_get(); |     m_context = gdk_pango_context_get(); | ||||||
|     // Note: The Sun customised version of Pango shipping with Solaris 10 |     // Note: The Sun customised version of Pango shipping with Solaris 10 | ||||||
|     // crashes if the language is left NULL (see bug 1374114) |     // crashes if the language is left NULL (see bug 1374114) | ||||||
|     pango_context_set_language( m_context, gtk_get_default_language() ); |     pango_context_set_language( m_context, gtk_get_default_language() ); | ||||||
|     m_layout = pango_layout_new( m_context ); |     m_layout = pango_layout_new( m_context ); | ||||||
| //    m_fontdesc = pango_font_description_copy( widget->style->font_desc ); | //    m_fontdesc = pango_font_description_copy( widget->style->font_desc ); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     m_isScreenDC = TRUE; |     m_isScreenDC = TRUE; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -506,13 +506,7 @@ GdkAtom wxDropTarget::GetMatchingPair() | |||||||
|     GList *child = m_dragContext->targets; |     GList *child = m_dragContext->targets; | ||||||
|     while (child) |     while (child) | ||||||
|     { |     { | ||||||
|         // in GTK+ 1.x GdkAtom was a gulong, but now it's a pointer |         GdkAtom formatAtom = (GdkAtom)(child->data); | ||||||
|         GdkAtom formatAtom = |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                              (GdkAtom)(child->data); |  | ||||||
| #else |  | ||||||
|                              GPOINTER_TO_INT(child->data); |  | ||||||
| #endif |  | ||||||
|         wxDataFormat format( formatAtom ); |         wxDataFormat format( formatAtom ); | ||||||
|  |  | ||||||
| #ifdef __WXDEBUG__ | #ifdef __WXDEBUG__ | ||||||
| @@ -823,18 +817,12 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) | |||||||
|     gdk_window_get_size (pixmap, &width, &height); |     gdk_window_get_size (pixmap, &width, &height); | ||||||
|  |  | ||||||
|     GdkColormap *colormap = gtk_widget_get_colormap( m_widget ); |     GdkColormap *colormap = gtk_widget_get_colormap( m_widget ); | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     gtk_widget_push_visual (gdk_colormap_get_visual (colormap)); |  | ||||||
| #endif |  | ||||||
|     gtk_widget_push_colormap (colormap); |     gtk_widget_push_colormap (colormap); | ||||||
|  |  | ||||||
|     m_iconWindow = gtk_window_new (GTK_WINDOW_POPUP); |     m_iconWindow = gtk_window_new (GTK_WINDOW_POPUP); | ||||||
|     gtk_widget_set_events (m_iconWindow, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); |     gtk_widget_set_events (m_iconWindow, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); | ||||||
|     gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow), TRUE); |     gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow), TRUE); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     gtk_widget_pop_visual (); |  | ||||||
| #endif |  | ||||||
|     gtk_widget_pop_colormap (); |     gtk_widget_pop_colormap (); | ||||||
|  |  | ||||||
|     gtk_widget_set_usize (m_iconWindow, width, height); |     gtk_widget_set_usize (m_iconWindow, width, height); | ||||||
|   | |||||||
							
								
								
									
										357
									
								
								src/gtk/font.cpp
									
									
									
									
									
								
							
							
						
						
									
										357
									
								
								src/gtk/font.cpp
									
									
									
									
									
								
							| @@ -73,13 +73,8 @@ public: | |||||||
|     // do we have the native font info? |     // do we have the native font info? | ||||||
|     bool HasNativeFont() const |     bool HasNativeFont() const | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         // we always have a Pango font description |         // we always have a Pango font description | ||||||
|         return TRUE; |         return TRUE; | ||||||
| #else // GTK 1.x |  | ||||||
|         // only use m_nativeFontInfo if it had been initialized |  | ||||||
|         return !m_nativeFontInfo.IsDefault(); |  | ||||||
| #endif // GTK 2.0/1.x |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // setters: all of them also take care to modify m_nativeFontInfo if we |     // setters: all of them also take care to modify m_nativeFontInfo if we | ||||||
| @@ -98,26 +93,6 @@ public: | |||||||
|     // and this one also modifies all the other font data fields |     // and this one also modifies all the other font data fields | ||||||
|     void SetNativeFontInfo(const wxNativeFontInfo& info); |     void SetNativeFontInfo(const wxNativeFontInfo& info); | ||||||
|  |  | ||||||
|     // debugger helper: shows what the font really is |  | ||||||
|     // |  | ||||||
|     // VZ: I need this as my gdb either shows wildly wrong values or crashes |  | ||||||
|     //     when I ask it to "p fontRefData" :-( |  | ||||||
| #if defined(__WXDEBUG__) && !defined(__WXGTK20__) |  | ||||||
|     void Dump() const |  | ||||||
|     { |  | ||||||
|         wxPrintf(_T("%s-%s-%s-%d-%d\n"), |  | ||||||
|                  m_faceName.c_str(), |  | ||||||
|                  m_weight == wxFONTWEIGHT_NORMAL |  | ||||||
|                     ? _T("normal") |  | ||||||
|                     : m_weight == wxFONTWEIGHT_BOLD |  | ||||||
|                         ? _T("bold") |  | ||||||
|                         : _T("light"), |  | ||||||
|                  m_style == wxFONTSTYLE_NORMAL ? _T("regular") : _T("italic"), |  | ||||||
|                  m_pointSize, |  | ||||||
|                  m_encoding); |  | ||||||
|     } |  | ||||||
| #endif // Debug |  | ||||||
|  |  | ||||||
| protected: | protected: | ||||||
|     // common part of all ctors |     // common part of all ctors | ||||||
|     void Init(int pointSize, |     void Init(int pointSize, | ||||||
| @@ -135,11 +110,6 @@ private: | |||||||
|     // clear m_scaled_xfonts if any |     // clear m_scaled_xfonts if any | ||||||
|     void ClearGdkFonts(); |     void ClearGdkFonts(); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // the map of font sizes to "GdkFont *" |  | ||||||
|     wxScaledFontList  m_scaled_xfonts; |  | ||||||
| #endif // GTK 2.0/1.x |  | ||||||
|  |  | ||||||
|     int             m_pointSize; |     int             m_pointSize; | ||||||
|     int             m_family, |     int             m_family, | ||||||
|                     m_style, |                     m_style, | ||||||
| @@ -187,7 +157,6 @@ void wxFontRefData::Init(int pointSize, | |||||||
|  |  | ||||||
|     m_noAA = FALSE; |     m_noAA = FALSE; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // Create native font info |     // Create native font info | ||||||
|     m_nativeFontInfo.description = pango_font_description_new(); |     m_nativeFontInfo.description = pango_font_description_new(); | ||||||
|  |  | ||||||
| @@ -218,14 +187,12 @@ void wxFontRefData::Init(int pointSize, | |||||||
|     SetStyle( m_style ); |     SetStyle( m_style ); | ||||||
|     SetPointSize( m_pointSize ); |     SetPointSize( m_pointSize ); | ||||||
|     SetWeight( m_weight ); |     SetWeight( m_weight ); | ||||||
| #endif // GTK 2.0 |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxFontRefData::InitFromNative() | void wxFontRefData::InitFromNative() | ||||||
| { | { | ||||||
|     m_noAA = FALSE; |     m_noAA = FALSE; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // Get native info |     // Get native info | ||||||
|     PangoFontDescription *desc = m_nativeFontInfo.description; |     PangoFontDescription *desc = m_nativeFontInfo.description; | ||||||
|  |  | ||||||
| @@ -263,105 +230,6 @@ void wxFontRefData::InitFromNative() | |||||||
|  |  | ||||||
|     // Cannot we choose that |     // Cannot we choose that | ||||||
|     m_encoding = wxFONTENCODING_SYSTEM; |     m_encoding = wxFONTENCODING_SYSTEM; | ||||||
| #else // GTK 1.x |  | ||||||
|     // get the font parameters from the XLFD |  | ||||||
|     // ------------------------------------- |  | ||||||
|  |  | ||||||
|     m_faceName = m_nativeFontInfo.GetXFontComponent(wxXLFD_FAMILY); |  | ||||||
|  |  | ||||||
|     m_weight = wxFONTWEIGHT_NORMAL; |  | ||||||
|  |  | ||||||
|     wxString w = m_nativeFontInfo.GetXFontComponent(wxXLFD_WEIGHT).Upper(); |  | ||||||
|     if ( !w.empty() && w != _T('*') ) |  | ||||||
|     { |  | ||||||
|         // the test below catches all of BOLD, EXTRABOLD, DEMIBOLD, ULTRABOLD |  | ||||||
|         // and BLACK |  | ||||||
|         if ( ((w[0u] == _T('B') && (!wxStrcmp(w.c_str() + 1, wxT("OLD")) || |  | ||||||
|                                    !wxStrcmp(w.c_str() + 1, wxT("LACK"))))) || |  | ||||||
|              wxStrstr(w.c_str() + 1, _T("BOLD")) ) |  | ||||||
|         { |  | ||||||
|             m_weight = wxFONTWEIGHT_BOLD; |  | ||||||
|         } |  | ||||||
|         else if ( w == _T("LIGHT") || w == _T("THIN") ) |  | ||||||
|         { |  | ||||||
|             m_weight = wxFONTWEIGHT_LIGHT; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     switch ( wxToupper(*m_nativeFontInfo. |  | ||||||
|                             GetXFontComponent(wxXLFD_SLANT).c_str()) ) |  | ||||||
|     { |  | ||||||
|         case _T('I'):   // italique |  | ||||||
|             m_style = wxFONTSTYLE_ITALIC; |  | ||||||
|             break; |  | ||||||
|  |  | ||||||
|         case _T('O'):   // oblique |  | ||||||
|             m_style = wxFONTSTYLE_SLANT; |  | ||||||
|             break; |  | ||||||
|  |  | ||||||
|         default: |  | ||||||
|             m_style = wxFONTSTYLE_NORMAL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     long ptSize; |  | ||||||
|     if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_POINTSIZE).ToLong(&ptSize) ) |  | ||||||
|     { |  | ||||||
|         // size in XLFD is in 10 point units |  | ||||||
|         m_pointSize = (int)(ptSize / 10); |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         m_pointSize = wxDEFAULT_FONT_SIZE; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // examine the spacing: if the font is monospaced, assume wxTELETYPE |  | ||||||
|     // family for compatibility with the old code which used it instead of |  | ||||||
|     // IsFixedWidth() |  | ||||||
|     if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING).Upper() == _T('M') ) |  | ||||||
|     { |  | ||||||
|         m_family = wxFONTFAMILY_TELETYPE; |  | ||||||
|     } |  | ||||||
|     else // not monospaceed |  | ||||||
|     { |  | ||||||
|         // don't even try guessing it, it doesn't work for too many fonts |  | ||||||
|         // anyhow |  | ||||||
|         m_family = wxFONTFAMILY_UNKNOWN; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // X fonts are never underlined... |  | ||||||
|     m_underlined = FALSE; |  | ||||||
|  |  | ||||||
|     // deal with font encoding |  | ||||||
|     wxString |  | ||||||
|         registry = m_nativeFontInfo.GetXFontComponent(wxXLFD_REGISTRY).Upper(), |  | ||||||
|         encoding = m_nativeFontInfo.GetXFontComponent(wxXLFD_ENCODING).Upper(); |  | ||||||
|  |  | ||||||
|     if ( registry == _T("ISO8859") ) |  | ||||||
|     { |  | ||||||
|         int cp; |  | ||||||
|         if ( wxSscanf(encoding, wxT("%d"), &cp) == 1 ) |  | ||||||
|         { |  | ||||||
|             m_encoding = (wxFontEncoding)(wxFONTENCODING_ISO8859_1 + cp - 1); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     else if ( registry == _T("MICROSOFT") ) |  | ||||||
|     { |  | ||||||
|         int cp; |  | ||||||
|         if ( wxSscanf(encoding, wxT("cp125%d"), &cp) == 1 ) |  | ||||||
|         { |  | ||||||
|             m_encoding = (wxFontEncoding)(wxFONTENCODING_CP1250 + cp); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     else if ( registry == _T("KOI8") ) |  | ||||||
|     { |  | ||||||
|         m_encoding = wxFONTENCODING_KOI8; |  | ||||||
|     } |  | ||||||
|     else // unknown encoding |  | ||||||
|     { |  | ||||||
|         // may be give a warning here? or use wxFontMapper? |  | ||||||
|         m_encoding = wxFONTENCODING_SYSTEM; |  | ||||||
|     } |  | ||||||
| #endif // GTK 2.0/1.x |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxFontRefData::wxFontRefData( const wxFontRefData& data ) | wxFontRefData::wxFontRefData( const wxFontRefData& data ) | ||||||
| @@ -395,29 +263,13 @@ wxFontRefData::wxFontRefData(int size, int family, int style, | |||||||
|  |  | ||||||
| wxFontRefData::wxFontRefData(const wxString& fontname) | wxFontRefData::wxFontRefData(const wxString& fontname) | ||||||
| { | { | ||||||
|     // VZ: FromString() should really work in both cases, doesn't it? |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_nativeFontInfo.FromString( fontname ); |     m_nativeFontInfo.FromString( fontname ); | ||||||
| #else // GTK 1.x |  | ||||||
|     m_nativeFontInfo.SetXFontName(fontname); |  | ||||||
| #endif // GTK 2.0/1.x |  | ||||||
|  |  | ||||||
|     InitFromNative(); |     InitFromNative(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxFontRefData::ClearGdkFonts() | void wxFontRefData::ClearGdkFonts() | ||||||
| { | { | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     for ( wxScaledFontList::iterator i = m_scaled_xfonts.begin(); |  | ||||||
|           i != m_scaled_xfonts.end(); |  | ||||||
|           ++i ) |  | ||||||
|     { |  | ||||||
|         GdkFont *font = i->second; |  | ||||||
|         gdk_font_unref( font ); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     m_scaled_xfonts.clear(); |  | ||||||
| #endif // GTK 1.x |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxFontRefData::~wxFontRefData() | wxFontRefData::~wxFontRefData() | ||||||
| @@ -433,20 +285,7 @@ void wxFontRefData::SetPointSize(int pointSize) | |||||||
| { | { | ||||||
|     m_pointSize = pointSize; |     m_pointSize = pointSize; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_nativeFontInfo.SetPointSize(pointSize); |     m_nativeFontInfo.SetPointSize(pointSize); | ||||||
| #else |  | ||||||
|     if ( HasNativeFont() ) |  | ||||||
|     { |  | ||||||
|         wxString size; |  | ||||||
|         if ( pointSize == -1 ) |  | ||||||
|             size = _T('*'); |  | ||||||
|         else |  | ||||||
|             size.Printf(_T("%d"), 10*pointSize); |  | ||||||
|  |  | ||||||
|         m_nativeFontInfo.SetXFontComponent(wxXLFD_POINTSIZE, size); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxFontRefData::SetFamily(int family) | void wxFontRefData::SetFamily(int family) | ||||||
| @@ -460,67 +299,14 @@ void wxFontRefData::SetStyle(int style) | |||||||
| { | { | ||||||
|     m_style = style; |     m_style = style; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_nativeFontInfo.SetStyle((wxFontStyle)style); |     m_nativeFontInfo.SetStyle((wxFontStyle)style); | ||||||
| #else |  | ||||||
|     if ( HasNativeFont() ) |  | ||||||
|     { |  | ||||||
|         wxString slant; |  | ||||||
|         switch ( style ) |  | ||||||
|         { |  | ||||||
|             case wxFONTSTYLE_ITALIC: |  | ||||||
|                 slant = _T('i'); |  | ||||||
|                 break; |  | ||||||
|  |  | ||||||
|             case wxFONTSTYLE_SLANT: |  | ||||||
|                 slant = _T('o'); |  | ||||||
|                 break; |  | ||||||
|  |  | ||||||
|             default: |  | ||||||
|                 wxFAIL_MSG( _T("unknown font style") ); |  | ||||||
|                 // fall through |  | ||||||
|  |  | ||||||
|             case wxFONTSTYLE_NORMAL: |  | ||||||
|                 slant = _T('r'); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         m_nativeFontInfo.SetXFontComponent(wxXLFD_SLANT, slant); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxFontRefData::SetWeight(int weight) | void wxFontRefData::SetWeight(int weight) | ||||||
| { | { | ||||||
|     m_weight = weight; |     m_weight = weight; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_nativeFontInfo.SetWeight((wxFontWeight)weight); |     m_nativeFontInfo.SetWeight((wxFontWeight)weight); | ||||||
| #else //!__WXGTK20__ |  | ||||||
|     if ( HasNativeFont() ) |  | ||||||
|     { |  | ||||||
|         wxString boldness; |  | ||||||
|         switch ( weight ) |  | ||||||
|         { |  | ||||||
|             case wxFONTWEIGHT_BOLD: |  | ||||||
|                 boldness = _T("bold"); |  | ||||||
|                 break; |  | ||||||
|  |  | ||||||
|             case wxFONTWEIGHT_LIGHT: |  | ||||||
|                 boldness = _T("light"); |  | ||||||
|                 break; |  | ||||||
|  |  | ||||||
|             default: |  | ||||||
|                 wxFAIL_MSG( _T("unknown font weight") ); |  | ||||||
|                 // fall through |  | ||||||
|  |  | ||||||
|             case wxFONTWEIGHT_NORMAL: |  | ||||||
|                 // unspecified |  | ||||||
|                 boldness = _T("medium"); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         m_nativeFontInfo.SetXFontComponent(wxXLFD_WEIGHT, boldness); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxFontRefData::SetUnderlined(bool underlined) | void wxFontRefData::SetUnderlined(bool underlined) | ||||||
| @@ -534,31 +320,12 @@ void wxFontRefData::SetFaceName(const wxString& facename) | |||||||
| { | { | ||||||
|     m_faceName = facename; |     m_faceName = facename; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_nativeFontInfo.SetFaceName(facename); |     m_nativeFontInfo.SetFaceName(facename); | ||||||
| #else |  | ||||||
|     if ( HasNativeFont() ) |  | ||||||
|     { |  | ||||||
|         m_nativeFontInfo.SetXFontComponent(wxXLFD_FAMILY, facename); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxFontRefData::SetEncoding(wxFontEncoding encoding) | void wxFontRefData::SetEncoding(wxFontEncoding encoding) | ||||||
| { | { | ||||||
|     m_encoding = encoding; |     m_encoding = encoding; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     if ( HasNativeFont() ) |  | ||||||
|     { |  | ||||||
|         wxNativeEncodingInfo info; |  | ||||||
|         if ( wxGetNativeFontEncoding(encoding, &info) ) |  | ||||||
|         { |  | ||||||
|             m_nativeFontInfo.SetXFontComponent(wxXLFD_REGISTRY, info.xregistry); |  | ||||||
|             m_nativeFontInfo.SetXFontComponent(wxXLFD_ENCODING, info.xencoding); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo& info) | void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo& info) | ||||||
| @@ -586,7 +353,6 @@ wxFont::wxFont(const wxNativeFontInfo& info) | |||||||
| { | { | ||||||
|     Init(); |     Init(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     Create( info.GetPointSize(), |     Create( info.GetPointSize(), | ||||||
|             info.GetFamily(), |             info.GetFamily(), | ||||||
|             info.GetStyle(), |             info.GetStyle(), | ||||||
| @@ -594,9 +360,6 @@ wxFont::wxFont(const wxNativeFontInfo& info) | |||||||
|             info.GetUnderlined(), |             info.GetUnderlined(), | ||||||
|             info.GetFaceName(), |             info.GetFaceName(), | ||||||
|             info.GetEncoding() ); |             info.GetEncoding() ); | ||||||
| #else |  | ||||||
|     (void) Create(info.GetXFontName()); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| bool wxFont::Create( int pointSize, | bool wxFont::Create( int pointSize, | ||||||
| @@ -745,16 +508,6 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const | |||||||
| { | { | ||||||
|     wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") ); |     wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     if ( !M_FONTDATA->HasNativeFont() ) |  | ||||||
|     { |  | ||||||
|         // NB: this call has important side-effect: it not only finds |  | ||||||
|         //     GdkFont representation, it also initializes m_nativeFontInfo |  | ||||||
|         //     by calling its SetXFontName method |  | ||||||
|         GetInternalFont(); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return &(M_FONTDATA->m_nativeFontInfo); |     return &(M_FONTDATA->m_nativeFontInfo); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -762,17 +515,6 @@ bool wxFont::IsFixedWidth() const | |||||||
| { | { | ||||||
|     wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") ); |     wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     if ( M_FONTDATA->HasNativeFont() ) |  | ||||||
|     { |  | ||||||
|         // the monospace fonts are supposed to have "M" in the spacing field |  | ||||||
|         wxString spacing = M_FONTDATA-> |  | ||||||
|                             m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING); |  | ||||||
|  |  | ||||||
|         return spacing.Upper() == _T('M'); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return wxFontBase::IsFixedWidth(); |     return wxFontBase::IsFixedWidth(); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -842,102 +584,3 @@ void wxFont::SetNoAntiAliasing( bool no ) | |||||||
|  |  | ||||||
|     M_FONTDATA->SetNoAntiAliasing( no ); |     M_FONTDATA->SetNoAntiAliasing( no ); | ||||||
| } | } | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- |  | ||||||
| // get internal representation of font |  | ||||||
| // ---------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; |  | ||||||
|  |  | ||||||
| // this is also used from tbargtk.cpp and tooltip.cpp, hence extern |  | ||||||
| extern GdkFont *GtkGetDefaultGuiFont() |  | ||||||
| { |  | ||||||
|     if (!g_systemDefaultGuiFont) |  | ||||||
|     { |  | ||||||
|         GtkWidget *widget = gtk_button_new(); |  | ||||||
|         GtkStyle *def = gtk_rc_get_style( widget ); |  | ||||||
|         if (def) |  | ||||||
|         { |  | ||||||
|             g_systemDefaultGuiFont = gdk_font_ref( def->font ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             def = gtk_widget_get_default_style(); |  | ||||||
|             if (def) |  | ||||||
|                 g_systemDefaultGuiFont = gdk_font_ref( def->font ); |  | ||||||
|         } |  | ||||||
|         gtk_widget_destroy( widget ); |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         // already have it, but ref it once more before returning |  | ||||||
|         gdk_font_ref(g_systemDefaultGuiFont); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return g_systemDefaultGuiFont; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| GdkFont *wxFont::GetInternalFont( float scale ) const |  | ||||||
| { |  | ||||||
|     GdkFont *font = (GdkFont *) NULL; |  | ||||||
|  |  | ||||||
|     wxCHECK_MSG( Ok(), font, wxT("invalid font") ) |  | ||||||
|  |  | ||||||
|     long int_scale = long(scale * 100.0 + 0.5); // key for fontlist |  | ||||||
|     int point_scale = (int)((M_FONTDATA->m_pointSize * 10 * int_scale) / 100); |  | ||||||
|  |  | ||||||
|     wxScaledFontList& list = M_FONTDATA->m_scaled_xfonts; |  | ||||||
|     wxScaledFontList::iterator i = list.find(int_scale); |  | ||||||
|     if ( i != list.end() ) |  | ||||||
|     { |  | ||||||
|         font = i->second; |  | ||||||
|     } |  | ||||||
|     else // we don't have this font in this size yet |  | ||||||
|     { |  | ||||||
|         if (*this == wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT)) |  | ||||||
|         { |  | ||||||
|             font = GtkGetDefaultGuiFont(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if ( !font ) |  | ||||||
|         { |  | ||||||
|             // do we have the XLFD? |  | ||||||
|             if ( int_scale == 100 && M_FONTDATA->HasNativeFont() ) |  | ||||||
|             { |  | ||||||
|                 font = wxLoadFont(M_FONTDATA->m_nativeFontInfo.GetXFontName()); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             // no XLFD of no exact match - try the approximate one now |  | ||||||
|             if ( !font ) |  | ||||||
|             { |  | ||||||
|                 wxString xfontname; |  | ||||||
|                 font = wxLoadQueryNearestFont( point_scale, |  | ||||||
|                                                M_FONTDATA->m_family, |  | ||||||
|                                                M_FONTDATA->m_style, |  | ||||||
|                                                M_FONTDATA->m_weight, |  | ||||||
|                                                M_FONTDATA->m_underlined, |  | ||||||
|                                                M_FONTDATA->m_faceName, |  | ||||||
|                                                M_FONTDATA->m_encoding, |  | ||||||
|                                                &xfontname); |  | ||||||
|                 // NB: wxFont::GetNativeFontInfo relies on this |  | ||||||
|                 //     side-effect of GetInternalFont |  | ||||||
|                 if ( int_scale == 100 ) |  | ||||||
|                     M_FONTDATA->m_nativeFontInfo.SetXFontName(xfontname); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if ( font ) |  | ||||||
|         { |  | ||||||
|             list[int_scale] = font; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // it's quite useless to make it a wxCHECK because we're going to crash |  | ||||||
|     // anyhow... |  | ||||||
|     wxASSERT_MSG( font, wxT("could not load any font?") ); |  | ||||||
|  |  | ||||||
|     return font; |  | ||||||
| } |  | ||||||
| #endif  // not GTK 2.0 |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -69,17 +69,6 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial | |||||||
|  |  | ||||||
|     GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget); |     GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     GdkFont *gfont = gtk_font_selection_dialog_get_font(fontdlg); |  | ||||||
|  |  | ||||||
|     if (!gfont) |  | ||||||
|     { |  | ||||||
|         wxMessageBox(_("Please choose a valid font."), _("Error"), |  | ||||||
|                      wxOK | wxICON_ERROR); |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gchar *fontname = gtk_font_selection_dialog_get_font_name(fontdlg); |     gchar *fontname = gtk_font_selection_dialog_get_font_name(fontdlg); | ||||||
|     dialog->SetChosenFont( fontname); |     dialog->SetChosenFont( fontname); | ||||||
|  |  | ||||||
| @@ -138,19 +127,9 @@ bool wxFontDialog::DoCreate(wxWindow *parent) | |||||||
|     gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", |     gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", | ||||||
|       GTK_SIGNAL_FUNC(gtk_fontdialog_ok_callback), (gpointer*)this ); |       GTK_SIGNAL_FUNC(gtk_fontdialog_ok_callback), (gpointer*)this ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // strange way to internationalize |  | ||||||
|     gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->ok_button) ), _("OK") ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", |     gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", | ||||||
|       GTK_SIGNAL_FUNC(gtk_fontdialog_cancel_callback), (gpointer*)this ); |       GTK_SIGNAL_FUNC(gtk_fontdialog_cancel_callback), (gpointer*)this ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // strange way to internationalize |  | ||||||
|     gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->cancel_button) ), _("Cancel") ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", |     gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", | ||||||
|         GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this ); |         GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this ); | ||||||
|  |  | ||||||
| @@ -162,13 +141,7 @@ bool wxFontDialog::DoCreate(wxWindow *parent) | |||||||
|         if ( info ) |         if ( info ) | ||||||
|         { |         { | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             const wxString& fontname = info->ToString(); |             const wxString& fontname = info->ToString(); | ||||||
| #else |  | ||||||
|             const wxString& fontname = info->GetXFontName(); |  | ||||||
|             if ( !fontname ) |  | ||||||
|                 font.GetInternalFont(); |  | ||||||
| #endif |  | ||||||
|             gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname)); |             gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname)); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|   | |||||||
| @@ -251,26 +251,6 @@ gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_e | |||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
| // "draw" of m_wxwindow |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| extern "C" { |  | ||||||
| static void |  | ||||||
| gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win ) |  | ||||||
| { |  | ||||||
|     if (g_isIdle) |  | ||||||
|         wxapp_install_idle_handler(); |  | ||||||
|  |  | ||||||
|     win->m_exposed = TRUE; |  | ||||||
|  |  | ||||||
|     win->GetUpdateRegion().Union( rect->x, rect->y, |  | ||||||
|                                   rect->width, rect->height ); |  | ||||||
| } |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // "size_allocate" of m_wxwindow | // "size_allocate" of m_wxwindow | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -429,9 +409,7 @@ bool wxGLCanvas::Create( wxWindow *parent, | |||||||
|         m_glWidget = m_wxwindow; |         m_glWidget = m_wxwindow; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gtk_widget_set_double_buffered( m_glWidget, FALSE ); |     gtk_widget_set_double_buffered( m_glWidget, FALSE ); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); |     gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); | ||||||
|  |  | ||||||
| @@ -444,17 +422,10 @@ bool wxGLCanvas::Create( wxWindow *parent, | |||||||
|     gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", |     gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", | ||||||
|         GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this ); |         GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", |  | ||||||
|         GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", |     gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", | ||||||
|         GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); |         GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (gtk_check_version(2,2,0) != NULL) |     if (gtk_check_version(2,2,0) != NULL) | ||||||
| #endif |  | ||||||
|     { |     { | ||||||
|         gtk_widget_pop_visual(); |         gtk_widget_pop_visual(); | ||||||
|         gtk_widget_pop_colormap(); |         gtk_widget_pop_colormap(); | ||||||
|   | |||||||
| @@ -887,11 +887,7 @@ wxString wxListBox::GetRealLabel(GList *item) const | |||||||
|  |  | ||||||
|     wxString str; |     wxString str; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     str = wxGTK_CONV_BACK( gtk_label_get_text( label ) ); |     str = wxGTK_CONV_BACK( gtk_label_get_text( label ) ); | ||||||
| #else |  | ||||||
|     str = wxString( label->label ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if wxUSE_CHECKLISTBOX | #if wxUSE_CHECKLISTBOX | ||||||
|     // checklistboxes have "[<5B>] " prepended to their lables, remove it |     // checklistboxes have "[<5B>] " prepended to their lables, remove it | ||||||
|   | |||||||
							
								
								
									
										114
									
								
								src/gtk/menu.cpp
									
									
									
									
									
								
							
							
						
						
									
										114
									
								
								src/gtk/menu.cpp
									
									
									
									
									
								
							| @@ -44,11 +44,6 @@ | |||||||
| // we use normal item but with a special id for the menu title | // we use normal item but with a special id for the menu title | ||||||
| static const int wxGTK_TITLE_ID = -3; | static const int wxGTK_TITLE_ID = -3; | ||||||
|  |  | ||||||
| // defined in window.cpp |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     extern guint32 wxGtkTimeLastClick; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // idle system | // idle system | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -167,9 +162,6 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     m_menubar = gtk_menu_bar_new(); |     m_menubar = gtk_menu_bar_new(); | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     m_accel = gtk_accel_group_new(); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     if (style & wxMB_DOCKABLE) |     if (style & wxMB_DOCKABLE) | ||||||
|     { |     { | ||||||
| @@ -227,11 +219,6 @@ static void wxMenubarUnsetInvokingWindow( wxMenu *menu, wxWindow *win ) | |||||||
|     while (top_frame->GetParent() && !(top_frame->IsTopLevel())) |     while (top_frame->GetParent() && !(top_frame->IsTopLevel())) | ||||||
|         top_frame = top_frame->GetParent(); |         top_frame = top_frame->GetParent(); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // support for native hot keys |  | ||||||
|     gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); |     wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); | ||||||
|     while (node) |     while (node) | ||||||
|     { |     { | ||||||
| @@ -272,13 +259,6 @@ void wxMenuBar::SetInvokingWindow( wxWindow *win ) | |||||||
|     while (top_frame->GetParent() && !(top_frame->IsTopLevel())) |     while (top_frame->GetParent() && !(top_frame->IsTopLevel())) | ||||||
|         top_frame = top_frame->GetParent(); |         top_frame = top_frame->GetParent(); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // support for native key accelerators indicated by underscroes |  | ||||||
|     ACCEL_OBJECT *obj = ACCEL_OBJ_CAST(top_frame->m_widget); |  | ||||||
|     if ( !g_slist_find( ACCEL_OBJECTS(m_accel), obj ) ) |  | ||||||
|         gtk_accel_group_attach( m_accel, obj ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxMenuList::compatibility_iterator node = m_menus.GetFirst(); |     wxMenuList::compatibility_iterator node = m_menus.GetFirst(); | ||||||
|     while (node) |     while (node) | ||||||
|     { |     { | ||||||
| @@ -295,11 +275,6 @@ void wxMenuBar::UnsetInvokingWindow( wxWindow *win ) | |||||||
|     while (top_frame->GetParent() && !(top_frame->IsTopLevel())) |     while (top_frame->GetParent() && !(top_frame->IsTopLevel())) | ||||||
|         top_frame = top_frame->GetParent(); |         top_frame = top_frame->GetParent(); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // support for native key accelerators indicated by underscroes |  | ||||||
|     gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxMenuList::compatibility_iterator node = m_menus.GetFirst(); |     wxMenuList::compatibility_iterator node = m_menus.GetFirst(); | ||||||
|     while (node) |     while (node) | ||||||
|     { |     { | ||||||
| @@ -325,25 +300,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos) | |||||||
|     menu->SetTitle( str ); |     menu->SetTitle( str ); | ||||||
|  |  | ||||||
|     // The "m_owner" is the "menu item" |     // The "m_owner" is the "menu item" | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     menu->m_owner = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( str ) ); |     menu->m_owner = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( str ) ); | ||||||
| #else |  | ||||||
|     menu->m_owner = gtk_menu_item_new_with_label( wxGTK_CONV( str ) ); |  | ||||||
|     GtkLabel *label = GTK_LABEL( GTK_BIN(menu->m_owner)->child ); |  | ||||||
|     // set new text |  | ||||||
|     gtk_label_set_text( label, wxGTK_CONV( str ) ); |  | ||||||
|     // reparse key accel |  | ||||||
|     guint accel_key = gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( str ) ); |  | ||||||
|     if (accel_key != GDK_VoidSymbol) |  | ||||||
|     { |  | ||||||
|         gtk_widget_add_accelerator (menu->m_owner, |  | ||||||
|                                     "activate_item", |  | ||||||
|                                     m_accel, //gtk_menu_ensure_uline_accel_group(GTK_MENU(m_menubar)), |  | ||||||
|                                     accel_key, |  | ||||||
|                                     GDK_MOD1_MASK, |  | ||||||
|                                     GTK_ACCEL_LOCKED); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gtk_widget_show( menu->m_owner ); |     gtk_widget_show( menu->m_owner ); | ||||||
|  |  | ||||||
| @@ -774,7 +731,6 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text) | |||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         if ( *pc == wxT('\\')  ) |         if ( *pc == wxT('\\')  ) | ||||||
|         { |         { | ||||||
|             // GTK 2.0 escapes "xxx/xxx" to "xxx\/xxx" |             // GTK 2.0 escapes "xxx/xxx" to "xxx\/xxx" | ||||||
| @@ -782,7 +738,6 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text) | |||||||
|             label += *pc; |             label += *pc; | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         if ( (*pc == wxT('&')) && (*(pc+1) != wxT('&')) ) |         if ( (*pc == wxT('&')) && (*(pc+1) != wxT('&')) ) | ||||||
|         { |         { | ||||||
| @@ -823,16 +778,7 @@ void wxMenuItem::SetText( const wxString& str ) | |||||||
|         else |         else | ||||||
|             label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); |             label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         gtk_label_set_text_with_mnemonic( GTK_LABEL(label), wxGTK_CONV(m_text) ); |         gtk_label_set_text_with_mnemonic( GTK_LABEL(label), wxGTK_CONV(m_text) ); | ||||||
| #else |  | ||||||
|         // set new text |  | ||||||
|         gtk_label_set( label, wxGTK_CONV( m_text ) ); |  | ||||||
|  |  | ||||||
|         // reparse key accel |  | ||||||
|         (void)gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV(m_text) ); |  | ||||||
|         gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) ); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     guint accel_key; |     guint accel_key; | ||||||
| @@ -1013,25 +959,16 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) | |||||||
|     GtkWidget *menuItem; |     GtkWidget *menuItem; | ||||||
|  |  | ||||||
|     wxString text; |     wxString text; | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     GtkLabel* label; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     if ( mitem->IsSeparator() ) |     if ( mitem->IsSeparator() ) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         menuItem = gtk_separator_menu_item_new(); |         menuItem = gtk_separator_menu_item_new(); | ||||||
| #else |  | ||||||
|         // TODO |  | ||||||
|         menuItem = gtk_menu_item_new(); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|     else if (mitem->GetBitmap().Ok()) |     else if (mitem->GetBitmap().Ok()) | ||||||
|     { |     { | ||||||
|         text = mitem->GetText(); |         text = mitem->GetText(); | ||||||
|         const wxBitmap *bitmap = &mitem->GetBitmap(); |         const wxBitmap *bitmap = &mitem->GetBitmap(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         menuItem = gtk_image_menu_item_new_with_mnemonic( wxGTK_CONV( text ) ); |         menuItem = gtk_image_menu_item_new_with_mnemonic( wxGTK_CONV( text ) ); | ||||||
|  |  | ||||||
|         GtkWidget *image; |         GtkWidget *image; | ||||||
| @@ -1052,13 +989,6 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) | |||||||
|  |  | ||||||
|         gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(menuItem), image ); |         gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(menuItem), image ); | ||||||
|  |  | ||||||
| #else |  | ||||||
| 	// TODO |  | ||||||
|         wxUnusedVar(bitmap); |  | ||||||
|         menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) ); |  | ||||||
|         label = GTK_LABEL( GTK_BIN(menuItem)->child ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         m_prevRadio = NULL; |         m_prevRadio = NULL; | ||||||
|     } |     } | ||||||
|     else // a normal item |     else // a normal item | ||||||
| @@ -1070,14 +1000,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) | |||||||
|         { |         { | ||||||
|             case wxITEM_CHECK: |             case wxITEM_CHECK: | ||||||
|             { |             { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                 menuItem = gtk_check_menu_item_new_with_mnemonic( wxGTK_CONV( text ) ); |                 menuItem = gtk_check_menu_item_new_with_mnemonic( wxGTK_CONV( text ) ); | ||||||
| #else |  | ||||||
|                 menuItem = gtk_check_menu_item_new_with_label( wxGTK_CONV( text ) ); |  | ||||||
|                 label = GTK_LABEL( GTK_BIN(menuItem)->child ); |  | ||||||
|                 // set new text |  | ||||||
|                 gtk_label_set_text( label, wxGTK_CONV( text ) ); |  | ||||||
| #endif |  | ||||||
|                 m_prevRadio = NULL; |                 m_prevRadio = NULL; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
| @@ -1088,25 +1011,12 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) | |||||||
|                 if ( m_prevRadio == NULL ) |                 if ( m_prevRadio == NULL ) | ||||||
|                 { |                 { | ||||||
|                     // start of a new radio group |                     // start of a new radio group | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                     m_prevRadio = menuItem = gtk_radio_menu_item_new_with_mnemonic( group, wxGTK_CONV( text ) ); |                     m_prevRadio = menuItem = gtk_radio_menu_item_new_with_mnemonic( group, wxGTK_CONV( text ) ); | ||||||
| #else |  | ||||||
|                     m_prevRadio = menuItem = gtk_radio_menu_item_new_with_label( group, wxGTK_CONV( text ) ); |  | ||||||
|                     label = GTK_LABEL( GTK_BIN(menuItem)->child ); |  | ||||||
|                     // set new text |  | ||||||
|                     gtk_label_set_text( label, wxGTK_CONV( text ) ); |  | ||||||
| #endif |  | ||||||
|                 } |                 } | ||||||
|                 else // continue the radio group |                 else // continue the radio group | ||||||
|                 { |                 { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                     group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (m_prevRadio)); |                     group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (m_prevRadio)); | ||||||
|                     m_prevRadio = menuItem = gtk_radio_menu_item_new_with_mnemonic( group, wxGTK_CONV( text ) ); |                     m_prevRadio = menuItem = gtk_radio_menu_item_new_with_mnemonic( group, wxGTK_CONV( text ) ); | ||||||
| #else |  | ||||||
|                     group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (m_prevRadio)); |  | ||||||
|                     m_prevRadio = menuItem = gtk_radio_menu_item_new_with_label( group, wxGTK_CONV( text ) ); |  | ||||||
|                     label = GTK_LABEL( GTK_BIN(menuItem)->child ); |  | ||||||
| #endif |  | ||||||
|                 } |                 } | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
| @@ -1117,12 +1027,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) | |||||||
|  |  | ||||||
|             case wxITEM_NORMAL: |             case wxITEM_NORMAL: | ||||||
|             { |             { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                 menuItem = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( text ) ); |                 menuItem = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( text ) ); | ||||||
| #else |  | ||||||
|                 menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) ); |  | ||||||
|                 label = GTK_LABEL( GTK_BIN(menuItem)->child ); |  | ||||||
| #endif |  | ||||||
|                 m_prevRadio = NULL; |                 m_prevRadio = NULL; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
| @@ -1183,19 +1088,6 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) | |||||||
|                                 GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), |                                 GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), | ||||||
|                                 (gpointer)this ); |                                 (gpointer)this ); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|         guint accel_key = gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( text ) ); |  | ||||||
|         if (accel_key != GDK_VoidSymbol) |  | ||||||
|         { |  | ||||||
|             gtk_widget_add_accelerator (menuItem, |  | ||||||
|                                         "activate_item", |  | ||||||
|                                         gtk_menu_ensure_uline_accel_group(GTK_MENU(m_menu)), |  | ||||||
|                                         accel_key, |  | ||||||
|                                         GDK_MOD1_MASK, |  | ||||||
|                                         GTK_ACCEL_LOCKED); |  | ||||||
|         } |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     mitem->SetMenuItem(menuItem); |     mitem->SetMenuItem(menuItem); | ||||||
| @@ -1560,9 +1452,7 @@ void SetInvokingWindow( wxMenu *menu, wxWindow* win ) | |||||||
| extern "C" | extern "C" | ||||||
| void wxPopupMenuPositionCallback( GtkMenu *menu, | void wxPopupMenuPositionCallback( GtkMenu *menu, | ||||||
|                                   gint *x, gint *y, |                                   gint *x, gint *y, | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                                   gboolean * WXUNUSED(whatever), |                                   gboolean * WXUNUSED(whatever), | ||||||
| #endif |  | ||||||
|                                   gpointer user_data ) |                                   gpointer user_data ) | ||||||
| { | { | ||||||
|     // ensure that the menu appears entirely on screen |     // ensure that the menu appears entirely on screen | ||||||
| @@ -1626,11 +1516,7 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) | |||||||
|                   posfunc,                      // function to position it |                   posfunc,                      // function to position it | ||||||
|                   userdata,                     // client data |                   userdata,                     // client data | ||||||
|                   0,                            // button used to activate it |                   0,                            // button used to activate it | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                   gtk_get_current_event_time() |                   gtk_get_current_event_time() | ||||||
| #else |  | ||||||
|                   wxGtkTimeLastClick            // the time of activation |  | ||||||
| #endif |  | ||||||
|                 ); |                 ); | ||||||
|  |  | ||||||
|     while (is_waiting) |     while (is_waiting) | ||||||
|   | |||||||
| @@ -108,54 +108,6 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g | |||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
| // "draw" of m_mainWidget |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| extern "C" { |  | ||||||
| static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win ) |  | ||||||
| { |  | ||||||
|     if (g_isIdle) wxapp_install_idle_handler(); |  | ||||||
|  |  | ||||||
|     if (!win->m_hasVMT) return; |  | ||||||
|  |  | ||||||
|     GtkPizza *pizza = GTK_PIZZA(widget); |  | ||||||
|  |  | ||||||
|     gtk_draw_shadow( widget->style, |  | ||||||
|                      pizza->bin_window, |  | ||||||
|                      GTK_STATE_NORMAL, |  | ||||||
|                      GTK_SHADOW_OUT, |  | ||||||
|                      0, 0, |  | ||||||
|                      win->m_width, win->m_height ); |  | ||||||
|  |  | ||||||
|     if (!win->GetTitle().empty() && |  | ||||||
|         ((win->GetWindowStyle() & wxCAPTION) || |  | ||||||
|          (win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) || |  | ||||||
|          (win->GetWindowStyle() & wxTINY_CAPTION_VERT))) |  | ||||||
|     { |  | ||||||
|         wxClientDC dc(win); |  | ||||||
|         dc.SetFont( *wxSMALL_FONT ); |  | ||||||
|         int height = dc.GetCharHeight(); |  | ||||||
|  |  | ||||||
|         GdkGC *gc = gdk_gc_new( pizza->bin_window ); |  | ||||||
|         gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] ); |  | ||||||
|         gdk_draw_rectangle( pizza->bin_window, gc, TRUE, |  | ||||||
|                             3, |  | ||||||
|                             3, |  | ||||||
|                             win->m_width - 7, |  | ||||||
|                             height+1 ); |  | ||||||
|         gdk_gc_unref( gc ); |  | ||||||
|  |  | ||||||
|         // Hack alert |  | ||||||
|         dc.m_window = pizza->bin_window; |  | ||||||
|         dc.SetTextForeground( *wxWHITE ); |  | ||||||
|         dc.DrawText( win->GetTitle(), 6, 3 ); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // "button_press_event" of m_mainWidget | // "button_press_event" of m_mainWidget | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -379,11 +331,6 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title | |||||||
|     gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event", |     gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event", | ||||||
|         GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this ); |         GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw", |  | ||||||
|        GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     /* these are required for dragging the mini frame around */ |     /* these are required for dragging the mini frame around */ | ||||||
|     gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event", |     gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event", | ||||||
|       GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this ); |       GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this ); | ||||||
| @@ -401,11 +348,7 @@ void wxMiniFrame::SetTitle( const wxString &title ) | |||||||
| { | { | ||||||
|     wxFrame::SetTitle( title ); |     wxFrame::SetTitle( title ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gdk_window_invalidate_rect( GTK_PIZZA(m_mainWidget)->bin_window, NULL, true ); |     gdk_window_invalidate_rect( GTK_PIZZA(m_mainWidget)->bin_window, NULL, true ); | ||||||
| #else |  | ||||||
|     gtk_widget_draw( m_mainWidget, (GdkRectangle*) NULL ); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -738,23 +738,17 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const | |||||||
|     const size_t count = GetPageCount(); |     const size_t count = GetPageCount(); | ||||||
|     size_t i = 0; |     size_t i = 0; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     GtkNotebook * notebook = GTK_NOTEBOOK(m_widget); |     GtkNotebook * notebook = GTK_NOTEBOOK(m_widget); | ||||||
|     if (gtk_notebook_get_scrollable(notebook)); |     if (gtk_notebook_get_scrollable(notebook)); | ||||||
|         i = g_list_position( notebook->children, notebook->first_tab ); |         i = g_list_position( notebook->children, notebook->first_tab ); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     for ( ; i < count; i++ ) |     for ( ; i < count; i++ ) | ||||||
|     { |     { | ||||||
|         wxGtkNotebookPage* nb_page = GetNotebookPage(i); |         wxGtkNotebookPage* nb_page = GetNotebookPage(i); | ||||||
|         GtkWidget *box = nb_page->m_box; |         GtkWidget *box = nb_page->m_box; | ||||||
|  |  | ||||||
|         // VZ: don't know how to find the border width in GTK+ 1.2 |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         const gint border = gtk_container_get_border_width(GTK_CONTAINER(box)); |         const gint border = gtk_container_get_border_width(GTK_CONTAINER(box)); | ||||||
| #else // !GTK+ 2.x |  | ||||||
|         const gint border = 0; |  | ||||||
| #endif |  | ||||||
|         if ( IsPointInsideWidget(pt, box, x, y, border) ) |         if ( IsPointInsideWidget(pt, box, x, y, border) ) | ||||||
|         { |         { | ||||||
|             // ok, we're inside this tab -- now find out where, if needed |             // ok, we're inside this tab -- now find out where, if needed | ||||||
|   | |||||||
| @@ -385,11 +385,7 @@ wxString wxRadioBox::GetString( int n ) const | |||||||
|  |  | ||||||
|     GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) ); |     GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); |     wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); | ||||||
| #else |  | ||||||
|     wxString str( label->label ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return str; |     return str; | ||||||
| } | } | ||||||
| @@ -528,10 +524,7 @@ void wxRadioBox::GtkEnableEvents() | |||||||
| void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) | void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) | ||||||
| { | { | ||||||
|     gtk_widget_modify_style( m_widget, style ); |     gtk_widget_modify_style( m_widget, style ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); |     gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxList::compatibility_iterator node = m_boxes.GetFirst(); |     wxList::compatibility_iterator node = m_boxes.GetFirst(); | ||||||
|     while (node) |     while (node) | ||||||
|   | |||||||
| @@ -23,25 +23,6 @@ | |||||||
| #include "wx/log.h" | #include "wx/log.h" | ||||||
| #include "wx/gtk/private.h" | #include "wx/gtk/private.h" | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- |  | ||||||
| // wxGdkRegion: creates a new region in ctor and destroys in dtor |  | ||||||
| // ---------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| class wxGdkRegion |  | ||||||
| { |  | ||||||
| public: |  | ||||||
|     wxGdkRegion() { m_region = gdk_region_new(); } |  | ||||||
|     ~wxGdkRegion() { gdk_region_destroy(m_region); } |  | ||||||
|  |  | ||||||
|     operator GdkRegion *() const { return m_region; } |  | ||||||
|  |  | ||||||
| private: |  | ||||||
|     GdkRegion *m_region; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| // wxRegionRefData: private class containing the information about the region | // wxRegionRefData: private class containing the information about the region | ||||||
| @@ -58,11 +39,7 @@ public: | |||||||
|     wxRegionRefData(const wxRegionRefData& refData) |     wxRegionRefData(const wxRegionRefData& refData) | ||||||
|         : wxObjectRefData() |         : wxObjectRefData() | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         m_region = gdk_region_copy(refData.m_region); |         m_region = gdk_region_copy(refData.m_region); | ||||||
| #else |  | ||||||
|         m_region = gdk_regions_union(wxGdkRegion(), refData.m_region); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ~wxRegionRefData() |     ~wxRegionRefData() | ||||||
| @@ -100,21 +77,13 @@ void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) | |||||||
|  |  | ||||||
|     m_refData = new wxRegionRefData(); |     m_refData = new wxRegionRefData(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     M_REGIONDATA->m_region = gdk_region_rectangle( &rect ); |     M_REGIONDATA->m_region = gdk_region_rectangle( &rect ); | ||||||
| #else |  | ||||||
|     M_REGIONDATA->m_region = gdk_region_union_with_rect( wxGdkRegion(), &rect ); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxRegion::wxRegion( GdkRegion *region ) | wxRegion::wxRegion( GdkRegion *region ) | ||||||
| { | { | ||||||
|     m_refData = new wxRegionRefData(); |     m_refData = new wxRegionRefData(); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     M_REGIONDATA->m_region = gdk_region_copy( region ); |     M_REGIONDATA->m_region = gdk_region_copy( region ); | ||||||
| #else |  | ||||||
|     M_REGIONDATA->m_region = gdk_regions_union(wxGdkRegion(), region); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle ) | wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle ) | ||||||
| @@ -202,13 +171,7 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) | |||||||
|         rect.width = width; |         rect.width = width; | ||||||
|         rect.height = height; |         rect.height = height; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); |         gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); | ||||||
| #else |  | ||||||
|         GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); |  | ||||||
|         gdk_region_destroy( M_REGIONDATA->m_region ); |  | ||||||
|         M_REGIONDATA->m_region = reg; |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| @@ -234,13 +197,7 @@ bool wxRegion::Union( const wxRegion& region ) | |||||||
|         AllocExclusive(); |         AllocExclusive(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() ); |     gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() ); | ||||||
| #else |  | ||||||
|     GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() ); |  | ||||||
|     gdk_region_destroy( M_REGIONDATA->m_region ); |  | ||||||
|     M_REGIONDATA->m_region = reg; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| @@ -272,13 +229,7 @@ bool wxRegion::Intersect( const wxRegion& region ) | |||||||
|  |  | ||||||
|     AllocExclusive(); |     AllocExclusive(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() ); |     gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() ); | ||||||
| #else |  | ||||||
|     GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() ); |  | ||||||
|     gdk_region_destroy( M_REGIONDATA->m_region ); |  | ||||||
|     M_REGIONDATA->m_region = reg; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| @@ -308,13 +259,7 @@ bool wxRegion::Subtract( const wxRegion& region ) | |||||||
|  |  | ||||||
|     AllocExclusive(); |     AllocExclusive(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() ); |     gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() ); | ||||||
| #else |  | ||||||
|     GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() ); |  | ||||||
|     gdk_region_destroy( M_REGIONDATA->m_region ); |  | ||||||
|     M_REGIONDATA->m_region = reg; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| @@ -343,13 +288,7 @@ bool wxRegion::Xor( const wxRegion& region ) | |||||||
|  |  | ||||||
|     AllocExclusive(); |     AllocExclusive(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); |     gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); | ||||||
| #else |  | ||||||
|     GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() ); |  | ||||||
|     gdk_region_destroy( M_REGIONDATA->m_region ); |  | ||||||
|     M_REGIONDATA->m_region = reg; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| @@ -458,27 +397,6 @@ GdkRegion *wxRegion::GetRegion() const | |||||||
| // wxRegionIterator | // wxRegionIterator | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| // the following structures must match the private structures |  | ||||||
| // in X11 region code ( xc/lib/X11/region.h ) |  | ||||||
|  |  | ||||||
| // this makes the Region type transparent |  | ||||||
| // and we have access to the region rectangles |  | ||||||
|  |  | ||||||
| #include <gdk/gdkprivate.h> |  | ||||||
|  |  | ||||||
| struct _XBox { |  | ||||||
|     short x1, x2, y1, y2; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| struct _XRegion { |  | ||||||
|     long   size , numRects; |  | ||||||
|     _XBox *rects, extents; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #endif // GTK+ 1.x |  | ||||||
|  |  | ||||||
| class wxRIRefData: public wxObjectRefData | class wxRIRefData: public wxObjectRefData | ||||||
| { | { | ||||||
| public: | public: | ||||||
| @@ -508,7 +426,6 @@ void wxRIRefData::CreateRects( const wxRegion& region ) | |||||||
|     if (!gdkregion) |     if (!gdkregion) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     GdkRectangle *gdkrects = NULL; |     GdkRectangle *gdkrects = NULL; | ||||||
|     gint numRects = 0; |     gint numRects = 0; | ||||||
|     gdk_region_get_rectangles( gdkregion, &gdkrects, &numRects ); |     gdk_region_get_rectangles( gdkregion, &gdkrects, &numRects ); | ||||||
| @@ -528,26 +445,6 @@ void wxRIRefData::CreateRects( const wxRegion& region ) | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     g_free( gdkrects ); |     g_free( gdkrects ); | ||||||
| #else // GTK+ 1.x |  | ||||||
|     Region r = ((GdkRegionPrivate *)gdkregion)->xregion; |  | ||||||
|     if (r) |  | ||||||
|     { |  | ||||||
|         m_numRects = r->numRects; |  | ||||||
|         if (m_numRects) |  | ||||||
|         { |  | ||||||
|             m_rects = new wxRect[m_numRects]; |  | ||||||
|             for (size_t i=0; i < m_numRects; ++i) |  | ||||||
|             { |  | ||||||
|                 _XBox &xr = r->rects[i]; |  | ||||||
|                 wxRect &wr = m_rects[i]; |  | ||||||
|                 wr.x = xr.x1; |  | ||||||
|                 wr.y = xr.y1; |  | ||||||
|                 wr.width = xr.x2-xr.x1; |  | ||||||
|                 wr.height = xr.y2-xr.y1; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #endif // GTK+ 2.0/1.x |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxRegionIterator::wxRegionIterator() | wxRegionIterator::wxRegionIterator() | ||||||
|   | |||||||
| @@ -31,16 +31,7 @@ | |||||||
| #include "wx/window.h" | #include "wx/window.h" | ||||||
| #include "wx/dc.h" | #include "wx/dc.h" | ||||||
| #include "wx/dcclient.h" | #include "wx/dcclient.h" | ||||||
|  | #include "wx/settings.h" | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     #include "wx/settings.h" |  | ||||||
| #endif // GTK 2.0 |  | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     #define WXUNUSED_IN_GTK1(arg) arg |  | ||||||
| #else |  | ||||||
|     #define WXUNUSED_IN_GTK1(arg) |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| // RR: After a correction to the orientation of the sash | // RR: After a correction to the orientation of the sash | ||||||
| //     this doesn't seem to be required anymore and it | //     this doesn't seem to be required anymore and it | ||||||
| @@ -60,13 +51,11 @@ public: | |||||||
|                                   const wxRect& rect, |                                   const wxRect& rect, | ||||||
|                                   int flags = 0); |                                   int flags = 0); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // draw the expanded/collapsed icon for a tree control item |     // draw the expanded/collapsed icon for a tree control item | ||||||
|     virtual void DrawTreeItemButton(wxWindow *win, |     virtual void DrawTreeItemButton(wxWindow *win, | ||||||
|                                     wxDC& dc, |                                     wxDC& dc, | ||||||
|                                     const wxRect& rect, |                                     const wxRect& rect, | ||||||
|                                     int flags = 0); |                                     int flags = 0); | ||||||
| #endif // GTK+ 2.0 |  | ||||||
|  |  | ||||||
|     virtual void DrawSplitterBorder(wxWindow *win, |     virtual void DrawSplitterBorder(wxWindow *win, | ||||||
|                                     wxDC& dc, |                                     wxDC& dc, | ||||||
| @@ -97,10 +86,8 @@ private: | |||||||
|     // used by DrawHeaderButton and DrawComboBoxDropButton |     // used by DrawHeaderButton and DrawComboBoxDropButton | ||||||
|     static GtkWidget *GetButtonWidget(); |     static GtkWidget *GetButtonWidget(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // used by DrawTreeItemButton() |     // used by DrawTreeItemButton() | ||||||
|     static GtkWidget *GetTreeWidget(); |     static GtkWidget *GetTreeWidget(); | ||||||
| #endif // GTK+ 2.0 |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // ============================================================================ | // ============================================================================ | ||||||
| @@ -137,8 +124,6 @@ wxRendererGTK::GetButtonWidget() | |||||||
|     return s_button; |     return s_button; | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|  |  | ||||||
| GtkWidget * | GtkWidget * | ||||||
| wxRendererGTK::GetTreeWidget() | wxRendererGTK::GetTreeWidget() | ||||||
| { | { | ||||||
| @@ -157,8 +142,6 @@ wxRendererGTK::GetTreeWidget() | |||||||
|     return s_tree; |     return s_tree; | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif // GTK+ 2.0 |  | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| // list/tree controls drawing | // list/tree controls drawing | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| @@ -187,8 +170,6 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, | |||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|  |  | ||||||
| // draw a ">" or "v" button | // draw a ">" or "v" button | ||||||
| void | void | ||||||
| wxRendererGTK::DrawTreeItemButton(wxWindow* win, | wxRendererGTK::DrawTreeItemButton(wxWindow* win, | ||||||
| @@ -219,23 +200,13 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win, | |||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif // GTK+ 2.0 |  | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| // splitter sash drawing | // splitter sash drawing | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // the full sash width (should be even) |  | ||||||
|     static const wxCoord SASH_SIZE = 8; |  | ||||||
|  |  | ||||||
|     // margin around the sash |  | ||||||
|     static const wxCoord SASH_MARGIN = 2; |  | ||||||
| #endif // GTK+ 2.x/1.x |  | ||||||
|  |  | ||||||
| static int GetGtkSplitterFullSize() | static int GetGtkSplitterFullSize() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     static GtkWidget *s_paned = NULL; |     static GtkWidget *s_paned = NULL; | ||||||
|     if (s_paned == NULL) |     if (s_paned == NULL) | ||||||
|         s_paned = gtk_vpaned_new(); |         s_paned = gtk_vpaned_new(); | ||||||
| @@ -244,9 +215,6 @@ static int GetGtkSplitterFullSize() | |||||||
|     gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL); |     gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL); | ||||||
|  |  | ||||||
|     return handle_size; |     return handle_size; | ||||||
| #else |  | ||||||
|     return SASH_SIZE + SASH_MARGIN; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxSplitterRenderParams | wxSplitterRenderParams | ||||||
| @@ -257,11 +225,7 @@ wxRendererGTK::GetSplitterParams(const wxWindow *WXUNUSED(win)) | |||||||
|            ( |            ( | ||||||
|                GetGtkSplitterFullSize(), |                GetGtkSplitterFullSize(), | ||||||
|                0, |                0, | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                true     // hot sensitive |                true     // hot sensitive | ||||||
| #else // GTK+ 1.x |  | ||||||
|                false    // not |  | ||||||
| #endif // GTK+ 2.x/1.x |  | ||||||
|            ); |            ); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -280,7 +244,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win, | |||||||
|                                 const wxSize& size, |                                 const wxSize& size, | ||||||
|                                 wxCoord position, |                                 wxCoord position, | ||||||
|                                 wxOrientation orient, |                                 wxOrientation orient, | ||||||
|                                 int WXUNUSED_IN_GTK1(flags)) |                                 int flags) | ||||||
| { | { | ||||||
|     if ( !win->m_wxwindow->window ) |     if ( !win->m_wxwindow->window ) | ||||||
|     { |     { | ||||||
| @@ -350,7 +314,6 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win, | |||||||
|     ); |     ); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gtk_paint_handle |     gtk_paint_handle | ||||||
|     ( |     ( | ||||||
|         win->m_wxwindow->style, |         win->m_wxwindow->style, | ||||||
| @@ -366,45 +329,6 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win, | |||||||
|         rect.height, |         rect.height, | ||||||
|         isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL |         isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL | ||||||
|     ); |     ); | ||||||
| #else // GTK+ 1.x |  | ||||||
|  |  | ||||||
|     // leave some margin before sash itself |  | ||||||
|     position += SASH_MARGIN / 2; |  | ||||||
|  |  | ||||||
|     // and finally draw it using GTK paint functions |  | ||||||
|     typedef void (*GtkPaintLineFunc)(GtkStyle *, GdkWindow *, |  | ||||||
|                                                 GtkStateType, |  | ||||||
|                                                 GdkRectangle *, GtkWidget *, |  | ||||||
|                                                 gchar *, |  | ||||||
|                                                 gint, gint, gint); |  | ||||||
|  |  | ||||||
|     GtkPaintLineFunc func = isVert ? gtk_paint_vline : gtk_paint_hline; |  | ||||||
|  |  | ||||||
|     (*func) |  | ||||||
|     ( |  | ||||||
|         win->m_wxwindow->style, |  | ||||||
|         GTK_PIZZA(win->m_wxwindow)->bin_window, |  | ||||||
|         GTK_STATE_NORMAL, |  | ||||||
|         NULL, |  | ||||||
|         win->m_wxwindow, |  | ||||||
|         (char *)"paned", // const_cast |  | ||||||
|         0, isVert ? size.y : size.x, position + SASH_SIZE / 2 - 1 |  | ||||||
|     ); |  | ||||||
|  |  | ||||||
|     gtk_paint_box |  | ||||||
|     ( |  | ||||||
|         win->m_wxwindow->style, |  | ||||||
|         GTK_PIZZA(win->m_wxwindow)->bin_window, |  | ||||||
|         GTK_STATE_NORMAL, |  | ||||||
|         GTK_SHADOW_OUT, |  | ||||||
|         (GdkRectangle*) NULL, |  | ||||||
|         win->m_wxwindow, |  | ||||||
|         (char *)"paned", // const_cast |  | ||||||
|         isVert ? position : size.x - 2*SASH_SIZE, |  | ||||||
|         isVert ? size.y - 2*SASH_SIZE : position, |  | ||||||
|         SASH_SIZE, SASH_SIZE |  | ||||||
|     ); |  | ||||||
| #endif // GTK+ 2.x/1.x |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
|   | |||||||
| @@ -118,11 +118,6 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, | |||||||
|             g_currentUpDownEvent = wxEVT_SCROLL_LINEUP; |             g_currentUpDownEvent = wxEVT_SCROLL_LINEUP; | ||||||
|       } |       } | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // There is no slider field any more |  | ||||||
|     win->m_isScrolling = (gdk_event->window == widget->slider); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| } | } | ||||||
| @@ -344,14 +339,7 @@ void wxScrollBar::SetViewLength( int viewLength ) | |||||||
| bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window ) | bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window ) | ||||||
| { | { | ||||||
|     GtkRange *range = GTK_RANGE(m_widget); |     GtkRange *range = GTK_RANGE(m_widget); | ||||||
|     return ( (window == GTK_WIDGET(range)->window) |     return ( (window == GTK_WIDGET(range)->window) ); | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|                 || (window == range->trough) |  | ||||||
|                 || (window == range->slider) |  | ||||||
|                 || (window == range->step_forw) |  | ||||||
|                 || (window == range->step_back) |  | ||||||
| #endif // GTK+ 1.x |  | ||||||
|            ); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxSize wxScrollBar::DoGetBestSize() const | wxSize wxScrollBar::DoGetBestSize() const | ||||||
|   | |||||||
| @@ -344,7 +344,6 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) | |||||||
|         { |         { | ||||||
|             if (!gs_objects.m_fontSystem.Ok()) |             if (!gs_objects.m_fontSystem.Ok()) | ||||||
|             { |             { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                 GtkWidget *widget = gtk_button_new(); |                 GtkWidget *widget = gtk_button_new(); | ||||||
|                 GtkStyle *def = gtk_rc_get_style( widget ); |                 GtkStyle *def = gtk_rc_get_style( widget ); | ||||||
|                 if ( !def || !def->font_desc ) |                 if ( !def || !def->font_desc ) | ||||||
| @@ -371,9 +370,6 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) | |||||||
|                     g_free (font_name); |                     g_free (font_name); | ||||||
|                 } |                 } | ||||||
|                 gtk_widget_destroy( widget ); |                 gtk_widget_destroy( widget ); | ||||||
| #else |  | ||||||
|                 gs_objects.m_fontSystem = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); |  | ||||||
| #endif |  | ||||||
|             } |             } | ||||||
|             return gs_objects.m_fontSystem; |             return gs_objects.m_fontSystem; | ||||||
|         } |         } | ||||||
| @@ -385,18 +381,15 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) | |||||||
|  |  | ||||||
| int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     bool success = false; |     bool success = false; | ||||||
|  |  | ||||||
|     guchar *data = NULL; |     guchar *data = NULL; | ||||||
|     GdkWindow *window = NULL; |     GdkWindow *window = NULL; | ||||||
|     if(win && GTK_WIDGET_REALIZED(win->GetHandle())) |     if(win && GTK_WIDGET_REALIZED(win->GetHandle())) | ||||||
|         window = win->GetHandle()->window; |         window = win->GetHandle()->window; | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     switch (index) |     switch (index) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         case wxSYS_BORDER_X: |         case wxSYS_BORDER_X: | ||||||
|         case wxSYS_BORDER_Y: |         case wxSYS_BORDER_Y: | ||||||
|         case wxSYS_EDGE_X: |         case wxSYS_EDGE_X: | ||||||
| @@ -484,7 +477,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             return -1; // no window specified |             return -1; // no window specified | ||||||
| #endif // gtk2 |  | ||||||
|  |  | ||||||
|         case wxSYS_CURSOR_X: |         case wxSYS_CURSOR_X: | ||||||
|         case wxSYS_CURSOR_Y: |         case wxSYS_CURSOR_Y: | ||||||
| @@ -500,7 +492,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | |||||||
| #endif | #endif | ||||||
|                 return 16; |                 return 16; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         case wxSYS_DCLICK_X: |         case wxSYS_DCLICK_X: | ||||||
|         case wxSYS_DCLICK_Y: |         case wxSYS_DCLICK_Y: | ||||||
|             gint dclick_distance; |             gint dclick_distance; | ||||||
| @@ -514,9 +505,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | |||||||
|                                 "gtk-double-click-distance", &dclick_distance, NULL); |                                 "gtk-double-click-distance", &dclick_distance, NULL); | ||||||
|  |  | ||||||
|             return dclick_distance * 2; |             return dclick_distance * 2; | ||||||
| #endif // gtk2 |  | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         case wxSYS_DRAG_X: |         case wxSYS_DRAG_X: | ||||||
|         case wxSYS_DRAG_Y: |         case wxSYS_DRAG_Y: | ||||||
|             gint drag_threshold; |             gint drag_threshold; | ||||||
| @@ -536,7 +525,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             return drag_threshold * 2; |             return drag_threshold * 2; | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         // MBN: ditto for icons |         // MBN: ditto for icons | ||||||
|         case wxSYS_ICON_X:     return 32; |         case wxSYS_ICON_X:     return 32; | ||||||
| @@ -561,8 +549,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | |||||||
|         case wxSYS_HSCROLL_Y:  return 15; |         case wxSYS_HSCROLL_Y:  return 15; | ||||||
|         case wxSYS_VSCROLL_X:  return 15; |         case wxSYS_VSCROLL_X:  return 15; | ||||||
|  |  | ||||||
| // a gtk1 implementation should be possible too if gtk2 efficiency/convenience functions aren't used |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         case wxSYS_CAPTION_Y: |         case wxSYS_CAPTION_Y: | ||||||
|             if (!window) |             if (!window) | ||||||
|                 // No realized window specified, and no implementation for that case yet. |                 // No realized window specified, and no implementation for that case yet. | ||||||
| @@ -635,7 +621,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) | |||||||
|             // ... |             // ... | ||||||
|  |  | ||||||
|             return -1; |             return -1; | ||||||
| #endif // gtk2 |  | ||||||
|  |  | ||||||
|         case wxSYS_PENWINDOWS_PRESENT: |         case wxSYS_PENWINDOWS_PRESENT: | ||||||
|             // No MS Windows for Pen computing extension available in X11 based gtk+. |             // No MS Windows for Pen computing extension available in X11 based gtk+. | ||||||
|   | |||||||
| @@ -93,7 +93,6 @@ static void gtk_slider_callback( GtkAdjustment *adjust, | |||||||
|         return; |         return; | ||||||
|  |  | ||||||
|     wxEventType evtType; |     wxEventType evtType; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if ( win->m_isScrolling ) |     if ( win->m_isScrolling ) | ||||||
|         evtType = wxEVT_SCROLL_THUMBTRACK; |         evtType = wxEVT_SCROLL_THUMBTRACK; | ||||||
|     // it could seem that UP/DOWN are inversed but this is what wxMSW does |     // it could seem that UP/DOWN are inversed but this is what wxMSW does | ||||||
| @@ -109,9 +108,6 @@ static void gtk_slider_callback( GtkAdjustment *adjust, | |||||||
|         evtType = wxEVT_SCROLL_TOP; |         evtType = wxEVT_SCROLL_TOP; | ||||||
|     else if ( AreSameAdjustValues(adjust->value, adjust->upper) ) |     else if ( AreSameAdjustValues(adjust->value, adjust->upper) ) | ||||||
|         evtType = wxEVT_SCROLL_BOTTOM; |         evtType = wxEVT_SCROLL_BOTTOM; | ||||||
| #else |  | ||||||
|     evtType = GtkScrollTypeToWx(GET_SCROLL_TYPE(win->m_widget)); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     ProcessScrollEvent(win, evtType, dvalue); |     ProcessScrollEvent(win, evtType, dvalue); | ||||||
|  |  | ||||||
| @@ -202,10 +198,8 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, | |||||||
|  |  | ||||||
|     m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) ); |     m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (style & wxSL_INVERSE) |     if (style & wxSL_INVERSE) | ||||||
|         gtk_range_set_inverted( GTK_RANGE(m_widget), TRUE ); |         gtk_range_set_inverted( GTK_RANGE(m_widget), TRUE ); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     GtkEnableEvents(); |     GtkEnableEvents(); | ||||||
|     gtk_signal_connect( GTK_OBJECT(m_widget), |     gtk_signal_connect( GTK_OBJECT(m_widget), | ||||||
| @@ -333,15 +327,7 @@ int wxSlider::GetLineSize() const | |||||||
| bool wxSlider::IsOwnGtkWindow( GdkWindow *window ) | bool wxSlider::IsOwnGtkWindow( GdkWindow *window ) | ||||||
| { | { | ||||||
|     GtkRange *range = GTK_RANGE(m_widget); |     GtkRange *range = GTK_RANGE(m_widget); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return (range->event_window == window); |     return (range->event_window == window); | ||||||
| #else |  | ||||||
|     return ( (window == GTK_WIDGET(range)->window) |  | ||||||
|                 || (window == range->trough) |  | ||||||
|                 || (window == range->slider) |  | ||||||
|                 || (window == range->step_forw) |  | ||||||
|                 || (window == range->step_back) ); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxSlider::GtkDisableEvents() | void wxSlider::GtkDisableEvents() | ||||||
|   | |||||||
| @@ -34,15 +34,6 @@ wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap | |||||||
|     Create( parent, id, bitmap, pos, size, style, name ); |     Create( parent, id, bitmap, pos, size, style, name ); | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| // empty bitmap, so that we can create GtkPixmap widget: |  | ||||||
| static char * bogus_xpm[] = { |  | ||||||
| "2 2 1 1", |  | ||||||
| " 	c None", |  | ||||||
| "  ", |  | ||||||
| "  "}; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, | bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, | ||||||
|                              const wxPoint &pos, const wxSize &size, |                              const wxPoint &pos, const wxSize &size, | ||||||
|                              long style, const wxString &name ) |                              long style, const wxString &name ) | ||||||
| @@ -58,12 +49,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi | |||||||
|  |  | ||||||
|     m_bitmap = bitmap; |     m_bitmap = bitmap; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_widget = gtk_image_new(); |     m_widget = gtk_image_new(); | ||||||
| #else |  | ||||||
|     wxBitmap bmp(bitmap.Ok() ? bitmap : wxBitmap(bogus_xpm)); |  | ||||||
|     m_widget = gtk_pixmap_new(bmp.GetPixmap(), NULL); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     if (bitmap.Ok()) |     if (bitmap.Ok()) | ||||||
|         SetBitmap(bitmap); |         SetBitmap(bitmap); | ||||||
| @@ -84,7 +70,6 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) | |||||||
|         if (m_bitmap.GetMask()) |         if (m_bitmap.GetMask()) | ||||||
|             mask = m_bitmap.GetMask()->GetBitmap(); |             mask = m_bitmap.GetMask()->GetBitmap(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         if (m_bitmap.HasPixbuf()) |         if (m_bitmap.HasPixbuf()) | ||||||
|         { |         { | ||||||
|             gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget), |             gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget), | ||||||
| @@ -93,9 +78,6 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) | |||||||
|         else |         else | ||||||
|             gtk_image_set_from_pixmap(GTK_IMAGE(m_widget), |             gtk_image_set_from_pixmap(GTK_IMAGE(m_widget), | ||||||
|                                       m_bitmap.GetPixmap(), mask); |                                       m_bitmap.GetPixmap(), mask); | ||||||
| #else |  | ||||||
|         gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         InvalidateBestSize(); |         InvalidateBestSize(); | ||||||
|         SetSize(GetBestSize()); |         SetSize(GetBestSize()); | ||||||
|   | |||||||
| @@ -88,9 +88,7 @@ void wxStaticBox::SetLabel( const wxString& label ) | |||||||
| void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style) | void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style) | ||||||
| { | { | ||||||
|     gtk_widget_modify_style(m_widget, style); |     gtk_widget_modify_style(m_widget, style); | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); |     gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // static | // static | ||||||
|   | |||||||
| @@ -88,7 +88,6 @@ bool wxStaticText::Create(wxWindow *parent, | |||||||
|     PostCreation(size); |     PostCreation(size); | ||||||
|  |  | ||||||
|     // the bug below only happens with GTK 2 |     // the bug below only happens with GTK 2 | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if ( justify != GTK_JUSTIFY_LEFT ) |     if ( justify != GTK_JUSTIFY_LEFT ) | ||||||
|     { |     { | ||||||
|         // if we let GTK call wxgtk_window_size_request_callback the label |         // if we let GTK call wxgtk_window_size_request_callback the label | ||||||
| @@ -102,7 +101,6 @@ bool wxStaticText::Create(wxWindow *parent, | |||||||
|             (gpointer) this |             (gpointer) this | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| @@ -110,12 +108,7 @@ bool wxStaticText::Create(wxWindow *parent, | |||||||
| wxString wxStaticText::GetLabel() const | wxString wxStaticText::GetLabel() const | ||||||
| { | { | ||||||
|     GtkLabel *label = GTK_LABEL(m_widget); |     GtkLabel *label = GTK_LABEL(m_widget); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     wxString str = wxGTK_CONV_BACK( gtk_label_get_text( label ) ); |     wxString str = wxGTK_CONV_BACK( gtk_label_get_text( label ) ); | ||||||
| #else |  | ||||||
|     wxString str = wxString( label->label ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return wxString(str); |     return wxString(str); | ||||||
| } | } | ||||||
| @@ -124,7 +117,6 @@ void wxStaticText::SetLabel( const wxString &label ) | |||||||
| { | { | ||||||
|     wxControl::SetLabel(label); |     wxControl::SetLabel(label); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // Build the colorized version of the label (markup only allowed |     // Build the colorized version of the label (markup only allowed | ||||||
|     // under GTK2): |     // under GTK2): | ||||||
|     if (m_foregroundColour.Ok()) |     if (m_foregroundColour.Ok()) | ||||||
| @@ -139,7 +131,6 @@ void wxStaticText::SetLabel( const wxString &label ) | |||||||
|         gtk_label_set_markup( GTK_LABEL(m_widget), wxGTK_CONV( colorlabel ) ); |         gtk_label_set_markup( GTK_LABEL(m_widget), wxGTK_CONV( colorlabel ) ); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
| #endif |  | ||||||
|         gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) ); |         gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) ); | ||||||
|  |  | ||||||
|     // adjust the label size to the new label unless disabled |     // adjust the label size to the new label unless disabled | ||||||
| @@ -175,12 +166,6 @@ wxSize wxStaticText::DoGetBestSize() const | |||||||
|     // Do not return any arbitrary default value... |     // Do not return any arbitrary default value... | ||||||
|     wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") ); |     wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // This resets the internal GTK1 size calculation, which |  | ||||||
|     // otherwise would be cashed (incorrectly) |  | ||||||
|     gtk_label_set_pattern( GTK_LABEL(m_widget), NULL ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     // GetBestSize is supposed to return unwrapped size |     // GetBestSize is supposed to return unwrapped size | ||||||
|     gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE ); |     gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE ); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -57,9 +57,7 @@ static void GetGtkStyle(long style, | |||||||
|         *gtkStyle = style & wxTB_NOICONS |         *gtkStyle = style & wxTB_NOICONS | ||||||
|                         ? GTK_TOOLBAR_TEXT |                         ? GTK_TOOLBAR_TEXT | ||||||
|                         : ( |                         : ( | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                           style & wxTB_HORZ_LAYOUT ? GTK_TOOLBAR_BOTH_HORIZ : |                           style & wxTB_HORZ_LAYOUT ? GTK_TOOLBAR_BOTH_HORIZ : | ||||||
| #endif // __WXGTK20__ |  | ||||||
|                           GTK_TOOLBAR_BOTH); |                           GTK_TOOLBAR_BOTH); | ||||||
|     } |     } | ||||||
|     else // no text, hence we must have the icons or what would we show? |     else // no text, hence we must have the icons or what would we show? | ||||||
| @@ -128,11 +126,9 @@ public: | |||||||
|         { |         { | ||||||
|             GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap() |             GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap() | ||||||
|                                                : (GdkBitmap *)NULL; |                                                : (GdkBitmap *)NULL; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             if (bitmap.HasPixbuf()) |             if (bitmap.HasPixbuf()) | ||||||
|                 gtk_image_set_from_pixbuf( GTK_IMAGE(m_pixmap), bitmap.GetPixbuf() ); |                 gtk_image_set_from_pixbuf( GTK_IMAGE(m_pixmap), bitmap.GetPixbuf() ); | ||||||
|             else |             else | ||||||
| #endif // !__WXGTK20__ |  | ||||||
|                 gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask ); |                 gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask ); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -292,20 +288,12 @@ bool wxToolBar::Create( wxWindow *parent, | |||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); |     m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); | ||||||
|     GtkSetStyle(); |     GtkSetStyle(); | ||||||
|  |  | ||||||
|     // Doesn't work this way. |     // Doesn't work this way. | ||||||
|     // GtkToolbarSpaceStyle space_style = GTK_TOOLBAR_SPACE_EMPTY; |     // GtkToolbarSpaceStyle space_style = GTK_TOOLBAR_SPACE_EMPTY; | ||||||
|     // gtk_widget_style_set (GTK_WIDGET (m_toolbar), "space_style", &space_style, NULL); |     // gtk_widget_style_set (GTK_WIDGET (m_toolbar), "space_style", &space_style, NULL); | ||||||
| #else |  | ||||||
|     GtkOrientation orient; |  | ||||||
|     GtkToolbarStyle gtkStyle; |  | ||||||
|     GetGtkStyle(style, &orient, >kStyle); |  | ||||||
|  |  | ||||||
|     m_toolbar = GTK_TOOLBAR( gtk_toolbar_new(orient, gtkStyle) ); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     SetToolSeparation(7); |     SetToolSeparation(7); | ||||||
|  |  | ||||||
| @@ -329,7 +317,7 @@ bool wxToolBar::Create( wxWindow *parent, | |||||||
|     gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); |     gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); | ||||||
|  |  | ||||||
|     // FIXME: there is no such function for toolbars in 2.0 |     // FIXME: there is no such function for toolbars in 2.0 | ||||||
| #ifndef __WXGTK20__ | #if 0 | ||||||
|     if (style & wxTB_FLAT) |     if (style & wxTB_FLAT) | ||||||
|         gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE ); |         gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE ); | ||||||
| #endif | #endif | ||||||
| @@ -363,13 +351,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) | |||||||
| { | { | ||||||
|     wxToolBarTool *tool = (wxToolBarTool *)toolBase; |     wxToolBarTool *tool = (wxToolBarTool *)toolBase; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // if we have inserted a space before all the tools we must change the GTK |  | ||||||
|     // index by 1 |  | ||||||
|     size_t posGtk = m_xMargin > 1 ? pos + 1 : pos; |  | ||||||
| #else |  | ||||||
|     size_t posGtk = pos; |     size_t posGtk = pos; | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     if ( tool->IsButton() ) |     if ( tool->IsButton() ) | ||||||
|     { |     { | ||||||
| @@ -389,7 +371,6 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) | |||||||
|             GtkWidget *tool_pixmap = (GtkWidget *)NULL; |             GtkWidget *tool_pixmap = (GtkWidget *)NULL; | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             if (bitmap.HasPixbuf()) |             if (bitmap.HasPixbuf()) | ||||||
|             { |             { | ||||||
|                 tool_pixmap = gtk_image_new(); |                 tool_pixmap = gtk_image_new(); | ||||||
| @@ -397,7 +378,6 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) | |||||||
|                 tool->SetPixmap(bitmap); |                 tool->SetPixmap(bitmap); | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
| #endif |  | ||||||
|             { |             { | ||||||
|                 GdkPixmap *pixmap = bitmap.GetPixmap(); |                 GdkPixmap *pixmap = bitmap.GetPixmap(); | ||||||
|  |  | ||||||
| @@ -528,11 +508,9 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase) | |||||||
|             gtk_widget_destroy( tool->m_item ); |             gtk_widget_destroy( tool->m_item ); | ||||||
|             break; |             break; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         case wxTOOL_STYLE_SEPARATOR: |         case wxTOOL_STYLE_SEPARATOR: | ||||||
|             gtk_toolbar_remove_space( m_toolbar, pos ); |             gtk_toolbar_remove_space( m_toolbar, pos ); | ||||||
|             break; |             break; | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     InvalidateBestSize(); |     InvalidateBestSize(); | ||||||
| @@ -595,11 +573,6 @@ void wxToolBar::SetMargins( int x, int y ) | |||||||
|     wxCHECK_RET( GetToolsCount() == 0, |     wxCHECK_RET( GetToolsCount() == 0, | ||||||
|                  wxT("wxToolBar::SetMargins must be called before adding tools.") ); |                  wxT("wxToolBar::SetMargins must be called before adding tools.") ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     if (x > 1) |  | ||||||
|         gtk_toolbar_append_space( m_toolbar );  // oh well |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     m_xMargin = x; |     m_xMargin = x; | ||||||
|     m_yMargin = y; |     m_yMargin = y; | ||||||
| } | } | ||||||
| @@ -607,7 +580,7 @@ void wxToolBar::SetMargins( int x, int y ) | |||||||
| void wxToolBar::SetToolSeparation( int separation ) | void wxToolBar::SetToolSeparation( int separation ) | ||||||
| { | { | ||||||
|     // FIXME: this function disappeared |     // FIXME: this function disappeared | ||||||
| #ifndef __WXGTK20__ | #if 0 | ||||||
|     gtk_toolbar_set_space_size( m_toolbar, separation ); |     gtk_toolbar_set_space_size( m_toolbar, separation ); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -683,15 +656,7 @@ void wxToolBar::OnInternalIdle() | |||||||
| wxVisualAttributes | wxVisualAttributes | ||||||
| wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) | wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new); |     return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new); | ||||||
| #else |  | ||||||
|     wxVisualAttributes attr; |  | ||||||
|     GtkWidget* widget = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); |  | ||||||
|     attr = GetDefaultAttributesFromGTKWidget(widget); |  | ||||||
|     gtk_widget_destroy(widget); |  | ||||||
|     return attr; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif // wxUSE_TOOLBAR_NATIVE | #endif // wxUSE_TOOLBAR_NATIVE | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -396,29 +396,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev | |||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
| // "draw" of m_client |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| extern "C" { |  | ||||||
| static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win ) |  | ||||||
| { |  | ||||||
|     GtkPizza *pizza = GTK_PIZZA(widget); |  | ||||||
|  |  | ||||||
|     gtk_paint_flat_box (win->m_widget->style, |  | ||||||
|                         pizza->bin_window, GTK_STATE_NORMAL, |  | ||||||
|                         GTK_SHADOW_NONE, |  | ||||||
|                         rect, |  | ||||||
|                         win->m_widget, |  | ||||||
|                         (char *)"base", |  | ||||||
|                         0, 0, -1, -1); |  | ||||||
| } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #endif // GTK+ 1.x |  | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| // wxTopLevelWindowGTK itself | // wxTopLevelWindowGTK itself | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| @@ -517,7 +494,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, | |||||||
|     { |     { | ||||||
|         if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) |         if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) | ||||||
|         { |         { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); |             m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); | ||||||
|             // Tell WM that this is a dialog window and make it center |             // Tell WM that this is a dialog window and make it center | ||||||
|             // on parent by default (this is what GtkDialog ctor does): |             // on parent by default (this is what GtkDialog ctor does): | ||||||
| @@ -525,9 +501,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, | |||||||
|                                      GDK_WINDOW_TYPE_HINT_DIALOG); |                                      GDK_WINDOW_TYPE_HINT_DIALOG); | ||||||
|             gtk_window_set_position(GTK_WINDOW(m_widget), |             gtk_window_set_position(GTK_WINDOW(m_widget), | ||||||
|                                     GTK_WIN_POS_CENTER_ON_PARENT); |                                     GTK_WIN_POS_CENTER_ON_PARENT); | ||||||
| #else |  | ||||||
|             m_widget = gtk_window_new(GTK_WINDOW_DIALOG); |  | ||||||
| #endif |  | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
| @@ -602,10 +575,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, | |||||||
|        // For m_mainWidget themes |        // For m_mainWidget themes | ||||||
|        gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event", |        gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event", | ||||||
|                 GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); |                 GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|        gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw", |  | ||||||
|                 GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // m_wxwindow only represents the client area without toolbar and menubar |     // m_wxwindow only represents the client area without toolbar and menubar | ||||||
| @@ -841,11 +810,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) | |||||||
|  |  | ||||||
| void wxTopLevelWindowGTK::Raise() | void wxTopLevelWindowGTK::Raise() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gtk_window_present( GTK_WINDOW( m_widget ) ); |     gtk_window_present( GTK_WINDOW( m_widget ) ); | ||||||
| #else |  | ||||||
|     wxWindow::Raise(); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) ) | void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) ) | ||||||
| @@ -1149,7 +1114,6 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) | |||||||
|  |  | ||||||
|     wxTopLevelWindowBase::SetIcons( icons ); |     wxTopLevelWindowBase::SetIcons( icons ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     GList *list = NULL; |     GList *list = NULL; | ||||||
|     size_t max = icons.m_icons.GetCount(); |     size_t max = icons.m_icons.GetCount(); | ||||||
|  |  | ||||||
| @@ -1162,25 +1126,6 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) | |||||||
|     } |     } | ||||||
|     gtk_window_set_icon_list(GTK_WINDOW(m_widget), list); |     gtk_window_set_icon_list(GTK_WINDOW(m_widget), list); | ||||||
|     g_list_free(list); |     g_list_free(list); | ||||||
|  |  | ||||||
| #else // !__WXGTK20__ |  | ||||||
|     GdkWindow* window = m_widget->window; |  | ||||||
|     if (!window) |  | ||||||
|         return; |  | ||||||
|  |  | ||||||
|     wxIcon icon = icons.GetIcon(-1); |  | ||||||
|     if (icon.Ok()) |  | ||||||
|     { |  | ||||||
|         wxMask *mask = icon.GetMask(); |  | ||||||
|         GdkBitmap *bm = (GdkBitmap *) NULL; |  | ||||||
|         if (mask) bm = mask->GetBitmap(); |  | ||||||
|  |  | ||||||
|         gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ), |  | ||||||
|                    (WXWindow)GDK_WINDOW_XWINDOW( window ), icons ); |  | ||||||
| #endif // !__WXGTK20__ |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| @@ -1189,61 +1134,32 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) | |||||||
|  |  | ||||||
| void wxTopLevelWindowGTK::Maximize(bool maximize) | void wxTopLevelWindowGTK::Maximize(bool maximize) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (maximize) |     if (maximize) | ||||||
|         gtk_window_maximize( GTK_WINDOW( m_widget ) ); |         gtk_window_maximize( GTK_WINDOW( m_widget ) ); | ||||||
|     else |     else | ||||||
|         gtk_window_unmaximize( GTK_WINDOW( m_widget ) ); |         gtk_window_unmaximize( GTK_WINDOW( m_widget ) ); | ||||||
| #else |  | ||||||
|     wxFAIL_MSG( _T("not implemented") ); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| bool wxTopLevelWindowGTK::IsMaximized() const | bool wxTopLevelWindowGTK::IsMaximized() const | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if(!m_widget->window) |     if(!m_widget->window) | ||||||
|         return false; |         return false; | ||||||
|  |  | ||||||
|     return gdk_window_get_state(m_widget->window) & GDK_WINDOW_STATE_MAXIMIZED; |     return gdk_window_get_state(m_widget->window) & GDK_WINDOW_STATE_MAXIMIZED; | ||||||
| #else |  | ||||||
|   //    wxFAIL_MSG( _T("not implemented") ); |  | ||||||
|  |  | ||||||
|     // This is an approximation |  | ||||||
|     return false; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxTopLevelWindowGTK::Restore() | void wxTopLevelWindowGTK::Restore() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // "Present" seems similar enough to "restore" |     // "Present" seems similar enough to "restore" | ||||||
|     gtk_window_present( GTK_WINDOW( m_widget ) ); |     gtk_window_present( GTK_WINDOW( m_widget ) ); | ||||||
| #else |  | ||||||
|     wxFAIL_MSG( _T("not implemented") ); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxTopLevelWindowGTK::Iconize( bool iconize ) | void wxTopLevelWindowGTK::Iconize( bool iconize ) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (iconize) |     if (iconize) | ||||||
|         gtk_window_iconify( GTK_WINDOW( m_widget ) ); |         gtk_window_iconify( GTK_WINDOW( m_widget ) ); | ||||||
|     else |     else | ||||||
|         gtk_window_deiconify( GTK_WINDOW( m_widget ) ); |         gtk_window_deiconify( GTK_WINDOW( m_widget ) ); | ||||||
| #else |  | ||||||
|    if (iconize) |  | ||||||
|    { |  | ||||||
|        GdkWindow *window = m_widget->window; |  | ||||||
|  |  | ||||||
|        // you should do it later, for example from OnCreate() handler |  | ||||||
|        wxCHECK_RET( window, _T("frame not created yet - can't iconize") ); |  | ||||||
|  |  | ||||||
|        XIconifyWindow( GDK_WINDOW_XDISPLAY( window ), |  | ||||||
|                        GDK_WINDOW_XWINDOW( window ), |  | ||||||
|                        DefaultScreen( GDK_DISPLAY() ) ); |  | ||||||
|    } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| bool wxTopLevelWindowGTK::IsIconized() const | bool wxTopLevelWindowGTK::IsIconized() const | ||||||
| @@ -1292,14 +1208,7 @@ static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region) | |||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); |             gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); | ||||||
| #else |  | ||||||
|             wxBitmap bmp = region.ConvertToBitmap(); |  | ||||||
|             bmp.SetMask(new wxMask(bmp, *wxBLACK)); |  | ||||||
|             GdkBitmap* mask = bmp.GetMask()->GetBitmap(); |  | ||||||
|             gdk_window_shape_combine_mask(window, mask, 0, 0); |  | ||||||
| #endif |  | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -1364,16 +1273,13 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags) | |||||||
|  |  | ||||||
| void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) | void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // Store which styles were changed |     // Store which styles were changed | ||||||
|     long styleChanges = style ^ m_windowStyle; |     long styleChanges = style ^ m_windowStyle; | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     // Process wxWindow styles. This also updates the internal variable |     // Process wxWindow styles. This also updates the internal variable | ||||||
|     // Therefore m_windowStyle bits carry now the _new_ style values |     // Therefore m_windowStyle bits carry now the _new_ style values | ||||||
|     wxWindow::SetWindowStyleFlag(style); |     wxWindow::SetWindowStyleFlag(style); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // just return for now if widget does not exist yet |     // just return for now if widget does not exist yet | ||||||
|     if (!m_widget) |     if (!m_widget) | ||||||
|         return; |         return; | ||||||
| @@ -1388,5 +1294,4 @@ void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) | |||||||
|         gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), m_windowStyle & wxFRAME_NO_TASKBAR); |         gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), m_windowStyle & wxFRAME_NO_TASKBAR); | ||||||
|     } |     } | ||||||
| #endif // GTK+ 2.2 | #endif // GTK+ 2.2 | ||||||
| #endif // GTK+ 2.0 |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -31,9 +31,6 @@ | |||||||
| #include "glib.h" | #include "glib.h" | ||||||
| #include "gdk/gdk.h" | #include "gdk/gdk.h" | ||||||
| #include "gtk/gtk.h" | #include "gtk/gtk.h" | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| #include "gtk/gtkfeatures.h" |  | ||||||
| #endif |  | ||||||
| #include "gdk/gdkx.h" | #include "gdk/gdkx.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_X11_XKBLIB_H | #ifdef HAVE_X11_XKBLIB_H | ||||||
| @@ -81,7 +78,6 @@ bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) ) | |||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| // Escapes string so that it is valid Pango markup XML string: | // Escapes string so that it is valid Pango markup XML string: | ||||||
| wxString wxEscapeStringForPangoMarkup(const wxString& str) | wxString wxEscapeStringForPangoMarkup(const wxString& str) | ||||||
| { | { | ||||||
| @@ -115,7 +111,6 @@ wxString wxEscapeStringForPangoMarkup(const wxString& str) | |||||||
|     } |     } | ||||||
|     return out; |     return out; | ||||||
| } | } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
| @@ -168,11 +163,7 @@ int wxDisplayDepth() | |||||||
| wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() | wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() | ||||||
| { | { | ||||||
|     static wxToolkitInfo info; |     static wxToolkitInfo info; | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     info.shortName = _T("gtk2"); |     info.shortName = _T("gtk2"); | ||||||
| #else |  | ||||||
|     info.shortName = _T("gtk"); |  | ||||||
| #endif |  | ||||||
|     info.name = _T("wxGTK"); |     info.name = _T("wxGTK"); | ||||||
| #ifdef __WXUNIVERSAL__ | #ifdef __WXUNIVERSAL__ | ||||||
|     info.shortName << _T("univ"); |     info.shortName << _T("univ"); | ||||||
|   | |||||||
| @@ -23,17 +23,6 @@ | |||||||
| extern "C" { | extern "C" { | ||||||
| #endif /* __cplusplus */ | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| #include <X11/Xlib.h> |  | ||||||
| #include <X11/Xutil.h> |  | ||||||
| #include <X11/Xatom.h> |  | ||||||
|  |  | ||||||
| #define IS_ONSCREEN(x,y) ((x >= G_MINSHORT) && (x <= G_MAXSHORT) && \ |  | ||||||
|                           (y >= G_MINSHORT) && (y <= G_MAXSHORT)) |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| typedef struct _GtkPizzaAdjData  GtkPizzaAdjData; | typedef struct _GtkPizzaAdjData  GtkPizzaAdjData; | ||||||
|  |  | ||||||
| struct _GtkPizzaAdjData | struct _GtkPizzaAdjData | ||||||
| @@ -54,10 +43,6 @@ static void gtk_pizza_size_request  (GtkWidget        *widget, | |||||||
|                                      GtkRequisition   *requisition); |                                      GtkRequisition   *requisition); | ||||||
| static void gtk_pizza_size_allocate (GtkWidget        *widget, | static void gtk_pizza_size_allocate (GtkWidget        *widget, | ||||||
|                                      GtkAllocation    *allocation); |                                      GtkAllocation    *allocation); | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| static void gtk_pizza_draw          (GtkWidget        *widget, |  | ||||||
|                                      GdkRectangle     *area); |  | ||||||
| #endif /* __WXGTK20__ */ |  | ||||||
| static gint gtk_pizza_expose        (GtkWidget        *widget, | static gint gtk_pizza_expose        (GtkWidget        *widget, | ||||||
|                                      GdkEventExpose   *event); |                                      GdkEventExpose   *event); | ||||||
| static void gtk_pizza_style_set     (GtkWidget *widget, | static void gtk_pizza_style_set     (GtkWidget *widget, | ||||||
| @@ -76,35 +61,14 @@ static void     gtk_pizza_allocate_child     (GtkPizza      *pizza, | |||||||
| static void     gtk_pizza_adjust_allocations_recurse (GtkWidget *widget, | static void     gtk_pizza_adjust_allocations_recurse (GtkWidget *widget, | ||||||
|                                                       gpointer   cb_data); |                                                       gpointer   cb_data); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| static void     gtk_pizza_position_child     (GtkPizza      *pizza, |  | ||||||
|                                               GtkPizzaChild *child); |  | ||||||
| static void     gtk_pizza_position_children  (GtkPizza      *pizza); |  | ||||||
|  |  | ||||||
| static GdkFilterReturn gtk_pizza_filter      (GdkXEvent      *gdk_xevent, |  | ||||||
|                                               GdkEvent       *event, |  | ||||||
|                                               gpointer        data); |  | ||||||
| static GdkFilterReturn gtk_pizza_main_filter (GdkXEvent      *gdk_xevent, |  | ||||||
|                                               GdkEvent       *event, |  | ||||||
|                                               gpointer        data); |  | ||||||
| #endif /* __WXGTK20__ */ |  | ||||||
|  |  | ||||||
| static GtkType gtk_pizza_child_type (GtkContainer     *container); | static GtkType gtk_pizza_child_type (GtkContainer     *container); | ||||||
|  |  | ||||||
| static void  gtk_pizza_scroll_set_adjustments (GtkPizza      *pizza, | static void  gtk_pizza_scroll_set_adjustments (GtkPizza      *pizza, | ||||||
|                                                GtkAdjustment *hadj, |                                                GtkAdjustment *hadj, | ||||||
|                                                GtkAdjustment *vadj); |                                                GtkAdjustment *vadj); | ||||||
|  |  | ||||||
|  | /* static */ | ||||||
| #ifdef __WXGTK20__ | GtkContainerClass *pizza_parent_class = NULL; | ||||||
|        GtkContainerClass *pizza_parent_class = NULL; |  | ||||||
| #else |  | ||||||
| static GtkContainerClass *pizza_parent_class = NULL; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| static gboolean gravity_works; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| GtkType | GtkType | ||||||
| gtk_pizza_get_type () | gtk_pizza_get_type () | ||||||
| @@ -113,8 +77,6 @@ gtk_pizza_get_type () | |||||||
|  |  | ||||||
|     if (!pizza_type) |     if (!pizza_type) | ||||||
|     { |     { | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         static const GTypeInfo pizza_info = |         static const GTypeInfo pizza_info = | ||||||
|         { |         { | ||||||
|             sizeof (GtkPizzaClass), |             sizeof (GtkPizzaClass), | ||||||
| @@ -128,26 +90,11 @@ gtk_pizza_get_type () | |||||||
|             (GInstanceInitFunc) gtk_pizza_init, |             (GInstanceInitFunc) gtk_pizza_init, | ||||||
|         }; |         }; | ||||||
|         pizza_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkPizza", &pizza_info, (GTypeFlags)0); |         pizza_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkPizza", &pizza_info, (GTypeFlags)0); | ||||||
| #else |  | ||||||
|         GtkTypeInfo pizza_info = |  | ||||||
|         { |  | ||||||
|             "GtkPizza", |  | ||||||
|             sizeof (GtkPizza), |  | ||||||
|             sizeof (GtkPizzaClass), |  | ||||||
|             (GtkClassInitFunc) gtk_pizza_class_init, |  | ||||||
|             (GtkObjectInitFunc) gtk_pizza_init, |  | ||||||
|             /* reserved_1 */ NULL, |  | ||||||
|             /* reserved_2 */ NULL, |  | ||||||
|             (GtkClassInitFunc) NULL, |  | ||||||
|         }; |  | ||||||
|         pizza_type = gtk_type_unique (gtk_container_get_type (), &pizza_info); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return pizza_type; |     return pizza_type; | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| /* Marshaller needed for set_scroll_adjustments signal, | /* Marshaller needed for set_scroll_adjustments signal, | ||||||
|    generated with GLib-2.4.6 glib-genmarshal */ |    generated with GLib-2.4.6 glib-genmarshal */ | ||||||
| #define g_marshal_value_peek_object(v)   g_value_get_object (v) | #define g_marshal_value_peek_object(v)   g_value_get_object (v) | ||||||
| @@ -186,7 +133,6 @@ g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure     *closure, | |||||||
|             g_marshal_value_peek_object (param_values + 2), |             g_marshal_value_peek_object (param_values + 2), | ||||||
|             data2); |             data2); | ||||||
| } | } | ||||||
| #endif /* __WXGTK20__ */ |  | ||||||
|  |  | ||||||
| static void | static void | ||||||
| gtk_pizza_class_init (GtkPizzaClass *klass) | gtk_pizza_class_init (GtkPizzaClass *klass) | ||||||
| @@ -205,9 +151,6 @@ gtk_pizza_class_init (GtkPizzaClass *klass) | |||||||
|     widget_class->unrealize = gtk_pizza_unrealize; |     widget_class->unrealize = gtk_pizza_unrealize; | ||||||
|     widget_class->size_request = gtk_pizza_size_request; |     widget_class->size_request = gtk_pizza_size_request; | ||||||
|     widget_class->size_allocate = gtk_pizza_size_allocate; |     widget_class->size_allocate = gtk_pizza_size_allocate; | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     widget_class->draw = gtk_pizza_draw; |  | ||||||
| #endif |  | ||||||
|     widget_class->expose_event = gtk_pizza_expose; |     widget_class->expose_event = gtk_pizza_expose; | ||||||
|     widget_class->style_set = gtk_pizza_style_set; |     widget_class->style_set = gtk_pizza_style_set; | ||||||
|  |  | ||||||
| @@ -220,7 +163,6 @@ gtk_pizza_class_init (GtkPizzaClass *klass) | |||||||
|     klass->set_scroll_adjustments = gtk_pizza_scroll_set_adjustments; |     klass->set_scroll_adjustments = gtk_pizza_scroll_set_adjustments; | ||||||
|  |  | ||||||
|     widget_class->set_scroll_adjustments_signal = |     widget_class->set_scroll_adjustments_signal = | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         g_signal_new( |         g_signal_new( | ||||||
|             "set_scroll_adjustments", |             "set_scroll_adjustments", | ||||||
|             G_TYPE_FROM_CLASS(object_class), |             G_TYPE_FROM_CLASS(object_class), | ||||||
| @@ -233,14 +175,6 @@ gtk_pizza_class_init (GtkPizzaClass *klass) | |||||||
|             2, |             2, | ||||||
|             GTK_TYPE_ADJUSTMENT, |             GTK_TYPE_ADJUSTMENT, | ||||||
|             GTK_TYPE_ADJUSTMENT); |             GTK_TYPE_ADJUSTMENT); | ||||||
| #else |  | ||||||
|     gtk_signal_new ("set_scroll_adjustments", |  | ||||||
|                     GTK_RUN_LAST, |  | ||||||
|                     object_class->type, |  | ||||||
|                     GTK_SIGNAL_OFFSET (GtkPizzaClass, set_scroll_adjustments), |  | ||||||
|                     gtk_marshal_NONE__POINTER_POINTER, |  | ||||||
|                     GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); |  | ||||||
| #endif /* __WXGTK20__ */ |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static GtkType | static GtkType | ||||||
| @@ -372,11 +306,6 @@ gtk_pizza_put (GtkPizza   *pizza, | |||||||
|  |  | ||||||
|     gtk_widget_set_parent (widget, GTK_WIDGET (pizza)); |     gtk_widget_set_parent (widget, GTK_WIDGET (pizza)); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ /* FIXME? */ |  | ||||||
|     if (!IS_ONSCREEN (x, y)) |  | ||||||
|        GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gtk_widget_set_usize (widget, width, height); |     gtk_widget_set_usize (widget, width, height); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -541,11 +470,7 @@ gtk_pizza_map (GtkWidget *widget) | |||||||
|  |  | ||||||
|         if ( GTK_WIDGET_VISIBLE (child->widget) && |         if ( GTK_WIDGET_VISIBLE (child->widget) && | ||||||
|             !GTK_WIDGET_MAPPED (child->widget) && |             !GTK_WIDGET_MAPPED (child->widget) && | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             TRUE) |             TRUE) | ||||||
| #else |  | ||||||
|             !GTK_WIDGET_IS_OFFSCREEN (child->widget)) |  | ||||||
| #endif |  | ||||||
|         { |         { | ||||||
|             gtk_widget_map (child->widget); |             gtk_widget_map (child->widget); | ||||||
|         } |         } | ||||||
| @@ -620,9 +545,7 @@ gtk_pizza_realize (GtkWidget *widget) | |||||||
|  |  | ||||||
|     attributes.event_mask = gtk_widget_get_events (widget); |     attributes.event_mask = gtk_widget_get_events (widget); | ||||||
|     attributes.event_mask |= GDK_EXPOSURE_MASK              | |     attributes.event_mask |= GDK_EXPOSURE_MASK              | | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|                              GDK_SCROLL_MASK                | |                              GDK_SCROLL_MASK                | | ||||||
| #endif |  | ||||||
|                              GDK_POINTER_MOTION_MASK        | |                              GDK_POINTER_MOTION_MASK        | | ||||||
|                              GDK_POINTER_MOTION_HINT_MASK   | |                              GDK_POINTER_MOTION_HINT_MASK   | | ||||||
|                              GDK_BUTTON_MOTION_MASK         | |                              GDK_BUTTON_MOTION_MASK         | | ||||||
| @@ -650,15 +573,6 @@ gtk_pizza_realize (GtkWidget *widget) | |||||||
|     gdk_window_set_back_pixmap( pizza->bin_window, NULL, FALSE ); |     gdk_window_set_back_pixmap( pizza->bin_window, NULL, FALSE ); | ||||||
| */ | */ | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     /* add filters for intercepting visibility and expose events */ |  | ||||||
|     gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza); |  | ||||||
|     gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza); |  | ||||||
|  |  | ||||||
|     /* we NEED gravity or we'll give up */ |  | ||||||
|     gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE); |  | ||||||
| #endif // !__WXGTK20__ |  | ||||||
|  |  | ||||||
|     /* cannot be done before realisation */ |     /* cannot be done before realisation */ | ||||||
|     children = pizza->children; |     children = pizza->children; | ||||||
|     while (children) |     while (children) | ||||||
| @@ -764,63 +678,15 @@ gtk_pizza_size_allocate (GtkWidget     *widget, | |||||||
|         child = children->data; |         child = children->data; | ||||||
|         children = children->next; |         children = children->next; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|         gtk_pizza_position_child (pizza, child); |  | ||||||
| #endif |  | ||||||
|         gtk_pizza_allocate_child (pizza, child); |         gtk_pizza_allocate_child (pizza, child); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| gtk_pizza_draw (GtkWidget    *widget, |  | ||||||
|                 GdkRectangle *area) |  | ||||||
| { |  | ||||||
|     GtkPizza *pizza; |  | ||||||
|     GtkPizzaChild *child; |  | ||||||
|     GdkRectangle child_area; |  | ||||||
|     GList *children; |  | ||||||
|  |  | ||||||
|     g_return_if_fail (widget != NULL); |  | ||||||
|     g_return_if_fail (GTK_IS_PIZZA (widget)); |  | ||||||
|  |  | ||||||
|     pizza = GTK_PIZZA (widget); |  | ||||||
|  |  | ||||||
|     /* Sometimes, We handle all expose events in window.cpp now. */ |  | ||||||
|     if (pizza->external_expose) |  | ||||||
|         return; |  | ||||||
|  |  | ||||||
|     children = pizza->children; |  | ||||||
|     if ( !(GTK_WIDGET_APP_PAINTABLE (widget)) && |  | ||||||
|          (pizza->clear_on_draw)) |  | ||||||
|     { |  | ||||||
|         gdk_window_clear_area( pizza->bin_window, |  | ||||||
|                                 area->x, area->y, area->width, area->height); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     while (children) |  | ||||||
|     { |  | ||||||
|         child = children->data; |  | ||||||
|         children = children->next; |  | ||||||
|  |  | ||||||
|         if (gtk_widget_intersect (child->widget, area, &child_area)) |  | ||||||
|             gtk_widget_draw (child->widget, &child_area); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #endif /* __WXGTK20__ */ |  | ||||||
|  |  | ||||||
| static gint | static gint | ||||||
| gtk_pizza_expose (GtkWidget      *widget, | gtk_pizza_expose (GtkWidget      *widget, | ||||||
|                   GdkEventExpose *event) |                   GdkEventExpose *event) | ||||||
| { | { | ||||||
|     GtkPizza *pizza; |     GtkPizza *pizza; | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     GtkPizzaChild *child; |  | ||||||
|     GdkEventExpose child_event; |  | ||||||
|     GList *children; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     g_return_val_if_fail (widget != NULL, FALSE); |     g_return_val_if_fail (widget != NULL, FALSE); | ||||||
|     g_return_val_if_fail (GTK_IS_PIZZA (widget), FALSE); |     g_return_val_if_fail (GTK_IS_PIZZA (widget), FALSE); | ||||||
| @@ -835,33 +701,9 @@ gtk_pizza_expose (GtkWidget      *widget, | |||||||
|     if (pizza->external_expose) |     if (pizza->external_expose) | ||||||
|         return FALSE; |         return FALSE; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|  |  | ||||||
|     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, event); |     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, event); | ||||||
|  |  | ||||||
|     return FALSE; |     return FALSE; | ||||||
|  |  | ||||||
| #else |  | ||||||
|  |  | ||||||
|     children = pizza->children; |  | ||||||
|     while (children) |  | ||||||
|     { |  | ||||||
|         child = children->data; |  | ||||||
|         children = children->next; |  | ||||||
|  |  | ||||||
|         child_event = *event; |  | ||||||
|  |  | ||||||
|         if (GTK_WIDGET_NO_WINDOW (child->widget) && |  | ||||||
|             GTK_WIDGET_DRAWABLE (child->widget) && |  | ||||||
|             gtk_widget_intersect (child->widget, &event->area, &child_event.area)) |  | ||||||
|         { |  | ||||||
|             gtk_widget_event (child->widget, (GdkEvent*) &child_event); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return TRUE; |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -920,10 +762,6 @@ gtk_pizza_remove (GtkContainer *container, | |||||||
|             /* security checks */ |             /* security checks */ | ||||||
|             g_return_if_fail (GTK_IS_WIDGET (widget)); |             g_return_if_fail (GTK_IS_WIDGET (widget)); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|             GTK_PRIVATE_UNSET_FLAG (widget, GTK_IS_OFFSCREEN); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -1020,68 +858,6 @@ gtk_pizza_adjust_allocations (GtkPizza *pizza, | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| static void |  | ||||||
| gtk_pizza_position_child (GtkPizza      *pizza, |  | ||||||
|                           GtkPizzaChild *child) |  | ||||||
| { |  | ||||||
|     gint x; |  | ||||||
|     gint y; |  | ||||||
|  |  | ||||||
|     x = child->x - pizza->xoffset; |  | ||||||
|     y = child->y - pizza->yoffset; |  | ||||||
|  |  | ||||||
|     if (IS_ONSCREEN (x,y)) |  | ||||||
|     { |  | ||||||
|         if (GTK_WIDGET_MAPPED (pizza) && |  | ||||||
|           GTK_WIDGET_VISIBLE (child->widget)) |  | ||||||
|         { |  | ||||||
|             if (!GTK_WIDGET_MAPPED (child->widget)) |  | ||||||
|                 gtk_widget_map (child->widget); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (GTK_WIDGET_IS_OFFSCREEN (child->widget)) |  | ||||||
|             GTK_PRIVATE_UNSET_FLAG (child->widget, GTK_IS_OFFSCREEN); |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         if (!GTK_WIDGET_IS_OFFSCREEN (child->widget)) |  | ||||||
|             GTK_PRIVATE_SET_FLAG (child->widget, GTK_IS_OFFSCREEN); |  | ||||||
|  |  | ||||||
|         if (GTK_WIDGET_MAPPED (child->widget)) |  | ||||||
|             gtk_widget_unmap (child->widget); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| gtk_pizza_position_children (GtkPizza *pizza) |  | ||||||
| { |  | ||||||
|     GList *tmp_list; |  | ||||||
|  |  | ||||||
|     tmp_list = pizza->children; |  | ||||||
|     while (tmp_list) |  | ||||||
|     { |  | ||||||
|         GtkPizzaChild *child = tmp_list->data; |  | ||||||
|         tmp_list = tmp_list->next; |  | ||||||
|  |  | ||||||
|         gtk_pizza_position_child (pizza, child); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* This function is used to find events to process while scrolling */ |  | ||||||
| static Bool |  | ||||||
| gtk_pizza_expose_predicate (Display *display, |  | ||||||
|                   XEvent  *xevent, |  | ||||||
|                   XPointer arg) |  | ||||||
| { |  | ||||||
|     if ((xevent->type == Expose) || |  | ||||||
|        ((xevent->xany.window == *(Window *)arg) && |  | ||||||
|        (xevent->type == ConfigureNotify))) |  | ||||||
|         return True; |  | ||||||
|     else |  | ||||||
|         return False; |  | ||||||
| } |  | ||||||
| #endif /* __WXGTK20__ */ |  | ||||||
|  |  | ||||||
| /* This is the main routine to do the scrolling. Scrolling is | /* This is the main routine to do the scrolling. Scrolling is | ||||||
|  * done by "Guffaw" scrolling, as in the Mozilla XFE, with |  * done by "Guffaw" scrolling, as in the Mozilla XFE, with | ||||||
| @@ -1098,7 +874,6 @@ gtk_pizza_expose_predicate (Display *display, | |||||||
| void | void | ||||||
| gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) | gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     pizza->xoffset += dx; |     pizza->xoffset += dx; | ||||||
|     pizza->yoffset += dy; |     pizza->yoffset += dy; | ||||||
|  |  | ||||||
| @@ -1106,233 +881,8 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) | |||||||
|  |  | ||||||
|     if (pizza->bin_window) |     if (pizza->bin_window) | ||||||
|         gdk_window_scroll( pizza->bin_window, -dx, -dy ); |         gdk_window_scroll( pizza->bin_window, -dx, -dy ); | ||||||
| #else // !__WXGTK20__ |  | ||||||
|     GtkWidget *widget; |  | ||||||
|     XEvent xevent; |  | ||||||
|     XID win; |  | ||||||
|  |  | ||||||
|     gint x,y,w,h,border; |  | ||||||
|  |  | ||||||
|     widget = GTK_WIDGET (pizza); |  | ||||||
|  |  | ||||||
|     pizza->xoffset += dx; |  | ||||||
|     pizza->yoffset += dy; |  | ||||||
|  |  | ||||||
|     if (!GTK_WIDGET_MAPPED (pizza)) |  | ||||||
|     { |  | ||||||
|         gtk_pizza_position_children (pizza); |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     gtk_pizza_adjust_allocations (pizza, -dx, -dy); |  | ||||||
|  |  | ||||||
|     if (pizza->shadow_type == GTK_MYSHADOW_NONE) |  | ||||||
|         border = 0; |  | ||||||
|     else |  | ||||||
|     if (pizza->shadow_type == GTK_MYSHADOW_THIN) |  | ||||||
|         border = 1; |  | ||||||
|     else |  | ||||||
|         border = 2; |  | ||||||
|  |  | ||||||
|     x = 0; |  | ||||||
|     y = 0; |  | ||||||
|     w = widget->allocation.width - 2*border; |  | ||||||
|     h = widget->allocation.height - 2*border; |  | ||||||
|  |  | ||||||
|     if (dx > 0) |  | ||||||
|     { |  | ||||||
|         if (gravity_works) |  | ||||||
|         { |  | ||||||
|           gdk_window_resize (pizza->bin_window, |  | ||||||
|                              w + dx, |  | ||||||
|                              h); |  | ||||||
|           gdk_window_move   (pizza->bin_window, x-dx, y); |  | ||||||
|           gdk_window_move_resize (pizza->bin_window, x, y, w, h ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|           /* FIXME */ |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     else if (dx < 0) |  | ||||||
|     { |  | ||||||
|         if (gravity_works) |  | ||||||
|         { |  | ||||||
|           gdk_window_move_resize (pizza->bin_window, |  | ||||||
|                                   x + dx, |  | ||||||
|                                   y, |  | ||||||
|                                   w - dx, |  | ||||||
|                                   h); |  | ||||||
|           gdk_window_move   (pizza->bin_window, x, y); |  | ||||||
|           gdk_window_resize (pizza->bin_window, w, h ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|           /* FIXME */ |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (dy > 0) |  | ||||||
|     { |  | ||||||
|         if (gravity_works) |  | ||||||
|         { |  | ||||||
|           gdk_window_resize (pizza->bin_window, w, h + dy); |  | ||||||
|           gdk_window_move   (pizza->bin_window, x, y-dy); |  | ||||||
|           gdk_window_move_resize (pizza->bin_window, |  | ||||||
|                                   x, y, w, h ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|           /* FIXME */ |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     else if (dy < 0) |  | ||||||
|     { |  | ||||||
|         if (gravity_works) |  | ||||||
|         { |  | ||||||
|           gdk_window_move_resize (pizza->bin_window, |  | ||||||
|                                   x, y+dy, w, h - dy ); |  | ||||||
|           gdk_window_move   (pizza->bin_window, x, y); |  | ||||||
|           gdk_window_resize (pizza->bin_window, w, h ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|           /* FIXME */ |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     gtk_pizza_position_children (pizza); |  | ||||||
|  |  | ||||||
|     gdk_flush(); |  | ||||||
|  |  | ||||||
|     win = GDK_WINDOW_XWINDOW (pizza->bin_window); |  | ||||||
|     while (XCheckIfEvent(GDK_WINDOW_XDISPLAY (pizza->bin_window), |  | ||||||
|                          &xevent, |  | ||||||
|                          gtk_pizza_expose_predicate, |  | ||||||
|                          (XPointer)&win)) |  | ||||||
|     { |  | ||||||
|         GdkEvent event; |  | ||||||
|         GtkWidget *event_widget; |  | ||||||
|  |  | ||||||
|         if ((xevent.xany.window == GDK_WINDOW_XWINDOW (pizza->bin_window)) ) |  | ||||||
|             gtk_pizza_filter (&xevent, &event, pizza); |  | ||||||
|  |  | ||||||
|         if (xevent.type == Expose) |  | ||||||
|         { |  | ||||||
|             event.expose.window = gdk_window_lookup (xevent.xany.window); |  | ||||||
|             gdk_window_get_user_data (event.expose.window, |  | ||||||
|                                     (gpointer *)&event_widget); |  | ||||||
|  |  | ||||||
|             if (event_widget) |  | ||||||
|             { |  | ||||||
|                 event.expose.type = GDK_EXPOSE; |  | ||||||
|                 event.expose.area.x = xevent.xexpose.x; |  | ||||||
|                 event.expose.area.y = xevent.xexpose.y; |  | ||||||
|                 event.expose.area.width = xevent.xexpose.width; |  | ||||||
|                 event.expose.area.height = xevent.xexpose.height; |  | ||||||
|                 event.expose.count = xevent.xexpose.count; |  | ||||||
|  |  | ||||||
|                 gdk_window_ref (event.expose.window); |  | ||||||
|                 gtk_widget_event (event_widget, &event); |  | ||||||
|                 gdk_window_unref (event.expose.window); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #endif /* __WXGTK20__/!__WXGTK20__ */ |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| /* The main event filter. Actually, we probably don't really need |  | ||||||
|  * to install this as a filter at all, since we are calling it |  | ||||||
|  * directly above in the expose-handling hack. But in case scrollbars |  | ||||||
|  * are fixed up in some manner... |  | ||||||
|  * |  | ||||||
|  * This routine identifies expose events that are generated when |  | ||||||
|  * we've temporarily moved the bin_window_origin, and translates |  | ||||||
|  * them or discards them, depending on whether we are obscured |  | ||||||
|  * or not. |  | ||||||
|  */ |  | ||||||
| static GdkFilterReturn |  | ||||||
| gtk_pizza_filter (GdkXEvent *gdk_xevent, |  | ||||||
|                    GdkEvent  *event, |  | ||||||
|                    gpointer   data) |  | ||||||
| { |  | ||||||
|     XEvent *xevent; |  | ||||||
|     GtkPizza *pizza; |  | ||||||
|  |  | ||||||
|     xevent = (XEvent *)gdk_xevent; |  | ||||||
|  |  | ||||||
|     pizza = GTK_PIZZA (data); |  | ||||||
|  |  | ||||||
|     if (!pizza->use_filter) |  | ||||||
|         return GDK_FILTER_CONTINUE; |  | ||||||
|  |  | ||||||
|     switch (xevent->type) |  | ||||||
|     { |  | ||||||
|         case Expose: |  | ||||||
|             if (xevent->xexpose.serial == pizza->configure_serial) |  | ||||||
|             { |  | ||||||
|                 xevent->xexpose.x += pizza->scroll_x; |  | ||||||
|                 xevent->xexpose.y += pizza->scroll_y; |  | ||||||
|             } |  | ||||||
|             break; |  | ||||||
|  |  | ||||||
|         case ConfigureNotify: |  | ||||||
|             { |  | ||||||
|                 pizza->configure_serial = xevent->xconfigure.serial; |  | ||||||
|                 pizza->scroll_x = xevent->xconfigure.x; |  | ||||||
|                 pizza->scroll_y = xevent->xconfigure.y; |  | ||||||
|             } |  | ||||||
|             break; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return GDK_FILTER_CONTINUE; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* Although GDK does have a GDK_VISIBILITY_NOTIFY event, |  | ||||||
|  * there is no corresponding event in GTK, so we have |  | ||||||
|  * to get the events from a filter |  | ||||||
|  */ |  | ||||||
| static GdkFilterReturn |  | ||||||
| gtk_pizza_main_filter (GdkXEvent *gdk_xevent, |  | ||||||
|                         GdkEvent  *event, |  | ||||||
|                         gpointer   data) |  | ||||||
| { |  | ||||||
|     XEvent *xevent; |  | ||||||
|     GtkPizza *pizza; |  | ||||||
|  |  | ||||||
|     xevent = (XEvent *)gdk_xevent; |  | ||||||
|     pizza = GTK_PIZZA (data); |  | ||||||
|  |  | ||||||
|     if (!pizza->use_filter) |  | ||||||
|         return GDK_FILTER_CONTINUE; |  | ||||||
|  |  | ||||||
|     if (xevent->type == VisibilityNotify) |  | ||||||
|     { |  | ||||||
|         switch (xevent->xvisibility.state) |  | ||||||
|         { |  | ||||||
|             case VisibilityFullyObscured: |  | ||||||
|                 pizza->visibility = GDK_VISIBILITY_FULLY_OBSCURED; |  | ||||||
|                 break; |  | ||||||
|  |  | ||||||
|             case VisibilityPartiallyObscured: |  | ||||||
|                 pizza->visibility = GDK_VISIBILITY_PARTIAL; |  | ||||||
|                 break; |  | ||||||
|  |  | ||||||
|             case VisibilityUnobscured: |  | ||||||
|                 pizza->visibility = GDK_VISIBILITY_UNOBSCURED; |  | ||||||
|                 break; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return GDK_FILTER_REMOVE; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return GDK_FILTER_CONTINUE; |  | ||||||
| } |  | ||||||
| #endif /* __WXGTK20__ */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif /* __cplusplus */ | #endif /* __cplusplus */ | ||||||
|   | |||||||
| @@ -65,20 +65,13 @@ | |||||||
|  |  | ||||||
| #include "wx/gtk/win_gtk.h" | #include "wx/gtk/win_gtk.h" | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| #include <pango/pangox.h> | #include <pango/pangox.h> | ||||||
|  |  | ||||||
|  | #ifdef HAVE_XIM | ||||||
|  |     #undef HAVE_XIM | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     #ifdef HAVE_XIM |  | ||||||
|         #undef HAVE_XIM |  | ||||||
|     #endif |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| extern GtkContainerClass *pizza_parent_class; | extern GtkContainerClass *pizza_parent_class; | ||||||
| #endif |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // documentation on internals | // documentation on internals | ||||||
| @@ -237,12 +230,6 @@ wxWindowGTK *g_focusWindowLast = (wxWindowGTK*) NULL; | |||||||
| // yet, defer setting the focus to idle time. | // yet, defer setting the focus to idle time. | ||||||
| wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; | wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; | ||||||
|  |  | ||||||
| // hack: we need something to pass to gtk_menu_popup, so we store the time of |  | ||||||
| // the last click here (extern: used from gtk/menu.cpp) |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
| guint32 wxGtkTimeLastClick = 0; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| extern bool g_mainThreadLocked; | extern bool g_mainThreadLocked; | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -272,14 +259,9 @@ gdk_window_warp_pointer (GdkWindow      *window, | |||||||
|                          gint            x, |                          gint            x, | ||||||
|                          gint            y) |                          gint            y) | ||||||
| { | { | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|   GdkWindowPrivate *priv; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|   if (!window) |   if (!window) | ||||||
|     window = GDK_ROOT_PARENT(); |     window = GDK_ROOT_PARENT(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|   if (!GDK_WINDOW_DESTROYED(window)) |   if (!GDK_WINDOW_DESTROYED(window)) | ||||||
|   { |   { | ||||||
|       XWarpPointer (GDK_WINDOW_XDISPLAY(window), |       XWarpPointer (GDK_WINDOW_XDISPLAY(window), | ||||||
| @@ -288,18 +270,6 @@ gdk_window_warp_pointer (GdkWindow      *window, | |||||||
|                     0, 0, 0, 0,        /* not source window -> move from anywhere */ |                     0, 0, 0, 0,        /* not source window -> move from anywhere */ | ||||||
|                     x, y ); |                     x, y ); | ||||||
|   } |   } | ||||||
| #else |  | ||||||
|   priv = (GdkWindowPrivate*) window; |  | ||||||
|  |  | ||||||
|   if (!priv->destroyed) |  | ||||||
|   { |  | ||||||
|       XWarpPointer (priv->xdisplay, |  | ||||||
|                     None,              /* not source window -> move from anywhere */ |  | ||||||
|                     priv->xwindow,  /* dest window */ |  | ||||||
|                     0, 0, 0, 0,        /* not source window -> move from anywhere */ |  | ||||||
|                     x, y ); |  | ||||||
|   } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -433,30 +403,12 @@ static gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g | |||||||
|  |  | ||||||
|     draw_frame( widget, win ); |     draw_frame( widget, win ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|  |  | ||||||
|     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event); |     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event); | ||||||
|  |  | ||||||
| #endif |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
| // "draw" of m_widget |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| extern "C" { |  | ||||||
| static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindowGTK *win ) |  | ||||||
| { |  | ||||||
|     draw_frame( widget, win ); |  | ||||||
| } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #endif // GTK+ < 2.0 |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // "size_request" of m_widget | // "size_request" of m_widget | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -522,7 +474,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, | |||||||
|     if (g_isIdle) |     if (g_isIdle) | ||||||
|         wxapp_install_idle_handler(); |         wxapp_install_idle_handler(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // This callback gets called in drawing-idle time under |     // This callback gets called in drawing-idle time under | ||||||
|     // GTK 2.0, so we don't need to defer anything to idle |     // GTK 2.0, so we don't need to defer anything to idle | ||||||
|     // time anymore. |     // time anymore. | ||||||
| @@ -562,147 +513,11 @@ static int gtk_window_expose_callback( GtkWidget *widget, | |||||||
|  |  | ||||||
|     // Let parent window draw window-less widgets |     // Let parent window draw window-less widgets | ||||||
|     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event); |     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event); | ||||||
| #else |  | ||||||
|     // This gets called immediately after an expose event |  | ||||||
|     // under GTK 1.2 so we collect the calls and wait for |  | ||||||
|     // the idle handler to pick things up. |  | ||||||
|  |  | ||||||
|     win->GetUpdateRegion().Union( gdk_event->area.x, |  | ||||||
|                                   gdk_event->area.y, |  | ||||||
|                                   gdk_event->area.width, |  | ||||||
|                                   gdk_event->area.height ); |  | ||||||
|     win->m_clearRegion.Union( gdk_event->area.x, |  | ||||||
|                                   gdk_event->area.y, |  | ||||||
|                                   gdk_event->area.width, |  | ||||||
|                                   gdk_event->area.height ); |  | ||||||
|  |  | ||||||
|     // Actual redrawing takes place in idle time. |  | ||||||
|     // win->GtkUpdate(); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
| // "event" of m_wxwindow |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| // GTK thinks it is clever and filters out a certain amount of "unneeded" |  | ||||||
| // expose events. We need them, of course, so we override the main event |  | ||||||
| // procedure in GtkWidget by giving our own handler for all system events. |  | ||||||
| // There, we look for expose events ourselves whereas all other events are |  | ||||||
| // handled normally. |  | ||||||
|  |  | ||||||
| extern "C" { |  | ||||||
| static |  | ||||||
| gint gtk_window_event_event_callback( GtkWidget *widget, |  | ||||||
|                                       GdkEventExpose *event, |  | ||||||
|                                       wxWindow *win ) |  | ||||||
| { |  | ||||||
|     if (event->type == GDK_EXPOSE) |  | ||||||
|     { |  | ||||||
|         gint ret = gtk_window_expose_callback( widget, event, win ); |  | ||||||
|         return ret; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return FALSE; |  | ||||||
| } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #endif // !GTK+ 2 |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
| // "draw" of m_wxwindow |  | ||||||
| //----------------------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|  |  | ||||||
| // This callback is a complete replacement of the gtk_pizza_draw() function, |  | ||||||
| // which is disabled. |  | ||||||
|  |  | ||||||
| extern "C" { |  | ||||||
| static void gtk_window_draw_callback( GtkWidget *widget, |  | ||||||
|                                       GdkRectangle *rect, |  | ||||||
|                                       wxWindow *win ) |  | ||||||
| { |  | ||||||
|     DEBUG_MAIN_THREAD |  | ||||||
|  |  | ||||||
|     if (g_isIdle) |  | ||||||
|         wxapp_install_idle_handler(); |  | ||||||
|  |  | ||||||
|     // if there are any children we must refresh everything |  | ||||||
|     // |  | ||||||
|     // VZ: why? |  | ||||||
|     if ( !win->HasFlag(wxFULL_REPAINT_ON_RESIZE) && |  | ||||||
|             win->GetChildren().IsEmpty() ) |  | ||||||
|     { |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| #if 0 |  | ||||||
|     if (win->GetName()) |  | ||||||
|     { |  | ||||||
|         wxPrintf( wxT("OnDraw from ") ); |  | ||||||
|         if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) |  | ||||||
|             wxPrintf( win->GetClassInfo()->GetClassName() ); |  | ||||||
|         wxPrintf( wxT(" %d %d %d %d\n"), (int)rect->x, |  | ||||||
|                                          (int)rect->y, |  | ||||||
|                                          (int)rect->width, |  | ||||||
|                                          (int)rect->height ); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #ifndef __WXUNIVERSAL__ |  | ||||||
|     GtkPizza *pizza = GTK_PIZZA (widget); |  | ||||||
|  |  | ||||||
|     if (win->GetThemeEnabled() && win->GetBackgroundStyle() == wxBG_STYLE_SYSTEM) |  | ||||||
|     { |  | ||||||
|         wxWindow *parent = win->GetParent(); |  | ||||||
|         while (parent && !parent->IsTopLevel()) |  | ||||||
|             parent = parent->GetParent(); |  | ||||||
|         if (!parent) |  | ||||||
|             parent = win; |  | ||||||
|  |  | ||||||
|         gtk_paint_flat_box (parent->m_widget->style, |  | ||||||
|                             pizza->bin_window, |  | ||||||
|                             GTK_STATE_NORMAL, |  | ||||||
|                             GTK_SHADOW_NONE, |  | ||||||
|                             rect, |  | ||||||
|                             parent->m_widget, |  | ||||||
|                             (char *)"base", |  | ||||||
|                             0, 0, -1, -1); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     win->m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height ); |  | ||||||
|     win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height ); |  | ||||||
|  |  | ||||||
|     // Update immediately, not in idle time. |  | ||||||
|     win->GtkUpdate(); |  | ||||||
|  |  | ||||||
| #ifndef __WXUNIVERSAL__ |  | ||||||
|     // Redraw child widgets |  | ||||||
|     GList *children = pizza->children; |  | ||||||
|     while (children) |  | ||||||
|     { |  | ||||||
|         GtkPizzaChild *child = (GtkPizzaChild*) children->data; |  | ||||||
|         children = children->next; |  | ||||||
|  |  | ||||||
|         GdkRectangle child_area; |  | ||||||
|         if (gtk_widget_intersect (child->widget, rect, &child_area)) |  | ||||||
|         { |  | ||||||
|             gtk_widget_draw (child->widget, &child_area /* (GdkRectangle*) NULL*/ ); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // "key_press_event" from any window | // "key_press_event" from any window | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -1125,7 +940,6 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| struct wxGtkIMData | struct wxGtkIMData | ||||||
| { | { | ||||||
|     GtkIMContext *context; |     GtkIMContext *context; | ||||||
| @@ -1141,7 +955,6 @@ struct wxGtkIMData | |||||||
|         g_object_unref(context); |         g_object_unref(context); | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
| #endif |  | ||||||
|  |  | ||||||
| extern "C" { | extern "C" { | ||||||
| static gint gtk_window_key_press_callback( GtkWidget *widget, | static gint gtk_window_key_press_callback( GtkWidget *widget, | ||||||
| @@ -1170,7 +983,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, | |||||||
|         return_after_IM = true; |         return_after_IM = true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // 2005.01.26 modified by Hong Jen Yee (hzysoft@sina.com.tw): |     // 2005.01.26 modified by Hong Jen Yee (hzysoft@sina.com.tw): | ||||||
|     // When we get a key_press event here, it could be originate |     // When we get a key_press event here, it could be originate | ||||||
|     // from the current widget or its child widgets.  However, only the widget |     // from the current widget or its child widgets.  However, only the widget | ||||||
| @@ -1195,74 +1007,13 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, | |||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| #endif |  | ||||||
|     if (return_after_IM) |     if (return_after_IM) | ||||||
|         return false; |         return false; | ||||||
|  |  | ||||||
|     // Emit KEY_DOWN event |     // Emit KEY_DOWN event | ||||||
|     ret = win->GetEventHandler()->ProcessEvent( event ); |     ret = win->GetEventHandler()->ProcessEvent( event ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     // This is for GTK+ 1.2 only. The char event generatation for GTK+ 2.0 is done |  | ||||||
|     // in the "commit" handler. |  | ||||||
|  |  | ||||||
|     // 2005.02.02 modified by Hong Jen Yee (hzysoft@sina.com.tw). |  | ||||||
|     // In GTK+ 1.2, strings sent by IMs are also regarded as key_press events whose |  | ||||||
|     // keyCodes cannot be recognized by wxWidgets. These MBCS strings, however, are |  | ||||||
|     // composed of more than one character, which means gdk_event->length will always |  | ||||||
|     // greater than one. When gtk_event->length == 1, this may be an ASCII character |  | ||||||
|     // and can be translated by wx.  However, when MBCS characters are sent by IM, |  | ||||||
|     // gdk_event->length will >= 2. So neither should we pass it to accelerator table, |  | ||||||
|     // nor should we pass it to controls. The following explanation was excerpted |  | ||||||
|     // from GDK documentation. |  | ||||||
|     // gint length : the length of string. |  | ||||||
|     // gchar *string : a null-terminated multi-byte string containing the composed |  | ||||||
|     // characters resulting from the key press. When text is being input, in a GtkEntry |  | ||||||
|     // for example, it is these characters which should be added to the input buffer. |  | ||||||
|     // When using Input Methods to support internationalized text input, the composed |  | ||||||
|     // characters appear here after the pre-editing has been completed. |  | ||||||
|  |  | ||||||
|     if ( (!ret) && (gdk_event->length > 1) ) // If this event contains a pre-edited string from IM. |  | ||||||
|     { |  | ||||||
|         // We should translate this key event into wxEVT_CHAR not wxEVT_KEY_DOWN. |  | ||||||
|         #if wxUSE_UNICODE   // GTK+ 1.2 is not UTF-8 based. |  | ||||||
|             const wxWCharBuffer string = wxConvLocal.cMB2WC( gdk_event->string ); |  | ||||||
|             if( !string ) |  | ||||||
|                 return false; |  | ||||||
|         #else |  | ||||||
|             const char* string = gdk_event->string; |  | ||||||
|         #endif |  | ||||||
|  |  | ||||||
|         // Implement OnCharHook by checking ancestor top level windows |  | ||||||
|         wxWindow *parent = win; |  | ||||||
|         while (parent && !parent->IsTopLevel()) |  | ||||||
|             parent = parent->GetParent(); |  | ||||||
|  |  | ||||||
|         for( const wxChar* pstr = string; *pstr; pstr++ ) |  | ||||||
|         { |  | ||||||
|         #if wxUSE_UNICODE |  | ||||||
|             event.m_uniChar = *pstr; |  | ||||||
|             // Backward compatible for ISO-8859-1 |  | ||||||
|             event.m_keyCode = *pstr < 256 ? event.m_uniChar : 0; |  | ||||||
|         #else |  | ||||||
|             event.m_keyCode = *pstr; |  | ||||||
|         #endif |  | ||||||
|             if (parent) |  | ||||||
|             { |  | ||||||
|                 event.SetEventType( wxEVT_CHAR_HOOK ); |  | ||||||
|                 ret = parent->GetEventHandler()->ProcessEvent( event ); |  | ||||||
|             } |  | ||||||
|             if (!ret) |  | ||||||
|             { |  | ||||||
|                 event.SetEventType(wxEVT_CHAR); |  | ||||||
|                 win->GetEventHandler()->ProcessEvent( event ); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         return true; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| #endif  // #ifndef  __WXGTK20__ |  | ||||||
|  |  | ||||||
| #if wxUSE_ACCEL | #if wxUSE_ACCEL | ||||||
|     if (!ret) |     if (!ret) | ||||||
|     { |     { | ||||||
| @@ -1404,7 +1155,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, | |||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| extern "C" { | extern "C" { | ||||||
| static void gtk_wxwindow_commit_cb (GtkIMContext *context, | static void gtk_wxwindow_commit_cb (GtkIMContext *context, | ||||||
|                            const gchar  *str, |                            const gchar  *str, | ||||||
| @@ -1460,7 +1210,6 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context, | |||||||
|     } |     } | ||||||
| } | } | ||||||
| } | } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -1799,22 +1548,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, | |||||||
|     if ( !g_captureWindow ) |     if ( !g_captureWindow ) | ||||||
|         win = FindWindowForMouseEvent(win, event.m_x, event.m_y); |         win = FindWindowForMouseEvent(win, event.m_x, event.m_y); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     wxGtkTimeLastClick = gdk_event->time; |  | ||||||
|  |  | ||||||
|     if (event_type == wxEVT_LEFT_DCLICK) |  | ||||||
|     { |  | ||||||
|         // GTK 1.2 crashes when intercepting double |  | ||||||
|         // click events from both wxSpinButton and |  | ||||||
|         // wxSpinCtrl |  | ||||||
|         if (GTK_IS_SPIN_BUTTON(win->m_widget)) |  | ||||||
|         { |  | ||||||
|             // Just disable this event for now. |  | ||||||
|             return FALSE; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #endif // !__WXGTK20__ |  | ||||||
|  |  | ||||||
|     if (win->GetEventHandler()->ProcessEvent( event )) |     if (win->GetEventHandler()->ProcessEvent( event )) | ||||||
|     { |     { | ||||||
|         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" ); |         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" ); | ||||||
| @@ -1980,7 +1713,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, | |||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // "mouse_wheel_event" | // "mouse_wheel_event" | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -2052,7 +1784,6 @@ static gboolean wxgtk_window_popup_menu_callback(GtkWidget*, wxWindowGTK* win) | |||||||
|     return win->GetEventHandler()->ProcessEvent(event); |     return win->GetEventHandler()->ProcessEvent(event); | ||||||
| } | } | ||||||
| } | } | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // "focus_in_event" | // "focus_in_event" | ||||||
| @@ -2083,10 +1814,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, | |||||||
|     if (g_isIdle) |     if (g_isIdle) | ||||||
|         wxapp_install_idle_handler(); |         wxapp_install_idle_handler(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (win->m_imData) |     if (win->m_imData) | ||||||
|         gtk_im_context_focus_in(win->m_imData->context); |         gtk_im_context_focus_in(win->m_imData->context); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     g_focusWindowLast = |     g_focusWindowLast = | ||||||
|     g_focusWindow = win; |     g_focusWindow = win; | ||||||
| @@ -2137,10 +1866,8 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk | |||||||
|     if (g_isIdle) |     if (g_isIdle) | ||||||
|         wxapp_install_idle_handler(); |         wxapp_install_idle_handler(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (win->m_imData) |     if (win->m_imData) | ||||||
|         gtk_im_context_focus_out(win->m_imData->context); |         gtk_im_context_focus_out(win->m_imData->context); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxLogTrace( TRACE_FOCUS, |     wxLogTrace( TRACE_FOCUS, | ||||||
|                 _T("%s: focus out"), win->GetName().c_str() ); |                 _T("%s: focus out"), win->GetName().c_str() ); | ||||||
| @@ -2306,9 +2033,6 @@ static void gtk_window_vscroll_callback( GtkAdjustment *adjust, | |||||||
|  |  | ||||||
|     win->m_oldVerticalPos = adjust->value; |     win->m_oldVerticalPos = adjust->value; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     GtkScrolledWindow   *sw = GTK_SCROLLED_WINDOW(win->m_widget); |  | ||||||
| #endif |  | ||||||
|     wxEventType         command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->vscrollbar)); |     wxEventType         command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->vscrollbar)); | ||||||
|  |  | ||||||
|     int value = (int)(adjust->value+0.5); |     int value = (int)(adjust->value+0.5); | ||||||
| @@ -2339,9 +2063,6 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust, | |||||||
|     float diff = adjust->value - win->m_oldHorizontalPos; |     float diff = adjust->value - win->m_oldHorizontalPos; | ||||||
|     if (fabs(diff) < 0.2) return; |     if (fabs(diff) < 0.2) return; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     GtkScrolledWindow   *sw = GTK_SCROLLED_WINDOW(win->m_widget); |  | ||||||
| #endif |  | ||||||
|     wxEventType         command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->hscrollbar)); |     wxEventType         command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->hscrollbar)); | ||||||
|  |  | ||||||
|     win->m_oldHorizontalPos = adjust->value; |     win->m_oldHorizontalPos = adjust->value; | ||||||
| @@ -2371,8 +2092,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, | |||||||
|  |  | ||||||
|     g_blockEventsOnScroll = true; |     g_blockEventsOnScroll = true; | ||||||
|  |  | ||||||
|     // FIXME: there is no 'slider' field in GTK+ 2.0 any more | // FIXME: there is no 'slider' field in GTK+ 2.0 any more | ||||||
| #ifndef __WXGTK20__ | #if 0 | ||||||
|     win->m_isScrolling = (gdk_event->window == widget->slider); |     win->m_isScrolling = (gdk_event->window == widget->slider); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -2454,14 +2175,12 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) | |||||||
|     if (g_isIdle) |     if (g_isIdle) | ||||||
|         wxapp_install_idle_handler(); |         wxapp_install_idle_handler(); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (win->m_imData) |     if (win->m_imData) | ||||||
|     { |     { | ||||||
|         GtkPizza *pizza = GTK_PIZZA( m_widget ); |         GtkPizza *pizza = GTK_PIZZA( m_widget ); | ||||||
|         gtk_im_context_set_client_window( win->m_imData->context, |         gtk_im_context_set_client_window( win->m_imData->context, | ||||||
|                                           pizza->bin_window ); |                                           pizza->bin_window ); | ||||||
|     } |     } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxWindowCreateEvent event( win ); |     wxWindowCreateEvent event( win ); | ||||||
|     event.SetEventObject( win ); |     event.SetEventObject( win ); | ||||||
| @@ -2751,15 +2470,8 @@ void wxWindowGTK::Init() | |||||||
|  |  | ||||||
|     m_cursor = *wxSTANDARD_CURSOR; |     m_cursor = *wxSTANDARD_CURSOR; | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     m_imData = NULL; |     m_imData = NULL; | ||||||
|     m_dirtyTabOrder = false; |     m_dirtyTabOrder = false; | ||||||
| #else |  | ||||||
| #ifdef HAVE_XIM |  | ||||||
|     m_ic = (GdkIC*) NULL; |  | ||||||
|     m_icattr = (GdkICAttr*) NULL; |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| wxWindowGTK::wxWindowGTK() | wxWindowGTK::wxWindowGTK() | ||||||
| @@ -2925,10 +2637,8 @@ wxWindowGTK::~wxWindowGTK() | |||||||
|         gdk_ic_attr_destroy (m_icattr); |         gdk_ic_attr_destroy (m_icattr); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     // delete before the widgets to avoid a crash on solaris |     // delete before the widgets to avoid a crash on solaris | ||||||
|     delete m_imData; |     delete m_imData; | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     if (m_wxwindow) |     if (m_wxwindow) | ||||||
|     { |     { | ||||||
| @@ -2973,21 +2683,9 @@ void wxWindowGTK::PostCreation() | |||||||
|             gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", |             gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", | ||||||
|                 GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); |                 GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|             gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", |  | ||||||
|                 GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); |  | ||||||
|  |  | ||||||
|             if (!HasFlag(wxFULL_REPAINT_ON_RESIZE)) |  | ||||||
|             { |  | ||||||
|                 gtk_signal_connect( GTK_OBJECT(m_wxwindow), "event", |  | ||||||
|                     GTK_SIGNAL_FUNC(gtk_window_event_event_callback), (gpointer)this ); |  | ||||||
|             } |  | ||||||
| #else |  | ||||||
|             // gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), !HasFlag( wxFULL_REPAINT_ON_RESIZE ) ); |             // gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), !HasFlag( wxFULL_REPAINT_ON_RESIZE ) ); | ||||||
| #endif |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         // Create input method handler |         // Create input method handler | ||||||
|         m_imData = new wxGtkIMData; |         m_imData = new wxGtkIMData; | ||||||
|  |  | ||||||
| @@ -2996,16 +2694,11 @@ void wxWindowGTK::PostCreation() | |||||||
|  |  | ||||||
|         g_signal_connect (G_OBJECT (m_imData->context), "commit", |         g_signal_connect (G_OBJECT (m_imData->context), "commit", | ||||||
|                           G_CALLBACK (gtk_wxwindow_commit_cb), this); |                           G_CALLBACK (gtk_wxwindow_commit_cb), this); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         // these are called when the "sunken" or "raised" borders are drawn |         // these are called when the "sunken" or "raised" borders are drawn | ||||||
|         gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event", |         gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event", | ||||||
|           GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this ); |           GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|         gtk_signal_connect( GTK_OBJECT(m_widget), "draw", |  | ||||||
|           GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this ); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // focus handling |     // focus handling | ||||||
| @@ -3094,12 +2787,10 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) | |||||||
|     gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event", |     gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event", | ||||||
|       GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this ); |       GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     gtk_signal_connect( GTK_OBJECT(widget), "scroll_event", |     gtk_signal_connect( GTK_OBJECT(widget), "scroll_event", | ||||||
|       GTK_SIGNAL_FUNC(gtk_window_wheel_callback), (gpointer)this ); |       GTK_SIGNAL_FUNC(gtk_window_wheel_callback), (gpointer)this ); | ||||||
|     g_signal_connect(widget, "popup_menu", |     g_signal_connect(widget, "popup_menu", | ||||||
|         G_CALLBACK(wxgtk_window_popup_menu_callback), this); |         G_CALLBACK(wxgtk_window_popup_menu_callback), this); | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event", |     gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event", | ||||||
|       GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this ); |       GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this ); | ||||||
| @@ -3198,7 +2889,6 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags | |||||||
|         /* the default button has a border around it */ |         /* the default button has a border around it */ | ||||||
|         if (GTK_WIDGET_CAN_DEFAULT(m_widget)) |         if (GTK_WIDGET_CAN_DEFAULT(m_widget)) | ||||||
|         { |         { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|             GtkBorder *default_border = NULL; |             GtkBorder *default_border = NULL; | ||||||
|             gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); |             gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); | ||||||
|             if (default_border) |             if (default_border) | ||||||
| @@ -3209,12 +2899,6 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags | |||||||
|                 bottom_border += default_border->bottom; |                 bottom_border += default_border->bottom; | ||||||
|                 g_free( default_border ); |                 g_free( default_border ); | ||||||
|             } |             } | ||||||
| #else |  | ||||||
|             left_border = 6; |  | ||||||
|             right_border = 6; |  | ||||||
|             top_border = 6; |  | ||||||
|             bottom_border = 5; |  | ||||||
| #endif |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         DoMoveWindow( m_x-top_border, |         DoMoveWindow( m_x-top_border, | ||||||
| @@ -3253,10 +2937,9 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags | |||||||
|  |  | ||||||
| void wxWindowGTK::OnInternalIdle() | void wxWindowGTK::OnInternalIdle() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if ( m_dirtyTabOrder ) |     if ( m_dirtyTabOrder ) | ||||||
|         RealizeTabOrder(); |         RealizeTabOrder(); | ||||||
| #endif |  | ||||||
|     // Update style if the window was not yet realized |     // Update style if the window was not yet realized | ||||||
|     // and SetBackgroundStyle(wxBG_STYLE_CUSTOM) was called |     // and SetBackgroundStyle(wxBG_STYLE_CUSTOM) was called | ||||||
|     if (m_needsStyleChange) |     if (m_needsStyleChange) | ||||||
| @@ -3590,7 +3273,6 @@ int wxWindowGTK::GetCharHeight() const | |||||||
|     wxFont font = GetFont(); |     wxFont font = GetFont(); | ||||||
|     wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") ); |     wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     PangoContext *context = NULL; |     PangoContext *context = NULL; | ||||||
|     if (m_widget) |     if (m_widget) | ||||||
|         context = gtk_widget_get_pango_context( m_widget ); |         context = gtk_widget_get_pango_context( m_widget ); | ||||||
| @@ -3610,11 +3292,6 @@ int wxWindowGTK::GetCharHeight() const | |||||||
|     g_object_unref( G_OBJECT( layout ) ); |     g_object_unref( G_OBJECT( layout ) ); | ||||||
|  |  | ||||||
|     return (int) PANGO_PIXELS(rect.height); |     return (int) PANGO_PIXELS(rect.height); | ||||||
| #else |  | ||||||
|     GdkFont *gfont = font.GetInternalFont( 1.0 ); |  | ||||||
|  |  | ||||||
|     return gfont->ascent + gfont->descent; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| int wxWindowGTK::GetCharWidth() const | int wxWindowGTK::GetCharWidth() const | ||||||
| @@ -3624,7 +3301,6 @@ int wxWindowGTK::GetCharWidth() const | |||||||
|     wxFont font = GetFont(); |     wxFont font = GetFont(); | ||||||
|     wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") ); |     wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") ); | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     PangoContext *context = NULL; |     PangoContext *context = NULL; | ||||||
|     if (m_widget) |     if (m_widget) | ||||||
|         context = gtk_widget_get_pango_context( m_widget ); |         context = gtk_widget_get_pango_context( m_widget ); | ||||||
| @@ -3644,11 +3320,6 @@ int wxWindowGTK::GetCharWidth() const | |||||||
|     g_object_unref( G_OBJECT( layout ) ); |     g_object_unref( G_OBJECT( layout ) ); | ||||||
|  |  | ||||||
|     return (int) PANGO_PIXELS(rect.width); |     return (int) PANGO_PIXELS(rect.width); | ||||||
| #else |  | ||||||
|     GdkFont *gfont = font.GetInternalFont( 1.0 ); |  | ||||||
|  |  | ||||||
|     return gdk_string_width( gfont, "g" ); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxWindowGTK::GetTextExtent( const wxString& string, | void wxWindowGTK::GetTextExtent( const wxString& string, | ||||||
| @@ -3669,7 +3340,6 @@ void wxWindowGTK::GetTextExtent( const wxString& string, | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     PangoContext *context = NULL; |     PangoContext *context = NULL; | ||||||
|     if (m_widget) |     if (m_widget) | ||||||
|         context = gtk_widget_get_pango_context( m_widget ); |         context = gtk_widget_get_pango_context( m_widget ); | ||||||
| @@ -3710,13 +3380,6 @@ void wxWindowGTK::GetTextExtent( const wxString& string, | |||||||
|     if (externalLeading) (*externalLeading) = 0;  // ?? |     if (externalLeading) (*externalLeading) = 0;  // ?? | ||||||
|  |  | ||||||
|     g_object_unref( G_OBJECT( layout ) ); |     g_object_unref( G_OBJECT( layout ) ); | ||||||
| #else |  | ||||||
|     GdkFont *font = fontToUse.GetInternalFont( 1.0 ); |  | ||||||
|     if (x) (*x) = gdk_string_width( font, wxGTK_CONV( string ) ); |  | ||||||
|     if (y) (*y) = font->ascent + font->descent; |  | ||||||
|     if (descent) (*descent) = font->descent; |  | ||||||
|     if (externalLeading) (*externalLeading) = 0;  // ?? |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxWindowGTK::SetFocus() | void wxWindowGTK::SetFocus() | ||||||
| @@ -3737,13 +3400,11 @@ void wxWindowGTK::SetFocus() | |||||||
|     } |     } | ||||||
|     else if (m_widget) |     else if (m_widget) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         if (GTK_IS_CONTAINER(m_widget)) |         if (GTK_IS_CONTAINER(m_widget)) | ||||||
|         { |         { | ||||||
|             gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD ); |             gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD ); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
| #endif |  | ||||||
|         if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) ) |         if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) ) | ||||||
|         { |         { | ||||||
|  |  | ||||||
| @@ -3768,13 +3429,6 @@ void wxWindowGTK::SetFocus() | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|         if (GTK_IS_CONTAINER(m_widget)) |  | ||||||
|         { |  | ||||||
|             gtk_container_focus( GTK_CONTAINER(m_widget), GTK_DIR_TAB_FORWARD ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
| #endif |  | ||||||
|         { |         { | ||||||
|            wxLogTrace(TRACE_FOCUS, |            wxLogTrace(TRACE_FOCUS, | ||||||
|                       _T("Can't set focus to %s(%s)"), |                       _T("Can't set focus to %s(%s)"), | ||||||
| @@ -3839,8 +3493,6 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child) | |||||||
|     (*m_insertCallback)(this, child); |     (*m_insertCallback)(this, child); | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|  |  | ||||||
| void wxWindowGTK::AddChild(wxWindowBase *child) | void wxWindowGTK::AddChild(wxWindowBase *child) | ||||||
| { | { | ||||||
|     wxWindowBase::AddChild(child); |     wxWindowBase::AddChild(child); | ||||||
| @@ -3893,8 +3545,6 @@ void wxWindowGTK::RealizeTabOrder() | |||||||
|     m_dirtyTabOrder = false; |     m_dirtyTabOrder = false; | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif // __WXGTK20__ |  | ||||||
|  |  | ||||||
| void wxWindowGTK::Raise() | void wxWindowGTK::Raise() | ||||||
| { | { | ||||||
|     wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); |     wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); | ||||||
| @@ -3964,67 +3614,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) | |||||||
|     if (!m_widget->window) |     if (!m_widget->window) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     if (g_isIdle) |  | ||||||
|         wxapp_install_idle_handler(); |  | ||||||
|  |  | ||||||
|     wxRect myRect; |  | ||||||
|     if (m_wxwindow && rect) |  | ||||||
|     { |  | ||||||
|         myRect.SetSize(wxSize( m_wxwindow->allocation.width, |  | ||||||
|                                m_wxwindow->allocation.height)); |  | ||||||
|         if ( myRect.Intersect(*rect).IsEmpty() ) |  | ||||||
|         { |  | ||||||
|             // nothing to do, rectangle is empty |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         rect = &myRect; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // schedule the area for later updating in GtkUpdate() |  | ||||||
|     if (eraseBackground && m_wxwindow && m_wxwindow->window) |  | ||||||
|     { |  | ||||||
|         if (rect) |  | ||||||
|         { |  | ||||||
|             m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             m_clearRegion.Clear(); |  | ||||||
|             m_clearRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height ); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (rect) |  | ||||||
|     { |  | ||||||
|         if (m_wxwindow) |  | ||||||
|         { |  | ||||||
|             m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             GdkRectangle gdk_rect; |  | ||||||
|             gdk_rect.x = rect->x; |  | ||||||
|             gdk_rect.y = rect->y; |  | ||||||
|             gdk_rect.width = rect->width; |  | ||||||
|             gdk_rect.height = rect->height; |  | ||||||
|             gtk_widget_draw( m_widget, &gdk_rect ); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         if (m_wxwindow) |  | ||||||
|         { |  | ||||||
|             m_updateRegion.Clear(); |  | ||||||
|             m_updateRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height ); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             gtk_widget_draw( m_widget, (GdkRectangle*) NULL ); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #else // GTK+ 2 |  | ||||||
|     if (m_wxwindow) |     if (m_wxwindow) | ||||||
|     { |     { | ||||||
|         GdkRectangle gdk_rect, |         GdkRectangle gdk_rect, | ||||||
| @@ -4044,7 +3633,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) | |||||||
|  |  | ||||||
|         gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE ); |         gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE ); | ||||||
|     } |     } | ||||||
| #endif // GTK+ 1/2 |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxWindowGTK::Update() | void wxWindowGTK::Update() | ||||||
| @@ -4060,13 +3648,8 @@ void wxWindowGTK::Update() | |||||||
|  |  | ||||||
| void wxWindowGTK::GtkUpdate() | void wxWindowGTK::GtkUpdate() | ||||||
| { | { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window) |     if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window) | ||||||
|         gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE ); |         gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE ); | ||||||
| #else |  | ||||||
|     if (!m_updateRegion.IsEmpty()) |  | ||||||
|         GtkSendPaintEvents(); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     // for consistency with other platforms (and also because it's convenient |     // for consistency with other platforms (and also because it's convenient | ||||||
|     // to be able to update an entire TLW by calling Update() only once), we |     // to be able to update an entire TLW by calling Update() only once), we | ||||||
| @@ -4083,9 +3666,6 @@ void wxWindowGTK::GtkSendPaintEvents() | |||||||
| { | { | ||||||
|     if (!m_wxwindow) |     if (!m_wxwindow) | ||||||
|     { |     { | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|         m_clearRegion.Clear(); |  | ||||||
| #endif |  | ||||||
|         m_updateRegion.Clear(); |         m_updateRegion.Clear(); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| @@ -4129,7 +3709,6 @@ void wxWindowGTK::GtkSendPaintEvents() | |||||||
|     } |     } | ||||||
|     else |     else | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|     { |     { | ||||||
|         wxWindowDC dc( (wxWindow*)this ); |         wxWindowDC dc( (wxWindow*)this ); | ||||||
|         dc.SetClippingRegion( m_updateRegion ); |         dc.SetClippingRegion( m_updateRegion ); | ||||||
| @@ -4139,38 +3718,6 @@ void wxWindowGTK::GtkSendPaintEvents() | |||||||
|  |  | ||||||
|         GetEventHandler()->ProcessEvent(erase_event); |         GetEventHandler()->ProcessEvent(erase_event); | ||||||
|     } |     } | ||||||
| #else |  | ||||||
|     // if (!m_clearRegion.IsEmpty())   // Always send an erase event under GTK 1.2 |  | ||||||
|     { |  | ||||||
|         wxWindowDC dc( (wxWindow*)this ); |  | ||||||
|         if (m_clearRegion.IsEmpty()) |  | ||||||
|             dc.SetClippingRegion( m_updateRegion ); |  | ||||||
|         else |  | ||||||
|             dc.SetClippingRegion( m_clearRegion ); |  | ||||||
|  |  | ||||||
|         wxEraseEvent erase_event( GetId(), &dc ); |  | ||||||
|         erase_event.SetEventObject( this ); |  | ||||||
|  |  | ||||||
|         if (!GetEventHandler()->ProcessEvent(erase_event) && GetBackgroundStyle() != wxBG_STYLE_CUSTOM) |  | ||||||
|         { |  | ||||||
|             if (!g_eraseGC) |  | ||||||
|             { |  | ||||||
|                 g_eraseGC = gdk_gc_new( pizza->bin_window ); |  | ||||||
|                 gdk_gc_set_fill( g_eraseGC, GDK_SOLID ); |  | ||||||
|             } |  | ||||||
|             gdk_gc_set_foreground( g_eraseGC, GetBackgroundColour().GetColor() ); |  | ||||||
|  |  | ||||||
|             wxRegionIterator upd( m_clearRegion ); |  | ||||||
|             while (upd) |  | ||||||
|             { |  | ||||||
|                 gdk_draw_rectangle( pizza->bin_window, g_eraseGC, 1, |  | ||||||
|                                     upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() ); |  | ||||||
|                 upd ++; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         m_clearRegion.Clear(); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     wxNcPaintEvent nc_paint_event( GetId() ); |     wxNcPaintEvent nc_paint_event( GetId() ); | ||||||
|     nc_paint_event.SetEventObject( this ); |     nc_paint_event.SetEventObject( this ); | ||||||
| @@ -4182,67 +3729,12 @@ void wxWindowGTK::GtkSendPaintEvents() | |||||||
|  |  | ||||||
|     m_clipPaintRegion = false; |     m_clipPaintRegion = false; | ||||||
|  |  | ||||||
| #if !defined(__WXUNIVERSAL__) && !defined(__WXGTK20__) |  | ||||||
|     // The following code will result in all window-less widgets |  | ||||||
|     // being redrawn because the wxWidgets class is allowed to |  | ||||||
|     // paint over the window-less widgets. |  | ||||||
|  |  | ||||||
|     GList *children = pizza->children; |  | ||||||
|     while (children) |  | ||||||
|     { |  | ||||||
|         GtkPizzaChild *child = (GtkPizzaChild*) children->data; |  | ||||||
|         children = children->next; |  | ||||||
|  |  | ||||||
|         if (GTK_WIDGET_NO_WINDOW (child->widget) && |  | ||||||
|             GTK_WIDGET_DRAWABLE (child->widget)) |  | ||||||
|         { |  | ||||||
|             // Get intersection of widget area and update region |  | ||||||
|             wxRegion region( m_updateRegion ); |  | ||||||
|  |  | ||||||
|             GdkEventExpose gdk_event; |  | ||||||
|             gdk_event.type = GDK_EXPOSE; |  | ||||||
|             gdk_event.window = pizza->bin_window; |  | ||||||
|             gdk_event.count = 0; |  | ||||||
|             gdk_event.send_event = TRUE; |  | ||||||
|  |  | ||||||
|             wxRegionIterator upd( m_updateRegion ); |  | ||||||
|             while (upd) |  | ||||||
|             { |  | ||||||
|                 GdkRectangle rect; |  | ||||||
|                 rect.x = upd.GetX(); |  | ||||||
|                 rect.y = upd.GetY(); |  | ||||||
|                 rect.width = upd.GetWidth(); |  | ||||||
|                 rect.height = upd.GetHeight(); |  | ||||||
|  |  | ||||||
|                 if (gtk_widget_intersect (child->widget, &rect, &gdk_event.area)) |  | ||||||
|                 { |  | ||||||
|                     gtk_widget_event (child->widget, (GdkEvent*) &gdk_event); |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 upd ++; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #endif // native GTK 1 |  | ||||||
|  |  | ||||||
|     m_updateRegion.Clear(); |     m_updateRegion.Clear(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void wxWindowGTK::ClearBackground() | void wxWindowGTK::ClearBackground() | ||||||
| { | { | ||||||
|     wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); |     wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     if (m_wxwindow && m_wxwindow->window) |  | ||||||
|     { |  | ||||||
|         m_clearRegion.Clear(); |  | ||||||
|         wxSize size( GetClientSize() ); |  | ||||||
|         m_clearRegion.Union( 0,0,size.x,size.y ); |  | ||||||
|  |  | ||||||
|         // Better do this in idle? |  | ||||||
|         GtkUpdate(); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #if wxUSE_TOOLTIPS | #if wxUSE_TOOLTIPS | ||||||
| @@ -4304,12 +3796,10 @@ bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __WXGTK20__ |  | ||||||
| PangoContext *wxWindowGTK::GtkGetPangoDefaultContext() | PangoContext *wxWindowGTK::GtkGetPangoDefaultContext() | ||||||
| { | { | ||||||
|     return gtk_widget_get_pango_context( m_widget ); |     return gtk_widget_get_pango_context( m_widget ); | ||||||
| } | } | ||||||
| #endif |  | ||||||
|  |  | ||||||
| GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) | GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) | ||||||
| { | { | ||||||
| @@ -4325,13 +3815,8 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) | |||||||
|  |  | ||||||
|     if ( m_font.Ok() ) |     if ( m_font.Ok() ) | ||||||
|     { |     { | ||||||
| #ifdef __WXGTK20__ |  | ||||||
|         style->font_desc = |         style->font_desc = | ||||||
|             pango_font_description_copy( m_font.GetNativeFontInfo()->description ); |             pango_font_description_copy( m_font.GetNativeFontInfo()->description ); | ||||||
| #else |  | ||||||
|         wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName(); |  | ||||||
|         style->fontset_name = g_strdup(xfontname.c_str()); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if ( m_foregroundColour.Ok() ) |     if ( m_foregroundColour.Ok() ) | ||||||
| @@ -4687,28 +4172,6 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) | |||||||
|     // No scrolling requested. |     // No scrolling requested. | ||||||
|     if ((dx == 0) && (dy == 0)) return; |     if ((dx == 0) && (dy == 0)) return; | ||||||
|  |  | ||||||
| #ifndef __WXGTK20__ |  | ||||||
|     if (!m_updateRegion.IsEmpty()) |  | ||||||
|     { |  | ||||||
|         m_updateRegion.Offset( dx, dy ); |  | ||||||
|  |  | ||||||
|         int cw = 0; |  | ||||||
|         int ch = 0; |  | ||||||
|         GetClientSize( &cw, &ch ); |  | ||||||
|         m_updateRegion.Intersect( 0, 0, cw, ch ); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (!m_clearRegion.IsEmpty()) |  | ||||||
|     { |  | ||||||
|         m_clearRegion.Offset( dx, dy ); |  | ||||||
|  |  | ||||||
|         int cw = 0; |  | ||||||
|         int ch = 0; |  | ||||||
|         GetClientSize( &cw, &ch ); |  | ||||||
|         m_clearRegion.Intersect( 0, 0, cw, ch ); |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     m_clipPaintRegion = true; |     m_clipPaintRegion = true; | ||||||
|  |  | ||||||
|     gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); |     gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user