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)
bool m_hasScrolling;
bool m_hasVMT;
bool m_sizeSet;
+ bool m_resizing;
public: // Layout section
bool m_hasScrolling;
bool m_hasVMT;
bool m_sizeSet;
+ bool m_resizing;
public: // Layout section
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" );
}
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);
}
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,
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);
}
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);
{
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 );
};
};
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 );
{
if (!Ok()) return;
- return;
-
#ifdef USE_GDK_IMLIB
if (M_BMPDATA->m_bitmap) return; // not supported for bitmaps
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 )
// 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)
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)
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) )
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 );
};
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
//-----------------------------------------------------------------------------
m_children.Append(win);
-
wxNotebookPage *page = new wxNotebookPage();
page->m_id = GetPageCount();
(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" );
// @@@@ 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();
};
}
//-----------------------------------------------------------------------------
// 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 )
m_drawingOffsetX = 0;
m_drawingOffsetY = 0;
m_pDropTarget = NULL;
+ m_resizing = FALSE;
};
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
m_drawingOffsetX = 0;
m_drawingOffsetY = 0;
m_pDropTarget = NULL;
+ m_resizing = FALSE;
}
void wxWindow::PostCreation(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;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
ProcessEvent( event );
+
+ m_resizing = FALSE;
};
void wxWindow::SetSize( int width, int height )
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 )
};
};
+ // wxNotebooks are very special, so they have their own AddChild
+
if (IsKindOf(CLASSINFO(wxNotebook)))
{
wxNotebook *tab = (wxNotebook*)this;
m_vAdjust->page_increment = (float)(wxMax(fthumb-2,0));
m_vAdjust->page_size = fthumb;
};
-
+
if (m_wxwindow->window)
{
if (orient == wxHORIZONTAL)
{
if (!Ok()) return;
- return;
-
#ifdef USE_GDK_IMLIB
if (M_BMPDATA->m_bitmap) return; // not supported for bitmaps
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 )
// 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)
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)
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) )
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 );
};
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
//-----------------------------------------------------------------------------
m_children.Append(win);
-
wxNotebookPage *page = new wxNotebookPage();
page->m_id = GetPageCount();
(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" );
// @@@@ 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();
};
}
//-----------------------------------------------------------------------------
// 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 )
m_drawingOffsetX = 0;
m_drawingOffsetY = 0;
m_pDropTarget = NULL;
+ m_resizing = FALSE;
};
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
m_drawingOffsetX = 0;
m_drawingOffsetY = 0;
m_pDropTarget = NULL;
+ m_resizing = FALSE;
}
void wxWindow::PostCreation(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;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
ProcessEvent( event );
+
+ m_resizing = FALSE;
};
void wxWindow::SetSize( int width, int height )
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 )
};
};
+ // wxNotebooks are very special, so they have their own AddChild
+
if (IsKindOf(CLASSINFO(wxNotebook)))
{
wxNotebook *tab = (wxNotebook*)this;
m_vAdjust->page_increment = (float)(wxMax(fthumb-2,0));
m_vAdjust->page_size = fthumb;
};
-
+
if (m_wxwindow->window)
{
if (orient == wxHORIZONTAL)
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 ) );