bool Destroy();
virtual bool Show( bool show );
- virtual void Centre( int direction = wxHORIZONTAL );
+ virtual void Centre( int direction = wxBOTH );
#if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
bool Destroy();
virtual bool Show( bool show );
- virtual void Centre( int direction = wxHORIZONTAL );
+ virtual void Centre( int direction = wxBOTH );
#if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
wxDefaultPosition, wxDefaultSize,
5, animals,
2, wxRA_SPECIFY_ROWS);
+
c = new wxLayoutConstraints;
c->left.SameAs(radiobox, wxLeft);
c->height.AsIs();
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
-/*
// send size event to status bar
if (m_frameStatusBar)
{
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
-*/
m_resizing = FALSE;
}
{
if (g_isIdle)
wxapp_install_idle_handler();
-
+
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
- if (win->GetAutoLayout()) win->Layout();
+ if (win->GetAutoLayout())
+ {
+ win->Layout();
+ }
+}
+
+//-----------------------------------------------------------------------------
+// "realize" from m_widget
+//-----------------------------------------------------------------------------
+
+/* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
+ here in order to take repositioning before showing to take effect. */
+
+static gint
+gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ gtk_widget_queue_resize( win->m_widget );
+
+ return FALSE;
}
//-----------------------------------------------------------------------------
PostCreation();
+ gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
+ GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
+
Show( TRUE );
return TRUE;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
gtk_widget_queue_resize (widget);
- break;
+ return;
}
}
}
myfixed = GTK_MYFIXED (widget);
- children = myfixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- gtk_myfixed_position_child (myfixed, child);
- gtk_myfixed_allocate_child (myfixed, child);
- }
-
widget->allocation = *allocation;
if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
gdk_window_move_resize( widget->window, x, y, w, h );
gdk_window_move_resize( myfixed->bin_window, 0, 0, w, h );
}
+
+ children = myfixed->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ gtk_myfixed_position_child (myfixed, child);
+ gtk_myfixed_allocate_child (myfixed, child);
+ }
}
static void
}
}
-/*
-static void
-gtk_myfixed_draw_border (GtkMyFixed *myfixed)
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET(myfixed);
-
- if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
- return;
-
- if (myfixed->shadow_type == GTK_MYSHADOW_OUT)
- {
- gtk_draw_shadow( widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_OUT,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height );
- return;
- }
-
- if (myfixed->shadow_type == GTK_MYSHADOW_IN)
- {
- gtk_draw_shadow( widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_IN,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height );
- return;
- }
-
- if (myfixed->shadow_type == GTK_MYSHADOW_THIN)
- {
- GdkGC *gc;
- gc = gdk_gc_new( widget->window );
- gdk_gc_set_foreground( gc, &widget->style->black );
- gdk_draw_rectangle( widget->window, gc, FALSE,
- 0, 0,
- widget->allocation.width-1,
- widget->allocation.height-1 );
- gdk_gc_unref( gc );
- return;
- }
-}
-*/
-
static gint
gtk_myfixed_expose (GtkWidget *widget,
GdkEventExpose *event)
GtkCallback callback,
gpointer callback_data)
{
- GtkMyFixed *myfixed;
- GtkMyFixedChild *child;
- GList *children;
+ GtkMyFixed *myfixed;
+ GtkMyFixedChild *child;
+ GList *children;
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_MYFIXED (container));
- g_return_if_fail (callback != NULL);
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_MYFIXED (container));
+ g_return_if_fail (callback != NULL);
- myfixed = GTK_MYFIXED (container);
+ myfixed = GTK_MYFIXED (container);
- children = myfixed->children;
- while (children)
+ children = myfixed->children;
+ while (children)
{
- child = children->data;
- children = children->next;
+ child = children->data;
+ children = children->next;
- (* callback) (child->widget, callback_data);
+ (* callback) (child->widget, callback_data);
}
}
gtk_myfixed_position_child (GtkMyFixed *myfixed,
GtkMyFixedChild *child)
{
- gint x;
- gint y;
+ gint x;
+ gint y;
- x = child->x - myfixed->xoffset;
- y = child->y - myfixed->yoffset;
+ x = child->x - myfixed->xoffset;
+ y = child->y - myfixed->yoffset;
- if (IS_ONSCREEN (x,y))
+ if (IS_ONSCREEN (x,y))
{
- if (GTK_WIDGET_MAPPED (myfixed) &&
+ if (GTK_WIDGET_MAPPED (myfixed) &&
GTK_WIDGET_VISIBLE (child->widget))
{
- if (!GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
+ if (!GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_map (child->widget);
}
- if (GTK_WIDGET_IS_OFFSCREEN (child->widget))
- GTK_PRIVATE_UNSET_FLAG (child->widget, GTK_IS_OFFSCREEN);
+ if (GTK_WIDGET_IS_OFFSCREEN (child->widget))
+ GTK_PRIVATE_UNSET_FLAG (child->widget, GTK_IS_OFFSCREEN);
}
- else
+ else
{
- if (!GTK_WIDGET_IS_OFFSCREEN (child->widget))
- GTK_PRIVATE_SET_FLAG (child->widget, GTK_IS_OFFSCREEN);
+ if (!GTK_WIDGET_IS_OFFSCREEN (child->widget))
+ GTK_PRIVATE_SET_FLAG (child->widget, GTK_IS_OFFSCREEN);
- if (GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
+ if (GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_unmap (child->widget);
}
}
gtk_myfixed_allocate_child (GtkMyFixed *myfixed,
GtkMyFixedChild *child)
{
- GtkAllocation allocation;
- GtkRequisition requisition;
-
- allocation.x = child->x - myfixed->xoffset;
- allocation.y = child->y - myfixed->yoffset;
- gtk_widget_get_child_requisition (child->widget, &requisition);
- allocation.width = requisition.width;
- allocation.height = requisition.height;
+ GtkAllocation allocation;
+ GtkRequisition requisition;
+
+ allocation.x = child->x - myfixed->xoffset;
+ allocation.y = child->y - myfixed->yoffset;
+ gtk_widget_get_child_requisition (child->widget, &requisition);
+ allocation.width = requisition.width;
+ allocation.height = requisition.height;
- gtk_widget_size_allocate (child->widget, &allocation);
+ gtk_widget_size_allocate (child->widget, &allocation);
}
static void
gtk_myfixed_position_children (GtkMyFixed *myfixed)
{
- GList *tmp_list;
+ GList *tmp_list;
- tmp_list = myfixed->children;
- while (tmp_list)
+ tmp_list = myfixed->children;
+ while (tmp_list)
{
- GtkMyFixedChild *child = tmp_list->data;
- tmp_list = tmp_list->next;
+ GtkMyFixedChild *child = tmp_list->data;
+ tmp_list = tmp_list->next;
- gtk_myfixed_position_child (myfixed, child);
+ gtk_myfixed_position_child (myfixed, child);
}
}
gtk_myfixed_adjust_allocations_recurse (GtkWidget *widget,
gpointer cb_data)
{
- GtkMyFixedAdjData *data = cb_data;
+ GtkMyFixedAdjData *data = cb_data;
- widget->allocation.x += data->dx;
- widget->allocation.y += data->dy;
+ widget->allocation.x += data->dx;
+ widget->allocation.y += data->dy;
- if (GTK_WIDGET_NO_WINDOW (widget) &&
- GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
+ if (GTK_WIDGET_NO_WINDOW (widget) && GTK_IS_CONTAINER (widget))
+ {
+ gtk_container_forall (GTK_CONTAINER (widget),
gtk_myfixed_adjust_allocations_recurse,
cb_data);
+ }
}
static void
#endif // GTK_MINOR_VERSION > 0
-
-//-----------------------------------------------------------------------------
-// "size_allocate"
-//-----------------------------------------------------------------------------
-
-static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
-{
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- if (!win->m_hasVMT)
- return;
-
- if (win->m_sizeSet)
- return;
-
- win->m_sizeSet = TRUE;
-
-/*
- wxPrintf( "OnSize from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- wxPrintf( win->GetClassInfo()->GetClassName() );
- wxPrintf( " %d %d %d %d\n", (int)alloc->x,
- (int)alloc->y,
- (int)alloc->width,
- (int)alloc->height );
-*/
-
- wxSizeEvent event( win->GetSize(), win->GetId() );
- event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
-}
-
//-----------------------------------------------------------------------------
// key event conversion routines
//-----------------------------------------------------------------------------
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
- if (!m_isFrame)
- {
- /* frames have their own callback */
- gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
- GTK_SIGNAL_FUNC(gtk_window_size_callback), (gpointer)this );
- }
-
if (m_wxwindow)
{
if (!m_noExpose)
m_y = y;
m_width = width;
m_height = height;
-
- m_sizeSet = FALSE;
}
else
{
- int old_width = m_width;
- int old_height = m_height;
-
GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
m_y-border,
m_width+2*border,
m_height+border+bottom_border );
-
- if ((old_width != m_width) ||
- (old_height != m_height))
- {
- m_sizeSet = FALSE;
- }
}
-
+
/*
+ wxPrintf( "OnSize sent from " );
+ if (GetClassInfo() && GetClassInfo()->GetClassName())
+ wxPrintf( GetClassInfo()->GetClassName() );
+ wxPrintf( " %d %d %d %d\n", (int)m_x, (int)m_y, (int)m_width, (int)m_height );
+*/
+
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
-*/
+
m_resizing = FALSE;
}
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
-/*
// send size event to status bar
if (m_frameStatusBar)
{
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
-*/
m_resizing = FALSE;
}
{
if (g_isIdle)
wxapp_install_idle_handler();
-
+
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
- if (win->GetAutoLayout()) win->Layout();
+ if (win->GetAutoLayout())
+ {
+ win->Layout();
+ }
+}
+
+//-----------------------------------------------------------------------------
+// "realize" from m_widget
+//-----------------------------------------------------------------------------
+
+/* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
+ here in order to take repositioning before showing to take effect. */
+
+static gint
+gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ gtk_widget_queue_resize( win->m_widget );
+
+ return FALSE;
}
//-----------------------------------------------------------------------------
PostCreation();
+ gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
+ GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
+
Show( TRUE );
return TRUE;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
gtk_widget_queue_resize (widget);
- break;
+ return;
}
}
}
myfixed = GTK_MYFIXED (widget);
- children = myfixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- gtk_myfixed_position_child (myfixed, child);
- gtk_myfixed_allocate_child (myfixed, child);
- }
-
widget->allocation = *allocation;
if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
gdk_window_move_resize( widget->window, x, y, w, h );
gdk_window_move_resize( myfixed->bin_window, 0, 0, w, h );
}
+
+ children = myfixed->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ gtk_myfixed_position_child (myfixed, child);
+ gtk_myfixed_allocate_child (myfixed, child);
+ }
}
static void
}
}
-/*
-static void
-gtk_myfixed_draw_border (GtkMyFixed *myfixed)
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET(myfixed);
-
- if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
- return;
-
- if (myfixed->shadow_type == GTK_MYSHADOW_OUT)
- {
- gtk_draw_shadow( widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_OUT,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height );
- return;
- }
-
- if (myfixed->shadow_type == GTK_MYSHADOW_IN)
- {
- gtk_draw_shadow( widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_IN,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height );
- return;
- }
-
- if (myfixed->shadow_type == GTK_MYSHADOW_THIN)
- {
- GdkGC *gc;
- gc = gdk_gc_new( widget->window );
- gdk_gc_set_foreground( gc, &widget->style->black );
- gdk_draw_rectangle( widget->window, gc, FALSE,
- 0, 0,
- widget->allocation.width-1,
- widget->allocation.height-1 );
- gdk_gc_unref( gc );
- return;
- }
-}
-*/
-
static gint
gtk_myfixed_expose (GtkWidget *widget,
GdkEventExpose *event)
GtkCallback callback,
gpointer callback_data)
{
- GtkMyFixed *myfixed;
- GtkMyFixedChild *child;
- GList *children;
+ GtkMyFixed *myfixed;
+ GtkMyFixedChild *child;
+ GList *children;
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_MYFIXED (container));
- g_return_if_fail (callback != NULL);
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_MYFIXED (container));
+ g_return_if_fail (callback != NULL);
- myfixed = GTK_MYFIXED (container);
+ myfixed = GTK_MYFIXED (container);
- children = myfixed->children;
- while (children)
+ children = myfixed->children;
+ while (children)
{
- child = children->data;
- children = children->next;
+ child = children->data;
+ children = children->next;
- (* callback) (child->widget, callback_data);
+ (* callback) (child->widget, callback_data);
}
}
gtk_myfixed_position_child (GtkMyFixed *myfixed,
GtkMyFixedChild *child)
{
- gint x;
- gint y;
+ gint x;
+ gint y;
- x = child->x - myfixed->xoffset;
- y = child->y - myfixed->yoffset;
+ x = child->x - myfixed->xoffset;
+ y = child->y - myfixed->yoffset;
- if (IS_ONSCREEN (x,y))
+ if (IS_ONSCREEN (x,y))
{
- if (GTK_WIDGET_MAPPED (myfixed) &&
+ if (GTK_WIDGET_MAPPED (myfixed) &&
GTK_WIDGET_VISIBLE (child->widget))
{
- if (!GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
+ if (!GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_map (child->widget);
}
- if (GTK_WIDGET_IS_OFFSCREEN (child->widget))
- GTK_PRIVATE_UNSET_FLAG (child->widget, GTK_IS_OFFSCREEN);
+ if (GTK_WIDGET_IS_OFFSCREEN (child->widget))
+ GTK_PRIVATE_UNSET_FLAG (child->widget, GTK_IS_OFFSCREEN);
}
- else
+ else
{
- if (!GTK_WIDGET_IS_OFFSCREEN (child->widget))
- GTK_PRIVATE_SET_FLAG (child->widget, GTK_IS_OFFSCREEN);
+ if (!GTK_WIDGET_IS_OFFSCREEN (child->widget))
+ GTK_PRIVATE_SET_FLAG (child->widget, GTK_IS_OFFSCREEN);
- if (GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
+ if (GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_unmap (child->widget);
}
}
gtk_myfixed_allocate_child (GtkMyFixed *myfixed,
GtkMyFixedChild *child)
{
- GtkAllocation allocation;
- GtkRequisition requisition;
-
- allocation.x = child->x - myfixed->xoffset;
- allocation.y = child->y - myfixed->yoffset;
- gtk_widget_get_child_requisition (child->widget, &requisition);
- allocation.width = requisition.width;
- allocation.height = requisition.height;
+ GtkAllocation allocation;
+ GtkRequisition requisition;
+
+ allocation.x = child->x - myfixed->xoffset;
+ allocation.y = child->y - myfixed->yoffset;
+ gtk_widget_get_child_requisition (child->widget, &requisition);
+ allocation.width = requisition.width;
+ allocation.height = requisition.height;
- gtk_widget_size_allocate (child->widget, &allocation);
+ gtk_widget_size_allocate (child->widget, &allocation);
}
static void
gtk_myfixed_position_children (GtkMyFixed *myfixed)
{
- GList *tmp_list;
+ GList *tmp_list;
- tmp_list = myfixed->children;
- while (tmp_list)
+ tmp_list = myfixed->children;
+ while (tmp_list)
{
- GtkMyFixedChild *child = tmp_list->data;
- tmp_list = tmp_list->next;
+ GtkMyFixedChild *child = tmp_list->data;
+ tmp_list = tmp_list->next;
- gtk_myfixed_position_child (myfixed, child);
+ gtk_myfixed_position_child (myfixed, child);
}
}
gtk_myfixed_adjust_allocations_recurse (GtkWidget *widget,
gpointer cb_data)
{
- GtkMyFixedAdjData *data = cb_data;
+ GtkMyFixedAdjData *data = cb_data;
- widget->allocation.x += data->dx;
- widget->allocation.y += data->dy;
+ widget->allocation.x += data->dx;
+ widget->allocation.y += data->dy;
- if (GTK_WIDGET_NO_WINDOW (widget) &&
- GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
+ if (GTK_WIDGET_NO_WINDOW (widget) && GTK_IS_CONTAINER (widget))
+ {
+ gtk_container_forall (GTK_CONTAINER (widget),
gtk_myfixed_adjust_allocations_recurse,
cb_data);
+ }
}
static void
#endif // GTK_MINOR_VERSION > 0
-
-//-----------------------------------------------------------------------------
-// "size_allocate"
-//-----------------------------------------------------------------------------
-
-static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
-{
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- if (!win->m_hasVMT)
- return;
-
- if (win->m_sizeSet)
- return;
-
- win->m_sizeSet = TRUE;
-
-/*
- wxPrintf( "OnSize from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- wxPrintf( win->GetClassInfo()->GetClassName() );
- wxPrintf( " %d %d %d %d\n", (int)alloc->x,
- (int)alloc->y,
- (int)alloc->width,
- (int)alloc->height );
-*/
-
- wxSizeEvent event( win->GetSize(), win->GetId() );
- event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
-}
-
//-----------------------------------------------------------------------------
// key event conversion routines
//-----------------------------------------------------------------------------
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
- if (!m_isFrame)
- {
- /* frames have their own callback */
- gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
- GTK_SIGNAL_FUNC(gtk_window_size_callback), (gpointer)this );
- }
-
if (m_wxwindow)
{
if (!m_noExpose)
m_y = y;
m_width = width;
m_height = height;
-
- m_sizeSet = FALSE;
}
else
{
- int old_width = m_width;
- int old_height = m_height;
-
GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
m_y-border,
m_width+2*border,
m_height+border+bottom_border );
-
- if ((old_width != m_width) ||
- (old_height != m_height))
- {
- m_sizeSet = FALSE;
- }
}
-
+
/*
+ wxPrintf( "OnSize sent from " );
+ if (GetClassInfo() && GetClassInfo()->GetClassName())
+ wxPrintf( GetClassInfo()->GetClassName() );
+ wxPrintf( " %d %d %d %d\n", (int)m_x, (int)m_y, (int)m_width, (int)m_height );
+*/
+
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
-*/
+
m_resizing = FALSE;
}