Added window resize patch to wxFrame

Added patch to wxNotebook for keeping m_id in
    synch after deletion of pages
  Added patch for idle handling within DnD


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-05-04 11:15:37 +00:00
parent 69c6074dc5
commit 5549fa6559
6 changed files with 76 additions and 10 deletions

View File

@ -28,6 +28,13 @@
#include "gtk/gtkdnd.h" #include "gtk/gtkdnd.h"
#include "gtk/gtkselection.h" #include "gtk/gtkselection.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// global data // global data
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -134,6 +141,8 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
guint WXUNUSED(time), guint WXUNUSED(time),
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* inform the wxDropTarget about the current GdkDragContext. /* inform the wxDropTarget about the current GdkDragContext.
this is only valid for the duration of this call */ this is only valid for the duration of this call */
drop_target->SetDragContext( context ); drop_target->SetDragContext( context );
@ -160,6 +169,8 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
guint time, guint time,
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* Owen Taylor: "if the coordinates not in a drop zone, /* Owen Taylor: "if the coordinates not in a drop zone,
return FALSE, otherwise call gtk_drag_status() and return FALSE, otherwise call gtk_drag_status() and
return TRUE" */ return TRUE" */
@ -203,6 +214,8 @@ static gboolean target_drag_drop( GtkWidget *widget,
guint time, guint time,
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* Owen Taylor: "if the drop is not in a drop zone, /* Owen Taylor: "if the drop is not in a drop zone,
return FALSE, otherwise, if you aren't accepting return FALSE, otherwise, if you aren't accepting
the drop, call gtk_drag_finish() with success == FALSE the drop, call gtk_drag_finish() with success == FALSE
@ -262,6 +275,8 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
guint time, guint time,
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* Owen Taylor: "call gtk_drag_finish() with /* Owen Taylor: "call gtk_drag_finish() with
success == TRUE" */ success == TRUE" */
@ -589,6 +604,8 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
guint WXUNUSED(time), guint WXUNUSED(time),
wxDropSource *drop_source ) wxDropSource *drop_source )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "Provide data!\n" ); // printf( "Provide data!\n" );
// char *name = gdk_atom_name( selection_data->target ); // char *name = gdk_atom_name( selection_data->target );
@ -640,6 +657,8 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context), GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source ) wxDropSource *drop_source )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "Delete the data!\n" ); // printf( "Delete the data!\n" );
drop_source->m_retValue = wxDragMove; drop_source->m_retValue = wxDragMove;
@ -653,6 +672,8 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context), GdkDragContext *WXUNUSED(context),
wxDropSource *WXUNUSED(drop_source) ) wxDropSource *WXUNUSED(drop_source) )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "drag_begin.\n" ); // printf( "drag_begin.\n" );
} }
@ -664,6 +685,8 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context), GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source ) wxDropSource *drop_source )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "drag_end.\n" ); // printf( "drag_end.\n" );
drop_source->m_waiting = FALSE; drop_source->m_waiting = FALSE;

View File

@ -696,8 +696,6 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy );
// m_frameToolBar->m_widget->requisition.width = ww;
// m_frameToolBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
client_area_y_offset += hh; client_area_y_offset += hh;
@ -709,10 +707,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
int client_w = m_width - 2*m_miniEdge; 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;
// m_wxwindow->requisition.width = client_w;
// m_wxwindow->requisition.height = client_h;
gtk_widget_set_usize( m_wxwindow, client_w, client_h ); gtk_widget_set_usize( m_wxwindow, client_w, client_h );
GtkAllocation alloc;
alloc.x = client_x; alloc.y = client_y; alloc.width = client_w; alloc.height = client_h;
gtk_widget_size_allocate( m_wxwindow, &alloc );
} }
else else
{ {

View File

@ -572,6 +572,18 @@ bool wxNotebook::DeletePage( int page )
m_pages.DeleteObject( nb_page ); m_pages.DeleteObject( nb_page );
/* adjust the notebook page numbers so that
m_id reflects the current position, Daniel Paull */
int count = 0;
wxNode *node = m_pages.First();
wxNotebookPage *pagePtr = (wxNotebookPage *) NULL;
while (node)
{
pagePtr = (wxNotebookPage*)node->Data();
pagePtr->m_id = count++;
node = node->Next();
}
return TRUE; return TRUE;
} }

View File

@ -28,6 +28,13 @@
#include "gtk/gtkdnd.h" #include "gtk/gtkdnd.h"
#include "gtk/gtkselection.h" #include "gtk/gtkselection.h"
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
extern bool g_isIdle;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// global data // global data
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -134,6 +141,8 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
guint WXUNUSED(time), guint WXUNUSED(time),
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* inform the wxDropTarget about the current GdkDragContext. /* inform the wxDropTarget about the current GdkDragContext.
this is only valid for the duration of this call */ this is only valid for the duration of this call */
drop_target->SetDragContext( context ); drop_target->SetDragContext( context );
@ -160,6 +169,8 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
guint time, guint time,
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* Owen Taylor: "if the coordinates not in a drop zone, /* Owen Taylor: "if the coordinates not in a drop zone,
return FALSE, otherwise call gtk_drag_status() and return FALSE, otherwise call gtk_drag_status() and
return TRUE" */ return TRUE" */
@ -203,6 +214,8 @@ static gboolean target_drag_drop( GtkWidget *widget,
guint time, guint time,
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* Owen Taylor: "if the drop is not in a drop zone, /* Owen Taylor: "if the drop is not in a drop zone,
return FALSE, otherwise, if you aren't accepting return FALSE, otherwise, if you aren't accepting
the drop, call gtk_drag_finish() with success == FALSE the drop, call gtk_drag_finish() with success == FALSE
@ -262,6 +275,8 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
guint time, guint time,
wxDropTarget *drop_target ) wxDropTarget *drop_target )
{ {
if (g_isIdle) wxapp_install_idle_handler();
/* Owen Taylor: "call gtk_drag_finish() with /* Owen Taylor: "call gtk_drag_finish() with
success == TRUE" */ success == TRUE" */
@ -589,6 +604,8 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
guint WXUNUSED(time), guint WXUNUSED(time),
wxDropSource *drop_source ) wxDropSource *drop_source )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "Provide data!\n" ); // printf( "Provide data!\n" );
// char *name = gdk_atom_name( selection_data->target ); // char *name = gdk_atom_name( selection_data->target );
@ -640,6 +657,8 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context), GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source ) wxDropSource *drop_source )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "Delete the data!\n" ); // printf( "Delete the data!\n" );
drop_source->m_retValue = wxDragMove; drop_source->m_retValue = wxDragMove;
@ -653,6 +672,8 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context), GdkDragContext *WXUNUSED(context),
wxDropSource *WXUNUSED(drop_source) ) wxDropSource *WXUNUSED(drop_source) )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "drag_begin.\n" ); // printf( "drag_begin.\n" );
} }
@ -664,6 +685,8 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget),
GdkDragContext *WXUNUSED(context), GdkDragContext *WXUNUSED(context),
wxDropSource *drop_source ) wxDropSource *drop_source )
{ {
if (g_isIdle) wxapp_install_idle_handler();
// printf( "drag_end.\n" ); // printf( "drag_end.\n" );
drop_source->m_waiting = FALSE; drop_source->m_waiting = FALSE;

View File

@ -696,8 +696,6 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy );
// m_frameToolBar->m_widget->requisition.width = ww;
// m_frameToolBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
client_area_y_offset += hh; client_area_y_offset += hh;
@ -709,10 +707,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
int client_w = m_width - 2*m_miniEdge; 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;
// m_wxwindow->requisition.width = client_w;
// m_wxwindow->requisition.height = client_h;
gtk_widget_set_usize( m_wxwindow, client_w, client_h ); gtk_widget_set_usize( m_wxwindow, client_w, client_h );
GtkAllocation alloc;
alloc.x = client_x; alloc.y = client_y; alloc.width = client_w; alloc.height = client_h;
gtk_widget_size_allocate( m_wxwindow, &alloc );
} }
else else
{ {

View File

@ -572,6 +572,18 @@ bool wxNotebook::DeletePage( int page )
m_pages.DeleteObject( nb_page ); m_pages.DeleteObject( nb_page );
/* adjust the notebook page numbers so that
m_id reflects the current position, Daniel Paull */
int count = 0;
wxNode *node = m_pages.First();
wxNotebookPage *pagePtr = (wxNotebookPage *) NULL;
while (node)
{
pagePtr = (wxNotebookPage*)node->Data();
pagePtr->m_id = count++;
node = node->Next();
}
return TRUE; return TRUE;
} }