mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Implementing native progress meter widget. Not part of the build.
This commit is contained in:
parent
60e9cb0e3e
commit
9929343612
@ -56,6 +56,7 @@ extern GtkWidget* gDropdownButtonWidget;
|
||||
extern GtkWidget* gHandleBoxWidget;
|
||||
extern GtkWidget* gFrameWidget;
|
||||
extern GtkWidget* gProtoWindow;
|
||||
extern GtkWidget* gProgressWidget;
|
||||
extern GtkTooltips* gTooltipWidget;
|
||||
|
||||
GtkStateType
|
||||
@ -390,3 +391,22 @@ moz_gtk_frame_paint(GdkWindow* window, GtkStyle* style, GdkRectangle* rect,
|
||||
gFrameWidget, "frame", rect->x, rect->y, rect->width,
|
||||
rect->height);
|
||||
}
|
||||
|
||||
void
|
||||
moz_gtk_progressbar_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* rect, GdkRectangle* cliprect)
|
||||
{
|
||||
gtk_paint_box(style, window, GTK_STATE_NORMAL, GTK_SHADOW_IN,
|
||||
cliprect, gProgressWidget, "trough", rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
|
||||
void
|
||||
moz_gtk_progress_chunk_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* rect, GdkRectangle* cliprect)
|
||||
{
|
||||
gtk_paint_box(style, window, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
|
||||
cliprect, gProgressWidget, "bar", rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,14 @@ void
|
||||
moz_gtk_frame_paint(GdkWindow* window, GtkStyle* style, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect);
|
||||
|
||||
void
|
||||
moz_gtk_progressbar_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* rect, GdkRectangle* cliprect);
|
||||
|
||||
void
|
||||
moz_gtk_progress_chunk_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* rect, GdkRectangle* cliprect);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -66,6 +66,7 @@ GtkWidget* gDropdownButtonWidget;
|
||||
GtkWidget* gHandleBoxWidget;
|
||||
GtkWidget* gFrameWidget;
|
||||
GtkWidget* gProtoWindow;
|
||||
GtkWidget* gProgressWidget;
|
||||
GtkTooltips* gTooltipWidget;
|
||||
|
||||
nsNativeThemeGTK::nsNativeThemeGTK()
|
||||
@ -337,6 +338,20 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
||||
EnsureFrameWidget();
|
||||
moz_gtk_frame_paint(window, gFrameWidget->style, &gdk_rect, &gdk_clip);
|
||||
break;
|
||||
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
EnsureProgressBarWidget();
|
||||
moz_gtk_progressbar_paint(window, gProgressWidget->style, &gdk_rect,
|
||||
&gdk_clip);
|
||||
break;
|
||||
|
||||
case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
EnsureProgressBarWidget();
|
||||
moz_gtk_progress_chunk_paint(window, gProgressWidget->style, &gdk_rect,
|
||||
&gdk_clip);
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -391,6 +406,11 @@ nsNativeThemeGTK::GetWidgetBorder(nsIDeviceContext* aContext, nsIFrame* aFrame,
|
||||
EnsureFrameWidget();
|
||||
WidgetBorderToMargin(gFrameWidget, aResult);
|
||||
break;
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
EnsureProgressBarWidget();
|
||||
WidgetBorderToMargin(gProgressWidget, aResult);
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -546,10 +566,10 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
||||
// case NS_THEME_TREEVIEW_HEADER_CELL:
|
||||
// case NS_THEME_TREEVIEW_HEADER_SORTARROW:
|
||||
// case NS_THEME_TREEVIEW_TWISTY_OPEN:
|
||||
// case NS_THEME_PROGRESSBAR:
|
||||
// case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
// case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
// case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
// case NS_THEME_TAB:
|
||||
// case NS_THEME_TAB_PANEL:
|
||||
// case NS_THEME_TAB_LEFT_EDGE:
|
||||
@ -705,3 +725,12 @@ nsNativeThemeGTK::EnsureFrameWidget()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsNativeThemeGTK::EnsureProgressBarWidget()
|
||||
{
|
||||
if (!gProgressWidget) {
|
||||
gProgressWidget = gtk_progress_bar_new();
|
||||
SetupWidgetPrototype(gProgressWidget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ protected:
|
||||
void EnsureHandleBoxWidget();
|
||||
void EnsureTooltipWidget();
|
||||
void EnsureFrameWidget();
|
||||
void EnsureProgressBarWidget();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAtom> mCheckedAtom;
|
||||
|
@ -115,6 +115,14 @@ void
|
||||
moz_gtk_frame_paint(GdkWindow* window, GtkStyle* style, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect);
|
||||
|
||||
void
|
||||
moz_gtk_progressbar_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* rect, GdkRectangle* cliprect);
|
||||
|
||||
void
|
||||
moz_gtk_progress_chunk_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* rect, GdkRectangle* cliprect);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -66,6 +66,7 @@ GtkWidget* gDropdownButtonWidget;
|
||||
GtkWidget* gHandleBoxWidget;
|
||||
GtkWidget* gFrameWidget;
|
||||
GtkWidget* gProtoWindow;
|
||||
GtkWidget* gProgressWidget;
|
||||
GtkTooltips* gTooltipWidget;
|
||||
|
||||
nsNativeThemeGTK::nsNativeThemeGTK()
|
||||
@ -337,6 +338,20 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
||||
EnsureFrameWidget();
|
||||
moz_gtk_frame_paint(window, gFrameWidget->style, &gdk_rect, &gdk_clip);
|
||||
break;
|
||||
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
EnsureProgressBarWidget();
|
||||
moz_gtk_progressbar_paint(window, gProgressWidget->style, &gdk_rect,
|
||||
&gdk_clip);
|
||||
break;
|
||||
|
||||
case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
EnsureProgressBarWidget();
|
||||
moz_gtk_progress_chunk_paint(window, gProgressWidget->style, &gdk_rect,
|
||||
&gdk_clip);
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -391,6 +406,11 @@ nsNativeThemeGTK::GetWidgetBorder(nsIDeviceContext* aContext, nsIFrame* aFrame,
|
||||
EnsureFrameWidget();
|
||||
WidgetBorderToMargin(gFrameWidget, aResult);
|
||||
break;
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
EnsureProgressBarWidget();
|
||||
WidgetBorderToMargin(gProgressWidget, aResult);
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -546,10 +566,10 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
||||
// case NS_THEME_TREEVIEW_HEADER_CELL:
|
||||
// case NS_THEME_TREEVIEW_HEADER_SORTARROW:
|
||||
// case NS_THEME_TREEVIEW_TWISTY_OPEN:
|
||||
// case NS_THEME_PROGRESSBAR:
|
||||
// case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
// case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
// case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
// case NS_THEME_TAB:
|
||||
// case NS_THEME_TAB_PANEL:
|
||||
// case NS_THEME_TAB_LEFT_EDGE:
|
||||
@ -705,3 +725,12 @@ nsNativeThemeGTK::EnsureFrameWidget()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsNativeThemeGTK::EnsureProgressBarWidget()
|
||||
{
|
||||
if (!gProgressWidget) {
|
||||
gProgressWidget = gtk_progress_bar_new();
|
||||
SetupWidgetPrototype(gProgressWidget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ protected:
|
||||
void EnsureHandleBoxWidget();
|
||||
void EnsureTooltipWidget();
|
||||
void EnsureFrameWidget();
|
||||
void EnsureProgressBarWidget();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAtom> mCheckedAtom;
|
||||
|
Loading…
Reference in New Issue
Block a user