From 68567a967bc8afd37a40cb9a7ee5021b9ee6cd96 Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Sun, 22 Jan 2006 20:29:17 +0000 Subject: [PATCH] Nuke GTK1 from src/gtk git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37056 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/app.cpp | 56 +---- src/gtk/bitmap.cpp | 48 +--- src/gtk/bmpbuttn.cpp | 11 +- src/gtk/button.cpp | 27 --- src/gtk/checkbox.cpp | 12 - src/gtk/choice.cpp | 29 --- src/gtk/clipbrd.cpp | 2 - src/gtk/colour.cpp | 12 - src/gtk/combobox.cpp | 24 +- src/gtk/control.cpp | 13 - src/gtk/dcclient.cpp | 124 +--------- src/gtk/dcmemory.cpp | 8 - src/gtk/dcscreen.cpp | 2 - src/gtk/dnd.cpp | 14 +- src/gtk/font.cpp | 357 ---------------------------- src/gtk/fontdlg.cpp | 27 --- src/gtk/glcanvas.cpp | 29 --- src/gtk/listbox.cpp | 4 - src/gtk/menu.cpp | 114 --------- src/gtk/minifram.cpp | 57 ----- src/gtk/notebook.cpp | 8 +- src/gtk/radiobox.cpp | 7 - src/gtk/region.cpp | 103 -------- src/gtk/renderer.cpp | 80 +------ src/gtk/scrolbar.cpp | 14 +- src/gtk/settings.cpp | 15 -- src/gtk/slider.cpp | 14 -- src/gtk/statbmp.cpp | 18 -- src/gtk/statbox.cpp | 2 - src/gtk/stattext.cpp | 15 -- src/gtk/tbargtk.cpp | 39 +-- src/gtk/textctrl.cpp | 547 +----------------------------------------- src/gtk/toplevel.cpp | 95 -------- src/gtk/utilsgtk.cpp | 9 - src/gtk/win_gtk.c | 454 +---------------------------------- src/gtk/window.cpp | 551 +------------------------------------------ 36 files changed, 31 insertions(+), 2910 deletions(-) diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index aaf7989b30..862bf4da14 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -164,30 +164,12 @@ bool wxApp::Yield(bool onlyIfNeeded) // wxWakeUpIdle //----------------------------------------------------------------------------- -// RR/KH: The wxMutexGui calls are not needed on GTK2 according to -// the GTK faq, http://www.gtk.org/faq/#AEN500 -// 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. +// RR/KH: No wxMutexGui calls are needed here according to the GTK faq, +// http://www.gtk.org/faq/#AEN500 - this caused problems for wxPostEvent. void wxApp::WakeUpIdle() { -#ifndef __WXGTK20__ -#if wxUSE_THREADS - if (!wxThread::IsMain()) - wxMutexGuiEnter(); -#endif // wxUSE_THREADS_ -#endif // __WXGTK2__ - 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) { wxWindow* win = (wxWindow*) wxTopLevelWindows.GetLast()->GetData(); -#ifdef __WXGTK20__ if (win->IsKindOf(CLASSINFO(wxMessageDialog))) -#else - if (win->IsKindOf(CLASSINFO(wxGenericMessageDialog))) -#endif win->OnInternalIdle(); } return TRUE; @@ -469,14 +447,8 @@ bool wxApp::OnInitGui() // chosen a specific visual, then derive the GdkVisual from that if (m_glVisualInfo != NULL) { -#ifdef __WXGTK20__ // seems gtk_widget_set_default_visual no longer exists? 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 ); gtk_widget_set_default_colormap( colormap ); @@ -490,13 +462,8 @@ bool wxApp::OnInitGui() else if ((gdk_visual_get_best() != gdk_visual_get_system()) && (m_useBestVisual)) { -#ifdef __WXGTK20__ /* seems gtk_widget_set_default_visual no longer exists? */ 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 ); gtk_widget_set_default_colormap( colormap ); @@ -575,7 +542,7 @@ GdkVisual *wxApp::GetGdkVisual() bool wxApp::Initialize(int& argc, wxChar **argv) { bool init_result; - + #if wxUSE_THREADS // GTK 1.2 up to version 1.2.3 has broken threads if ((gtk_major_version == 1) && @@ -595,19 +562,13 @@ bool wxApp::Initialize(int& argc, wxChar **argv) // We should have the wxUSE_WCHAR_T test on the _outside_ #if wxUSE_WCHAR_T - #if defined(__WXGTK20__) - // gtk+ 2.0 supports Unicode through UTF-8 strings - wxConvCurrent = &wxConvUTF8; - #else // GTK 1.x - if (!wxOKlibc()) - wxConvCurrent = &wxConvLocal; - #endif + // gtk+ 2.0 supports Unicode through UTF-8 strings + wxConvCurrent = &wxConvUTF8; #else // !wxUSE_WCHAR_T if (!wxOKlibc()) wxConvCurrent = (wxMBConv*) NULL; #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T -#ifdef __WXGTK20__ // decide which conversion to use for the file names // (1) this variable exists for the sole purpose of specifying the encoding @@ -617,7 +578,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) if (encName == _T("@locale")) encName.clear(); encName.MakeUpper(); -#if wxUSE_INTL +#if wxUSE_INTL if (encName.empty()) { // (2) if a non default locale is set, assume that the user wants his @@ -634,7 +595,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #endif // wxUSE_INTL static wxConvBrokenFileNames fileconv(encName); wxConvFileName = &fileconv; -#endif // __WXGTK20__ #if wxUSE_UNICODE // gtk_init() wants UTF-8, not wchar_t, so convert @@ -648,7 +608,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) argvGTK[argc] = NULL; int argcGTK = argc; - + #ifdef __WXGPE__ init_result = true; // is there a _check() version of this? gpe_application_init( &argcGTK, &argvGTK ); @@ -688,7 +648,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxLogError(wxT("Unable to initialize gtk, is DISPLAY set properly?")); return false; } - + // we can not enter threads before gtk_init is done gdk_threads_enter(); diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 46ffd4b0ca..7f0b385f9b 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -20,21 +20,15 @@ #include "wx/dcmemory.h" #include "wx/app.h" -#ifdef __WXGTK20__ #include "wx/rawbmp.h" // need this to get gdk_image_new_bitmap() #define GDK_ENABLE_BROKEN -#endif #include #include #include -#ifdef __WXGTK20__ - #include -#else // GTK+ 1.2 - #include -#endif // GTK+ 2.0/1.2 +#include #include "wx/math.h" @@ -240,9 +234,7 @@ public: GdkPixmap *m_pixmap; GdkBitmap *m_bitmap; -#ifdef __WXGTK20__ GdkPixbuf *m_pixbuf; -#endif wxMask *m_mask; int m_width; int m_height; @@ -254,9 +246,7 @@ wxBitmapRefData::wxBitmapRefData() { m_pixmap = (GdkPixmap *) NULL; m_bitmap = (GdkBitmap *) NULL; -#ifdef __WXGTK20__ m_pixbuf = (GdkPixbuf *) NULL; -#endif m_mask = (wxMask *) NULL; m_width = 0; m_height = 0; @@ -270,10 +260,8 @@ wxBitmapRefData::~wxBitmapRefData() gdk_pixmap_unref( m_pixmap ); if (m_bitmap) gdk_bitmap_unref( m_bitmap ); -#ifdef __WXGTK20__ if (m_pixbuf) gdk_pixbuf_unref( m_pixbuf ); -#endif delete m_mask; #if wxUSE_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_bpp = 1; } -#ifdef __WXGTK20__ else if (depth == 32) { M_BMPDATA->m_pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, true, 8, width, height); M_BMPDATA->m_bpp = 32; } -#endif else { 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; -#ifdef __WXGTK20__ if (HasPixbuf()) { bmp.SetWidth(width); @@ -397,7 +382,6 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, GDK_INTERP_BILINEAR); } else -#endif // __WXGTK20__ { GdkImage *img = (GdkImage*) NULL; if (GetPixmap()) @@ -587,10 +571,9 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth) } else { -#ifdef __WXGTK20__ if (image.HasAlpha()) return CreateFromImageAsPixbuf(image); -#endif + return CreateFromImageAsPixmap(image); } } @@ -935,7 +918,6 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img) return true; } -#ifdef __WXGTK20__ bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image) { int width = image.GetWidth(); @@ -978,7 +960,6 @@ bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image) return true; } -#endif // __WXGTK20__ wxImage wxBitmap::ConvertToImage() const { @@ -995,7 +976,6 @@ wxImage wxBitmap::ConvertToImage() const return wxNullImage; } -#ifdef __WXGTK20__ if (HasPixbuf()) { GdkPixbuf *pixbuf = GetPixbuf(); @@ -1023,7 +1003,6 @@ wxImage wxBitmap::ConvertToImage() const } } else -#endif // __WXGTK20__ { // the colour used as transparent one in wxImage and the one it is // replaced with when it really occurs in the bitmap @@ -1223,9 +1202,7 @@ bool wxBitmap::Ok() const { return (m_refData != NULL) && ( -#ifdef __WXGTK20__ M_BMPDATA->m_pixbuf || -#endif 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 ); wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") ); -#ifdef __WXGTK20__ if (HasPixbuf()) { GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, @@ -1295,7 +1271,6 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const pixbuf, 0, 0); } else -#endif // __WXGTK20__ { if (ret.GetPixmap()) { @@ -1439,9 +1414,7 @@ void wxBitmap::SetPixmap( GdkPixmap *pixmap ) m_refData = new wxBitmapRefData(); M_BMPDATA->m_pixmap = pixmap; -#ifdef __WXGTK20__ PurgeOtherRepresentations(Pixmap); -#endif } void wxBitmap::SetBitmap( GdkPixmap *bitmap ) @@ -1450,16 +1423,13 @@ void wxBitmap::SetBitmap( GdkPixmap *bitmap ) m_refData = new wxBitmapRefData(); M_BMPDATA->m_bitmap = bitmap; -#ifdef __WXGTK20__ PurgeOtherRepresentations(Pixmap); -#endif } GdkPixmap *wxBitmap::GetPixmap() const { wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, wxT("invalid bitmap") ); -#ifdef __WXGTK20__ // create the pixmap on the fly if we use Pixbuf representation: if (HasPixbuf() && !HasPixmap()) { @@ -1470,7 +1440,6 @@ GdkPixmap *wxBitmap::GetPixmap() const &M_BMPDATA->m_mask->m_bitmap, 128 /*threshold*/); } -#endif // __WXGTK20__ return M_BMPDATA->m_pixmap; } @@ -1489,7 +1458,6 @@ GdkBitmap *wxBitmap::GetBitmap() const return M_BMPDATA->m_bitmap; } -#ifdef __WXGTK20__ GdkPixbuf *wxBitmap::GetPixbuf() const { 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) { -#ifdef __WXGTK20__ if (bpp != 32) return NULL; @@ -1593,9 +1558,6 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) data.m_stride = gdk_pixbuf_get_rowstride( pixbuf ); return gdk_pixbuf_get_pixels( pixbuf ); -#else - return NULL; -#endif } void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data)) @@ -1605,18 +1567,12 @@ void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data)) bool wxBitmap::HasAlpha() const { -#ifdef __WXGTK20__ return HasPixbuf(); -#else - return false; -#endif } void wxBitmap::UseAlpha() { -#ifdef __WXGTK20__ GetPixbuf(); -#endif } //----------------------------------------------------------------------------- diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 8ab5eaa6cd..9955a41022 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -224,29 +224,22 @@ void wxBitmapButton::OnSetBitmap() { // initial bitmap GtkWidget *pixmap; -#ifdef __WXGTK20__ + if (the_one.HasPixbuf()) pixmap = gtk_image_new_from_pixbuf(the_one.GetPixbuf()); else 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_container_add(GTK_CONTAINER(m_widget), pixmap); } else { // subsequent bitmaps -#ifdef __WXGTK20__ GtkImage *pixmap = GTK_IMAGE(child); if (the_one.HasPixbuf()) gtk_image_set_from_pixbuf(pixmap, the_one.GetPixbuf()); else 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 } } diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index ca57fcc514..2fd0db643d 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -76,7 +76,6 @@ gtk_button_style_set_callback( GtkWidget *m_widget, GtkStyle *WXUNUSED(style), w /* the default button has a border around it */ if (GTK_WIDGET_CAN_DEFAULT(m_widget)) { -#ifdef __WXGTK20__ GtkBorder *default_border = NULL; gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); if (default_border) @@ -87,12 +86,6 @@ gtk_button_style_set_callback( GtkWidget *m_widget, GtkStyle *WXUNUSED(style), w bottom_border += default_border->bottom; 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->m_y-left_border, win->m_width+left_border+right_border, @@ -130,11 +123,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, return FALSE; } -#ifdef __WXGTK20__ m_widget = gtk_button_new_with_mnemonic(""); -#else - m_widget = gtk_button_new_with_label(""); -#endif float x_alignment = 0.5; if (HasFlag(wxBU_LEFT)) @@ -197,7 +186,6 @@ void wxButton::SetDefault() /* static */ wxSize wxButtonBase::GetDefaultSize() { -#ifdef __WXGTK20__ static wxSize size = wxDefaultSize; if (size == wxDefaultSize) { @@ -228,9 +216,6 @@ wxSize wxButtonBase::GetDefaultSize() gtk_widget_destroy(wnd); } return size; -#else - return wxSize(80,26); -#endif } void wxButton::SetLabel( const wxString &lbl ) @@ -246,7 +231,6 @@ void wxButton::SetLabel( const wxString &lbl ) const wxString labelGTK = GTKConvertMnemonics(label); -#ifdef __WXGTK20__ if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label)) { 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); 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 ) @@ -279,11 +260,7 @@ bool wxButton::Enable( bool enable ) bool wxButton::IsOwnGtkWindow( GdkWindow *window ) { -#ifdef __WXGTK20__ return GTK_BUTTON(m_widget)->event_window; -#else - return (window == m_widget->window); -#endif } void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) @@ -313,10 +290,6 @@ wxSize wxButton::DoGetBestSize() const 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)) { wxSize defaultSize = GetDefaultSize(); diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 4e6cc8f252..f76fdded93 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -48,7 +48,6 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) if (cb->m_blockEvent) return; -#ifdef __WXGTK20__ // Transitions for 3state checkbox must be done manually, GTK's checkbox // is 2state with additional "undetermined state" flag which isn't // changed automatically: @@ -94,14 +93,9 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) gtk_toggle_button_set_inconsistent(toggle, false); } } -#endif wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); -#ifdef __WXGTK20__ event.SetInt(cb->Get3StateValue()); -#else - event.SetInt(cb->GetValue()); -#endif event.SetEventObject(cb); cb->GetEventHandler()->ProcessEvent(event); } @@ -197,14 +191,9 @@ bool wxCheckBox::GetValue() const { wxCHECK_MSG( m_widgetCheckbox != NULL, FALSE, wxT("invalid checkbox") ); -#ifdef __WXGTK20__ 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) { SetValue(state != wxCHK_UNCHECKED); @@ -223,7 +212,6 @@ wxCheckBoxState wxCheckBox::DoGet3StateValue() const return GetValue() ? wxCHK_CHECKED : wxCHK_UNCHECKED; } } -#endif void wxCheckBox::SetLabel( const wxString& label ) { diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index f5a9bd5034..1f7e316042 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -45,25 +45,8 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice * int selection = wxNOT_FOUND; -#ifdef __WXGTK20__ 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; 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") ); -#ifdef __WXGTK20__ wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text( label) ) ); -#else - wxString tmp( label->label ); -#endif if (string.IsSameAs( tmp, bCase )) return count; @@ -427,11 +406,7 @@ wxString wxChoice::GetString( int n ) const wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); -#ifdef __WXGTK20__ return wxString( wxGTK_CONV_BACK( gtk_label_get_text( label) ) ); -#else - return wxString( label->label ); -#endif } child = child->next; count++; @@ -622,11 +597,7 @@ wxSize wxChoice::DoGetBestSize() const bool wxChoice::IsOwnGtkWindow( GdkWindow *window ) { -#ifdef __WXGTK20__ return GTK_BUTTON(m_widget)->event_window; -#else - return (window == m_widget->window); -#endif } // static diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index 712b6ed9e8..8f586d58ae 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -274,7 +274,6 @@ selection_handler( GtkWidget *WXUNUSED(widget), // Text data will be in UTF8 in Unicode mode. data->GetDataHere( selection_data->target, d ); -#ifdef __WXGTK20__ // NB: GTK+ requires special treatment of UTF8_STRING data, the text // would show as UTF-8 data interpreted as latin1 (?) in other // GTK+ apps if we used gtk_selection_data_set() @@ -286,7 +285,6 @@ selection_handler( GtkWidget *WXUNUSED(widget), size-1 ); } else -#endif { gtk_selection_data_set( selection_data, diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index 2b63a69a0c..3e2386a840 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -92,14 +92,8 @@ void wxColourRefData::FreeColour() { if (m_colormap) { -#ifdef __WXGTK20__ if ((m_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || (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; colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; @@ -117,14 +111,8 @@ void wxColourRefData::AllocColour( GdkColormap *cmap ) FreeColour(); -#ifdef __WXGTK20__ if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || (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 ); int idx = m_color.pixel; diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 517993327f..b5a8f059a5 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -238,17 +238,11 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, // and case-sensitive gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE ); -#ifdef __WXGTK20__ if (style & wxNO_BORDER) g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL ); -#endif 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++) { 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 ); GtkLabel *label = GTK_LABEL( bin->child ); -#ifdef __WXGTK20__ wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); -#else - wxString str( label->label ); -#endif + if (item.IsSameAs( str , bCase ) ) return count; @@ -607,11 +598,7 @@ wxString wxComboBox::GetString( int n ) const { GtkBin *bin = GTK_BIN( child->data ); GtkLabel *label = GTK_LABEL( bin->child ); -#ifdef __WXGTK20__ str = wxGTK_CONV_BACK( gtk_label_get_text(label) ); -#else - str = wxString( label->label ); -#endif } else { @@ -632,11 +619,7 @@ wxString wxComboBox::GetStringSelection() const { GtkBin *bin = GTK_BIN( selection->data ); GtkLabel *label = GTK_LABEL( bin->child ); -#ifdef __WXGTK20__ wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); -#else - wxString tmp( label->label ); -#endif return tmp; } @@ -832,15 +815,10 @@ void wxComboBox::GetSelection( long* from, long* to ) const if (IsEditable()) { GtkEditable *editable = GTK_EDITABLE(GTK_COMBO(m_widget)->entry); -#ifdef __WXGTK20__ gint start, end; gtk_editable_get_selection_bounds(editable, & start, & end); *from = start; *to = end; -#else - *from = (long) editable->selection_start_pos; - *to = (long) editable->selection_end_pos; -#endif } } diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index d339e25aeb..921820d427 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -107,11 +107,7 @@ void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label) const wxString labelGTK = GTKConvertMnemonics(label); -#ifdef __WXGTK20__ 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) @@ -208,11 +204,7 @@ wxString wxControl::GTKRemoveMnemonics(const wxString& label) /* static */ wxString wxControl::GTKConvertMnemonics(const wxString& label) { -#ifdef __WXGTK20__ return GTKProcessMnemonics(label, MNEMONICS_CONVERT); -#else - return GTKRemoveMnemonics(label); -#endif } // ---------------------------------------------------------------------------- @@ -263,7 +255,6 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, style->bg[state].blue >> SHIFT); // get the style's font -#ifdef __WXGTK20__ if ( !style->font_desc ) style = gtk_widget_get_default_style(); if ( style && style->font_desc ) @@ -286,10 +277,6 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, attr.font = wxFont(wxString::FromAscii(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; } diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index d97e4ae8de..57bce1de01 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -92,7 +92,6 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable, wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") ); wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") ); -#ifdef __WXGTK20__ gint src_width, src_height; gdk_drawable_get_size(src, &src_width, &src_height); if (width == -1) width = src_width; @@ -106,33 +105,6 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable, width, height, 0, 0, 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_isScreenDC = false; m_owner = (wxWindow *)NULL; -#ifdef __WXGTK20__ m_context = (PangoContext *)NULL; m_layout = (PangoLayout *)NULL; m_fontdesc = (PangoFontDescription *)NULL; -#endif } wxWindowDC::wxWindowDC( wxWindow *window ) @@ -322,11 +292,9 @@ wxWindowDC::wxWindowDC( wxWindow *window ) wxASSERT_MSG( widget, wxT("DC needs a widget") ); -#ifdef __WXGTK20__ m_context = window->GtkGetPangoDefaultContext(); m_layout = pango_layout_new( m_context ); m_fontdesc = pango_font_description_copy( widget->style->font_desc ); -#endif GtkPizza *pizza = GTK_PIZZA( widget ); m_window = pizza->bin_window; @@ -358,12 +326,10 @@ wxWindowDC::~wxWindowDC() { Destroy(); -#ifdef __WXGTK20__ if (m_layout) g_object_unref( G_OBJECT( m_layout ) ); if (m_fontdesc) pango_font_description_free( m_fontdesc ); -#endif } void wxWindowDC::SetUpDC() @@ -1184,7 +1150,6 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, // drawing a mono-bitmap (XBitmap) we use the current text GC if (is_mono) { -#ifdef __WXGTK20__ GdkPixmap *bitmap2 = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); GdkGC *gc = gdk_gc_new( bitmap2 ); gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); @@ -1195,9 +1160,6 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, gdk_bitmap_unref( bitmap2 ); gdk_gc_unref( gc ); -#else - gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); -#endif } else { @@ -1442,7 +1404,6 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, if (is_mono) { -#ifdef __WXGTK20__ GdkPixmap *bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bm_ww, bm_hh, -1 ); GdkGC *gc = gdk_gc_new( bitmap ); gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); @@ -1453,10 +1414,6 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, gdk_bitmap_unref( bitmap ); 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 { @@ -1529,16 +1486,9 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) if (text.empty()) return; -#ifndef __WXGTK20__ - GdkFont *font = m_font.GetInternalFont( m_scaleY ); - - wxCHECK_RET( font, wxT("invalid font") ); -#endif - x = XLOG2DEV(x); y = YLOG2DEV(y); -#ifdef __WXGTK20__ wxCHECK_RET( m_context, wxT("no Pango context") ); wxCHECK_RET( m_layout, wxT("no Pango layout") ); 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 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); height = wxCoord(height / m_scaleY); CalcBoundingBox (x + width, y + height); @@ -1671,19 +1598,9 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, wxCoord w; wxCoord h; -#ifdef __WXGTK20__ - // implement later without GdkFont for GTK 2.0 + // TODO: implement later without GdkFont for GTK 2.0 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 wxBitmap src(w, h); wxMemoryDC dc; @@ -1786,7 +1703,6 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, return; } -#ifdef __WXGTK20__ // Set new font description if (theFont) pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description ); @@ -1832,52 +1748,22 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, // Reset old font description if (theFont) 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 { -#ifdef __WXGTK20__ pango_layout_set_text( m_layout, "H", 1 ); int w; pango_layout_get_pixel_size( m_layout, &w, NULL ); 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 { -#ifdef __WXGTK20__ pango_layout_set_text( m_layout, "H", 1 ); int h; pango_layout_get_pixel_size( m_layout, NULL, &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() @@ -1922,7 +1808,6 @@ void wxWindowDC::SetFont( const wxFont &font ) { m_font = font; -#ifdef __WXGTK20__ if (m_font.Ok()) { if (m_fontdesc) @@ -1951,7 +1836,6 @@ void wxWindowDC::SetFont( const wxFont &font ) pango_layout_set_font_description( m_layout, m_fontdesc ); } -#endif } void wxWindowDC::SetPen( const wxPen &pen ) @@ -2433,13 +2317,7 @@ wxSize wxWindowDC::GetPPI() const int wxWindowDC::GetDepth() const { -#ifdef __WXGTK20__ return gdk_drawable_get_depth(m_window); -#else - wxFAIL_MSG(wxT("not implemented")); - - return -1; -#endif } diff --git a/src/gtk/dcmemory.cpp b/src/gtk/dcmemory.cpp index 5d945a329f..3894dd4f2e 100644 --- a/src/gtk/dcmemory.cpp +++ b/src/gtk/dcmemory.cpp @@ -27,14 +27,12 @@ wxMemoryDC::wxMemoryDC() : wxWindowDC() m_cmap = gtk_widget_get_default_colormap(); -#ifdef __WXGTK20__ m_context = gdk_pango_context_get(); // Note: The Sun customised version of Pango shipping with Solaris 10 // crashes if the language is left NULL (see bug 1374114) pango_context_set_language( m_context, gtk_get_default_language() ); m_layout = pango_layout_new( m_context ); m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) ); -#endif } wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) @@ -44,19 +42,15 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) m_cmap = gtk_widget_get_default_colormap(); -#ifdef __WXGTK20__ m_context = gdk_pango_context_get(); pango_context_set_language( m_context, gtk_get_default_language() ); m_layout = pango_layout_new( m_context ); m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) ); -#endif } wxMemoryDC::~wxMemoryDC() { -#ifdef __WXGTK20__ g_object_unref(m_context); -#endif } void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) @@ -74,9 +68,7 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) m_window = m_selected.GetBitmap(); } -#ifdef __WXGTK20__ m_selected.PurgeOtherRepresentations(wxBitmap::Pixmap); -#endif m_isMemDC = TRUE; diff --git a/src/gtk/dcscreen.cpp b/src/gtk/dcscreen.cpp index bf7d10404d..c4a198a618 100644 --- a/src/gtk/dcscreen.cpp +++ b/src/gtk/dcscreen.cpp @@ -37,14 +37,12 @@ wxScreenDC::wxScreenDC() m_cmap = gdk_colormap_get_system(); m_window = GDK_ROOT_PARENT(); -#ifdef __WXGTK20__ m_context = gdk_pango_context_get(); // Note: The Sun customised version of Pango shipping with Solaris 10 // crashes if the language is left NULL (see bug 1374114) pango_context_set_language( m_context, gtk_get_default_language() ); m_layout = pango_layout_new( m_context ); // m_fontdesc = pango_font_description_copy( widget->style->font_desc ); -#endif m_isScreenDC = TRUE; diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index c56c806047..ba5dbeeec6 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -506,13 +506,7 @@ GdkAtom wxDropTarget::GetMatchingPair() GList *child = m_dragContext->targets; while (child) { - // in GTK+ 1.x GdkAtom was a gulong, but now it's a pointer - GdkAtom formatAtom = -#ifdef __WXGTK20__ - (GdkAtom)(child->data); -#else - GPOINTER_TO_INT(child->data); -#endif + GdkAtom formatAtom = (GdkAtom)(child->data); wxDataFormat format( formatAtom ); #ifdef __WXDEBUG__ @@ -823,18 +817,12 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) gdk_window_get_size (pixmap, &width, &height); 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); 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_app_paintable (GTK_WIDGET (m_iconWindow), TRUE); -#ifndef __WXGTK20__ - gtk_widget_pop_visual (); -#endif gtk_widget_pop_colormap (); gtk_widget_set_usize (m_iconWindow, width, height); diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index e174e7c2d0..120d0a87e5 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -73,13 +73,8 @@ public: // do we have the native font info? bool HasNativeFont() const { -#ifdef __WXGTK20__ // we always have a Pango font description 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 @@ -98,26 +93,6 @@ public: // and this one also modifies all the other font data fields 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: // common part of all ctors void Init(int pointSize, @@ -135,11 +110,6 @@ private: // clear m_scaled_xfonts if any 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_family, m_style, @@ -187,7 +157,6 @@ void wxFontRefData::Init(int pointSize, m_noAA = FALSE; -#ifdef __WXGTK20__ // Create native font info m_nativeFontInfo.description = pango_font_description_new(); @@ -218,14 +187,12 @@ void wxFontRefData::Init(int pointSize, SetStyle( m_style ); SetPointSize( m_pointSize ); SetWeight( m_weight ); -#endif // GTK 2.0 } void wxFontRefData::InitFromNative() { m_noAA = FALSE; -#ifdef __WXGTK20__ // Get native info PangoFontDescription *desc = m_nativeFontInfo.description; @@ -263,105 +230,6 @@ void wxFontRefData::InitFromNative() // Cannot we choose that 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 ) @@ -395,29 +263,13 @@ wxFontRefData::wxFontRefData(int size, int family, int style, wxFontRefData::wxFontRefData(const wxString& fontname) { - // VZ: FromString() should really work in both cases, doesn't it? -#ifdef __WXGTK20__ m_nativeFontInfo.FromString( fontname ); -#else // GTK 1.x - m_nativeFontInfo.SetXFontName(fontname); -#endif // GTK 2.0/1.x InitFromNative(); } 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() @@ -433,20 +285,7 @@ void wxFontRefData::SetPointSize(int pointSize) { m_pointSize = pointSize; -#ifdef __WXGTK20__ 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) @@ -460,67 +299,14 @@ void wxFontRefData::SetStyle(int style) { m_style = style; -#ifdef __WXGTK20__ 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) { m_weight = weight; -#ifdef __WXGTK20__ 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) @@ -534,31 +320,12 @@ void wxFontRefData::SetFaceName(const wxString& facename) { m_faceName = facename; -#ifdef __WXGTK20__ m_nativeFontInfo.SetFaceName(facename); -#else - if ( HasNativeFont() ) - { - m_nativeFontInfo.SetXFontComponent(wxXLFD_FAMILY, facename); - } -#endif } void wxFontRefData::SetEncoding(wxFontEncoding 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) @@ -586,7 +353,6 @@ wxFont::wxFont(const wxNativeFontInfo& info) { Init(); -#ifdef __WXGTK20__ Create( info.GetPointSize(), info.GetFamily(), info.GetStyle(), @@ -594,9 +360,6 @@ wxFont::wxFont(const wxNativeFontInfo& info) info.GetUnderlined(), info.GetFaceName(), info.GetEncoding() ); -#else - (void) Create(info.GetXFontName()); -#endif } bool wxFont::Create( int pointSize, @@ -745,16 +508,6 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { 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); } @@ -762,17 +515,6 @@ bool wxFont::IsFixedWidth() const { 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(); } @@ -842,102 +584,3 @@ void wxFont::SetNoAntiAliasing( bool 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 - diff --git a/src/gtk/fontdlg.cpp b/src/gtk/fontdlg.cpp index af709b3825..9398504e6e 100644 --- a/src/gtk/fontdlg.cpp +++ b/src/gtk/fontdlg.cpp @@ -69,17 +69,6 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial 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); dialog->SetChosenFont( fontname); @@ -138,19 +127,9 @@ bool wxFontDialog::DoCreate(wxWindow *parent) gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", 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_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_FUNC(gtk_fontdialog_delete_callback), (gpointer)this ); @@ -162,13 +141,7 @@ bool wxFontDialog::DoCreate(wxWindow *parent) if ( info ) { -#ifdef __WXGTK20__ 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)); } else diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp index 688402fd99..dd566c8f30 100644 --- a/src/gtk/glcanvas.cpp +++ b/src/gtk/glcanvas.cpp @@ -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 //----------------------------------------------------------------------------- @@ -429,9 +409,7 @@ bool wxGLCanvas::Create( wxWindow *parent, m_glWidget = m_wxwindow; } -#ifdef __WXGTK20__ gtk_widget_set_double_buffered( m_glWidget, FALSE ); -#endif 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_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_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); -#ifdef __WXGTK20__ if (gtk_check_version(2,2,0) != NULL) -#endif { gtk_widget_pop_visual(); gtk_widget_pop_colormap(); diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 40fb0c0a0c..80a66fbb98 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -887,11 +887,7 @@ wxString wxListBox::GetRealLabel(GList *item) const wxString str; -#ifdef __WXGTK20__ str = wxGTK_CONV_BACK( gtk_label_get_text( label ) ); -#else - str = wxString( label->label ); -#endif #if wxUSE_CHECKLISTBOX // checklistboxes have "[±] " prepended to their lables, remove it diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 2a2e7bdc25..01902dc5b3 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -44,11 +44,6 @@ // we use normal item but with a special id for the menu title static const int wxGTK_TITLE_ID = -3; -// defined in window.cpp -#ifndef __WXGTK20__ - extern guint32 wxGtkTimeLastClick; -#endif - //----------------------------------------------------------------------------- // 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(); -#ifndef __WXGTK20__ - m_accel = gtk_accel_group_new(); -#endif if (style & wxMB_DOCKABLE) { @@ -227,11 +219,6 @@ static void wxMenubarUnsetInvokingWindow( wxMenu *menu, wxWindow *win ) while (top_frame->GetParent() && !(top_frame->IsTopLevel())) 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(); while (node) { @@ -272,13 +259,6 @@ void wxMenuBar::SetInvokingWindow( wxWindow *win ) while (top_frame->GetParent() && !(top_frame->IsTopLevel())) 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(); while (node) { @@ -295,11 +275,6 @@ void wxMenuBar::UnsetInvokingWindow( wxWindow *win ) while (top_frame->GetParent() && !(top_frame->IsTopLevel())) 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(); while (node) { @@ -325,25 +300,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos) menu->SetTitle( str ); // The "m_owner" is the "menu item" -#ifdef __WXGTK20__ 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 ); @@ -774,7 +731,6 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text) continue; } -#ifdef __WXGTK20__ if ( *pc == wxT('\\') ) { // GTK 2.0 escapes "xxx/xxx" to "xxx\/xxx" @@ -782,7 +738,6 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text) label += *pc; continue; } -#endif if ( (*pc == wxT('&')) && (*(pc+1) != wxT('&')) ) { @@ -823,16 +778,7 @@ void wxMenuItem::SetText( const wxString& str ) else label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); -#ifdef __WXGTK20__ 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; @@ -1013,25 +959,16 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) GtkWidget *menuItem; wxString text; -#ifndef __WXGTK20__ - GtkLabel* label; -#endif if ( mitem->IsSeparator() ) { -#ifdef __WXGTK20__ menuItem = gtk_separator_menu_item_new(); -#else - // TODO - menuItem = gtk_menu_item_new(); -#endif } else if (mitem->GetBitmap().Ok()) { text = mitem->GetText(); const wxBitmap *bitmap = &mitem->GetBitmap(); -#ifdef __WXGTK20__ menuItem = gtk_image_menu_item_new_with_mnemonic( wxGTK_CONV( text ) ); 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 ); -#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; } else // a normal item @@ -1070,14 +1000,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) { case wxITEM_CHECK: { -#ifdef __WXGTK20__ 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; break; } @@ -1088,25 +1011,12 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) if ( m_prevRadio == NULL ) { // start of a new radio group -#ifdef __WXGTK20__ 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 { -#ifdef __WXGTK20__ 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 ) ); -#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; } @@ -1117,12 +1027,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) case wxITEM_NORMAL: { -#ifdef __WXGTK20__ 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; break; } @@ -1183,19 +1088,6 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), (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); @@ -1560,9 +1452,7 @@ void SetInvokingWindow( wxMenu *menu, wxWindow* win ) extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu, gint *x, gint *y, -#ifdef __WXGTK20__ gboolean * WXUNUSED(whatever), -#endif gpointer user_data ) { // 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 userdata, // client data 0, // button used to activate it -#ifdef __WXGTK20__ gtk_get_current_event_time() -#else - wxGtkTimeLastClick // the time of activation -#endif ); while (is_waiting) diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index 3e4e04231f..d1aeea70bc 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -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 //----------------------------------------------------------------------------- @@ -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_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 */ gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event", GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this ); @@ -401,11 +348,7 @@ void wxMiniFrame::SetTitle( const wxString &title ) { wxFrame::SetTitle( title ); -#ifdef __WXGTK20__ gdk_window_invalidate_rect( GTK_PIZZA(m_mainWidget)->bin_window, NULL, true ); -#else - gtk_widget_draw( m_mainWidget, (GdkRectangle*) NULL ); -#endif } #endif diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index fa18809974..9cc15b8a05 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -738,23 +738,17 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const const size_t count = GetPageCount(); size_t i = 0; -#ifdef __WXGTK20__ GtkNotebook * notebook = GTK_NOTEBOOK(m_widget); if (gtk_notebook_get_scrollable(notebook)); i = g_list_position( notebook->children, notebook->first_tab ); -#endif for ( ; i < count; i++ ) { wxGtkNotebookPage* nb_page = GetNotebookPage(i); 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)); -#else // !GTK+ 2.x - const gint border = 0; -#endif + if ( IsPointInsideWidget(pt, box, x, y, border) ) { // ok, we're inside this tab -- now find out where, if needed diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index abe3aed93d..80ec423554 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -385,11 +385,7 @@ wxString wxRadioBox::GetString( int n ) const GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) ); -#ifdef __WXGTK20__ wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) ); -#else - wxString str( label->label ); -#endif return str; } @@ -528,10 +524,7 @@ void wxRadioBox::GtkEnableEvents() void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style( m_widget, style ); - -#ifdef __WXGTK20__ gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); -#endif wxList::compatibility_iterator node = m_boxes.GetFirst(); while (node) diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index 93aef5fc16..71cc667463 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -23,25 +23,6 @@ #include "wx/log.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 @@ -58,11 +39,7 @@ public: wxRegionRefData(const wxRegionRefData& refData) : wxObjectRefData() { -#ifdef __WXGTK20__ m_region = gdk_region_copy(refData.m_region); -#else - m_region = gdk_regions_union(wxGdkRegion(), refData.m_region); -#endif } ~wxRegionRefData() @@ -100,21 +77,13 @@ void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) m_refData = new wxRegionRefData(); -#ifdef __WXGTK20__ 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 ) { m_refData = new wxRegionRefData(); -#ifdef __WXGTK20__ 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 ) @@ -202,13 +171,7 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) rect.width = width; rect.height = height; -#ifdef __WXGTK20__ 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; @@ -234,13 +197,7 @@ bool wxRegion::Union( const wxRegion& region ) AllocExclusive(); } -#ifdef __WXGTK20__ 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; } @@ -272,13 +229,7 @@ bool wxRegion::Intersect( const wxRegion& region ) AllocExclusive(); -#ifdef __WXGTK20__ 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; } @@ -308,13 +259,7 @@ bool wxRegion::Subtract( const wxRegion& region ) AllocExclusive(); -#ifdef __WXGTK20__ 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; } @@ -343,13 +288,7 @@ bool wxRegion::Xor( const wxRegion& region ) AllocExclusive(); -#ifdef __WXGTK20__ 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; } @@ -458,27 +397,6 @@ GdkRegion *wxRegion::GetRegion() const // 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 - -struct _XBox { - short x1, x2, y1, y2; -}; - -struct _XRegion { - long size , numRects; - _XBox *rects, extents; -}; - -#endif // GTK+ 1.x - class wxRIRefData: public wxObjectRefData { public: @@ -508,7 +426,6 @@ void wxRIRefData::CreateRects( const wxRegion& region ) if (!gdkregion) return; -#ifdef __WXGTK20__ GdkRectangle *gdkrects = NULL; gint numRects = 0; gdk_region_get_rectangles( gdkregion, &gdkrects, &numRects ); @@ -528,26 +445,6 @@ void wxRIRefData::CreateRects( const wxRegion& region ) } } 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() diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 7c0a375e80..b60fac2845 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -31,16 +31,7 @@ #include "wx/window.h" #include "wx/dc.h" #include "wx/dcclient.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 +#include "wx/settings.h" // RR: After a correction to the orientation of the sash // this doesn't seem to be required anymore and it @@ -60,13 +51,11 @@ public: const wxRect& rect, int flags = 0); -#ifdef __WXGTK20__ // draw the expanded/collapsed icon for a tree control item virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0); -#endif // GTK+ 2.0 virtual void DrawSplitterBorder(wxWindow *win, wxDC& dc, @@ -97,10 +86,8 @@ private: // used by DrawHeaderButton and DrawComboBoxDropButton static GtkWidget *GetButtonWidget(); -#ifdef __WXGTK20__ // used by DrawTreeItemButton() static GtkWidget *GetTreeWidget(); -#endif // GTK+ 2.0 }; // ============================================================================ @@ -137,8 +124,6 @@ wxRendererGTK::GetButtonWidget() return s_button; } -#ifdef __WXGTK20__ - GtkWidget * wxRendererGTK::GetTreeWidget() { @@ -157,8 +142,6 @@ wxRendererGTK::GetTreeWidget() return s_tree; } -#endif // GTK+ 2.0 - // ---------------------------------------------------------------------------- // list/tree controls drawing // ---------------------------------------------------------------------------- @@ -187,8 +170,6 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, ); } -#ifdef __WXGTK20__ - // draw a ">" or "v" button void wxRendererGTK::DrawTreeItemButton(wxWindow* win, @@ -219,23 +200,13 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win, ); } -#endif // GTK+ 2.0 // ---------------------------------------------------------------------------- // 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() { -#ifdef __WXGTK20__ static GtkWidget *s_paned = NULL; if (s_paned == NULL) s_paned = gtk_vpaned_new(); @@ -244,9 +215,6 @@ static int GetGtkSplitterFullSize() gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL); return handle_size; -#else - return SASH_SIZE + SASH_MARGIN; -#endif } wxSplitterRenderParams @@ -257,11 +225,7 @@ wxRendererGTK::GetSplitterParams(const wxWindow *WXUNUSED(win)) ( GetGtkSplitterFullSize(), 0, -#ifdef __WXGTK20__ 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, wxCoord position, wxOrientation orient, - int WXUNUSED_IN_GTK1(flags)) + int flags) { if ( !win->m_wxwindow->window ) { @@ -350,7 +314,6 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win, ); #endif -#ifdef __WXGTK20__ gtk_paint_handle ( win->m_wxwindow->style, @@ -366,45 +329,6 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win, rect.height, 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 diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index 9172d9b8b9..dc081675c1 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -118,11 +118,6 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, 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; } } @@ -344,14 +339,7 @@ void wxScrollBar::SetViewLength( int viewLength ) bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window ) { GtkRange *range = GTK_RANGE(m_widget); - 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 - ); + return ( (window == GTK_WIDGET(range)->window) ); } wxSize wxScrollBar::DoGetBestSize() const diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index ad07a8affb..d5391ad1e4 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -344,7 +344,6 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) { if (!gs_objects.m_fontSystem.Ok()) { -#ifdef __WXGTK20__ GtkWidget *widget = gtk_button_new(); GtkStyle *def = gtk_rc_get_style( widget ); if ( !def || !def->font_desc ) @@ -371,9 +370,6 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) g_free (font_name); } gtk_widget_destroy( widget ); -#else - gs_objects.m_fontSystem = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); -#endif } return gs_objects.m_fontSystem; } @@ -385,18 +381,15 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) { -#ifdef __WXGTK20__ bool success = false; guchar *data = NULL; GdkWindow *window = NULL; if(win && GTK_WIDGET_REALIZED(win->GetHandle())) window = win->GetHandle()->window; -#endif switch (index) { -#ifdef __WXGTK20__ case wxSYS_BORDER_X: case wxSYS_BORDER_Y: case wxSYS_EDGE_X: @@ -484,7 +477,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) } return -1; // no window specified -#endif // gtk2 case wxSYS_CURSOR_X: case wxSYS_CURSOR_Y: @@ -500,7 +492,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) #endif return 16; -#ifdef __WXGTK20__ case wxSYS_DCLICK_X: case wxSYS_DCLICK_Y: gint dclick_distance; @@ -514,9 +505,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) "gtk-double-click-distance", &dclick_distance, NULL); return dclick_distance * 2; -#endif // gtk2 -#ifdef __WXGTK20__ case wxSYS_DRAG_X: case wxSYS_DRAG_Y: gint drag_threshold; @@ -536,7 +525,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) } return drag_threshold * 2; -#endif // MBN: ditto for icons 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_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: if (!window) // No realized window specified, and no implementation for that case yet. @@ -635,7 +621,6 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win ) // ... return -1; -#endif // gtk2 case wxSYS_PENWINDOWS_PRESENT: // No MS Windows for Pen computing extension available in X11 based gtk+. diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index ba70dee257..8cdeb4cc19 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -93,7 +93,6 @@ static void gtk_slider_callback( GtkAdjustment *adjust, return; wxEventType evtType; -#ifdef __WXGTK20__ if ( win->m_isScrolling ) evtType = wxEVT_SCROLL_THUMBTRACK; // 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; else if ( AreSameAdjustValues(adjust->value, adjust->upper) ) evtType = wxEVT_SCROLL_BOTTOM; -#else - evtType = GtkScrollTypeToWx(GET_SCROLL_TYPE(win->m_widget)); -#endif 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) ); -#ifdef __WXGTK20__ if (style & wxSL_INVERSE) gtk_range_set_inverted( GTK_RANGE(m_widget), TRUE ); -#endif GtkEnableEvents(); gtk_signal_connect( GTK_OBJECT(m_widget), @@ -333,15 +327,7 @@ int wxSlider::GetLineSize() const bool wxSlider::IsOwnGtkWindow( GdkWindow *window ) { GtkRange *range = GTK_RANGE(m_widget); -#ifdef __WXGTK20__ 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() diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp index 64d3931648..7bc4035a18 100644 --- a/src/gtk/statbmp.cpp +++ b/src/gtk/statbmp.cpp @@ -34,15 +34,6 @@ wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap 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, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) @@ -58,12 +49,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi m_bitmap = bitmap; -#ifdef __WXGTK20__ 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()) SetBitmap(bitmap); @@ -84,7 +70,6 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); -#ifdef __WXGTK20__ if (m_bitmap.HasPixbuf()) { gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget), @@ -93,9 +78,6 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) else gtk_image_set_from_pixmap(GTK_IMAGE(m_widget), m_bitmap.GetPixmap(), mask); -#else - gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask); -#endif InvalidateBestSize(); SetSize(GetBestSize()); diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index c000c1306a..89c9c8adc3 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -88,9 +88,7 @@ void wxStaticBox::SetLabel( const wxString& label ) void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); -#ifdef __WXGTK20__ gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); -#endif } // static diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index 59817b5027..e0b063f83d 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -88,7 +88,6 @@ bool wxStaticText::Create(wxWindow *parent, PostCreation(size); // the bug below only happens with GTK 2 -#ifdef __WXGTK20__ if ( justify != GTK_JUSTIFY_LEFT ) { // if we let GTK call wxgtk_window_size_request_callback the label @@ -102,7 +101,6 @@ bool wxStaticText::Create(wxWindow *parent, (gpointer) this ); } -#endif // __WXGTK20__ return TRUE; } @@ -110,12 +108,7 @@ bool wxStaticText::Create(wxWindow *parent, wxString wxStaticText::GetLabel() const { GtkLabel *label = GTK_LABEL(m_widget); - -#ifdef __WXGTK20__ wxString str = wxGTK_CONV_BACK( gtk_label_get_text( label ) ); -#else - wxString str = wxString( label->label ); -#endif return wxString(str); } @@ -124,7 +117,6 @@ void wxStaticText::SetLabel( const wxString &label ) { wxControl::SetLabel(label); -#ifdef __WXGTK20__ // Build the colorized version of the label (markup only allowed // under GTK2): 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 ) ); } else -#endif gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) ); // 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... 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 gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE ); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 555803cd80..d767b494ae 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -57,9 +57,7 @@ static void GetGtkStyle(long style, *gtkStyle = style & wxTB_NOICONS ? GTK_TOOLBAR_TEXT : ( -#ifdef __WXGTK20__ style & wxTB_HORZ_LAYOUT ? GTK_TOOLBAR_BOTH_HORIZ : -#endif // __WXGTK20__ GTK_TOOLBAR_BOTH); } 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 *)NULL; -#ifdef __WXGTK20__ if (bitmap.HasPixbuf()) gtk_image_set_from_pixbuf( GTK_IMAGE(m_pixmap), bitmap.GetPixbuf() ); else -#endif // !__WXGTK20__ gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask ); } } @@ -292,20 +288,12 @@ bool wxToolBar::Create( wxWindow *parent, return false; } -#ifdef __WXGTK20__ m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); GtkSetStyle(); // Doesn't work this way. // GtkToolbarSpaceStyle space_style = GTK_TOOLBAR_SPACE_EMPTY; // 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); @@ -329,7 +317,7 @@ bool wxToolBar::Create( wxWindow *parent, gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); // FIXME: there is no such function for toolbars in 2.0 -#ifndef __WXGTK20__ +#if 0 if (style & wxTB_FLAT) gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE ); #endif @@ -363,13 +351,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *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; -#endif if ( tool->IsButton() ) { @@ -389,7 +371,6 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) GtkWidget *tool_pixmap = (GtkWidget *)NULL; -#ifdef __WXGTK20__ if (bitmap.HasPixbuf()) { tool_pixmap = gtk_image_new(); @@ -397,7 +378,6 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) tool->SetPixmap(bitmap); } else -#endif { GdkPixmap *pixmap = bitmap.GetPixmap(); @@ -528,11 +508,9 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase) gtk_widget_destroy( tool->m_item ); break; -#ifdef __WXGTK20__ case wxTOOL_STYLE_SEPARATOR: gtk_toolbar_remove_space( m_toolbar, pos ); break; -#endif } InvalidateBestSize(); @@ -595,11 +573,6 @@ void wxToolBar::SetMargins( int x, int y ) wxCHECK_RET( GetToolsCount() == 0, 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_yMargin = y; } @@ -607,7 +580,7 @@ void wxToolBar::SetMargins( int x, int y ) void wxToolBar::SetToolSeparation( int separation ) { // FIXME: this function disappeared -#ifndef __WXGTK20__ +#if 0 gtk_toolbar_set_space_size( m_toolbar, separation ); #endif @@ -683,15 +656,7 @@ void wxToolBar::OnInternalIdle() wxVisualAttributes wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { -#ifdef __WXGTK20__ 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 diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index a6dfa4b31d..914bae93d8 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -46,7 +46,6 @@ extern wxWindowGTK *g_delayedFocus; // helpers // ---------------------------------------------------------------------------- -#ifdef __WXGTK20__ extern "C" { static void wxGtkOnRemoveTag(GtkTextBuffer *buffer, GtkTextTag *tag, @@ -181,27 +180,6 @@ static void wxGtkTextInsert(GtkWidget *text, wxGtkTextApplyTagsFromAttr(text_buffer, attr, &start, &iter); } } -#else -extern "C" { -static void wxGtkTextInsert(GtkWidget *text, - const wxTextAttr& attr, - const char *txt, - size_t len) -{ - GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont() - : NULL; - - GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor() - : NULL; - - GdkColor *colBg = attr.HasBackgroundColour() - ? attr.GetBackgroundColour().GetColor() - : NULL; - - gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len ); -} -} -#endif // GTK 1.x // ---------------------------------------------------------------------------- // "insert_text" for GtkEntry @@ -245,7 +223,6 @@ gtk_insert_text_callback(GtkEditable *editable, } } -#ifdef __WXGTK20__ // Implementation of wxTE_AUTO_URL for wxGTK2 by Mart Raudsepp, extern "C" { @@ -452,8 +429,6 @@ au_delete_range_callback(GtkTextBuffer *buffer, } -#endif - //----------------------------------------------------------------------------- // "changed" //----------------------------------------------------------------------------- @@ -471,9 +446,6 @@ gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win ) wxapp_install_idle_handler(); win->SetModified(); -#ifndef __WXGTK20__ - win->UpdateFontIfNeeded(); -#endif // !__WXGTK20__ wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() ); event.SetEventObject( win ); @@ -485,7 +457,6 @@ gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win ) // "expose_event" from scrolled window and textview //----------------------------------------------------------------------------- -#ifdef __WXGTK20__ extern "C" { static gboolean gtk_text_exposed_callback( GtkWidget *widget, GdkEventExpose *event, wxTextCtrl *win ) @@ -493,60 +464,7 @@ gtk_text_exposed_callback( GtkWidget *widget, GdkEventExpose *event, wxTextCtrl return TRUE; } } -#endif - -//----------------------------------------------------------------------------- -// "changed" from vertical scrollbar -//----------------------------------------------------------------------------- - -#ifndef __WXGTK20__ -extern "C" { -static void -gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) -{ - if (!win->m_hasVMT) return; - - if (g_isIdle) - wxapp_install_idle_handler(); - - win->CalculateScrollbar(); -} -} -#endif - -// ---------------------------------------------------------------------------- -// redraw callback for multiline text -// ---------------------------------------------------------------------------- - -#ifndef __WXGTK20__ - -// redrawing a GtkText from inside a wxYield() call results in crashes (the -// text sample shows it in its "Add lines" command which shows wxProgressDialog -// which implicitly calls wxYield()) so we override GtkText::draw() and simply -// don't do anything if we're inside wxYield() - -extern bool wxIsInsideYield; - -extern "C" { - typedef void (*GtkDrawCallback)(GtkWidget *widget, GdkRectangle *rect); -} - -static GtkDrawCallback gs_gtk_text_draw = NULL; - -extern "C" { -static void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect) -{ - if ( !wxIsInsideYield ) - { - wxCHECK_RET( gs_gtk_text_draw != wxgtk_text_draw, - _T("infinite recursion in wxgtk_text_draw aborted") ); - - gs_gtk_text_draw(widget, rect); - } -} -} -#endif // __WXGTK20__ //----------------------------------------------------------------------------- // wxTextCtrl @@ -569,7 +487,6 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo) EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo) -#ifdef __WXGTK20__ // wxTE_AUTO_URL wxTextUrl support. Currently only creates // wxTextUrlEvent in the same cases as wxMSW, more can be added here. EVT_MOTION (wxTextCtrl::OnUrlMouseEvent) @@ -579,7 +496,6 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) EVT_RIGHT_DOWN (wxTextCtrl::OnUrlMouseEvent) EVT_RIGHT_UP (wxTextCtrl::OnUrlMouseEvent) EVT_RIGHT_DCLICK(wxTextCtrl::OnUrlMouseEvent) -#endif END_EVENT_TABLE() void wxTextCtrl::Init() @@ -589,21 +505,17 @@ void wxTextCtrl::Init() SetUpdateFont(false); m_text = m_vScrollbar = (GtkWidget *)NULL; -#ifdef __WXGTK20__ m_frozenness = 0; m_gdkHandCursor = NULL; m_gdkXTermCursor = NULL; -#endif } wxTextCtrl::~wxTextCtrl() { -#ifdef __WXGTK20__ if(m_gdkHandCursor) gdk_cursor_unref(m_gdkHandCursor); if(m_gdkXTermCursor) gdk_cursor_unref(m_gdkXTermCursor); -#endif } wxTextCtrl::wxTextCtrl( wxWindow *parent, @@ -646,7 +558,6 @@ bool wxTextCtrl::Create( wxWindow *parent, if (multi_line) { -#ifdef __WXGTK20__ // Create view m_text = gtk_text_view_new(); @@ -689,30 +600,6 @@ bool wxTextCtrl::Create( wxWindow *parent, gtk_widget_add_events( GTK_WIDGET(m_text), GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); -#else // GTK+ 1 - // create our control ... - m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); - - // ... and put into the upper left hand corner of the table - bool bHasHScrollbar = false; - m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE); - GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); - gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1, - (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK), - (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK), - 0, 0); - - // always wrap words - gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE ); - - // finally, put the vertical scrollbar in the upper right corner - m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj ); - GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS ); - gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1, - GTK_FILL, - (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), - 0, 0); -#endif // GTK+ 2/1 } else { @@ -720,10 +607,8 @@ bool wxTextCtrl::Create( wxWindow *parent, m_widget = m_text = gtk_entry_new(); -#ifdef __WXGTK20__ if (style & wxNO_BORDER) g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL ); -#endif } m_parent->DoAddChild( this ); @@ -735,53 +620,9 @@ bool wxTextCtrl::Create( wxWindow *parent, if (multi_line) gtk_widget_show(m_text); -#ifndef __WXGTK20__ - if (multi_line) - { - gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed", - (GtkSignalFunc) gtk_scrollbar_changed_callback, (gpointer) this ); - - // only initialize gs_gtk_text_draw once, starting from the next the - // klass::draw will already be wxgtk_text_draw - if ( !gs_gtk_text_draw ) - { - GtkDrawCallback& - draw = GTK_WIDGET_CLASS(GTK_OBJECT(m_text)->klass)->draw; - - gs_gtk_text_draw = draw; - - draw = wxgtk_text_draw; - } - } -#endif // GTK+ 1.x - if (!value.empty()) { -#ifdef __WXGTK20__ SetValue( value ); -#else - -#if !GTK_CHECK_VERSION(1, 2, 0) - // if we don't realize it, GTK 1.0.6 dies with a SIGSEGV in - // gtk_editable_insert_text() - gtk_widget_realize(m_text); -#endif // GTK 1.0 - - gint tmp = 0; -#if wxUSE_UNICODE - wxWX2MBbuf val = value.mbc_str(); - gtk_editable_insert_text( GTK_EDITABLE(m_text), val, strlen(val), &tmp ); -#else - gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp ); -#endif - - if (multi_line) - { - // Bring editable's cursor uptodate. Bug in GTK. - SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) )); - } - -#endif } if (style & wxTE_PASSWORD) @@ -794,19 +635,10 @@ bool wxTextCtrl::Create( wxWindow *parent, { if (!multi_line) gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE ); -#ifdef __WXGTK20__ else gtk_text_view_set_editable( GTK_TEXT_VIEW( m_text), FALSE); -#else - } - else - { - if (multi_line) - gtk_text_set_editable( GTK_TEXT(m_text), 1 ); -#endif } -#ifdef __WXGTK20__ if (multi_line) { if (style & wxTE_RIGHT) @@ -828,10 +660,8 @@ bool wxTextCtrl::Create( wxWindow *parent, } #endif } -#endif // __WXGTK20__ // We want to be notified about text changes. -#ifdef __WXGTK20__ if (multi_line) { g_signal_connect( G_OBJECT(m_buffer), "changed", @@ -874,8 +704,6 @@ bool wxTextCtrl::Create( wxWindow *parent, } } else -#endif - { gtk_signal_connect( GTK_OBJECT(m_text), "changed", GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); @@ -892,28 +720,6 @@ bool wxTextCtrl::Create( wxWindow *parent, void wxTextCtrl::CalculateScrollbar() { -#ifndef __WXGTK20__ - if ((m_windowStyle & wxTE_MULTILINE) == 0) return; - - GtkAdjustment *adj = GTK_TEXT(m_text)->vadj; - - if (adj->upper - adj->page_size < 0.8) - { - if (m_vScrollbarVisible) - { - gtk_widget_hide( m_vScrollbar ); - m_vScrollbarVisible = false; - } - } - else - { - if (!m_vScrollbarVisible) - { - gtk_widget_show( m_vScrollbar ); - m_vScrollbarVisible = true; - } - } -#endif } wxString wxTextCtrl::GetValue() const @@ -923,7 +729,6 @@ wxString wxTextCtrl::GetValue() const wxString tmp; if (m_windowStyle & wxTE_MULTILINE) { -#ifdef __WXGTK20__ GtkTextIter start; gtk_text_buffer_get_start_iter( m_buffer, &start ); GtkTextIter end; @@ -939,12 +744,6 @@ wxString wxTextCtrl::GetValue() const tmp = buffer; g_free( text ); -#else - gint len = gtk_text_get_length( GTK_TEXT(m_text) ); - char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len ); - tmp = text; - g_free( text ); -#endif } else { @@ -960,8 +759,6 @@ void wxTextCtrl::SetValue( const wxString &value ) if (m_windowStyle & wxTE_MULTILINE) { -#ifdef __WXGTK20__ - #if wxUSE_UNICODE wxCharBuffer buffer( wxConvUTF8.cWX2MB( value) ); #else @@ -977,13 +774,6 @@ void wxTextCtrl::SetValue( const wxString &value ) } gtk_text_buffer_set_text( m_buffer, buffer, strlen(buffer) ); - -#else - gint len = gtk_text_get_length( GTK_TEXT(m_text) ); - gtk_editable_delete_text( GTK_EDITABLE(m_text), 0, len ); - len = 0; - gtk_editable_insert_text( GTK_EDITABLE(m_text), value.mbc_str(), value.Length(), &len ); -#endif } else { @@ -1012,8 +802,6 @@ void wxTextCtrl::WriteText( const wxString &text ) if ( m_windowStyle & wxTE_MULTILINE ) { -#ifdef __WXGTK20__ - #if wxUSE_UNICODE wxCharBuffer buffer( wxConvUTF8.cWX2MB( text ) ); #else @@ -1035,26 +823,6 @@ void wxTextCtrl::WriteText( const wxString &text ) gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW(m_text), gtk_text_buffer_get_insert( m_buffer ), 0.0, FALSE, 0.0, 1.0 ); } -#else // GTK 1.x - // After cursor movements, gtk_text_get_point() is wrong by one. - gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) ); - - // always use m_defaultStyle, even if it is empty as otherwise - // resetting the style and appending some more text wouldn't work: if - // we don't specify the style explicitly, the old style would be used - gtk_editable_delete_selection( GTK_EDITABLE(m_text) ); - wxGtkTextInsert(m_text, m_defaultStyle, text.c_str(), text.Len()); - - // we called wxGtkTextInsert with correct font, no need to do anything - // in UpdateFontIfNeeded() any longer - if ( !text.empty() ) - { - SetUpdateFont(false); - } - - // Bring editable's cursor back uptodate. - SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) )); -#endif // GTK 1.x/2.0 } else // single line { @@ -1064,8 +832,6 @@ void wxTextCtrl::WriteText( const wxString &text ) // This moves the cursor pos to behind the inserted text. gint len = GET_EDITABLE_POS(m_text); -#ifdef __WXGTK20__ - #if wxUSE_UNICODE wxCharBuffer buffer( wxConvUTF8.cWX2MB( text ) ); #else @@ -1079,10 +845,6 @@ void wxTextCtrl::WriteText( const wxString &text ) gtk_editable_insert_text( GTK_EDITABLE(m_text), buffer, strlen(buffer), &len ); -#else - gtk_editable_insert_text( GTK_EDITABLE(m_text), text.c_str(), text.Len(), &len ); -#endif - // Bring entry's cursor uptodate. gtk_entry_set_position( GTK_ENTRY(m_text), len ); } @@ -1100,31 +862,6 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const { if (m_windowStyle & wxTE_MULTILINE) { -#ifndef __WXGTK20__ - gint len = gtk_text_get_length( GTK_TEXT(m_text) ); - char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len ); - - if (text) - { - wxString buf; - long i; - int currentLine = 0; - for (i = 0; currentLine != lineNo && text[i]; i++ ) - if (text[i] == '\n') - currentLine++; - // Now get the text - int j; - for (j = 0; text[i] && text[i] != '\n'; i++, j++ ) - buf += text[i]; - - g_free( text ); - return buf; - } - else - { - return wxEmptyString; - } -#else GtkTextIter line; gtk_text_buffer_get_iter_at_line(m_buffer,&line,lineNo); GtkTextIter end = line; @@ -1133,7 +870,6 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const wxString result(wxGTK_CONV_BACK(text)); g_free(text); return result; -#endif } else { @@ -1153,7 +889,6 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const { if ( m_windowStyle & wxTE_MULTILINE ) { -#ifdef __WXGTK20__ GtkTextIter iter; gtk_text_buffer_get_iter_at_offset(m_buffer, &iter, pos); if (gtk_text_iter_is_end(&iter)) @@ -1161,28 +896,6 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const *y = gtk_text_iter_get_line(&iter); *x = gtk_text_iter_get_line_offset(&iter); -#else - wxString text = GetValue(); - - // cast to prevent warning. But pos really should've been unsigned. - if( (unsigned long)pos > text.Len() ) - return false; - - *x=0; // First Col - *y=0; // First Line - - const wxChar* stop = text.c_str() + pos; - for ( const wxChar *p = text.c_str(); p < stop; p++ ) - { - if (*p == wxT('\n')) - { - (*y)++; - *x=0; - } - else - (*x)++; - } -#endif } else // single line control { @@ -1205,7 +918,6 @@ long wxTextCtrl::XYToPosition(long x, long y ) const { if (!(m_windowStyle & wxTE_MULTILINE)) return 0; -#ifdef __WXGTK20__ GtkTextIter iter; if (y >= gtk_text_buffer_get_line_count (m_buffer)) return -1; @@ -1215,18 +927,10 @@ long wxTextCtrl::XYToPosition(long x, long y ) const return -1; return gtk_text_iter_get_offset(&iter) + x; -#else - long pos=0; - for( int i=0; iline_start_cache ) - { - // tell the programmer that it didn't work - wxLogDebug(_T("Can't call SetSelection() before realizing the control")); - return; - } -#endif - if (m_windowStyle & wxTE_MULTILINE) { -#ifdef __WXGTK20__ GtkTextIter fromi, toi; gtk_text_buffer_get_iter_at_offset( m_buffer, &fromi, from ); gtk_text_buffer_get_iter_at_offset( m_buffer, &toi, to ); gtk_text_buffer_place_cursor( m_buffer, &toi ); gtk_text_buffer_move_mark_by_name( m_buffer, "selection_bound", &fromi ); -#else - gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); -#endif } else { @@ -1515,27 +1145,14 @@ void wxTextCtrl::ShowPosition( long pos ) { if (m_windowStyle & wxTE_MULTILINE) { -#ifdef __WXGTK20__ GtkTextIter iter; gtk_text_buffer_get_start_iter( m_buffer, &iter ); gtk_text_iter_set_offset( &iter, pos ); GtkTextMark *mark = gtk_text_buffer_create_mark( m_buffer, NULL, &iter, TRUE ); gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW(m_text), mark, 0.0, FALSE, 0.0, 0.0 ); -#else // GTK 1.x - GtkAdjustment *vp = GTK_TEXT(m_text)->vadj; - float totalLines = (float) GetNumberOfLines(); - long posX; - long posY; - PositionToXY(pos, &posX, &posY); - float posLine = (float) posY; - float p = (posLine/totalLines)*(vp->upper - vp->lower) + vp->lower; - gtk_adjustment_set_value(GTK_TEXT(m_text)->vadj, p); -#endif // GTK 1.x/2.x } } -#ifdef __WXGTK20__ - wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const { @@ -1562,13 +1179,10 @@ wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const return wxTE_HT_ON_TEXT; } -#endif // __WXGTK20__ - long wxTextCtrl::GetInsertionPoint() const { wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") ); -#ifdef __WXGTK20__ if (m_windowStyle & wxTE_MULTILINE) { // There is no direct accessor for the cursor, but @@ -1582,7 +1196,6 @@ long wxTextCtrl::GetInsertionPoint() const return gtk_text_iter_get_offset( &cursor ); } else -#endif { return (long) GET_EDITABLE_POS(m_text); } @@ -1596,14 +1209,10 @@ wxTextPos wxTextCtrl::GetLastPosition() const if (m_windowStyle & wxTE_MULTILINE) { -#ifdef __WXGTK20__ GtkTextIter end; gtk_text_buffer_get_end_iter( m_buffer, &end ); pos = gtk_text_iter_get_offset( &end ); -#else - pos = gtk_text_get_length( GTK_TEXT(m_text) ); -#endif } else { @@ -1617,7 +1226,6 @@ void wxTextCtrl::Remove( long from, long to ) { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); -#ifdef __WXGTK20__ if (m_windowStyle & wxTE_MULTILINE) { GtkTextIter fromi, toi; @@ -1627,8 +1235,7 @@ void wxTextCtrl::Remove( long from, long to ) gtk_text_buffer_delete( m_buffer, &fromi, &toi ); } else // single line -#endif - gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); + gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); } void wxTextCtrl::Replace( long from, long to, const wxString &value ) @@ -1639,18 +1246,8 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value ) if (!value.empty()) { -#ifdef __WXGTK20__ SetInsertionPoint( from ); WriteText( value ); -#else // GTK 1.x - gint pos = (gint)from; -#if wxUSE_UNICODE - wxWX2MBbuf buf = value.mbc_str(); - gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &pos ); -#else - gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos ); -#endif // wxUSE_UNICODE -#endif // GTK 1.x/2.x } } @@ -1658,11 +1255,9 @@ void wxTextCtrl::Cut() { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); -#ifdef __WXGTK20__ if (m_windowStyle & wxTE_MULTILINE) g_signal_emit_by_name(m_text, "cut-clipboard"); else -#endif gtk_editable_cut_clipboard(GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG); } @@ -1670,11 +1265,9 @@ void wxTextCtrl::Copy() { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); -#ifdef __WXGTK20__ if (m_windowStyle & wxTE_MULTILINE) g_signal_emit_by_name(m_text, "copy-clipboard"); else -#endif gtk_editable_copy_clipboard(GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG); } @@ -1682,11 +1275,9 @@ void wxTextCtrl::Paste() { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); -#ifdef __WXGTK20__ if (m_windowStyle & wxTE_MULTILINE) g_signal_emit_by_name(m_text, "paste-clipboard"); else -#endif gtk_editable_paste_clipboard(GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG); } @@ -1727,7 +1318,6 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const gint to = -1; bool haveSelection = false; -#ifdef __WXGTK20__ if (m_windowStyle & wxTE_MULTILINE) { GtkTextIter ifrom, ito; @@ -1746,14 +1336,6 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const haveSelection = true; } } -#else // not GTK2 - if ( (GTK_EDITABLE(m_text)->has_selection) ) - { - haveSelection = true; - from = (long) GTK_EDITABLE(m_text)->selection_start_pos; - to = (long) GTK_EDITABLE(m_text)->selection_end_pos; - } -#endif if (! haveSelection ) from = to = GetInsertionPoint(); @@ -1777,7 +1359,6 @@ bool wxTextCtrl::IsEditable() const { wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") ); -#ifdef __WXGTK20__ if (m_windowStyle & wxTE_MULTILINE) { return gtk_text_view_get_editable(GTK_TEXT_VIEW(m_text)); @@ -1786,9 +1367,6 @@ bool wxTextCtrl::IsEditable() const { return gtk_editable_get_editable(GTK_EDITABLE(m_text)); } -#else - return GTK_EDITABLE(m_text)->editable; -#endif } bool wxTextCtrl::IsModified() const @@ -1846,11 +1424,7 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window ) { if (m_windowStyle & wxTE_MULTILINE) { -#ifdef __WXGTK20__ return window == gtk_text_view_get_window( GTK_TEXT_VIEW( m_text ), GTK_TEXT_WINDOW_TEXT ); // pure guesswork -#else - return (window == GTK_TEXT(m_text)->text_area); -#endif } else { @@ -1887,14 +1461,8 @@ void wxTextCtrl::ChangeFontGlobally() // possible! // // TODO: it can be implemented much more efficiently for GTK2 -#ifndef __WXGTK20__ - wxASSERT_MSG( (m_windowStyle & wxTE_MULTILINE) && m_updateFont, - - _T("shouldn't be called for single line controls") ); -#else wxASSERT_MSG( (m_windowStyle & wxTE_MULTILINE), _T("shouldn't be called for single line controls") ); -#endif wxString value = GetValue(); if ( !value.empty() ) @@ -1906,16 +1474,6 @@ void wxTextCtrl::ChangeFontGlobally() } } -#ifndef __WXGTK20__ - -void wxTextCtrl::UpdateFontIfNeeded() -{ - if ( m_updateFont ) - ChangeFontGlobally(); -} - -#endif // GTK+ 1.x - bool wxTextCtrl::SetForegroundColour(const wxColour& colour) { if ( !wxControl::SetForegroundColour(colour) ) @@ -1934,26 +1492,9 @@ bool wxTextCtrl::SetBackgroundColour( const wxColour &colour ) if ( !wxControl::SetBackgroundColour( colour ) ) return false; -#ifndef __WXGTK20__ - if (!m_widget->window) - return false; -#endif - if (!m_backgroundColour.Ok()) return false; - if (m_windowStyle & wxTE_MULTILINE) - { -#ifndef __WXGTK20__ - GdkWindow *window = GTK_TEXT(m_text)->text_area; - if (!window) - return false; - m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); - gdk_window_set_background( window, m_backgroundColour.GetColor() ); - gdk_window_clear( window ); -#endif - } - // change active background color too m_defaultStyle.SetBackgroundColour( colour ); @@ -1970,7 +1511,6 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style ) return true; } -#ifdef __WXGTK20__ gint l = gtk_text_buffer_get_char_count( m_buffer ); wxCHECK_MSG( start >= 0 && end <= l, false, @@ -1986,44 +1526,6 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style ) wxTextAttr attr = wxTextAttr::Combine(style, m_defaultStyle, this); wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi ); -#else - // VERY dirty way to do that - removes the required text and re-adds it - // with styling (FIXME) - - gint l = gtk_text_get_length( GTK_TEXT(m_text) ); - - wxCHECK_MSG( start >= 0 && end <= l, false, - _T("invalid range in wxTextCtrl::SetStyle") ); - - gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) ); - char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), start, end ); - wxString tmp(text,*wxConvCurrent); - g_free( text ); - - gtk_editable_delete_text( GTK_EDITABLE(m_text), start, end ); - gtk_editable_set_position( GTK_EDITABLE(m_text), start ); - - #if wxUSE_UNICODE - wxWX2MBbuf buf = tmp.mbc_str(); - const char *txt = buf; - size_t txtlen = strlen(buf); - #else - const char *txt = tmp; - size_t txtlen = tmp.length(); - #endif - - // use the attributes from style which are set in it and fall back - // first to the default style and then to the text control default - // colours for the others - wxGtkTextInsert(m_text, - wxTextAttr::Combine(style, m_defaultStyle, this), - txt, - txtlen); - - /* does not seem to help under GTK+ 1.2 !!! - gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */ - SetInsertionPoint( old_pos ); -#endif return true; } @@ -2093,27 +1595,6 @@ void wxTextCtrl::OnInternalIdle() wxCursor cursor = m_cursor; if (g_globalCursor.Ok()) cursor = g_globalCursor; - if (cursor.Ok()) - { -#ifndef __WXGTK20__ - GdkWindow *window = (GdkWindow*) NULL; - if (HasFlag(wxTE_MULTILINE)) - window = GTK_TEXT(m_text)->text_area; - else - window = GTK_ENTRY(m_text)->text_area; - - if (window) - gdk_window_set_cursor( window, cursor.GetCursor() ); - - if (!g_globalCursor.Ok()) - cursor = *wxSTANDARD_CURSOR; - - window = m_widget->window; - if ((window) && !(GTK_WIDGET_NO_WINDOW(m_widget))) - gdk_window_set_cursor( window, cursor.GetCursor() ); -#endif - } - if (g_delayedFocus == this) { if (GTK_WIDGET_REALIZED(m_widget)) @@ -2144,7 +1625,6 @@ void wxTextCtrl::Freeze() { if ( HasFlag(wxTE_MULTILINE) ) { -#ifdef __WXGTK20__ if ( !m_frozenness++ ) { // freeze textview updates and remove buffer @@ -2156,9 +1636,6 @@ void wxTextCtrl::Freeze() g_object_ref(m_buffer); gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), gtk_text_buffer_new(NULL)); } -#else - gtk_text_freeze(GTK_TEXT(m_text)); -#endif } } @@ -2166,7 +1643,6 @@ void wxTextCtrl::Thaw() { if ( HasFlag(wxTE_MULTILINE) ) { -#ifdef __WXGTK20__ wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") ); if ( !--m_frozenness ) @@ -2178,11 +1654,6 @@ void wxTextCtrl::Thaw() g_signal_handlers_disconnect_by_func(m_widget, (gpointer)gtk_text_exposed_callback, this); g_signal_handlers_disconnect_by_func(m_text, (gpointer)gtk_text_exposed_callback, this); } -#else - GTK_TEXT(m_text)->vadj->value = 0.0; - - gtk_text_thaw(GTK_TEXT(m_text)); -#endif } } @@ -2190,8 +1661,6 @@ void wxTextCtrl::Thaw() // wxTextUrlEvent passing if style & wxTE_AUTO_URL // ---------------------------------------------------------------------------- -#ifdef __WXGTK20__ - // FIXME: when dragging on a link the sample gets an "Unknown event". // This might be an excessive event from us or a buggy wxMouseEvent::Moving() or // a buggy sample, or something else @@ -2240,7 +1709,6 @@ void wxTextCtrl::OnUrlMouseEvent(wxMouseEvent& event) //event.Skip(!GetEventHandler()->ProcessEvent(url_event)); GetEventHandler()->ProcessEvent(url_event); } -#endif // gtk2 // ---------------------------------------------------------------------------- // scrolling @@ -2251,11 +1719,7 @@ GtkAdjustment *wxTextCtrl::GetVAdj() const if ( !IsMultiLine() ) return NULL; -#ifdef __WXGTK20__ return gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(m_widget)); -#else - return GTK_TEXT(m_text)->vadj; -#endif } bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff) @@ -2278,11 +1742,7 @@ bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff) adj->value = value; -#ifdef __WXGTK20__ gtk_adjustment_value_changed(GTK_ADJUSTMENT(adj)); -#else - gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed"); -#endif return true; } @@ -2293,12 +1753,7 @@ bool wxTextCtrl::ScrollLines(int lines) if ( !adj ) return false; -#ifdef __WXGTK20__ int diff = (int)ceil(lines*adj->step_increment); -#else - // this is hardcoded to 10 in GTK+ 1.2 (great idea) - int diff = 10*lines; -#endif return DoScroll(adj, diff); } diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 21f458ae64..1d90caaacc 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -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 // ---------------------------------------------------------------------------- @@ -517,7 +494,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, { if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) { -#ifdef __WXGTK20__ m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); // Tell WM that this is a dialog window and make it center // on parent by default (this is what GtkDialog ctor does): @@ -525,9 +501,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_position(GTK_WINDOW(m_widget), GTK_WIN_POS_CENTER_ON_PARENT); -#else - m_widget = gtk_window_new(GTK_WINDOW_DIALOG); -#endif } else { @@ -602,10 +575,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, // For m_mainWidget themes gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event", 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 @@ -841,11 +810,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) void wxTopLevelWindowGTK::Raise() { -#ifdef __WXGTK20__ 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) ) @@ -1149,7 +1114,6 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) wxTopLevelWindowBase::SetIcons( icons ); -#ifdef __WXGTK20__ GList *list = NULL; 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); 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) { -#ifdef __WXGTK20__ if (maximize) gtk_window_maximize( GTK_WINDOW( m_widget ) ); else gtk_window_unmaximize( GTK_WINDOW( m_widget ) ); -#else - wxFAIL_MSG( _T("not implemented") ); -#endif } bool wxTopLevelWindowGTK::IsMaximized() const { -#ifdef __WXGTK20__ if(!m_widget->window) return false; 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() { -#ifdef __WXGTK20__ // "Present" seems similar enough to "restore" gtk_window_present( GTK_WINDOW( m_widget ) ); -#else - wxFAIL_MSG( _T("not implemented") ); -#endif } void wxTopLevelWindowGTK::Iconize( bool iconize ) { -#ifdef __WXGTK20__ if (iconize) gtk_window_iconify( GTK_WINDOW( m_widget ) ); else 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 @@ -1292,14 +1208,7 @@ static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region) } else { -#ifdef __WXGTK20__ 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; } } @@ -1364,16 +1273,13 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags) void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) { -#ifdef __WXGTK20__ // Store which styles were changed long styleChanges = style ^ m_windowStyle; -#endif // Process wxWindow styles. This also updates the internal variable // Therefore m_windowStyle bits carry now the _new_ style values wxWindow::SetWindowStyleFlag(style); -#ifdef __WXGTK20__ // just return for now if widget does not exist yet if (!m_widget) 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); } #endif // GTK+ 2.2 -#endif // GTK+ 2.0 } diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 4d780162b6..6385e82fef 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -31,9 +31,6 @@ #include "glib.h" #include "gdk/gdk.h" #include "gtk/gtk.h" -#ifndef __WXGTK20__ -#include "gtk/gtkfeatures.h" -#endif #include "gdk/gdkx.h" #ifdef HAVE_X11_XKBLIB_H @@ -81,7 +78,6 @@ bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) ) } #endif -#ifdef __WXGTK20__ // Escapes string so that it is valid Pango markup XML string: wxString wxEscapeStringForPangoMarkup(const wxString& str) { @@ -115,7 +111,6 @@ wxString wxEscapeStringForPangoMarkup(const wxString& str) } return out; } -#endif // ---------------------------------------------------------------------------- @@ -168,11 +163,7 @@ int wxDisplayDepth() wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { static wxToolkitInfo info; -#ifdef __WXGTK20__ info.shortName = _T("gtk2"); -#else - info.shortName = _T("gtk"); -#endif info.name = _T("wxGTK"); #ifdef __WXUNIVERSAL__ info.shortName << _T("univ"); diff --git a/src/gtk/win_gtk.c b/src/gtk/win_gtk.c index 44222ba55c..cd3e794936 100644 --- a/src/gtk/win_gtk.c +++ b/src/gtk/win_gtk.c @@ -23,17 +23,6 @@ extern "C" { #endif /* __cplusplus */ -#ifndef __WXGTK20__ - -#include -#include -#include - -#define IS_ONSCREEN(x,y) ((x >= G_MINSHORT) && (x <= G_MAXSHORT) && \ - (y >= G_MINSHORT) && (y <= G_MAXSHORT)) - -#endif - typedef struct _GtkPizzaAdjData GtkPizzaAdjData; struct _GtkPizzaAdjData @@ -54,10 +43,6 @@ static void gtk_pizza_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_pizza_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -#ifndef __WXGTK20__ -static void gtk_pizza_draw (GtkWidget *widget, - GdkRectangle *area); -#endif /* __WXGTK20__ */ static gint gtk_pizza_expose (GtkWidget *widget, GdkEventExpose *event); 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, 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 void gtk_pizza_scroll_set_adjustments (GtkPizza *pizza, GtkAdjustment *hadj, GtkAdjustment *vadj); - -#ifdef __WXGTK20__ - GtkContainerClass *pizza_parent_class = NULL; -#else -static GtkContainerClass *pizza_parent_class = NULL; -#endif - -#ifndef __WXGTK20__ -static gboolean gravity_works; -#endif +/* static */ +GtkContainerClass *pizza_parent_class = NULL; GtkType gtk_pizza_get_type () @@ -113,8 +77,6 @@ gtk_pizza_get_type () if (!pizza_type) { - -#ifdef __WXGTK20__ static const GTypeInfo pizza_info = { sizeof (GtkPizzaClass), @@ -128,26 +90,11 @@ gtk_pizza_get_type () (GInstanceInitFunc) gtk_pizza_init, }; 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; } -#ifdef __WXGTK20__ /* Marshaller needed for set_scroll_adjustments signal, generated with GLib-2.4.6 glib-genmarshal */ #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), data2); } -#endif /* __WXGTK20__ */ static void gtk_pizza_class_init (GtkPizzaClass *klass) @@ -205,9 +151,6 @@ gtk_pizza_class_init (GtkPizzaClass *klass) widget_class->unrealize = gtk_pizza_unrealize; widget_class->size_request = gtk_pizza_size_request; 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->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; widget_class->set_scroll_adjustments_signal = -#ifdef __WXGTK20__ g_signal_new( "set_scroll_adjustments", G_TYPE_FROM_CLASS(object_class), @@ -233,14 +175,6 @@ gtk_pizza_class_init (GtkPizzaClass *klass) 2, 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 @@ -372,11 +306,6 @@ gtk_pizza_put (GtkPizza *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); } @@ -541,11 +470,7 @@ gtk_pizza_map (GtkWidget *widget) if ( GTK_WIDGET_VISIBLE (child->widget) && !GTK_WIDGET_MAPPED (child->widget) && -#ifdef __WXGTK20__ TRUE) -#else - !GTK_WIDGET_IS_OFFSCREEN (child->widget)) -#endif { 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 |= GDK_EXPOSURE_MASK | -#ifdef __WXGTK20__ GDK_SCROLL_MASK | -#endif GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | @@ -650,15 +573,6 @@ gtk_pizza_realize (GtkWidget *widget) 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 */ children = pizza->children; while (children) @@ -764,63 +678,15 @@ gtk_pizza_size_allocate (GtkWidget *widget, child = children->data; children = children->next; -#ifndef __WXGTK20__ - gtk_pizza_position_child (pizza, child); -#endif 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 gtk_pizza_expose (GtkWidget *widget, GdkEventExpose *event) { 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 (GTK_IS_PIZZA (widget), FALSE); @@ -835,33 +701,9 @@ gtk_pizza_expose (GtkWidget *widget, if (pizza->external_expose) return FALSE; -#ifdef __WXGTK20__ - (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, event); 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 @@ -920,10 +762,6 @@ gtk_pizza_remove (GtkContainer *container, /* security checks */ g_return_if_fail (GTK_IS_WIDGET (widget)); -#ifndef __WXGTK20__ - GTK_PRIVATE_UNSET_FLAG (widget, GTK_IS_OFFSCREEN); -#endif - 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 * done by "Guffaw" scrolling, as in the Mozilla XFE, with @@ -1098,7 +874,6 @@ gtk_pizza_expose_predicate (Display *display, void gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) { -#ifdef __WXGTK20__ pizza->xoffset += dx; pizza->yoffset += dy; @@ -1106,233 +881,8 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) if (pizza->bin_window) 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 } #endif /* __cplusplus */ diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 29faacac74..bb9ab32d19 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -65,20 +65,13 @@ #include "wx/gtk/win_gtk.h" -#ifdef __WXGTK20__ #include -#endif - -#ifdef __WXGTK20__ - #ifdef HAVE_XIM - #undef HAVE_XIM - #endif +#ifdef HAVE_XIM + #undef HAVE_XIM #endif -#ifdef __WXGTK20__ extern GtkContainerClass *pizza_parent_class; -#endif //----------------------------------------------------------------------------- // documentation on internals @@ -237,12 +230,6 @@ wxWindowGTK *g_focusWindowLast = (wxWindowGTK*) NULL; // yet, defer setting the focus to idle time. 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; //----------------------------------------------------------------------------- @@ -272,14 +259,9 @@ gdk_window_warp_pointer (GdkWindow *window, gint x, gint y) { -#ifndef __WXGTK20__ - GdkWindowPrivate *priv; -#endif - if (!window) window = GDK_ROOT_PARENT(); -#ifdef __WXGTK20__ if (!GDK_WINDOW_DESTROYED(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 */ 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 ); -#ifdef __WXGTK20__ - (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event); -#endif 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 //----------------------------------------------------------------------------- @@ -522,7 +474,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, if (g_isIdle) wxapp_install_idle_handler(); -#ifdef __WXGTK20__ // This callback gets called in drawing-idle time under // GTK 2.0, so we don't need to defer anything to idle // time anymore. @@ -562,147 +513,11 @@ static int gtk_window_expose_callback( GtkWidget *widget, // Let parent window draw window-less widgets (* 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; } } -//----------------------------------------------------------------------------- -// "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 //----------------------------------------------------------------------------- @@ -1125,7 +940,6 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, } -#ifdef __WXGTK20__ struct wxGtkIMData { GtkIMContext *context; @@ -1141,7 +955,6 @@ struct wxGtkIMData g_object_unref(context); } }; -#endif extern "C" { 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; } -#ifdef __WXGTK20__ // 2005.01.26 modified by Hong Jen Yee (hzysoft@sina.com.tw): // When we get a key_press event here, it could be originate // 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; } } -#endif + if (return_after_IM) return false; - + // Emit KEY_DOWN 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 (!ret) { @@ -1404,7 +1155,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, } } -#ifdef __WXGTK20__ extern "C" { static void gtk_wxwindow_commit_cb (GtkIMContext *context, 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 ) 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 )) { 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" //----------------------------------------------------------------------------- @@ -2052,7 +1784,6 @@ static gboolean wxgtk_window_popup_menu_callback(GtkWidget*, wxWindowGTK* win) return win->GetEventHandler()->ProcessEvent(event); } } -#endif // __WXGTK20__ //----------------------------------------------------------------------------- // "focus_in_event" @@ -2083,10 +1814,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, if (g_isIdle) wxapp_install_idle_handler(); -#ifdef __WXGTK20__ if (win->m_imData) gtk_im_context_focus_in(win->m_imData->context); -#endif g_focusWindowLast = g_focusWindow = win; @@ -2137,10 +1866,8 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk if (g_isIdle) wxapp_install_idle_handler(); -#ifdef __WXGTK20__ if (win->m_imData) gtk_im_context_focus_out(win->m_imData->context); -#endif wxLogTrace( TRACE_FOCUS, _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; -#ifndef __WXGTK20__ - GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget); -#endif wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->vscrollbar)); 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; 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)); win->m_oldHorizontalPos = adjust->value; @@ -2371,8 +2092,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, g_blockEventsOnScroll = true; - // FIXME: there is no 'slider' field in GTK+ 2.0 any more -#ifndef __WXGTK20__ +// FIXME: there is no 'slider' field in GTK+ 2.0 any more +#if 0 win->m_isScrolling = (gdk_event->window == widget->slider); #endif @@ -2454,14 +2175,12 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) if (g_isIdle) wxapp_install_idle_handler(); -#ifdef __WXGTK20__ if (win->m_imData) { GtkPizza *pizza = GTK_PIZZA( m_widget ); gtk_im_context_set_client_window( win->m_imData->context, pizza->bin_window ); } -#endif wxWindowCreateEvent event( win ); event.SetEventObject( win ); @@ -2751,15 +2470,8 @@ void wxWindowGTK::Init() m_cursor = *wxSTANDARD_CURSOR; -#ifdef __WXGTK20__ m_imData = NULL; m_dirtyTabOrder = false; -#else -#ifdef HAVE_XIM - m_ic = (GdkIC*) NULL; - m_icattr = (GdkICAttr*) NULL; -#endif -#endif } wxWindowGTK::wxWindowGTK() @@ -2925,10 +2637,8 @@ wxWindowGTK::~wxWindowGTK() gdk_ic_attr_destroy (m_icattr); #endif -#ifdef __WXGTK20__ // delete before the widgets to avoid a crash on solaris delete m_imData; -#endif if (m_wxwindow) { @@ -2973,21 +2683,9 @@ void wxWindowGTK::PostCreation() gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", 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 ) ); -#endif } -#ifdef __WXGTK20__ // Create input method handler m_imData = new wxGtkIMData; @@ -2996,16 +2694,11 @@ void wxWindowGTK::PostCreation() g_signal_connect (G_OBJECT (m_imData->context), "commit", G_CALLBACK (gtk_wxwindow_commit_cb), this); -#endif // these are called when the "sunken" or "raised" borders are drawn gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event", 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 @@ -3094,12 +2787,10 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event", GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this ); -#ifdef __WXGTK20__ gtk_signal_connect( GTK_OBJECT(widget), "scroll_event", GTK_SIGNAL_FUNC(gtk_window_wheel_callback), (gpointer)this ); g_signal_connect(widget, "popup_menu", G_CALLBACK(wxgtk_window_popup_menu_callback), this); -#endif gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event", 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 */ if (GTK_WIDGET_CAN_DEFAULT(m_widget)) { -#ifdef __WXGTK20__ GtkBorder *default_border = NULL; gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); 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; g_free( default_border ); } -#else - left_border = 6; - right_border = 6; - top_border = 6; - bottom_border = 5; -#endif } 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() { -#ifdef __WXGTK20__ if ( m_dirtyTabOrder ) RealizeTabOrder(); -#endif + // Update style if the window was not yet realized // and SetBackgroundStyle(wxBG_STYLE_CUSTOM) was called if (m_needsStyleChange) @@ -3590,7 +3273,6 @@ int wxWindowGTK::GetCharHeight() const wxFont font = GetFont(); wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") ); -#ifdef __WXGTK20__ PangoContext *context = NULL; if (m_widget) context = gtk_widget_get_pango_context( m_widget ); @@ -3610,11 +3292,6 @@ int wxWindowGTK::GetCharHeight() const g_object_unref( G_OBJECT( layout ) ); return (int) PANGO_PIXELS(rect.height); -#else - GdkFont *gfont = font.GetInternalFont( 1.0 ); - - return gfont->ascent + gfont->descent; -#endif } int wxWindowGTK::GetCharWidth() const @@ -3624,7 +3301,6 @@ int wxWindowGTK::GetCharWidth() const wxFont font = GetFont(); wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") ); -#ifdef __WXGTK20__ PangoContext *context = NULL; if (m_widget) context = gtk_widget_get_pango_context( m_widget ); @@ -3644,11 +3320,6 @@ int wxWindowGTK::GetCharWidth() const g_object_unref( G_OBJECT( layout ) ); 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, @@ -3669,7 +3340,6 @@ void wxWindowGTK::GetTextExtent( const wxString& string, return; } -#ifdef __WXGTK20__ PangoContext *context = NULL; if (m_widget) context = gtk_widget_get_pango_context( m_widget ); @@ -3710,13 +3380,6 @@ void wxWindowGTK::GetTextExtent( const wxString& string, if (externalLeading) (*externalLeading) = 0; // ?? 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() @@ -3737,13 +3400,11 @@ void wxWindowGTK::SetFocus() } else if (m_widget) { -#ifdef __WXGTK20__ if (GTK_IS_CONTAINER(m_widget)) { gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD ); } else -#endif if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) ) { @@ -3768,13 +3429,6 @@ void wxWindowGTK::SetFocus() } } 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, _T("Can't set focus to %s(%s)"), @@ -3839,8 +3493,6 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child) (*m_insertCallback)(this, child); } -#ifdef __WXGTK20__ - void wxWindowGTK::AddChild(wxWindowBase *child) { wxWindowBase::AddChild(child); @@ -3893,8 +3545,6 @@ void wxWindowGTK::RealizeTabOrder() m_dirtyTabOrder = false; } -#endif // __WXGTK20__ - void wxWindowGTK::Raise() { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); @@ -3964,67 +3614,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) if (!m_widget->window) 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) { 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 ); } -#endif // GTK+ 1/2 } void wxWindowGTK::Update() @@ -4060,13 +3648,8 @@ void wxWindowGTK::Update() void wxWindowGTK::GtkUpdate() { -#ifdef __WXGTK20__ if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window) 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 // to be able to update an entire TLW by calling Update() only once), we @@ -4083,9 +3666,6 @@ void wxWindowGTK::GtkSendPaintEvents() { if (!m_wxwindow) { -#ifndef __WXGTK20__ - m_clearRegion.Clear(); -#endif m_updateRegion.Clear(); return; } @@ -4129,7 +3709,6 @@ void wxWindowGTK::GtkSendPaintEvents() } else -#ifdef __WXGTK20__ { wxWindowDC dc( (wxWindow*)this ); dc.SetClippingRegion( m_updateRegion ); @@ -4139,38 +3718,6 @@ void wxWindowGTK::GtkSendPaintEvents() 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() ); nc_paint_event.SetEventObject( this ); @@ -4182,67 +3729,12 @@ void wxWindowGTK::GtkSendPaintEvents() 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(); } void wxWindowGTK::ClearBackground() { 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 @@ -4304,12 +3796,10 @@ bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) return true; } -#ifdef __WXGTK20__ PangoContext *wxWindowGTK::GtkGetPangoDefaultContext() { return gtk_widget_get_pango_context( m_widget ); } -#endif GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) { @@ -4325,13 +3815,8 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) if ( m_font.Ok() ) { -#ifdef __WXGTK20__ style->font_desc = 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() ) @@ -4687,28 +4172,6 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) // No scrolling requested. 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; gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); -- 2.45.2