[1231183] 'cleanup: mismatched indentation' and other cleanings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-07-22 18:01:46 +00:00
parent bfd84575a2
commit 0a164d4c4e
18 changed files with 456 additions and 468 deletions

View File

@@ -115,16 +115,16 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxValidator& validator, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = true;
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
m_acceptsFocus = TRUE; m_acceptsFocus = true;
#endif #endif
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxChoice creation failed") ); wxFAIL_MSG( wxT("wxChoice creation failed") );
return FALSE; return false;
} }
m_widget = gtk_option_menu_new(); m_widget = gtk_option_menu_new();
@@ -153,7 +153,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
PostCreation(size); PostCreation(size);
SetBestSize(size); // need this too because this is a wxControlWithItems SetBestSize(size); // need this too because this is a wxControlWithItems
return TRUE; return true;
} }
wxChoice::~wxChoice() wxChoice::~wxChoice()
@@ -247,7 +247,7 @@ void wxChoice::Clear()
{ {
// destroy the data (due to Robert's idea of using wxList<wxObject> // destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say // and not wxList<wxClientData> 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(); wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node ) while ( node )
{ {
@@ -372,7 +372,7 @@ int wxChoice::FindString( const wxString &string ) const
count++; count++;
} }
return -1; return wxNOT_FOUND;
} }
int wxChoice::GetSelection() const int wxChoice::GetSelection() const
@@ -403,8 +403,8 @@ void wxChoice::SetString( int n, const wxString& str )
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); 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; return;
} }
child = child->next; child = child->next;
@@ -414,7 +414,7 @@ void wxChoice::SetString( int n, const wxString& str )
wxString wxChoice::GetString( int n ) const 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) ) ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0; int count = 0;
@@ -444,7 +444,7 @@ wxString wxChoice::GetString( int n ) const
wxFAIL_MSG( wxT("wxChoice: invalid index in GetString()") ); wxFAIL_MSG( wxT("wxChoice: invalid index in GetString()") );
return wxT(""); return wxEmptyString;
} }
int wxChoice::GetCount() const int wxChoice::GetCount() const
@@ -545,9 +545,9 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item)
// normal control, just append // normal control, just append
if (pos == (int)m_clientList.GetCount()) if (pos == (int)m_clientList.GetCount())
{ {
gtk_menu_append( GTK_MENU(menu), menu_item ); gtk_menu_append( GTK_MENU(menu), menu_item );
m_clientList.Append( (wxObject*) NULL ); m_clientList.Append( (wxObject*) NULL );
index = m_clientList.GetCount() - 1; index = m_clientList.GetCount() - 1;
} }
else else
{ {
@@ -570,7 +570,7 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item)
// changed, but at least after adding an item // changed, but at least after adding an item
// it has to change. Adapted from Matt Ownby. // it has to change. Adapted from Matt Ownby.
InvalidateBestSize(); InvalidateBestSize();
gtk_signal_connect_after( GTK_OBJECT( menu_item ), "activate", gtk_signal_connect_after( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
@@ -643,4 +643,3 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
#endif // wxUSE_CHOICE #endif // wxUSE_CHOICE

View File

@@ -110,7 +110,7 @@ void wxColourRefData::FreeColour()
colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1;
if (colMapAllocCounter[ idx ] == 0) 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__ #ifdef __WXGTK20__
if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) ||
(cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) )
#else #else
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
@@ -284,5 +284,3 @@ GdkColor *wxColour::GetColor() const
return &M_COLDATA->m_color; return &M_COLDATA->m_color;
} }

View File

@@ -349,9 +349,9 @@ int wxComboBox::DoAppend( const wxString &item )
const int count = GetCount(); const int count = GetCount();
if ( (int)m_clientDataList.GetCount() < count ) if ( (int)m_clientDataList.GetCount() < count )
m_clientDataList.Append( (wxObject*) NULL ); m_clientDataList.Append( (wxObject*) NULL );
if ( (int)m_clientObjectList.GetCount() < count ) if ( (int)m_clientObjectList.GetCount() < count )
m_clientObjectList.Append( (wxObject*) NULL ); m_clientObjectList.Append( (wxObject*) NULL );
EnableEvents(); EnableEvents();
@@ -396,9 +396,9 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
count = GetCount(); count = GetCount();
if ( (int)m_clientDataList.GetCount() < count ) if ( (int)m_clientDataList.GetCount() < count )
m_clientDataList.Insert( pos, (wxObject*) NULL ); m_clientDataList.Insert( pos, (wxObject*) NULL );
if ( (int)m_clientObjectList.GetCount() < count ) if ( (int)m_clientObjectList.GetCount() < count )
m_clientObjectList.Insert( pos, (wxObject*) NULL ); m_clientObjectList.Insert( pos, (wxObject*) NULL );
EnableEvents(); EnableEvents();
@@ -532,7 +532,7 @@ void wxComboBox::SetString(int n, const wxString &text)
int wxComboBox::FindString( const wxString &item ) const 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; GtkWidget *list = GTK_COMBO(m_widget)->list;
@@ -581,7 +581,7 @@ int wxComboBox::GetSelection() const
wxString wxComboBox::GetString( int n ) 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; GtkWidget *list = GTK_COMBO(m_widget)->list;
@@ -607,7 +607,7 @@ wxString wxComboBox::GetString( int n ) const
wxString wxComboBox::GetStringSelection() 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; GtkWidget *list = GTK_COMBO(m_widget)->list;
@@ -626,7 +626,7 @@ wxString wxComboBox::GetStringSelection() const
wxFAIL_MSG( wxT("wxComboBox: no selection") ); wxFAIL_MSG( wxT("wxComboBox: no selection") );
return wxT(""); return wxEmptyString;
} }
int wxComboBox::GetCount() const int wxComboBox::GetCount() const
@@ -677,7 +677,7 @@ void wxComboBox::SetValue( const wxString& value )
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = wxT(""); wxString tmp;
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) ); gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) );
@@ -1042,4 +1042,3 @@ void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
} }
#endif #endif

View File

@@ -1372,7 +1372,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
{ {
gdk_gc_set_clip_mask( m_textGC, mask ); gdk_gc_set_clip_mask( m_textGC, mask );
gdk_gc_set_clip_origin( m_textGC, cx-xsrcMask, cy-ysrcMask ); gdk_gc_set_clip_origin( m_textGC, cx-xsrcMask, cy-ysrcMask );
} }
} }
else else
{ {
@@ -1385,7 +1385,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
{ {
gdk_gc_set_clip_mask( m_penGC, mask ); gdk_gc_set_clip_mask( m_penGC, mask );
gdk_gc_set_clip_origin( m_penGC, cx-xsrcMask, cy-ysrcMask ); 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) && if ((m_scaleX != origScaleX || m_scaleY != origScaleY) &&
(m_pen.Ok())) (m_pen.Ok()))
{ {
/* this is a bit artificial, but we need to force wxDC to think /* this is a bit artificial, but we need to force wxDC to think
the pen has changed */ the pen has changed */
wxPen pen = m_pen; wxPen pen = m_pen;
m_pen = wxNullPen; m_pen = wxNullPen;
SetPen( pen ); SetPen( pen );
} }
} }
// Resolution in pixels per logical inch // Resolution in pixels per logical inch

View File

@@ -16,8 +16,8 @@
#include "wx/dnd.h" #include "wx/dnd.h"
#include "wx/log.h" #include "wx/log.h"
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
#include "wx/window.h" #include "wx/window.h"
@@ -188,7 +188,7 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
drop_target->OnLeave(); drop_target->OnLeave();
/* this has to be done because GDK has no "drag_enter" event */ /* 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 */ /* after this, invalidate the drop_target's GdkDragContext */
drop_target->SetDragContext( (GdkDragContext*) NULL ); drop_target->SetDragContext( (GdkDragContext*) NULL );
@@ -287,7 +287,7 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
drop_target->SetDragContext( (GdkDragContext*) NULL ); drop_target->SetDragContext( (GdkDragContext*) NULL );
/* this has to be done because GDK has no "drag_enter" event */ /* this has to be done because GDK has no "drag_enter" event */
drop_target->m_firstMotion = FALSE; drop_target->m_firstMotion = false;
return ret; return ret;
} }
@@ -338,7 +338,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
/* reset the block here as someone might very well /* reset the block here as someone might very well
show a dialog as a reaction to a drop and this show a dialog as a reaction to a drop and this
wouldn't work without events */ wouldn't work without events */
g_blockEventsOnDrag = FALSE; g_blockEventsOnDrag = false;
bool ret = drop_target->OnDrop( x, y ); bool ret = drop_target->OnDrop( x, y );
@@ -388,7 +388,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
drop_target->SetDragWidget( (GtkWidget*) NULL ); drop_target->SetDragWidget( (GtkWidget*) NULL );
/* this has to be done because GDK has no "drag_enter" event */ /* this has to be done because GDK has no "drag_enter" event */
drop_target->m_firstMotion = TRUE; drop_target->m_firstMotion = true;
return ret; return ret;
} }
@@ -457,7 +457,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
wxDropTarget::wxDropTarget( wxDataObject *data ) wxDropTarget::wxDropTarget( wxDataObject *data )
: wxDropTargetBase( data ) : wxDropTargetBase( data )
{ {
m_firstMotion = TRUE; m_firstMotion = true;
m_dragContext = (GdkDragContext*) NULL; m_dragContext = (GdkDragContext*) NULL;
m_dragWidget = (GtkWidget*) NULL; m_dragWidget = (GtkWidget*) NULL;
m_dragData = (GtkSelectionData*) NULL; m_dragData = (GtkSelectionData*) NULL;
@@ -482,7 +482,7 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
{ {
if (!m_dataObject) if (!m_dataObject)
return FALSE; return false;
return (GetMatchingPair() != (GdkAtom) 0); return (GetMatchingPair() != (GdkAtom) 0);
} }
@@ -530,19 +530,19 @@ GdkAtom wxDropTarget::GetMatchingPair()
bool wxDropTarget::GetData() bool wxDropTarget::GetData()
{ {
if (!m_dragData) if (!m_dragData)
return FALSE; return false;
if (!m_dataObject) if (!m_dataObject)
return FALSE; return false;
wxDataFormat dragFormat( m_dragData->target ); wxDataFormat dragFormat( m_dragData->target );
if (!m_dataObject->IsSupportedFormat( dragFormat )) if (!m_dataObject->IsSupportedFormat( dragFormat ))
return FALSE; return false;
m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data ); m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data );
return TRUE; return true;
} }
void wxDropTarget::UnregisterWidget( GtkWidget *widget ) void wxDropTarget::UnregisterWidget( GtkWidget *widget )
@@ -655,11 +655,11 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
/* disable GUI threads */ /* disable GUI threads */
#endif #endif
gtk_selection_data_set( selection_data, gtk_selection_data_set( selection_data,
selection_data->target, selection_data->target,
8, // 8-bit 8, // 8-bit
d, d,
size ); size );
#if wxUSE_THREADS #if wxUSE_THREADS
/* enable GUI threads */ /* enable GUI threads */
@@ -714,7 +714,7 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget),
// printf( "Drag source: drag_end.\n" ); // 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 &iconMove,
const wxIcon &iconNone) const wxIcon &iconNone)
{ {
m_waiting = TRUE; m_waiting = true;
m_iconWindow = (GtkWidget*) NULL; m_iconWindow = (GtkWidget*) NULL;
@@ -763,7 +763,7 @@ wxDropSource::wxDropSource(wxDataObject& data,
const wxIcon &iconMove, const wxIcon &iconMove,
const wxIcon &iconNone) const wxIcon &iconNone)
{ {
m_waiting = TRUE; m_waiting = true;
SetData( data ); SetData( data );
@@ -859,11 +859,11 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
return wxDragNone; return wxDragNone;
// disabled for now // disabled for now
g_blockEventsOnDrag = TRUE; g_blockEventsOnDrag = true;
RegisterWindow(); RegisterWindow();
m_waiting = TRUE; m_waiting = true;
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 ); GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
@@ -933,7 +933,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
/* re-enable GUI threads */ /* re-enable GUI threads */
#endif #endif
g_blockEventsOnDrag = FALSE; g_blockEventsOnDrag = false;
UnregisterWindow(); UnregisterWindow();

View File

@@ -622,12 +622,12 @@ void wxFrame::UpdateMenuBarSize()
// this is called after Remove with a NULL m_frameMenuBar // this is called after Remove with a NULL m_frameMenuBar
if ( m_frameMenuBar ) if ( m_frameMenuBar )
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
(m_frameMenuBar->m_widget, &req ); (m_frameMenuBar->m_widget, &req );
m_menuBarHeight = req.height; m_menuBarHeight = req.height;
// resize window in OnInternalIdle // resize window in OnInternalIdle
GtkUpdateSize(); GtkUpdateSize();
} }
@@ -714,4 +714,3 @@ void wxFrame::PositionStatusBar()
GtkUpdateSize(); GtkUpdateSize();
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR

View File

@@ -1510,7 +1510,7 @@ long wxTextCtrl::GetInsertionPoint() const
else else
#endif #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); gtk_widget_set_sensitive(m_widget, false);
g_object_ref(m_buffer); g_object_ref(m_buffer);
gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), gtk_text_buffer_new(NULL)); gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), gtk_text_buffer_new(NULL));
} }
#else #else
gtk_text_freeze(GTK_TEXT(m_text)); gtk_text_freeze(GTK_TEXT(m_text));
#endif #endif

View File

@@ -77,7 +77,7 @@ static wxTopLevelWindowGTK *g_lastActiveFrame = (wxTopLevelWindowGTK*) NULL;
// either TRUE or FALSE and an activate event will be sent during the next // 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 // OnIdle() call and it is reset to -1: this value means that we shouldn't
// send any activate events at all // send any activate events at all
static int g_sendActivateEvent = -1; static int g_sendActivateEvent = -1;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "focus_in_event" // "focus_in_event"
@@ -90,7 +90,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
switch ( g_sendActivateEvent ) switch ( g_sendActivateEvent )
{ {
case -1: case -1:
@@ -107,11 +107,11 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
g_activeFrame = win; g_activeFrame = win;
g_lastActiveFrame = g_activeFrame; g_lastActiveFrame = g_activeFrame;
// wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() ); // wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() );
wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); 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); event.SetEventObject(g_activeFrame);
g_activeFrame->GetEventHandler()->ProcessEvent(event); g_activeFrame->GetEventHandler()->ProcessEvent(event);
@@ -124,8 +124,8 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern "C" { extern "C" {
static gint gtk_frame_focus_out_callback( GtkWidget *widget, static gint gtk_frame_focus_out_callback( GtkWidget *widget,
GdkEventFocus *WXUNUSED(gdk_event), GdkEventFocus *WXUNUSED(gdk_event),
wxTopLevelWindowGTK *win ) wxTopLevelWindowGTK *win )
{ {
if (g_isIdle) 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 // wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset
// g_sendActivateEvent to -1 // g_sendActivateEvent to -1
g_sendActivateEvent = 0; g_sendActivateEvent = 0;
// wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") ); // wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") );
// wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() ); // wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() );
if (g_activeFrame) if (g_activeFrame)
{ {
wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), 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); event.SetEventObject(g_activeFrame);
g_activeFrame->GetEventHandler()->ProcessEvent(event); g_activeFrame->GetEventHandler()->ProcessEvent(event);
g_activeFrame = NULL; g_activeFrame = NULL;
} }
return FALSE; return FALSE;
} }
} }
@@ -299,7 +299,7 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget),
GdkEvent * WXUNUSED(event), GdkEvent * WXUNUSED(event),
wxTopLevelWindow *win ) wxTopLevelWindow *win )
{ {
win->SetIconizeState(FALSE); win->SetIconizeState(false);
} }
} }
@@ -410,16 +410,16 @@ static void wxInsertChildInTopLevelWindow( wxTopLevelWindowGTK* parent, wxWindow
void wxTopLevelWindowGTK::Init() void wxTopLevelWindowGTK::Init()
{ {
m_sizeSet = FALSE; m_sizeSet = false;
m_miniEdge = 0; m_miniEdge = 0;
m_miniTitle = 0; m_miniTitle = 0;
m_mainWidget = (GtkWidget*) NULL; m_mainWidget = (GtkWidget*) NULL;
m_insertInClientArea = TRUE; m_insertInClientArea = true;
m_isIconized = FALSE; m_isIconized = false;
m_fsIsShowing = FALSE; m_fsIsShowing = false;
m_themeEnabled = TRUE; m_themeEnabled = true;
m_gdkDecor = m_gdkFunc = 0; m_gdkDecor = m_gdkFunc = 0;
m_grabbed = FALSE; m_grabbed = false;
} }
bool wxTopLevelWindowGTK::Create( wxWindow *parent, bool wxTopLevelWindowGTK::Create( wxWindow *parent,
@@ -438,13 +438,13 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
wxTopLevelWindows.Append( this ); wxTopLevelWindows.Append( this );
m_needParent = FALSE; m_needParent = false;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{ {
wxFAIL_MSG( wxT("wxTopLevelWindowGTK creation failed") ); wxFAIL_MSG( wxT("wxTopLevelWindowGTK creation failed") );
return FALSE; return false;
} }
m_title = title; m_title = title;
@@ -479,10 +479,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
{ {
gtk_window_set_type_hint(GTK_WINDOW(m_widget), gtk_window_set_type_hint(GTK_WINDOW(m_widget),
GDK_WINDOW_TYPE_HINT_UTILITY); GDK_WINDOW_TYPE_HINT_UTILITY);
// On some WMs, like KDE, a TOOL_WINDOW will still show // On some WMs, like KDE, a TOOL_WINDOW will still show
// on the taskbar, but on Gnome a TOOL_WINDOW will not. // 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 // should set the NO_TASKBAR flag which will apply
// the set_skip_taskbar_hint if it is available, // the set_skip_taskbar_hint if it is available,
// ensuring no taskbar entry will appear. // ensuring no taskbar entry will appear.
@@ -495,8 +495,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
wxWindow *topParent = wxGetTopLevelParent(m_parent); wxWindow *topParent = wxGetTopLevelParent(m_parent);
if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) && if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) || (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
(style & wxFRAME_FLOAT_ON_PARENT))) (style & wxFRAME_FLOAT_ON_PARENT)))
{ {
gtk_window_set_transient_for( GTK_WINDOW(m_widget), gtk_window_set_transient_for( GTK_WINDOW(m_widget),
GTK_WINDOW(topParent->m_widget) ); GTK_WINDOW(topParent->m_widget) );
@@ -522,7 +522,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
} }
#endif #endif
if (!name.IsEmpty()) if (!name.empty())
gtk_window_set_wmclass( GTK_WINDOW(m_widget), wxGTK_CONV( name ), wxGTK_CONV( name ) ); 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 ) ); 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_FUNC(gtk_frame_focus_in_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event", gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event",
GTK_SIGNAL_FUNC(gtk_frame_focus_out_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_focus_out_callback), (gpointer)this );
// decorations // decorations
if ((m_miniEdge > 0) || (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER)) 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() wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
@@ -652,14 +652,14 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
RemoveGrab(); RemoveGrab();
} }
m_isBeingDeleted = TRUE; m_isBeingDeleted = true;
// it may also be GtkScrolledWindow in the case of an MDI child // it may also be GtkScrolledWindow in the case of an MDI child
if (GTK_IS_WINDOW(m_widget)) if (GTK_IS_WINDOW(m_widget))
{ {
gtk_window_set_focus( GTK_WINDOW(m_widget), NULL ); gtk_window_set_focus( GTK_WINDOW(m_widget), NULL );
} }
if (g_activeFrame == this) if (g_activeFrame == this)
g_activeFrame = NULL; g_activeFrame = NULL;
if (g_lastActiveFrame == this) if (g_lastActiveFrame == this)
@@ -671,10 +671,10 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
{ {
if (show == m_fsIsShowing) if (show == m_fsIsShowing)
return FALSE; // return what? return false; // return what?
m_fsIsShowing = show; m_fsIsShowing = show;
wxX11FullScreenMethod method = wxX11FullScreenMethod method =
wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(), wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
(WXWindow)GDK_ROOT_WINDOW()); (WXWindow)GDK_ROOT_WINDOW());
@@ -691,7 +691,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
else else
gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
return TRUE; return true;
} }
else else
#endif // GTK+ >= 2.2.0 #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 ); GtkOnSize( m_x, m_y, m_width, m_height );
} }
if (show) if (show)
gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_uposition( m_widget, m_x, m_y );
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
@@ -804,7 +804,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
// avoid recursions // avoid recursions
if (m_resizing) if (m_resizing)
return; return;
m_resizing = TRUE; m_resizing = true;
int old_x = m_x; int old_x = m_x;
int old_y = m_y; int old_y = m_y;
@@ -851,7 +851,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
maxWidth = -1; maxWidth = -1;
maxHeight = -1; maxHeight = -1;
#endif #endif
if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; 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 /* 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 done either directly before the frame is shown or in idle time
so that different calls to SetSize() don't lead to flicker. */ 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 void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const
@@ -914,7 +914,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
// avoid recursions // avoid recursions
if (m_resizing) return; if (m_resizing) return;
m_resizing = TRUE; m_resizing = true;
if ( m_wxwindow == NULL ) return; if ( m_wxwindow == NULL ) return;
@@ -942,7 +942,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
maxWidth = -1; maxWidth = -1;
maxHeight = -1; maxHeight = -1;
#endif #endif
if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; 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. // is no need to set the size or position of m_wxwindow.
} }
m_sizeSet = TRUE; m_sizeSet = true;
// send size event to frame // send size event to frame
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = false;
} }
void wxTopLevelWindowGTK::OnInternalIdle() void wxTopLevelWindowGTK::OnInternalIdle()
@@ -1047,15 +1047,15 @@ void wxTopLevelWindowGTK::OnInternalIdle()
} }
wxWindow::OnInternalIdle(); wxWindow::OnInternalIdle();
// Synthetize activate events. // Synthetize activate events.
if ( g_sendActivateEvent != -1 ) if ( g_sendActivateEvent != -1 )
{ {
bool activate = g_sendActivateEvent != 0; bool activate = g_sendActivateEvent != 0;
// if (!activate) wxPrintf( wxT("de") ); // if (!activate) wxPrintf( wxT("de") );
// wxPrintf( wxT("activate\n") ); // wxPrintf( wxT("activate\n") );
// do it only once // do it only once
g_sendActivateEvent = -1; g_sendActivateEvent = -1;
@@ -1099,7 +1099,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
} }
gtk_window_set_icon_list(GTK_WINDOW(m_widget), list); gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
g_list_free(list); g_list_free(list);
#else // !__WXGTK20__ #else // !__WXGTK20__
GdkWindow* window = m_widget->window; GdkWindow* window = m_widget->window;
if (!window) if (!window)
@@ -1147,7 +1147,7 @@ bool wxTopLevelWindowGTK::IsMaximized() const
// wxFAIL_MSG( _T("not implemented") ); // wxFAIL_MSG( _T("not implemented") );
// This is an approximation // This is an approximation
return FALSE; return false;
#endif #endif
} }
@@ -1201,7 +1201,7 @@ void wxTopLevelWindowGTK::AddGrab()
{ {
if (!m_grabbed) if (!m_grabbed)
{ {
m_grabbed = TRUE; m_grabbed = true;
gtk_grab_add( m_widget ); gtk_grab_add( m_widget );
wxEventLoop().Run(); wxEventLoop().Run();
gtk_grab_remove( m_widget ); gtk_grab_remove( m_widget );
@@ -1213,7 +1213,7 @@ void wxTopLevelWindowGTK::RemoveGrab()
if (m_grabbed) if (m_grabbed)
{ {
gtk_main_quit(); 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 else
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0);
#else #else
wxBitmap bmp = region.ConvertToBitmap(); wxBitmap bmp = region.ConvertToBitmap();
bmp.SetMask(new wxMask(bmp, *wxBLACK)); bmp.SetMask(new wxMask(bmp, *wxBLACK));
GdkBitmap* mask = bmp.GetMask()->GetBitmap(); GdkBitmap* mask = bmp.GetMask()->GetBitmap();
gdk_window_shape_combine_mask(window, mask, 0, 0); gdk_window_shape_combine_mask(window, mask, 0, 0);
#endif #endif
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) 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.")); _T("Shaped windows must be created with the wxFRAME_SHAPED style."));
GdkWindow *window = NULL; GdkWindow *window = NULL;
@@ -1263,4 +1263,3 @@ bool wxTopLevelWindowGTK::IsActive()
{ {
return (this == (wxTopLevelWindowGTK*)g_activeFrame); return (this == (wxTopLevelWindowGTK*)g_activeFrame);
} }

View File

@@ -229,7 +229,7 @@ static GdkGC *g_eraseGC = NULL;
// mouse capture state: the window which has it and if the mouse is currently // mouse capture state: the window which has it and if the mouse is currently
// inside it // inside it
static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL; static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL;
static bool g_captureWindowHasMouse = FALSE; static bool g_captureWindowHasMouse = false;
wxWindowGTK *g_focusWindow = (wxWindowGTK*) NULL; 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 // hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here // the last click here
static guint32 gs_timeLastClick = 0; static guint32 gs_timeLastClick = 0;
extern bool g_mainThreadLocked; 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 // This callback is actually hooked into the text entry
// of the combo box, not the GtkHBox. // of the combo box, not the GtkHBox.
int w, h; int w, h;
win->GetSize( &w, &h ); win->GetSize( &w, &h );
if (w < 2) if (w < 2)
@@ -499,13 +499,13 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget,
h = 2; h = 2;
GtkCombo *gcombo = GTK_COMBO(win->m_widget); GtkCombo *gcombo = GTK_COMBO(win->m_widget);
GtkRequisition entry_req; GtkRequisition entry_req;
entry_req.width = 2; entry_req.width = 2;
entry_req.height = 2; entry_req.height = 2;
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->button) )->size_request ) (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->button) )->size_request )
(gcombo->button, &entry_req ); (gcombo->button, &entry_req );
requisition->width = w - entry_req.width; requisition->width = w - entry_req.width;
requisition->height = entry_req.height; 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.width,
(int)gdk_event->area.height ); (int)gdk_event->area.height );
} }
gtk_paint_box gtk_paint_box
( (
win->m_wxwindow->style, win->m_wxwindow->style,
@@ -1048,7 +1048,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
: _T("press"), : _T("press"),
keysym); keysym);
long key_code = wxTranslateKeySymToWXKey(keysym, FALSE /* !isChar */); long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */);
if ( !key_code ) if ( !key_code )
{ {
@@ -1117,14 +1117,14 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
// sending unknown key events doesn't really make sense // sending unknown key events doesn't really make sense
if ( !key_code ) if ( !key_code )
return FALSE; return false;
// now fill all the other fields // now fill all the other fields
wxFillOtherKeyEventFields(event, win, gdk_event); wxFillOtherKeyEventFields(event, win, gdk_event);
event.m_keyCode = key_code; 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 // Emit KEY_DOWN event
ret = win->GetEventHandler()->ProcessEvent( event ); ret = win->GetEventHandler()->ProcessEvent( event );
} }
else else
{ {
// Return after IM processing as we cannot do // Return after IM processing as we cannot do
// anything with it anyhow. // 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): // 2005.01.26 modified by Hong Jen Yee (hzysoft@sina.com.tw):
// When we get a key_press event here, it could be originate // When we get a key_press event here, it could be originate
// from the current widget or its child widgets. However, only the widget // from the current widget or its child widgets. However, only the widget
// 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 // 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. // 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 // 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 // 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(). // by gtk_im_context_filter_keypress().
// Then, we should, according to GTK+ 2.0 API doc, return whatever it returns. // Then, we should, according to GTK+ 2.0 API doc, return whatever it returns.
if ((!ret) && (win->m_imData != NULL) && ( wxWindow::FindFocus() == win )) if ((!ret) && (win->m_imData != NULL) && ( wxWindow::FindFocus() == win ))
{ {
// We should let GTK+ IM filter key event first. According to GTK+ 2.0 API // 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. // 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); bool intercepted_by_IM = gtk_im_context_filter_keypress(win->m_imData->context, gdk_event);
win->m_imData->lastKeyEvent = NULL; win->m_imData->lastKeyEvent = NULL;
if (intercepted_by_IM) if (intercepted_by_IM)
@@ -1207,16 +1207,16 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
if (return_after_IM) if (return_after_IM)
return false; return false;
#ifndef __WXGTK20__ #ifndef __WXGTK20__
// This is for GTK+ 1.2 only. The char event generatation for GTK+ 2.0 is done // This is for GTK+ 1.2 only. The char event generatation for GTK+ 2.0 is done
// in the "commit" handler. // in the "commit" handler.
// 2005.02.02 modified by Hong Jen Yee (hzysoft@sina.com.tw). // 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 // 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 // keyCodes cannot be recognized by wxWidgets. These MBCS strings, however, are
// composed of more than one character, which means gdk_event->length will always // 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 // 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, // 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 // nor should we pass it to controls. The following explanation was excerpted
// from GDK documentation. // from GDK documentation.
@@ -1265,7 +1265,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
} }
return true; return true;
} }
#endif // #ifndef __WXGTK20__ #endif // #ifndef __WXGTK20__
#if wxUSE_ACCEL #if wxUSE_ACCEL
@@ -1295,7 +1295,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
long key_code; long key_code;
KeySym keysym = gdk_event->keyval; KeySym keysym = gdk_event->keyval;
// Find key code for EVT_CHAR and EVT_CHAR_HOOK events // 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 ( !key_code )
{ {
if ( wxIsAsciiKeysym(keysym) ) if ( wxIsAsciiKeysym(keysym) )
@@ -2007,7 +2007,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget,
event_type = wxEVT_MOUSEWHEEL; event_type = wxEVT_MOUSEWHEEL;
else else
return FALSE; return FALSE;
wxMouseEvent event( event_type ); wxMouseEvent event( event_type );
// Can't use InitMouse macro because scroll events don't have button // Can't use InitMouse macro because scroll events don't have button
event.SetTimestamp( gdk_event->time ); event.SetTimestamp( gdk_event->time );
@@ -2032,7 +2032,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget,
event.SetEventObject( win ); event.SetEventObject( win );
event.SetId( win->GetId() ); event.SetId( win->GetId() );
event.SetTimestamp( gdk_event->time ); event.SetTimestamp( gdk_event->time );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "scroll_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 ) wxWindow *win )
{ {
DEBUG_MAIN_THREAD DEBUG_MAIN_THREAD
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
@@ -2117,8 +2117,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
if ( !win->m_hasFocus ) if ( !win->m_hasFocus )
{ {
// not yet, notify it // not yet, notify it
win->m_hasFocus = TRUE; win->m_hasFocus = true;
if ( DoSendFocusEvents(win) ) if ( DoSendFocusEvents(win) )
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" ); 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 // have focus already
if ( win->m_hasFocus ) if ( win->m_hasFocus )
{ {
win->m_hasFocus = FALSE; win->m_hasFocus = false;
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
@@ -2374,7 +2374,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
wxapp_install_idle_handler(); wxapp_install_idle_handler();
g_blockEventsOnScroll = TRUE; g_blockEventsOnScroll = true;
// FIXME: there is no 'slider' field in GTK+ 2.0 any more // FIXME: there is no 'slider' field in GTK+ 2.0 any more
#ifndef __WXGTK20__ #ifndef __WXGTK20__
@@ -2401,7 +2401,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
// //
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
g_blockEventsOnScroll = FALSE; g_blockEventsOnScroll = false;
if (win->m_isScrolling) if (win->m_isScrolling)
{ {
@@ -2426,7 +2426,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
win->GetEventHandler()->ProcessEvent( event ); win->GetEventHandler()->ProcessEvent( event );
} }
win->m_isScrolling = FALSE; win->m_isScrolling = false;
return FALSE; return FALSE;
} }
@@ -2458,7 +2458,7 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (win->m_imData) if (win->m_imData)
{ {
@@ -2700,16 +2700,16 @@ void wxWindowGTK::Init()
m_width = 0; m_width = 0;
m_height = 0; m_height = 0;
m_sizeSet = FALSE; m_sizeSet = false;
m_hasVMT = FALSE; m_hasVMT = false;
m_needParent = TRUE; m_needParent = true;
m_isBeingDeleted = FALSE; m_isBeingDeleted = false;
m_noExpose = FALSE; m_noExpose = false;
m_nativeSizeEvent = FALSE; m_nativeSizeEvent = false;
m_hasScrolling = FALSE; m_hasScrolling = false;
m_isScrolling = FALSE; m_isScrolling = false;
m_hAdjust = (GtkAdjustment*) NULL; m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL; m_vAdjust = (GtkAdjustment*) NULL;
@@ -2718,14 +2718,14 @@ void wxWindowGTK::Init()
m_oldClientWidth = m_oldClientWidth =
m_oldClientHeight = 0; m_oldClientHeight = 0;
m_resizing = FALSE; m_resizing = false;
m_insertCallback = (wxInsertChildFunction) NULL; m_insertCallback = (wxInsertChildFunction) NULL;
m_acceptsFocus = FALSE; m_acceptsFocus = false;
m_hasFocus = FALSE; m_hasFocus = false;
m_clipPaintRegion = FALSE; m_clipPaintRegion = false;
m_needsStyleChange = false; m_needsStyleChange = false;
@@ -2771,7 +2771,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{ {
wxFAIL_MSG( wxT("wxWindowGTK creation failed") ); wxFAIL_MSG( wxT("wxWindowGTK creation failed") );
return FALSE; return false;
} }
m_insertCallback = wxInsertChildInWindow; m_insertCallback = wxInsertChildInWindow;
@@ -2815,7 +2815,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
m_acceptsFocus = TRUE; m_acceptsFocus = true;
// I _really_ don't want scrollbars in the beginning // I _really_ don't want scrollbars in the beginning
m_vAdjust->lower = 0.0; m_vAdjust->lower = 0.0;
@@ -2867,7 +2867,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
PostCreation(); PostCreation();
return TRUE; return true;
} }
wxWindowGTK::~wxWindowGTK() wxWindowGTK::~wxWindowGTK()
@@ -2880,11 +2880,11 @@ wxWindowGTK::~wxWindowGTK()
if ( g_delayedFocus == this ) if ( g_delayedFocus == this )
g_delayedFocus = NULL; g_delayedFocus = NULL;
m_isBeingDeleted = TRUE; m_isBeingDeleted = true;
m_hasVMT = FALSE; m_hasVMT = false;
if (m_widget) if (m_widget)
Show( FALSE ); Show( false );
DestroyChildren(); DestroyChildren();
@@ -2914,7 +2914,7 @@ wxWindowGTK::~wxWindowGTK()
bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ) 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. // Use either the given size, or the default if -1 is given.
// See wxWindowBase for these functions. // 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_x = (int)pos.x;
m_y = (int)pos.y; m_y = (int)pos.y;
return TRUE; return true;
} }
void wxWindowGTK::PostCreation() void wxWindowGTK::PostCreation()
@@ -2983,7 +2983,7 @@ void wxWindowGTK::PostCreation()
{ {
if (m_focusWidget == NULL) if (m_focusWidget == NULL)
m_focusWidget = m_widget; m_focusWidget = m_widget;
gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_in_event", gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
@@ -3020,7 +3020,7 @@ void wxWindowGTK::PostCreation()
if (GTK_IS_COMBO(m_widget)) if (GTK_IS_COMBO(m_widget))
{ {
GtkCombo *gcombo = GTK_COMBO(m_widget); GtkCombo *gcombo = GTK_COMBO(m_widget);
gtk_signal_connect( GTK_OBJECT(gcombo->entry), "size_request", gtk_signal_connect( GTK_OBJECT(gcombo->entry), "size_request",
GTK_SIGNAL_FUNC(wxgtk_combo_size_request_callback), GTK_SIGNAL_FUNC(wxgtk_combo_size_request_callback),
(gpointer) this ); (gpointer) this );
@@ -3038,7 +3038,7 @@ void wxWindowGTK::PostCreation()
InheritAttributes(); InheritAttributes();
m_hasVMT = TRUE; m_hasVMT = true;
// unless the window was created initially hidden (i.e. Hide() had been // unless the window was created initially hidden (i.e. Hide() had been
// called before Create()), we should show it at GTK+ level as well // 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") ); wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
m_hasVMT = FALSE; m_hasVMT = false;
return wxWindowBase::Destroy(); 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 */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = true;
int currentX, currentY; int currentX, currentY;
GetPosition(&currentX, &currentY); GetPosition(&currentX, &currentY);
@@ -3217,7 +3217,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
} }
m_resizing = FALSE; m_resizing = false;
} }
void wxWindowGTK::OnInternalIdle() void wxWindowGTK::OnInternalIdle()
@@ -3495,12 +3495,12 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const
bool wxWindowGTK::Show( bool show ) 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)) if (!wxWindowBase::Show(show))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
if (show) if (show)
@@ -3513,7 +3513,7 @@ bool wxWindowGTK::Show( bool show )
GetEventHandler()->ProcessEvent(eventShow); GetEventHandler()->ProcessEvent(eventShow);
return TRUE; return true;
} }
static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
@@ -3535,12 +3535,12 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
bool wxWindowGTK::Enable( 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)) if (!wxWindowBase::Enable(enable))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
gtk_widget_set_sensitive( m_widget, enable ); gtk_widget_set_sensitive( m_widget, enable );
@@ -3549,7 +3549,7 @@ bool wxWindowGTK::Enable( bool enable )
wxWindowNotifyEnable(this, enable); wxWindowNotifyEnable(this, enable);
return TRUE; return true;
} }
int wxWindowGTK::GetCharHeight() const int wxWindowGTK::GetCharHeight() const
@@ -3621,17 +3621,17 @@ int wxWindowGTK::GetCharWidth() const
} }
void wxWindowGTK::GetTextExtent( const wxString& string, void wxWindowGTK::GetTextExtent( const wxString& string,
int *x, int *x,
int *y, int *y,
int *descent, int *descent,
int *externalLeading, int *externalLeading,
const wxFont *theFont ) const const wxFont *theFont ) const
{ {
wxFont fontToUse = theFont ? *theFont : GetFont(); wxFont fontToUse = theFont ? *theFont : GetFont();
wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") );
if (string.IsEmpty()) if (string.empty())
{ {
if (x) (*x) = 0; if (x) (*x) = 0;
if (y) (*y) = 0; if (y) (*y) = 0;
@@ -3715,7 +3715,7 @@ void wxWindowGTK::SetFocus()
#endif #endif
if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) ) if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) )
{ {
if (!GTK_WIDGET_REALIZED(m_widget)) if (!GTK_WIDGET_REALIZED(m_widget))
{ {
// we can't set the focus to the widget now so we remember that // 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); gtk_widget_grab_focus (m_widget);
} }
} }
else else
#ifndef __WXGTK20__ #ifndef __WXGTK20__
if (GTK_IS_CONTAINER(m_widget)) if (GTK_IS_CONTAINER(m_widget))
{ {
@@ -3759,7 +3759,7 @@ bool wxWindowGTK::AcceptsFocus() const
bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) 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, wxWindowGTK *oldParent = m_parent,
*newParent = (wxWindowGTK *)newParentBase; *newParent = (wxWindowGTK *)newParentBase;
@@ -3767,7 +3767,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
wxASSERT( GTK_IS_WIDGET(m_widget) ); wxASSERT( GTK_IS_WIDGET(m_widget) );
if ( !wxWindowBase::Reparent(newParent) ) if ( !wxWindowBase::Reparent(newParent) )
return FALSE; return false;
wxASSERT( GTK_IS_WIDGET(m_widget) ); wxASSERT( GTK_IS_WIDGET(m_widget) );
@@ -3790,7 +3790,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
/* reverse: prevent GTK from deleting the widget arbitrarily */ /* reverse: prevent GTK from deleting the widget arbitrarily */
gtk_widget_unref( m_widget ); gtk_widget_unref( m_widget );
return TRUE; return true;
} }
void wxWindowGTK::DoAddChild(wxWindowGTK *child) void wxWindowGTK::DoAddChild(wxWindowGTK *child)
@@ -3825,7 +3825,7 @@ void wxWindowGTK::RemoveChild(wxWindowBase *child)
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
} }
void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move) void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
{ {
wxWindowBase::DoMoveInTabOrder(win, move); wxWindowBase::DoMoveInTabOrder(win, move);
@@ -3841,15 +3841,15 @@ void wxWindowGTK::RealizeTabOrder()
if (m_children.size() > 0) if (m_children.size() > 0)
{ {
GList *chain = NULL; GList *chain = NULL;
for (wxWindowList::const_iterator i = m_children.begin(); for (wxWindowList::const_iterator i = m_children.begin();
i != m_children.end(); ++i) i != m_children.end(); ++i)
{ {
chain = g_list_prepend(chain, (*i)->m_widget); chain = g_list_prepend(chain, (*i)->m_widget);
} }
chain = g_list_reverse(chain); chain = g_list_reverse(chain);
gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain); gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain);
g_list_free(chain); g_list_free(chain);
} }
@@ -3858,7 +3858,7 @@ void wxWindowGTK::RealizeTabOrder()
gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow)); gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow));
} }
} }
m_dirtyTabOrder = false; m_dirtyTabOrder = false;
} }
@@ -3872,7 +3872,7 @@ void wxWindowGTK::Raise()
{ {
gdk_window_raise( m_wxwindow->window ); gdk_window_raise( m_wxwindow->window );
} }
else if (m_widget->window) else if (m_widget->window)
{ {
gdk_window_raise( m_widget->window ); gdk_window_raise( m_widget->window );
} }
@@ -3886,7 +3886,7 @@ void wxWindowGTK::Lower()
{ {
gdk_window_lower( m_wxwindow->window ); gdk_window_lower( m_wxwindow->window );
} }
else if (m_widget->window) else if (m_widget->window)
{ {
gdk_window_lower( m_widget->window ); gdk_window_lower( m_widget->window );
} }
@@ -3894,10 +3894,10 @@ void wxWindowGTK::Lower()
bool wxWindowGTK::SetCursor( const wxCursor &cursor ) 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) if (cursor == m_cursor)
return FALSE; return false;
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
@@ -4060,7 +4060,7 @@ void wxWindowGTK::GtkSendPaintEvents()
} }
// Clip to paint region in wxClientDC // Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE; m_clipPaintRegion = true;
// widget to draw on // widget to draw on
GtkPizza *pizza = GTK_PIZZA (m_wxwindow); GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
@@ -4149,7 +4149,7 @@ void wxWindowGTK::GtkSendPaintEvents()
paint_event.SetEventObject( this ); paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( paint_event ); GetEventHandler()->ProcessEvent( paint_event );
m_clipPaintRegion = FALSE; m_clipPaintRegion = false;
#ifndef __WXUNIVERSAL__ #ifndef __WXUNIVERSAL__
#ifndef __WXGTK20__ #ifndef __WXGTK20__
@@ -4233,7 +4233,7 @@ void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) 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)) if (!wxWindowBase::SetBackgroundColour(colour))
return false; return false;
@@ -4254,13 +4254,13 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
bool wxWindowGTK::SetForegroundColour( 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)) if (!wxWindowBase::SetForegroundColour(colour))
{ {
return false; return false;
} }
if (colour.Ok()) if (colour.Ok())
{ {
// We need the pixel value e.g. for background clearing. // We need the pixel value e.g. for background clearing.
@@ -4288,7 +4288,7 @@ PangoContext *wxWindowGTK::GtkGetPangoX11Context()
return m_x11Context; return m_x11Context;
} }
#endif #endif
GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
{ {
// do we need to apply any changes at all? // do we need to apply any changes at all?
@@ -4304,7 +4304,7 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
if ( m_font.Ok() ) if ( m_font.Ok() )
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
style->font_desc = style->font_desc =
pango_font_description_copy( m_font.GetNativeFontInfo()->description ); pango_font_description_copy( m_font.GetNativeFontInfo()->description );
#else #else
wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName(); wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName();
@@ -4315,13 +4315,13 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
if ( m_foregroundColour.Ok() ) if ( m_foregroundColour.Ok() )
{ {
GdkColor *fg = m_foregroundColour.GetColor(); GdkColor *fg = m_foregroundColour.GetColor();
style->fg[GTK_STATE_NORMAL] = *fg; style->fg[GTK_STATE_NORMAL] = *fg;
style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG; style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG;
style->fg[GTK_STATE_PRELIGHT] = *fg; style->fg[GTK_STATE_PRELIGHT] = *fg;
style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_FG; style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_FG;
style->fg[GTK_STATE_ACTIVE] = *fg; style->fg[GTK_STATE_ACTIVE] = *fg;
style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_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->base[GTK_STATE_NORMAL] = *bg;
style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags) style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags)
(style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG | GTK_RC_BASE);
style->bg[GTK_STATE_PRELIGHT] = *bg; style->bg[GTK_STATE_PRELIGHT] = *bg;
style->base[GTK_STATE_PRELIGHT] = *bg; style->base[GTK_STATE_PRELIGHT] = *bg;
style->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) style->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags)
(style->color_flags[GTK_STATE_PRELIGHT] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_PRELIGHT] | GTK_RC_BG | GTK_RC_BASE);
style->bg[GTK_STATE_ACTIVE] = *bg; style->bg[GTK_STATE_ACTIVE] = *bg;
style->base[GTK_STATE_ACTIVE] = *bg; style->base[GTK_STATE_ACTIVE] = *bg;
style->color_flags[GTK_STATE_ACTIVE] = (GtkRcFlags) style->color_flags[GTK_STATE_ACTIVE] = (GtkRcFlags)
(style->color_flags[GTK_STATE_ACTIVE] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_ACTIVE] | GTK_RC_BG | GTK_RC_BASE);
style->bg[GTK_STATE_INSENSITIVE] = *bg; style->bg[GTK_STATE_INSENSITIVE] = *bg;
style->base[GTK_STATE_INSENSITIVE] = *bg; style->base[GTK_STATE_INSENSITIVE] = *bg;
style->color_flags[GTK_STATE_INSENSITIVE] = (GtkRcFlags) style->color_flags[GTK_STATE_INSENSITIVE] = (GtkRcFlags)
(style->color_flags[GTK_STATE_INSENSITIVE] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_INSENSITIVE] | GTK_RC_BG | GTK_RC_BASE);
} }
return style; return style;
} }
@@ -4378,7 +4378,7 @@ void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style)
bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
{ {
wxWindowBase::SetBackgroundStyle(style); wxWindowBase::SetBackgroundStyle(style);
if (style == wxBG_STYLE_CUSTOM) if (style == wxBG_STYLE_CUSTOM)
{ {
GdkWindow *window = (GdkWindow*) NULL; GdkWindow *window = (GdkWindow*) NULL;
@@ -4401,7 +4401,7 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
else else
// Do in OnIdle, because the window is not yet available // Do in OnIdle, because the window is not yet available
m_needsStyleChange = true; m_needsStyleChange = true;
// Don't apply widget style, or we get a grey background // Don't apply widget style, or we get a grey background
} }
else else
@@ -4428,7 +4428,7 @@ void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
void SetInvokingWindow( wxMenu *menu, wxWindow* win ) void SetInvokingWindow( wxMenu *menu, wxWindow* win )
{ {
menu->SetInvokingWindow( win ); menu->SetInvokingWindow( win );
wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
@@ -4562,14 +4562,14 @@ bool wxWindowGTK::IsOwnGtkWindow( GdkWindow *window )
bool wxWindowGTK::SetFont( const wxFont &font ) 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)) if (!wxWindowBase::SetFont(font))
return false; return false;
// apply style change (forceStyle=true so that new style is applied // apply style change (forceStyle=true so that new style is applied
// even if the font changed from valid to wxNullFont): // even if the font changed from valid to wxNullFont):
ApplyWidgetStyle(true); ApplyWidgetStyle(true);
return true; return true;
} }
@@ -4600,7 +4600,7 @@ void wxWindowGTK::DoCaptureMouse()
cursor->GetCursor(), cursor->GetCursor(),
(guint32)GDK_CURRENT_TIME ); (guint32)GDK_CURRENT_TIME );
g_captureWindow = this; g_captureWindow = this;
g_captureWindowHasMouse = TRUE; g_captureWindowHasMouse = true;
} }
void wxWindowGTK::DoReleaseMouse() void wxWindowGTK::DoReleaseMouse()
@@ -4631,7 +4631,7 @@ wxWindow *wxWindowBase::GetCapture()
bool wxWindowGTK::IsRetained() const bool wxWindowGTK::IsRetained() const
{ {
return FALSE; return false;
} }
void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, 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") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
m_hasScrolling = TRUE; m_hasScrolling = true;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
@@ -4817,11 +4817,11 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
} }
#endif #endif
m_clipPaintRegion = TRUE; m_clipPaintRegion = true;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = FALSE; m_clipPaintRegion = false;
} }
@@ -4885,7 +4885,7 @@ bool wxWinModule::OnInit()
// g_eraseGC = gdk_gc_new( GDK_ROOT_PARENT() ); // g_eraseGC = gdk_gc_new( GDK_ROOT_PARENT() );
// gdk_gc_set_fill( g_eraseGC, GDK_SOLID ); // gdk_gc_set_fill( g_eraseGC, GDK_SOLID );
return TRUE; return true;
} }
void wxWinModule::OnExit() void wxWinModule::OnExit()

View File

@@ -115,16 +115,16 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxValidator& validator, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = true;
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
m_acceptsFocus = TRUE; m_acceptsFocus = true;
#endif #endif
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxChoice creation failed") ); wxFAIL_MSG( wxT("wxChoice creation failed") );
return FALSE; return false;
} }
m_widget = gtk_option_menu_new(); m_widget = gtk_option_menu_new();
@@ -153,7 +153,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
PostCreation(size); PostCreation(size);
SetBestSize(size); // need this too because this is a wxControlWithItems SetBestSize(size); // need this too because this is a wxControlWithItems
return TRUE; return true;
} }
wxChoice::~wxChoice() wxChoice::~wxChoice()
@@ -247,7 +247,7 @@ void wxChoice::Clear()
{ {
// destroy the data (due to Robert's idea of using wxList<wxObject> // destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say // and not wxList<wxClientData> 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(); wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node ) while ( node )
{ {
@@ -372,7 +372,7 @@ int wxChoice::FindString( const wxString &string ) const
count++; count++;
} }
return -1; return wxNOT_FOUND;
} }
int wxChoice::GetSelection() const int wxChoice::GetSelection() const
@@ -403,8 +403,8 @@ void wxChoice::SetString( int n, const wxString& str )
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); 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; return;
} }
child = child->next; child = child->next;
@@ -414,7 +414,7 @@ void wxChoice::SetString( int n, const wxString& str )
wxString wxChoice::GetString( int n ) const 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) ) ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0; int count = 0;
@@ -444,7 +444,7 @@ wxString wxChoice::GetString( int n ) const
wxFAIL_MSG( wxT("wxChoice: invalid index in GetString()") ); wxFAIL_MSG( wxT("wxChoice: invalid index in GetString()") );
return wxT(""); return wxEmptyString;
} }
int wxChoice::GetCount() const int wxChoice::GetCount() const
@@ -545,9 +545,9 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item)
// normal control, just append // normal control, just append
if (pos == (int)m_clientList.GetCount()) if (pos == (int)m_clientList.GetCount())
{ {
gtk_menu_append( GTK_MENU(menu), menu_item ); gtk_menu_append( GTK_MENU(menu), menu_item );
m_clientList.Append( (wxObject*) NULL ); m_clientList.Append( (wxObject*) NULL );
index = m_clientList.GetCount() - 1; index = m_clientList.GetCount() - 1;
} }
else else
{ {
@@ -570,7 +570,7 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item)
// changed, but at least after adding an item // changed, but at least after adding an item
// it has to change. Adapted from Matt Ownby. // it has to change. Adapted from Matt Ownby.
InvalidateBestSize(); InvalidateBestSize();
gtk_signal_connect_after( GTK_OBJECT( menu_item ), "activate", gtk_signal_connect_after( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
@@ -643,4 +643,3 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
#endif // wxUSE_CHOICE #endif // wxUSE_CHOICE

View File

@@ -110,7 +110,7 @@ void wxColourRefData::FreeColour()
colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1;
if (colMapAllocCounter[ idx ] == 0) 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__ #ifdef __WXGTK20__
if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) ||
(cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) )
#else #else
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
@@ -284,5 +284,3 @@ GdkColor *wxColour::GetColor() const
return &M_COLDATA->m_color; return &M_COLDATA->m_color;
} }

View File

@@ -349,9 +349,9 @@ int wxComboBox::DoAppend( const wxString &item )
const int count = GetCount(); const int count = GetCount();
if ( (int)m_clientDataList.GetCount() < count ) if ( (int)m_clientDataList.GetCount() < count )
m_clientDataList.Append( (wxObject*) NULL ); m_clientDataList.Append( (wxObject*) NULL );
if ( (int)m_clientObjectList.GetCount() < count ) if ( (int)m_clientObjectList.GetCount() < count )
m_clientObjectList.Append( (wxObject*) NULL ); m_clientObjectList.Append( (wxObject*) NULL );
EnableEvents(); EnableEvents();
@@ -396,9 +396,9 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
count = GetCount(); count = GetCount();
if ( (int)m_clientDataList.GetCount() < count ) if ( (int)m_clientDataList.GetCount() < count )
m_clientDataList.Insert( pos, (wxObject*) NULL ); m_clientDataList.Insert( pos, (wxObject*) NULL );
if ( (int)m_clientObjectList.GetCount() < count ) if ( (int)m_clientObjectList.GetCount() < count )
m_clientObjectList.Insert( pos, (wxObject*) NULL ); m_clientObjectList.Insert( pos, (wxObject*) NULL );
EnableEvents(); EnableEvents();
@@ -532,7 +532,7 @@ void wxComboBox::SetString(int n, const wxString &text)
int wxComboBox::FindString( const wxString &item ) const 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; GtkWidget *list = GTK_COMBO(m_widget)->list;
@@ -581,7 +581,7 @@ int wxComboBox::GetSelection() const
wxString wxComboBox::GetString( int n ) 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; GtkWidget *list = GTK_COMBO(m_widget)->list;
@@ -607,7 +607,7 @@ wxString wxComboBox::GetString( int n ) const
wxString wxComboBox::GetStringSelection() 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; GtkWidget *list = GTK_COMBO(m_widget)->list;
@@ -626,7 +626,7 @@ wxString wxComboBox::GetStringSelection() const
wxFAIL_MSG( wxT("wxComboBox: no selection") ); wxFAIL_MSG( wxT("wxComboBox: no selection") );
return wxT(""); return wxEmptyString;
} }
int wxComboBox::GetCount() const int wxComboBox::GetCount() const
@@ -677,7 +677,7 @@ void wxComboBox::SetValue( const wxString& value )
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = wxT(""); wxString tmp;
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) ); gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) );
@@ -1042,4 +1042,3 @@ void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
} }
#endif #endif

View File

@@ -1372,7 +1372,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
{ {
gdk_gc_set_clip_mask( m_textGC, mask ); gdk_gc_set_clip_mask( m_textGC, mask );
gdk_gc_set_clip_origin( m_textGC, cx-xsrcMask, cy-ysrcMask ); gdk_gc_set_clip_origin( m_textGC, cx-xsrcMask, cy-ysrcMask );
} }
} }
else else
{ {
@@ -1385,7 +1385,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
{ {
gdk_gc_set_clip_mask( m_penGC, mask ); gdk_gc_set_clip_mask( m_penGC, mask );
gdk_gc_set_clip_origin( m_penGC, cx-xsrcMask, cy-ysrcMask ); 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) && if ((m_scaleX != origScaleX || m_scaleY != origScaleY) &&
(m_pen.Ok())) (m_pen.Ok()))
{ {
/* this is a bit artificial, but we need to force wxDC to think /* this is a bit artificial, but we need to force wxDC to think
the pen has changed */ the pen has changed */
wxPen pen = m_pen; wxPen pen = m_pen;
m_pen = wxNullPen; m_pen = wxNullPen;
SetPen( pen ); SetPen( pen );
} }
} }
// Resolution in pixels per logical inch // Resolution in pixels per logical inch

View File

@@ -16,8 +16,8 @@
#include "wx/dnd.h" #include "wx/dnd.h"
#include "wx/log.h" #include "wx/log.h"
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
#include "wx/window.h" #include "wx/window.h"
@@ -188,7 +188,7 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
drop_target->OnLeave(); drop_target->OnLeave();
/* this has to be done because GDK has no "drag_enter" event */ /* 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 */ /* after this, invalidate the drop_target's GdkDragContext */
drop_target->SetDragContext( (GdkDragContext*) NULL ); drop_target->SetDragContext( (GdkDragContext*) NULL );
@@ -287,7 +287,7 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
drop_target->SetDragContext( (GdkDragContext*) NULL ); drop_target->SetDragContext( (GdkDragContext*) NULL );
/* this has to be done because GDK has no "drag_enter" event */ /* this has to be done because GDK has no "drag_enter" event */
drop_target->m_firstMotion = FALSE; drop_target->m_firstMotion = false;
return ret; return ret;
} }
@@ -338,7 +338,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
/* reset the block here as someone might very well /* reset the block here as someone might very well
show a dialog as a reaction to a drop and this show a dialog as a reaction to a drop and this
wouldn't work without events */ wouldn't work without events */
g_blockEventsOnDrag = FALSE; g_blockEventsOnDrag = false;
bool ret = drop_target->OnDrop( x, y ); bool ret = drop_target->OnDrop( x, y );
@@ -388,7 +388,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
drop_target->SetDragWidget( (GtkWidget*) NULL ); drop_target->SetDragWidget( (GtkWidget*) NULL );
/* this has to be done because GDK has no "drag_enter" event */ /* this has to be done because GDK has no "drag_enter" event */
drop_target->m_firstMotion = TRUE; drop_target->m_firstMotion = true;
return ret; return ret;
} }
@@ -457,7 +457,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
wxDropTarget::wxDropTarget( wxDataObject *data ) wxDropTarget::wxDropTarget( wxDataObject *data )
: wxDropTargetBase( data ) : wxDropTargetBase( data )
{ {
m_firstMotion = TRUE; m_firstMotion = true;
m_dragContext = (GdkDragContext*) NULL; m_dragContext = (GdkDragContext*) NULL;
m_dragWidget = (GtkWidget*) NULL; m_dragWidget = (GtkWidget*) NULL;
m_dragData = (GtkSelectionData*) NULL; m_dragData = (GtkSelectionData*) NULL;
@@ -482,7 +482,7 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
{ {
if (!m_dataObject) if (!m_dataObject)
return FALSE; return false;
return (GetMatchingPair() != (GdkAtom) 0); return (GetMatchingPair() != (GdkAtom) 0);
} }
@@ -530,19 +530,19 @@ GdkAtom wxDropTarget::GetMatchingPair()
bool wxDropTarget::GetData() bool wxDropTarget::GetData()
{ {
if (!m_dragData) if (!m_dragData)
return FALSE; return false;
if (!m_dataObject) if (!m_dataObject)
return FALSE; return false;
wxDataFormat dragFormat( m_dragData->target ); wxDataFormat dragFormat( m_dragData->target );
if (!m_dataObject->IsSupportedFormat( dragFormat )) if (!m_dataObject->IsSupportedFormat( dragFormat ))
return FALSE; return false;
m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data ); m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data );
return TRUE; return true;
} }
void wxDropTarget::UnregisterWidget( GtkWidget *widget ) void wxDropTarget::UnregisterWidget( GtkWidget *widget )
@@ -655,11 +655,11 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
/* disable GUI threads */ /* disable GUI threads */
#endif #endif
gtk_selection_data_set( selection_data, gtk_selection_data_set( selection_data,
selection_data->target, selection_data->target,
8, // 8-bit 8, // 8-bit
d, d,
size ); size );
#if wxUSE_THREADS #if wxUSE_THREADS
/* enable GUI threads */ /* enable GUI threads */
@@ -714,7 +714,7 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget),
// printf( "Drag source: drag_end.\n" ); // 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 &iconMove,
const wxIcon &iconNone) const wxIcon &iconNone)
{ {
m_waiting = TRUE; m_waiting = true;
m_iconWindow = (GtkWidget*) NULL; m_iconWindow = (GtkWidget*) NULL;
@@ -763,7 +763,7 @@ wxDropSource::wxDropSource(wxDataObject& data,
const wxIcon &iconMove, const wxIcon &iconMove,
const wxIcon &iconNone) const wxIcon &iconNone)
{ {
m_waiting = TRUE; m_waiting = true;
SetData( data ); SetData( data );
@@ -859,11 +859,11 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
return wxDragNone; return wxDragNone;
// disabled for now // disabled for now
g_blockEventsOnDrag = TRUE; g_blockEventsOnDrag = true;
RegisterWindow(); RegisterWindow();
m_waiting = TRUE; m_waiting = true;
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 ); GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
@@ -933,7 +933,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
/* re-enable GUI threads */ /* re-enable GUI threads */
#endif #endif
g_blockEventsOnDrag = FALSE; g_blockEventsOnDrag = false;
UnregisterWindow(); UnregisterWindow();

View File

@@ -622,12 +622,12 @@ void wxFrame::UpdateMenuBarSize()
// this is called after Remove with a NULL m_frameMenuBar // this is called after Remove with a NULL m_frameMenuBar
if ( m_frameMenuBar ) if ( m_frameMenuBar )
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
(m_frameMenuBar->m_widget, &req ); (m_frameMenuBar->m_widget, &req );
m_menuBarHeight = req.height; m_menuBarHeight = req.height;
// resize window in OnInternalIdle // resize window in OnInternalIdle
GtkUpdateSize(); GtkUpdateSize();
} }
@@ -714,4 +714,3 @@ void wxFrame::PositionStatusBar()
GtkUpdateSize(); GtkUpdateSize();
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR

View File

@@ -1510,7 +1510,7 @@ long wxTextCtrl::GetInsertionPoint() const
else else
#endif #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); gtk_widget_set_sensitive(m_widget, false);
g_object_ref(m_buffer); g_object_ref(m_buffer);
gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), gtk_text_buffer_new(NULL)); gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), gtk_text_buffer_new(NULL));
} }
#else #else
gtk_text_freeze(GTK_TEXT(m_text)); gtk_text_freeze(GTK_TEXT(m_text));
#endif #endif

View File

@@ -77,7 +77,7 @@ static wxTopLevelWindowGTK *g_lastActiveFrame = (wxTopLevelWindowGTK*) NULL;
// either TRUE or FALSE and an activate event will be sent during the next // 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 // OnIdle() call and it is reset to -1: this value means that we shouldn't
// send any activate events at all // send any activate events at all
static int g_sendActivateEvent = -1; static int g_sendActivateEvent = -1;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "focus_in_event" // "focus_in_event"
@@ -90,7 +90,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
switch ( g_sendActivateEvent ) switch ( g_sendActivateEvent )
{ {
case -1: case -1:
@@ -107,11 +107,11 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
g_activeFrame = win; g_activeFrame = win;
g_lastActiveFrame = g_activeFrame; g_lastActiveFrame = g_activeFrame;
// wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() ); // wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() );
wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); 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); event.SetEventObject(g_activeFrame);
g_activeFrame->GetEventHandler()->ProcessEvent(event); g_activeFrame->GetEventHandler()->ProcessEvent(event);
@@ -124,8 +124,8 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern "C" { extern "C" {
static gint gtk_frame_focus_out_callback( GtkWidget *widget, static gint gtk_frame_focus_out_callback( GtkWidget *widget,
GdkEventFocus *WXUNUSED(gdk_event), GdkEventFocus *WXUNUSED(gdk_event),
wxTopLevelWindowGTK *win ) wxTopLevelWindowGTK *win )
{ {
if (g_isIdle) 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 // wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset
// g_sendActivateEvent to -1 // g_sendActivateEvent to -1
g_sendActivateEvent = 0; g_sendActivateEvent = 0;
// wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") ); // wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") );
// wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() ); // wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() );
if (g_activeFrame) if (g_activeFrame)
{ {
wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), 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); event.SetEventObject(g_activeFrame);
g_activeFrame->GetEventHandler()->ProcessEvent(event); g_activeFrame->GetEventHandler()->ProcessEvent(event);
g_activeFrame = NULL; g_activeFrame = NULL;
} }
return FALSE; return FALSE;
} }
} }
@@ -299,7 +299,7 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget),
GdkEvent * WXUNUSED(event), GdkEvent * WXUNUSED(event),
wxTopLevelWindow *win ) wxTopLevelWindow *win )
{ {
win->SetIconizeState(FALSE); win->SetIconizeState(false);
} }
} }
@@ -410,16 +410,16 @@ static void wxInsertChildInTopLevelWindow( wxTopLevelWindowGTK* parent, wxWindow
void wxTopLevelWindowGTK::Init() void wxTopLevelWindowGTK::Init()
{ {
m_sizeSet = FALSE; m_sizeSet = false;
m_miniEdge = 0; m_miniEdge = 0;
m_miniTitle = 0; m_miniTitle = 0;
m_mainWidget = (GtkWidget*) NULL; m_mainWidget = (GtkWidget*) NULL;
m_insertInClientArea = TRUE; m_insertInClientArea = true;
m_isIconized = FALSE; m_isIconized = false;
m_fsIsShowing = FALSE; m_fsIsShowing = false;
m_themeEnabled = TRUE; m_themeEnabled = true;
m_gdkDecor = m_gdkFunc = 0; m_gdkDecor = m_gdkFunc = 0;
m_grabbed = FALSE; m_grabbed = false;
} }
bool wxTopLevelWindowGTK::Create( wxWindow *parent, bool wxTopLevelWindowGTK::Create( wxWindow *parent,
@@ -438,13 +438,13 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
wxTopLevelWindows.Append( this ); wxTopLevelWindows.Append( this );
m_needParent = FALSE; m_needParent = false;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{ {
wxFAIL_MSG( wxT("wxTopLevelWindowGTK creation failed") ); wxFAIL_MSG( wxT("wxTopLevelWindowGTK creation failed") );
return FALSE; return false;
} }
m_title = title; m_title = title;
@@ -479,10 +479,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
{ {
gtk_window_set_type_hint(GTK_WINDOW(m_widget), gtk_window_set_type_hint(GTK_WINDOW(m_widget),
GDK_WINDOW_TYPE_HINT_UTILITY); GDK_WINDOW_TYPE_HINT_UTILITY);
// On some WMs, like KDE, a TOOL_WINDOW will still show // On some WMs, like KDE, a TOOL_WINDOW will still show
// on the taskbar, but on Gnome a TOOL_WINDOW will not. // 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 // should set the NO_TASKBAR flag which will apply
// the set_skip_taskbar_hint if it is available, // the set_skip_taskbar_hint if it is available,
// ensuring no taskbar entry will appear. // ensuring no taskbar entry will appear.
@@ -495,8 +495,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
wxWindow *topParent = wxGetTopLevelParent(m_parent); wxWindow *topParent = wxGetTopLevelParent(m_parent);
if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) && if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) || (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
(style & wxFRAME_FLOAT_ON_PARENT))) (style & wxFRAME_FLOAT_ON_PARENT)))
{ {
gtk_window_set_transient_for( GTK_WINDOW(m_widget), gtk_window_set_transient_for( GTK_WINDOW(m_widget),
GTK_WINDOW(topParent->m_widget) ); GTK_WINDOW(topParent->m_widget) );
@@ -522,7 +522,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
} }
#endif #endif
if (!name.IsEmpty()) if (!name.empty())
gtk_window_set_wmclass( GTK_WINDOW(m_widget), wxGTK_CONV( name ), wxGTK_CONV( name ) ); 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 ) ); 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_FUNC(gtk_frame_focus_in_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event", gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event",
GTK_SIGNAL_FUNC(gtk_frame_focus_out_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_focus_out_callback), (gpointer)this );
// decorations // decorations
if ((m_miniEdge > 0) || (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER)) 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() wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
@@ -652,14 +652,14 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
RemoveGrab(); RemoveGrab();
} }
m_isBeingDeleted = TRUE; m_isBeingDeleted = true;
// it may also be GtkScrolledWindow in the case of an MDI child // it may also be GtkScrolledWindow in the case of an MDI child
if (GTK_IS_WINDOW(m_widget)) if (GTK_IS_WINDOW(m_widget))
{ {
gtk_window_set_focus( GTK_WINDOW(m_widget), NULL ); gtk_window_set_focus( GTK_WINDOW(m_widget), NULL );
} }
if (g_activeFrame == this) if (g_activeFrame == this)
g_activeFrame = NULL; g_activeFrame = NULL;
if (g_lastActiveFrame == this) if (g_lastActiveFrame == this)
@@ -671,10 +671,10 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
{ {
if (show == m_fsIsShowing) if (show == m_fsIsShowing)
return FALSE; // return what? return false; // return what?
m_fsIsShowing = show; m_fsIsShowing = show;
wxX11FullScreenMethod method = wxX11FullScreenMethod method =
wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(), wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
(WXWindow)GDK_ROOT_WINDOW()); (WXWindow)GDK_ROOT_WINDOW());
@@ -691,7 +691,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
else else
gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
return TRUE; return true;
} }
else else
#endif // GTK+ >= 2.2.0 #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 ); GtkOnSize( m_x, m_y, m_width, m_height );
} }
if (show) if (show)
gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_uposition( m_widget, m_x, m_y );
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
@@ -804,7 +804,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
// avoid recursions // avoid recursions
if (m_resizing) if (m_resizing)
return; return;
m_resizing = TRUE; m_resizing = true;
int old_x = m_x; int old_x = m_x;
int old_y = m_y; int old_y = m_y;
@@ -851,7 +851,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
maxWidth = -1; maxWidth = -1;
maxHeight = -1; maxHeight = -1;
#endif #endif
if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; 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 /* 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 done either directly before the frame is shown or in idle time
so that different calls to SetSize() don't lead to flicker. */ 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 void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const
@@ -914,7 +914,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
// avoid recursions // avoid recursions
if (m_resizing) return; if (m_resizing) return;
m_resizing = TRUE; m_resizing = true;
if ( m_wxwindow == NULL ) return; if ( m_wxwindow == NULL ) return;
@@ -942,7 +942,7 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
maxWidth = -1; maxWidth = -1;
maxHeight = -1; maxHeight = -1;
#endif #endif
if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; 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. // is no need to set the size or position of m_wxwindow.
} }
m_sizeSet = TRUE; m_sizeSet = true;
// send size event to frame // send size event to frame
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = false;
} }
void wxTopLevelWindowGTK::OnInternalIdle() void wxTopLevelWindowGTK::OnInternalIdle()
@@ -1047,15 +1047,15 @@ void wxTopLevelWindowGTK::OnInternalIdle()
} }
wxWindow::OnInternalIdle(); wxWindow::OnInternalIdle();
// Synthetize activate events. // Synthetize activate events.
if ( g_sendActivateEvent != -1 ) if ( g_sendActivateEvent != -1 )
{ {
bool activate = g_sendActivateEvent != 0; bool activate = g_sendActivateEvent != 0;
// if (!activate) wxPrintf( wxT("de") ); // if (!activate) wxPrintf( wxT("de") );
// wxPrintf( wxT("activate\n") ); // wxPrintf( wxT("activate\n") );
// do it only once // do it only once
g_sendActivateEvent = -1; g_sendActivateEvent = -1;
@@ -1099,7 +1099,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
} }
gtk_window_set_icon_list(GTK_WINDOW(m_widget), list); gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
g_list_free(list); g_list_free(list);
#else // !__WXGTK20__ #else // !__WXGTK20__
GdkWindow* window = m_widget->window; GdkWindow* window = m_widget->window;
if (!window) if (!window)
@@ -1147,7 +1147,7 @@ bool wxTopLevelWindowGTK::IsMaximized() const
// wxFAIL_MSG( _T("not implemented") ); // wxFAIL_MSG( _T("not implemented") );
// This is an approximation // This is an approximation
return FALSE; return false;
#endif #endif
} }
@@ -1201,7 +1201,7 @@ void wxTopLevelWindowGTK::AddGrab()
{ {
if (!m_grabbed) if (!m_grabbed)
{ {
m_grabbed = TRUE; m_grabbed = true;
gtk_grab_add( m_widget ); gtk_grab_add( m_widget );
wxEventLoop().Run(); wxEventLoop().Run();
gtk_grab_remove( m_widget ); gtk_grab_remove( m_widget );
@@ -1213,7 +1213,7 @@ void wxTopLevelWindowGTK::RemoveGrab()
if (m_grabbed) if (m_grabbed)
{ {
gtk_main_quit(); 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 else
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0); gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0);
#else #else
wxBitmap bmp = region.ConvertToBitmap(); wxBitmap bmp = region.ConvertToBitmap();
bmp.SetMask(new wxMask(bmp, *wxBLACK)); bmp.SetMask(new wxMask(bmp, *wxBLACK));
GdkBitmap* mask = bmp.GetMask()->GetBitmap(); GdkBitmap* mask = bmp.GetMask()->GetBitmap();
gdk_window_shape_combine_mask(window, mask, 0, 0); gdk_window_shape_combine_mask(window, mask, 0, 0);
#endif #endif
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) 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.")); _T("Shaped windows must be created with the wxFRAME_SHAPED style."));
GdkWindow *window = NULL; GdkWindow *window = NULL;
@@ -1263,4 +1263,3 @@ bool wxTopLevelWindowGTK::IsActive()
{ {
return (this == (wxTopLevelWindowGTK*)g_activeFrame); return (this == (wxTopLevelWindowGTK*)g_activeFrame);
} }

View File

@@ -229,7 +229,7 @@ static GdkGC *g_eraseGC = NULL;
// mouse capture state: the window which has it and if the mouse is currently // mouse capture state: the window which has it and if the mouse is currently
// inside it // inside it
static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL; static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL;
static bool g_captureWindowHasMouse = FALSE; static bool g_captureWindowHasMouse = false;
wxWindowGTK *g_focusWindow = (wxWindowGTK*) NULL; 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 // hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here // the last click here
static guint32 gs_timeLastClick = 0; static guint32 gs_timeLastClick = 0;
extern bool g_mainThreadLocked; 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 // This callback is actually hooked into the text entry
// of the combo box, not the GtkHBox. // of the combo box, not the GtkHBox.
int w, h; int w, h;
win->GetSize( &w, &h ); win->GetSize( &w, &h );
if (w < 2) if (w < 2)
@@ -499,13 +499,13 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget,
h = 2; h = 2;
GtkCombo *gcombo = GTK_COMBO(win->m_widget); GtkCombo *gcombo = GTK_COMBO(win->m_widget);
GtkRequisition entry_req; GtkRequisition entry_req;
entry_req.width = 2; entry_req.width = 2;
entry_req.height = 2; entry_req.height = 2;
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->button) )->size_request ) (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->button) )->size_request )
(gcombo->button, &entry_req ); (gcombo->button, &entry_req );
requisition->width = w - entry_req.width; requisition->width = w - entry_req.width;
requisition->height = entry_req.height; 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.width,
(int)gdk_event->area.height ); (int)gdk_event->area.height );
} }
gtk_paint_box gtk_paint_box
( (
win->m_wxwindow->style, win->m_wxwindow->style,
@@ -1048,7 +1048,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
: _T("press"), : _T("press"),
keysym); keysym);
long key_code = wxTranslateKeySymToWXKey(keysym, FALSE /* !isChar */); long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */);
if ( !key_code ) if ( !key_code )
{ {
@@ -1117,14 +1117,14 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
// sending unknown key events doesn't really make sense // sending unknown key events doesn't really make sense
if ( !key_code ) if ( !key_code )
return FALSE; return false;
// now fill all the other fields // now fill all the other fields
wxFillOtherKeyEventFields(event, win, gdk_event); wxFillOtherKeyEventFields(event, win, gdk_event);
event.m_keyCode = key_code; 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 // Emit KEY_DOWN event
ret = win->GetEventHandler()->ProcessEvent( event ); ret = win->GetEventHandler()->ProcessEvent( event );
} }
else else
{ {
// Return after IM processing as we cannot do // Return after IM processing as we cannot do
// anything with it anyhow. // 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): // 2005.01.26 modified by Hong Jen Yee (hzysoft@sina.com.tw):
// When we get a key_press event here, it could be originate // When we get a key_press event here, it could be originate
// from the current widget or its child widgets. However, only the widget // from the current widget or its child widgets. However, only the widget
// 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 // 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. // 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 // 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 // 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(). // by gtk_im_context_filter_keypress().
// Then, we should, according to GTK+ 2.0 API doc, return whatever it returns. // Then, we should, according to GTK+ 2.0 API doc, return whatever it returns.
if ((!ret) && (win->m_imData != NULL) && ( wxWindow::FindFocus() == win )) if ((!ret) && (win->m_imData != NULL) && ( wxWindow::FindFocus() == win ))
{ {
// We should let GTK+ IM filter key event first. According to GTK+ 2.0 API // 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. // 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); bool intercepted_by_IM = gtk_im_context_filter_keypress(win->m_imData->context, gdk_event);
win->m_imData->lastKeyEvent = NULL; win->m_imData->lastKeyEvent = NULL;
if (intercepted_by_IM) if (intercepted_by_IM)
@@ -1207,16 +1207,16 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
if (return_after_IM) if (return_after_IM)
return false; return false;
#ifndef __WXGTK20__ #ifndef __WXGTK20__
// This is for GTK+ 1.2 only. The char event generatation for GTK+ 2.0 is done // This is for GTK+ 1.2 only. The char event generatation for GTK+ 2.0 is done
// in the "commit" handler. // in the "commit" handler.
// 2005.02.02 modified by Hong Jen Yee (hzysoft@sina.com.tw). // 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 // 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 // keyCodes cannot be recognized by wxWidgets. These MBCS strings, however, are
// composed of more than one character, which means gdk_event->length will always // 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 // 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, // 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 // nor should we pass it to controls. The following explanation was excerpted
// from GDK documentation. // from GDK documentation.
@@ -1265,7 +1265,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
} }
return true; return true;
} }
#endif // #ifndef __WXGTK20__ #endif // #ifndef __WXGTK20__
#if wxUSE_ACCEL #if wxUSE_ACCEL
@@ -1295,7 +1295,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
long key_code; long key_code;
KeySym keysym = gdk_event->keyval; KeySym keysym = gdk_event->keyval;
// Find key code for EVT_CHAR and EVT_CHAR_HOOK events // 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 ( !key_code )
{ {
if ( wxIsAsciiKeysym(keysym) ) if ( wxIsAsciiKeysym(keysym) )
@@ -2007,7 +2007,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget,
event_type = wxEVT_MOUSEWHEEL; event_type = wxEVT_MOUSEWHEEL;
else else
return FALSE; return FALSE;
wxMouseEvent event( event_type ); wxMouseEvent event( event_type );
// Can't use InitMouse macro because scroll events don't have button // Can't use InitMouse macro because scroll events don't have button
event.SetTimestamp( gdk_event->time ); event.SetTimestamp( gdk_event->time );
@@ -2032,7 +2032,7 @@ static gint gtk_window_wheel_callback (GtkWidget * widget,
event.SetEventObject( win ); event.SetEventObject( win );
event.SetId( win->GetId() ); event.SetId( win->GetId() );
event.SetTimestamp( gdk_event->time ); event.SetTimestamp( gdk_event->time );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "scroll_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 ) wxWindow *win )
{ {
DEBUG_MAIN_THREAD DEBUG_MAIN_THREAD
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
@@ -2117,8 +2117,8 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
if ( !win->m_hasFocus ) if ( !win->m_hasFocus )
{ {
// not yet, notify it // not yet, notify it
win->m_hasFocus = TRUE; win->m_hasFocus = true;
if ( DoSendFocusEvents(win) ) if ( DoSendFocusEvents(win) )
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" ); 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 // have focus already
if ( win->m_hasFocus ) if ( win->m_hasFocus )
{ {
win->m_hasFocus = FALSE; win->m_hasFocus = false;
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
@@ -2374,7 +2374,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
wxapp_install_idle_handler(); wxapp_install_idle_handler();
g_blockEventsOnScroll = TRUE; g_blockEventsOnScroll = true;
// FIXME: there is no 'slider' field in GTK+ 2.0 any more // FIXME: there is no 'slider' field in GTK+ 2.0 any more
#ifndef __WXGTK20__ #ifndef __WXGTK20__
@@ -2401,7 +2401,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
// //
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
g_blockEventsOnScroll = FALSE; g_blockEventsOnScroll = false;
if (win->m_isScrolling) if (win->m_isScrolling)
{ {
@@ -2426,7 +2426,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
win->GetEventHandler()->ProcessEvent( event ); win->GetEventHandler()->ProcessEvent( event );
} }
win->m_isScrolling = FALSE; win->m_isScrolling = false;
return FALSE; return FALSE;
} }
@@ -2458,7 +2458,7 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (win->m_imData) if (win->m_imData)
{ {
@@ -2700,16 +2700,16 @@ void wxWindowGTK::Init()
m_width = 0; m_width = 0;
m_height = 0; m_height = 0;
m_sizeSet = FALSE; m_sizeSet = false;
m_hasVMT = FALSE; m_hasVMT = false;
m_needParent = TRUE; m_needParent = true;
m_isBeingDeleted = FALSE; m_isBeingDeleted = false;
m_noExpose = FALSE; m_noExpose = false;
m_nativeSizeEvent = FALSE; m_nativeSizeEvent = false;
m_hasScrolling = FALSE; m_hasScrolling = false;
m_isScrolling = FALSE; m_isScrolling = false;
m_hAdjust = (GtkAdjustment*) NULL; m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL; m_vAdjust = (GtkAdjustment*) NULL;
@@ -2718,14 +2718,14 @@ void wxWindowGTK::Init()
m_oldClientWidth = m_oldClientWidth =
m_oldClientHeight = 0; m_oldClientHeight = 0;
m_resizing = FALSE; m_resizing = false;
m_insertCallback = (wxInsertChildFunction) NULL; m_insertCallback = (wxInsertChildFunction) NULL;
m_acceptsFocus = FALSE; m_acceptsFocus = false;
m_hasFocus = FALSE; m_hasFocus = false;
m_clipPaintRegion = FALSE; m_clipPaintRegion = false;
m_needsStyleChange = false; m_needsStyleChange = false;
@@ -2771,7 +2771,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{ {
wxFAIL_MSG( wxT("wxWindowGTK creation failed") ); wxFAIL_MSG( wxT("wxWindowGTK creation failed") );
return FALSE; return false;
} }
m_insertCallback = wxInsertChildInWindow; m_insertCallback = wxInsertChildInWindow;
@@ -2815,7 +2815,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
m_acceptsFocus = TRUE; m_acceptsFocus = true;
// I _really_ don't want scrollbars in the beginning // I _really_ don't want scrollbars in the beginning
m_vAdjust->lower = 0.0; m_vAdjust->lower = 0.0;
@@ -2867,7 +2867,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
PostCreation(); PostCreation();
return TRUE; return true;
} }
wxWindowGTK::~wxWindowGTK() wxWindowGTK::~wxWindowGTK()
@@ -2880,11 +2880,11 @@ wxWindowGTK::~wxWindowGTK()
if ( g_delayedFocus == this ) if ( g_delayedFocus == this )
g_delayedFocus = NULL; g_delayedFocus = NULL;
m_isBeingDeleted = TRUE; m_isBeingDeleted = true;
m_hasVMT = FALSE; m_hasVMT = false;
if (m_widget) if (m_widget)
Show( FALSE ); Show( false );
DestroyChildren(); DestroyChildren();
@@ -2914,7 +2914,7 @@ wxWindowGTK::~wxWindowGTK()
bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ) 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. // Use either the given size, or the default if -1 is given.
// See wxWindowBase for these functions. // 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_x = (int)pos.x;
m_y = (int)pos.y; m_y = (int)pos.y;
return TRUE; return true;
} }
void wxWindowGTK::PostCreation() void wxWindowGTK::PostCreation()
@@ -2983,7 +2983,7 @@ void wxWindowGTK::PostCreation()
{ {
if (m_focusWidget == NULL) if (m_focusWidget == NULL)
m_focusWidget = m_widget; m_focusWidget = m_widget;
gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_in_event", gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
@@ -3020,7 +3020,7 @@ void wxWindowGTK::PostCreation()
if (GTK_IS_COMBO(m_widget)) if (GTK_IS_COMBO(m_widget))
{ {
GtkCombo *gcombo = GTK_COMBO(m_widget); GtkCombo *gcombo = GTK_COMBO(m_widget);
gtk_signal_connect( GTK_OBJECT(gcombo->entry), "size_request", gtk_signal_connect( GTK_OBJECT(gcombo->entry), "size_request",
GTK_SIGNAL_FUNC(wxgtk_combo_size_request_callback), GTK_SIGNAL_FUNC(wxgtk_combo_size_request_callback),
(gpointer) this ); (gpointer) this );
@@ -3038,7 +3038,7 @@ void wxWindowGTK::PostCreation()
InheritAttributes(); InheritAttributes();
m_hasVMT = TRUE; m_hasVMT = true;
// unless the window was created initially hidden (i.e. Hide() had been // unless the window was created initially hidden (i.e. Hide() had been
// called before Create()), we should show it at GTK+ level as well // 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") ); wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
m_hasVMT = FALSE; m_hasVMT = false;
return wxWindowBase::Destroy(); 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 */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = true;
int currentX, currentY; int currentX, currentY;
GetPosition(&currentX, &currentY); GetPosition(&currentX, &currentY);
@@ -3217,7 +3217,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
} }
m_resizing = FALSE; m_resizing = false;
} }
void wxWindowGTK::OnInternalIdle() void wxWindowGTK::OnInternalIdle()
@@ -3495,12 +3495,12 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const
bool wxWindowGTK::Show( bool show ) 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)) if (!wxWindowBase::Show(show))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
if (show) if (show)
@@ -3513,7 +3513,7 @@ bool wxWindowGTK::Show( bool show )
GetEventHandler()->ProcessEvent(eventShow); GetEventHandler()->ProcessEvent(eventShow);
return TRUE; return true;
} }
static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
@@ -3535,12 +3535,12 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
bool wxWindowGTK::Enable( 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)) if (!wxWindowBase::Enable(enable))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
gtk_widget_set_sensitive( m_widget, enable ); gtk_widget_set_sensitive( m_widget, enable );
@@ -3549,7 +3549,7 @@ bool wxWindowGTK::Enable( bool enable )
wxWindowNotifyEnable(this, enable); wxWindowNotifyEnable(this, enable);
return TRUE; return true;
} }
int wxWindowGTK::GetCharHeight() const int wxWindowGTK::GetCharHeight() const
@@ -3621,17 +3621,17 @@ int wxWindowGTK::GetCharWidth() const
} }
void wxWindowGTK::GetTextExtent( const wxString& string, void wxWindowGTK::GetTextExtent( const wxString& string,
int *x, int *x,
int *y, int *y,
int *descent, int *descent,
int *externalLeading, int *externalLeading,
const wxFont *theFont ) const const wxFont *theFont ) const
{ {
wxFont fontToUse = theFont ? *theFont : GetFont(); wxFont fontToUse = theFont ? *theFont : GetFont();
wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") );
if (string.IsEmpty()) if (string.empty())
{ {
if (x) (*x) = 0; if (x) (*x) = 0;
if (y) (*y) = 0; if (y) (*y) = 0;
@@ -3715,7 +3715,7 @@ void wxWindowGTK::SetFocus()
#endif #endif
if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) ) if (GTK_WIDGET_CAN_FOCUS(m_widget) && !GTK_WIDGET_HAS_FOCUS (m_widget) )
{ {
if (!GTK_WIDGET_REALIZED(m_widget)) if (!GTK_WIDGET_REALIZED(m_widget))
{ {
// we can't set the focus to the widget now so we remember that // 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); gtk_widget_grab_focus (m_widget);
} }
} }
else else
#ifndef __WXGTK20__ #ifndef __WXGTK20__
if (GTK_IS_CONTAINER(m_widget)) if (GTK_IS_CONTAINER(m_widget))
{ {
@@ -3759,7 +3759,7 @@ bool wxWindowGTK::AcceptsFocus() const
bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) 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, wxWindowGTK *oldParent = m_parent,
*newParent = (wxWindowGTK *)newParentBase; *newParent = (wxWindowGTK *)newParentBase;
@@ -3767,7 +3767,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
wxASSERT( GTK_IS_WIDGET(m_widget) ); wxASSERT( GTK_IS_WIDGET(m_widget) );
if ( !wxWindowBase::Reparent(newParent) ) if ( !wxWindowBase::Reparent(newParent) )
return FALSE; return false;
wxASSERT( GTK_IS_WIDGET(m_widget) ); wxASSERT( GTK_IS_WIDGET(m_widget) );
@@ -3790,7 +3790,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
/* reverse: prevent GTK from deleting the widget arbitrarily */ /* reverse: prevent GTK from deleting the widget arbitrarily */
gtk_widget_unref( m_widget ); gtk_widget_unref( m_widget );
return TRUE; return true;
} }
void wxWindowGTK::DoAddChild(wxWindowGTK *child) void wxWindowGTK::DoAddChild(wxWindowGTK *child)
@@ -3825,7 +3825,7 @@ void wxWindowGTK::RemoveChild(wxWindowBase *child)
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
} }
void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move) void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
{ {
wxWindowBase::DoMoveInTabOrder(win, move); wxWindowBase::DoMoveInTabOrder(win, move);
@@ -3841,15 +3841,15 @@ void wxWindowGTK::RealizeTabOrder()
if (m_children.size() > 0) if (m_children.size() > 0)
{ {
GList *chain = NULL; GList *chain = NULL;
for (wxWindowList::const_iterator i = m_children.begin(); for (wxWindowList::const_iterator i = m_children.begin();
i != m_children.end(); ++i) i != m_children.end(); ++i)
{ {
chain = g_list_prepend(chain, (*i)->m_widget); chain = g_list_prepend(chain, (*i)->m_widget);
} }
chain = g_list_reverse(chain); chain = g_list_reverse(chain);
gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain); gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain);
g_list_free(chain); g_list_free(chain);
} }
@@ -3858,7 +3858,7 @@ void wxWindowGTK::RealizeTabOrder()
gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow)); gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow));
} }
} }
m_dirtyTabOrder = false; m_dirtyTabOrder = false;
} }
@@ -3872,7 +3872,7 @@ void wxWindowGTK::Raise()
{ {
gdk_window_raise( m_wxwindow->window ); gdk_window_raise( m_wxwindow->window );
} }
else if (m_widget->window) else if (m_widget->window)
{ {
gdk_window_raise( m_widget->window ); gdk_window_raise( m_widget->window );
} }
@@ -3886,7 +3886,7 @@ void wxWindowGTK::Lower()
{ {
gdk_window_lower( m_wxwindow->window ); gdk_window_lower( m_wxwindow->window );
} }
else if (m_widget->window) else if (m_widget->window)
{ {
gdk_window_lower( m_widget->window ); gdk_window_lower( m_widget->window );
} }
@@ -3894,10 +3894,10 @@ void wxWindowGTK::Lower()
bool wxWindowGTK::SetCursor( const wxCursor &cursor ) 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) if (cursor == m_cursor)
return FALSE; return false;
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
@@ -4060,7 +4060,7 @@ void wxWindowGTK::GtkSendPaintEvents()
} }
// Clip to paint region in wxClientDC // Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE; m_clipPaintRegion = true;
// widget to draw on // widget to draw on
GtkPizza *pizza = GTK_PIZZA (m_wxwindow); GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
@@ -4149,7 +4149,7 @@ void wxWindowGTK::GtkSendPaintEvents()
paint_event.SetEventObject( this ); paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( paint_event ); GetEventHandler()->ProcessEvent( paint_event );
m_clipPaintRegion = FALSE; m_clipPaintRegion = false;
#ifndef __WXUNIVERSAL__ #ifndef __WXUNIVERSAL__
#ifndef __WXGTK20__ #ifndef __WXGTK20__
@@ -4233,7 +4233,7 @@ void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) 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)) if (!wxWindowBase::SetBackgroundColour(colour))
return false; return false;
@@ -4254,13 +4254,13 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
bool wxWindowGTK::SetForegroundColour( 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)) if (!wxWindowBase::SetForegroundColour(colour))
{ {
return false; return false;
} }
if (colour.Ok()) if (colour.Ok())
{ {
// We need the pixel value e.g. for background clearing. // We need the pixel value e.g. for background clearing.
@@ -4288,7 +4288,7 @@ PangoContext *wxWindowGTK::GtkGetPangoX11Context()
return m_x11Context; return m_x11Context;
} }
#endif #endif
GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle) GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
{ {
// do we need to apply any changes at all? // do we need to apply any changes at all?
@@ -4304,7 +4304,7 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
if ( m_font.Ok() ) if ( m_font.Ok() )
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
style->font_desc = style->font_desc =
pango_font_description_copy( m_font.GetNativeFontInfo()->description ); pango_font_description_copy( m_font.GetNativeFontInfo()->description );
#else #else
wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName(); wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName();
@@ -4315,13 +4315,13 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
if ( m_foregroundColour.Ok() ) if ( m_foregroundColour.Ok() )
{ {
GdkColor *fg = m_foregroundColour.GetColor(); GdkColor *fg = m_foregroundColour.GetColor();
style->fg[GTK_STATE_NORMAL] = *fg; style->fg[GTK_STATE_NORMAL] = *fg;
style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG; style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG;
style->fg[GTK_STATE_PRELIGHT] = *fg; style->fg[GTK_STATE_PRELIGHT] = *fg;
style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_FG; style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_FG;
style->fg[GTK_STATE_ACTIVE] = *fg; style->fg[GTK_STATE_ACTIVE] = *fg;
style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_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->base[GTK_STATE_NORMAL] = *bg;
style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags) style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags)
(style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG | GTK_RC_BASE);
style->bg[GTK_STATE_PRELIGHT] = *bg; style->bg[GTK_STATE_PRELIGHT] = *bg;
style->base[GTK_STATE_PRELIGHT] = *bg; style->base[GTK_STATE_PRELIGHT] = *bg;
style->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) style->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags)
(style->color_flags[GTK_STATE_PRELIGHT] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_PRELIGHT] | GTK_RC_BG | GTK_RC_BASE);
style->bg[GTK_STATE_ACTIVE] = *bg; style->bg[GTK_STATE_ACTIVE] = *bg;
style->base[GTK_STATE_ACTIVE] = *bg; style->base[GTK_STATE_ACTIVE] = *bg;
style->color_flags[GTK_STATE_ACTIVE] = (GtkRcFlags) style->color_flags[GTK_STATE_ACTIVE] = (GtkRcFlags)
(style->color_flags[GTK_STATE_ACTIVE] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_ACTIVE] | GTK_RC_BG | GTK_RC_BASE);
style->bg[GTK_STATE_INSENSITIVE] = *bg; style->bg[GTK_STATE_INSENSITIVE] = *bg;
style->base[GTK_STATE_INSENSITIVE] = *bg; style->base[GTK_STATE_INSENSITIVE] = *bg;
style->color_flags[GTK_STATE_INSENSITIVE] = (GtkRcFlags) style->color_flags[GTK_STATE_INSENSITIVE] = (GtkRcFlags)
(style->color_flags[GTK_STATE_INSENSITIVE] | GTK_RC_BG | GTK_RC_BASE); (style->color_flags[GTK_STATE_INSENSITIVE] | GTK_RC_BG | GTK_RC_BASE);
} }
return style; return style;
} }
@@ -4378,7 +4378,7 @@ void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style)
bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
{ {
wxWindowBase::SetBackgroundStyle(style); wxWindowBase::SetBackgroundStyle(style);
if (style == wxBG_STYLE_CUSTOM) if (style == wxBG_STYLE_CUSTOM)
{ {
GdkWindow *window = (GdkWindow*) NULL; GdkWindow *window = (GdkWindow*) NULL;
@@ -4401,7 +4401,7 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
else else
// Do in OnIdle, because the window is not yet available // Do in OnIdle, because the window is not yet available
m_needsStyleChange = true; m_needsStyleChange = true;
// Don't apply widget style, or we get a grey background // Don't apply widget style, or we get a grey background
} }
else else
@@ -4428,7 +4428,7 @@ void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
void SetInvokingWindow( wxMenu *menu, wxWindow* win ) void SetInvokingWindow( wxMenu *menu, wxWindow* win )
{ {
menu->SetInvokingWindow( win ); menu->SetInvokingWindow( win );
wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
@@ -4562,14 +4562,14 @@ bool wxWindowGTK::IsOwnGtkWindow( GdkWindow *window )
bool wxWindowGTK::SetFont( const wxFont &font ) 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)) if (!wxWindowBase::SetFont(font))
return false; return false;
// apply style change (forceStyle=true so that new style is applied // apply style change (forceStyle=true so that new style is applied
// even if the font changed from valid to wxNullFont): // even if the font changed from valid to wxNullFont):
ApplyWidgetStyle(true); ApplyWidgetStyle(true);
return true; return true;
} }
@@ -4600,7 +4600,7 @@ void wxWindowGTK::DoCaptureMouse()
cursor->GetCursor(), cursor->GetCursor(),
(guint32)GDK_CURRENT_TIME ); (guint32)GDK_CURRENT_TIME );
g_captureWindow = this; g_captureWindow = this;
g_captureWindowHasMouse = TRUE; g_captureWindowHasMouse = true;
} }
void wxWindowGTK::DoReleaseMouse() void wxWindowGTK::DoReleaseMouse()
@@ -4631,7 +4631,7 @@ wxWindow *wxWindowBase::GetCapture()
bool wxWindowGTK::IsRetained() const bool wxWindowGTK::IsRetained() const
{ {
return FALSE; return false;
} }
void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, 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") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
m_hasScrolling = TRUE; m_hasScrolling = true;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
@@ -4817,11 +4817,11 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
} }
#endif #endif
m_clipPaintRegion = TRUE; m_clipPaintRegion = true;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = FALSE; m_clipPaintRegion = false;
} }
@@ -4885,7 +4885,7 @@ bool wxWinModule::OnInit()
// g_eraseGC = gdk_gc_new( GDK_ROOT_PARENT() ); // g_eraseGC = gdk_gc_new( GDK_ROOT_PARENT() );
// gdk_gc_set_fill( g_eraseGC, GDK_SOLID ); // gdk_gc_set_fill( g_eraseGC, GDK_SOLID );
return TRUE; return true;
} }
void wxWinModule::OnExit() void wxWinModule::OnExit()