@ -908,42 +908,43 @@ draw_centroid_texture (GtkThemingEngine *engine,
gdouble width ,
gdouble height )
{
GtkStateFlags state ;
GValue value = { 0 , } ;
cairo_pattern_t * texture = NULL ;
cairo_surface_t * surface = NULL ;
gboolean retval = FALSE ;
GtkStateFlags state ;
GValue value = { 0 , } ;
cairo_pattern_t * texture = NULL ;
cairo_surface_t * surface = NULL ;
gboolean retval = FALSE ;
state = gtk_theming_engine_get_state ( engine ) ;
state = gtk_theming_engine_get_state ( engine ) ;
gtk_theming_engine_get_property ( engine , " -tdegtk-centroid-texture " , state , & value ) ;
gtk_theming_engine_get_property ( engine , " -tdegtk-centroid-texture " , state , & value ) ;
if ( ! G_VALUE_HOLDS_BOXED ( & value ) )
return FALSE ;
if ( ! G_VALUE_HOLDS_BOXED ( & value ) ) {
return FALSE ;
}
texture = ( cairo_pattern_t * ) g_value_dup_boxed ( & value ) ;
g_value_unset ( & value ) ;
texture = ( cairo_pattern_t * ) g_value_dup_boxed ( & value ) ;
g_value_unset ( & value ) ;
if ( texture ! = NULL )
cairo_pattern_get_surface ( texture , & surface ) ;
if ( texture ! = NULL ) {
cairo_pattern_get_surface ( texture , & surface ) ;
}
if ( surface ! = NULL )
{
cairo_save ( cr ) ;
if ( surface ! = NULL ) {
cairo_save ( cr ) ;
cairo_set_source_surface ( cr , surface , ( gint ) ( x + width / 2 - cairo_image_surface_get_width ( surface ) / 2 ) ,
( gint ) ( y + height / 2 - cairo_image_surface_get_height ( surface ) / 2 ) ) ;
cairo_paint ( cr ) ;
cairo_set_source_surface ( cr , surface , ( gint ) ( x + width / 2 - cairo_image_surface_get_width ( surface ) / 2 ) , ( gint ) ( y + height / 2 - cairo_image_surface_get_height ( surface ) / 2 ) ) ;
cairo_paint ( cr ) ;
cairo_restore ( cr ) ;
cairo_restore ( cr ) ;
retval = TRUE ;
}
retval = TRUE ;
}
if ( texture ! = NULL )
cairo_pattern_destroy ( texture ) ;
if ( texture ! = NULL ) {
cairo_pattern_destroy ( texture ) ;
}
return retval ;
return retval ;
}
static void
@ -1226,8 +1227,8 @@ tdegtk_draw_cell_frame (DRAW_ARGS,
state = gtk_theming_engine_get_state ( engine ) ;
widget = m_widgetLookup . find ( cr , path ) ;
#if 0
if ( gtk_widget_path_is_type ( path , GTK_TYPE_TREE_VIEW ) ) {
#if 0
TQStringList objectTypes ;
objectTypes . append ( TQLISTVIEW_OBJECT_NAME_STRING ) ;
TQPalette objectPalette = tqApp - > palette ( objectTypes ) ;
@ -1251,13 +1252,13 @@ tdegtk_draw_cell_frame (DRAW_ARGS,
// Draw item
tqApp - > style ( ) . drawComplexControl ( TQStyle : : CC_ListView , & p , ceData , elementFlags , boundingRect , gtkToTQtColorGroup ( engine , state ) , gtkToTQtStyleFlags ( engine , state , TQT3WT_NONE , widget ) , TQStyle : : SC_ListView , TQStyle : : SC_All , listViewItemOpt ) ;
# endif
}
else {
DEBUG_FILL_BACKGROUND_WITH_COLOR ( p , 255 , 64 , 64 ) ;
printf ( " [WARNING] tdegtk_draw_cell_background() nonfunctional for widget with path '%s' \n \r " , gtk_widget_path_to_string ( gtk_theming_engine_get_path ( engine ) ) ) ; fflush ( stdout ) ;
}
# endif
p . end ( ) ;
}
@ -1294,6 +1295,7 @@ tdegtk_draw_common (DRAW_ARGS)
TQPainter p ( & pd ) ;
DEBUG_FILL_BACKGROUND_WITH_COLOR ( p , 0 , 255 , 255 ) ;
printf ( " [WARNING] tdegtk_draw_common() nonfunctional for widget with path '%s' \n \r " , gtk_widget_path_to_string ( gtk_theming_engine_get_path ( engine ) ) ) ; fflush ( stdout ) ;
GtkStateFlags state ;
state = gtk_theming_engine_get_state ( engine ) ;
@ -1632,8 +1634,11 @@ tdegtk_draw_common_background (DRAW_ARGS)
// Where is this widget actually used?
}
else if ( ( gtk_theming_engine_has_class ( engine , GTK_STYLE_CLASS_BACKGROUND ) )
| | ( gtk_widget_path_is_type ( path , GTK_TYPE_EXPANDER ) )
else if ( gtk_theming_engine_has_class ( engine , GTK_STYLE_CLASS_BACKGROUND ) ) {
// Do nothing
}
else if ( ( gtk_widget_path_is_type ( path , GTK_TYPE_EXPANDER ) )
| | ( gtk_widget_path_is_type ( path , GTK_TYPE_BOX ) )
| | ( gtk_widget_path_is_type ( path , GTK_TYPE_VIEWPORT ) )
| | ( gtk_widget_path_is_type ( path , GTK_TYPE_SCROLLED_WINDOW ) )
@ -1890,7 +1895,6 @@ tdegtk_draw_common_frame (DRAW_ARGS)
else if ( ( gtk_theming_engine_has_class ( engine , GTK_STYLE_CLASS_BACKGROUND ) )
| | ( Gtk : : gtk_widget_path_has_type ( path , GTK_TYPE_BOX ) )
| | ( Gtk : : gtk_widget_path_has_type ( path , GTK_TYPE_EXPANDER ) )
| | ( Gtk : : gtk_widget_path_has_type ( path , GTK_TYPE_BOX ) )
| | ( Gtk : : gtk_widget_path_has_type ( path , GTK_TYPE_VIEWPORT ) )
| | ( Gtk : : gtk_widget_path_has_type ( path , GTK_TYPE_SCROLLED_WINDOW ) )
| | ( Gtk : : gtk_widget_path_has_type ( path , GTK_TYPE_PANED ) )
@ -1912,44 +1916,64 @@ tdegtk_draw_common_frame (DRAW_ARGS)
static void
tdegtk_draw_expander ( DRAW_ARGS )
{
GtkStateFlags state ;
GdkRGBA color ;
gint size ;
gdouble angle = G_PI_2 ;
#if 0
// FIXME
TQRect boundingRect ( 0 , 0 , width , height ) ;
TQt3CairoPaintDevice pd ( NULL , x , y , width , height , cr ) ;
TQPainter p ( & pd ) ;
state = gtk_theming_engine_get_state ( engine ) ;
const GtkWidgetPath * path ;
GtkStateFlags state ;
GtkWidget * widget ;
gtk_theming_engine_get_color ( engine , state , & color ) ;
path = gtk_theming_engine_get_path ( engine ) ;
state = gtk_theming_engine_get_state ( engine ) ;
widget = m_widgetLookup . find ( cr , path ) ;
cairo_save ( cr ) ;
DEBUG_FILL_BACKGROUND_WITH_COLOR ( p , 255 , 255 , 0 ) ;
printf ( " [WARNING] tdegtk_draw_expander() nonfunctional for widget with path '%s' \n \r " , gtk_widget_path_to_string ( gtk_theming_engine_get_path ( engine ) ) ) ; fflush ( stdout ) ;
/* use floor function to adjust doubles */
size = floor ( MIN ( width , height ) ) ;
p . end ( ) ;
# else
GtkStateFlags state ;
GdkRGBA color ;
gint size ;
gdouble angle = G_PI_2 ;
state = gtk_theming_engine_get_state ( engine ) ;
gtk_theming_engine_get_color ( engine , state , & color ) ;
x + = ( gint ) ( width / 2 ) - size / 2 ;
y + = ( gint ) ( height / 2 ) - size / 2 ;
cairo_save ( cr ) ;
if ( ( state & GTK_STATE_FLAG_ACTIVE ) = = 0 )
angle = 0 ;
/* use floor function to adjust doubles */
size = floor ( MIN ( width , height ) ) ;
cairo_translate ( cr , x + size / 2.0 + 0.5 , y + size / 2.0 + 0.5 ) ;
cairo_rotate ( cr , angle ) ;
cairo_translate ( cr , size / 4.0 , 0 ) ;
x + = ( gint ) ( width / 2 ) - size / 2 ;
y + = ( gint ) ( height / 2 ) - size / 2 ;
/* FIXME this + 1/- 1 is done to fix blurred diagonal lines.
* I know it ' s not nice at all , but it fix a visual bug */
cairo_move_to ( cr , - size / 2.0 , - size / 2.0 ) ;
cairo_rel_line_to ( cr , size / 2.0 + 1 , size / 2.0 ) ;
cairo_rel_line_to ( cr , - size / 2.0 - 1 , size / 2.0 ) ;
cairo_close_path ( cr ) ;
if ( ( state & GTK_STATE_FLAG_ACTIVE ) = = 0 )
angle = 0 ;
cairo_set_source_rgba ( cr , color . red , color . green , color . blue , color . alpha * 0.75 ) ;
cairo_fill_preserve ( cr ) ;
cairo_translate ( cr , x + size / 2.0 + 0.5 , y + size / 2.0 + 0.5 ) ;
cairo_rotate ( cr , angle ) ;
cairo_translate ( cr , size / 4.0 , 0 ) ;
gdk_cairo_set_source_rgba ( cr , & color ) ;
cairo_stroke ( cr ) ;
/* FIXME this + 1/- 1 is done to fix blurred diagonal lines.
* I know it ' s not nice at all , but it fix a visual bug */
cairo_move_to ( cr , - size / 2.0 , - size / 2.0 ) ;
cairo_rel_line_to ( cr , size / 2.0 + 1 , size / 2.0 ) ;
cairo_rel_line_to ( cr , - size / 2.0 - 1 , size / 2.0 ) ;
cairo_close_path ( cr ) ;
cairo_restore ( cr ) ;
cairo_set_source_rgba ( cr , color . red , color . green , color . blue , color . alpha * 0.75 ) ;
cairo_fill_preserve ( cr ) ;
gdk_cairo_set_source_rgba ( cr , & color ) ;
cairo_stroke ( cr ) ;
cairo_restore ( cr ) ;
# endif
}
static void
@ -2642,27 +2666,27 @@ tdegtk_draw_spinbutton_frame (DRAW_ARGS)
void
tdegtk_register_style_default ( TdeGtkStyleFunctions * functions )
{
g_assert ( functions ) ;
functions - > draw_activity = tdegtk_draw_activity ;
functions - > draw_arrow = tdegtk_draw_arrow ;
functions - > draw_cell_background = tdegtk_draw_cell_background ;
functions - > draw_cell_frame = tdegtk_draw_cell_frame ;
functions - > draw_check = tdegtk_draw_check ;
functions - > draw_common = tdegtk_draw_common ;
functions - > draw_common_background = tdegtk_draw_common_background ;
functions - > draw_common_frame = tdegtk_draw_common_frame ;
functions - > draw_expander = tdegtk_draw_expander ;
functions - > draw_extension = tdegtk_draw_extension ;
functions - > draw_focus = tdegtk_draw_focus ;
functions - > draw_frame_gap = tdegtk_draw_frame_gap ;
functions - > draw_grip = tdegtk_draw_grip ;
functions - > draw_handle = tdegtk_draw_handle ;
functions - > draw_line = tdegtk_draw_line ;
functions - > draw_notebook = tdegtk_draw_notebook ;
functions - > draw_radio = tdegtk_draw_radio ;
functions - > draw_separator = tdegtk_draw_separator ;
functions - > draw_slider = tdegtk_draw_slider ;
functions - > draw_spinbutton_background = tdegtk_draw_spinbutton_background ;
functions - > draw_spinbutton_frame = tdegtk_draw_spinbutton_frame ;
g_assert ( functions ) ;
functions - > draw_activity = tdegtk_draw_activity ;
functions - > draw_arrow = tdegtk_draw_arrow ;
functions - > draw_cell_background = tdegtk_draw_cell_background ;
functions - > draw_cell_frame = tdegtk_draw_cell_frame ;
functions - > draw_check = tdegtk_draw_check ;
functions - > draw_common = tdegtk_draw_common ;
functions - > draw_common_background = tdegtk_draw_common_background ;
functions - > draw_common_frame = tdegtk_draw_common_frame ;
functions - > draw_expander = tdegtk_draw_expander ;
functions - > draw_extension = tdegtk_draw_extension ;
functions - > draw_focus = tdegtk_draw_focus ;
functions - > draw_frame_gap = tdegtk_draw_frame_gap ;
functions - > draw_grip = tdegtk_draw_grip ;
functions - > draw_handle = tdegtk_draw_handle ;
functions - > draw_line = tdegtk_draw_line ;
functions - > draw_notebook = tdegtk_draw_notebook ;
functions - > draw_radio = tdegtk_draw_radio ;
functions - > draw_separator = tdegtk_draw_separator ;
functions - > draw_slider = tdegtk_draw_slider ;
functions - > draw_spinbutton_background = tdegtk_draw_spinbutton_background ;
functions - > draw_spinbutton_frame = tdegtk_draw_spinbutton_frame ;
}