dc.DrawText( "Loaded image", 30, 10 );
if (my_square && my_square->Ok()) dc.DrawBitmap( *my_square, 30, 30 );
- wxBitmap bm( 1200, 1, 1 );
- dc.DrawBitmap( bm, 10, 10 );
-
dc.DrawText( "Drawn directly", 150, 10 );
dc.SetBrush( wxBrush( "orange", wxSOLID ) );
dc.SetPen( *wxWHITE_PEN );
void MyFrame::OnToolLeftClick(wxCommandEvent& event)
{
wxString str;
- str.Printf("Clicked on tool %d", event.GetId());
+ str.Printf( _T("Clicked on tool %d"), event.GetId());
SetStatusText(str);
}
if (event.GetSelection() > -1)
{
wxString str;
- str.Printf("This is tool number %d", event.GetSelection());
+ str.Printf(_T("This is tool number %d"), event.GetSelection());
SetStatusText(str);
}
else
public:
MyTimer(wxFrame *frame) { m_frame = frame; }
- virtual void Notify() { wxLogStatus(m_frame, "Timer arrived!"); }
+ virtual void Notify() { wxLogStatus(m_frame, _T("Timer arrived!") ); }
private:
wxFrame *m_frame;
else
m_headerWin = (wxListHeaderWindow *) NULL;
+ SetBackgroundColour( *wxWHITE );
+
return ret;
}
void wxListCtrl::SetBackgroundColour( const wxColour &colour )
{
+ wxWindow::SetBackgroundColour( colour );
+
if (m_mainWin)
{
m_mainWin->SetBackgroundColour( colour );
void wxListCtrl::SetForegroundColour( const wxColour &colour )
{
+ wxWindow::SetForegroundColour( colour );
+
if (m_mainWin)
{
m_mainWin->SetForegroundColour( colour );
void wxListCtrl::SetFont( const wxFont &font )
{
+ wxWindow::SetFont( font );
+
if (m_mainWin)
{
m_mainWin->SetFont( font );
// "realize" from m_widget
//-----------------------------------------------------------------------------
-/* we cannot MWM hints before the widget has been realized,
+/* we cannot MWM hints and icons before the widget has been realized,
so we do this directly after realization */
static gint
-gtk_dialog_realized_callback( GtkWidget *widget, wxWindow *win )
+gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
{
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
+ /* reset the icon */
+ if (win->m_icon != wxNullIcon)
+ {
+ wxIcon icon( win->m_icon );
+ win->m_icon = wxNullIcon;
+ win->SetIcon( icon );
+ }
+
return FALSE;
}
// "realize" from m_widget
//-----------------------------------------------------------------------------
-/* we cannot MWM hints before the widget has been realized,
+/* we cannot MWM hints and icons before the widget has been realized,
so we do this directly after realization */
static gint
-gtk_frame_realized_callback( GtkWidget *widget, wxWindow *win )
+gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
{
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
+ /* reset the icon */
+ if (win->m_icon != wxNullIcon)
+ {
+ wxIcon icon( win->m_icon );
+ win->m_icon = wxNullIcon;
+ win->SetIcon( icon );
+ }
+
return FALSE;
}
PostCreation();
- /* we cannot set MWM hints before the widget has
+ /* we cannot set MWM hints and icons before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
m_icon = icon;
if (!icon.Ok()) return;
+ if (!m_widget->window) return;
+
wxMask *mask = icon.GetMask();
GdkBitmap *bm = (GdkBitmap *) NULL;
if (mask) bm = mask->GetBitmap();
(win->m_width == alloc->width) &&
(win->m_height == alloc->height))
{
-// return;
+ return;
}
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
attributes.window_type = GDK_WINDOW_CHILD;
#if (GTK_MINOR_VERSION > 0)
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+
if (myfixed->shadow_type != GTK_SHADOW_NONE)
- {
- attributes.x = 2;
- attributes.y = 2;
- }
- else
- {
- attributes.x = 0;
- attributes.y = 0;
- }
- attributes.width = MAX (1, (gint)widget->allocation.width - attributes.x * 2 );
- attributes.height = MAX (1, (gint)widget->allocation.height - attributes.y * 2 );
+ {
+ attributes.x += 2;
+ attributes.y += 2;
+ attributes.width -= 4;
+ attributes.height -= 4;
+ }
+
+ if (attributes.width < 2) attributes.width = 2;
+ if (attributes.height < 2) attributes.height = 2;
#else
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
{
wxColour bg( win->m_backgroundColour );
- win->m_backgroundColour = wxNullColour;
+ win->SetBackgroundColour( wxNullColour );
win->SetBackgroundColour( bg );
}
if (win->m_foregroundColour != *wxBLACK)
{
wxColour fg( win->m_foregroundColour );
- win->m_foregroundColour = wxNullColour;
+ win->SetForegroundColour( wxNullColour );
win->SetForegroundColour( fg );
}
m_vAdjust = gtk_range_get_adjustment( GTK_RANGE(s_window->vscrollbar) );
m_wxwindow = gtk_myfixed_new();
+ gtk_widget_show( m_wxwindow );
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
-
+
#if (GTK_MINOR_VERSION > 0)
GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
gtk_signal_connect(GTK_OBJECT(m_vAdjust), "changed",
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
- gtk_widget_show( m_wxwindow );
-
if (m_parent) m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_vAdjust->page_size = fthumb;
}
- if (m_wxwindow->window)
+ if (m_wxwindow)
{
if (orient == wxHORIZONTAL)
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
// "realize" from m_widget
//-----------------------------------------------------------------------------
-/* we cannot MWM hints before the widget has been realized,
+/* we cannot MWM hints and icons before the widget has been realized,
so we do this directly after realization */
static gint
-gtk_dialog_realized_callback( GtkWidget *widget, wxWindow *win )
+gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
{
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
+ /* reset the icon */
+ if (win->m_icon != wxNullIcon)
+ {
+ wxIcon icon( win->m_icon );
+ win->m_icon = wxNullIcon;
+ win->SetIcon( icon );
+ }
+
return FALSE;
}
// "realize" from m_widget
//-----------------------------------------------------------------------------
-/* we cannot MWM hints before the widget has been realized,
+/* we cannot MWM hints and icons before the widget has been realized,
so we do this directly after realization */
static gint
-gtk_frame_realized_callback( GtkWidget *widget, wxWindow *win )
+gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
{
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
+ /* reset the icon */
+ if (win->m_icon != wxNullIcon)
+ {
+ wxIcon icon( win->m_icon );
+ win->m_icon = wxNullIcon;
+ win->SetIcon( icon );
+ }
+
return FALSE;
}
PostCreation();
- /* we cannot set MWM hints before the widget has
+ /* we cannot set MWM hints and icons before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
m_icon = icon;
if (!icon.Ok()) return;
+ if (!m_widget->window) return;
+
wxMask *mask = icon.GetMask();
GdkBitmap *bm = (GdkBitmap *) NULL;
if (mask) bm = mask->GetBitmap();
(win->m_width == alloc->width) &&
(win->m_height == alloc->height))
{
-// return;
+ return;
}
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
attributes.window_type = GDK_WINDOW_CHILD;
#if (GTK_MINOR_VERSION > 0)
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+
if (myfixed->shadow_type != GTK_SHADOW_NONE)
- {
- attributes.x = 2;
- attributes.y = 2;
- }
- else
- {
- attributes.x = 0;
- attributes.y = 0;
- }
- attributes.width = MAX (1, (gint)widget->allocation.width - attributes.x * 2 );
- attributes.height = MAX (1, (gint)widget->allocation.height - attributes.y * 2 );
+ {
+ attributes.x += 2;
+ attributes.y += 2;
+ attributes.width -= 4;
+ attributes.height -= 4;
+ }
+
+ if (attributes.width < 2) attributes.width = 2;
+ if (attributes.height < 2) attributes.height = 2;
#else
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
{
wxColour bg( win->m_backgroundColour );
- win->m_backgroundColour = wxNullColour;
+ win->SetBackgroundColour( wxNullColour );
win->SetBackgroundColour( bg );
}
if (win->m_foregroundColour != *wxBLACK)
{
wxColour fg( win->m_foregroundColour );
- win->m_foregroundColour = wxNullColour;
+ win->SetForegroundColour( wxNullColour );
win->SetForegroundColour( fg );
}
m_vAdjust = gtk_range_get_adjustment( GTK_RANGE(s_window->vscrollbar) );
m_wxwindow = gtk_myfixed_new();
+ gtk_widget_show( m_wxwindow );
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
-
+
#if (GTK_MINOR_VERSION > 0)
GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
gtk_signal_connect(GTK_OBJECT(m_vAdjust), "changed",
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
- gtk_widget_show( m_wxwindow );
-
if (m_parent) m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
m_vAdjust->page_size = fthumb;
}
- if (m_wxwindow->window)
+ if (m_wxwindow)
{
if (orient == wxHORIZONTAL)
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );