wxWindow split into wxWindowBase and wxWindow (wxGTK part)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-05-09 22:17:03 +00:00
parent 358d140ac9
commit f03fc89fff
101 changed files with 6352 additions and 7343 deletions

View File

@@ -45,7 +45,6 @@
wxApp *wxTheApp = (wxApp *) NULL;
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete;
#if wxUSE_THREADS
extern wxList *wxPendingEvents;
extern wxCriticalSection *wxPendingEventsLocker;
@@ -277,8 +276,8 @@ bool wxApp::OnInitGui()
m_colorCube = (unsigned char*)malloc(32 * 32 * 32);
for (int r = 0; r < 32; r++)
{
for (int r = 0; r < 32; r++)
{
for (int g = 0; g < 32; g++)
{
for (int b = 0; b < 32; b++)
@@ -287,21 +286,26 @@ bool wxApp::OnInitGui()
int gg = (g << 3) | (g >> 2);
int bb = (b << 3) | (b >> 2);
GdkColor *colors = cmap->colors;
if(colors)
{
int max = 3 * 65536;
int index = -1;
int index = -1;
for (int i = 0; i < cmap->size; i++)
{
int rdiff = ((rr << 8) - colors[i].red);
int gdiff = ((gg << 8) - colors[i].green);
int bdiff = ((bb << 8) - colors[i].blue);
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; }
GdkColor *colors = cmap->colors;
if(colors)
{
int max = 3 * 65536;
for (int i = 0; i < cmap->size; i++)
{
int rdiff = ((rr << 8) - colors[i].red);
int gdiff = ((gg << 8) - colors[i].green);
int bdiff = ((bb << 8) - colors[i].blue);
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max)
{
index = i; max = sum;
}
}
}
}
m_colorCube[ (r*1024) + (g*32) + b ] = index;
}
}
@@ -448,8 +452,8 @@ void wxApp::DeletePendingObjects()
delete obj;
if (wxPendingDelete.Member(obj))
delete node;
if (wxPendingDelete.Find(obj))
delete node;
node = wxPendingDelete.First();
}

View File

@@ -166,7 +166,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->InsertChild( this );
PostCreation();
@@ -278,11 +278,14 @@ void wxBitmapButton::SetBitmapSelected( const wxBitmap& bitmap )
SetBitmap();
}
void wxBitmapButton::Enable( const bool enable )
bool wxBitmapButton::Enable( bool enable )
{
wxWindow::Enable(enable);
if ( !wxWindow::Enable(enable) )
return FALSE;
SetBitmap();
SetBitmap();
return TRUE;
}
void wxBitmapButton::HasFocus()

View File

@@ -96,9 +96,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -128,13 +126,14 @@ void wxButton::SetLabel( const wxString &label )
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel().mbc_str() );
}
void wxButton::Enable( bool enable )
bool wxButton::Enable( bool enable )
{
wxCHECK_RET( m_widget != NULL, _T("invalid button") );
wxControl::Enable( enable );
if ( !wxControl::Enable( enable ) )
return FALSE;
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
return TRUE;
}
void wxButton::ApplyWidgetStyle()

View File

@@ -124,9 +124,7 @@ bool wxCheckBox::Create(wxWindow *parent,
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
(gpointer *)this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -169,13 +167,14 @@ void wxCheckBox::SetLabel( const wxString& label )
gtk_label_set( GTK_LABEL(m_widgetLabel), GetLabel().mbc_str() );
}
void wxCheckBox::Enable( bool enable )
bool wxCheckBox::Enable( bool enable )
{
wxCHECK_RET( m_widgetLabel != NULL, _T("invalid checkbox") );
wxControl::Enable( enable );
if ( !wxControl::Enable( enable ) )
return FALSE;
gtk_widget_set_sensitive( m_widgetLabel, enable );
return TRUE;
}
void wxCheckBox::ApplyWidgetStyle()

View File

@@ -99,9 +99,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();

View File

@@ -134,9 +134,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
gtk_widget_show( list_item );
}
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -582,7 +580,7 @@ void wxComboBox::OnChar( wxKeyEvent &event )
void wxComboBox::OnSize( wxSizeEvent &event )
{
wxControl::OnSize( event );
event.Skip();
return;

View File

@@ -110,8 +110,9 @@ wxWindowDC::wxWindowDC( wxWindow *window )
if (!window) return;
GtkWidget *widget = window->m_wxwindow;
if (!widget) return;
GtkWidget *widget = window->GetWxWindow();
if (!widget)
return;
m_window = widget->window;
@@ -126,10 +127,10 @@ wxWindowDC::wxWindowDC( wxWindow *window )
/* still not realized ? */
if (!m_window) return;
if (window->m_wxwindow)
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
if (window->GetWxWindow())
m_cmap = gtk_widget_get_colormap( window->GetWxWindow() );
else
m_cmap = gtk_widget_get_colormap( window->m_widget );
m_cmap = gtk_widget_get_colormap( window->GetHandle() );
m_isMemDC = FALSE;

View File

@@ -69,11 +69,9 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation
printf( ".\n" );
*/
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
{
win->m_sizeSet = FALSE;
win->m_width = alloc->width;
win->m_height = alloc->height;
win->InternalSetSize( alloc->width, alloc->height );
}
}
@@ -87,10 +85,9 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
win->m_y = event->y;
win->InternalSetPosition(event->x, event->y);
wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
mevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( mevent );
@@ -114,7 +111,7 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
{
wxIcon icon( win->m_icon );
win->m_icon = wxNullIcon;
win->SetIcon( icon );
win->SetIcon( icon );
}
return FALSE;
@@ -129,43 +126,43 @@ gtk_dialog_map_callback( GtkWidget *widget, wxDialog *win )
{
/* I haven''t been able to set the position of
the dialog before it is shown, so I do it here */
gtk_widget_set_uposition( widget, win->m_x, win->m_y );
gtk_widget_set_uposition( widget, win->GetX(), win->GetY() );
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
long decor = (long) GDK_DECOR_BORDER;
long func = (long) GDK_FUNC_MOVE ;
if ((win->m_windowStyle & wxCAPTION) != 0)
decor |= GDK_DECOR_TITLE;
if ((win->m_windowStyle & wxSYSTEM_MENU) != 0)
if ((win->GetWindowStyle() & wxCAPTION) != 0)
decor |= GDK_DECOR_TITLE;
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
{
decor |= GDK_DECOR_MENU;
func |= GDK_FUNC_CLOSE;
}
if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0)
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
{
func |= GDK_FUNC_MINIMIZE;
decor |= GDK_DECOR_MINIMIZE;
func |= GDK_FUNC_MINIMIZE;
decor |= GDK_DECOR_MINIMIZE;
}
if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0)
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
{
decor |= GDK_DECOR_MAXIMIZE;
func |= GDK_FUNC_MAXIMIZE;
decor |= GDK_DECOR_MAXIMIZE;
func |= GDK_FUNC_MAXIMIZE;
}
if ((win->m_windowStyle & wxRESIZE_BORDER) != 0)
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
{
func |= GDK_FUNC_RESIZE;
decor |= GDK_DECOR_RESIZEH;
}
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
/* GTK's shrinking/growing policy */
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
return FALSE;
}
@@ -186,6 +183,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxPanel)
void wxDialog::Init()
{
m_returnCode = 0;
m_sizeSet = FALSE;
m_modalShowing = FALSE;
}
@@ -236,12 +234,12 @@ bool wxDialog::Create( wxWindow *parent,
/* we cannot set MWM hints before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
/* we set the position of the window after the map event. setting it
before has no effect (with KWM) */
gtk_signal_connect( GTK_OBJECT(m_widget), "map",
GTK_SIGNAL_FUNC(gtk_dialog_map_callback), (gpointer) this );
GTK_SIGNAL_FUNC(gtk_dialog_map_callback), (gpointer) this );
/* the user resized the frame by dragging etc. */
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
@@ -434,17 +432,17 @@ void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_x != -1) || (m_y != -1))
{
if ((m_x != old_x) || (m_y != old_y))
{
/* we set the position here and when showing the dialog
for the first time in idle time */
{
/* we set the position here and when showing the dialog
for the first time in idle time */
gtk_widget_set_uposition( m_widget, m_x, m_y );
}
}
}
if ((m_width != old_width) || (m_height != old_height))
{
/* actual resizing is deferred to GtkOnSize in idle time and
when showing the dialog */
when showing the dialog */
m_sizeSet = FALSE;
}
@@ -517,12 +515,12 @@ bool wxDialog::Show( bool show )
if (show != m_isShown)
{
if (show)
{
gtk_widget_show( m_widget );
}
{
gtk_widget_show( m_widget );
}
else
gtk_widget_hide( m_widget );
m_isShown = show;
}

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -48,9 +48,9 @@ extern bool g_blockEventsOnDrag;
/* XPM */
static char * gv_xpm[] = {
"40 34 3 1",
" s None c None",
". c black",
"X c white",
" s None c None",
". c black",
"X c white",
" ",
" ",
" ...... ",
@@ -85,17 +85,17 @@ static char * gv_xpm[] = {
" ",
" ",
" "};
/* XPM */
static char * page_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 5 1",
/* colors */
" s None c None",
". c black",
"X c wheat",
"o c tan",
"O c #6699FF",
" s None c None",
". c black",
"X c wheat",
"o c tan",
"O c #6699FF",
/* pixels */
" ................... ",
" .XXXXXXXXXXXXXXXXX.. ",
@@ -129,31 +129,31 @@ static char * page_xpm[] = {
" .XXXXXXXXXXXXXXXXXXXXXXX. ",
" .XXXXXXXXXXXXXXXXXXXXXXX. ",
" ......................... "};
// ----------------------------------------------------------------------------
// "drag_leave"
// ----------------------------------------------------------------------------
static void target_drag_leave( GtkWidget *WXUNUSED(widget),
GdkDragContext *context,
guint WXUNUSED(time),
wxDropTarget *drop_target )
GdkDragContext *context,
guint WXUNUSED(time),
wxDropTarget *drop_target )
{
if (g_isIdle) wxapp_install_idle_handler();
/* inform the wxDropTarget about the current GdkDragContext.
this is only valid for the duration of this call */
drop_target->SetDragContext( context );
/* we don't need return values. this event is just for
information */
drop_target->OnLeave();
/* this has to be done because GDK has no "drag_enter" event */
drop_target->m_firstMotion = TRUE;
/* after this, invalidate the drop_target's GdkDragContext */
drop_target->SetDragContext( (GdkDragContext*) NULL );
}
@@ -163,43 +163,43 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
// ----------------------------------------------------------------------------
static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
GdkDragContext *context,
gint x,
gint y,
guint time,
wxDropTarget *drop_target )
GdkDragContext *context,
gint x,
gint y,
guint time,
wxDropTarget *drop_target )
{
if (g_isIdle) wxapp_install_idle_handler();
/* Owen Taylor: "if the coordinates not in a drop zone,
return FALSE, otherwise call gtk_drag_status() and
return TRUE" */
/* inform the wxDropTarget about the current GdkDragContext.
this is only valid for the duration of this call */
drop_target->SetDragContext( context );
if (drop_target->m_firstMotion)
{
/* the first "drag_motion" event substitutes a "drag_enter" event */
drop_target->OnEnter();
drop_target->OnEnter();
}
/* give program a chance to react (i.e. to say no by returning FALSE) */
bool ret = drop_target->OnMove( x, y );
/* we don't yet handle which "actions" (i.e. copy or move)
the target accepts. so far we simply accept the
suggested action. TODO. */
if (ret)
gdk_drag_status( context, context->suggested_action, time );
/* after this, invalidate the drop_target's GdkDragContext */
drop_target->SetDragContext( (GdkDragContext*) NULL );
/* this has to be done because GDK has no "drag_enter" event */
drop_target->m_firstMotion = FALSE;
return ret;
}
@@ -208,11 +208,11 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
// ----------------------------------------------------------------------------
static gboolean target_drag_drop( GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
wxDropTarget *drop_target )
GdkDragContext *context,
gint x,
gint y,
guint time,
wxDropTarget *drop_target )
{
if (g_isIdle) wxapp_install_idle_handler();
@@ -222,43 +222,43 @@ static gboolean target_drag_drop( GtkWidget *widget,
otherwise call gtk_drag_data_get()" */
// printf( "drop.\n" );
/* this seems to make a difference between not accepting
due to wrong target area and due to wrong format. let
us hope that this is not required.. */
/* inform the wxDropTarget about the current GdkDragContext.
this is only valid for the duration of this call */
drop_target->SetDragContext( context );
/* inform the wxDropTarget about the current drag widget.
this is only valid for the duration of this call */
drop_target->SetDragWidget( widget );
/* inform the wxDropTarget about the current drag time.
this is only valid for the duration of this call */
drop_target->SetDragTime( time );
bool ret = drop_target->OnDrop( x, y );
if (!ret)
{
/* cancel the whole thing */
gtk_drag_finish( context,
FALSE, /* no success */
FALSE, /* don't delete data on dropping side */
time );
FALSE, /* no success */
FALSE, /* don't delete data on dropping side */
time );
}
/* after this, invalidate the drop_target's GdkDragContext */
drop_target->SetDragContext( (GdkDragContext*) NULL );
/* after this, invalidate the drop_target's drag widget */
drop_target->SetDragWidget( (GtkWidget*) NULL );
/* this has to be done because GDK has no "drag_enter" event */
drop_target->m_firstMotion = TRUE;
return ret;
}
@@ -267,13 +267,13 @@ static gboolean target_drag_drop( GtkWidget *widget,
// ----------------------------------------------------------------------------
static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *data,
guint WXUNUSED(info),
guint time,
wxDropTarget *drop_target )
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *data,
guint WXUNUSED(info),
guint time,
wxDropTarget *drop_target )
{
if (g_isIdle) wxapp_install_idle_handler();
@@ -281,33 +281,33 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
success == TRUE" */
// printf( "data received.\n" );
if ((data->length <= 0) || (data->format != 8))
{
/* negative data length and non 8-bit data format
qualifies for junk */
gtk_drag_finish (context, FALSE, FALSE, time);
// printf( "no data.\n" );
return;
// printf( "no data.\n" );
return;
}
/* inform the wxDropTarget about the current GtkSelectionData.
this is only valid for the duration of this call */
drop_target->SetDragData( data );
if (drop_target->OnData( x, y ))
{
/* tell GTK that data transfer was successfull */
/* tell GTK that data transfer was successfull */
gtk_drag_finish( context, TRUE, FALSE, time );
}
else
{
/* tell GTK that data transfer was not successfull */
/* tell GTK that data transfer was not successfull */
gtk_drag_finish( context, FALSE, FALSE, time );
}
/* after this, invalidate the drop_target's drag data */
drop_target->SetDragData( (GtkSelectionData*) NULL );
}
@@ -356,7 +356,7 @@ bool wxDropTarget::RequestData( wxDataFormat format )
{
if (!m_dragContext) return FALSE;
if (!m_dragWidget) return FALSE;
/*
wxPrintf( _T("format: %s.\n"), format.GetId().c_str() );
if (format.GetType() == wxDF_PRIVATE) wxPrintf( _T("private data.\n") );
@@ -364,108 +364,108 @@ bool wxDropTarget::RequestData( wxDataFormat format )
*/
/* this should trigger an "drag_data_received" event */
gtk_drag_get_data( m_dragWidget,
m_dragContext,
format.GetAtom(),
m_dragTime );
gtk_drag_get_data( m_dragWidget,
m_dragContext,
format.GetAtom(),
m_dragTime );
return TRUE;
}
bool wxDropTarget::IsSupported( wxDataFormat format )
{
{
if (!m_dragContext) return FALSE;
GList *child = m_dragContext->targets;
while (child)
{
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
// char *name = gdk_atom_name( formatAtom );
// if (name) printf( "Format available: %s.\n", name );
if (formatAtom == format.GetAtom()) return TRUE;
child = child->next;
}
return FALSE;
}
bool wxDropTarget::GetData( wxDataObject *data_object )
{
if (!m_dragData) return FALSE;
if (m_dragData->target != data_object->GetFormat().GetAtom()) return FALSE;
if (data_object->GetFormat().GetType() == wxDF_TEXT)
{
wxTextDataObject *text_object = (wxTextDataObject*)data_object;
text_object->SetText( (const char*)m_dragData->data );
} else
if (data_object->GetFormat().GetType() == wxDF_FILENAME)
{
} else
if (data_object->GetFormat().GetType() == wxDF_PRIVATE)
{
wxPrivateDataObject *priv_object = (wxPrivateDataObject*)data_object;
priv_object->SetData( (const char*)m_dragData->data, (size_t)m_dragData->length );
wxPrivateDataObject *priv_object = (wxPrivateDataObject*)data_object;
priv_object->SetData( (const char*)m_dragData->data, (size_t)m_dragData->length );
}
return TRUE;
}
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
{
wxCHECK_RET( widget != NULL, _T("unregister widget is NULL") );
gtk_drag_dest_unset( widget );
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
}
void wxDropTarget::RegisterWidget( GtkWidget *widget )
{
wxCHECK_RET( widget != NULL, _T("register widget is NULL") );
/* gtk_drag_dest_set() determines what default behaviour we'd like
GTK to supply. we don't want to specify out targets (=formats)
or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
not GTK_DEST_DEFAULT_DROP). instead we react individually to
"drag_motion" and "drag_drop" events. this makes it possible
to allow dropping on only a small area. we should set
to allow dropping on only a small area. we should set
GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
highlighting if dragging over standard controls, but this
seems to be broken without the other two. */
gtk_drag_dest_set( widget,
(GtkDestDefaults) 0, /* no default behaviour */
(GtkTargetEntry*) NULL, /* we don't supply any formats here */
0, /* number of targets = 0 */
(GdkDragAction) 0 ); /* we don't supply any actions here */
(GtkDestDefaults) 0, /* no default behaviour */
(GtkTargetEntry*) NULL, /* we don't supply any formats here */
0, /* number of targets = 0 */
(GdkDragAction) 0 ); /* we don't supply any actions here */
gtk_signal_connect( GTK_OBJECT(widget), "drag_leave",
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
gtk_signal_connect( GTK_OBJECT(widget), "drag_motion",
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
gtk_signal_connect( GTK_OBJECT(widget), "drag_drop",
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
gtk_signal_connect( GTK_OBJECT(widget), "drag_data_received",
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
}
//-------------------------------------------------------------------------
@@ -482,9 +482,9 @@ bool wxTextDropTarget::OnDrop( int WXUNUSED(x), int WXUNUSED(y) )
if (IsSupported( wxDF_TEXT ))
{
RequestData( wxDF_TEXT );
return TRUE;
return TRUE;
}
return FALSE;
}
@@ -492,9 +492,9 @@ bool wxTextDropTarget::OnData( int x, int y )
{
wxTextDataObject data;
if (!GetData( &data )) return FALSE;
OnDropText( x, y, data.GetText() );
return TRUE;
}
@@ -520,23 +520,23 @@ bool wxPrivateDropTarget::OnMove( int WXUNUSED(x), int WXUNUSED(y) )
bool wxPrivateDropTarget::OnDrop( int WXUNUSED(x), int WXUNUSED(y) )
{
if (!IsSupported( m_id ))
{
{
RequestData( m_id );
return FALSE;
}
return FALSE;
}
bool wxPrivateDropTarget::OnData( int x, int y )
{
if (!IsSupported( m_id )) return FALSE;
wxPrivateDataObject data;
if (!GetData( &data )) return FALSE;
OnDropData( x, y, data.GetData(), data.GetSize() );
return TRUE;
}
@@ -554,9 +554,9 @@ bool wxFileDropTarget::OnDrop( int x, int y )
if (IsSupported( wxDF_FILENAME ))
{
RequestData( wxDF_FILENAME );
return TRUE;
return TRUE;
}
return FALSE;
}
@@ -574,9 +574,9 @@ bool wxFileDropTarget::OnData( int x, int y )
if (text[i] == 0) number++;
if (number == 0) return FALSE;
wxChar **files = new wxChar*[number];
text = WXSTRINGCAST data.GetFiles();
for (i = 0; i < number; i++)
{
@@ -585,10 +585,10 @@ bool wxFileDropTarget::OnData( int x, int y )
text += len+1;
}
OnDropFiles( x, y, number, files );
OnDropFiles( x, y, number, files );
free( files );
return TRUE;
}
@@ -596,13 +596,13 @@ bool wxFileDropTarget::OnData( int x, int y )
// "drag_data_get"
//----------------------------------------------------------------------------
static void
static void
source_drag_data_get (GtkWidget *WXUNUSED(widget),
GdkDragContext *context,
GtkSelectionData *selection_data,
guint WXUNUSED(info),
guint WXUNUSED(time),
wxDropSource *drop_source )
GdkDragContext *context,
GtkSelectionData *selection_data,
guint WXUNUSED(info),
guint WXUNUSED(time),
wxDropSource *drop_source )
{
if (g_isIdle) wxapp_install_idle_handler();
@@ -610,52 +610,52 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
// char *name = gdk_atom_name( selection_data->target );
// if (name) printf( "Format requested: %s.\n", name );
wxNode *node = drop_source->m_data->m_dataObjects.First();
while (node)
{
wxDataObject *data_object = (wxDataObject*) node->Data();
if (data_object->GetFormat().GetAtom() == selection_data->target)
{
// printf( "format found.\n" );
size_t data_size = data_object->GetSize();
if (data_size > 0)
{
// printf( "data size: %d.\n", (int)data_size );
guchar *buffer = new guchar[data_size];
data_object->WriteData( buffer );
if (data_object->GetFormat().GetAtom() == selection_data->target)
{
// printf( "format found.\n" );
size_t data_size = data_object->GetSize();
if (data_size > 0)
{
// printf( "data size: %d.\n", (int)data_size );
guchar *buffer = new guchar[data_size];
data_object->WriteData( buffer );
gtk_selection_data_set( selection_data,
selection_data->target,
8, // 8-bit
buffer,
data_size );
free( buffer );
/* so far only copy, no moves. TODO. */
selection_data->target,
8, // 8-bit
buffer,
data_size );
free( buffer );
/* so far only copy, no moves. TODO. */
drop_source->m_retValue = wxDragCopy;
return;
}
}
return;
}
}
node = node->Next();
}
drop_source->m_retValue = wxDragCancel;
}
//----------------------------------------------------------------------------
// "drag_data_delete"
//----------------------------------------------------------------------------
static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source )
GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source )
{
if (g_isIdle) wxapp_install_idle_handler();
@@ -663,27 +663,27 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
drop_source->m_retValue = wxDragMove;
}
//----------------------------------------------------------------------------
// "drag_begin"
//----------------------------------------------------------------------------
static void source_drag_begin( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context),
wxDropSource *WXUNUSED(drop_source) )
GdkDragContext *WXUNUSED(context),
wxDropSource *WXUNUSED(drop_source) )
{
if (g_isIdle) wxapp_install_idle_handler();
// printf( "drag_begin.\n" );
}
//----------------------------------------------------------------------------
// "drag_end"
//----------------------------------------------------------------------------
static void source_drag_end( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source )
GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source )
{
if (g_isIdle) wxapp_install_idle_handler();
@@ -691,7 +691,7 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget),
drop_source->m_waiting = FALSE;
}
//---------------------------------------------------------------------------
// wxDropSource
//---------------------------------------------------------------------------
@@ -700,17 +700,17 @@ wxDropSource::wxDropSource( wxWindow *win, const wxIcon &go, const wxIcon &stop
{
g_blockEventsOnDrag = TRUE;
m_waiting = TRUE;
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_widget = win->GetWidget();
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
m_data = (wxDataBroker*) NULL;
m_retValue = wxDragCancel;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
m_goIcon = go;
if (wxNullIcon == go) m_goIcon = wxIcon( page_xpm );
m_stopIcon = stop;
@@ -720,16 +720,16 @@ wxDropSource::wxDropSource( wxWindow *win, const wxIcon &go, const wxIcon &stop
wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go, const wxIcon &stop )
{
m_waiting = TRUE;
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_widget = win->GetWidget();
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
m_retValue = wxDragCancel;
if (data)
{
m_data = new wxDataBroker();
m_data->Add( data );
m_data->Add( data );
}
else
{
@@ -738,7 +738,7 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go,
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
m_goIcon = go;
if (wxNullIcon == go) m_goIcon = wxIcon( page_xpm );
m_stopIcon = stop;
@@ -748,10 +748,10 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go,
wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
{
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_widget = win->GetWidget();
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
m_retValue = wxDragCancel;
m_data = data;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
@@ -761,11 +761,11 @@ wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
void wxDropSource::SetData( wxDataObject *data )
{
if (m_data) delete m_data;
if (data)
{
m_data = new wxDataBroker();
m_data->Add( data );
m_data->Add( data );
}
else
{
@@ -776,7 +776,7 @@ void wxDropSource::SetData( wxDataObject *data )
void wxDropSource::SetData( wxDataBroker *data )
{
if (m_data) delete m_data;
m_data = data;
}
@@ -786,17 +786,17 @@ wxDropSource::~wxDropSource(void)
g_blockEventsOnDrag = FALSE;
}
wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{
wxASSERT_MSG( m_data, _T("wxDragSource: no data") );
if (!m_data) return (wxDragResult) wxDragNone;
g_blockEventsOnDrag = TRUE;
RegisterWindow();
m_waiting = TRUE;
GdkAtom atom = gdk_atom_intern( "STRING", FALSE );
@@ -804,7 +804,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
gtk_target_list_add( target_list, atom, 0, 0 );
GdkEventMotion event;
event.window = m_widget->window;
int x = 0;
@@ -815,7 +815,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
event.y = y;
event.state = state;
event.time = GDK_CURRENT_TIME;
/* GTK wants to know which button was pressed which caused the dragging */
int button_number = 0;
if (event.state & GDK_BUTTON1_MASK) button_number = 1;
@@ -827,27 +827,27 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{
GdkDragContext *context = gtk_drag_begin( m_widget,
target_list,
GDK_ACTION_COPY,
button_number, /* number of mouse button which started drag */
(GdkEvent*) &event );
GDK_ACTION_COPY,
button_number, /* number of mouse button which started drag */
(GdkEvent*) &event );
wxMask *mask = m_goIcon.GetMask();
GdkBitmap *bm = (GdkBitmap *) NULL;
if (mask) bm = mask->GetBitmap();
GdkPixmap *pm = m_goIcon.GetPixmap();
GdkPixmap *pm = m_goIcon.GetPixmap();
gtk_drag_set_icon_pixmap( context,
gtk_widget_get_colormap( m_widget ),
pm,
bm,
0,
0 );
gtk_widget_get_colormap( m_widget ),
pm,
bm,
0,
0 );
while (m_waiting) gtk_main_iteration();;
}
g_blockEventsOnDrag = FALSE;
UnregisterWindow();
return m_retValue;
@@ -856,30 +856,30 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
void wxDropSource::RegisterWindow()
{
if (!m_widget) return;
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_data_get",
GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this);
GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this);
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_data_delete",
GTK_SIGNAL_FUNC (source_drag_data_delete), (gpointer) this );
GTK_SIGNAL_FUNC (source_drag_data_delete), (gpointer) this );
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_begin",
GTK_SIGNAL_FUNC (source_drag_begin), (gpointer) this );
GTK_SIGNAL_FUNC (source_drag_begin), (gpointer) this );
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_end",
GTK_SIGNAL_FUNC (source_drag_end), (gpointer) this );
GTK_SIGNAL_FUNC (source_drag_end), (gpointer) this );
}
void wxDropSource::UnregisterWindow()
{
if (!m_widget) return;
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
GTK_SIGNAL_FUNC(source_drag_data_get), (gpointer) this );
GTK_SIGNAL_FUNC(source_drag_data_get), (gpointer) this );
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
GTK_SIGNAL_FUNC(source_drag_data_delete), (gpointer) this );
GTK_SIGNAL_FUNC(source_drag_data_delete), (gpointer) this );
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
GTK_SIGNAL_FUNC(source_drag_begin), (gpointer) this );
GTK_SIGNAL_FUNC(source_drag_begin), (gpointer) this );
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
GTK_SIGNAL_FUNC(source_drag_end), (gpointer) this );
GTK_SIGNAL_FUNC(source_drag_end), (gpointer) this );
}
#endif

View File

@@ -57,7 +57,7 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial
int style = dialog->GetStyle();
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->GetHandle());
char *filename = gtk_file_selection_get_filename(filedlg);
if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) )

View File

@@ -159,12 +159,12 @@ wxFont& wxFont::operator = ( const wxFont& font )
return *this;
}
bool wxFont::operator == ( const wxFont& font )
bool wxFont::operator == ( const wxFont& font ) const
{
return m_refData == font.m_refData;
}
bool wxFont::operator != ( const wxFont& font )
bool wxFont::operator != ( const wxFont& font ) const
{
return m_refData != font.m_refData;
}

View File

@@ -73,11 +73,9 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
printf( ".\n" );
*/
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
{
win->m_sizeSet = FALSE;
win->m_width = alloc->width;
win->m_height = alloc->height;
win->InternalSetSize( alloc->width, alloc->height );
}
}
@@ -112,7 +110,7 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
if (!win->HasVMT()) return;
win->m_menuBarDetached = FALSE;
win->m_sizeSet = FALSE;
win->UpdateSize();
}
//-----------------------------------------------------------------------------
@@ -126,7 +124,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
if (!win->HasVMT()) return;
win->m_menuBarDetached = TRUE;
win->m_sizeSet = FALSE;
win->UpdateSize();
}
//-----------------------------------------------------------------------------
@@ -140,7 +138,7 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
if (!win->HasVMT()) return;
win->m_toolBarDetached = FALSE;
win->m_sizeSet = FALSE;
win->UpdateSize();
}
//-----------------------------------------------------------------------------
@@ -154,7 +152,7 @@ static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSE
if (!win->HasVMT()) return;
win->m_toolBarDetached = TRUE;
win->m_sizeSet = FALSE;
win->UpdateSize();
}
//-----------------------------------------------------------------------------
@@ -167,10 +165,9 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
win->m_y = event->y;
win->InternalSetPosition(event->x, event->y);
wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
mevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( mevent );
@@ -194,60 +191,60 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
long decor = (long) GDK_DECOR_BORDER;
long func = (long) GDK_FUNC_MOVE;
if ((win->m_windowStyle & wxCAPTION) != 0)
decor |= GDK_DECOR_TITLE;
if ((win->m_windowStyle & wxSYSTEM_MENU) != 0)
if ((win->GetWindowStyle() & wxCAPTION) != 0)
decor |= GDK_DECOR_TITLE;
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
{
decor |= GDK_DECOR_MENU;
func |= GDK_FUNC_CLOSE;
}
if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0)
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
{
func |= GDK_FUNC_MINIMIZE;
decor |= GDK_DECOR_MINIMIZE;
func |= GDK_FUNC_MINIMIZE;
decor |= GDK_DECOR_MINIMIZE;
}
if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0)
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
{
func |= GDK_FUNC_MAXIMIZE;
decor |= GDK_DECOR_MAXIMIZE;
func |= GDK_FUNC_MAXIMIZE;
decor |= GDK_DECOR_MAXIMIZE;
}
if ((win->m_windowStyle & wxRESIZE_BORDER) != 0)
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
{
func |= GDK_FUNC_RESIZE;
decor |= GDK_DECOR_RESIZEH;
}
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
/* GTK's shrinking/growing policy */
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
/* reset the icon */
if (win->m_icon != wxNullIcon)
{
wxIcon icon( win->m_icon );
win->m_icon = wxNullIcon;
win->SetIcon( icon );
win->SetIcon( icon );
}
/* we set the focus to the child that accepts the focus. this
doesn't really have to be done in "realize" but why not? */
wxNode *node = win->m_children.First();
wxWindowList::Node *node = win->GetChildren().GetFirst();
while (node)
{
wxWindow *child = (wxWindow*) node->Data();
if (child->AcceptsFocus())
{
child->SetFocus();
break;
}
node = node->Next();
wxWindow *child = node->GetData();
if (child->AcceptsFocus())
{
child->SetFocus();
break;
}
node = node->GetNext();
}
return FALSE;
@@ -267,45 +264,45 @@ static void wxInsertChildInFrame( wxWindow* parent, wxWindow* child )
if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar))
{
/* actually, menubars are never inserted here, but this
may change one day */
may change one day */
/* these are outside the client area */
wxFrame* frame = (wxFrame*) parent;
wxFrame* frame = (wxFrame*) parent;
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
GTK_WIDGET(child->m_widget),
child->m_x,
child->m_y,
child->m_width,
child->m_height );
/* we connect to these events for recalculating the client area
space when the toolbar is floating */
if (wxIS_KIND_OF(child,wxToolBar))
{
wxToolBar *toolBar = (wxToolBar*) child;
if (toolBar->m_windowStyle & wxTB_DOCKABLE)
{
gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
GTK_WIDGET(child->GetHandle()),
child->GetX(),
child->GetY(),
child->GetWidth(),
child->GetHeight() );
/* we connect to these events for recalculating the client area
space when the toolbar is floating */
if (wxIS_KIND_OF(child,wxToolBar))
{
wxToolBar *toolBar = (wxToolBar*) child;
if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
{
gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_attached",
GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_detached",
GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
}
}
}
}
}
else
{
/* these are inside the client area */
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
child->m_x,
child->m_y,
child->m_width,
child->m_height );
gtk_myfixed_put( GTK_MYFIXED(parent->GetWxWindow()),
GTK_WIDGET(child->GetHandle()),
child->GetX(),
child->GetY(),
child->GetWidth(),
child->GetHeight() );
}
/* resize on OnInternalIdle */
parent->m_sizeSet = FALSE;
parent->UpdateSize();
}
//-----------------------------------------------------------------------------
@@ -413,7 +410,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
/* we cannot set MWM hints and icons before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
/* the user resized the frame by dragging etc. */
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
@@ -523,15 +520,15 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_x != old_x) || (m_y != old_y))
{
/* we set the size here and in gtk_frame_map_callback */
gtk_widget_set_uposition( m_widget, m_x, m_y );
gtk_widget_set_uposition( m_widget, m_x, m_y );
}
}
if ((m_width != old_width) || (m_height != old_height))
{
/* we set the size in GtkOnSize, i.e. mostly the actual resizing is
done either directly before the frame is shown or in idle time
so that different calls to SetSize() don't lead to flicker. */
done either directly before the frame is shown or in idle time
so that different calls to SetSize() don't lead to flicker. */
m_sizeSet = FALSE;
}
@@ -560,30 +557,30 @@ void wxFrame::GetClientSize( int *width, int *height ) const
{
/* menu bar */
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
(*height) -= wxMENU_HEIGHT;
else
(*height) -= wxPLACE_HOLDER;
}
/* status bar */
{
if (!m_menuBarDetached)
(*height) -= wxMENU_HEIGHT;
else
(*height) -= wxPLACE_HOLDER;
}
/* status bar */
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
/* tool bar */
/* tool bar */
if (m_frameToolBar)
{
if (!m_toolBarDetached)
{
if (!m_toolBarDetached)
{
int y = 0;
m_frameToolBar->GetSize( (int *) NULL, &y );
(*height) -= y;
}
else
}
else
(*height) -= wxPLACE_HOLDER;
}
/* mini edge */
/* mini edge */
(*height) -= m_miniEdge*2 + m_miniTitle;
}
if (width)
@@ -598,29 +595,29 @@ void wxFrame::DoSetClientSize( int width, int height )
/* menu bar */
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
height += wxMENU_HEIGHT;
else
height += wxPLACE_HOLDER;
}
/* status bar */
{
if (!m_menuBarDetached)
height += wxMENU_HEIGHT;
else
height += wxPLACE_HOLDER;
}
/* status bar */
if (m_frameStatusBar) height += wxSTATUS_HEIGHT;
/* tool bar */
/* tool bar */
if (m_frameToolBar)
{
if (!m_toolBarDetached)
{
if (!m_toolBarDetached)
{
int y = 0;
m_frameToolBar->GetSize( (int *) NULL, &y );
height += y;
}
else
}
else
height += wxPLACE_HOLDER;
}
wxWindow::DoSetClientSize( width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle );
}
@@ -670,15 +667,13 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT;
if (m_menuBarDetached) hh = wxPLACE_HOLDER;
m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww;
m_frameMenuBar->m_height = hh;
if (m_menuBarDetached) hh = wxPLACE_HOLDER;
m_frameMenuBar->InternalSetPosition(xx, yy);
m_frameMenuBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
m_frameMenuBar->m_widget,
xx, yy, ww, hh );
client_area_y_offset += hh;
m_frameMenuBar->GetHandle(),
xx, yy, ww, hh );
client_area_y_offset += hh;
}
if (m_frameToolBar)
@@ -686,37 +681,40 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
yy += wxMENU_HEIGHT;
else
yy += wxPLACE_HOLDER;
}
{
if (!m_menuBarDetached)
yy += wxMENU_HEIGHT;
else
yy += wxPLACE_HOLDER;
}
int ww = m_width - 2*m_miniEdge;
int hh = m_frameToolBar->m_height;
if (m_toolBarDetached) hh = wxPLACE_HOLDER;
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
/* m_frameToolBar->m_height = hh; don't change the toolbar's height */
m_frameToolBar->m_width = ww;
int hh = m_frameToolBar->GetHeight();
// VZ: according to earlier comments in this file, the tbar height
// shouldn't be changed, so I comment out the next line
// (09.05.99)
//if (m_toolBarDetached) hh = wxPLACE_HOLDER;
m_frameToolBar->InternalSetPosition(xx, yy);
m_frameToolBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
m_frameToolBar->m_widget,
xx, yy, ww, hh );
client_area_y_offset += hh;
m_frameToolBar->GetHandle(),
xx, yy, ww, hh );
client_area_y_offset += hh;
}
int client_x = m_miniEdge;
int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
int client_w = m_width - 2*m_miniEdge;
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
m_wxwindow,
client_x, client_y, client_w, client_h );
m_wxwindow,
client_x, client_y, client_w, client_h );
}
else
{
/* if there is no m_mainWidget between m_widget and m_wxwindow there
is no need to set the size or position of m_wxwindow. */
is no need to set the size or position of m_wxwindow. */
}
if (m_frameStatusBar)
@@ -725,13 +723,11 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
int ww = m_width - 2*m_miniEdge;
int hh = wxSTATUS_HEIGHT;
m_frameStatusBar->m_x = xx;
m_frameStatusBar->m_y = yy;
m_frameStatusBar->m_width = ww;
m_frameStatusBar->m_height = hh;
m_frameStatusBar->InternalSetPosition(xx, yy);
m_frameStatusBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
m_frameStatusBar->m_widget,
xx, yy, ww, hh );
m_frameStatusBar->GetHandle(),
xx, yy, ww, hh );
}
/* we actually set the size of a frame here and no-where else */
@@ -747,7 +743,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
/* send size event to status bar */
if (m_frameStatusBar)
{
wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
wxSizeEvent event2( wxSize(m_frameStatusBar->GetWidth(),m_frameStatusBar->GetHeight()), m_frameStatusBar->GetId() );
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
@@ -812,7 +808,7 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
#if (GTK_MINOR_VERSION > 0)
/* support for native hot keys */
gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->m_widget));
gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->GetHandle()));
#endif
wxNode *node = menu->GetItems().First();
@@ -847,24 +843,24 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
node = node->Next();
}
if (m_frameMenuBar->m_parent != this)
if (m_frameMenuBar->GetParent() != this)
{
m_frameMenuBar->m_parent = this;
m_frameMenuBar->SetParent(this);
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
m_frameMenuBar->m_widget,
m_frameMenuBar->m_x,
m_frameMenuBar->m_y,
m_frameMenuBar->m_width,
m_frameMenuBar->m_height );
if (menuBar->m_windowStyle & wxMB_DOCKABLE)
{
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
m_frameMenuBar->GetHandle(),
m_frameMenuBar->GetX(),
m_frameMenuBar->GetY(),
m_frameMenuBar->GetWidth(),
m_frameMenuBar->GetHeight() );
if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
{
gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_attached",
GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_detached",
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
}
}
}
}

View File

@@ -37,9 +37,7 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
m_widget = gtk_progress_bar_new();
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();

View File

@@ -282,9 +282,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
gtk_widget_show( list_item );
}
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -419,7 +417,7 @@ void wxListBox::AppendCommon( const wxString &item )
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
if (GetWindowStyleFlag() & wxLB_MULTIPLE)
if (HasFlag(wxLB_MULTIPLE))
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
@@ -454,7 +452,7 @@ void wxListBox::AppendCommon( const wxString &item )
#endif
#if wxUSE_TOOLTIPS
if (m_toolTip) m_toolTip->Apply( this );
if (m_tooltip) m_tooltip->Apply( this );
#endif
}
}
@@ -858,9 +856,12 @@ void wxListBox::ApplyWidgetStyle()
if (m_backgroundColour.Ok())
{
GdkWindow *window = GTK_WIDGET(m_list)->window;
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
if ( window )
{
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
}
}
GList *child = m_list->children;

View File

@@ -90,15 +90,13 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
wxMenuBar *menu_bar = child_frame->m_menuBar;
if (!menu_bar) return;
if (!menu_bar->m_widget) return;
if (!menu_bar->GetHandle()) return;
menu_bar->m_x = 0;
menu_bar->m_y = 0;
menu_bar->m_width = m_width;
menu_bar->m_height = wxMENU_HEIGHT;
menu_bar->InternalSetPosition(0, 0);
menu_bar->InternalSetSize(m_width, wxMENU_HEIGHT);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
menu_bar->GetHandle(),
0, 0, m_width, wxMENU_HEIGHT );
}
void wxMDIParentFrame::OnInternalIdle()
@@ -110,7 +108,7 @@ void wxMDIParentFrame::OnInternalIdle()
if (m_justInserted)
{
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
m_justInserted = FALSE;
@@ -122,19 +120,19 @@ void wxMDIParentFrame::OnInternalIdle()
wxMDIChildFrame *active_child_frame = GetActiveChild();
bool visible_child_menu = FALSE;
wxNode *node = m_clientWindow->m_children.First();
wxNode *node = m_clientWindow->GetChildren().First();
while (node)
{
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
if (child_frame->m_menuBar)
{
if (child_frame == active_child_frame)
{
gtk_widget_show( child_frame->m_menuBar->m_widget );
visible_child_menu = TRUE;
}
{
gtk_widget_show( child_frame->m_menuBar->GetHandle() );
visible_child_menu = TRUE;
}
else
gtk_widget_hide( child_frame->m_menuBar->m_widget );
gtk_widget_hide( child_frame->m_menuBar->GetHandle() );
}
node = node->Next();
}
@@ -152,7 +150,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
{
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
if (!notebook) return (wxMDIChildFrame*) NULL;
#if (GTK_MINOR_VERSION > 0)
@@ -165,7 +163,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
if (!page) return (wxMDIChildFrame*) NULL;
wxNode *node = m_clientWindow->m_children.First();
wxNode *node = m_clientWindow->GetChildren().First();
while (node)
{
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
@@ -191,13 +189,13 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
void wxMDIParentFrame::ActivateNext()
{
if (m_clientWindow)
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
}
void wxMDIParentFrame::ActivatePrevious()
{
if (m_clientWindow)
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
}
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
@@ -279,9 +277,9 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
if (m_menuBar)
{
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->GetParent();
if (m_menuBar->m_parent != this)
if (m_menuBar->GetParent() != this)
{
wxNode *node = m_menuBar->GetMenus().First();
while (node)
@@ -291,16 +289,16 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
node = node->Next();
}
m_menuBar->m_parent = mdi_frame;
m_menuBar->SetParent( mdi_frame );
}
/* the menu bar of the child window is shown in idle time as needed */
gtk_widget_hide( m_menuBar->m_widget );
gtk_widget_hide( m_menuBar->GetHandle() );
/* insert the invisible menu bar into the _parent_ mdi frame */
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget),
m_menuBar->m_widget,
0, 0, mdi_frame->m_width, wxMENU_HEIGHT );
m_menuBar->GetHandle(),
0, 0, mdi_frame->GetWidth(), wxMENU_HEIGHT );
}
}
@@ -325,11 +323,11 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
{
if (g_isIdle) wxapp_install_idle_handler();
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
(win->m_height == alloc->height) &&
(win->m_sizeSet))
if ((win->GetX() == alloc->x) &&
(win->GetY() == alloc->y) &&
(win->GetWidth() == alloc->width) &&
(win->GetHeight() == alloc->height) &&
(win->IsSizeSet()))
{
return;
}
@@ -349,16 +347,16 @@ static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* chil
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
gtk_signal_connect( GTK_OBJECT(child->GetHandle()), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetHandle());
gtk_notebook_append_page( notebook, child->m_widget, label_widget );
gtk_notebook_append_page( notebook, child->GetHandle(), label_widget );
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->m_parent;
wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->GetParent();
parent_frame->m_justInserted = TRUE;
}
@@ -393,9 +391,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -404,5 +400,3 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
return TRUE;
}

View File

@@ -70,34 +70,34 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
win->m_width, win->m_height );
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
win->GetWidth(), win->GetHeight() );
if (!win->m_title.IsEmpty() &&
((win->m_windowStyle & wxCAPTION) ||
(win->m_windowStyle & wxTINY_CAPTION_HORIZ) ||
(win->m_windowStyle & wxTINY_CAPTION_VERT)))
((win->GetWindowStyle() & wxCAPTION) ||
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
{
GdkGC *gc = gdk_gc_new( widget->window );
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
int x = 2;
if (win->m_windowStyle & wxSYSTEM_MENU) x = 18;
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
int x = 2;
if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 18;
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
win->m_width - 4 - x,
font->ascent + font->descent+1 );
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
win->GetWidth() - 4 - x,
font->ascent + font->descent+1 );
gdk_gc_set_foreground( gc, &widget->style->white );
gdk_draw_string( widget->window, font, gc,
x+2,
3+font->ascent,
win->m_title.mb_str() );
x+2,
3+font->ascent,
win->m_title.mb_str() );
gdk_gc_unref( gc );
}
}
@@ -114,34 +114,34 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
win->m_width, win->m_height );
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
win->GetWidth(), win->GetHeight() );
if (!win->m_title.IsEmpty() &&
((win->m_windowStyle & wxCAPTION) ||
(win->m_windowStyle & wxTINY_CAPTION_HORIZ) ||
(win->m_windowStyle & wxTINY_CAPTION_VERT)))
((win->GetWindowStyle() & wxCAPTION) ||
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
{
GdkGC *gc = gdk_gc_new( widget->window );
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
int x = 2;
if (win->m_windowStyle & wxSYSTEM_MENU) x = 17;
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
int x = 2;
if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 17;
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
win->m_width - 4 - x,
font->ascent + font->descent+1 );
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
win->GetWidth() - 4 - x,
font->ascent + font->descent+1 );
gdk_gc_set_foreground( gc, &widget->style->white );
gdk_draw_string( widget->window, font, gc,
x+2,
3+font->ascent,
win->m_title.mb_str() );
x+2,
3+font->ascent,
win->m_title.mb_str() );
gdk_gc_unref( gc );
}
}
@@ -164,17 +164,17 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
(GdkEventMask)
(GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_BUTTON1_MOTION_MASK),
(GdkWindow *) NULL,
(GdkCursor *) NULL,
GDK_CURRENT_TIME );
win->m_diffX = (int)gdk_event->x;
win->m_diffY = (int)gdk_event->y;
DrawFrame( widget, 0, 0, win->m_width, win->m_height );
DrawFrame( widget, 0, 0, win->GetWidth(), win->GetHeight() );
win->m_oldX = 0;
win->m_oldY = 0;
@@ -202,16 +202,15 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
int x = (int)gdk_event->x;
int y = (int)gdk_event->y;
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
int org_x = 0;
int org_y = 0;
gdk_window_get_origin( widget->window, &org_x, &org_y );
x += org_x - win->m_diffX;
y += org_y - win->m_diffY;
win->m_x = x;
win->m_y = y;
gtk_widget_set_uposition( win->m_widget, x, y );
win->InternalSetPosition(x, y);
gtk_widget_set_uposition( win->GetWidget(), x, y );
return TRUE;
}
@@ -241,10 +240,10 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
gdk_event->state = state;
}
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
win->m_oldX = (int)gdk_event->x - win->m_diffX;
win->m_oldY = (int)gdk_event->y - win->m_diffY;
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
return TRUE;
}
@@ -274,7 +273,7 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
m_miniTitle = 13;
m_miniEdge = 3;
m_isDragging = FALSE;
m_oldX = -1;
@@ -290,8 +289,8 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
GtkWidget *close_button = gtk_button_new_with_label( "x" );
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
close_button,
4, 4, 12, 11 );
close_button,
4, 4, 12, 11 );
gtk_widget_show( close_button );

View File

@@ -125,10 +125,10 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
{
if (g_isIdle) wxapp_install_idle_handler();
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
(win->m_height == alloc->height))
if ((win->GetX() == alloc->x) &&
(win->GetY() == alloc->y) &&
(win->GetWidth() == alloc->width) &&
(win->GetHeight() == alloc->height))
{
return;
}
@@ -188,16 +188,16 @@ static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child )
page->m_box = gtk_hbox_new (FALSE, 0);
gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetWidget());
page->m_client = child;
gtk_notebook_append_page( notebook, child->m_widget, page->m_box );
gtk_notebook_append_page( notebook, child->GetWidget(), page->m_box );
page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
page->m_parent = notebook;
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
gtk_signal_connect( GTK_OBJECT(child->GetWidget()), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
wxASSERT_MSG( page->m_page, _T("Notebook page creation error") );
@@ -267,9 +267,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback),
(gpointer)this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );

View File

@@ -68,7 +68,7 @@ BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
EVT_SIZE(wxRadioBox::OnSize)
END_EVENT_TABLE()
wxRadioBox::wxRadioBox(void)
wxRadioBox::wxRadioBox()
{
}
@@ -108,9 +108,9 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow),
GTK_WIDGET(m_radio),
m_x+10, m_y+10+(i*24), 10, 10 );
gtk_myfixed_put( GTK_MYFIXED(m_parent->GetWxWindow()),
GTK_WIDGET(m_radio),
m_x+10, m_y+10+(i*24), 10, 10 );
}
wxSize ls = LayoutItems();
@@ -120,9 +120,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
if (newSize.y == -1) newSize.y = ls.y;
SetSize( newSize.x, newSize.y );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -137,7 +135,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
return TRUE;
}
wxRadioBox::~wxRadioBox(void)
wxRadioBox::~wxRadioBox()
{
wxNode *node = m_boxes.First();
while (node)
@@ -150,9 +148,9 @@ wxRadioBox::~wxRadioBox(void)
void wxRadioBox::OnSize( wxSizeEvent &event )
{
wxControl::OnSize( event );
LayoutItems();
event.Skip();
}
wxSize wxRadioBox::LayoutItems()
@@ -181,7 +179,7 @@ wxSize wxRadioBox::LayoutItems()
int len = 22+gdk_string_measure( font, label->label );
if (len > max_len) max_len = len;
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y );
y += 20;
node = node->Next();
@@ -195,7 +193,7 @@ wxSize wxRadioBox::LayoutItems()
{
GtkWidget *button = GTK_WIDGET( node->Data() );
gtk_myfixed_resize( GTK_MYFIXED(m_parent->m_wxwindow), button, max_len, 20 );
gtk_myfixed_resize( GTK_MYFIXED(m_parent->GetWxWindow()), button, max_len, 20 );
node = node->Next();
if (!node) break;
@@ -231,7 +229,7 @@ wxSize wxRadioBox::LayoutItems()
{
GtkWidget *button = GTK_WIDGET( node->Data() );
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, 20 );
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y, max, 20 );
x += max;
node = node->Next();
@@ -389,9 +387,10 @@ void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
wxFAIL_MSG(_T("wxRadioBox::SetLabel not implemented."));
}
void wxRadioBox::Enable( bool enable )
bool wxRadioBox::Enable( bool enable )
{
wxControl::Enable( enable );
if ( !wxControl::Enable( enable ) )
return FALSE;
wxNode *node = m_boxes.First();
while (node)
@@ -402,6 +401,8 @@ void wxRadioBox::Enable( bool enable )
gtk_widget_set_sensitive( label, enable );
node = node->Next();
}
return TRUE;
}
void wxRadioBox::Enable( int item, bool enable )

View File

@@ -91,9 +91,7 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -138,13 +136,14 @@ bool wxRadioButton::GetValue(void) const
return GTK_TOGGLE_BUTTON(m_widget)->active;
}
void wxRadioButton::Enable( bool enable )
bool wxRadioButton::Enable( bool enable )
{
wxCHECK_RET( m_widget != NULL, _T("invalid radiobutton") );
wxControl::Enable( enable );
if ( !wxControl::Enable( enable ) )
return FALSE;
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
return TRUE;
}
void wxRadioButton::ApplyWidgetStyle()

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -53,7 +53,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
float line_step = win->m_adjust->step_increment;
float page_step = win->m_adjust->page_increment;
if (win->m_isScrolling)
if (win->IsScrolling())
{
command = wxEVT_SCROLL_THUMBTRACK;
}
@@ -70,8 +70,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
int value = (int)(win->m_adjust->value+0.5);
int orient = wxHORIZONTAL;
if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
@@ -90,11 +89,11 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
wxScrollBar *win )
{
if (g_isIdle) wxapp_install_idle_handler();
win->m_isScrolling = TRUE;
win->SetScrolling(TRUE);
// g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
return FALSE;
@@ -106,11 +105,11 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
wxScrollBar *win )
{
if (g_isIdle) wxapp_install_idle_handler();
win->m_isScrolling = FALSE;
win->SetScrolling(FALSE);
// g_blockEventsOnScroll = FALSE;
gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
@@ -150,22 +149,20 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
gtk_signal_connect( GTK_OBJECT(m_adjust),
"value_changed",
(GtkSignalFunc) gtk_scrollbar_callback,
(gpointer) this );
(GtkSignalFunc) gtk_scrollbar_callback,
(gpointer) this );
gtk_signal_connect( GTK_OBJECT(m_widget),
"button_press_event",
(GtkSignalFunc)gtk_scrollbar_button_press_callback,
(gpointer) this );
(gpointer) this );
gtk_signal_connect( GTK_OBJECT(m_widget),
"button_release_event",
(GtkSignalFunc)gtk_scrollbar_button_release_callback,
(gpointer) this );
(gpointer) this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -299,9 +296,9 @@ bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window )
GtkRange *range = GTK_RANGE(m_widget);
return ( (window == GTK_WIDGET(range)->window) ||
(window == range->trough) ||
(window == range->slider) ||
(window == range->step_forw) ||
(window == range->step_back) );
(window == range->slider) ||
(window == range->step_forw) ||
(window == range->step_back) );
}
void wxScrollBar::ApplyWidgetStyle()

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -109,27 +109,27 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
if (style & wxSL_LABELS)
{
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
/* labels need more space and too small window will
cause junk to appear on the dialog */
/* labels need more space and too small window will
cause junk to appear on the dialog */
if (style & wxSL_VERTICAL)
{
wxSize sz( size );
if (sz.x < 35)
{
sz.x = 35;
SetSize( sz );
}
}
{
wxSize sz( size );
if (sz.x < 35)
{
sz.x = 35;
SetSize( sz );
}
}
else
{
wxSize sz( size );
if (sz.y < 35)
{
sz.y = 35;
SetSize( sz );
}
}
{
wxSize sz( size );
if (sz.y < 35)
{
sz.y = 35;
SetSize( sz );
}
}
}
else
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
@@ -138,15 +138,13 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
gtk_signal_connect( GTK_OBJECT(m_adjust),
"value_changed",
(GtkSignalFunc) gtk_slider_callback,
(gpointer) this );
(GtkSignalFunc) gtk_slider_callback,
(gpointer) this );
SetRange( minValue, maxValue );
SetValue( value );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -281,9 +279,9 @@ bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
GtkRange *range = GTK_RANGE(m_widget);
return ( (window == GTK_WIDGET(range)->window) ||
(window == range->trough) ||
(window == range->slider) ||
(window == range->step_forw) ||
(window == range->step_back) );
(window == range->slider) ||
(window == range->step_forw) ||
(window == range->step_back) );
}
void wxSlider::ApplyWidgetStyle()

View File

@@ -111,9 +111,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
(GtkSignalFunc) gtk_spinbutt_callback,
(gpointer) this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -60,9 +60,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
m_widget = gtk_label_new( "Bitmap" );
}
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();

View File

@@ -45,9 +45,7 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
m_widget = gtk_frame_new(m_label.mbc_str());
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -46,9 +46,7 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
else
m_widget = gtk_hseparator_new();
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();

View File

@@ -76,9 +76,7 @@ bool wxStaticText::Create(wxWindow *parent,
SetSize( newSize.x, newSize.y );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();

View File

@@ -65,29 +65,29 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
if (tool->m_enabled)
{
if (tb->m_fg->red != 0)
{
{
tb->m_fg->red = 0;
tb->m_fg->green = 0;
tb->m_fg->blue = 0;
gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg );
#if (GTK_MINOR_VERSION > 0)
GtkStyle *g_style =
gtk_style_copy(
gtk_widget_get_style(
GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window ) );
g_style->fg[GTK_STATE_NORMAL] = *tb->m_fg;
gtk_widget_set_style( GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window, g_style );
#else
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
#endif
}
}
}
else
{
if (tb->m_fg->red == 0)
{
{
tb->m_fg->red = 33000;
tb->m_fg->green = 33000;
tb->m_fg->blue = 33000;
@@ -97,13 +97,13 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
gtk_style_copy(
gtk_widget_get_style(
GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window ) );
g_style->fg[GTK_STATE_NORMAL] = *tb->m_fg;
gtk_widget_set_style( GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window, g_style );
#else
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
#endif
}
}
}
/* emit the event */
@@ -160,11 +160,11 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
if (style & wxTB_DOCKABLE)
{
m_widget = gtk_handle_box_new();
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
gtk_widget_show( GTK_WIDGET(m_toolbar) );
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
gtk_widget_show( GTK_WIDGET(m_toolbar) );
#if (GTK_MINOR_VERSION > 0)
if (style & wxTB_FLAT)
if (style & wxTB_FLAT)
gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
#endif
}
@@ -172,7 +172,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
{
m_widget = GTK_WIDGET(m_toolbar);
}
gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
#if (GTK_MINOR_VERSION > 0)
@@ -199,7 +199,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
gtk_style_copy(
gtk_widget_get_style(
GTK_TOOLBAR(m_toolbar)->tooltips->tip_window ) );
g_style->bg[GTK_STATE_NORMAL] = *m_bg;
gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style );
#else
@@ -209,9 +209,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
m_xMargin = 0;
m_yMargin = 0;
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -281,7 +279,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap,
toggle, clientData,
helpString1, helpString2,
tool_pixmap );
tool_pixmap );
GtkToolbarChildType ctype = toggle ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
: GTK_TOOLBAR_CHILD_BUTTON;
@@ -355,14 +353,14 @@ void wxToolBar::EnableTool(int toolIndex, bool enable)
if (tool->m_index == toolIndex)
{
tool->m_enabled = enable;
/* we don't disable the tools for now as the bitmaps don't get
greyed anyway and this also disables tooltips
if (tool->m_item)
gtk_widget_set_sensitive( tool->m_item, enable );
if (tool->m_item)
gtk_widget_set_sensitive( tool->m_item, enable );
*/
return;
}
node = node->Next();
@@ -511,7 +509,7 @@ void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString)
if (tool->m_index == toolIndex)
{
tool->m_longHelpString = helpString;
return;
return;
}
node = node->Next();
}
@@ -530,7 +528,7 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
if (tool->m_index == toolIndex)
{
tool->m_shortHelpString = helpString;
return;
return;
}
node = node->Next();
}

View File

@@ -46,11 +46,11 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!win->m_hasVMT) return;
if (!win->HasVMT()) return;
win->SetModified();
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
event.SetString( win->GetValue() );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
@@ -66,8 +66,8 @@ gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
if (g_isIdle) wxapp_install_idle_handler();
win->CalculateScrollbar();
if (!win->m_hasVMT) return;
if (!win->HasVMT()) return;
}
//-----------------------------------------------------------------------------
@@ -152,7 +152,6 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
/* ... and put into the upper left hand corner of the table */
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
@@ -160,13 +159,11 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
/* always wrap words */
gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
/* put the horizontal scrollbar in the lower left hand corner */
if (bHasHScrollbar)
{
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS );
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
GTK_FILL,
@@ -178,11 +175,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
#endif
}
/* finally, put the vertical scrollbar in the upper right corner */
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
GTK_FILL,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
@@ -200,9 +195,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
PostCreation();
@@ -948,46 +941,53 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
return (window == GTK_ENTRY(m_text)->text_area);
}
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
bool wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
// doesn't work
return FALSE;
}
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
bool wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
// doesn't work
return FALSE;
}
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
wxControl::SetBackgroundColour( colour );
if (!m_widget->window) return;
if (!m_widget->window)
return FALSE;
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
if (sysbg.Red() == colour.Red() &&
sysbg.Green() == colour.Green() &&
sysbg.Blue() == colour.Blue())
{
return;
return FALSE; // FIXME or TRUE?
}
if (!m_backgroundColour.Ok()) return;
if (!m_backgroundColour.Ok())
return FALSE;
if (m_windowStyle & wxTE_MULTILINE)
{
GdkWindow *window = GTK_TEXT(m_text)->text_area;
if (!window) return;
if (!window)
return FALSE;
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
}
return TRUE;
}
void wxTextCtrl::ApplyWidgetStyle()

View File

@@ -133,9 +133,7 @@ printf("5\n");
SetValidator(validator);
printf("Robert's new insertion code :-)\n");
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_parent->DoAddChild( this );
printf("postcreate\n");
PostCreation();

File diff suppressed because it is too large Load Diff