]> git.saurik.com Git - wxWidgets.git/commitdiff
Added window resize patch to wxFrame
authorRobert Roebling <robert@roebling.de>
Tue, 4 May 1999 11:15:37 +0000 (11:15 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 4 May 1999 11:15:37 +0000 (11:15 +0000)
  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

src/gtk/dnd.cpp
src/gtk/frame.cpp
src/gtk/notebook.cpp
src/gtk1/dnd.cpp
src/gtk1/frame.cpp
src/gtk1/notebook.cpp

index 7bef3e8f1cf32202dfce327c5839becaab39c122..9378aba506d4c3a58c84af171dacfcc1c10b438c 100644 (file)
 #include "gtk/gtkdnd.h"
 #include "gtk/gtkselection.h"
 
+//-----------------------------------------------------------------------------
+// idle system
+//-----------------------------------------------------------------------------
+
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
 //----------------------------------------------------------------------------
 // global data
 //----------------------------------------------------------------------------
@@ -134,6 +141,8 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
                               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 );
@@ -160,6 +169,8 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
                                    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" */
@@ -203,6 +214,8 @@ static gboolean target_drag_drop( GtkWidget *widget,
                                  guint time,
                                  wxDropTarget *drop_target )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
     /* Owen Taylor: "if the drop is not in a drop zone,
        return FALSE, otherwise, if you aren't accepting
        the drop, call gtk_drag_finish() with success == FALSE
@@ -262,6 +275,8 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
                                       guint time,
                                       wxDropTarget *drop_target )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
     /* Owen Taylor: "call gtk_drag_finish() with
        success == TRUE" */
 
@@ -589,6 +604,8 @@ source_drag_data_get  (GtkWidget          *WXUNUSED(widget),
                       guint               WXUNUSED(time),
                       wxDropSource       *drop_source )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "Provide data!\n" );
 
 //    char *name = gdk_atom_name( selection_data->target );
@@ -640,6 +657,8 @@ static void source_drag_data_delete( GtkWidget          *WXUNUSED(widget),
                                     GdkDragContext     *WXUNUSED(context),
                                     wxDropSource       *drop_source )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "Delete the data!\n" );
 
     drop_source->m_retValue = wxDragMove;
@@ -653,6 +672,8 @@ static void source_drag_begin( GtkWidget          *WXUNUSED(widget),
                               GdkDragContext     *WXUNUSED(context),
                               wxDropSource       *WXUNUSED(drop_source) )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "drag_begin.\n" );
 }
   
@@ -664,6 +685,8 @@ static void source_drag_end( GtkWidget          *WXUNUSED(widget),
                             GdkDragContext     *WXUNUSED(context),
                             wxDropSource       *drop_source )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "drag_end.\n" );
 
     drop_source->m_waiting = FALSE;
index 04a8523505105063cdfe964c567b5bd2a32d0974..62cfe002c068241711bb9fd172127fb3b59b2efb 100644 (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 );
            
-//         m_frameToolBar->m_widget->requisition.width = ww;
-//         m_frameToolBar->m_widget->requisition.height = hh;
             gtk_widget_set_usize( m_frameToolBar->m_widget, ww, 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_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 );
-
+       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
     {
index 56ef149e825c694cf07c86514175de76401586a3..2eb7a24f51c130b0dad8519c5638f92dd25b103c 100644 (file)
@@ -572,6 +572,18 @@ bool wxNotebook::DeletePage( int 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;
 }
 
index 7bef3e8f1cf32202dfce327c5839becaab39c122..9378aba506d4c3a58c84af171dacfcc1c10b438c 100644 (file)
 #include "gtk/gtkdnd.h"
 #include "gtk/gtkselection.h"
 
+//-----------------------------------------------------------------------------
+// idle system
+//-----------------------------------------------------------------------------
+
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
 //----------------------------------------------------------------------------
 // global data
 //----------------------------------------------------------------------------
@@ -134,6 +141,8 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
                               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 );
@@ -160,6 +169,8 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
                                    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" */
@@ -203,6 +214,8 @@ static gboolean target_drag_drop( GtkWidget *widget,
                                  guint time,
                                  wxDropTarget *drop_target )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
     /* Owen Taylor: "if the drop is not in a drop zone,
        return FALSE, otherwise, if you aren't accepting
        the drop, call gtk_drag_finish() with success == FALSE
@@ -262,6 +275,8 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
                                       guint time,
                                       wxDropTarget *drop_target )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
     /* Owen Taylor: "call gtk_drag_finish() with
        success == TRUE" */
 
@@ -589,6 +604,8 @@ source_drag_data_get  (GtkWidget          *WXUNUSED(widget),
                       guint               WXUNUSED(time),
                       wxDropSource       *drop_source )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "Provide data!\n" );
 
 //    char *name = gdk_atom_name( selection_data->target );
@@ -640,6 +657,8 @@ static void source_drag_data_delete( GtkWidget          *WXUNUSED(widget),
                                     GdkDragContext     *WXUNUSED(context),
                                     wxDropSource       *drop_source )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "Delete the data!\n" );
 
     drop_source->m_retValue = wxDragMove;
@@ -653,6 +672,8 @@ static void source_drag_begin( GtkWidget          *WXUNUSED(widget),
                               GdkDragContext     *WXUNUSED(context),
                               wxDropSource       *WXUNUSED(drop_source) )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "drag_begin.\n" );
 }
   
@@ -664,6 +685,8 @@ static void source_drag_end( GtkWidget          *WXUNUSED(widget),
                             GdkDragContext     *WXUNUSED(context),
                             wxDropSource       *drop_source )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
 //    printf( "drag_end.\n" );
 
     drop_source->m_waiting = FALSE;
index 04a8523505105063cdfe964c567b5bd2a32d0974..62cfe002c068241711bb9fd172127fb3b59b2efb 100644 (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 );
            
-//         m_frameToolBar->m_widget->requisition.width = ww;
-//         m_frameToolBar->m_widget->requisition.height = hh;
             gtk_widget_set_usize( m_frameToolBar->m_widget, ww, 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_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 );
-
+       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
     {
index 56ef149e825c694cf07c86514175de76401586a3..2eb7a24f51c130b0dad8519c5638f92dd25b103c 100644 (file)
@@ -572,6 +572,18 @@ bool wxNotebook::DeletePage( int 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;
 }