Progress bars

This commit is contained in:
Raymond Penners 2003-08-06 20:05:39 +00:00
parent d2c64e305c
commit 6ec4aefa64
5 changed files with 94 additions and 9 deletions

View File

@ -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

View File

@ -26,3 +26,4 @@ style "wimp-scrollbar"
}
class "GtkScrollbar" style "wimp-scrollbar"

View File

@ -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;
@ -865,9 +899,19 @@ draw_box (GtkStyle *style,
if (detail && !strcmp (detail, "trough"))
{
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, TRUE);
if (xp_theme_draw (window, xp_progress_bar,
style, x, y, width, height, state_type))
{
return;
}
else
{
// Blank in classic Windows
}
}
else
{
gboolean is_vertical = GTK_IS_VSCROLLBAR(widget);

View File

@ -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;
}

View File

@ -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;