зеркало из https://github.com/mozilla/pjs.git
Hooking up radio buttons, clean up debugging printf's. Not part of the build.
This commit is contained in:
Родитель
f33a25c893
Коммит
768add5ddc
|
@ -120,7 +120,7 @@ moz_gtk_button_paint(GdkWindow* window, GtkStyle* style,
|
|||
void
|
||||
moz_gtk_check_button_draw_indicator(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* boxRect, GdkRectangle* clipRect,
|
||||
GtkToggleButtonState* aState)
|
||||
GtkToggleButtonState* aState, const char* detail)
|
||||
{
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type;
|
||||
|
@ -142,7 +142,7 @@ moz_gtk_check_button_draw_indicator(GdkWindow* window, GtkStyle* style,
|
|||
if (state_type != GTK_STATE_NORMAL) /* this is for drawing e.g. a prelight box */
|
||||
gtk_paint_flat_box (style, window, state_type,
|
||||
GTK_SHADOW_ETCHED_OUT,
|
||||
clipRect, gCheckboxWidget, "checkbutton",
|
||||
clipRect, gCheckboxWidget, detail,
|
||||
boxRect->x, boxRect->y,
|
||||
boxRect->width, boxRect->height);
|
||||
|
||||
|
@ -160,22 +160,25 @@ moz_gtk_check_button_draw_indicator(GdkWindow* window, GtkStyle* style,
|
|||
state_type = ConvertGtkState(wState);
|
||||
}
|
||||
|
||||
gtk_paint_check (style, window,
|
||||
state_type, shadow_type,
|
||||
clipRect, gCheckboxWidget, "checkbutton",
|
||||
x + 1, y + 1, width, height);
|
||||
if (!strcmp(detail, "radiobutton"))
|
||||
gtk_paint_option(style, window, state_type, shadow_type, clipRect,
|
||||
gCheckboxWidget, detail, x+1, y+1, width, height);
|
||||
else
|
||||
gtk_paint_check(style, window, state_type, shadow_type, clipRect,
|
||||
gCheckboxWidget, detail, x+1, y+1, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
moz_gtk_checkbox_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* boxRect, GdkRectangle* clipRect,
|
||||
GtkToggleButtonState* aState)
|
||||
GtkToggleButtonState* aState, const char* detail)
|
||||
{
|
||||
moz_gtk_check_button_draw_indicator(window, style, boxRect, clipRect, aState);
|
||||
moz_gtk_check_button_draw_indicator(window, style, boxRect,
|
||||
clipRect, aState, detail);
|
||||
|
||||
if (((GtkWidgetState*)aState)->focused)
|
||||
gtk_paint_focus (style, window,
|
||||
clipRect, gCheckboxWidget, "checkbutton",
|
||||
clipRect, gCheckboxWidget, detail,
|
||||
boxRect->x, boxRect->y, boxRect->width - 1, boxRect->height - 1);
|
||||
|
||||
}
|
||||
|
|
|
@ -69,12 +69,7 @@ moz_gtk_button_paint(GdkWindow* window, GtkStyle* style,
|
|||
void
|
||||
moz_gtk_checkbox_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* boxRect, GdkRectangle* clipRect,
|
||||
GtkToggleButtonState* aState);
|
||||
|
||||
void
|
||||
moz_gtk_radio_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* boxRect, GdkRectangle* clipRect,
|
||||
GtkToggleButtonState* aState);
|
||||
GtkToggleButtonState* aState, const char* detail);
|
||||
|
||||
void
|
||||
moz_gtk_scrollbar_button_paint(GdkWindow* window, GtkStyle* style,
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
#include "nsNativeThemeGTK.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "nsDrawingSurfaceGTK.h"
|
||||
extern "C" {
|
||||
#include "gtkdrawing.h"
|
||||
}
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -55,6 +53,8 @@ extern "C" {
|
|||
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
#undef DEBUG_NATIVE_THEME
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsNativeThemeGTK, nsITheme)
|
||||
|
||||
GtkWidget* gButtonWidget = nsnull;
|
||||
|
@ -246,6 +246,7 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
break;
|
||||
|
||||
case NS_THEME_CHECKBOX:
|
||||
case NS_THEME_RADIO:
|
||||
{
|
||||
EnsureCheckBoxWidget();
|
||||
|
||||
|
@ -262,6 +263,7 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
GetGtkWidgetState(aFrame, (GtkWidgetState*)&checkBoxState);
|
||||
checkBoxState.selected = CheckBooleanAttr(aFrame, mCheckedAtom);
|
||||
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("paint checkbox: aRect=(%d,%d,%d,%d), aClipRect=(%d,%d,%d,%d)\n",
|
||||
aRect.x, aRect.y, aRect.width, aRect.height, aClipRect.x,
|
||||
aClipRect.y, aClipRect.width, aClipRect.height);
|
||||
|
@ -269,8 +271,11 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
printf(" gdk_rect=(%d,%d,%d,%d), gdk_clip=(%d,%d,%d,%d)\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height,
|
||||
gdk_clip.x, gdk_clip.y, gdk_clip.width, gdk_clip.height);
|
||||
#endif
|
||||
|
||||
moz_gtk_checkbox_paint(window, gCheckboxWidget->style, &gdk_rect, &gdk_clip, &checkBoxState);
|
||||
moz_gtk_checkbox_paint(window, gCheckboxWidget->style, &gdk_rect,
|
||||
&gdk_clip, &checkBoxState,
|
||||
(aWidgetType==NS_THEME_RADIO) ? "radiobutton" : "checkbutton");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -287,9 +292,11 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
|
||||
GtkArrowType arrowType = GtkArrowType(aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP);
|
||||
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("paint scrollbar button, rect=(%d,%d,%d,%d), clip=(%d,%d,%d,%d)\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height,
|
||||
gdk_clip.x, gdk_clip.y, gdk_clip.width, gdk_clip.height);
|
||||
#endif
|
||||
moz_gtk_scrollbar_button_paint(window, gScrollbarWidget->style, &gdk_rect, &gdk_clip,
|
||||
&buttonState, arrowType);
|
||||
}
|
||||
|
@ -316,9 +323,11 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
GtkWidgetState thumbState;
|
||||
GetGtkWidgetState(aFrame, &thumbState);
|
||||
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("paint thumb, rect=(%d,%d,%d,%d), clip=(%d,%d,%d,%d)\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height,
|
||||
gdk_clip.x, gdk_clip.y, gdk_clip.width, gdk_clip.height);
|
||||
#endif
|
||||
moz_gtk_scrollbar_thumb_paint(window, gScrollbarWidget->style,
|
||||
&gdk_rect, &gdk_clip, &thumbState);
|
||||
}
|
||||
|
@ -331,7 +340,6 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
GtkWidgetState state;
|
||||
GetGtkWidgetState(aFrame, &state);
|
||||
|
||||
printf("painting gripper\n");
|
||||
moz_gtk_gripper_paint(window, gGripperWidget->style, &gdk_rect,
|
||||
&gdk_clip, &state);
|
||||
}
|
||||
|
@ -436,12 +444,13 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
|
|||
aResult->height = slider_width;
|
||||
}
|
||||
|
||||
*aIsOverridable = PR_FALSE;
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("scrollbar thumb min size: (%d,%d)\n", aResult->width,
|
||||
aResult->height);
|
||||
#endif
|
||||
*aIsOverridable = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -508,6 +517,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
|||
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
|
||||
case NS_THEME_TOOLBAR_BUTTON:
|
||||
case NS_THEME_TOOLBAR_GRIPPER:
|
||||
case NS_THEME_RADIO:
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,12 +69,7 @@ moz_gtk_button_paint(GdkWindow* window, GtkStyle* style,
|
|||
void
|
||||
moz_gtk_checkbox_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* boxRect, GdkRectangle* clipRect,
|
||||
GtkToggleButtonState* aState);
|
||||
|
||||
void
|
||||
moz_gtk_radio_paint(GdkWindow* window, GtkStyle* style,
|
||||
GdkRectangle* boxRect, GdkRectangle* clipRect,
|
||||
GtkToggleButtonState* aState);
|
||||
GtkToggleButtonState* aState, const char* detail);
|
||||
|
||||
void
|
||||
moz_gtk_scrollbar_button_paint(GdkWindow* window, GtkStyle* style,
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
#include "nsNativeThemeGTK.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "nsDrawingSurfaceGTK.h"
|
||||
extern "C" {
|
||||
#include "gtkdrawing.h"
|
||||
}
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -55,6 +53,8 @@ extern "C" {
|
|||
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
#undef DEBUG_NATIVE_THEME
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsNativeThemeGTK, nsITheme)
|
||||
|
||||
GtkWidget* gButtonWidget = nsnull;
|
||||
|
@ -246,6 +246,7 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
break;
|
||||
|
||||
case NS_THEME_CHECKBOX:
|
||||
case NS_THEME_RADIO:
|
||||
{
|
||||
EnsureCheckBoxWidget();
|
||||
|
||||
|
@ -262,6 +263,7 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
GetGtkWidgetState(aFrame, (GtkWidgetState*)&checkBoxState);
|
||||
checkBoxState.selected = CheckBooleanAttr(aFrame, mCheckedAtom);
|
||||
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("paint checkbox: aRect=(%d,%d,%d,%d), aClipRect=(%d,%d,%d,%d)\n",
|
||||
aRect.x, aRect.y, aRect.width, aRect.height, aClipRect.x,
|
||||
aClipRect.y, aClipRect.width, aClipRect.height);
|
||||
|
@ -269,8 +271,11 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
printf(" gdk_rect=(%d,%d,%d,%d), gdk_clip=(%d,%d,%d,%d)\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height,
|
||||
gdk_clip.x, gdk_clip.y, gdk_clip.width, gdk_clip.height);
|
||||
#endif
|
||||
|
||||
moz_gtk_checkbox_paint(window, gCheckboxWidget->style, &gdk_rect, &gdk_clip, &checkBoxState);
|
||||
moz_gtk_checkbox_paint(window, gCheckboxWidget->style, &gdk_rect,
|
||||
&gdk_clip, &checkBoxState,
|
||||
(aWidgetType==NS_THEME_RADIO) ? "radiobutton" : "checkbutton");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -287,9 +292,11 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
|
||||
GtkArrowType arrowType = GtkArrowType(aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP);
|
||||
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("paint scrollbar button, rect=(%d,%d,%d,%d), clip=(%d,%d,%d,%d)\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height,
|
||||
gdk_clip.x, gdk_clip.y, gdk_clip.width, gdk_clip.height);
|
||||
#endif
|
||||
moz_gtk_scrollbar_button_paint(window, gScrollbarWidget->style, &gdk_rect, &gdk_clip,
|
||||
&buttonState, arrowType);
|
||||
}
|
||||
|
@ -316,9 +323,11 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
GtkWidgetState thumbState;
|
||||
GetGtkWidgetState(aFrame, &thumbState);
|
||||
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("paint thumb, rect=(%d,%d,%d,%d), clip=(%d,%d,%d,%d)\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height,
|
||||
gdk_clip.x, gdk_clip.y, gdk_clip.width, gdk_clip.height);
|
||||
#endif
|
||||
moz_gtk_scrollbar_thumb_paint(window, gScrollbarWidget->style,
|
||||
&gdk_rect, &gdk_clip, &thumbState);
|
||||
}
|
||||
|
@ -331,7 +340,6 @@ nsNativeThemeGTK::DrawWidgetBackground(nsIRenderingContext* aContext,
|
|||
GtkWidgetState state;
|
||||
GetGtkWidgetState(aFrame, &state);
|
||||
|
||||
printf("painting gripper\n");
|
||||
moz_gtk_gripper_paint(window, gGripperWidget->style, &gdk_rect,
|
||||
&gdk_clip, &state);
|
||||
}
|
||||
|
@ -436,12 +444,13 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
|
|||
aResult->height = slider_width;
|
||||
}
|
||||
|
||||
*aIsOverridable = PR_FALSE;
|
||||
#ifdef DEBUG_NATIVE_THEME
|
||||
printf("scrollbar thumb min size: (%d,%d)\n", aResult->width,
|
||||
aResult->height);
|
||||
#endif
|
||||
*aIsOverridable = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -508,6 +517,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
|||
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
|
||||
case NS_THEME_TOOLBAR_BUTTON:
|
||||
case NS_THEME_TOOLBAR_GRIPPER:
|
||||
case NS_THEME_RADIO:
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче