SetBackground for ListBox and others
Removed the old and famous wxSplitter bug git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -95,6 +95,7 @@ class wxComboBox: public wxControl
|
|||||||
|
|
||||||
void SetFont( const wxFont &font );
|
void SetFont( const wxFont &font );
|
||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
|
void SetBackgroundColour( const wxColour &colour );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -100,7 +100,7 @@ class wxPaintDC: public wxDC
|
|||||||
GdkGC *m_textGC;
|
GdkGC *m_textGC;
|
||||||
GdkGC *m_bgGC;
|
GdkGC *m_bgGC;
|
||||||
GdkColormap *m_cmap;
|
GdkColormap *m_cmap;
|
||||||
bool m_isDrawable;
|
bool m_isMemDC;
|
||||||
|
|
||||||
void SetUpDC(void);
|
void SetUpDC(void);
|
||||||
GdkWindow *GetWindow(void);
|
GdkWindow *GetWindow(void);
|
||||||
|
@@ -236,6 +236,8 @@ public:
|
|||||||
void ConnectWidget( GtkWidget *widget );
|
void ConnectWidget( GtkWidget *widget );
|
||||||
void ConnectDnDWidget( GtkWidget *widget );
|
void ConnectDnDWidget( GtkWidget *widget );
|
||||||
void DisconnectDnDWidget( GtkWidget *widget );
|
void DisconnectDnDWidget( GtkWidget *widget );
|
||||||
|
|
||||||
|
void SetBackgroundColourHelper( GdkWindow *window );
|
||||||
|
|
||||||
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||||
const wxSize &size, long style, const wxString &name );
|
const wxSize &size, long style, const wxString &name );
|
||||||
@@ -315,11 +317,6 @@ public:
|
|||||||
virtual void GetClientSizeConstraint(int *w, int *h) const ;
|
virtual void GetClientSizeConstraint(int *w, int *h) const ;
|
||||||
virtual void GetPositionConstraint(int *x, int *y) const ;
|
virtual void GetPositionConstraint(int *x, int *y) const ;
|
||||||
|
|
||||||
protected:
|
|
||||||
// set background colour for arbitrary window (useful because some windows
|
|
||||||
// don't work with m_wxwindow, e.g. wxTextCtrl)
|
|
||||||
void SetBackgroundColourHelper( const wxColour &colour, GdkWindow *window );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -95,6 +95,7 @@ class wxComboBox: public wxControl
|
|||||||
|
|
||||||
void SetFont( const wxFont &font );
|
void SetFont( const wxFont &font );
|
||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
|
void SetBackgroundColour( const wxColour &colour );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -100,7 +100,7 @@ class wxPaintDC: public wxDC
|
|||||||
GdkGC *m_textGC;
|
GdkGC *m_textGC;
|
||||||
GdkGC *m_bgGC;
|
GdkGC *m_bgGC;
|
||||||
GdkColormap *m_cmap;
|
GdkColormap *m_cmap;
|
||||||
bool m_isDrawable;
|
bool m_isMemDC;
|
||||||
|
|
||||||
void SetUpDC(void);
|
void SetUpDC(void);
|
||||||
GdkWindow *GetWindow(void);
|
GdkWindow *GetWindow(void);
|
||||||
|
@@ -236,6 +236,8 @@ public:
|
|||||||
void ConnectWidget( GtkWidget *widget );
|
void ConnectWidget( GtkWidget *widget );
|
||||||
void ConnectDnDWidget( GtkWidget *widget );
|
void ConnectDnDWidget( GtkWidget *widget );
|
||||||
void DisconnectDnDWidget( GtkWidget *widget );
|
void DisconnectDnDWidget( GtkWidget *widget );
|
||||||
|
|
||||||
|
void SetBackgroundColourHelper( GdkWindow *window );
|
||||||
|
|
||||||
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||||
const wxSize &size, long style, const wxString &name );
|
const wxSize &size, long style, const wxString &name );
|
||||||
@@ -315,11 +317,6 @@ public:
|
|||||||
virtual void GetClientSizeConstraint(int *w, int *h) const ;
|
virtual void GetClientSizeConstraint(int *w, int *h) const ;
|
||||||
virtual void GetPositionConstraint(int *x, int *y) const ;
|
virtual void GetPositionConstraint(int *x, int *y) const ;
|
||||||
|
|
||||||
protected:
|
|
||||||
// set background colour for arbitrary window (useful because some windows
|
|
||||||
// don't work with m_wxwindow, e.g. wxTextCtrl)
|
|
||||||
void SetBackgroundColourHelper( const wxColour &colour, GdkWindow *window );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -28,6 +28,11 @@
|
|||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
#include "mondrian.xpm"
|
#include "mondrian.xpm"
|
||||||
|
#include "icons/choice.xpm"
|
||||||
|
#include "icons/combo.xpm"
|
||||||
|
#include "icons/list.xpm"
|
||||||
|
#include "icons/radio.xpm"
|
||||||
|
#include "icons/text.xpm"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -227,6 +232,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
|||||||
Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Max
|
Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Max
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// fill the image list
|
||||||
|
#ifdef __WXMSW__
|
||||||
const char *aIconNames[] =
|
const char *aIconNames[] =
|
||||||
{
|
{
|
||||||
"list.xpm", "choice.xpm", "combo.xpm", "text.xpm", "radio.xpm"
|
"list.xpm", "choice.xpm", "combo.xpm", "text.xpm", "radio.xpm"
|
||||||
@@ -234,15 +241,22 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
|||||||
|
|
||||||
wxASSERT( WXSIZEOF(aIconNames) == Image_Max ); // keep in sync
|
wxASSERT( WXSIZEOF(aIconNames) == Image_Max ); // keep in sync
|
||||||
|
|
||||||
// TODO should find the dir from path to program
|
wxString strIconDir = "icons/";
|
||||||
wxString strIconDir = "icons/";
|
|
||||||
|
|
||||||
// fill the image list
|
|
||||||
wxImageList *imagelist = new wxImageList(32, 32);
|
wxImageList *imagelist = new wxImageList(32, 32);
|
||||||
for ( size_t n = 0; n < Image_Max; n++ )
|
for ( size_t n = 0; n < Image_Max; n++ )
|
||||||
{
|
{
|
||||||
imagelist->Add(wxBitmap(strIconDir + aIconNames[n]));
|
imagelist->Add(wxBitmap(strIconDir + aIconNames[n]));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxImageList *imagelist = new wxImageList(32, 32);
|
||||||
|
|
||||||
|
imagelist-> Add( wxBitmap( list_xpm ));
|
||||||
|
imagelist-> Add( wxBitmap( choice_xpm ));
|
||||||
|
imagelist-> Add( wxBitmap( combo_xpm ));
|
||||||
|
imagelist-> Add( wxBitmap( text_xpm ));
|
||||||
|
imagelist-> Add( wxBitmap( radio_xpm ));
|
||||||
|
#endif
|
||||||
|
|
||||||
m_notebook->SetImageList(imagelist);
|
m_notebook->SetImageList(imagelist);
|
||||||
|
|
||||||
|
@@ -130,6 +130,12 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
|||||||
gtk_widget_get_style( m_widget ) ) );
|
gtk_widget_get_style( m_widget ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_backgroundColour != wxNullColour)
|
||||||
|
{
|
||||||
|
GtkBin *bin = GTK_BIN( list_item );
|
||||||
|
SetBackgroundColourHelper( bin->child->window );
|
||||||
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||||
|
|
||||||
@@ -426,3 +432,18 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
(window == GTK_COMBO(m_widget)->button->window ) );
|
(window == GTK_COMBO(m_widget)->button->window ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SetBackgroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
wxWindow::SetBackgroundColour( colour );
|
||||||
|
|
||||||
|
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||||
|
|
||||||
|
GList *child = GTK_LIST(list)->children;
|
||||||
|
while (child)
|
||||||
|
{
|
||||||
|
GtkBin *bin = (GtkBin*) child->data;
|
||||||
|
SetBackgroundColourHelper( bin->child->window );
|
||||||
|
child = child->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -92,6 +92,7 @@ wxPaintDC::wxPaintDC(void)
|
|||||||
m_textGC = (GdkGC *) NULL;
|
m_textGC = (GdkGC *) NULL;
|
||||||
m_bgGC = (GdkGC *) NULL;
|
m_bgGC = (GdkGC *) NULL;
|
||||||
m_cmap = (GdkColormap *) NULL;
|
m_cmap = (GdkColormap *) NULL;
|
||||||
|
m_isMemDC = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPaintDC::wxPaintDC( wxWindow *window )
|
wxPaintDC::wxPaintDC( wxWindow *window )
|
||||||
@@ -112,7 +113,7 @@ wxPaintDC::wxPaintDC( wxWindow *window )
|
|||||||
else
|
else
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
||||||
|
|
||||||
m_isDrawable = TRUE;
|
m_isMemDC = FALSE;
|
||||||
|
|
||||||
SetUpDC();
|
SetUpDC();
|
||||||
}
|
}
|
||||||
@@ -137,9 +138,7 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
// FIXME: is this right? Causes a segfault on my system and doesn't
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
// seem right: wxPaintDC does not inherit from wxMemoryDC
|
|
||||||
// if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
@@ -152,9 +151,7 @@ void wxPaintDC::CrossHair( long x, long y )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
// FIXME: is this right? Causes a segfault on my system and doesn't
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
// seem right: wxPaintDC does not inherit from wxMemoryDC
|
|
||||||
// if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
@@ -174,7 +171,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx1 = XLOG2DEV(x1);
|
long xx1 = XLOG2DEV(x1);
|
||||||
long yy1 = YLOG2DEV(y1);
|
long yy1 = YLOG2DEV(y1);
|
||||||
@@ -224,7 +221,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
@@ -248,7 +245,7 @@ void wxPaintDC::DrawPoint( long x, long y )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
||||||
@@ -258,7 +255,7 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
|
||||||
@@ -276,7 +273,7 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
|
||||||
@@ -298,7 +295,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (!n) return; // Nothing to draw
|
if (!n) return; // Nothing to draw
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
||||||
@@ -325,7 +322,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
int n = lines->Number();
|
int n = lines->Number();
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n];
|
GdkPoint *gdkpoints = new GdkPoint[n];
|
||||||
@@ -359,7 +356,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
@@ -384,7 +381,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
|
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
|
||||||
|
|
||||||
@@ -451,7 +448,7 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
@@ -480,7 +477,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
|
|||||||
|
|
||||||
if (!icon.Ok()) return;
|
if (!icon.Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
int xx = XLOG2DEV(x);
|
int xx = XLOG2DEV(x);
|
||||||
int yy = YLOG2DEV(y);
|
int yy = YLOG2DEV(y);
|
||||||
@@ -509,10 +506,9 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
{
|
{
|
||||||
if (!Ok()) return FALSE;
|
if (!Ok()) return FALSE;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
// CMB 20/5/98: add blitting of bitmaps
|
if (m_isMemDC)
|
||||||
if (source->IsKindOf(CLASSINFO(wxMemoryDC)))
|
|
||||||
{
|
{
|
||||||
wxMemoryDC* srcDC = (wxMemoryDC*)source;
|
wxMemoryDC* srcDC = (wxMemoryDC*)source;
|
||||||
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
|
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
|
||||||
@@ -551,7 +547,7 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
|
|
||||||
@@ -622,9 +618,9 @@ void wxPaintDC::Clear(void)
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_isDrawable)
|
if (!m_isMemDC)
|
||||||
{
|
{
|
||||||
gdk_window_clear( m_window );
|
gdk_window_clear( m_window );
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
|||||||
|
|
||||||
SetUpDC();
|
SetUpDC();
|
||||||
|
|
||||||
m_isDrawable = FALSE;
|
m_isMemDC = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -136,6 +136,8 @@ void wxListBox::Append( const wxString &item )
|
|||||||
|
|
||||||
void wxListBox::Append( const wxString &item, char *clientData )
|
void wxListBox::Append( const wxString &item, char *clientData )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||||
|
|
||||||
if (m_hasOwnStyle)
|
if (m_hasOwnStyle)
|
||||||
@@ -143,9 +145,13 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
|||||||
GtkBin *bin = GTK_BIN( list_item );
|
GtkBin *bin = GTK_BIN( list_item );
|
||||||
gtk_widget_set_style( bin->child,
|
gtk_widget_set_style( bin->child,
|
||||||
gtk_style_ref(
|
gtk_style_ref(
|
||||||
gtk_widget_get_style( m_widget ) ) );
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
|
|
||||||
|
gtk_widget_set_style( GTK_WIDGET(bin),
|
||||||
|
gtk_style_ref(
|
||||||
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
@@ -162,11 +168,12 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
|||||||
ConnectWidget( list_item );
|
ConnectWidget( list_item );
|
||||||
|
|
||||||
ConnectDnDWidget( list_item );
|
ConnectDnDWidget( list_item );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::Clear(void)
|
void wxListBox::Clear(void)
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
gtk_list_clear_items( m_list, 0, Number() );
|
gtk_list_clear_items( m_list, 0, Number() );
|
||||||
|
|
||||||
m_clientData.Clear();
|
m_clientData.Clear();
|
||||||
@@ -174,6 +181,8 @@ void wxListBox::Clear(void)
|
|||||||
|
|
||||||
void wxListBox::Delete( int n )
|
void wxListBox::Delete( int n )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
|
|
||||||
if (!child)
|
if (!child)
|
||||||
@@ -197,11 +206,15 @@ void wxListBox::Delete( int n )
|
|||||||
|
|
||||||
void wxListBox::Deselect( int n )
|
void wxListBox::Deselect( int n )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
gtk_list_unselect_item( m_list, n );
|
gtk_list_unselect_item( m_list, n );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::FindString( const wxString &item ) const
|
int wxListBox::FindString( const wxString &item ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -222,6 +235,8 @@ int wxListBox::FindString( const wxString &item ) const
|
|||||||
|
|
||||||
char *wxListBox::GetClientData( int n ) const
|
char *wxListBox::GetClientData( int n ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, (char*) NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
if (node) return ((char*)node->Data());
|
if (node) return ((char*)node->Data());
|
||||||
|
|
||||||
@@ -231,6 +246,8 @@ char *wxListBox::GetClientData( int n ) const
|
|||||||
|
|
||||||
int wxListBox::GetSelection(void) const
|
int wxListBox::GetSelection(void) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -244,6 +261,8 @@ int wxListBox::GetSelection(void) const
|
|||||||
|
|
||||||
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
// get the number of selected items first
|
// get the number of selected items first
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -271,6 +290,8 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
|||||||
|
|
||||||
wxString wxListBox::GetString( int n ) const
|
wxString wxListBox::GetString( int n ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
@@ -284,6 +305,8 @@ wxString wxListBox::GetString( int n ) const
|
|||||||
|
|
||||||
wxString wxListBox::GetStringSelection(void) const
|
wxString wxListBox::GetStringSelection(void) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
|
||||||
|
|
||||||
GList *selection = m_list->selection;
|
GList *selection = m_list->selection;
|
||||||
if (selection)
|
if (selection)
|
||||||
{
|
{
|
||||||
@@ -297,6 +320,8 @@ wxString wxListBox::GetStringSelection(void) const
|
|||||||
|
|
||||||
int wxListBox::Number(void)
|
int wxListBox::Number(void)
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child) { count++; child = child->next; }
|
while (child) { count++; child = child->next; }
|
||||||
@@ -305,6 +330,8 @@ int wxListBox::Number(void)
|
|||||||
|
|
||||||
bool wxListBox::Selected( int n )
|
bool wxListBox::Selected( int n )
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, FALSE, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *target = g_list_nth( m_list->children, n );
|
GList *target = g_list_nth( m_list->children, n );
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
@@ -326,6 +353,8 @@ void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) )
|
|||||||
|
|
||||||
void wxListBox::SetClientData( int n, char *clientData )
|
void wxListBox::SetClientData( int n, char *clientData )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
@@ -349,6 +378,8 @@ void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
|
|||||||
|
|
||||||
void wxListBox::SetSelection( int n, bool select )
|
void wxListBox::SetSelection( int n, bool select )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
if (select)
|
if (select)
|
||||||
gtk_list_select_item( m_list, n );
|
gtk_list_select_item( m_list, n );
|
||||||
else
|
else
|
||||||
@@ -357,6 +388,8 @@ void wxListBox::SetSelection( int n, bool select )
|
|||||||
|
|
||||||
void wxListBox::SetString( int n, const wxString &string )
|
void wxListBox::SetString( int n, const wxString &string )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
@@ -372,6 +405,8 @@ void wxListBox::SetString( int n, const wxString &string )
|
|||||||
|
|
||||||
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
SetSelection( FindString(string), select );
|
SetSelection( FindString(string), select );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,6 +428,8 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
|||||||
|
|
||||||
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
@@ -417,7 +454,29 @@ GtkWidget *wxListBox::GetConnectWidget(void)
|
|||||||
|
|
||||||
void wxListBox::SetFont( const wxFont &font )
|
void wxListBox::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
wxWindow::SetFont( font );
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
|
if (((wxFont*)&font)->Ok())
|
||||||
|
m_font = font;
|
||||||
|
else
|
||||||
|
m_font = *wxSWISS_FONT;
|
||||||
|
|
||||||
|
GtkStyle *style = (GtkStyle*) NULL;
|
||||||
|
if (!m_hasOwnStyle)
|
||||||
|
{
|
||||||
|
m_hasOwnStyle = TRUE;
|
||||||
|
style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
style = gtk_widget_get_style( GTK_WIDGET(m_list) );
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_font_unref( style->font );
|
||||||
|
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||||
|
|
||||||
|
gtk_widget_set_style( GTK_WIDGET(m_list), style );
|
||||||
|
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -425,7 +484,7 @@ void wxListBox::SetFont( const wxFont &font )
|
|||||||
GtkBin *bin = (GtkBin*) child->data;
|
GtkBin *bin = (GtkBin*) child->data;
|
||||||
gtk_widget_set_style( bin->child,
|
gtk_widget_set_style( bin->child,
|
||||||
gtk_style_ref(
|
gtk_style_ref(
|
||||||
gtk_widget_get_style( m_widget ) ) );
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -437,7 +496,7 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
GtkBin *bin = (GtkBin*) child->data;
|
GtkBin *bin = GTK_BIN( child->data );
|
||||||
if (bin->child->window == window) return TRUE;
|
if (bin->child->window == window) return TRUE;
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
@@ -445,10 +504,39 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetBackgroundColour(const wxColour &colour)
|
void wxListBox::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
SetBackgroundColourHelper( colour, GTK_WIDGET(m_list)->window );
|
m_backgroundColour = colour;
|
||||||
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
|
SetBackgroundColourHelper( GTK_WIDGET(m_list)->window );
|
||||||
|
|
||||||
|
GtkStyle *style = (GtkStyle*) NULL;
|
||||||
|
if (!m_hasOwnStyle)
|
||||||
|
{
|
||||||
|
m_hasOwnStyle = TRUE;
|
||||||
|
style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
style = gtk_widget_get_style( GTK_WIDGET(m_list) );
|
||||||
|
}
|
||||||
|
|
||||||
|
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
|
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
|
|
||||||
|
gtk_widget_set_style( GTK_WIDGET(m_list), style );
|
||||||
|
|
||||||
|
GList *child = m_list->children;
|
||||||
|
while (child)
|
||||||
|
{
|
||||||
|
GtkWidget *item = GTK_WIDGET(child->data);
|
||||||
|
gtk_widget_set_style( item,
|
||||||
|
gtk_style_ref(
|
||||||
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
|
child = child->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -464,12 +464,11 @@ void wxTextCtrl::SetFont( const wxFont &font )
|
|||||||
gtk_widget_set_style( m_text, style );
|
gtk_widget_set_style( m_text, style );
|
||||||
}
|
}
|
||||||
|
|
||||||
// as our GTK widget is m_text and not m_widget, we have to override
|
|
||||||
// SetBackgroundColour() to make it work
|
|
||||||
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||||
|
|
||||||
// NB: the GtkEntry and GtkText classes have text_area at the same offset
|
m_backgroundColour = colour;
|
||||||
SetBackgroundColourHelper( colour, GTK_TEXT(m_text)->text_area );
|
|
||||||
|
SetBackgroundColourHelper( GTK_TEXT(m_text)->text_area );
|
||||||
}
|
}
|
||||||
|
@@ -1096,7 +1096,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
|||||||
if (m_cursor == NULL)
|
if (m_cursor == NULL)
|
||||||
m_cursor = new wxCursor( wxCURSOR_ARROW );
|
m_cursor = new wxCursor( wxCURSOR_ARROW );
|
||||||
m_font = *wxSWISS_FONT;
|
m_font = *wxSWISS_FONT;
|
||||||
m_backgroundColour = wxWHITE;
|
// m_backgroundColour = wxWHITE;
|
||||||
m_foregroundColour = wxBLACK;
|
m_foregroundColour = wxBLACK;
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_windowName = name;
|
m_windowName = name;
|
||||||
@@ -1939,7 +1939,7 @@ bool wxWindow::IsExposed( const wxRect& rect ) const
|
|||||||
|
|
||||||
void wxWindow::Clear()
|
void wxWindow::Clear()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||||
|
|
||||||
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
|
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
|
||||||
}
|
}
|
||||||
@@ -1949,21 +1949,23 @@ wxColour wxWindow::GetBackgroundColour() const
|
|||||||
return m_backgroundColour;
|
return m_backgroundColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetBackgroundColourHelper(const wxColour& colour,
|
void wxWindow::SetBackgroundColourHelper( GdkWindow *window )
|
||||||
GdkWindow *window)
|
|
||||||
{
|
{
|
||||||
m_backgroundColour = colour;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap(window) );
|
|
||||||
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetBackgroundColour( const wxColour &colour )
|
void wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_widget != NULL, "invalid window" );
|
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||||
|
|
||||||
|
m_backgroundColour = colour;
|
||||||
|
|
||||||
GtkWidget *widget = m_wxwindow == NULL ? m_widget : m_wxwindow;
|
GtkWidget *widget = m_wxwindow == NULL ? m_widget : m_wxwindow;
|
||||||
SetBackgroundColourHelper( colour, widget->window );
|
SetBackgroundColourHelper( widget->window );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxWindow::GetForegroundColour() const
|
wxColour wxWindow::GetForegroundColour() const
|
||||||
@@ -1978,7 +1980,7 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
bool wxWindow::Validate()
|
bool wxWindow::Validate()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||||
|
|
||||||
wxNode *node = GetChildren()->First();
|
wxNode *node = GetChildren()->First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -1993,7 +1995,7 @@ bool wxWindow::Validate()
|
|||||||
|
|
||||||
bool wxWindow::TransferDataToWindow()
|
bool wxWindow::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||||
|
|
||||||
wxNode *node = GetChildren()->First();
|
wxNode *node = GetChildren()->First();
|
||||||
while (node)
|
while (node)
|
||||||
|
@@ -130,6 +130,12 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
|||||||
gtk_widget_get_style( m_widget ) ) );
|
gtk_widget_get_style( m_widget ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_backgroundColour != wxNullColour)
|
||||||
|
{
|
||||||
|
GtkBin *bin = GTK_BIN( list_item );
|
||||||
|
SetBackgroundColourHelper( bin->child->window );
|
||||||
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||||
|
|
||||||
@@ -426,3 +432,18 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
(window == GTK_COMBO(m_widget)->button->window ) );
|
(window == GTK_COMBO(m_widget)->button->window ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SetBackgroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
wxWindow::SetBackgroundColour( colour );
|
||||||
|
|
||||||
|
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||||
|
|
||||||
|
GList *child = GTK_LIST(list)->children;
|
||||||
|
while (child)
|
||||||
|
{
|
||||||
|
GtkBin *bin = (GtkBin*) child->data;
|
||||||
|
SetBackgroundColourHelper( bin->child->window );
|
||||||
|
child = child->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -92,6 +92,7 @@ wxPaintDC::wxPaintDC(void)
|
|||||||
m_textGC = (GdkGC *) NULL;
|
m_textGC = (GdkGC *) NULL;
|
||||||
m_bgGC = (GdkGC *) NULL;
|
m_bgGC = (GdkGC *) NULL;
|
||||||
m_cmap = (GdkColormap *) NULL;
|
m_cmap = (GdkColormap *) NULL;
|
||||||
|
m_isMemDC = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPaintDC::wxPaintDC( wxWindow *window )
|
wxPaintDC::wxPaintDC( wxWindow *window )
|
||||||
@@ -112,7 +113,7 @@ wxPaintDC::wxPaintDC( wxWindow *window )
|
|||||||
else
|
else
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
||||||
|
|
||||||
m_isDrawable = TRUE;
|
m_isMemDC = FALSE;
|
||||||
|
|
||||||
SetUpDC();
|
SetUpDC();
|
||||||
}
|
}
|
||||||
@@ -137,9 +138,7 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
// FIXME: is this right? Causes a segfault on my system and doesn't
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
// seem right: wxPaintDC does not inherit from wxMemoryDC
|
|
||||||
// if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
@@ -152,9 +151,7 @@ void wxPaintDC::CrossHair( long x, long y )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
// FIXME: is this right? Causes a segfault on my system and doesn't
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
// seem right: wxPaintDC does not inherit from wxMemoryDC
|
|
||||||
// if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
@@ -174,7 +171,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx1 = XLOG2DEV(x1);
|
long xx1 = XLOG2DEV(x1);
|
||||||
long yy1 = YLOG2DEV(y1);
|
long yy1 = YLOG2DEV(y1);
|
||||||
@@ -224,7 +221,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
@@ -248,7 +245,7 @@ void wxPaintDC::DrawPoint( long x, long y )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
||||||
@@ -258,7 +255,7 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
|
||||||
@@ -276,7 +273,7 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
|
||||||
@@ -298,7 +295,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (!n) return; // Nothing to draw
|
if (!n) return; // Nothing to draw
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
||||||
@@ -325,7 +322,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
int n = lines->Number();
|
int n = lines->Number();
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n];
|
GdkPoint *gdkpoints = new GdkPoint[n];
|
||||||
@@ -359,7 +356,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
@@ -384,7 +381,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
|
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
|
||||||
|
|
||||||
@@ -451,7 +448,7 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
@@ -480,7 +477,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
|
|||||||
|
|
||||||
if (!icon.Ok()) return;
|
if (!icon.Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
int xx = XLOG2DEV(x);
|
int xx = XLOG2DEV(x);
|
||||||
int yy = YLOG2DEV(y);
|
int yy = YLOG2DEV(y);
|
||||||
@@ -509,10 +506,9 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
{
|
{
|
||||||
if (!Ok()) return FALSE;
|
if (!Ok()) return FALSE;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
// CMB 20/5/98: add blitting of bitmaps
|
if (m_isMemDC)
|
||||||
if (source->IsKindOf(CLASSINFO(wxMemoryDC)))
|
|
||||||
{
|
{
|
||||||
wxMemoryDC* srcDC = (wxMemoryDC*)source;
|
wxMemoryDC* srcDC = (wxMemoryDC*)source;
|
||||||
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
|
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
|
||||||
@@ -551,7 +547,7 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
|
|
||||||
@@ -622,9 +618,9 @@ void wxPaintDC::Clear(void)
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!m_isDrawable) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
if (m_isMemDC) ((wxMemoryDC*)this)->m_selected.DestroyImage();
|
||||||
|
|
||||||
if (m_isDrawable)
|
if (!m_isMemDC)
|
||||||
{
|
{
|
||||||
gdk_window_clear( m_window );
|
gdk_window_clear( m_window );
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
|||||||
|
|
||||||
SetUpDC();
|
SetUpDC();
|
||||||
|
|
||||||
m_isDrawable = FALSE;
|
m_isMemDC = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -136,6 +136,8 @@ void wxListBox::Append( const wxString &item )
|
|||||||
|
|
||||||
void wxListBox::Append( const wxString &item, char *clientData )
|
void wxListBox::Append( const wxString &item, char *clientData )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||||
|
|
||||||
if (m_hasOwnStyle)
|
if (m_hasOwnStyle)
|
||||||
@@ -143,9 +145,13 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
|||||||
GtkBin *bin = GTK_BIN( list_item );
|
GtkBin *bin = GTK_BIN( list_item );
|
||||||
gtk_widget_set_style( bin->child,
|
gtk_widget_set_style( bin->child,
|
||||||
gtk_style_ref(
|
gtk_style_ref(
|
||||||
gtk_widget_get_style( m_widget ) ) );
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
|
|
||||||
|
gtk_widget_set_style( GTK_WIDGET(bin),
|
||||||
|
gtk_style_ref(
|
||||||
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
@@ -162,11 +168,12 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
|||||||
ConnectWidget( list_item );
|
ConnectWidget( list_item );
|
||||||
|
|
||||||
ConnectDnDWidget( list_item );
|
ConnectDnDWidget( list_item );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::Clear(void)
|
void wxListBox::Clear(void)
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
gtk_list_clear_items( m_list, 0, Number() );
|
gtk_list_clear_items( m_list, 0, Number() );
|
||||||
|
|
||||||
m_clientData.Clear();
|
m_clientData.Clear();
|
||||||
@@ -174,6 +181,8 @@ void wxListBox::Clear(void)
|
|||||||
|
|
||||||
void wxListBox::Delete( int n )
|
void wxListBox::Delete( int n )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
|
|
||||||
if (!child)
|
if (!child)
|
||||||
@@ -197,11 +206,15 @@ void wxListBox::Delete( int n )
|
|||||||
|
|
||||||
void wxListBox::Deselect( int n )
|
void wxListBox::Deselect( int n )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
gtk_list_unselect_item( m_list, n );
|
gtk_list_unselect_item( m_list, n );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::FindString( const wxString &item ) const
|
int wxListBox::FindString( const wxString &item ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -222,6 +235,8 @@ int wxListBox::FindString( const wxString &item ) const
|
|||||||
|
|
||||||
char *wxListBox::GetClientData( int n ) const
|
char *wxListBox::GetClientData( int n ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, (char*) NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
if (node) return ((char*)node->Data());
|
if (node) return ((char*)node->Data());
|
||||||
|
|
||||||
@@ -231,6 +246,8 @@ char *wxListBox::GetClientData( int n ) const
|
|||||||
|
|
||||||
int wxListBox::GetSelection(void) const
|
int wxListBox::GetSelection(void) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -244,6 +261,8 @@ int wxListBox::GetSelection(void) const
|
|||||||
|
|
||||||
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
// get the number of selected items first
|
// get the number of selected items first
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -271,6 +290,8 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
|||||||
|
|
||||||
wxString wxListBox::GetString( int n ) const
|
wxString wxListBox::GetString( int n ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
@@ -284,6 +305,8 @@ wxString wxListBox::GetString( int n ) const
|
|||||||
|
|
||||||
wxString wxListBox::GetStringSelection(void) const
|
wxString wxListBox::GetStringSelection(void) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
|
||||||
|
|
||||||
GList *selection = m_list->selection;
|
GList *selection = m_list->selection;
|
||||||
if (selection)
|
if (selection)
|
||||||
{
|
{
|
||||||
@@ -297,6 +320,8 @@ wxString wxListBox::GetStringSelection(void) const
|
|||||||
|
|
||||||
int wxListBox::Number(void)
|
int wxListBox::Number(void)
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child) { count++; child = child->next; }
|
while (child) { count++; child = child->next; }
|
||||||
@@ -305,6 +330,8 @@ int wxListBox::Number(void)
|
|||||||
|
|
||||||
bool wxListBox::Selected( int n )
|
bool wxListBox::Selected( int n )
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( m_list != NULL, FALSE, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *target = g_list_nth( m_list->children, n );
|
GList *target = g_list_nth( m_list->children, n );
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
@@ -326,6 +353,8 @@ void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) )
|
|||||||
|
|
||||||
void wxListBox::SetClientData( int n, char *clientData )
|
void wxListBox::SetClientData( int n, char *clientData )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
@@ -349,6 +378,8 @@ void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
|
|||||||
|
|
||||||
void wxListBox::SetSelection( int n, bool select )
|
void wxListBox::SetSelection( int n, bool select )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
if (select)
|
if (select)
|
||||||
gtk_list_select_item( m_list, n );
|
gtk_list_select_item( m_list, n );
|
||||||
else
|
else
|
||||||
@@ -357,6 +388,8 @@ void wxListBox::SetSelection( int n, bool select )
|
|||||||
|
|
||||||
void wxListBox::SetString( int n, const wxString &string )
|
void wxListBox::SetString( int n, const wxString &string )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
@@ -372,6 +405,8 @@ void wxListBox::SetString( int n, const wxString &string )
|
|||||||
|
|
||||||
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
SetSelection( FindString(string), select );
|
SetSelection( FindString(string), select );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,6 +428,8 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
|||||||
|
|
||||||
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
@@ -417,7 +454,29 @@ GtkWidget *wxListBox::GetConnectWidget(void)
|
|||||||
|
|
||||||
void wxListBox::SetFont( const wxFont &font )
|
void wxListBox::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
wxWindow::SetFont( font );
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
|
if (((wxFont*)&font)->Ok())
|
||||||
|
m_font = font;
|
||||||
|
else
|
||||||
|
m_font = *wxSWISS_FONT;
|
||||||
|
|
||||||
|
GtkStyle *style = (GtkStyle*) NULL;
|
||||||
|
if (!m_hasOwnStyle)
|
||||||
|
{
|
||||||
|
m_hasOwnStyle = TRUE;
|
||||||
|
style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
style = gtk_widget_get_style( GTK_WIDGET(m_list) );
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_font_unref( style->font );
|
||||||
|
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||||
|
|
||||||
|
gtk_widget_set_style( GTK_WIDGET(m_list), style );
|
||||||
|
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -425,7 +484,7 @@ void wxListBox::SetFont( const wxFont &font )
|
|||||||
GtkBin *bin = (GtkBin*) child->data;
|
GtkBin *bin = (GtkBin*) child->data;
|
||||||
gtk_widget_set_style( bin->child,
|
gtk_widget_set_style( bin->child,
|
||||||
gtk_style_ref(
|
gtk_style_ref(
|
||||||
gtk_widget_get_style( m_widget ) ) );
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -437,7 +496,7 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
GtkBin *bin = (GtkBin*) child->data;
|
GtkBin *bin = GTK_BIN( child->data );
|
||||||
if (bin->child->window == window) return TRUE;
|
if (bin->child->window == window) return TRUE;
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
@@ -445,10 +504,39 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetBackgroundColour(const wxColour &colour)
|
void wxListBox::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
|
||||||
|
|
||||||
SetBackgroundColourHelper( colour, GTK_WIDGET(m_list)->window );
|
m_backgroundColour = colour;
|
||||||
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
|
SetBackgroundColourHelper( GTK_WIDGET(m_list)->window );
|
||||||
|
|
||||||
|
GtkStyle *style = (GtkStyle*) NULL;
|
||||||
|
if (!m_hasOwnStyle)
|
||||||
|
{
|
||||||
|
m_hasOwnStyle = TRUE;
|
||||||
|
style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
style = gtk_widget_get_style( GTK_WIDGET(m_list) );
|
||||||
|
}
|
||||||
|
|
||||||
|
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
|
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
|
|
||||||
|
gtk_widget_set_style( GTK_WIDGET(m_list), style );
|
||||||
|
|
||||||
|
GList *child = m_list->children;
|
||||||
|
while (child)
|
||||||
|
{
|
||||||
|
GtkWidget *item = GTK_WIDGET(child->data);
|
||||||
|
gtk_widget_set_style( item,
|
||||||
|
gtk_style_ref(
|
||||||
|
gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
|
||||||
|
child = child->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -464,12 +464,11 @@ void wxTextCtrl::SetFont( const wxFont &font )
|
|||||||
gtk_widget_set_style( m_text, style );
|
gtk_widget_set_style( m_text, style );
|
||||||
}
|
}
|
||||||
|
|
||||||
// as our GTK widget is m_text and not m_widget, we have to override
|
|
||||||
// SetBackgroundColour() to make it work
|
|
||||||
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||||
|
|
||||||
// NB: the GtkEntry and GtkText classes have text_area at the same offset
|
m_backgroundColour = colour;
|
||||||
SetBackgroundColourHelper( colour, GTK_TEXT(m_text)->text_area );
|
|
||||||
|
SetBackgroundColourHelper( GTK_TEXT(m_text)->text_area );
|
||||||
}
|
}
|
||||||
|
@@ -1096,7 +1096,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
|||||||
if (m_cursor == NULL)
|
if (m_cursor == NULL)
|
||||||
m_cursor = new wxCursor( wxCURSOR_ARROW );
|
m_cursor = new wxCursor( wxCURSOR_ARROW );
|
||||||
m_font = *wxSWISS_FONT;
|
m_font = *wxSWISS_FONT;
|
||||||
m_backgroundColour = wxWHITE;
|
// m_backgroundColour = wxWHITE;
|
||||||
m_foregroundColour = wxBLACK;
|
m_foregroundColour = wxBLACK;
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_windowName = name;
|
m_windowName = name;
|
||||||
@@ -1939,7 +1939,7 @@ bool wxWindow::IsExposed( const wxRect& rect ) const
|
|||||||
|
|
||||||
void wxWindow::Clear()
|
void wxWindow::Clear()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||||
|
|
||||||
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
|
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
|
||||||
}
|
}
|
||||||
@@ -1949,21 +1949,23 @@ wxColour wxWindow::GetBackgroundColour() const
|
|||||||
return m_backgroundColour;
|
return m_backgroundColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetBackgroundColourHelper(const wxColour& colour,
|
void wxWindow::SetBackgroundColourHelper( GdkWindow *window )
|
||||||
GdkWindow *window)
|
|
||||||
{
|
{
|
||||||
m_backgroundColour = colour;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap(window) );
|
|
||||||
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetBackgroundColour( const wxColour &colour )
|
void wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_widget != NULL, "invalid window" );
|
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||||
|
|
||||||
|
m_backgroundColour = colour;
|
||||||
|
|
||||||
GtkWidget *widget = m_wxwindow == NULL ? m_widget : m_wxwindow;
|
GtkWidget *widget = m_wxwindow == NULL ? m_widget : m_wxwindow;
|
||||||
SetBackgroundColourHelper( colour, widget->window );
|
SetBackgroundColourHelper( widget->window );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxWindow::GetForegroundColour() const
|
wxColour wxWindow::GetForegroundColour() const
|
||||||
@@ -1978,7 +1980,7 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
bool wxWindow::Validate()
|
bool wxWindow::Validate()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||||
|
|
||||||
wxNode *node = GetChildren()->First();
|
wxNode *node = GetChildren()->First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -1993,7 +1995,7 @@ bool wxWindow::Validate()
|
|||||||
|
|
||||||
bool wxWindow::TransferDataToWindow()
|
bool wxWindow::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||||
|
|
||||||
wxNode *node = GetChildren()->First();
|
wxNode *node = GetChildren()->First();
|
||||||
while (node)
|
while (node)
|
||||||
|
Reference in New Issue
Block a user