зеркало из https://github.com/mozilla/gecko-dev.git
Bug 408990 - "gtk: expander in treeview is not the correct size" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r+sr+a1.9=roc]
This commit is contained in:
Родитель
29fce365a3
Коммит
91ffd99a2d
|
@ -1266,6 +1266,31 @@ moz_gtk_tree_header_sort_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
|||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_treeview_expander_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect, GtkWidgetState* state,
|
||||
GtkExpanderStyle expander_state,
|
||||
GtkTextDirection direction)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkStateType state_type;
|
||||
|
||||
ensure_tree_view_widget();
|
||||
gtk_widget_set_direction(gTreeViewWidget, direction);
|
||||
|
||||
style = gTreeViewWidget->style;
|
||||
|
||||
/* Because the frame we get is of the entire treeview, we can't get the precise
|
||||
* event state of one expander, thus rendering hover and active feedback useless. */
|
||||
state_type = state->disabled ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL;
|
||||
|
||||
TSOffsetStyleGCs(style, rect->x, rect->y);
|
||||
gtk_paint_expander(style, drawable, state_type, cliprect, gTreeViewWidget, "treeview",
|
||||
rect->x + rect->width / 2, rect->y + rect->height / 2, expander_state);
|
||||
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_expander_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect, GtkWidgetState* state,
|
||||
|
@ -1280,10 +1305,6 @@ moz_gtk_expander_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
|||
|
||||
style = gExpanderWidget->style;
|
||||
|
||||
/* Because the frame we get is of the entire treeview, we can't get the precise
|
||||
* event state of one expander, thus rendering hover and active feedback useless. */
|
||||
state_type = state->disabled ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL;
|
||||
|
||||
TSOffsetStyleGCs(style, rect->x, rect->y);
|
||||
gtk_paint_expander(style, drawable, state_type, cliprect, gExpanderWidget, "expander",
|
||||
rect->x + rect->width / 2, rect->y + rect->height / 2, expander_state);
|
||||
|
@ -2373,6 +2394,17 @@ moz_gtk_get_expander_size(gint* size)
|
|||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
gint
|
||||
moz_gtk_get_treeview_expander_size(gint* size)
|
||||
{
|
||||
ensure_tree_view_widget();
|
||||
gtk_widget_style_get(gTreeViewWidget,
|
||||
"expander-size", size,
|
||||
NULL);
|
||||
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
gint
|
||||
moz_gtk_get_menu_separator_height(gint *size)
|
||||
{
|
||||
|
@ -2511,6 +2543,10 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
|
|||
(GtkArrowType) flags,
|
||||
direction);
|
||||
break;
|
||||
case MOZ_GTK_TREEVIEW_EXPANDER:
|
||||
return moz_gtk_treeview_expander_paint(drawable, rect, cliprect, state,
|
||||
(GtkExpanderStyle) flags, direction);
|
||||
break;
|
||||
case MOZ_GTK_EXPANDER:
|
||||
return moz_gtk_expander_paint(drawable, rect, cliprect, state,
|
||||
(GtkExpanderStyle) flags, direction);
|
||||
|
|
|
@ -174,7 +174,9 @@ typedef enum {
|
|||
MOZ_GTK_TREE_HEADER_CELL,
|
||||
/* Paints sort arrows in treeheader cells */
|
||||
MOZ_GTK_TREE_HEADER_SORTARROW,
|
||||
/* Paints a GtkExpander for treeviews */
|
||||
/* Paints an expander for a GtkTreeView */
|
||||
MOZ_GTK_TREEVIEW_EXPANDER,
|
||||
/* Paints a GtkExpander */
|
||||
MOZ_GTK_EXPANDER,
|
||||
/* Paints the background of the menu bar. */
|
||||
MOZ_GTK_MENUBAR,
|
||||
|
@ -328,13 +330,21 @@ gint moz_gtk_get_dropdown_arrow_size(gint* width, gint* height);
|
|||
gint moz_gtk_get_toolbar_separator_width(gint* size);
|
||||
|
||||
/**
|
||||
* Get the size of a treeview's expander (we call them twisties)
|
||||
* Get the size of a regular GTK expander that shows/hides content
|
||||
* size: [OUT] the size of the GTK expander, size = width = height.
|
||||
*
|
||||
* returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
|
||||
*/
|
||||
gint moz_gtk_get_expander_size(gint* size);
|
||||
|
||||
/**
|
||||
* Get the size of a treeview's expander (we call them twisties)
|
||||
* size: [OUT] the size of the GTK expander, size = width = height.
|
||||
*
|
||||
* returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
|
||||
*/
|
||||
gint moz_gtk_get_treeview_expander_size(gint* size);
|
||||
|
||||
/**
|
||||
* Get the desired height of a menu separator
|
||||
* size: [OUT] the desired height
|
||||
|
|
|
@ -449,12 +449,12 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
aGtkWidgetType = MOZ_GTK_TREE_HEADER_SORTARROW;
|
||||
break;
|
||||
case NS_THEME_TREEVIEW_TWISTY:
|
||||
aGtkWidgetType = MOZ_GTK_EXPANDER;
|
||||
aGtkWidgetType = MOZ_GTK_TREEVIEW_EXPANDER;
|
||||
if (aWidgetFlags)
|
||||
*aWidgetFlags = GTK_EXPANDER_COLLAPSED;
|
||||
break;
|
||||
case NS_THEME_TREEVIEW_TWISTY_OPEN:
|
||||
aGtkWidgetType = MOZ_GTK_EXPANDER;
|
||||
aGtkWidgetType = MOZ_GTK_TREEVIEW_EXPANDER;
|
||||
if (aWidgetFlags)
|
||||
*aWidgetFlags = GTK_EXPANDER_EXPANDED;
|
||||
break;
|
||||
|
@ -1070,7 +1070,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext,
|
|||
{
|
||||
gint expander_size;
|
||||
|
||||
moz_gtk_get_expander_size(&expander_size);
|
||||
moz_gtk_get_treeview_expander_size(&expander_size);
|
||||
aResult->width = aResult->height = expander_size;
|
||||
*aIsOverridable = PR_FALSE;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче