本文整理了Java中org.eclipse.swt.widgets.Button.gtk_css_provider_load_from_css()
方法的一些代码示例,展示了Button.gtk_css_provider_load_from_css()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.gtk_css_provider_load_from_css()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Button
类名称:Button
方法名:gtk_css_provider_load_from_css
暂无
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
private void gtk_swt_set_border_color (GdkColor color) {
//Convert GtkColor to GdkRGBA
//TODO : Reactor in future commit. This and widget:setForegroundColor have duplicate code.
GdkRGBA rgba = null;
if (color != null) {
rgba = display.toGdkRGBA (color);
}
//Construct CSS String
//TODO : Reactor in future commit.
// This and Control:setBackgroundColorGradient(..). as there is similar code.
// ideally we should have a 'constructCssString(..) that accepts attribute-value pairs.
String css_string = "* {\n";
if (rgba != null) {
String css_color = display.gtk_rgba_to_css_string (rgba);
css_string += "border-color: " + css_color + ";\n";
}
css_string += "}\n";
//Apply CSS to widget.
long /*int*/context = OS.gtk_widget_get_style_context (handle);
gtk_css_provider_load_from_css (context, css_string);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
private void gtk_swt_set_border_color (GdkColor color) {
//Convert GtkColor to GdkRGBA
//TODO : Reactor in future commit. This and widget:setForegroundColor have duplicate code.
GdkRGBA rgba = null;
if (color != null) {
rgba = display.toGdkRGBA (color);
}
//Construct CSS String
//TODO : Reactor in future commit.
// This and Control:setBackgroundColorGradient(..). as there is similar code.
// ideally we should have a 'constructCssString(..) that accepts attribute-value pairs.
String css_string = "* {\n";
if (rgba != null) {
String css_color = display.gtk_rgba_to_css_string (rgba);
css_string += "border-color: " + css_color + ";\n";
}
css_string += "}\n";
//Apply CSS to widget.
int /*long*/context = OS.gtk_widget_get_style_context (handle);
gtk_css_provider_load_from_css (context, css_string);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
private void gtk_swt_set_border_color (GdkColor color) {
//Convert GtkColor to GdkRGBA
//TODO : Reactor in future commit. This and widget:setForegroundColor have duplicate code.
GdkRGBA rgba = null;
if (color != null) {
rgba = display.toGdkRGBA (color);
}
//Construct CSS String
//TODO : Reactor in future commit.
// This and Control:setBackgroundColorGradient(..). as there is similar code.
// ideally we should have a 'constructCssString(..) that accepts attribute-value pairs.
String css_string = "* {\n";
if (rgba != null) {
String css_color = display.gtk_rgba_to_css_string (rgba);
css_string += "border-color: " + css_color + ";\n";
}
css_string += "}\n";
//Apply CSS to widget.
int /*long*/context = OS.gtk_widget_get_style_context (handle);
gtk_css_provider_load_from_css (context, css_string);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
@Override
void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
/* Note: this function is called on Gtk3 only */
background = rgba;
//Pre Gtk 3.10 doesn't handle CSS background color very well for Gtk Check/Radio button.
// 3.10.3 as it was the latest to affect themeing in button.
if (OS.GTK_VERSION < OS.VERSION(3, 10, 3) && (style & (SWT.CHECK | SWT.RADIO)) != 0) {
super.setBackgroundColor (context, handle, rgba);
return;
}
// Form background CSS string
String css ="* {background : ";
String color = display.gtk_rgba_to_css_string (rgba);
css += color + ";}";
// Cache background color
cssBackground = css;
// Apply background color and any cached foreground color
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
gtk_css_provider_load_from_css (context, finalCss);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
@Override
void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) {
/* Note: this function is called on Gtk3 only */
background = rgba;
//Pre Gtk 3.10 doesn't handle CSS background color very well for Gtk Check/Radio button.
// 3.10.3 as it was the latest to affect themeing in button.
if (OS.GTK_VERSION < OS.VERSION(3, 10, 3) && (style & (SWT.CHECK | SWT.RADIO)) != 0) {
super.setBackgroundColor (context, handle, rgba);
return;
}
// Form background CSS string
String css ="* {background : ";
String color = display.gtk_rgba_to_css_string (rgba);
css += color + ";}";
// Cache background color
cssBackground = css;
// Apply background color and any cached foreground color
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
gtk_css_provider_load_from_css (context, finalCss);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
@Override
void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) {
/* Note: this function is called on Gtk3 only */
background = rgba;
//Pre Gtk 3.10 doesn't handle CSS background color very well for Gtk Check/Radio button.
// 3.10.3 as it was the latest to affect themeing in button.
if (OS.GTK_VERSION < OS.VERSION(3, 10, 3) && (style & (SWT.CHECK | SWT.RADIO)) != 0) {
super.setBackgroundColor (context, handle, rgba);
return;
}
// Form background CSS string
String css ="* {background : ";
String color = display.gtk_rgba_to_css_string (rgba);
css += color + ";}";
// Cache background color
cssBackground = css;
// Apply background color and any cached foreground color
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
gtk_css_provider_load_from_css (context, finalCss);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
@Override
void setForegroundColor (long /*int*/ handle, GdkRGBA rgba) {
GdkRGBA toSet;
if (rgba != null) {
toSet = rgba;
} else {
GdkColor defaultForeground = display.COLOR_WIDGET_FOREGROUND;
toSet = display.toGdkRGBA (defaultForeground);
}
long /*int*/ context = OS.gtk_widget_get_style_context (handle);
// Form foreground string
String color = display.gtk_rgba_to_css_string(toSet);
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "button" : "GtkButton";
String css = name + " {color: " + color + ";}";
// Cache foreground color
cssForeground = css;
// Apply foreground color and any cached background color
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND);
gtk_css_provider_load_from_css(context, finalCss);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
@Override
void setForegroundColor (int /*long*/ handle, GdkRGBA rgba) {
GdkRGBA toSet;
if (rgba != null) {
toSet = rgba;
} else {
GdkColor defaultForeground = display.COLOR_WIDGET_FOREGROUND;
toSet = display.toGdkRGBA (defaultForeground);
}
int /*long*/ context = OS.gtk_widget_get_style_context (handle);
// Form foreground string
String color = display.gtk_rgba_to_css_string(toSet);
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "button" : "GtkButton";
String css = name + " {color: " + color + ";}";
// Cache foreground color
cssForeground = css;
// Apply foreground color and any cached background color
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND);
gtk_css_provider_load_from_css(context, finalCss);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
@Override
void setForegroundColor (int /*long*/ handle, GdkRGBA rgba) {
GdkRGBA toSet;
if (rgba != null) {
toSet = rgba;
} else {
GdkColor defaultForeground = display.COLOR_WIDGET_FOREGROUND;
toSet = display.toGdkRGBA (defaultForeground);
}
int /*long*/ context = OS.gtk_widget_get_style_context (handle);
// Form foreground string
String color = display.gtk_rgba_to_css_string(toSet);
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "button" : "GtkButton";
String css = name + " {color: " + color + ";}";
// Cache foreground color
cssForeground = css;
// Apply foreground color and any cached background color
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND);
gtk_css_provider_load_from_css(context, finalCss);
}
内容来源于网络,如有侵权,请联系作者删除!