mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Progress bars
This commit is contained in:
parent
d2c64e305c
commit
6ec4aefa64
@ -1,3 +1,7 @@
|
||||
2003-08-06 Raymond Penners <raymond@dotsphinx.com>
|
||||
|
||||
* src/*.c: Added XP theming support for progress bars.
|
||||
|
||||
2003-08-05 Raymond Penners <raymond@dotsphinx.com>
|
||||
|
||||
* src/xp_theme.c: Internal redesign: extracted XP specific theming
|
||||
|
@ -26,3 +26,4 @@ style "wimp-scrollbar"
|
||||
}
|
||||
|
||||
class "GtkScrollbar" style "wimp-scrollbar"
|
||||
|
||||
|
@ -301,6 +301,27 @@ sanitize_size (GdkWindow *window,
|
||||
return set_bg;
|
||||
}
|
||||
|
||||
static XpThemeElement
|
||||
map_gtk_progress_bar_to_xp(GtkProgressBar *progress_bar, gboolean trough)
|
||||
{
|
||||
XpThemeElement ret;
|
||||
switch (progress_bar->orientation)
|
||||
{
|
||||
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
||||
case GTK_PROGRESS_RIGHT_TO_LEFT:
|
||||
ret = trough
|
||||
? XP_THEME_ELEMENT_PROGRESS_TROUGH_H
|
||||
: XP_THEME_ELEMENT_PROGRESS_BAR_H;
|
||||
break;
|
||||
default:
|
||||
ret = trough
|
||||
? XP_THEME_ELEMENT_PROGRESS_TROUGH_V
|
||||
: XP_THEME_ELEMENT_PROGRESS_BAR_V;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
draw_part (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
@ -858,6 +879,19 @@ draw_box (GtkStyle *style,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (detail && !strcmp (detail, "bar"))
|
||||
{
|
||||
if (widget && GTK_IS_PROGRESS_BAR (widget))
|
||||
{
|
||||
GtkProgressBar *progress_bar = GTK_PROGRESS_BAR(widget);
|
||||
XpThemeElement xp_progress_bar = map_gtk_progress_bar_to_xp (progress_bar, FALSE);
|
||||
if (xp_theme_draw (window, xp_progress_bar,
|
||||
style, x, y, width, height, state_type))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (detail && strcmp (detail, "menuitem") == 0)
|
||||
shadow_type = GTK_SHADOW_NONE;
|
||||
@ -866,7 +900,17 @@ draw_box (GtkStyle *style,
|
||||
{
|
||||
if (widget && GTK_IS_PROGRESS_BAR (widget))
|
||||
{
|
||||
// Blank in classic Windows
|
||||
GtkProgressBar *progress_bar = GTK_PROGRESS_BAR(widget);
|
||||
XpThemeElement xp_progress_bar = map_gtk_progress_bar_to_xp (progress_bar, TRUE);
|
||||
if (xp_theme_draw (window, xp_progress_bar,
|
||||
style, x, y, width, height, state_type))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Blank in classic Windows
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1135,14 +1179,14 @@ wimp_style_class_init (WimpStyleClass *klass)
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
style_class->init_from_rc = wimp_style_init_from_rc;
|
||||
style_class->draw_arrow = draw_arrow;
|
||||
style_class->draw_box = draw_box;
|
||||
style_class->draw_check = draw_check;
|
||||
style_class->draw_option = draw_option;
|
||||
style_class->draw_tab = draw_tab;
|
||||
style_class->draw_flat_box = draw_flat_box;
|
||||
style_class->draw_expander = draw_expander;
|
||||
style_class->init_from_rc = wimp_style_init_from_rc;
|
||||
style_class->draw_arrow = draw_arrow;
|
||||
style_class->draw_box = draw_box;
|
||||
style_class->draw_check = draw_check;
|
||||
style_class->draw_option = draw_option;
|
||||
style_class->draw_tab = draw_tab;
|
||||
style_class->draw_flat_box = draw_flat_box;
|
||||
style_class->draw_expander = draw_expander;
|
||||
style_class->draw_extension = draw_extension;
|
||||
style_class->draw_box_gap = draw_box_gap;
|
||||
style_class->draw_shadow = draw_shadow;
|
||||
|
@ -40,6 +40,7 @@ static LPCWSTR class_descriptors[] =
|
||||
L"Edit",
|
||||
L"TreeView",
|
||||
L"Spin",
|
||||
L"Progress",
|
||||
};
|
||||
|
||||
static const short element_part_map[]=
|
||||
@ -70,6 +71,10 @@ static const short element_part_map[]=
|
||||
BP_RADIOBUTTON,
|
||||
TVP_GLYPH,
|
||||
TVP_GLYPH,
|
||||
PP_CHUNK,
|
||||
PP_CHUNKVERT,
|
||||
PP_BAR,
|
||||
PP_BARVERT,
|
||||
};
|
||||
|
||||
|
||||
@ -200,6 +205,13 @@ xp_theme_get_handle_by_element(XpThemeElement element)
|
||||
klazz = XP_THEME_CLASS_SPIN;
|
||||
break;
|
||||
|
||||
case XP_THEME_ELEMENT_PROGRESS_BAR_H:
|
||||
case XP_THEME_ELEMENT_PROGRESS_BAR_V:
|
||||
case XP_THEME_ELEMENT_PROGRESS_TROUGH_H:
|
||||
case XP_THEME_ELEMENT_PROGRESS_TROUGH_V:
|
||||
klazz = XP_THEME_CLASS_PROGRESS;
|
||||
break;
|
||||
|
||||
case XP_THEME_ELEMENT_TREEVIEW_EXPANDER_OPENED:
|
||||
case XP_THEME_ELEMENT_TREEVIEW_EXPANDER_CLOSED:
|
||||
klazz = XP_THEME_CLASS_TREEVIEW;
|
||||
@ -443,6 +455,13 @@ xp_theme_map_gtk_state(XpThemeElement element, GtkStateType state)
|
||||
ret = GLPS_OPENED;
|
||||
break;
|
||||
|
||||
case XP_THEME_ELEMENT_PROGRESS_BAR_H:
|
||||
case XP_THEME_ELEMENT_PROGRESS_BAR_V:
|
||||
case XP_THEME_ELEMENT_PROGRESS_TROUGH_H:
|
||||
case XP_THEME_ELEMENT_PROGRESS_TROUGH_V:
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
switch(state)
|
||||
{
|
||||
@ -521,3 +540,15 @@ xp_theme_is_drawable(XpThemeElement element)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xp_theme_get_system_font(LOGFONTW *lf)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
if (get_theme_sys_font_func != NULL)
|
||||
{
|
||||
HRESULT hr = (*get_theme_sys_font_func)(NULL, TMT_MSGBOXFONT, lf);
|
||||
ret = (hr == S_OK);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ typedef enum
|
||||
XP_THEME_CLASS_EDIT,
|
||||
XP_THEME_CLASS_TREEVIEW,
|
||||
XP_THEME_CLASS_SPIN,
|
||||
XP_THEME_CLASS_PROGRESS,
|
||||
XP_THEME_CLASS__SIZEOF
|
||||
} XpThemeClass;
|
||||
|
||||
@ -65,6 +66,10 @@ typedef enum
|
||||
XP_THEME_ELEMENT_RADIO_BUTTON,
|
||||
XP_THEME_ELEMENT_TREEVIEW_EXPANDER_OPENED,
|
||||
XP_THEME_ELEMENT_TREEVIEW_EXPANDER_CLOSED,
|
||||
XP_THEME_ELEMENT_PROGRESS_BAR_H,
|
||||
XP_THEME_ELEMENT_PROGRESS_BAR_V,
|
||||
XP_THEME_ELEMENT_PROGRESS_TROUGH_H,
|
||||
XP_THEME_ELEMENT_PROGRESS_TROUGH_V,
|
||||
XP_THEME_ELEMENT__SIZEOF
|
||||
} XpThemeElement;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user