From 33d0b396b23cc198d6966d2ae4bd03762821e56c Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 13 Jul 1998 23:30:59 +0000 Subject: [PATCH] resize mdi and notebook client bitmap resizing (used in imagelist) draw spline bug git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/listctrl.h | 1 + include/wx/gtk/window.h | 1 + include/wx/gtk1/window.h | 1 + samples/controls/controls.cpp | 2 +- samples/mdi/mdi.cpp | 13 +++++++++-- samples/mdi/mdi.h | 1 + src/generic/listctrl.cpp | 9 +++++-- src/gtk/bitmap.cpp | 2 -- src/gtk/dc.cpp | 8 ++++++- src/gtk/mdi.cpp | 26 +++++++++++++++++---- src/gtk/notebook.cpp | 44 +++++++++++++++++++++++++++++++---- src/gtk/window.cpp | 19 +++++++++++---- src/gtk1/bitmap.cpp | 2 -- src/gtk1/dc.cpp | 8 ++++++- src/gtk1/mdi.cpp | 26 +++++++++++++++++---- src/gtk1/notebook.cpp | 44 +++++++++++++++++++++++++++++++---- src/gtk1/window.cpp | 19 +++++++++++---- user/wxFile/filectrl.cpp | 3 ++- 18 files changed, 193 insertions(+), 36 deletions(-) diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index aefb650684..ccd8b5c78a 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -594,6 +594,7 @@ class wxListCtrl: public wxControl bool GetItemPosition( long item, wxPoint& pos ) const; // not supported in wxGLC bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC int GetItemCount(void); + void SetItemSpacing( int spacing, bool isSmall = FALSE ); int GetItemSpacing( bool isSmall ); int GetSelectedItemCount(void); // wxColour GetTextColour(void) const; // wxGLC has colours for every Item (see wxListItem) diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 482556b626..84a3ddcddf 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -222,6 +222,7 @@ class wxWindow: public wxEvtHandler bool m_hasScrolling; bool m_hasVMT; bool m_sizeSet; + bool m_resizing; public: // Layout section diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index 482556b626..84a3ddcddf 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -222,6 +222,7 @@ class wxWindow: public wxEvtHandler bool m_hasScrolling; bool m_hasVMT; bool m_sizeSet; + bool m_resizing; public: // Layout section diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 7db58c8219..7ecbdf18d9 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -180,7 +180,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 9, choices ); m_notebook->AddPage(panel, "wxComboBox"); - wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(0,20), wxSize(120,100), wxTE_MULTILINE ); + wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(120,100), wxTE_MULTILINE ); m_notebook->AddPage( text, "wxTextCtrl" ); } diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index ed177ee94b..97b0a355ab 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -206,7 +206,7 @@ void MyCanvas::OnDraw(wxDC& dc) points[0].x = 200; points[0].y = 300; points[1].x = 100; points[1].y = 400; points[2].x = 300; points[2].y = 400; - + dc.DrawPolygon(3, points); } @@ -271,6 +271,7 @@ void MyFrame::OnSize(wxSizeEvent& event) BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame) EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit) + EVT_SIZE( MyChild::OnSize) END_EVENT_TABLE() MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, @@ -286,7 +287,15 @@ MyChild::~MyChild(void) my_children.DeleteObject(this); } -void MyChild::OnQuit(wxCommandEvent& event) +void MyChild::OnSize(wxSizeEvent& WXUNUSED(event)) +{ + int x = 0; + int y = 0; + GetClientSize( &x, &y ); + if (canvas) canvas->SetSize( x, y ); +} + +void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); } diff --git a/samples/mdi/mdi.h b/samples/mdi/mdi.h index 3773699422..47d61ee24e 100644 --- a/samples/mdi/mdi.h +++ b/samples/mdi/mdi.h @@ -77,6 +77,7 @@ class MyChild: public wxMDIChildFrame MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); ~MyChild(void); bool OnClose(void); + void OnSize(wxSizeEvent& event); void OnActivate(wxActivateEvent& event); void OnQuit(wxCommandEvent& event); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 13075f33df..788670089a 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1314,12 +1314,12 @@ void wxListMainWindow::DrawImage( int index, wxPaintDC *dc, int x, int y ) { if ((m_mode & wxLC_ICON) && (m_normal_image_list)) { - m_normal_image_list->Draw( index, *dc, x, y ); + m_normal_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT ); return; }; if ((m_mode & wxLC_SMALL_ICON) && (m_small_image_list)) { - m_small_image_list->Draw( index, *dc, x, y ); + m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT ); }; }; @@ -2212,6 +2212,11 @@ int wxListCtrl::GetItemCount(void) return m_mainWin->GetItemCount(); }; +void wxListCtrl::SetItemSpacing( int spacing, bool isSmall ) +{ + m_mainWin->SetItemSpacing( spacing, isSmall ); +}; + int wxListCtrl::GetItemSpacing( bool isSmall ) { return m_mainWin->GetItemSpacing( isSmall ); diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 7ae387a2f5..d2241e591d 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -278,8 +278,6 @@ void wxBitmap::Resize( int height, int width ) { if (!Ok()) return; - return; - #ifdef USE_GDK_IMLIB if (M_BMPDATA->m_bitmap) return; // not supported for bitmaps diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index b50ade747a..faba4faab6 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -136,11 +136,17 @@ void wxDC::DrawLines( wxList *list, long xoffset, long yoffset ) void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ) { wxList list; - list.DeleteContents(TRUE); list.Append( (wxObject*)new wxPoint(x1, y1) ); list.Append( (wxObject*)new wxPoint(x2, y2) ); list.Append( (wxObject*)new wxPoint(x3, y3) ); DrawSpline(&list); + wxNode *node = list.First(); + while (node) + { + wxPoint *p = (wxPoint*)node->Data(); + delete p; + node = node->Next(); + }; }; void wxDC::DrawSpline( wxList *points ) diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index f82bf73350..160828e8cd 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -18,6 +18,21 @@ // wxMDIParentFrame //----------------------------------------------------------------------------- +static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) +{ + if ((win->m_x == alloc->x) && + (win->m_y == alloc->y) && + (win->m_width == alloc->width) && + (win->m_height == alloc->height)) + { + return; + }; + + win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); +}; + +//----------------------------------------------------------------------------- + IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame) wxMDIParentFrame::wxMDIParentFrame(void) @@ -113,10 +128,10 @@ wxMDIChildFrame::wxMDIChildFrame(void) wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, + const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { - Create( parent, id, title, pos, size, style, name ); + Create( parent, id, title, wxDefaultPosition, size, style, name ); }; wxMDIChildFrame::~wxMDIChildFrame(void) @@ -125,11 +140,11 @@ wxMDIChildFrame::~wxMDIChildFrame(void) bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, + const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { m_title = title; - return wxPanel::Create( parent->GetClientWindow(), id, pos, size, style, name ); + return wxPanel::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); }; void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) ) @@ -191,6 +206,9 @@ void wxMDIClientWindow::AddChild( wxWindow *child ) GtkWidget *label_widget; label_widget = gtk_label_new( s ); gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); + + gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", + GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget ); }; diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 39bb790417..9b6ec68ef5 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -69,6 +69,40 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), notebook->ProcessEvent(event); } +static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) +{ + if ((win->m_x == alloc->x) && + (win->m_y == alloc->y) && + (win->m_width == alloc->width) && + (win->m_height == alloc->height)) + { + return; + }; + +/* + printf( "OnResize from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( " .\n" ); + + printf( " Old: X: %d Y: %d ", win->m_x, win->m_y ); + printf( " W: %d H: %d ", win->m_width, win->m_height ); + printf( " .\n" ); + + printf( " New: X: %d Y: %d ", alloc->x, alloc->y ); + printf( " W: %d H: %d ", alloc->width, alloc->height ); + printf( " .\n" ); +*/ + + win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); + +/* + printf( " Res: X: %d Y: %d ", win->m_x, win->m_y ); + printf( " W: %d H: %d ", win->m_width, win->m_height ); + printf( " .\n" ); +*/ +}; + //----------------------------------------------------------------------------- // wxNotebook //----------------------------------------------------------------------------- @@ -370,7 +404,6 @@ void wxNotebook::AddChild( wxWindow *win ) m_children.Append(win); - wxNotebookPage *page = new wxNotebookPage(); page->m_id = GetPageCount(); @@ -384,7 +417,10 @@ void wxNotebook::AddChild( wxWindow *win ) (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data); page->m_parent = GTK_NOTEBOOK(m_widget); - + + gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate", + GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win ); + if (!page->m_page) { wxLogFatalError( "Notebook page creation error" ); @@ -404,12 +440,12 @@ void wxNotebook::OnSize(wxSizeEvent& event) // @@@@ the numbers I substract here are completely arbitrary, instead we // should somehow calculate the size of the page from the size of the // notebook - page->SetSize(event.GetSize().GetX() - 5, +/* page->SetSize(event.GetSize().GetX() - 5, event.GetSize().GetY() - 30); if ( page->GetAutoLayout() ) page->Layout(); - +*/ node = node->Next(); }; } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index c9832cefa8..74ab35d9c7 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -108,7 +108,9 @@ void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, //----------------------------------------------------------------------------- // size -// I don't any longer intercept GTK's internal resize events (except frames) +// I don't any longer intercept GTK's internal resize events, except +// for frames and from within MDI and tabbed windows (client area +// size determined internally by GTK, not wxWin). /* void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) @@ -730,6 +732,7 @@ wxWindow::wxWindow() m_drawingOffsetX = 0; m_drawingOffsetY = 0; m_pDropTarget = NULL; + m_resizing = FALSE; }; wxWindow::wxWindow( wxWindow *parent, wxWindowID id, @@ -913,6 +916,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_drawingOffsetX = 0; m_drawingOffsetY = 0; m_pDropTarget = NULL; + m_resizing = FALSE; } void wxWindow::PostCreation(void) @@ -1059,6 +1063,9 @@ void wxWindow::ImplementSetPosition(void) void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) { + if (m_resizing) return; // I don't like recursions + m_resizing = TRUE; + int newX = x; int newY = y; int newW = width; @@ -1099,6 +1106,8 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); ProcessEvent( event ); + + m_resizing = FALSE; }; void wxWindow::SetSize( int width, int height ) @@ -1113,8 +1122,8 @@ void wxWindow::Move( int x, int y ) void wxWindow::GetSize( int *width, int *height ) const { - (*width) = m_width; - (*height) = m_height; + if (width) (*width) = m_width; + if (height) (*height) = m_height; }; void wxWindow::SetClientSize( int width, int height ) @@ -1423,6 +1432,8 @@ void wxWindow::AddChild( wxWindow *child ) }; }; + // wxNotebooks are very special, so they have their own AddChild + if (IsKindOf(CLASSINFO(wxNotebook))) { wxNotebook *tab = (wxNotebook*)this; @@ -1828,7 +1839,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->page_increment = (float)(wxMax(fthumb-2,0)); m_vAdjust->page_size = fthumb; }; - + if (m_wxwindow->window) { if (orient == wxHORIZONTAL) diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 7ae387a2f5..d2241e591d 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -278,8 +278,6 @@ void wxBitmap::Resize( int height, int width ) { if (!Ok()) return; - return; - #ifdef USE_GDK_IMLIB if (M_BMPDATA->m_bitmap) return; // not supported for bitmaps diff --git a/src/gtk1/dc.cpp b/src/gtk1/dc.cpp index b50ade747a..faba4faab6 100644 --- a/src/gtk1/dc.cpp +++ b/src/gtk1/dc.cpp @@ -136,11 +136,17 @@ void wxDC::DrawLines( wxList *list, long xoffset, long yoffset ) void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ) { wxList list; - list.DeleteContents(TRUE); list.Append( (wxObject*)new wxPoint(x1, y1) ); list.Append( (wxObject*)new wxPoint(x2, y2) ); list.Append( (wxObject*)new wxPoint(x3, y3) ); DrawSpline(&list); + wxNode *node = list.First(); + while (node) + { + wxPoint *p = (wxPoint*)node->Data(); + delete p; + node = node->Next(); + }; }; void wxDC::DrawSpline( wxList *points ) diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index f82bf73350..160828e8cd 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -18,6 +18,21 @@ // wxMDIParentFrame //----------------------------------------------------------------------------- +static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) +{ + if ((win->m_x == alloc->x) && + (win->m_y == alloc->y) && + (win->m_width == alloc->width) && + (win->m_height == alloc->height)) + { + return; + }; + + win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); +}; + +//----------------------------------------------------------------------------- + IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame) wxMDIParentFrame::wxMDIParentFrame(void) @@ -113,10 +128,10 @@ wxMDIChildFrame::wxMDIChildFrame(void) wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, + const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { - Create( parent, id, title, pos, size, style, name ); + Create( parent, id, title, wxDefaultPosition, size, style, name ); }; wxMDIChildFrame::~wxMDIChildFrame(void) @@ -125,11 +140,11 @@ wxMDIChildFrame::~wxMDIChildFrame(void) bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, + const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { m_title = title; - return wxPanel::Create( parent->GetClientWindow(), id, pos, size, style, name ); + return wxPanel::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); }; void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) ) @@ -191,6 +206,9 @@ void wxMDIClientWindow::AddChild( wxWindow *child ) GtkWidget *label_widget; label_widget = gtk_label_new( s ); gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); + + gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", + GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget ); }; diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 39bb790417..9b6ec68ef5 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -69,6 +69,40 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), notebook->ProcessEvent(event); } +static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) +{ + if ((win->m_x == alloc->x) && + (win->m_y == alloc->y) && + (win->m_width == alloc->width) && + (win->m_height == alloc->height)) + { + return; + }; + +/* + printf( "OnResize from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( " .\n" ); + + printf( " Old: X: %d Y: %d ", win->m_x, win->m_y ); + printf( " W: %d H: %d ", win->m_width, win->m_height ); + printf( " .\n" ); + + printf( " New: X: %d Y: %d ", alloc->x, alloc->y ); + printf( " W: %d H: %d ", alloc->width, alloc->height ); + printf( " .\n" ); +*/ + + win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); + +/* + printf( " Res: X: %d Y: %d ", win->m_x, win->m_y ); + printf( " W: %d H: %d ", win->m_width, win->m_height ); + printf( " .\n" ); +*/ +}; + //----------------------------------------------------------------------------- // wxNotebook //----------------------------------------------------------------------------- @@ -370,7 +404,6 @@ void wxNotebook::AddChild( wxWindow *win ) m_children.Append(win); - wxNotebookPage *page = new wxNotebookPage(); page->m_id = GetPageCount(); @@ -384,7 +417,10 @@ void wxNotebook::AddChild( wxWindow *win ) (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data); page->m_parent = GTK_NOTEBOOK(m_widget); - + + gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate", + GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win ); + if (!page->m_page) { wxLogFatalError( "Notebook page creation error" ); @@ -404,12 +440,12 @@ void wxNotebook::OnSize(wxSizeEvent& event) // @@@@ the numbers I substract here are completely arbitrary, instead we // should somehow calculate the size of the page from the size of the // notebook - page->SetSize(event.GetSize().GetX() - 5, +/* page->SetSize(event.GetSize().GetX() - 5, event.GetSize().GetY() - 30); if ( page->GetAutoLayout() ) page->Layout(); - +*/ node = node->Next(); }; } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index c9832cefa8..74ab35d9c7 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -108,7 +108,9 @@ void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, //----------------------------------------------------------------------------- // size -// I don't any longer intercept GTK's internal resize events (except frames) +// I don't any longer intercept GTK's internal resize events, except +// for frames and from within MDI and tabbed windows (client area +// size determined internally by GTK, not wxWin). /* void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) @@ -730,6 +732,7 @@ wxWindow::wxWindow() m_drawingOffsetX = 0; m_drawingOffsetY = 0; m_pDropTarget = NULL; + m_resizing = FALSE; }; wxWindow::wxWindow( wxWindow *parent, wxWindowID id, @@ -913,6 +916,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_drawingOffsetX = 0; m_drawingOffsetY = 0; m_pDropTarget = NULL; + m_resizing = FALSE; } void wxWindow::PostCreation(void) @@ -1059,6 +1063,9 @@ void wxWindow::ImplementSetPosition(void) void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) { + if (m_resizing) return; // I don't like recursions + m_resizing = TRUE; + int newX = x; int newY = y; int newW = width; @@ -1099,6 +1106,8 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); ProcessEvent( event ); + + m_resizing = FALSE; }; void wxWindow::SetSize( int width, int height ) @@ -1113,8 +1122,8 @@ void wxWindow::Move( int x, int y ) void wxWindow::GetSize( int *width, int *height ) const { - (*width) = m_width; - (*height) = m_height; + if (width) (*width) = m_width; + if (height) (*height) = m_height; }; void wxWindow::SetClientSize( int width, int height ) @@ -1423,6 +1432,8 @@ void wxWindow::AddChild( wxWindow *child ) }; }; + // wxNotebooks are very special, so they have their own AddChild + if (IsKindOf(CLASSINFO(wxNotebook))) { wxNotebook *tab = (wxNotebook*)this; @@ -1828,7 +1839,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->page_increment = (float)(wxMax(fthumb-2,0)); m_vAdjust->page_size = fthumb; }; - + if (m_wxwindow->window) { if (orient == wxHORIZONTAL) diff --git a/user/wxFile/filectrl.cpp b/user/wxFile/filectrl.cpp index 79630252e1..3dcbf7050d 100644 --- a/user/wxFile/filectrl.cpp +++ b/user/wxFile/filectrl.cpp @@ -222,7 +222,8 @@ wxFileCtrl::wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirN const long style, const wxString &name ) : wxListCtrl( win, id, pos, size, style, name ) { - wxImageList *imageList = new wxImageList(); + SetItemSpacing( 20 ); + wxImageList *imageList = new wxImageList( 18, 18 ); imageList->Add( wxBitmap( folder_xpm ) ); imageList->Add( wxBitmap( txt_xpm ) ); imageList->Add( wxBitmap( list_xpm ) ); -- 2.45.2