Fixed a layout bug in MyFixed

More things done after realization
  wxListCtrl is grey now. Why?


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-04-25 01:00:34 +00:00
parent 7ef156f797
commit 58dea4b067
14 changed files with 97 additions and 52 deletions

View File

@ -144,9 +144,6 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
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 );

View File

@ -191,7 +191,7 @@ void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
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);
}
@ -200,7 +200,7 @@ void MyFrame::OnToolEnter(wxCommandEvent& event)
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

View File

@ -22,7 +22,7 @@ class MyTimer : public wxTimer
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;

View File

@ -2335,6 +2335,8 @@ bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
else
m_headerWin = (wxListHeaderWindow *) NULL;
SetBackgroundColour( *wxWHITE );
return ret;
}
@ -2795,6 +2797,8 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
void wxListCtrl::SetBackgroundColour( const wxColour &colour )
{
wxWindow::SetBackgroundColour( colour );
if (m_mainWin)
{
m_mainWin->SetBackgroundColour( colour );
@ -2809,6 +2813,8 @@ void wxListCtrl::SetBackgroundColour( const wxColour &colour )
void wxListCtrl::SetForegroundColour( const wxColour &colour )
{
wxWindow::SetForegroundColour( colour );
if (m_mainWin)
{
m_mainWin->SetForegroundColour( colour );
@ -2823,6 +2829,8 @@ void wxListCtrl::SetForegroundColour( const wxColour &colour )
void wxListCtrl::SetFont( const wxFont &font )
{
wxWindow::SetFont( font );
if (m_mainWin)
{
m_mainWin->SetFont( font );

View File

@ -86,11 +86,11 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
// "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. */
@ -121,6 +121,14 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxWindow *win )
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;
}

View File

@ -150,11 +150,11 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
// "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. */
@ -185,6 +185,14 @@ gtk_frame_realized_callback( GtkWidget *widget, wxWindow *win )
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;
}
@ -334,7 +342,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
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 );
@ -927,6 +935,8 @@ void wxFrame::SetIcon( const wxIcon &icon )
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();

View File

@ -109,7 +109,7 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
(win->m_width == alloc->width) &&
(win->m_height == alloc->height))
{
// return;
return;
}
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );

View File

@ -319,18 +319,21 @@ gtk_myfixed_realize (GtkWidget *widget)
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;

View File

@ -1314,14 +1314,14 @@ gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
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 );
}
@ -1489,6 +1489,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
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 );
@ -1589,8 +1590,6 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
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 );
@ -3095,7 +3094,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
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" );

View File

@ -86,11 +86,11 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
// "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. */
@ -121,6 +121,14 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxWindow *win )
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;
}

View File

@ -150,11 +150,11 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
// "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. */
@ -185,6 +185,14 @@ gtk_frame_realized_callback( GtkWidget *widget, wxWindow *win )
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;
}
@ -334,7 +342,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
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 );
@ -927,6 +935,8 @@ void wxFrame::SetIcon( const wxIcon &icon )
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();

View File

@ -109,7 +109,7 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
(win->m_width == alloc->width) &&
(win->m_height == alloc->height))
{
// return;
return;
}
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );

View File

@ -319,18 +319,21 @@ gtk_myfixed_realize (GtkWidget *widget)
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;

View File

@ -1314,14 +1314,14 @@ gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
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 );
}
@ -1489,6 +1489,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
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 );
@ -1589,8 +1590,6 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
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 );
@ -3095,7 +3094,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
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" );