Slightly better GC pooling,
Implemented automatic updateregion clipping as MSW does. Made drawing sample a bit saner. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6183 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1618dca721
commit
0e09f76e6d
@ -20,7 +20,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza)
|
#define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza)
|
||||||
#define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass)
|
#define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass)
|
||||||
#define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ())
|
#define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ())
|
||||||
@ -28,10 +27,10 @@ extern "C" {
|
|||||||
/* Shadow types */
|
/* Shadow types */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GTK_MYSHADOW_NONE,
|
GTK_MYSHADOW_NONE,
|
||||||
GTK_MYSHADOW_THIN,
|
GTK_MYSHADOW_THIN,
|
||||||
GTK_MYSHADOW_IN,
|
GTK_MYSHADOW_IN,
|
||||||
GTK_MYSHADOW_OUT
|
GTK_MYSHADOW_OUT
|
||||||
} GtkMyShadowType;
|
} GtkMyShadowType;
|
||||||
|
|
||||||
typedef struct _GtkPizza GtkPizza;
|
typedef struct _GtkPizza GtkPizza;
|
||||||
@ -39,24 +38,25 @@ typedef struct _GtkPizzaClass GtkPizzaClass;
|
|||||||
|
|
||||||
struct _GtkPizza
|
struct _GtkPizza
|
||||||
{
|
{
|
||||||
GtkContainer container;
|
GtkContainer container;
|
||||||
GList *children;
|
GList *children;
|
||||||
GtkMyShadowType shadow_type;
|
GtkMyShadowType shadow_type;
|
||||||
|
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
|
|
||||||
guint xoffset;
|
guint xoffset;
|
||||||
guint yoffset;
|
guint yoffset;
|
||||||
|
|
||||||
GdkWindow *bin_window;
|
GdkWindow *bin_window;
|
||||||
|
|
||||||
GdkVisibilityState visibility;
|
GdkVisibilityState visibility;
|
||||||
gulong configure_serial;
|
gulong configure_serial;
|
||||||
gint scroll_x;
|
gint scroll_x;
|
||||||
gint scroll_y;
|
gint scroll_y;
|
||||||
|
|
||||||
gboolean clear_on_draw;
|
gboolean clear_on_draw;
|
||||||
|
gboolean use_filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkPizzaClass
|
struct _GtkPizzaClass
|
||||||
@ -71,39 +71,42 @@ struct _GtkPizzaClass
|
|||||||
guint gtk_pizza_get_type (void);
|
guint gtk_pizza_get_type (void);
|
||||||
GtkWidget* gtk_pizza_new (void);
|
GtkWidget* gtk_pizza_new (void);
|
||||||
|
|
||||||
void gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
void gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
||||||
GtkMyShadowType type);
|
GtkMyShadowType type);
|
||||||
|
|
||||||
void gtk_pizza_set_clear (GtkPizza *pizza,
|
void gtk_pizza_set_clear (GtkPizza *pizza,
|
||||||
gboolean clear);
|
gboolean clear);
|
||||||
|
|
||||||
void gtk_pizza_scroll (GtkPizza *pizza,
|
void gtk_pizza_set_filter (GtkPizza *pizza,
|
||||||
gint dx,
|
gboolean use);
|
||||||
gint dy);
|
|
||||||
|
|
||||||
void gtk_pizza_put (GtkPizza *pizza,
|
void gtk_pizza_scroll (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
gint dx,
|
||||||
gint x,
|
gint dy);
|
||||||
gint y,
|
|
||||||
gint width,
|
|
||||||
gint height);
|
|
||||||
|
|
||||||
void gtk_pizza_move (GtkPizza *pizza,
|
void gtk_pizza_put (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
gint x,
|
gint x,
|
||||||
gint y );
|
gint y,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
|
|
||||||
void gtk_pizza_resize (GtkPizza *pizza,
|
void gtk_pizza_move (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
gint width,
|
gint x,
|
||||||
gint height );
|
gint y );
|
||||||
|
|
||||||
void gtk_pizza_set_size (GtkPizza *pizza,
|
void gtk_pizza_resize (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
gint x,
|
gint width,
|
||||||
gint y,
|
gint height );
|
||||||
gint width,
|
|
||||||
gint height);
|
void gtk_pizza_set_size (GtkPizza *pizza,
|
||||||
|
GtkWidget *widget,
|
||||||
|
gint x,
|
||||||
|
gint y,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza)
|
#define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza)
|
||||||
#define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass)
|
#define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass)
|
||||||
#define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ())
|
#define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ())
|
||||||
@ -28,10 +27,10 @@ extern "C" {
|
|||||||
/* Shadow types */
|
/* Shadow types */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GTK_MYSHADOW_NONE,
|
GTK_MYSHADOW_NONE,
|
||||||
GTK_MYSHADOW_THIN,
|
GTK_MYSHADOW_THIN,
|
||||||
GTK_MYSHADOW_IN,
|
GTK_MYSHADOW_IN,
|
||||||
GTK_MYSHADOW_OUT
|
GTK_MYSHADOW_OUT
|
||||||
} GtkMyShadowType;
|
} GtkMyShadowType;
|
||||||
|
|
||||||
typedef struct _GtkPizza GtkPizza;
|
typedef struct _GtkPizza GtkPizza;
|
||||||
@ -39,24 +38,25 @@ typedef struct _GtkPizzaClass GtkPizzaClass;
|
|||||||
|
|
||||||
struct _GtkPizza
|
struct _GtkPizza
|
||||||
{
|
{
|
||||||
GtkContainer container;
|
GtkContainer container;
|
||||||
GList *children;
|
GList *children;
|
||||||
GtkMyShadowType shadow_type;
|
GtkMyShadowType shadow_type;
|
||||||
|
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
|
|
||||||
guint xoffset;
|
guint xoffset;
|
||||||
guint yoffset;
|
guint yoffset;
|
||||||
|
|
||||||
GdkWindow *bin_window;
|
GdkWindow *bin_window;
|
||||||
|
|
||||||
GdkVisibilityState visibility;
|
GdkVisibilityState visibility;
|
||||||
gulong configure_serial;
|
gulong configure_serial;
|
||||||
gint scroll_x;
|
gint scroll_x;
|
||||||
gint scroll_y;
|
gint scroll_y;
|
||||||
|
|
||||||
gboolean clear_on_draw;
|
gboolean clear_on_draw;
|
||||||
|
gboolean use_filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkPizzaClass
|
struct _GtkPizzaClass
|
||||||
@ -71,39 +71,42 @@ struct _GtkPizzaClass
|
|||||||
guint gtk_pizza_get_type (void);
|
guint gtk_pizza_get_type (void);
|
||||||
GtkWidget* gtk_pizza_new (void);
|
GtkWidget* gtk_pizza_new (void);
|
||||||
|
|
||||||
void gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
void gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
||||||
GtkMyShadowType type);
|
GtkMyShadowType type);
|
||||||
|
|
||||||
void gtk_pizza_set_clear (GtkPizza *pizza,
|
void gtk_pizza_set_clear (GtkPizza *pizza,
|
||||||
gboolean clear);
|
gboolean clear);
|
||||||
|
|
||||||
void gtk_pizza_scroll (GtkPizza *pizza,
|
void gtk_pizza_set_filter (GtkPizza *pizza,
|
||||||
gint dx,
|
gboolean use);
|
||||||
gint dy);
|
|
||||||
|
|
||||||
void gtk_pizza_put (GtkPizza *pizza,
|
void gtk_pizza_scroll (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
gint dx,
|
||||||
gint x,
|
gint dy);
|
||||||
gint y,
|
|
||||||
gint width,
|
|
||||||
gint height);
|
|
||||||
|
|
||||||
void gtk_pizza_move (GtkPizza *pizza,
|
void gtk_pizza_put (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
gint x,
|
gint x,
|
||||||
gint y );
|
gint y,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
|
|
||||||
void gtk_pizza_resize (GtkPizza *pizza,
|
void gtk_pizza_move (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
gint width,
|
gint x,
|
||||||
gint height );
|
gint y );
|
||||||
|
|
||||||
void gtk_pizza_set_size (GtkPizza *pizza,
|
void gtk_pizza_resize (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
gint x,
|
gint width,
|
||||||
gint y,
|
gint height );
|
||||||
gint width,
|
|
||||||
gint height);
|
void gtk_pizza_set_size (GtkPizza *pizza,
|
||||||
|
GtkWidget *widget,
|
||||||
|
gint x,
|
||||||
|
gint y,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
@ -154,6 +154,8 @@ private:
|
|||||||
MyFrame *m_owner;
|
MyFrame *m_owner;
|
||||||
|
|
||||||
ScreenToShow m_show;
|
ScreenToShow m_show;
|
||||||
|
wxBitmap m_smile_bmp;
|
||||||
|
wxIcon m_std_icon;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
@ -310,10 +312,14 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
|||||||
EVT_MOTION (MyCanvas::OnMouseMove)
|
EVT_MOTION (MyCanvas::OnMouseMove)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
#include "../image/smile.xpm"
|
||||||
|
|
||||||
MyCanvas::MyCanvas( MyFrame *parent ) : wxScrolledWindow( parent )
|
MyCanvas::MyCanvas( MyFrame *parent ) : wxScrolledWindow( parent )
|
||||||
{
|
{
|
||||||
m_owner = parent;
|
m_owner = parent;
|
||||||
m_show = Show_Default;
|
m_show = Show_Default;
|
||||||
|
m_smile_bmp = wxBitmap(smile_xpm);
|
||||||
|
m_std_icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw a polygon and an overlapping rectangle
|
//draw a polygon and an overlapping rectangle
|
||||||
@ -578,29 +584,26 @@ void MyCanvas::DrawDefault(wxDC& dc)
|
|||||||
dc.DrawCheckMark(25, 80, 30, 30);
|
dc.DrawCheckMark(25, 80, 30, 30);
|
||||||
dc.DrawCheckMark(60, 80, 60, 60);
|
dc.DrawCheckMark(60, 80, 60, 60);
|
||||||
|
|
||||||
// this is the test for "blitting bitmap into DC damages selected brush"
|
// this is the test for "blitting bitmap into DC damages selected brush" bug
|
||||||
// bug
|
wxIcon m_std_icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
|
||||||
wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
|
wxCoord rectSize = m_std_icon.GetWidth() + 10;
|
||||||
wxCoord rectSize = icon.GetWidth() + 10;
|
|
||||||
wxCoord x = 100;
|
wxCoord x = 100;
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
dc.SetBrush( *wxGREEN_BRUSH );
|
dc.SetBrush( *wxGREEN_BRUSH );
|
||||||
dc.DrawRectangle(x, 10, rectSize, rectSize);
|
dc.DrawRectangle(x, 10, rectSize, rectSize);
|
||||||
dc.DrawBitmap(icon, x + 5, 15, TRUE);
|
dc.DrawBitmap(m_std_icon, x + 5, 15, TRUE);
|
||||||
x += rectSize + 10;
|
x += rectSize + 10;
|
||||||
dc.DrawRectangle(x, 10, rectSize, rectSize);
|
dc.DrawRectangle(x, 10, rectSize, rectSize);
|
||||||
dc.DrawIcon(wxTheApp->GetStdIcon(wxICON_INFORMATION), x + 5, 15);
|
dc.DrawIcon(m_std_icon, x + 5, 15);
|
||||||
x += rectSize + 10;
|
x += rectSize + 10;
|
||||||
dc.DrawRectangle(x, 10, rectSize, rectSize);
|
dc.DrawRectangle(x, 10, rectSize, rectSize);
|
||||||
|
|
||||||
// test for "transparent" bitmap drawing (it intersects with the last
|
// test for "transparent" bitmap drawing (it intersects with the last
|
||||||
// rectangle above)
|
// rectangle above)
|
||||||
//dc.SetBrush( *wxTRANSPARENT_BRUSH );
|
//dc.SetBrush( *wxTRANSPARENT_BRUSH );
|
||||||
#include "../image/smile.xpm"
|
|
||||||
wxBitmap bmp(smile_xpm);
|
|
||||||
|
|
||||||
if (bmp.Ok())
|
if (m_smile_bmp.Ok())
|
||||||
dc.DrawBitmap(bmp, x + rectSize - 20, rectSize - 10, TRUE);
|
dc.DrawBitmap(m_smile_bmp, x + rectSize - 20, rectSize - 10, TRUE);
|
||||||
|
|
||||||
dc.SetBrush( *wxBLACK_BRUSH );
|
dc.SetBrush( *wxBLACK_BRUSH );
|
||||||
dc.DrawRectangle( 0, 160, 1000, 300 );
|
dc.DrawRectangle( 0, 160, 1000, 300 );
|
||||||
|
@ -100,11 +100,24 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
|
|||||||
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum wxPoolGCType
|
||||||
|
{
|
||||||
|
wxGC_ERROR = 0,
|
||||||
|
wxTEXT_MONO,
|
||||||
|
wxBG_MONO,
|
||||||
|
wxPEN_MONO,
|
||||||
|
wxBRUSH_MONO,
|
||||||
|
wxTEXT_COLOUR,
|
||||||
|
wxBG_COLOUR,
|
||||||
|
wxPEN_COLOUR,
|
||||||
|
wxBRUSH_COLOUR
|
||||||
|
};
|
||||||
|
|
||||||
struct wxGC
|
struct wxGC
|
||||||
{
|
{
|
||||||
GdkGC *m_gc;
|
GdkGC *m_gc;
|
||||||
bool m_mono;
|
wxPoolGCType m_type;
|
||||||
bool m_used;
|
bool m_used;
|
||||||
};
|
};
|
||||||
|
|
||||||
static wxGC wxGCPool[200];
|
static wxGC wxGCPool[200];
|
||||||
@ -123,7 +136,7 @@ static void wxCleanUpGCPool()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
|
static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 200; i++)
|
for (int i = 0; i < 200; i++)
|
||||||
{
|
{
|
||||||
@ -131,10 +144,10 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
|
|||||||
{
|
{
|
||||||
wxGCPool[i].m_gc = gdk_gc_new( window );
|
wxGCPool[i].m_gc = gdk_gc_new( window );
|
||||||
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
|
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
|
||||||
wxGCPool[i].m_mono = mono;
|
wxGCPool[i].m_type = type;
|
||||||
wxGCPool[i].m_used = FALSE;
|
wxGCPool[i].m_used = FALSE;
|
||||||
}
|
}
|
||||||
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_mono == mono))
|
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
|
||||||
{
|
{
|
||||||
wxGCPool[i].m_used = TRUE;
|
wxGCPool[i].m_used = TRUE;
|
||||||
return wxGCPool[i].m_gc;
|
return wxGCPool[i].m_gc;
|
||||||
@ -1587,10 +1600,10 @@ void wxWindowDC::SetUpDC()
|
|||||||
|
|
||||||
if (!m_penGC)
|
if (!m_penGC)
|
||||||
{
|
{
|
||||||
m_penGC = wxGetPoolGC( m_window );
|
m_penGC = wxGetPoolGC( m_window, wxPEN_COLOUR );
|
||||||
m_brushGC = wxGetPoolGC( m_window );
|
m_brushGC = wxGetPoolGC( m_window, wxBRUSH_COLOUR );
|
||||||
m_textGC = wxGetPoolGC( m_window );
|
m_textGC = wxGetPoolGC( m_window, wxTEXT_COLOUR );
|
||||||
m_bgGC = wxGetPoolGC( m_window );
|
m_bgGC = wxGetPoolGC( m_window, wxBG_COLOUR );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* background colour */
|
/* background colour */
|
||||||
@ -1606,14 +1619,12 @@ void wxWindowDC::SetUpDC()
|
|||||||
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
|
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_textGC, GDK_SOLID );
|
gdk_gc_set_fill( m_textGC, GDK_SOLID );
|
||||||
gdk_gc_set_line_attributes( m_textGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
|
||||||
|
|
||||||
/* m_penGC */
|
/* m_penGC */
|
||||||
m_pen.GetColour().CalcPixel( m_cmap );
|
m_pen.GetColour().CalcPixel( m_cmap );
|
||||||
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
|
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
|
||||||
gdk_gc_set_background( m_penGC, bg_col );
|
gdk_gc_set_background( m_penGC, bg_col );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_penGC, GDK_SOLID );
|
|
||||||
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
||||||
|
|
||||||
|
|
||||||
@ -1623,7 +1634,6 @@ void wxWindowDC::SetUpDC()
|
|||||||
gdk_gc_set_background( m_brushGC, bg_col );
|
gdk_gc_set_background( m_brushGC, bg_col );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
||||||
gdk_gc_set_line_attributes( m_brushGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
|
||||||
|
|
||||||
|
|
||||||
/* m_bgGC */
|
/* m_bgGC */
|
||||||
@ -1631,13 +1641,11 @@ void wxWindowDC::SetUpDC()
|
|||||||
gdk_gc_set_foreground( m_bgGC, bg_col );
|
gdk_gc_set_foreground( m_bgGC, bg_col );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_bgGC, GDK_SOLID );
|
gdk_gc_set_fill( m_bgGC, GDK_SOLID );
|
||||||
gdk_gc_set_line_attributes( m_bgGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
|
||||||
|
|
||||||
/* ROPs */
|
/* ROPs */
|
||||||
gdk_gc_set_function( m_textGC, GDK_COPY );
|
gdk_gc_set_function( m_textGC, GDK_COPY );
|
||||||
gdk_gc_set_function( m_brushGC, GDK_COPY );
|
gdk_gc_set_function( m_brushGC, GDK_COPY );
|
||||||
gdk_gc_set_function( m_penGC, GDK_COPY );
|
gdk_gc_set_function( m_penGC, GDK_COPY );
|
||||||
gdk_gc_set_function( m_bgGC, GDK_COPY );
|
|
||||||
|
|
||||||
/* clipping */
|
/* clipping */
|
||||||
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
|
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
|
||||||
@ -1886,7 +1894,6 @@ wxPaintDC::wxPaintDC()
|
|||||||
wxPaintDC::wxPaintDC( wxWindow *win )
|
wxPaintDC::wxPaintDC( wxWindow *win )
|
||||||
: wxWindowDC( win )
|
: wxWindowDC( win )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (!win->GetUpdateRegion().IsEmpty())
|
if (!win->GetUpdateRegion().IsEmpty())
|
||||||
{
|
{
|
||||||
m_paintClippingRegion = win->GetUpdateRegion();
|
m_paintClippingRegion = win->GetUpdateRegion();
|
||||||
@ -1897,7 +1904,6 @@ wxPaintDC::wxPaintDC( wxWindow *win )
|
|||||||
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
|
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
|
||||||
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
|
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -193,6 +193,7 @@ gtk_pizza_init (GtkPizza *pizza)
|
|||||||
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
||||||
|
|
||||||
pizza->clear_on_draw = TRUE;
|
pizza->clear_on_draw = TRUE;
|
||||||
|
pizza->use_filter = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
@ -215,7 +216,7 @@ gtk_pizza_scroll_set_adjustments (GtkPizza *pizza,
|
|||||||
|
|
||||||
void
|
void
|
||||||
gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
||||||
GtkMyShadowType type)
|
GtkMyShadowType type)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pizza != NULL);
|
g_return_if_fail (pizza != NULL);
|
||||||
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
||||||
@ -234,7 +235,7 @@ gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
|||||||
|
|
||||||
void
|
void
|
||||||
gtk_pizza_set_clear (GtkPizza *pizza,
|
gtk_pizza_set_clear (GtkPizza *pizza,
|
||||||
gboolean clear)
|
gboolean clear)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pizza != NULL);
|
g_return_if_fail (pizza != NULL);
|
||||||
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
||||||
@ -242,6 +243,16 @@ gtk_pizza_set_clear (GtkPizza *pizza,
|
|||||||
pizza->clear_on_draw = clear;
|
pizza->clear_on_draw = clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_pizza_set_filter (GtkPizza *pizza,
|
||||||
|
gboolean use)
|
||||||
|
{
|
||||||
|
g_return_if_fail (pizza != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
||||||
|
|
||||||
|
pizza->use_filter = use;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_pizza_put (GtkPizza *pizza,
|
gtk_pizza_put (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
@ -274,11 +285,14 @@ gtk_pizza_put (GtkPizza *pizza,
|
|||||||
if (!IS_ONSCREEN (x, y))
|
if (!IS_ONSCREEN (x, y))
|
||||||
GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN);
|
GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN);
|
||||||
|
|
||||||
|
/*
|
||||||
if (GTK_WIDGET_REALIZED (pizza))
|
if (GTK_WIDGET_REALIZED (pizza))
|
||||||
gtk_widget_realize (widget);
|
gtk_widget_realize (widget);
|
||||||
|
*/
|
||||||
|
|
||||||
gtk_widget_set_usize (widget, width, height);
|
gtk_widget_set_usize (widget, width, height);
|
||||||
|
|
||||||
|
/*
|
||||||
if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget))
|
if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget))
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_MAPPED (pizza))
|
if (GTK_WIDGET_MAPPED (pizza))
|
||||||
@ -286,6 +300,7 @@ gtk_pizza_put (GtkPizza *pizza,
|
|||||||
|
|
||||||
gtk_widget_queue_resize (widget);
|
gtk_widget_queue_resize (widget);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -683,14 +698,6 @@ gtk_pizza_expose (GtkWidget *widget,
|
|||||||
|
|
||||||
pizza = GTK_PIZZA (widget);
|
pizza = GTK_PIZZA (widget);
|
||||||
|
|
||||||
/*
|
|
||||||
if (event->window == widget->window)
|
|
||||||
{
|
|
||||||
gtk_pizza_draw_border( pizza );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (event->window != pizza->bin_window)
|
if (event->window != pizza->bin_window)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -881,26 +888,28 @@ gtk_pizza_adjust_allocations (GtkPizza *pizza,
|
|||||||
gint dx,
|
gint dx,
|
||||||
gint dy)
|
gint dy)
|
||||||
{
|
{
|
||||||
GList *tmp_list;
|
GList *tmp_list;
|
||||||
GtkPizzaAdjData data;
|
GtkPizzaAdjData data;
|
||||||
|
|
||||||
data.dx = dx;
|
data.dx = dx;
|
||||||
data.dy = dy;
|
data.dy = dy;
|
||||||
|
|
||||||
tmp_list = pizza->children;
|
tmp_list = pizza->children;
|
||||||
while (tmp_list)
|
while (tmp_list)
|
||||||
{
|
{
|
||||||
GtkPizzaChild *child = tmp_list->data;
|
GtkPizzaChild *child = tmp_list->data;
|
||||||
tmp_list = tmp_list->next;
|
tmp_list = tmp_list->next;
|
||||||
|
|
||||||
child->widget->allocation.x += dx;
|
child->widget->allocation.x += dx;
|
||||||
child->widget->allocation.y += dy;
|
child->widget->allocation.y += dy;
|
||||||
|
|
||||||
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
|
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
|
||||||
GTK_IS_CONTAINER (child->widget))
|
GTK_IS_CONTAINER (child->widget))
|
||||||
gtk_container_forall (GTK_CONTAINER (child->widget),
|
{
|
||||||
gtk_pizza_adjust_allocations_recurse,
|
gtk_container_forall (GTK_CONTAINER (child->widget),
|
||||||
&data);
|
gtk_pizza_adjust_allocations_recurse,
|
||||||
|
&data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,23 +921,23 @@ static void
|
|||||||
gtk_pizza_expose_area (GtkPizza *pizza,
|
gtk_pizza_expose_area (GtkPizza *pizza,
|
||||||
gint x, gint y, gint width, gint height)
|
gint x, gint y, gint width, gint height)
|
||||||
{
|
{
|
||||||
if (pizza->visibility == GDK_VISIBILITY_UNOBSCURED)
|
if (pizza->visibility == GDK_VISIBILITY_UNOBSCURED)
|
||||||
{
|
{
|
||||||
GdkEventExpose event;
|
GdkEventExpose event;
|
||||||
|
|
||||||
event.type = GDK_EXPOSE;
|
event.type = GDK_EXPOSE;
|
||||||
event.send_event = TRUE;
|
event.send_event = TRUE;
|
||||||
event.window = pizza->bin_window;
|
event.window = pizza->bin_window;
|
||||||
event.count = 0;
|
event.count = 0;
|
||||||
|
|
||||||
event.area.x = x;
|
event.area.x = x;
|
||||||
event.area.y = y;
|
event.area.y = y;
|
||||||
event.area.width = width;
|
event.area.width = width;
|
||||||
event.area.height = height;
|
event.area.height = height;
|
||||||
|
|
||||||
gdk_window_ref (event.window);
|
gdk_window_ref (event.window);
|
||||||
gtk_widget_event (GTK_WIDGET (pizza), (GdkEvent *)&event);
|
gtk_widget_event (GTK_WIDGET (pizza), (GdkEvent *)&event);
|
||||||
gdk_window_unref (event.window);
|
gdk_window_unref (event.window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1143,11 +1152,12 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
|
|||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
XEvent *xevent;
|
XEvent *xevent;
|
||||||
GtkPizza *pizza;
|
GtkPizza *pizza;
|
||||||
|
|
||||||
xevent = (XEvent *)gdk_xevent;
|
xevent = (XEvent *)gdk_xevent;
|
||||||
pizza = GTK_PIZZA (data);
|
|
||||||
|
pizza = GTK_PIZZA (data);
|
||||||
|
|
||||||
switch (xevent->type)
|
switch (xevent->type)
|
||||||
{
|
{
|
||||||
@ -1176,7 +1186,7 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Although GDK does have a GDK_VISIBILITY_NOTIFY event,
|
/* Although GDK does have a GDK_VISIBILITY_NOTIFY event,
|
||||||
@ -1188,34 +1198,33 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
|
|||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
XEvent *xevent;
|
XEvent *xevent;
|
||||||
GtkPizza *pizza;
|
GtkPizza *pizza;
|
||||||
|
|
||||||
xevent = (XEvent *)gdk_xevent;
|
xevent = (XEvent *)gdk_xevent;
|
||||||
pizza = GTK_PIZZA (data);
|
pizza = GTK_PIZZA (data);
|
||||||
|
|
||||||
if (xevent->type == VisibilityNotify)
|
if (xevent->type == VisibilityNotify)
|
||||||
{
|
{
|
||||||
switch (xevent->xvisibility.state)
|
switch (xevent->xvisibility.state)
|
||||||
{
|
{
|
||||||
case VisibilityFullyObscured:
|
case VisibilityFullyObscured:
|
||||||
pizza->visibility = GDK_VISIBILITY_FULLY_OBSCURED;
|
pizza->visibility = GDK_VISIBILITY_FULLY_OBSCURED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VisibilityPartiallyObscured:
|
case VisibilityPartiallyObscured:
|
||||||
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VisibilityUnobscured:
|
case VisibilityUnobscured:
|
||||||
pizza->visibility = GDK_VISIBILITY_UNOBSCURED;
|
pizza->visibility = GDK_VISIBILITY_UNOBSCURED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GDK_FILTER_REMOVE;
|
return GDK_FILTER_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return GDK_FILTER_CONTINUE;
|
||||||
return GDK_FILTER_CONTINUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -612,10 +612,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
|||||||
{
|
{
|
||||||
DEBUG_MAIN_THREAD
|
DEBUG_MAIN_THREAD
|
||||||
|
|
||||||
if (!win->m_hasVMT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (win->GetName() == wxT("columntitles"))
|
if (win->GetName() == wxT("columntitles"))
|
||||||
{
|
{
|
||||||
wxPrintf( wxT("OnExpose from ") );
|
wxPrintf( wxT("OnExpose from ") );
|
||||||
@ -626,7 +622,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
|||||||
(int)gdk_event->area.width,
|
(int)gdk_event->area.width,
|
||||||
(int)gdk_event->area.height );
|
(int)gdk_event->area.height );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
win->GetUpdateRegion().Union( gdk_event->area.x,
|
win->GetUpdateRegion().Union( gdk_event->area.x,
|
||||||
gdk_event->area.y,
|
gdk_event->area.y,
|
||||||
@ -637,6 +632,9 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
|||||||
if (gdk_event->count > 0)
|
if (gdk_event->count > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!win->m_hasVMT)
|
||||||
|
return;
|
||||||
|
|
||||||
wxEraseEvent eevent( win->GetId() );
|
wxEraseEvent eevent( win->GetId() );
|
||||||
eevent.SetEventObject( win );
|
eevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent(eevent);
|
win->GetEventHandler()->ProcessEvent(eevent);
|
||||||
@ -660,8 +658,10 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
/*
|
if ((rect->x == 0) && (rect->y == 0) && (rect->width <= 1) && (rect->height <= 1))
|
||||||
if ((win->GetName() == wxT("columntitles")) && (rect->x == 2))
|
return;
|
||||||
|
|
||||||
|
if (win->GetName() == wxT("columntitles"))
|
||||||
{
|
{
|
||||||
wxPrintf( wxT("OnDraw from ") );
|
wxPrintf( wxT("OnDraw from ") );
|
||||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
@ -671,11 +671,13 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
(int)rect->width,
|
(int)rect->width,
|
||||||
(int)rect->height );
|
(int)rect->height );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
win->GetUpdateRegion().Union( rect->x, rect->y,
|
win->GetUpdateRegion().Union( rect->x, rect->y,
|
||||||
rect->width, rect->height );
|
rect->width, rect->height );
|
||||||
|
|
||||||
|
if (!win->m_hasVMT)
|
||||||
|
return;
|
||||||
|
|
||||||
wxEraseEvent eevent( win->GetId() );
|
wxEraseEvent eevent( win->GetId() );
|
||||||
eevent.SetEventObject( win );
|
eevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent(eevent);
|
win->GetEventHandler()->ProcessEvent(eevent);
|
||||||
|
@ -100,11 +100,24 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
|
|||||||
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum wxPoolGCType
|
||||||
|
{
|
||||||
|
wxGC_ERROR = 0,
|
||||||
|
wxTEXT_MONO,
|
||||||
|
wxBG_MONO,
|
||||||
|
wxPEN_MONO,
|
||||||
|
wxBRUSH_MONO,
|
||||||
|
wxTEXT_COLOUR,
|
||||||
|
wxBG_COLOUR,
|
||||||
|
wxPEN_COLOUR,
|
||||||
|
wxBRUSH_COLOUR
|
||||||
|
};
|
||||||
|
|
||||||
struct wxGC
|
struct wxGC
|
||||||
{
|
{
|
||||||
GdkGC *m_gc;
|
GdkGC *m_gc;
|
||||||
bool m_mono;
|
wxPoolGCType m_type;
|
||||||
bool m_used;
|
bool m_used;
|
||||||
};
|
};
|
||||||
|
|
||||||
static wxGC wxGCPool[200];
|
static wxGC wxGCPool[200];
|
||||||
@ -123,7 +136,7 @@ static void wxCleanUpGCPool()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
|
static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 200; i++)
|
for (int i = 0; i < 200; i++)
|
||||||
{
|
{
|
||||||
@ -131,10 +144,10 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
|
|||||||
{
|
{
|
||||||
wxGCPool[i].m_gc = gdk_gc_new( window );
|
wxGCPool[i].m_gc = gdk_gc_new( window );
|
||||||
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
|
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
|
||||||
wxGCPool[i].m_mono = mono;
|
wxGCPool[i].m_type = type;
|
||||||
wxGCPool[i].m_used = FALSE;
|
wxGCPool[i].m_used = FALSE;
|
||||||
}
|
}
|
||||||
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_mono == mono))
|
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
|
||||||
{
|
{
|
||||||
wxGCPool[i].m_used = TRUE;
|
wxGCPool[i].m_used = TRUE;
|
||||||
return wxGCPool[i].m_gc;
|
return wxGCPool[i].m_gc;
|
||||||
@ -1587,10 +1600,10 @@ void wxWindowDC::SetUpDC()
|
|||||||
|
|
||||||
if (!m_penGC)
|
if (!m_penGC)
|
||||||
{
|
{
|
||||||
m_penGC = wxGetPoolGC( m_window );
|
m_penGC = wxGetPoolGC( m_window, wxPEN_COLOUR );
|
||||||
m_brushGC = wxGetPoolGC( m_window );
|
m_brushGC = wxGetPoolGC( m_window, wxBRUSH_COLOUR );
|
||||||
m_textGC = wxGetPoolGC( m_window );
|
m_textGC = wxGetPoolGC( m_window, wxTEXT_COLOUR );
|
||||||
m_bgGC = wxGetPoolGC( m_window );
|
m_bgGC = wxGetPoolGC( m_window, wxBG_COLOUR );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* background colour */
|
/* background colour */
|
||||||
@ -1606,14 +1619,12 @@ void wxWindowDC::SetUpDC()
|
|||||||
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
|
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_textGC, GDK_SOLID );
|
gdk_gc_set_fill( m_textGC, GDK_SOLID );
|
||||||
gdk_gc_set_line_attributes( m_textGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
|
||||||
|
|
||||||
/* m_penGC */
|
/* m_penGC */
|
||||||
m_pen.GetColour().CalcPixel( m_cmap );
|
m_pen.GetColour().CalcPixel( m_cmap );
|
||||||
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
|
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
|
||||||
gdk_gc_set_background( m_penGC, bg_col );
|
gdk_gc_set_background( m_penGC, bg_col );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_penGC, GDK_SOLID );
|
|
||||||
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
||||||
|
|
||||||
|
|
||||||
@ -1623,7 +1634,6 @@ void wxWindowDC::SetUpDC()
|
|||||||
gdk_gc_set_background( m_brushGC, bg_col );
|
gdk_gc_set_background( m_brushGC, bg_col );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
||||||
gdk_gc_set_line_attributes( m_brushGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
|
||||||
|
|
||||||
|
|
||||||
/* m_bgGC */
|
/* m_bgGC */
|
||||||
@ -1631,13 +1641,11 @@ void wxWindowDC::SetUpDC()
|
|||||||
gdk_gc_set_foreground( m_bgGC, bg_col );
|
gdk_gc_set_foreground( m_bgGC, bg_col );
|
||||||
|
|
||||||
gdk_gc_set_fill( m_bgGC, GDK_SOLID );
|
gdk_gc_set_fill( m_bgGC, GDK_SOLID );
|
||||||
gdk_gc_set_line_attributes( m_bgGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
|
||||||
|
|
||||||
/* ROPs */
|
/* ROPs */
|
||||||
gdk_gc_set_function( m_textGC, GDK_COPY );
|
gdk_gc_set_function( m_textGC, GDK_COPY );
|
||||||
gdk_gc_set_function( m_brushGC, GDK_COPY );
|
gdk_gc_set_function( m_brushGC, GDK_COPY );
|
||||||
gdk_gc_set_function( m_penGC, GDK_COPY );
|
gdk_gc_set_function( m_penGC, GDK_COPY );
|
||||||
gdk_gc_set_function( m_bgGC, GDK_COPY );
|
|
||||||
|
|
||||||
/* clipping */
|
/* clipping */
|
||||||
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
|
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
|
||||||
@ -1886,7 +1894,6 @@ wxPaintDC::wxPaintDC()
|
|||||||
wxPaintDC::wxPaintDC( wxWindow *win )
|
wxPaintDC::wxPaintDC( wxWindow *win )
|
||||||
: wxWindowDC( win )
|
: wxWindowDC( win )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (!win->GetUpdateRegion().IsEmpty())
|
if (!win->GetUpdateRegion().IsEmpty())
|
||||||
{
|
{
|
||||||
m_paintClippingRegion = win->GetUpdateRegion();
|
m_paintClippingRegion = win->GetUpdateRegion();
|
||||||
@ -1897,7 +1904,6 @@ wxPaintDC::wxPaintDC( wxWindow *win )
|
|||||||
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
|
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
|
||||||
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
|
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -193,6 +193,7 @@ gtk_pizza_init (GtkPizza *pizza)
|
|||||||
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
||||||
|
|
||||||
pizza->clear_on_draw = TRUE;
|
pizza->clear_on_draw = TRUE;
|
||||||
|
pizza->use_filter = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
@ -215,7 +216,7 @@ gtk_pizza_scroll_set_adjustments (GtkPizza *pizza,
|
|||||||
|
|
||||||
void
|
void
|
||||||
gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
||||||
GtkMyShadowType type)
|
GtkMyShadowType type)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pizza != NULL);
|
g_return_if_fail (pizza != NULL);
|
||||||
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
||||||
@ -234,7 +235,7 @@ gtk_pizza_set_shadow_type (GtkPizza *pizza,
|
|||||||
|
|
||||||
void
|
void
|
||||||
gtk_pizza_set_clear (GtkPizza *pizza,
|
gtk_pizza_set_clear (GtkPizza *pizza,
|
||||||
gboolean clear)
|
gboolean clear)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pizza != NULL);
|
g_return_if_fail (pizza != NULL);
|
||||||
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
||||||
@ -242,6 +243,16 @@ gtk_pizza_set_clear (GtkPizza *pizza,
|
|||||||
pizza->clear_on_draw = clear;
|
pizza->clear_on_draw = clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_pizza_set_filter (GtkPizza *pizza,
|
||||||
|
gboolean use)
|
||||||
|
{
|
||||||
|
g_return_if_fail (pizza != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_PIZZA (pizza));
|
||||||
|
|
||||||
|
pizza->use_filter = use;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_pizza_put (GtkPizza *pizza,
|
gtk_pizza_put (GtkPizza *pizza,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
@ -274,11 +285,14 @@ gtk_pizza_put (GtkPizza *pizza,
|
|||||||
if (!IS_ONSCREEN (x, y))
|
if (!IS_ONSCREEN (x, y))
|
||||||
GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN);
|
GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN);
|
||||||
|
|
||||||
|
/*
|
||||||
if (GTK_WIDGET_REALIZED (pizza))
|
if (GTK_WIDGET_REALIZED (pizza))
|
||||||
gtk_widget_realize (widget);
|
gtk_widget_realize (widget);
|
||||||
|
*/
|
||||||
|
|
||||||
gtk_widget_set_usize (widget, width, height);
|
gtk_widget_set_usize (widget, width, height);
|
||||||
|
|
||||||
|
/*
|
||||||
if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget))
|
if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget))
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_MAPPED (pizza))
|
if (GTK_WIDGET_MAPPED (pizza))
|
||||||
@ -286,6 +300,7 @@ gtk_pizza_put (GtkPizza *pizza,
|
|||||||
|
|
||||||
gtk_widget_queue_resize (widget);
|
gtk_widget_queue_resize (widget);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -683,14 +698,6 @@ gtk_pizza_expose (GtkWidget *widget,
|
|||||||
|
|
||||||
pizza = GTK_PIZZA (widget);
|
pizza = GTK_PIZZA (widget);
|
||||||
|
|
||||||
/*
|
|
||||||
if (event->window == widget->window)
|
|
||||||
{
|
|
||||||
gtk_pizza_draw_border( pizza );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (event->window != pizza->bin_window)
|
if (event->window != pizza->bin_window)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -881,26 +888,28 @@ gtk_pizza_adjust_allocations (GtkPizza *pizza,
|
|||||||
gint dx,
|
gint dx,
|
||||||
gint dy)
|
gint dy)
|
||||||
{
|
{
|
||||||
GList *tmp_list;
|
GList *tmp_list;
|
||||||
GtkPizzaAdjData data;
|
GtkPizzaAdjData data;
|
||||||
|
|
||||||
data.dx = dx;
|
data.dx = dx;
|
||||||
data.dy = dy;
|
data.dy = dy;
|
||||||
|
|
||||||
tmp_list = pizza->children;
|
tmp_list = pizza->children;
|
||||||
while (tmp_list)
|
while (tmp_list)
|
||||||
{
|
{
|
||||||
GtkPizzaChild *child = tmp_list->data;
|
GtkPizzaChild *child = tmp_list->data;
|
||||||
tmp_list = tmp_list->next;
|
tmp_list = tmp_list->next;
|
||||||
|
|
||||||
child->widget->allocation.x += dx;
|
child->widget->allocation.x += dx;
|
||||||
child->widget->allocation.y += dy;
|
child->widget->allocation.y += dy;
|
||||||
|
|
||||||
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
|
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
|
||||||
GTK_IS_CONTAINER (child->widget))
|
GTK_IS_CONTAINER (child->widget))
|
||||||
gtk_container_forall (GTK_CONTAINER (child->widget),
|
{
|
||||||
gtk_pizza_adjust_allocations_recurse,
|
gtk_container_forall (GTK_CONTAINER (child->widget),
|
||||||
&data);
|
gtk_pizza_adjust_allocations_recurse,
|
||||||
|
&data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,23 +921,23 @@ static void
|
|||||||
gtk_pizza_expose_area (GtkPizza *pizza,
|
gtk_pizza_expose_area (GtkPizza *pizza,
|
||||||
gint x, gint y, gint width, gint height)
|
gint x, gint y, gint width, gint height)
|
||||||
{
|
{
|
||||||
if (pizza->visibility == GDK_VISIBILITY_UNOBSCURED)
|
if (pizza->visibility == GDK_VISIBILITY_UNOBSCURED)
|
||||||
{
|
{
|
||||||
GdkEventExpose event;
|
GdkEventExpose event;
|
||||||
|
|
||||||
event.type = GDK_EXPOSE;
|
event.type = GDK_EXPOSE;
|
||||||
event.send_event = TRUE;
|
event.send_event = TRUE;
|
||||||
event.window = pizza->bin_window;
|
event.window = pizza->bin_window;
|
||||||
event.count = 0;
|
event.count = 0;
|
||||||
|
|
||||||
event.area.x = x;
|
event.area.x = x;
|
||||||
event.area.y = y;
|
event.area.y = y;
|
||||||
event.area.width = width;
|
event.area.width = width;
|
||||||
event.area.height = height;
|
event.area.height = height;
|
||||||
|
|
||||||
gdk_window_ref (event.window);
|
gdk_window_ref (event.window);
|
||||||
gtk_widget_event (GTK_WIDGET (pizza), (GdkEvent *)&event);
|
gtk_widget_event (GTK_WIDGET (pizza), (GdkEvent *)&event);
|
||||||
gdk_window_unref (event.window);
|
gdk_window_unref (event.window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1143,11 +1152,12 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
|
|||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
XEvent *xevent;
|
XEvent *xevent;
|
||||||
GtkPizza *pizza;
|
GtkPizza *pizza;
|
||||||
|
|
||||||
xevent = (XEvent *)gdk_xevent;
|
xevent = (XEvent *)gdk_xevent;
|
||||||
pizza = GTK_PIZZA (data);
|
|
||||||
|
pizza = GTK_PIZZA (data);
|
||||||
|
|
||||||
switch (xevent->type)
|
switch (xevent->type)
|
||||||
{
|
{
|
||||||
@ -1176,7 +1186,7 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Although GDK does have a GDK_VISIBILITY_NOTIFY event,
|
/* Although GDK does have a GDK_VISIBILITY_NOTIFY event,
|
||||||
@ -1188,34 +1198,33 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
|
|||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
XEvent *xevent;
|
XEvent *xevent;
|
||||||
GtkPizza *pizza;
|
GtkPizza *pizza;
|
||||||
|
|
||||||
xevent = (XEvent *)gdk_xevent;
|
xevent = (XEvent *)gdk_xevent;
|
||||||
pizza = GTK_PIZZA (data);
|
pizza = GTK_PIZZA (data);
|
||||||
|
|
||||||
if (xevent->type == VisibilityNotify)
|
if (xevent->type == VisibilityNotify)
|
||||||
{
|
{
|
||||||
switch (xevent->xvisibility.state)
|
switch (xevent->xvisibility.state)
|
||||||
{
|
{
|
||||||
case VisibilityFullyObscured:
|
case VisibilityFullyObscured:
|
||||||
pizza->visibility = GDK_VISIBILITY_FULLY_OBSCURED;
|
pizza->visibility = GDK_VISIBILITY_FULLY_OBSCURED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VisibilityPartiallyObscured:
|
case VisibilityPartiallyObscured:
|
||||||
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
pizza->visibility = GDK_VISIBILITY_PARTIAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VisibilityUnobscured:
|
case VisibilityUnobscured:
|
||||||
pizza->visibility = GDK_VISIBILITY_UNOBSCURED;
|
pizza->visibility = GDK_VISIBILITY_UNOBSCURED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GDK_FILTER_REMOVE;
|
return GDK_FILTER_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return GDK_FILTER_CONTINUE;
|
||||||
return GDK_FILTER_CONTINUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -612,10 +612,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
|||||||
{
|
{
|
||||||
DEBUG_MAIN_THREAD
|
DEBUG_MAIN_THREAD
|
||||||
|
|
||||||
if (!win->m_hasVMT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (win->GetName() == wxT("columntitles"))
|
if (win->GetName() == wxT("columntitles"))
|
||||||
{
|
{
|
||||||
wxPrintf( wxT("OnExpose from ") );
|
wxPrintf( wxT("OnExpose from ") );
|
||||||
@ -626,7 +622,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
|||||||
(int)gdk_event->area.width,
|
(int)gdk_event->area.width,
|
||||||
(int)gdk_event->area.height );
|
(int)gdk_event->area.height );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
win->GetUpdateRegion().Union( gdk_event->area.x,
|
win->GetUpdateRegion().Union( gdk_event->area.x,
|
||||||
gdk_event->area.y,
|
gdk_event->area.y,
|
||||||
@ -637,6 +632,9 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
|||||||
if (gdk_event->count > 0)
|
if (gdk_event->count > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!win->m_hasVMT)
|
||||||
|
return;
|
||||||
|
|
||||||
wxEraseEvent eevent( win->GetId() );
|
wxEraseEvent eevent( win->GetId() );
|
||||||
eevent.SetEventObject( win );
|
eevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent(eevent);
|
win->GetEventHandler()->ProcessEvent(eevent);
|
||||||
@ -660,8 +658,10 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
/*
|
if ((rect->x == 0) && (rect->y == 0) && (rect->width <= 1) && (rect->height <= 1))
|
||||||
if ((win->GetName() == wxT("columntitles")) && (rect->x == 2))
|
return;
|
||||||
|
|
||||||
|
if (win->GetName() == wxT("columntitles"))
|
||||||
{
|
{
|
||||||
wxPrintf( wxT("OnDraw from ") );
|
wxPrintf( wxT("OnDraw from ") );
|
||||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
@ -671,11 +671,13 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
(int)rect->width,
|
(int)rect->width,
|
||||||
(int)rect->height );
|
(int)rect->height );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
win->GetUpdateRegion().Union( rect->x, rect->y,
|
win->GetUpdateRegion().Union( rect->x, rect->y,
|
||||||
rect->width, rect->height );
|
rect->width, rect->height );
|
||||||
|
|
||||||
|
if (!win->m_hasVMT)
|
||||||
|
return;
|
||||||
|
|
||||||
wxEraseEvent eevent( win->GetId() );
|
wxEraseEvent eevent( win->GetId() );
|
||||||
eevent.SetEventObject( win );
|
eevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent(eevent);
|
win->GetEventHandler()->ProcessEvent(eevent);
|
||||||
|
Loading…
Reference in New Issue
Block a user