From 0a164d4c4e75bd48f6a0a484fb267b0dc337c541 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 22 Jul 2005 18:01:46 +0000 Subject: [PATCH] [1231183] 'cleanup: mismatched indentation' and other cleanings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/choice.cpp | 29 +++--- src/gtk/colour.cpp | 6 +- src/gtk/combobox.cpp | 19 ++-- src/gtk/dcclient.cpp | 16 ++-- src/gtk/dnd.cpp | 46 ++++----- src/gtk/frame.cpp | 7 +- src/gtk/textctrl.cpp | 4 +- src/gtk/toplevel.cpp | 117 +++++++++++------------ src/gtk/window.cpp | 218 +++++++++++++++++++++--------------------- src/gtk1/choice.cpp | 29 +++--- src/gtk1/colour.cpp | 6 +- src/gtk1/combobox.cpp | 19 ++-- src/gtk1/dcclient.cpp | 16 ++-- src/gtk1/dnd.cpp | 46 ++++----- src/gtk1/frame.cpp | 7 +- src/gtk1/textctrl.cpp | 4 +- src/gtk1/toplevel.cpp | 117 +++++++++++------------ src/gtk1/window.cpp | 218 +++++++++++++++++++++--------------------- 18 files changed, 456 insertions(+), 468 deletions(-) diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 7b8633ef1b..6dbc4a9cd1 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -115,16 +115,16 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, int n, const wxString choices[], long style, const wxValidator& validator, const wxString &name ) { - m_needParent = TRUE; + m_needParent = true; #if (GTK_MINOR_VERSION > 0) - m_acceptsFocus = TRUE; + m_acceptsFocus = true; #endif if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxChoice creation failed") ); - return FALSE; + return false; } m_widget = gtk_option_menu_new(); @@ -153,7 +153,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, PostCreation(size); SetBestSize(size); // need this too because this is a wxControlWithItems - return TRUE; + return true; } wxChoice::~wxChoice() @@ -247,7 +247,7 @@ void wxChoice::Clear() { // destroy the data (due to Robert's idea of using wxList // and not wxList we can't just say - // m_clientList.DeleteContents(TRUE) - this would crash! + // m_clientList.DeleteContents(true) - this would crash! wxList::compatibility_iterator node = m_clientList.GetFirst(); while ( node ) { @@ -372,7 +372,7 @@ int wxChoice::FindString( const wxString &string ) const count++; } - return -1; + return wxNOT_FOUND; } int wxChoice::GetSelection() const @@ -403,8 +403,8 @@ void wxChoice::SetString( int n, const wxString& str ) wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); - gtk_label_set_text( label, wxGTK_CONV( str ) ); - + gtk_label_set_text( label, wxGTK_CONV( str ) ); + return; } child = child->next; @@ -414,7 +414,7 @@ void wxChoice::SetString( int n, const wxString& str ) wxString wxChoice::GetString( int n ) const { - wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") ); + wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); int count = 0; @@ -444,7 +444,7 @@ wxString wxChoice::GetString( int n ) const wxFAIL_MSG( wxT("wxChoice: invalid index in GetString()") ); - return wxT(""); + return wxEmptyString; } int wxChoice::GetCount() const @@ -545,9 +545,9 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item) // normal control, just append if (pos == (int)m_clientList.GetCount()) { - gtk_menu_append( GTK_MENU(menu), menu_item ); - m_clientList.Append( (wxObject*) NULL ); - index = m_clientList.GetCount() - 1; + gtk_menu_append( GTK_MENU(menu), menu_item ); + m_clientList.Append( (wxObject*) NULL ); + index = m_clientList.GetCount() - 1; } else { @@ -570,7 +570,7 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item) // changed, but at least after adding an item // it has to change. Adapted from Matt Ownby. InvalidateBestSize(); - + gtk_signal_connect_after( GTK_OBJECT( menu_item ), "activate", GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); @@ -643,4 +643,3 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) #endif // wxUSE_CHOICE - diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index 60735789eb..a39f2af429 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -110,7 +110,7 @@ void wxColourRefData::FreeColour() colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; if (colMapAllocCounter[ idx ] == 0) - gdk_colormap_free_colors( m_colormap, &m_color, 1 ); + gdk_colormap_free_colors( m_colormap, &m_color, 1 ); } } } @@ -124,7 +124,7 @@ void wxColourRefData::AllocColour( GdkColormap *cmap ) #ifdef __WXGTK20__ if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || - (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) + (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) #else GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || @@ -284,5 +284,3 @@ GdkColor *wxColour::GetColor() const return &M_COLDATA->m_color; } - - diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index c1e77b07d7..9b11ce5315 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -349,9 +349,9 @@ int wxComboBox::DoAppend( const wxString &item ) const int count = GetCount(); if ( (int)m_clientDataList.GetCount() < count ) - m_clientDataList.Append( (wxObject*) NULL ); + m_clientDataList.Append( (wxObject*) NULL ); if ( (int)m_clientObjectList.GetCount() < count ) - m_clientObjectList.Append( (wxObject*) NULL ); + m_clientObjectList.Append( (wxObject*) NULL ); EnableEvents(); @@ -396,9 +396,9 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) count = GetCount(); if ( (int)m_clientDataList.GetCount() < count ) - m_clientDataList.Insert( pos, (wxObject*) NULL ); + m_clientDataList.Insert( pos, (wxObject*) NULL ); if ( (int)m_clientObjectList.GetCount() < count ) - m_clientObjectList.Insert( pos, (wxObject*) NULL ); + m_clientObjectList.Insert( pos, (wxObject*) NULL ); EnableEvents(); @@ -532,7 +532,7 @@ void wxComboBox::SetString(int n, const wxString &text) int wxComboBox::FindString( const wxString &item ) const { - wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") ); + wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") ); GtkWidget *list = GTK_COMBO(m_widget)->list; @@ -581,7 +581,7 @@ int wxComboBox::GetSelection() const wxString wxComboBox::GetString( int n ) const { - wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid combobox") ); + wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") ); GtkWidget *list = GTK_COMBO(m_widget)->list; @@ -607,7 +607,7 @@ wxString wxComboBox::GetString( int n ) const wxString wxComboBox::GetStringSelection() const { - wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid combobox") ); + wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") ); GtkWidget *list = GTK_COMBO(m_widget)->list; @@ -626,7 +626,7 @@ wxString wxComboBox::GetStringSelection() const wxFAIL_MSG( wxT("wxComboBox: no selection") ); - return wxT(""); + return wxEmptyString; } int wxComboBox::GetCount() const @@ -677,7 +677,7 @@ void wxComboBox::SetValue( const wxString& value ) wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); GtkWidget *entry = GTK_COMBO(m_widget)->entry; - wxString tmp = wxT(""); + wxString tmp; if (!value.IsNull()) tmp = value; gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) ); @@ -1042,4 +1042,3 @@ void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event) } #endif - diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 626d46cf44..42be5fdc2f 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1372,7 +1372,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, { gdk_gc_set_clip_mask( m_textGC, mask ); gdk_gc_set_clip_origin( m_textGC, cx-xsrcMask, cy-ysrcMask ); - } + } } else { @@ -1385,7 +1385,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, { gdk_gc_set_clip_mask( m_penGC, mask ); gdk_gc_set_clip_origin( m_penGC, cx-xsrcMask, cy-ysrcMask ); - } + } } } @@ -2377,12 +2377,12 @@ void wxWindowDC::ComputeScaleAndOrigin() if ((m_scaleX != origScaleX || m_scaleY != origScaleY) && (m_pen.Ok())) { - /* this is a bit artificial, but we need to force wxDC to think - the pen has changed */ - wxPen pen = m_pen; - m_pen = wxNullPen; - SetPen( pen ); - } + /* this is a bit artificial, but we need to force wxDC to think + the pen has changed */ + wxPen pen = m_pen; + m_pen = wxNullPen; + SetPen( pen ); + } } // Resolution in pixels per logical inch diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index dcb0b56c32..d03f079cc8 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -16,8 +16,8 @@ #include "wx/dnd.h" #include "wx/log.h" - - + + #if wxUSE_DRAG_AND_DROP #include "wx/window.h" @@ -188,7 +188,7 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget), drop_target->OnLeave(); /* this has to be done because GDK has no "drag_enter" event */ - drop_target->m_firstMotion = TRUE; + drop_target->m_firstMotion = true; /* after this, invalidate the drop_target's GdkDragContext */ drop_target->SetDragContext( (GdkDragContext*) NULL ); @@ -287,7 +287,7 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), drop_target->SetDragContext( (GdkDragContext*) NULL ); /* this has to be done because GDK has no "drag_enter" event */ - drop_target->m_firstMotion = FALSE; + drop_target->m_firstMotion = false; return ret; } @@ -338,7 +338,7 @@ static gboolean target_drag_drop( GtkWidget *widget, /* reset the block here as someone might very well show a dialog as a reaction to a drop and this wouldn't work without events */ - g_blockEventsOnDrag = FALSE; + g_blockEventsOnDrag = false; bool ret = drop_target->OnDrop( x, y ); @@ -388,7 +388,7 @@ static gboolean target_drag_drop( GtkWidget *widget, drop_target->SetDragWidget( (GtkWidget*) NULL ); /* this has to be done because GDK has no "drag_enter" event */ - drop_target->m_firstMotion = TRUE; + drop_target->m_firstMotion = true; return ret; } @@ -457,7 +457,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget), wxDropTarget::wxDropTarget( wxDataObject *data ) : wxDropTargetBase( data ) { - m_firstMotion = TRUE; + m_firstMotion = true; m_dragContext = (GdkDragContext*) NULL; m_dragWidget = (GtkWidget*) NULL; m_dragData = (GtkSelectionData*) NULL; @@ -482,7 +482,7 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x), bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) { if (!m_dataObject) - return FALSE; + return false; return (GetMatchingPair() != (GdkAtom) 0); } @@ -530,19 +530,19 @@ GdkAtom wxDropTarget::GetMatchingPair() bool wxDropTarget::GetData() { if (!m_dragData) - return FALSE; + return false; if (!m_dataObject) - return FALSE; + return false; wxDataFormat dragFormat( m_dragData->target ); if (!m_dataObject->IsSupportedFormat( dragFormat )) - return FALSE; + return false; m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data ); - return TRUE; + return true; } void wxDropTarget::UnregisterWidget( GtkWidget *widget ) @@ -655,11 +655,11 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), /* disable GUI threads */ #endif - gtk_selection_data_set( selection_data, - selection_data->target, - 8, // 8-bit - d, - size ); + gtk_selection_data_set( selection_data, + selection_data->target, + 8, // 8-bit + d, + size ); #if wxUSE_THREADS /* enable GUI threads */ @@ -714,7 +714,7 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget), // printf( "Drag source: drag_end.\n" ); - drop_source->m_waiting = FALSE; + drop_source->m_waiting = false; } } @@ -744,7 +744,7 @@ wxDropSource::wxDropSource(wxWindow *win, const wxIcon &iconMove, const wxIcon &iconNone) { - m_waiting = TRUE; + m_waiting = true; m_iconWindow = (GtkWidget*) NULL; @@ -763,7 +763,7 @@ wxDropSource::wxDropSource(wxDataObject& data, const wxIcon &iconMove, const wxIcon &iconNone) { - m_waiting = TRUE; + m_waiting = true; SetData( data ); @@ -859,11 +859,11 @@ wxDragResult wxDropSource::DoDragDrop(int flags) return wxDragNone; // disabled for now - g_blockEventsOnDrag = TRUE; + g_blockEventsOnDrag = true; RegisterWindow(); - m_waiting = TRUE; + m_waiting = true; GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 ); @@ -933,7 +933,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags) /* re-enable GUI threads */ #endif - g_blockEventsOnDrag = FALSE; + g_blockEventsOnDrag = false; UnregisterWindow(); diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 2e602ab9dc..21986f8a59 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -622,12 +622,12 @@ void wxFrame::UpdateMenuBarSize() // this is called after Remove with a NULL m_frameMenuBar if ( m_frameMenuBar ) - (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) - (m_frameMenuBar->m_widget, &req ); + (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) + (m_frameMenuBar->m_widget, &req ); m_menuBarHeight = req.height; - // resize window in OnInternalIdle + // resize window in OnInternalIdle GtkUpdateSize(); } @@ -714,4 +714,3 @@ void wxFrame::PositionStatusBar() GtkUpdateSize(); } #endif // wxUSE_STATUSBAR - diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 3f975f9b1f..5ffdf7d7d4 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1510,7 +1510,7 @@ long wxTextCtrl::GetInsertionPoint() const else #endif { - return (long) GET_EDITABLE_POS(m_text); + return (long) GET_EDITABLE_POS(m_text); } } @@ -2081,7 +2081,7 @@ void wxTextCtrl::Freeze() gtk_widget_set_sensitive(m_widget, false); 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 diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index d13acd7d68..312f2ce56d 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -77,7 +77,7 @@ static wxTopLevelWindowGTK *g_lastActiveFrame = (wxTopLevelWindowGTK*) NULL; // either TRUE or FALSE and an activate event will be sent during the next // OnIdle() call and it is reset to -1: this value means that we shouldn't // send any activate events at all -static int g_sendActivateEvent = -1; +static int g_sendActivateEvent = -1; //----------------------------------------------------------------------------- // "focus_in_event" @@ -90,7 +90,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, { if (g_isIdle) wxapp_install_idle_handler(); - + switch ( g_sendActivateEvent ) { case -1: @@ -107,11 +107,11 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, g_activeFrame = win; g_lastActiveFrame = g_activeFrame; - + // wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() ); - + wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); - wxActivateEvent event(wxEVT_ACTIVATE, TRUE, g_activeFrame->GetId()); + wxActivateEvent event(wxEVT_ACTIVATE, true, g_activeFrame->GetId()); event.SetEventObject(g_activeFrame); g_activeFrame->GetEventHandler()->ProcessEvent(event); @@ -124,8 +124,8 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, //----------------------------------------------------------------------------- extern "C" { -static gint gtk_frame_focus_out_callback( GtkWidget *widget, - GdkEventFocus *WXUNUSED(gdk_event), +static gint gtk_frame_focus_out_callback( GtkWidget *widget, + GdkEventFocus *WXUNUSED(gdk_event), wxTopLevelWindowGTK *win ) { if (g_isIdle) @@ -135,21 +135,21 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget, // wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset // g_sendActivateEvent to -1 g_sendActivateEvent = 0; - + // wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") ); - + // wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() ); if (g_activeFrame) { wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); - wxActivateEvent event(wxEVT_ACTIVATE, FALSE, g_activeFrame->GetId()); + wxActivateEvent event(wxEVT_ACTIVATE, false, g_activeFrame->GetId()); event.SetEventObject(g_activeFrame); g_activeFrame->GetEventHandler()->ProcessEvent(event); g_activeFrame = NULL; } - + return FALSE; } } @@ -299,7 +299,7 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), wxTopLevelWindow *win ) { - win->SetIconizeState(FALSE); + win->SetIconizeState(false); } } @@ -410,16 +410,16 @@ static void wxInsertChildInTopLevelWindow( wxTopLevelWindowGTK* parent, wxWindow void wxTopLevelWindowGTK::Init() { - m_sizeSet = FALSE; + m_sizeSet = false; m_miniEdge = 0; m_miniTitle = 0; m_mainWidget = (GtkWidget*) NULL; - m_insertInClientArea = TRUE; - m_isIconized = FALSE; - m_fsIsShowing = FALSE; - m_themeEnabled = TRUE; + m_insertInClientArea = true; + m_isIconized = false; + m_fsIsShowing = false; + m_themeEnabled = true; m_gdkDecor = m_gdkFunc = 0; - m_grabbed = FALSE; + m_grabbed = false; } bool wxTopLevelWindowGTK::Create( wxWindow *parent, @@ -438,13 +438,13 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, wxTopLevelWindows.Append( this ); - m_needParent = FALSE; + m_needParent = false; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxTopLevelWindowGTK creation failed") ); - return FALSE; + return false; } m_title = title; @@ -479,10 +479,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, { gtk_window_set_type_hint(GTK_WINDOW(m_widget), GDK_WINDOW_TYPE_HINT_UTILITY); - + // On some WMs, like KDE, a TOOL_WINDOW will still show // on the taskbar, but on Gnome a TOOL_WINDOW will not. - // For consistency between WMs and with Windows, we + // For consistency between WMs and with Windows, we // should set the NO_TASKBAR flag which will apply // the set_skip_taskbar_hint if it is available, // ensuring no taskbar entry will appear. @@ -495,8 +495,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, wxWindow *topParent = wxGetTopLevelParent(m_parent); if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) && - (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) || - (style & wxFRAME_FLOAT_ON_PARENT))) + (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) || + (style & wxFRAME_FLOAT_ON_PARENT))) { gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(topParent->m_widget) ); @@ -522,7 +522,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, } #endif - if (!name.IsEmpty()) + if (!name.empty()) gtk_window_set_wmclass( GTK_WINDOW(m_widget), wxGTK_CONV( name ), wxGTK_CONV( name ) ); gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) ); @@ -598,7 +598,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, GTK_SIGNAL_FUNC(gtk_frame_focus_in_callback), (gpointer)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event", GTK_SIGNAL_FUNC(gtk_frame_focus_out_callback), (gpointer)this ); - + // decorations if ((m_miniEdge > 0) || (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER)) { @@ -641,7 +641,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, } } - return TRUE; + return true; } wxTopLevelWindowGTK::~wxTopLevelWindowGTK() @@ -652,14 +652,14 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() RemoveGrab(); } - m_isBeingDeleted = TRUE; + m_isBeingDeleted = true; // it may also be GtkScrolledWindow in the case of an MDI child if (GTK_IS_WINDOW(m_widget)) { gtk_window_set_focus( GTK_WINDOW(m_widget), NULL ); } - + if (g_activeFrame == this) g_activeFrame = NULL; if (g_lastActiveFrame == this) @@ -671,10 +671,10 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) { if (show == m_fsIsShowing) - return FALSE; // return what? + return false; // return what? m_fsIsShowing = show; - + wxX11FullScreenMethod method = wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(), (WXWindow)GDK_ROOT_WINDOW()); @@ -691,7 +691,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) else gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); - return TRUE; + return true; } else #endif // GTK+ >= 2.2.0 @@ -753,7 +753,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) } } - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -773,10 +773,10 @@ bool wxTopLevelWindowGTK::Show( bool show ) GtkOnSize( m_x, m_y, m_width, m_height ); } - + if (show) gtk_widget_set_uposition( m_widget, m_x, m_y ); - + return wxWindow::Show( show ); } @@ -804,7 +804,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si // avoid recursions if (m_resizing) return; - m_resizing = TRUE; + m_resizing = true; int old_x = m_x; int old_y = m_y; @@ -851,7 +851,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si maxWidth = -1; maxHeight = -1; #endif - + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; @@ -875,10 +875,10 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si /* we set the size in GtkOnSize, i.e. mostly the actual resizing is done either directly before the frame is shown or in idle time so that different calls to SetSize() don't lead to flicker. */ - m_sizeSet = FALSE; + m_sizeSet = false; } - m_resizing = FALSE; + m_resizing = false; } void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const @@ -914,7 +914,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), // avoid recursions if (m_resizing) return; - m_resizing = TRUE; + m_resizing = true; if ( m_wxwindow == NULL ) return; @@ -942,7 +942,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), maxWidth = -1; maxHeight = -1; #endif - + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; @@ -1008,14 +1008,14 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), // is no need to set the size or position of m_wxwindow. } - m_sizeSet = TRUE; + m_sizeSet = true; // send size event to frame wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); GetEventHandler()->ProcessEvent( event ); - m_resizing = FALSE; + m_resizing = false; } void wxTopLevelWindowGTK::OnInternalIdle() @@ -1047,15 +1047,15 @@ void wxTopLevelWindowGTK::OnInternalIdle() } wxWindow::OnInternalIdle(); - + // Synthetize activate events. if ( g_sendActivateEvent != -1 ) { bool activate = g_sendActivateEvent != 0; - + // if (!activate) wxPrintf( wxT("de") ); // wxPrintf( wxT("activate\n") ); - + // do it only once g_sendActivateEvent = -1; @@ -1099,7 +1099,7 @@ 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) @@ -1147,7 +1147,7 @@ bool wxTopLevelWindowGTK::IsMaximized() const // wxFAIL_MSG( _T("not implemented") ); // This is an approximation - return FALSE; + return false; #endif } @@ -1201,7 +1201,7 @@ void wxTopLevelWindowGTK::AddGrab() { if (!m_grabbed) { - m_grabbed = TRUE; + m_grabbed = true; gtk_grab_add( m_widget ); wxEventLoop().Run(); gtk_grab_remove( m_widget ); @@ -1213,7 +1213,7 @@ void wxTopLevelWindowGTK::RemoveGrab() if (m_grabbed) { gtk_main_quit(); - m_grabbed = FALSE; + m_grabbed = false; } } @@ -1230,23 +1230,23 @@ static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region) else { #ifdef __WXGTK20__ - gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); + gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); #else - wxBitmap bmp = region.ConvertToBitmap(); - bmp.SetMask(new wxMask(bmp, *wxBLACK)); - GdkBitmap* mask = bmp.GetMask()->GetBitmap(); - gdk_window_shape_combine_mask(window, mask, 0, 0); + wxBitmap bmp = region.ConvertToBitmap(); + bmp.SetMask(new wxMask(bmp, *wxBLACK)); + GdkBitmap* mask = bmp.GetMask()->GetBitmap(); + gdk_window_shape_combine_mask(window, mask, 0, 0); #endif - return TRUE; + return true; } } - return FALSE; + return false; } bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) { - wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE, + wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false, _T("Shaped windows must be created with the wxFRAME_SHAPED style.")); GdkWindow *window = NULL; @@ -1263,4 +1263,3 @@ bool wxTopLevelWindowGTK::IsActive() { return (this == (wxTopLevelWindowGTK*)g_activeFrame); } - diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 345274e55d..536777c8f0 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -229,7 +229,7 @@ static GdkGC *g_eraseGC = NULL; // mouse capture state: the window which has it and if the mouse is currently // inside it static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL; -static bool g_captureWindowHasMouse = FALSE; +static bool g_captureWindowHasMouse = false; wxWindowGTK *g_focusWindow = (wxWindowGTK*) NULL; @@ -244,7 +244,7 @@ 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 -static guint32 gs_timeLastClick = 0; +static guint32 gs_timeLastClick = 0; extern bool g_mainThreadLocked; @@ -490,7 +490,7 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget, { // This callback is actually hooked into the text entry // of the combo box, not the GtkHBox. - + int w, h; win->GetSize( &w, &h ); if (w < 2) @@ -499,13 +499,13 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget, h = 2; GtkCombo *gcombo = GTK_COMBO(win->m_widget); - + GtkRequisition entry_req; entry_req.width = 2; entry_req.height = 2; (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->button) )->size_request ) (gcombo->button, &entry_req ); - + requisition->width = w - entry_req.width; requisition->height = entry_req.height; } @@ -544,7 +544,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, (int)gdk_event->area.width, (int)gdk_event->area.height ); } - + gtk_paint_box ( win->m_wxwindow->style, @@ -1048,7 +1048,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, : _T("press"), keysym); - long key_code = wxTranslateKeySymToWXKey(keysym, FALSE /* !isChar */); + long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */); if ( !key_code ) { @@ -1117,14 +1117,14 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, // sending unknown key events doesn't really make sense if ( !key_code ) - return FALSE; + return false; // now fill all the other fields wxFillOtherKeyEventFields(event, win, gdk_event); - + event.m_keyCode = key_code; - return TRUE; + return true; } @@ -1171,7 +1171,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, // Emit KEY_DOWN event ret = win->GetEventHandler()->ProcessEvent( event ); } - else + else { // Return after IM processing as we cannot do // anything with it anyhow. @@ -1182,19 +1182,19 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, // 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 - // with the INPUT FOCUS can generate the INITIAL key_press event. That is, + // with the INPUT FOCUS can generate the INITIAL key_press event. That is, // if the CURRENT widget doesn't have the FOCUS at all, this event definitely // originated from its child widgets and shouldn't be passed to IM context. // In fact, what a GTK+ IM should do is filtering keyEvents and convert them // into text input ONLY WHEN THE WIDGET HAS INPUT FOCUS. Besides, when current - // widgets has both IM context and input focus, the event should be filtered + // widgets has both IM context and input focus, the event should be filtered // by gtk_im_context_filter_keypress(). // Then, we should, according to GTK+ 2.0 API doc, return whatever it returns. if ((!ret) && (win->m_imData != NULL) && ( wxWindow::FindFocus() == win )) { // We should let GTK+ IM filter key event first. According to GTK+ 2.0 API // docs, if IM filter returns true, no further processing should be done. - // we should send the key_down event anyway. + // we should send the key_down event anyway. bool intercepted_by_IM = gtk_im_context_filter_keypress(win->m_imData->context, gdk_event); win->m_imData->lastKeyEvent = NULL; if (intercepted_by_IM) @@ -1207,16 +1207,16 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, if (return_after_IM) return false; -#ifndef __WXGTK20__ +#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 + // 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, + // 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. @@ -1265,7 +1265,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, } return true; } - + #endif // #ifndef __WXGTK20__ #if wxUSE_ACCEL @@ -1295,7 +1295,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, long key_code; KeySym keysym = gdk_event->keyval; // Find key code for EVT_CHAR and EVT_CHAR_HOOK events - key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */); + key_code = wxTranslateKeySymToWXKey(keysym, true /* isChar */); if ( !key_code ) { if ( wxIsAsciiKeysym(keysym) ) @@ -2007,7 +2007,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget, event_type = wxEVT_MOUSEWHEEL; else return FALSE; - + wxMouseEvent event( event_type ); // Can't use InitMouse macro because scroll events don't have button event.SetTimestamp( gdk_event->time ); @@ -2032,7 +2032,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget, event.SetEventObject( win ); event.SetId( win->GetId() ); event.SetTimestamp( gdk_event->time ); - + if (win->GetEventHandler()->ProcessEvent( event )) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "scroll_event" ); @@ -2084,7 +2084,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, wxWindow *win ) { DEBUG_MAIN_THREAD - + if (g_isIdle) wxapp_install_idle_handler(); @@ -2117,8 +2117,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, if ( !win->m_hasFocus ) { // not yet, notify it - win->m_hasFocus = TRUE; - + win->m_hasFocus = true; + if ( DoSendFocusEvents(win) ) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" ); @@ -2175,7 +2175,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk // have focus already if ( win->m_hasFocus ) { - win->m_hasFocus = FALSE; + win->m_hasFocus = false; wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); event.SetEventObject( win ); @@ -2374,7 +2374,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, wxapp_install_idle_handler(); - g_blockEventsOnScroll = TRUE; + g_blockEventsOnScroll = true; // FIXME: there is no 'slider' field in GTK+ 2.0 any more #ifndef __WXGTK20__ @@ -2401,7 +2401,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, // // if (gdk_event->window != widget->slider) return FALSE; - g_blockEventsOnScroll = FALSE; + g_blockEventsOnScroll = false; if (win->m_isScrolling) { @@ -2426,7 +2426,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, win->GetEventHandler()->ProcessEvent( event ); } - win->m_isScrolling = FALSE; + win->m_isScrolling = false; return FALSE; } @@ -2458,7 +2458,7 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) if (g_isIdle) wxapp_install_idle_handler(); - + #ifdef __WXGTK20__ if (win->m_imData) { @@ -2700,16 +2700,16 @@ void wxWindowGTK::Init() m_width = 0; m_height = 0; - m_sizeSet = FALSE; - m_hasVMT = FALSE; - m_needParent = TRUE; - m_isBeingDeleted = FALSE; + m_sizeSet = false; + m_hasVMT = false; + m_needParent = true; + m_isBeingDeleted = false; - m_noExpose = FALSE; - m_nativeSizeEvent = FALSE; + m_noExpose = false; + m_nativeSizeEvent = false; - m_hasScrolling = FALSE; - m_isScrolling = FALSE; + m_hasScrolling = false; + m_isScrolling = false; m_hAdjust = (GtkAdjustment*) NULL; m_vAdjust = (GtkAdjustment*) NULL; @@ -2718,14 +2718,14 @@ void wxWindowGTK::Init() m_oldClientWidth = m_oldClientHeight = 0; - m_resizing = FALSE; + m_resizing = false; m_insertCallback = (wxInsertChildFunction) NULL; - m_acceptsFocus = FALSE; - m_hasFocus = FALSE; + m_acceptsFocus = false; + m_hasFocus = false; - m_clipPaintRegion = FALSE; + m_clipPaintRegion = false; m_needsStyleChange = false; @@ -2771,7 +2771,7 @@ bool wxWindowGTK::Create( wxWindow *parent, !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxWindowGTK creation failed") ); - return FALSE; + return false; } m_insertCallback = wxInsertChildInWindow; @@ -2815,7 +2815,7 @@ bool wxWindowGTK::Create( wxWindow *parent, gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); - m_acceptsFocus = TRUE; + m_acceptsFocus = true; // I _really_ don't want scrollbars in the beginning m_vAdjust->lower = 0.0; @@ -2867,7 +2867,7 @@ bool wxWindowGTK::Create( wxWindow *parent, PostCreation(); - return TRUE; + return true; } wxWindowGTK::~wxWindowGTK() @@ -2880,11 +2880,11 @@ wxWindowGTK::~wxWindowGTK() if ( g_delayedFocus == this ) g_delayedFocus = NULL; - m_isBeingDeleted = TRUE; - m_hasVMT = FALSE; + m_isBeingDeleted = true; + m_hasVMT = false; if (m_widget) - Show( FALSE ); + Show( false ); DestroyChildren(); @@ -2914,7 +2914,7 @@ wxWindowGTK::~wxWindowGTK() bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ) { - wxCHECK_MSG( !m_needParent || parent, FALSE, wxT("Need complete parent.") ); + wxCHECK_MSG( !m_needParent || parent, false, wxT("Need complete parent.") ); // Use either the given size, or the default if -1 is given. // See wxWindowBase for these functions. @@ -2924,7 +2924,7 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w m_x = (int)pos.x; m_y = (int)pos.y; - return TRUE; + return true; } void wxWindowGTK::PostCreation() @@ -2983,7 +2983,7 @@ void wxWindowGTK::PostCreation() { if (m_focusWidget == NULL) m_focusWidget = m_widget; - + gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_in_event", GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this ); @@ -3020,7 +3020,7 @@ void wxWindowGTK::PostCreation() if (GTK_IS_COMBO(m_widget)) { GtkCombo *gcombo = GTK_COMBO(m_widget); - + gtk_signal_connect( GTK_OBJECT(gcombo->entry), "size_request", GTK_SIGNAL_FUNC(wxgtk_combo_size_request_callback), (gpointer) this ); @@ -3038,7 +3038,7 @@ void wxWindowGTK::PostCreation() InheritAttributes(); - m_hasVMT = TRUE; + m_hasVMT = true; // unless the window was created initially hidden (i.e. Hide() had been // called before Create()), we should show it at GTK+ level as well @@ -3081,7 +3081,7 @@ bool wxWindowGTK::Destroy() { wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); - m_hasVMT = FALSE; + m_hasVMT = false; return wxWindowBase::Destroy(); } @@ -3101,7 +3101,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags */ if (m_resizing) return; /* I don't like recursions */ - m_resizing = TRUE; + m_resizing = true; int currentX, currentY; GetPosition(¤tX, ¤tY); @@ -3217,7 +3217,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags GetEventHandler()->ProcessEvent( event ); } - m_resizing = FALSE; + m_resizing = false; } void wxWindowGTK::OnInternalIdle() @@ -3495,12 +3495,12 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const bool wxWindowGTK::Show( bool show ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); if (!wxWindowBase::Show(show)) { // nothing to do - return FALSE; + return false; } if (show) @@ -3513,7 +3513,7 @@ bool wxWindowGTK::Show( bool show ) GetEventHandler()->ProcessEvent(eventShow); - return TRUE; + return true; } static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) @@ -3535,12 +3535,12 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) bool wxWindowGTK::Enable( bool enable ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); if (!wxWindowBase::Enable(enable)) { // nothing to do - return FALSE; + return false; } gtk_widget_set_sensitive( m_widget, enable ); @@ -3549,7 +3549,7 @@ bool wxWindowGTK::Enable( bool enable ) wxWindowNotifyEnable(this, enable); - return TRUE; + return true; } int wxWindowGTK::GetCharHeight() const @@ -3621,17 +3621,17 @@ int wxWindowGTK::GetCharWidth() const } void wxWindowGTK::GetTextExtent( const wxString& string, - int *x, - int *y, - int *descent, - int *externalLeading, - const wxFont *theFont ) const + int *x, + int *y, + int *descent, + int *externalLeading, + const wxFont *theFont ) const { wxFont fontToUse = theFont ? *theFont : GetFont(); wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); - if (string.IsEmpty()) + if (string.empty()) { if (x) (*x) = 0; if (y) (*y) = 0; @@ -3715,7 +3715,7 @@ void wxWindowGTK::SetFocus() #endif if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) ) { - + if (!GTK_WIDGET_REALIZED(m_widget)) { // we can't set the focus to the widget now so we remember that @@ -3736,7 +3736,7 @@ void wxWindowGTK::SetFocus() gtk_widget_grab_focus (m_widget); } } - else + else #ifndef __WXGTK20__ if (GTK_IS_CONTAINER(m_widget)) { @@ -3759,7 +3759,7 @@ bool wxWindowGTK::AcceptsFocus() const bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); wxWindowGTK *oldParent = m_parent, *newParent = (wxWindowGTK *)newParentBase; @@ -3767,7 +3767,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) wxASSERT( GTK_IS_WIDGET(m_widget) ); if ( !wxWindowBase::Reparent(newParent) ) - return FALSE; + return false; wxASSERT( GTK_IS_WIDGET(m_widget) ); @@ -3790,7 +3790,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) /* reverse: prevent GTK from deleting the widget arbitrarily */ gtk_widget_unref( m_widget ); - return TRUE; + return true; } void wxWindowGTK::DoAddChild(wxWindowGTK *child) @@ -3825,7 +3825,7 @@ void wxWindowGTK::RemoveChild(wxWindowBase *child) if (g_isIdle) wxapp_install_idle_handler(); } - + void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move) { wxWindowBase::DoMoveInTabOrder(win, move); @@ -3841,15 +3841,15 @@ void wxWindowGTK::RealizeTabOrder() if (m_children.size() > 0) { GList *chain = NULL; - + for (wxWindowList::const_iterator i = m_children.begin(); i != m_children.end(); ++i) { chain = g_list_prepend(chain, (*i)->m_widget); } - + chain = g_list_reverse(chain); - + gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain); g_list_free(chain); } @@ -3858,7 +3858,7 @@ void wxWindowGTK::RealizeTabOrder() gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow)); } } - + m_dirtyTabOrder = false; } @@ -3872,7 +3872,7 @@ void wxWindowGTK::Raise() { gdk_window_raise( m_wxwindow->window ); } - else if (m_widget->window) + else if (m_widget->window) { gdk_window_raise( m_widget->window ); } @@ -3886,7 +3886,7 @@ void wxWindowGTK::Lower() { gdk_window_lower( m_wxwindow->window ); } - else if (m_widget->window) + else if (m_widget->window) { gdk_window_lower( m_widget->window ); } @@ -3894,10 +3894,10 @@ void wxWindowGTK::Lower() bool wxWindowGTK::SetCursor( const wxCursor &cursor ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); if (cursor == m_cursor) - return FALSE; + return false; if (g_isIdle) wxapp_install_idle_handler(); @@ -4060,7 +4060,7 @@ void wxWindowGTK::GtkSendPaintEvents() } // Clip to paint region in wxClientDC - m_clipPaintRegion = TRUE; + m_clipPaintRegion = true; // widget to draw on GtkPizza *pizza = GTK_PIZZA (m_wxwindow); @@ -4149,7 +4149,7 @@ void wxWindowGTK::GtkSendPaintEvents() paint_event.SetEventObject( this ); GetEventHandler()->ProcessEvent( paint_event ); - m_clipPaintRegion = FALSE; + m_clipPaintRegion = false; #ifndef __WXUNIVERSAL__ #ifndef __WXGTK20__ @@ -4233,7 +4233,7 @@ void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) { - wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); + wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); if (!wxWindowBase::SetBackgroundColour(colour)) return false; @@ -4254,13 +4254,13 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) { - wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); + wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); if (!wxWindowBase::SetForegroundColour(colour)) { return false; } - + if (colour.Ok()) { // We need the pixel value e.g. for background clearing. @@ -4288,7 +4288,7 @@ PangoContext *wxWindowGTK::GtkGetPangoX11Context() return m_x11Context; } #endif - + GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) { // do we need to apply any changes at all? @@ -4304,7 +4304,7 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) if ( m_font.Ok() ) { #ifdef __WXGTK20__ - style->font_desc = + style->font_desc = pango_font_description_copy( m_font.GetNativeFontInfo()->description ); #else wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName(); @@ -4315,13 +4315,13 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) if ( m_foregroundColour.Ok() ) { GdkColor *fg = m_foregroundColour.GetColor(); - + style->fg[GTK_STATE_NORMAL] = *fg; style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG; - + style->fg[GTK_STATE_PRELIGHT] = *fg; style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_FG; - + style->fg[GTK_STATE_ACTIVE] = *fg; style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_FG; } @@ -4334,23 +4334,23 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) style->base[GTK_STATE_NORMAL] = *bg; style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags) (style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG | GTK_RC_BASE); - + style->bg[GTK_STATE_PRELIGHT] = *bg; style->base[GTK_STATE_PRELIGHT] = *bg; style->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) (style->color_flags[GTK_STATE_PRELIGHT] | GTK_RC_BG | GTK_RC_BASE); - + style->bg[GTK_STATE_ACTIVE] = *bg; style->base[GTK_STATE_ACTIVE] = *bg; style->color_flags[GTK_STATE_ACTIVE] = (GtkRcFlags) (style->color_flags[GTK_STATE_ACTIVE] | GTK_RC_BG | GTK_RC_BASE); - + style->bg[GTK_STATE_INSENSITIVE] = *bg; style->base[GTK_STATE_INSENSITIVE] = *bg; style->color_flags[GTK_STATE_INSENSITIVE] = (GtkRcFlags) (style->color_flags[GTK_STATE_INSENSITIVE] | GTK_RC_BG | GTK_RC_BASE); } - + return style; } @@ -4378,7 +4378,7 @@ void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style) bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) { wxWindowBase::SetBackgroundStyle(style); - + if (style == wxBG_STYLE_CUSTOM) { GdkWindow *window = (GdkWindow*) NULL; @@ -4401,7 +4401,7 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) else // Do in OnIdle, because the window is not yet available m_needsStyleChange = true; - + // Don't apply widget style, or we get a grey background } else @@ -4428,7 +4428,7 @@ void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting ) void SetInvokingWindow( wxMenu *menu, wxWindow* win ) { menu->SetInvokingWindow( win ); - + wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); while (node) { @@ -4562,14 +4562,14 @@ bool wxWindowGTK::IsOwnGtkWindow( GdkWindow *window ) bool wxWindowGTK::SetFont( const wxFont &font ) { - wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); + wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); if (!wxWindowBase::SetFont(font)) return false; // apply style change (forceStyle=true so that new style is applied // even if the font changed from valid to wxNullFont): - ApplyWidgetStyle(true); + ApplyWidgetStyle(true); return true; } @@ -4600,7 +4600,7 @@ void wxWindowGTK::DoCaptureMouse() cursor->GetCursor(), (guint32)GDK_CURRENT_TIME ); g_captureWindow = this; - g_captureWindowHasMouse = TRUE; + g_captureWindowHasMouse = true; } void wxWindowGTK::DoReleaseMouse() @@ -4631,7 +4631,7 @@ wxWindow *wxWindowBase::GetCapture() bool wxWindowGTK::IsRetained() const { - return FALSE; + return false; } void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, @@ -4641,7 +4641,7 @@ void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); - m_hasScrolling = TRUE; + m_hasScrolling = true; if (orient == wxHORIZONTAL) { @@ -4817,11 +4817,11 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) } #endif - m_clipPaintRegion = TRUE; + m_clipPaintRegion = true; gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); - m_clipPaintRegion = FALSE; + m_clipPaintRegion = false; } @@ -4885,7 +4885,7 @@ bool wxWinModule::OnInit() // g_eraseGC = gdk_gc_new( GDK_ROOT_PARENT() ); // gdk_gc_set_fill( g_eraseGC, GDK_SOLID ); - return TRUE; + return true; } void wxWinModule::OnExit() diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 7b8633ef1b..6dbc4a9cd1 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -115,16 +115,16 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, int n, const wxString choices[], long style, const wxValidator& validator, const wxString &name ) { - m_needParent = TRUE; + m_needParent = true; #if (GTK_MINOR_VERSION > 0) - m_acceptsFocus = TRUE; + m_acceptsFocus = true; #endif if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxChoice creation failed") ); - return FALSE; + return false; } m_widget = gtk_option_menu_new(); @@ -153,7 +153,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, PostCreation(size); SetBestSize(size); // need this too because this is a wxControlWithItems - return TRUE; + return true; } wxChoice::~wxChoice() @@ -247,7 +247,7 @@ void wxChoice::Clear() { // destroy the data (due to Robert's idea of using wxList // and not wxList we can't just say - // m_clientList.DeleteContents(TRUE) - this would crash! + // m_clientList.DeleteContents(true) - this would crash! wxList::compatibility_iterator node = m_clientList.GetFirst(); while ( node ) { @@ -372,7 +372,7 @@ int wxChoice::FindString( const wxString &string ) const count++; } - return -1; + return wxNOT_FOUND; } int wxChoice::GetSelection() const @@ -403,8 +403,8 @@ void wxChoice::SetString( int n, const wxString& str ) wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); - gtk_label_set_text( label, wxGTK_CONV( str ) ); - + gtk_label_set_text( label, wxGTK_CONV( str ) ); + return; } child = child->next; @@ -414,7 +414,7 @@ void wxChoice::SetString( int n, const wxString& str ) wxString wxChoice::GetString( int n ) const { - wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") ); + wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); int count = 0; @@ -444,7 +444,7 @@ wxString wxChoice::GetString( int n ) const wxFAIL_MSG( wxT("wxChoice: invalid index in GetString()") ); - return wxT(""); + return wxEmptyString; } int wxChoice::GetCount() const @@ -545,9 +545,9 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item) // normal control, just append if (pos == (int)m_clientList.GetCount()) { - gtk_menu_append( GTK_MENU(menu), menu_item ); - m_clientList.Append( (wxObject*) NULL ); - index = m_clientList.GetCount() - 1; + gtk_menu_append( GTK_MENU(menu), menu_item ); + m_clientList.Append( (wxObject*) NULL ); + index = m_clientList.GetCount() - 1; } else { @@ -570,7 +570,7 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item) // changed, but at least after adding an item // it has to change. Adapted from Matt Ownby. InvalidateBestSize(); - + gtk_signal_connect_after( GTK_OBJECT( menu_item ), "activate", GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); @@ -643,4 +643,3 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) #endif // wxUSE_CHOICE - diff --git a/src/gtk1/colour.cpp b/src/gtk1/colour.cpp index 60735789eb..a39f2af429 100644 --- a/src/gtk1/colour.cpp +++ b/src/gtk1/colour.cpp @@ -110,7 +110,7 @@ void wxColourRefData::FreeColour() colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; if (colMapAllocCounter[ idx ] == 0) - gdk_colormap_free_colors( m_colormap, &m_color, 1 ); + gdk_colormap_free_colors( m_colormap, &m_color, 1 ); } } } @@ -124,7 +124,7 @@ void wxColourRefData::AllocColour( GdkColormap *cmap ) #ifdef __WXGTK20__ if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || - (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) + (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) #else GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || @@ -284,5 +284,3 @@ GdkColor *wxColour::GetColor() const return &M_COLDATA->m_color; } - - diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index c1e77b07d7..9b11ce5315 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -349,9 +349,9 @@ int wxComboBox::DoAppend( const wxString &item ) const int count = GetCount(); if ( (int)m_clientDataList.GetCount() < count ) - m_clientDataList.Append( (wxObject*) NULL ); + m_clientDataList.Append( (wxObject*) NULL ); if ( (int)m_clientObjectList.GetCount() < count ) - m_clientObjectList.Append( (wxObject*) NULL ); + m_clientObjectList.Append( (wxObject*) NULL ); EnableEvents(); @@ -396,9 +396,9 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) count = GetCount(); if ( (int)m_clientDataList.GetCount() < count ) - m_clientDataList.Insert( pos, (wxObject*) NULL ); + m_clientDataList.Insert( pos, (wxObject*) NULL ); if ( (int)m_clientObjectList.GetCount() < count ) - m_clientObjectList.Insert( pos, (wxObject*) NULL ); + m_clientObjectList.Insert( pos, (wxObject*) NULL ); EnableEvents(); @@ -532,7 +532,7 @@ void wxComboBox::SetString(int n, const wxString &text) int wxComboBox::FindString( const wxString &item ) const { - wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") ); + wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") ); GtkWidget *list = GTK_COMBO(m_widget)->list; @@ -581,7 +581,7 @@ int wxComboBox::GetSelection() const wxString wxComboBox::GetString( int n ) const { - wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid combobox") ); + wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") ); GtkWidget *list = GTK_COMBO(m_widget)->list; @@ -607,7 +607,7 @@ wxString wxComboBox::GetString( int n ) const wxString wxComboBox::GetStringSelection() const { - wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid combobox") ); + wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") ); GtkWidget *list = GTK_COMBO(m_widget)->list; @@ -626,7 +626,7 @@ wxString wxComboBox::GetStringSelection() const wxFAIL_MSG( wxT("wxComboBox: no selection") ); - return wxT(""); + return wxEmptyString; } int wxComboBox::GetCount() const @@ -677,7 +677,7 @@ void wxComboBox::SetValue( const wxString& value ) wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); GtkWidget *entry = GTK_COMBO(m_widget)->entry; - wxString tmp = wxT(""); + wxString tmp; if (!value.IsNull()) tmp = value; gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) ); @@ -1042,4 +1042,3 @@ void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event) } #endif - diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 626d46cf44..42be5fdc2f 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -1372,7 +1372,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, { gdk_gc_set_clip_mask( m_textGC, mask ); gdk_gc_set_clip_origin( m_textGC, cx-xsrcMask, cy-ysrcMask ); - } + } } else { @@ -1385,7 +1385,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, { gdk_gc_set_clip_mask( m_penGC, mask ); gdk_gc_set_clip_origin( m_penGC, cx-xsrcMask, cy-ysrcMask ); - } + } } } @@ -2377,12 +2377,12 @@ void wxWindowDC::ComputeScaleAndOrigin() if ((m_scaleX != origScaleX || m_scaleY != origScaleY) && (m_pen.Ok())) { - /* this is a bit artificial, but we need to force wxDC to think - the pen has changed */ - wxPen pen = m_pen; - m_pen = wxNullPen; - SetPen( pen ); - } + /* this is a bit artificial, but we need to force wxDC to think + the pen has changed */ + wxPen pen = m_pen; + m_pen = wxNullPen; + SetPen( pen ); + } } // Resolution in pixels per logical inch diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index dcb0b56c32..d03f079cc8 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -16,8 +16,8 @@ #include "wx/dnd.h" #include "wx/log.h" - - + + #if wxUSE_DRAG_AND_DROP #include "wx/window.h" @@ -188,7 +188,7 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget), drop_target->OnLeave(); /* this has to be done because GDK has no "drag_enter" event */ - drop_target->m_firstMotion = TRUE; + drop_target->m_firstMotion = true; /* after this, invalidate the drop_target's GdkDragContext */ drop_target->SetDragContext( (GdkDragContext*) NULL ); @@ -287,7 +287,7 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), drop_target->SetDragContext( (GdkDragContext*) NULL ); /* this has to be done because GDK has no "drag_enter" event */ - drop_target->m_firstMotion = FALSE; + drop_target->m_firstMotion = false; return ret; } @@ -338,7 +338,7 @@ static gboolean target_drag_drop( GtkWidget *widget, /* reset the block here as someone might very well show a dialog as a reaction to a drop and this wouldn't work without events */ - g_blockEventsOnDrag = FALSE; + g_blockEventsOnDrag = false; bool ret = drop_target->OnDrop( x, y ); @@ -388,7 +388,7 @@ static gboolean target_drag_drop( GtkWidget *widget, drop_target->SetDragWidget( (GtkWidget*) NULL ); /* this has to be done because GDK has no "drag_enter" event */ - drop_target->m_firstMotion = TRUE; + drop_target->m_firstMotion = true; return ret; } @@ -457,7 +457,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget), wxDropTarget::wxDropTarget( wxDataObject *data ) : wxDropTargetBase( data ) { - m_firstMotion = TRUE; + m_firstMotion = true; m_dragContext = (GdkDragContext*) NULL; m_dragWidget = (GtkWidget*) NULL; m_dragData = (GtkSelectionData*) NULL; @@ -482,7 +482,7 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x), bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) { if (!m_dataObject) - return FALSE; + return false; return (GetMatchingPair() != (GdkAtom) 0); } @@ -530,19 +530,19 @@ GdkAtom wxDropTarget::GetMatchingPair() bool wxDropTarget::GetData() { if (!m_dragData) - return FALSE; + return false; if (!m_dataObject) - return FALSE; + return false; wxDataFormat dragFormat( m_dragData->target ); if (!m_dataObject->IsSupportedFormat( dragFormat )) - return FALSE; + return false; m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data ); - return TRUE; + return true; } void wxDropTarget::UnregisterWidget( GtkWidget *widget ) @@ -655,11 +655,11 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), /* disable GUI threads */ #endif - gtk_selection_data_set( selection_data, - selection_data->target, - 8, // 8-bit - d, - size ); + gtk_selection_data_set( selection_data, + selection_data->target, + 8, // 8-bit + d, + size ); #if wxUSE_THREADS /* enable GUI threads */ @@ -714,7 +714,7 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget), // printf( "Drag source: drag_end.\n" ); - drop_source->m_waiting = FALSE; + drop_source->m_waiting = false; } } @@ -744,7 +744,7 @@ wxDropSource::wxDropSource(wxWindow *win, const wxIcon &iconMove, const wxIcon &iconNone) { - m_waiting = TRUE; + m_waiting = true; m_iconWindow = (GtkWidget*) NULL; @@ -763,7 +763,7 @@ wxDropSource::wxDropSource(wxDataObject& data, const wxIcon &iconMove, const wxIcon &iconNone) { - m_waiting = TRUE; + m_waiting = true; SetData( data ); @@ -859,11 +859,11 @@ wxDragResult wxDropSource::DoDragDrop(int flags) return wxDragNone; // disabled for now - g_blockEventsOnDrag = TRUE; + g_blockEventsOnDrag = true; RegisterWindow(); - m_waiting = TRUE; + m_waiting = true; GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 ); @@ -933,7 +933,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags) /* re-enable GUI threads */ #endif - g_blockEventsOnDrag = FALSE; + g_blockEventsOnDrag = false; UnregisterWindow(); diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 2e602ab9dc..21986f8a59 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -622,12 +622,12 @@ void wxFrame::UpdateMenuBarSize() // this is called after Remove with a NULL m_frameMenuBar if ( m_frameMenuBar ) - (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) - (m_frameMenuBar->m_widget, &req ); + (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) + (m_frameMenuBar->m_widget, &req ); m_menuBarHeight = req.height; - // resize window in OnInternalIdle + // resize window in OnInternalIdle GtkUpdateSize(); } @@ -714,4 +714,3 @@ void wxFrame::PositionStatusBar() GtkUpdateSize(); } #endif // wxUSE_STATUSBAR - diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 3f975f9b1f..5ffdf7d7d4 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -1510,7 +1510,7 @@ long wxTextCtrl::GetInsertionPoint() const else #endif { - return (long) GET_EDITABLE_POS(m_text); + return (long) GET_EDITABLE_POS(m_text); } } @@ -2081,7 +2081,7 @@ void wxTextCtrl::Freeze() gtk_widget_set_sensitive(m_widget, false); 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 diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index d13acd7d68..312f2ce56d 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -77,7 +77,7 @@ static wxTopLevelWindowGTK *g_lastActiveFrame = (wxTopLevelWindowGTK*) NULL; // either TRUE or FALSE and an activate event will be sent during the next // OnIdle() call and it is reset to -1: this value means that we shouldn't // send any activate events at all -static int g_sendActivateEvent = -1; +static int g_sendActivateEvent = -1; //----------------------------------------------------------------------------- // "focus_in_event" @@ -90,7 +90,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, { if (g_isIdle) wxapp_install_idle_handler(); - + switch ( g_sendActivateEvent ) { case -1: @@ -107,11 +107,11 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, g_activeFrame = win; g_lastActiveFrame = g_activeFrame; - + // wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() ); - + wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); - wxActivateEvent event(wxEVT_ACTIVATE, TRUE, g_activeFrame->GetId()); + wxActivateEvent event(wxEVT_ACTIVATE, true, g_activeFrame->GetId()); event.SetEventObject(g_activeFrame); g_activeFrame->GetEventHandler()->ProcessEvent(event); @@ -124,8 +124,8 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, //----------------------------------------------------------------------------- extern "C" { -static gint gtk_frame_focus_out_callback( GtkWidget *widget, - GdkEventFocus *WXUNUSED(gdk_event), +static gint gtk_frame_focus_out_callback( GtkWidget *widget, + GdkEventFocus *WXUNUSED(gdk_event), wxTopLevelWindowGTK *win ) { if (g_isIdle) @@ -135,21 +135,21 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget, // wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset // g_sendActivateEvent to -1 g_sendActivateEvent = 0; - + // wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") ); - + // wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() ); if (g_activeFrame) { wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); - wxActivateEvent event(wxEVT_ACTIVATE, FALSE, g_activeFrame->GetId()); + wxActivateEvent event(wxEVT_ACTIVATE, false, g_activeFrame->GetId()); event.SetEventObject(g_activeFrame); g_activeFrame->GetEventHandler()->ProcessEvent(event); g_activeFrame = NULL; } - + return FALSE; } } @@ -299,7 +299,7 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), wxTopLevelWindow *win ) { - win->SetIconizeState(FALSE); + win->SetIconizeState(false); } } @@ -410,16 +410,16 @@ static void wxInsertChildInTopLevelWindow( wxTopLevelWindowGTK* parent, wxWindow void wxTopLevelWindowGTK::Init() { - m_sizeSet = FALSE; + m_sizeSet = false; m_miniEdge = 0; m_miniTitle = 0; m_mainWidget = (GtkWidget*) NULL; - m_insertInClientArea = TRUE; - m_isIconized = FALSE; - m_fsIsShowing = FALSE; - m_themeEnabled = TRUE; + m_insertInClientArea = true; + m_isIconized = false; + m_fsIsShowing = false; + m_themeEnabled = true; m_gdkDecor = m_gdkFunc = 0; - m_grabbed = FALSE; + m_grabbed = false; } bool wxTopLevelWindowGTK::Create( wxWindow *parent, @@ -438,13 +438,13 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, wxTopLevelWindows.Append( this ); - m_needParent = FALSE; + m_needParent = false; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxTopLevelWindowGTK creation failed") ); - return FALSE; + return false; } m_title = title; @@ -479,10 +479,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, { gtk_window_set_type_hint(GTK_WINDOW(m_widget), GDK_WINDOW_TYPE_HINT_UTILITY); - + // On some WMs, like KDE, a TOOL_WINDOW will still show // on the taskbar, but on Gnome a TOOL_WINDOW will not. - // For consistency between WMs and with Windows, we + // For consistency between WMs and with Windows, we // should set the NO_TASKBAR flag which will apply // the set_skip_taskbar_hint if it is available, // ensuring no taskbar entry will appear. @@ -495,8 +495,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, wxWindow *topParent = wxGetTopLevelParent(m_parent); if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) && - (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) || - (style & wxFRAME_FLOAT_ON_PARENT))) + (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) || + (style & wxFRAME_FLOAT_ON_PARENT))) { gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(topParent->m_widget) ); @@ -522,7 +522,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, } #endif - if (!name.IsEmpty()) + if (!name.empty()) gtk_window_set_wmclass( GTK_WINDOW(m_widget), wxGTK_CONV( name ), wxGTK_CONV( name ) ); gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) ); @@ -598,7 +598,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, GTK_SIGNAL_FUNC(gtk_frame_focus_in_callback), (gpointer)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event", GTK_SIGNAL_FUNC(gtk_frame_focus_out_callback), (gpointer)this ); - + // decorations if ((m_miniEdge > 0) || (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER)) { @@ -641,7 +641,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, } } - return TRUE; + return true; } wxTopLevelWindowGTK::~wxTopLevelWindowGTK() @@ -652,14 +652,14 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() RemoveGrab(); } - m_isBeingDeleted = TRUE; + m_isBeingDeleted = true; // it may also be GtkScrolledWindow in the case of an MDI child if (GTK_IS_WINDOW(m_widget)) { gtk_window_set_focus( GTK_WINDOW(m_widget), NULL ); } - + if (g_activeFrame == this) g_activeFrame = NULL; if (g_lastActiveFrame == this) @@ -671,10 +671,10 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) { if (show == m_fsIsShowing) - return FALSE; // return what? + return false; // return what? m_fsIsShowing = show; - + wxX11FullScreenMethod method = wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(), (WXWindow)GDK_ROOT_WINDOW()); @@ -691,7 +691,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) else gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); - return TRUE; + return true; } else #endif // GTK+ >= 2.2.0 @@ -753,7 +753,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) } } - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -773,10 +773,10 @@ bool wxTopLevelWindowGTK::Show( bool show ) GtkOnSize( m_x, m_y, m_width, m_height ); } - + if (show) gtk_widget_set_uposition( m_widget, m_x, m_y ); - + return wxWindow::Show( show ); } @@ -804,7 +804,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si // avoid recursions if (m_resizing) return; - m_resizing = TRUE; + m_resizing = true; int old_x = m_x; int old_y = m_y; @@ -851,7 +851,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si maxWidth = -1; maxHeight = -1; #endif - + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; @@ -875,10 +875,10 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si /* we set the size in GtkOnSize, i.e. mostly the actual resizing is done either directly before the frame is shown or in idle time so that different calls to SetSize() don't lead to flicker. */ - m_sizeSet = FALSE; + m_sizeSet = false; } - m_resizing = FALSE; + m_resizing = false; } void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const @@ -914,7 +914,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), // avoid recursions if (m_resizing) return; - m_resizing = TRUE; + m_resizing = true; if ( m_wxwindow == NULL ) return; @@ -942,7 +942,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), maxWidth = -1; maxHeight = -1; #endif - + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; @@ -1008,14 +1008,14 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), // is no need to set the size or position of m_wxwindow. } - m_sizeSet = TRUE; + m_sizeSet = true; // send size event to frame wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); GetEventHandler()->ProcessEvent( event ); - m_resizing = FALSE; + m_resizing = false; } void wxTopLevelWindowGTK::OnInternalIdle() @@ -1047,15 +1047,15 @@ void wxTopLevelWindowGTK::OnInternalIdle() } wxWindow::OnInternalIdle(); - + // Synthetize activate events. if ( g_sendActivateEvent != -1 ) { bool activate = g_sendActivateEvent != 0; - + // if (!activate) wxPrintf( wxT("de") ); // wxPrintf( wxT("activate\n") ); - + // do it only once g_sendActivateEvent = -1; @@ -1099,7 +1099,7 @@ 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) @@ -1147,7 +1147,7 @@ bool wxTopLevelWindowGTK::IsMaximized() const // wxFAIL_MSG( _T("not implemented") ); // This is an approximation - return FALSE; + return false; #endif } @@ -1201,7 +1201,7 @@ void wxTopLevelWindowGTK::AddGrab() { if (!m_grabbed) { - m_grabbed = TRUE; + m_grabbed = true; gtk_grab_add( m_widget ); wxEventLoop().Run(); gtk_grab_remove( m_widget ); @@ -1213,7 +1213,7 @@ void wxTopLevelWindowGTK::RemoveGrab() if (m_grabbed) { gtk_main_quit(); - m_grabbed = FALSE; + m_grabbed = false; } } @@ -1230,23 +1230,23 @@ static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region) else { #ifdef __WXGTK20__ - gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); + gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); #else - wxBitmap bmp = region.ConvertToBitmap(); - bmp.SetMask(new wxMask(bmp, *wxBLACK)); - GdkBitmap* mask = bmp.GetMask()->GetBitmap(); - gdk_window_shape_combine_mask(window, mask, 0, 0); + wxBitmap bmp = region.ConvertToBitmap(); + bmp.SetMask(new wxMask(bmp, *wxBLACK)); + GdkBitmap* mask = bmp.GetMask()->GetBitmap(); + gdk_window_shape_combine_mask(window, mask, 0, 0); #endif - return TRUE; + return true; } } - return FALSE; + return false; } bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) { - wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE, + wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false, _T("Shaped windows must be created with the wxFRAME_SHAPED style.")); GdkWindow *window = NULL; @@ -1263,4 +1263,3 @@ bool wxTopLevelWindowGTK::IsActive() { return (this == (wxTopLevelWindowGTK*)g_activeFrame); } - diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 345274e55d..536777c8f0 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -229,7 +229,7 @@ static GdkGC *g_eraseGC = NULL; // mouse capture state: the window which has it and if the mouse is currently // inside it static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL; -static bool g_captureWindowHasMouse = FALSE; +static bool g_captureWindowHasMouse = false; wxWindowGTK *g_focusWindow = (wxWindowGTK*) NULL; @@ -244,7 +244,7 @@ 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 -static guint32 gs_timeLastClick = 0; +static guint32 gs_timeLastClick = 0; extern bool g_mainThreadLocked; @@ -490,7 +490,7 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget, { // This callback is actually hooked into the text entry // of the combo box, not the GtkHBox. - + int w, h; win->GetSize( &w, &h ); if (w < 2) @@ -499,13 +499,13 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget, h = 2; GtkCombo *gcombo = GTK_COMBO(win->m_widget); - + GtkRequisition entry_req; entry_req.width = 2; entry_req.height = 2; (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->button) )->size_request ) (gcombo->button, &entry_req ); - + requisition->width = w - entry_req.width; requisition->height = entry_req.height; } @@ -544,7 +544,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, (int)gdk_event->area.width, (int)gdk_event->area.height ); } - + gtk_paint_box ( win->m_wxwindow->style, @@ -1048,7 +1048,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, : _T("press"), keysym); - long key_code = wxTranslateKeySymToWXKey(keysym, FALSE /* !isChar */); + long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */); if ( !key_code ) { @@ -1117,14 +1117,14 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, // sending unknown key events doesn't really make sense if ( !key_code ) - return FALSE; + return false; // now fill all the other fields wxFillOtherKeyEventFields(event, win, gdk_event); - + event.m_keyCode = key_code; - return TRUE; + return true; } @@ -1171,7 +1171,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, // Emit KEY_DOWN event ret = win->GetEventHandler()->ProcessEvent( event ); } - else + else { // Return after IM processing as we cannot do // anything with it anyhow. @@ -1182,19 +1182,19 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, // 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 - // with the INPUT FOCUS can generate the INITIAL key_press event. That is, + // with the INPUT FOCUS can generate the INITIAL key_press event. That is, // if the CURRENT widget doesn't have the FOCUS at all, this event definitely // originated from its child widgets and shouldn't be passed to IM context. // In fact, what a GTK+ IM should do is filtering keyEvents and convert them // into text input ONLY WHEN THE WIDGET HAS INPUT FOCUS. Besides, when current - // widgets has both IM context and input focus, the event should be filtered + // widgets has both IM context and input focus, the event should be filtered // by gtk_im_context_filter_keypress(). // Then, we should, according to GTK+ 2.0 API doc, return whatever it returns. if ((!ret) && (win->m_imData != NULL) && ( wxWindow::FindFocus() == win )) { // We should let GTK+ IM filter key event first. According to GTK+ 2.0 API // docs, if IM filter returns true, no further processing should be done. - // we should send the key_down event anyway. + // we should send the key_down event anyway. bool intercepted_by_IM = gtk_im_context_filter_keypress(win->m_imData->context, gdk_event); win->m_imData->lastKeyEvent = NULL; if (intercepted_by_IM) @@ -1207,16 +1207,16 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, if (return_after_IM) return false; -#ifndef __WXGTK20__ +#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 + // 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, + // 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. @@ -1265,7 +1265,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, } return true; } - + #endif // #ifndef __WXGTK20__ #if wxUSE_ACCEL @@ -1295,7 +1295,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, long key_code; KeySym keysym = gdk_event->keyval; // Find key code for EVT_CHAR and EVT_CHAR_HOOK events - key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */); + key_code = wxTranslateKeySymToWXKey(keysym, true /* isChar */); if ( !key_code ) { if ( wxIsAsciiKeysym(keysym) ) @@ -2007,7 +2007,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget, event_type = wxEVT_MOUSEWHEEL; else return FALSE; - + wxMouseEvent event( event_type ); // Can't use InitMouse macro because scroll events don't have button event.SetTimestamp( gdk_event->time ); @@ -2032,7 +2032,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget, event.SetEventObject( win ); event.SetId( win->GetId() ); event.SetTimestamp( gdk_event->time ); - + if (win->GetEventHandler()->ProcessEvent( event )) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "scroll_event" ); @@ -2084,7 +2084,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, wxWindow *win ) { DEBUG_MAIN_THREAD - + if (g_isIdle) wxapp_install_idle_handler(); @@ -2117,8 +2117,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, if ( !win->m_hasFocus ) { // not yet, notify it - win->m_hasFocus = TRUE; - + win->m_hasFocus = true; + if ( DoSendFocusEvents(win) ) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" ); @@ -2175,7 +2175,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk // have focus already if ( win->m_hasFocus ) { - win->m_hasFocus = FALSE; + win->m_hasFocus = false; wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); event.SetEventObject( win ); @@ -2374,7 +2374,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, wxapp_install_idle_handler(); - g_blockEventsOnScroll = TRUE; + g_blockEventsOnScroll = true; // FIXME: there is no 'slider' field in GTK+ 2.0 any more #ifndef __WXGTK20__ @@ -2401,7 +2401,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, // // if (gdk_event->window != widget->slider) return FALSE; - g_blockEventsOnScroll = FALSE; + g_blockEventsOnScroll = false; if (win->m_isScrolling) { @@ -2426,7 +2426,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, win->GetEventHandler()->ProcessEvent( event ); } - win->m_isScrolling = FALSE; + win->m_isScrolling = false; return FALSE; } @@ -2458,7 +2458,7 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) if (g_isIdle) wxapp_install_idle_handler(); - + #ifdef __WXGTK20__ if (win->m_imData) { @@ -2700,16 +2700,16 @@ void wxWindowGTK::Init() m_width = 0; m_height = 0; - m_sizeSet = FALSE; - m_hasVMT = FALSE; - m_needParent = TRUE; - m_isBeingDeleted = FALSE; + m_sizeSet = false; + m_hasVMT = false; + m_needParent = true; + m_isBeingDeleted = false; - m_noExpose = FALSE; - m_nativeSizeEvent = FALSE; + m_noExpose = false; + m_nativeSizeEvent = false; - m_hasScrolling = FALSE; - m_isScrolling = FALSE; + m_hasScrolling = false; + m_isScrolling = false; m_hAdjust = (GtkAdjustment*) NULL; m_vAdjust = (GtkAdjustment*) NULL; @@ -2718,14 +2718,14 @@ void wxWindowGTK::Init() m_oldClientWidth = m_oldClientHeight = 0; - m_resizing = FALSE; + m_resizing = false; m_insertCallback = (wxInsertChildFunction) NULL; - m_acceptsFocus = FALSE; - m_hasFocus = FALSE; + m_acceptsFocus = false; + m_hasFocus = false; - m_clipPaintRegion = FALSE; + m_clipPaintRegion = false; m_needsStyleChange = false; @@ -2771,7 +2771,7 @@ bool wxWindowGTK::Create( wxWindow *parent, !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxWindowGTK creation failed") ); - return FALSE; + return false; } m_insertCallback = wxInsertChildInWindow; @@ -2815,7 +2815,7 @@ bool wxWindowGTK::Create( wxWindow *parent, gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); - m_acceptsFocus = TRUE; + m_acceptsFocus = true; // I _really_ don't want scrollbars in the beginning m_vAdjust->lower = 0.0; @@ -2867,7 +2867,7 @@ bool wxWindowGTK::Create( wxWindow *parent, PostCreation(); - return TRUE; + return true; } wxWindowGTK::~wxWindowGTK() @@ -2880,11 +2880,11 @@ wxWindowGTK::~wxWindowGTK() if ( g_delayedFocus == this ) g_delayedFocus = NULL; - m_isBeingDeleted = TRUE; - m_hasVMT = FALSE; + m_isBeingDeleted = true; + m_hasVMT = false; if (m_widget) - Show( FALSE ); + Show( false ); DestroyChildren(); @@ -2914,7 +2914,7 @@ wxWindowGTK::~wxWindowGTK() bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ) { - wxCHECK_MSG( !m_needParent || parent, FALSE, wxT("Need complete parent.") ); + wxCHECK_MSG( !m_needParent || parent, false, wxT("Need complete parent.") ); // Use either the given size, or the default if -1 is given. // See wxWindowBase for these functions. @@ -2924,7 +2924,7 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w m_x = (int)pos.x; m_y = (int)pos.y; - return TRUE; + return true; } void wxWindowGTK::PostCreation() @@ -2983,7 +2983,7 @@ void wxWindowGTK::PostCreation() { if (m_focusWidget == NULL) m_focusWidget = m_widget; - + gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_in_event", GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this ); @@ -3020,7 +3020,7 @@ void wxWindowGTK::PostCreation() if (GTK_IS_COMBO(m_widget)) { GtkCombo *gcombo = GTK_COMBO(m_widget); - + gtk_signal_connect( GTK_OBJECT(gcombo->entry), "size_request", GTK_SIGNAL_FUNC(wxgtk_combo_size_request_callback), (gpointer) this ); @@ -3038,7 +3038,7 @@ void wxWindowGTK::PostCreation() InheritAttributes(); - m_hasVMT = TRUE; + m_hasVMT = true; // unless the window was created initially hidden (i.e. Hide() had been // called before Create()), we should show it at GTK+ level as well @@ -3081,7 +3081,7 @@ bool wxWindowGTK::Destroy() { wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); - m_hasVMT = FALSE; + m_hasVMT = false; return wxWindowBase::Destroy(); } @@ -3101,7 +3101,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags */ if (m_resizing) return; /* I don't like recursions */ - m_resizing = TRUE; + m_resizing = true; int currentX, currentY; GetPosition(¤tX, ¤tY); @@ -3217,7 +3217,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags GetEventHandler()->ProcessEvent( event ); } - m_resizing = FALSE; + m_resizing = false; } void wxWindowGTK::OnInternalIdle() @@ -3495,12 +3495,12 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const bool wxWindowGTK::Show( bool show ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); if (!wxWindowBase::Show(show)) { // nothing to do - return FALSE; + return false; } if (show) @@ -3513,7 +3513,7 @@ bool wxWindowGTK::Show( bool show ) GetEventHandler()->ProcessEvent(eventShow); - return TRUE; + return true; } static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) @@ -3535,12 +3535,12 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) bool wxWindowGTK::Enable( bool enable ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); if (!wxWindowBase::Enable(enable)) { // nothing to do - return FALSE; + return false; } gtk_widget_set_sensitive( m_widget, enable ); @@ -3549,7 +3549,7 @@ bool wxWindowGTK::Enable( bool enable ) wxWindowNotifyEnable(this, enable); - return TRUE; + return true; } int wxWindowGTK::GetCharHeight() const @@ -3621,17 +3621,17 @@ int wxWindowGTK::GetCharWidth() const } void wxWindowGTK::GetTextExtent( const wxString& string, - int *x, - int *y, - int *descent, - int *externalLeading, - const wxFont *theFont ) const + int *x, + int *y, + int *descent, + int *externalLeading, + const wxFont *theFont ) const { wxFont fontToUse = theFont ? *theFont : GetFont(); wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); - if (string.IsEmpty()) + if (string.empty()) { if (x) (*x) = 0; if (y) (*y) = 0; @@ -3715,7 +3715,7 @@ void wxWindowGTK::SetFocus() #endif if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) ) { - + if (!GTK_WIDGET_REALIZED(m_widget)) { // we can't set the focus to the widget now so we remember that @@ -3736,7 +3736,7 @@ void wxWindowGTK::SetFocus() gtk_widget_grab_focus (m_widget); } } - else + else #ifndef __WXGTK20__ if (GTK_IS_CONTAINER(m_widget)) { @@ -3759,7 +3759,7 @@ bool wxWindowGTK::AcceptsFocus() const bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); wxWindowGTK *oldParent = m_parent, *newParent = (wxWindowGTK *)newParentBase; @@ -3767,7 +3767,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) wxASSERT( GTK_IS_WIDGET(m_widget) ); if ( !wxWindowBase::Reparent(newParent) ) - return FALSE; + return false; wxASSERT( GTK_IS_WIDGET(m_widget) ); @@ -3790,7 +3790,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) /* reverse: prevent GTK from deleting the widget arbitrarily */ gtk_widget_unref( m_widget ); - return TRUE; + return true; } void wxWindowGTK::DoAddChild(wxWindowGTK *child) @@ -3825,7 +3825,7 @@ void wxWindowGTK::RemoveChild(wxWindowBase *child) if (g_isIdle) wxapp_install_idle_handler(); } - + void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move) { wxWindowBase::DoMoveInTabOrder(win, move); @@ -3841,15 +3841,15 @@ void wxWindowGTK::RealizeTabOrder() if (m_children.size() > 0) { GList *chain = NULL; - + for (wxWindowList::const_iterator i = m_children.begin(); i != m_children.end(); ++i) { chain = g_list_prepend(chain, (*i)->m_widget); } - + chain = g_list_reverse(chain); - + gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain); g_list_free(chain); } @@ -3858,7 +3858,7 @@ void wxWindowGTK::RealizeTabOrder() gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow)); } } - + m_dirtyTabOrder = false; } @@ -3872,7 +3872,7 @@ void wxWindowGTK::Raise() { gdk_window_raise( m_wxwindow->window ); } - else if (m_widget->window) + else if (m_widget->window) { gdk_window_raise( m_widget->window ); } @@ -3886,7 +3886,7 @@ void wxWindowGTK::Lower() { gdk_window_lower( m_wxwindow->window ); } - else if (m_widget->window) + else if (m_widget->window) { gdk_window_lower( m_widget->window ); } @@ -3894,10 +3894,10 @@ void wxWindowGTK::Lower() bool wxWindowGTK::SetCursor( const wxCursor &cursor ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); if (cursor == m_cursor) - return FALSE; + return false; if (g_isIdle) wxapp_install_idle_handler(); @@ -4060,7 +4060,7 @@ void wxWindowGTK::GtkSendPaintEvents() } // Clip to paint region in wxClientDC - m_clipPaintRegion = TRUE; + m_clipPaintRegion = true; // widget to draw on GtkPizza *pizza = GTK_PIZZA (m_wxwindow); @@ -4149,7 +4149,7 @@ void wxWindowGTK::GtkSendPaintEvents() paint_event.SetEventObject( this ); GetEventHandler()->ProcessEvent( paint_event ); - m_clipPaintRegion = FALSE; + m_clipPaintRegion = false; #ifndef __WXUNIVERSAL__ #ifndef __WXGTK20__ @@ -4233,7 +4233,7 @@ void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) { - wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); + wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); if (!wxWindowBase::SetBackgroundColour(colour)) return false; @@ -4254,13 +4254,13 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) { - wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); + wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); if (!wxWindowBase::SetForegroundColour(colour)) { return false; } - + if (colour.Ok()) { // We need the pixel value e.g. for background clearing. @@ -4288,7 +4288,7 @@ PangoContext *wxWindowGTK::GtkGetPangoX11Context() return m_x11Context; } #endif - + GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) { // do we need to apply any changes at all? @@ -4304,7 +4304,7 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) if ( m_font.Ok() ) { #ifdef __WXGTK20__ - style->font_desc = + style->font_desc = pango_font_description_copy( m_font.GetNativeFontInfo()->description ); #else wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName(); @@ -4315,13 +4315,13 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) if ( m_foregroundColour.Ok() ) { GdkColor *fg = m_foregroundColour.GetColor(); - + style->fg[GTK_STATE_NORMAL] = *fg; style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG; - + style->fg[GTK_STATE_PRELIGHT] = *fg; style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_FG; - + style->fg[GTK_STATE_ACTIVE] = *fg; style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_FG; } @@ -4334,23 +4334,23 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) style->base[GTK_STATE_NORMAL] = *bg; style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags) (style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG | GTK_RC_BASE); - + style->bg[GTK_STATE_PRELIGHT] = *bg; style->base[GTK_STATE_PRELIGHT] = *bg; style->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) (style->color_flags[GTK_STATE_PRELIGHT] | GTK_RC_BG | GTK_RC_BASE); - + style->bg[GTK_STATE_ACTIVE] = *bg; style->base[GTK_STATE_ACTIVE] = *bg; style->color_flags[GTK_STATE_ACTIVE] = (GtkRcFlags) (style->color_flags[GTK_STATE_ACTIVE] | GTK_RC_BG | GTK_RC_BASE); - + style->bg[GTK_STATE_INSENSITIVE] = *bg; style->base[GTK_STATE_INSENSITIVE] = *bg; style->color_flags[GTK_STATE_INSENSITIVE] = (GtkRcFlags) (style->color_flags[GTK_STATE_INSENSITIVE] | GTK_RC_BG | GTK_RC_BASE); } - + return style; } @@ -4378,7 +4378,7 @@ void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style) bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) { wxWindowBase::SetBackgroundStyle(style); - + if (style == wxBG_STYLE_CUSTOM) { GdkWindow *window = (GdkWindow*) NULL; @@ -4401,7 +4401,7 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) else // Do in OnIdle, because the window is not yet available m_needsStyleChange = true; - + // Don't apply widget style, or we get a grey background } else @@ -4428,7 +4428,7 @@ void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting ) void SetInvokingWindow( wxMenu *menu, wxWindow* win ) { menu->SetInvokingWindow( win ); - + wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); while (node) { @@ -4562,14 +4562,14 @@ bool wxWindowGTK::IsOwnGtkWindow( GdkWindow *window ) bool wxWindowGTK::SetFont( const wxFont &font ) { - wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); + wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); if (!wxWindowBase::SetFont(font)) return false; // apply style change (forceStyle=true so that new style is applied // even if the font changed from valid to wxNullFont): - ApplyWidgetStyle(true); + ApplyWidgetStyle(true); return true; } @@ -4600,7 +4600,7 @@ void wxWindowGTK::DoCaptureMouse() cursor->GetCursor(), (guint32)GDK_CURRENT_TIME ); g_captureWindow = this; - g_captureWindowHasMouse = TRUE; + g_captureWindowHasMouse = true; } void wxWindowGTK::DoReleaseMouse() @@ -4631,7 +4631,7 @@ wxWindow *wxWindowBase::GetCapture() bool wxWindowGTK::IsRetained() const { - return FALSE; + return false; } void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, @@ -4641,7 +4641,7 @@ void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); - m_hasScrolling = TRUE; + m_hasScrolling = true; if (orient == wxHORIZONTAL) { @@ -4817,11 +4817,11 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) } #endif - m_clipPaintRegion = TRUE; + m_clipPaintRegion = true; gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); - m_clipPaintRegion = FALSE; + m_clipPaintRegion = false; } @@ -4885,7 +4885,7 @@ bool wxWinModule::OnInit() // g_eraseGC = gdk_gc_new( GDK_ROOT_PARENT() ); // gdk_gc_set_fill( g_eraseGC, GDK_SOLID ); - return TRUE; + return true; } void wxWinModule::OnExit() -- 2.45.2