1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GtkStyle.html 27 * outPack = gtk 28 * outFile = Style 29 * strct = GtkStyle 30 * realStrct= 31 * ctorStrct= 32 * clss = Style 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_style_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - core.vararg 48 * - glib.Str 49 * - cairo.Context 50 * - gobject.Value 51 * - gdk.Color 52 * - gdk.Pixbuf 53 * - gdk.Window 54 * - gtk.IconSet 55 * - gtk.IconSource 56 * - gtk.Widget 57 * - pango.PgLayout 58 * structWrap: 59 * - GValue* -> Value 60 * - GdkColor* -> Color 61 * - GdkPixbuf* -> Pixbuf 62 * - GdkWindow* -> Window 63 * - GtkIconSet* -> IconSet 64 * - GtkIconSource* -> IconSource 65 * - GtkStyle* -> Style 66 * - GtkWidget* -> Widget 67 * - PangoLayout* -> PgLayout 68 * - cairo_t* -> Context 69 * module aliases: 70 * local aliases: 71 * overrides: 72 */ 73 74 module gtk.Style; 75 76 public import gtkc.gtktypes; 77 78 private import gtkc.gtk; 79 private import glib.ConstructionException; 80 private import gobject.ObjectG; 81 82 private import gobject.Signals; 83 public import gtkc.gdktypes; 84 private import core.vararg; 85 private import glib.Str; 86 private import cairo.Context; 87 private import gobject.Value; 88 private import gdk.Color; 89 private import gdk.Pixbuf; 90 private import gdk.Window; 91 private import gtk.IconSet; 92 private import gtk.IconSource; 93 private import gtk.Widget; 94 private import pango.PgLayout; 95 96 97 private import gobject.ObjectG; 98 99 /** 100 * A GtkStyle object encapsulates the information that provides the look and 101 * feel for a widget. 102 * 103 * Warning 104 * 105 * In GTK+ 3.0, GtkStyle has been deprecated and replaced by GtkStyleContext. 106 * 107 * Each GtkWidget has an associated GtkStyle object that is used when 108 * rendering that widget. Also, a GtkStyle holds information for the five 109 * possible widget states though not every widget supports all five 110 * states; see GtkStateType. 111 * 112 * Usually the GtkStyle for a widget is the same as the default style that 113 * is set by GTK+ and modified the theme engine. 114 * 115 * Usually applications should not need to use or modify the GtkStyle of 116 * their widgets. 117 */ 118 public class Style : ObjectG 119 { 120 121 /** the main Gtk struct */ 122 protected GtkStyle* gtkStyle; 123 124 125 /** Get the main Gtk struct */ 126 public GtkStyle* getStyleStruct() 127 { 128 return gtkStyle; 129 } 130 131 132 /** the main Gtk struct as a void* */ 133 protected override void* getStruct() 134 { 135 return cast(void*)gtkStyle; 136 } 137 138 /** 139 * Sets our main struct and passes it to the parent class 140 */ 141 public this (GtkStyle* gtkStyle) 142 { 143 super(cast(GObject*)gtkStyle); 144 this.gtkStyle = gtkStyle; 145 } 146 147 protected override void setStruct(GObject* obj) 148 { 149 super.setStruct(obj); 150 gtkStyle = cast(GtkStyle*)obj; 151 } 152 153 deprecated: 154 155 /** 156 */ 157 int[string] connectedSignals; 158 159 void delegate(Style)[] onRealizeListeners; 160 /** 161 * Emitted when the style has been initialized for a particular 162 * visual. Connecting to this signal is probably seldom 163 * useful since most of the time applications and widgets only 164 * deal with styles that have been already realized. 165 * Since 2.4 166 */ 167 void addOnRealize(void delegate(Style) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 168 { 169 if ( !("realize" in connectedSignals) ) 170 { 171 Signals.connectData( 172 getStruct(), 173 "realize", 174 cast(GCallback)&callBackRealize, 175 cast(void*)this, 176 null, 177 connectFlags); 178 connectedSignals["realize"] = 1; 179 } 180 onRealizeListeners ~= dlg; 181 } 182 extern(C) static void callBackRealize(GtkStyle* styleStruct, Style _style) 183 { 184 foreach ( void delegate(Style) dlg ; _style.onRealizeListeners ) 185 { 186 dlg(_style); 187 } 188 } 189 190 void delegate(Style)[] onUnrealizeListeners; 191 /** 192 * Emitted when the aspects of the style specific to a particular visual 193 * is being cleaned up. A connection to this signal can be useful 194 * if a widget wants to cache objects as object data on GtkStyle. 195 * This signal provides a convenient place to free such cached objects. 196 * Since 2.4 197 */ 198 void addOnUnrealize(void delegate(Style) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 199 { 200 if ( !("unrealize" in connectedSignals) ) 201 { 202 Signals.connectData( 203 getStruct(), 204 "unrealize", 205 cast(GCallback)&callBackUnrealize, 206 cast(void*)this, 207 null, 208 connectFlags); 209 connectedSignals["unrealize"] = 1; 210 } 211 onUnrealizeListeners ~= dlg; 212 } 213 extern(C) static void callBackUnrealize(GtkStyle* styleStruct, Style _style) 214 { 215 foreach ( void delegate(Style) dlg ; _style.onUnrealizeListeners ) 216 { 217 dlg(_style); 218 } 219 } 220 221 222 /** 223 * Warning 224 * gtk_style_new has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext 225 * Creates a new GtkStyle. 226 * Throws: ConstructionException GTK+ fails to create the object. 227 */ 228 public this () 229 { 230 // GtkStyle * gtk_style_new (void); 231 auto p = gtk_style_new(); 232 if(p is null) 233 { 234 throw new ConstructionException("null returned by gtk_style_new()"); 235 } 236 this(cast(GtkStyle*) p); 237 } 238 239 /** 240 * Warning 241 * gtk_style_copy has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead 242 * Creates a copy of the passed in GtkStyle object. 243 * Returns: a copy of style. [transfer full] 244 */ 245 public Style copy() 246 { 247 // GtkStyle * gtk_style_copy (GtkStyle *style); 248 auto p = gtk_style_copy(gtkStyle); 249 250 if(p is null) 251 { 252 return null; 253 } 254 255 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 256 } 257 258 /** 259 * Warning 260 * gtk_style_attach has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_widget_style_attach() instead 261 * Attaches a style to a window; this process allocates the 262 * colors and creates the GC's for the style - it specializes 263 * it to a particular visual. The process may involve the creation 264 * of a new style if the style has already been attached to a 265 * window with a different style and visual. 266 * Since this function may return a new object, you have to use it 267 * Params: 268 * window = a GdkWindow. 269 * Returns: Either style, or a newly-created GtkStyle. If the style is newly created, the style parameter will be unref'ed, and the new style will have a reference count belonging to the caller. 270 */ 271 public Style attach(Window window) 272 { 273 // GtkStyle * gtk_style_attach (GtkStyle *style, GdkWindow *window); 274 auto p = gtk_style_attach(gtkStyle, (window is null) ? null : window.getWindowStruct()); 275 276 if(p is null) 277 { 278 return null; 279 } 280 281 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 282 } 283 284 /** 285 * Warning 286 * gtk_style_detach has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead 287 * Detaches a style from a window. If the style is not attached 288 * to any windows anymore, it is unrealized. See gtk_style_attach(). 289 */ 290 public void detach() 291 { 292 // void gtk_style_detach (GtkStyle *style); 293 gtk_style_detach(gtkStyle); 294 } 295 296 /** 297 * Returns whether style has an associated GtkStyleContext. 298 * Returns: TRUE if style has a GtkStyleContext Since 3.0 299 */ 300 public int hasContext() 301 { 302 // gboolean gtk_style_has_context (GtkStyle *style); 303 return gtk_style_has_context(gtkStyle); 304 } 305 306 /** 307 * Warning 308 * gtk_style_set_background has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_style_context_set_background() instead 309 * Sets the background of window to the background color or pixmap 310 * specified by style for the given state. 311 * Params: 312 * window = a GdkWindow 313 * stateType = a state 314 */ 315 public void setBackground(Window window, GtkStateType stateType) 316 { 317 // void gtk_style_set_background (GtkStyle *style, GdkWindow *window, GtkStateType state_type); 318 gtk_style_set_background(gtkStyle, (window is null) ? null : window.getWindowStruct(), stateType); 319 } 320 321 /** 322 * Warning 323 * gtk_style_apply_default_background has been deprecated since version 3.0 and should not be used in newly-written code. Use GtkStyleContext instead 324 */ 325 public void applyDefaultBackground(Context cr, Window window, GtkStateType stateType, int x, int y, int width, int height) 326 { 327 // void gtk_style_apply_default_background (GtkStyle *style, cairo_t *cr, GdkWindow *window, GtkStateType state_type, gint x, gint y, gint width, gint height); 328 gtk_style_apply_default_background(gtkStyle, (cr is null) ? null : cr.getContextStruct(), (window is null) ? null : window.getWindowStruct(), stateType, x, y, width, height); 329 } 330 331 /** 332 * Warning 333 * gtk_style_lookup_color has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_style_context_lookup_color() instead 334 * Looks up color_name in the style's logical color mappings, 335 * filling in color and returning TRUE if found, otherwise 336 * returning FALSE. Do not cache the found mapping, because 337 * it depends on the GtkStyle and might change when a theme 338 * switch occurs. 339 * Since 2.10 340 * Params: 341 * colorName = the name of the logical color to look up 342 * color = the GdkColor to fill in. [out] 343 * Returns: TRUE if the mapping was found. 344 */ 345 public int lookupColor(string colorName, Color color) 346 { 347 // gboolean gtk_style_lookup_color (GtkStyle *style, const gchar *color_name, GdkColor *color); 348 return gtk_style_lookup_color(gtkStyle, Str.toStringz(colorName), (color is null) ? null : color.getColorStruct()); 349 } 350 351 /** 352 * Warning 353 * gtk_style_lookup_icon_set has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_style_context_lookup_icon_set() instead 354 * Looks up stock_id in the icon factories associated with style 355 * and the default icon factory, returning an icon set if found, 356 * otherwise NULL. 357 * Params: 358 * stockId = an icon name 359 * Returns: icon set of stock_id. [transfer none] 360 */ 361 public IconSet lookupIconSet(string stockId) 362 { 363 // GtkIconSet * gtk_style_lookup_icon_set (GtkStyle *style, const gchar *stock_id); 364 auto p = gtk_style_lookup_icon_set(gtkStyle, Str.toStringz(stockId)); 365 366 if(p is null) 367 { 368 return null; 369 } 370 371 return ObjectG.getDObject!(IconSet)(cast(GtkIconSet*) p); 372 } 373 374 /** 375 * Warning 376 * gtk_style_render_icon has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_icon_pixbuf() instead 377 * Renders the icon specified by source at the given size 378 * according to the given parameters and returns the result in a 379 * pixbuf. 380 * Params: 381 * source = the GtkIconSource specifying the icon to render 382 * direction = a text direction 383 * state = a state 384 * size = the size to render the icon at. A size of 385 * (GtkIconSize)-1 means render at the size of the source and 386 * don't scale. [type int] 387 * widget = the widget. [allow-none] 388 * detail = a style detail. [allow-none] 389 * Returns: a newly-created GdkPixbuf containing the rendered icon. [transfer full] 390 */ 391 public Pixbuf renderIcon(IconSource source, GtkTextDirection direction, GtkStateType state, GtkIconSize size, Widget widget, string detail) 392 { 393 // GdkPixbuf * gtk_style_render_icon (GtkStyle *style, const GtkIconSource *source, GtkTextDirection direction, GtkStateType state, GtkIconSize size, GtkWidget *widget, const gchar *detail); 394 auto p = gtk_style_render_icon(gtkStyle, (source is null) ? null : source.getIconSourceStruct(), direction, state, size, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail)); 395 396 if(p is null) 397 { 398 return null; 399 } 400 401 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 402 } 403 404 /** 405 * Queries the value of a style property corresponding to a 406 * widget class is in the given style. 407 * Since 2.16 408 * Params: 409 * widgetType = the GType of a descendant of GtkWidget 410 * propertyName = the name of the style property to get 411 * value = a GValue where the value of the property being 412 * queried will be stored 413 */ 414 public void getStyleProperty(GType widgetType, string propertyName, Value value) 415 { 416 // void gtk_style_get_style_property (GtkStyle *style, GType widget_type, const gchar *property_name, GValue *value); 417 gtk_style_get_style_property(gtkStyle, widgetType, Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 418 } 419 420 /** 421 * Non-vararg variant of gtk_style_get(). 422 * Used primarily by language bindings. 423 * Since 2.16 424 * Params: 425 * widgetType = the GType of a descendant of GtkWidget 426 * firstPropertyName = the name of the first style property to get 427 * varArgs = a va_list of pairs of property names and 428 * locations to return the property values, starting with the 429 * location for first_property_name. 430 */ 431 public void getValist(GType widgetType, string firstPropertyName, void* varArgs) 432 { 433 // void gtk_style_get_valist (GtkStyle *style, GType widget_type, const gchar *first_property_name, va_list var_args); 434 gtk_style_get_valist(gtkStyle, widgetType, Str.toStringz(firstPropertyName), varArgs); 435 } 436 437 /** 438 * Warning 439 * gtk_paint_arrow has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_arrow() instead 440 * Draws an arrow in the given rectangle on cr using the given 441 * parameters. arrow_type determines the direction of the arrow. 442 * Params: 443 * cr = a cairo_t 444 * stateType = a state 445 * shadowType = the type of shadow to draw 446 * widget = the widget. [allow-none] 447 * detail = a style detail. [allow-none] 448 * arrowType = the type of arrow to draw 449 * fill = TRUE if the arrow tip should be filled 450 * x = x origin of the rectangle to draw the arrow in 451 * y = y origin of the rectangle to draw the arrow in 452 * width = width of the rectangle to draw the arrow in 453 * height = height of the rectangle to draw the arrow in 454 */ 455 public void paintArrow(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, GtkArrowType arrowType, int fill, int x, int y, int width, int height) 456 { 457 // void gtk_paint_arrow (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, GtkArrowType arrow_type, gboolean fill, gint x, gint y, gint width, gint height); 458 gtk_paint_arrow(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), arrowType, fill, x, y, width, height); 459 } 460 461 /** 462 * Warning 463 * gtk_paint_box has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_frame() and gtk_render_background() instead 464 * Draws a box on cr with the given parameters. 465 * Params: 466 * cr = a cairo_t 467 * stateType = a state 468 * shadowType = the type of shadow to draw 469 * widget = the widget. [allow-none] 470 * detail = a style detail. [allow-none] 471 * x = x origin of the box 472 * y = y origin of the box 473 * width = the width of the box 474 * height = the height of the box 475 */ 476 public void paintBox(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height) 477 { 478 // void gtk_paint_box (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 479 gtk_paint_box(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 480 } 481 482 /** 483 * Warning 484 * gtk_paint_box_gap has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_frame_gap() instead 485 * Draws a box in cr using the given style and state and shadow type, 486 * leaving a gap in one side. 487 * Params: 488 * cr = a cairo_t 489 * stateType = a state 490 * shadowType = type of shadow to draw 491 * widget = the widget. [allow-none] 492 * detail = a style detail. [allow-none] 493 * x = x origin of the rectangle 494 * y = y origin of the rectangle 495 * width = width of the rectangle 496 * height = width of the rectangle 497 * gapSide = side in which to leave the gap 498 * gapX = starting position of the gap 499 * gapWidth = width of the gap 500 */ 501 public void paintBoxGap(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height, GtkPositionType gapSide, int gapX, int gapWidth) 502 { 503 // void gtk_paint_box_gap (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height, GtkPositionType gap_side, gint gap_x, gint gap_width); 504 gtk_paint_box_gap(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height, gapSide, gapX, gapWidth); 505 } 506 507 /** 508 * Warning 509 * gtk_paint_check has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_check() instead 510 * Draws a check button indicator in the given rectangle on cr with 511 * the given parameters. 512 * Params: 513 * cr = a cairo_t 514 * stateType = a state 515 * shadowType = the type of shadow to draw 516 * widget = the widget. [allow-none] 517 * detail = a style detail. [allow-none] 518 * x = x origin of the rectangle to draw the check in 519 * y = y origin of the rectangle to draw the check in 520 * width = the width of the rectangle to draw the check in 521 * height = the height of the rectangle to draw the check in 522 */ 523 public void paintCheck(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height) 524 { 525 // void gtk_paint_check (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 526 gtk_paint_check(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 527 } 528 529 /** 530 * Warning 531 * gtk_paint_diamond has been deprecated since version 3.0 and should not be used in newly-written code. Use cairo instead 532 * Draws a diamond in the given rectangle on window using the given 533 * parameters. 534 * Params: 535 * cr = a cairo_t 536 * stateType = a state 537 * shadowType = the type of shadow to draw 538 * widget = the widget. [allow-none] 539 * detail = a style detail. [allow-none] 540 * x = x origin of the rectangle to draw the diamond in 541 * y = y origin of the rectangle to draw the diamond in 542 * width = width of the rectangle to draw the diamond in 543 * height = height of the rectangle to draw the diamond in 544 */ 545 public void paintDiamond(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height) 546 { 547 // void gtk_paint_diamond (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 548 gtk_paint_diamond(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 549 } 550 551 /** 552 * Warning 553 * gtk_paint_extension has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_extension() instead 554 * Draws an extension, i.e. a notebook tab. 555 * Params: 556 * cr = a cairo_t 557 * stateType = a state 558 * shadowType = type of shadow to draw 559 * widget = the widget. [allow-none] 560 * detail = a style detail. [allow-none] 561 * x = x origin of the extension 562 * y = y origin of the extension 563 * width = width of the extension 564 * height = width of the extension 565 * gapSide = the side on to which the extension is attached 566 */ 567 public void paintExtension(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height, GtkPositionType gapSide) 568 { 569 // void gtk_paint_extension (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height, GtkPositionType gap_side); 570 gtk_paint_extension(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height, gapSide); 571 } 572 573 /** 574 * Warning 575 * gtk_paint_flat_box has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_frame() and gtk_render_background() instead 576 * Draws a flat box on cr with the given parameters. 577 * Params: 578 * cr = a cairo_t 579 * stateType = a state 580 * shadowType = the type of shadow to draw 581 * widget = the widget. [allow-none] 582 * detail = a style detail. [allow-none] 583 * x = x origin of the box 584 * y = y origin of the box 585 * width = the width of the box 586 * height = the height of the box 587 */ 588 public void paintFlatBox(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height) 589 { 590 // void gtk_paint_flat_box (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 591 gtk_paint_flat_box(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 592 } 593 594 /** 595 * Warning 596 * gtk_paint_focus has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_focus() instead 597 * Draws a focus indicator around the given rectangle on cr using the 598 * given style. 599 * Params: 600 * cr = a cairo_t 601 * stateType = a state 602 * widget = the widget. [allow-none] 603 * detail = a style detail. [allow-none] 604 * x = the x origin of the rectangle around which to draw a focus indicator 605 * y = the y origin of the rectangle around which to draw a focus indicator 606 * width = the width of the rectangle around which to draw a focus indicator 607 * height = the height of the rectangle around which to draw a focus indicator 608 */ 609 public void paintFocus(Context cr, GtkStateType stateType, Widget widget, string detail, int x, int y, int width, int height) 610 { 611 // void gtk_paint_focus (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 612 gtk_paint_focus(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 613 } 614 615 /** 616 * Warning 617 * gtk_paint_handle has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_handle() instead 618 * Draws a handle as used in GtkHandleBox and GtkPaned. 619 * Params: 620 * cr = a cairo_t 621 * stateType = a state 622 * shadowType = type of shadow to draw 623 * widget = the widget. [allow-none] 624 * detail = a style detail. [allow-none] 625 * x = x origin of the handle 626 * y = y origin of the handle 627 * width = with of the handle 628 * height = height of the handle 629 * orientation = the orientation of the handle 630 */ 631 public void paintHandle(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height, GtkOrientation orientation) 632 { 633 // void gtk_paint_handle (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height, GtkOrientation orientation); 634 gtk_paint_handle(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height, orientation); 635 } 636 637 /** 638 * Warning 639 * gtk_paint_hline has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_line() instead 640 * Draws a horizontal line from (x1, y) to (x2, y) in cr 641 * using the given style and state. 642 * Params: 643 * cr = a caio_t 644 * stateType = a state 645 * widget = the widget. [allow-none] 646 * detail = a style detail. [allow-none] 647 * x1 = the starting x coordinate 648 * x2 = the ending x coordinate 649 * y = the y coordinate 650 */ 651 public void paintHline(Context cr, GtkStateType stateType, Widget widget, string detail, int x1, int x2, int y) 652 { 653 // void gtk_paint_hline (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkWidget *widget, const gchar *detail, gint x1, gint x2, gint y); 654 gtk_paint_hline(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x1, x2, y); 655 } 656 657 /** 658 * Warning 659 * gtk_paint_option has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_option() instead 660 * Draws a radio button indicator in the given rectangle on cr with 661 * the given parameters. 662 * Params: 663 * cr = a cairo_t 664 * stateType = a state 665 * shadowType = the type of shadow to draw 666 * widget = the widget. [allow-none] 667 * detail = a style detail. [allow-none] 668 * x = x origin of the rectangle to draw the option in 669 * y = y origin of the rectangle to draw the option in 670 * width = the width of the rectangle to draw the option in 671 * height = the height of the rectangle to draw the option in 672 */ 673 public void paintOption(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height) 674 { 675 // void gtk_paint_option (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 676 gtk_paint_option(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 677 } 678 679 /** 680 * Warning 681 * gtk_paint_shadow has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_frame() instead 682 * Draws a shadow around the given rectangle in cr 683 * using the given style and state and shadow type. 684 * Params: 685 * cr = a cairo_t 686 * stateType = a state 687 * shadowType = type of shadow to draw 688 * widget = the widget. [allow-none] 689 * detail = a style detail. [allow-none] 690 * x = x origin of the rectangle 691 * y = y origin of the rectangle 692 * width = width of the rectangle 693 * height = width of the rectangle 694 */ 695 public void paintShadow(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height) 696 { 697 // void gtk_paint_shadow (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 698 gtk_paint_shadow(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 699 } 700 701 /** 702 * Warning 703 * gtk_paint_shadow_gap has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_frame_gap() instead 704 * Draws a shadow around the given rectangle in cr 705 * using the given style and state and shadow type, leaving a 706 * gap in one side. 707 * Params: 708 * cr = a cairo_t 709 * stateType = a state 710 * shadowType = type of shadow to draw 711 * widget = the widget. [allow-none] 712 * detail = a style detail. [allow-none] 713 * x = x origin of the rectangle 714 * y = y origin of the rectangle 715 * width = width of the rectangle 716 * height = width of the rectangle 717 * gapSide = side in which to leave the gap 718 * gapX = starting position of the gap 719 * gapWidth = width of the gap 720 */ 721 public void paintShadowGap(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height, GtkPositionType gapSide, int gapX, int gapWidth) 722 { 723 // void gtk_paint_shadow_gap (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height, GtkPositionType gap_side, gint gap_x, gint gap_width); 724 gtk_paint_shadow_gap(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height, gapSide, gapX, gapWidth); 725 } 726 727 /** 728 * Warning 729 * gtk_paint_slider has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_slider() instead 730 * Draws a slider in the given rectangle on cr using the 731 * given style and orientation. 732 * Params: 733 * cr = a cairo_t 734 * stateType = a state 735 * shadowType = a shadow 736 * widget = the widget. [allow-none] 737 * detail = a style detail. [allow-none] 738 * x = the x origin of the rectangle in which to draw a slider 739 * y = the y origin of the rectangle in which to draw a slider 740 * width = the width of the rectangle in which to draw a slider 741 * height = the height of the rectangle in which to draw a slider 742 * orientation = the orientation to be used 743 */ 744 public void paintSlider(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height, GtkOrientation orientation) 745 { 746 // void gtk_paint_slider (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height, GtkOrientation orientation); 747 gtk_paint_slider(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height, orientation); 748 } 749 750 /** 751 * Warning 752 * gtk_paint_spinner has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_activity() instead 753 * Draws a spinner on window using the given parameters. 754 * Params: 755 * cr = a cairo_t 756 * stateType = a state 757 * widget = the widget (may be NULL). [allow-none] 758 * detail = a style detail (may be NULL). [allow-none] 759 * step = the nth step, a value between 0 and "num-steps" 760 * x = the x origin of the rectangle in which to draw the spinner 761 * y = the y origin of the rectangle in which to draw the spinner 762 * width = the width of the rectangle in which to draw the spinner 763 * height = the height of the rectangle in which to draw the spinner 764 */ 765 public void paintSpinner(Context cr, GtkStateType stateType, Widget widget, string detail, uint step, int x, int y, int width, int height) 766 { 767 // void gtk_paint_spinner (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkWidget *widget, const gchar *detail, guint step, gint x, gint y, gint width, gint height); 768 gtk_paint_spinner(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), step, x, y, width, height); 769 } 770 771 /** 772 * Warning 773 * gtk_paint_tab has been deprecated since version 3.0 and should not be used in newly-written code. Use cairo instead 774 * Draws an option menu tab (i.e. the up and down pointing arrows) 775 * in the given rectangle on cr using the given parameters. 776 * Params: 777 * cr = a cairo_t 778 * stateType = a state 779 * shadowType = the type of shadow to draw 780 * widget = the widget. [allow-none] 781 * detail = a style detail. [allow-none] 782 * x = x origin of the rectangle to draw the tab in 783 * y = y origin of the rectangle to draw the tab in 784 * width = the width of the rectangle to draw the tab in 785 * height = the height of the rectangle to draw the tab in 786 */ 787 public void paintTab(Context cr, GtkStateType stateType, GtkShadowType shadowType, Widget widget, string detail, int x, int y, int width, int height) 788 { 789 // void gtk_paint_tab (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); 790 gtk_paint_tab(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, shadowType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, width, height); 791 } 792 793 /** 794 * Warning 795 * gtk_paint_vline has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_line() instead 796 * Draws a vertical line from (x, y1_) to (x, y2_) in cr 797 * using the given style and state. 798 * Params: 799 * cr = a cairo_t 800 * stateType = a state 801 * widget = the widget. [allow-none] 802 * detail = a style detail. [allow-none] 803 * y1_ = the starting y coordinate 804 * y2_ = the ending y coordinate 805 * x = the x coordinate 806 */ 807 public void paintVline(Context cr, GtkStateType stateType, Widget widget, string detail, int y1_, int y2_, int x) 808 { 809 // void gtk_paint_vline (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkWidget *widget, const gchar *detail, gint y1_, gint y2_, gint x); 810 gtk_paint_vline(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), y1_, y2_, x); 811 } 812 813 /** 814 * Warning 815 * gtk_paint_expander has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_expander() instead 816 * Draws an expander as used in GtkTreeView. x and y specify the 817 * center the expander. The size of the expander is determined by the 818 * "expander-size" style property of widget. (If widget is not 819 * specified or doesn't have an "expander-size" property, an 820 * unspecified default size will be used, since the caller doesn't 821 * have sufficient information to position the expander, this is 822 * likely not useful.) The expander is expander_size pixels tall 823 * in the collapsed position and expander_size pixels wide in the 824 * expanded position. 825 * Params: 826 * cr = a cairo_t 827 * stateType = a state 828 * widget = the widget. [allow-none] 829 * detail = a style detail. [allow-none] 830 * x = the x position to draw the expander at 831 * y = the y position to draw the expander at 832 * expanderStyle = the style to draw the expander in; determines 833 * whether the expander is collapsed, expanded, or in an 834 * intermediate state. 835 */ 836 public void paintExpander(Context cr, GtkStateType stateType, Widget widget, string detail, int x, int y, GtkExpanderStyle expanderStyle) 837 { 838 // void gtk_paint_expander (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkWidget *widget, const gchar *detail, gint x, gint y, GtkExpanderStyle expander_style); 839 gtk_paint_expander(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, expanderStyle); 840 } 841 842 /** 843 * Warning 844 * gtk_paint_layout has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_layout() instead 845 * Draws a layout on cr using the given parameters. 846 * Params: 847 * cr = a cairo_t 848 * stateType = a state 849 * useText = whether to use the text or foreground 850 * graphics context of style 851 * widget = the widget. [allow-none] 852 * detail = a style detail. [allow-none] 853 * x = x origin 854 * y = y origin 855 * layout = the layout to draw 856 */ 857 public void paintLayout(Context cr, GtkStateType stateType, int useText, Widget widget, string detail, int x, int y, PgLayout layout) 858 { 859 // void gtk_paint_layout (GtkStyle *style, cairo_t *cr, GtkStateType state_type, gboolean use_text, GtkWidget *widget, const gchar *detail, gint x, gint y, PangoLayout *layout); 860 gtk_paint_layout(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, useText, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), x, y, (layout is null) ? null : layout.getPgLayoutStruct()); 861 } 862 863 /** 864 * Warning 865 * gtk_paint_resize_grip has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_render_handle() instead 866 * Draws a resize grip in the given rectangle on cr using the given 867 * parameters. 868 * Params: 869 * cr = a cairo_t 870 * stateType = a state 871 * widget = the widget. [allow-none] 872 * detail = a style detail. [allow-none] 873 * edge = the edge in which to draw the resize grip 874 * x = the x origin of the rectangle in which to draw the resize grip 875 * y = the y origin of the rectangle in which to draw the resize grip 876 * width = the width of the rectangle in which to draw the resize grip 877 * height = the height of the rectangle in which to draw the resize grip 878 */ 879 public void paintResizeGrip(Context cr, GtkStateType stateType, Widget widget, string detail, GdkWindowEdge edge, int x, int y, int width, int height) 880 { 881 // void gtk_paint_resize_grip (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkWidget *widget, const gchar *detail, GdkWindowEdge edge, gint x, gint y, gint width, gint height); 882 gtk_paint_resize_grip(gtkStyle, (cr is null) ? null : cr.getContextStruct(), stateType, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(detail), edge, x, y, width, height); 883 } 884 885 /** 886 * Warning 887 * gtk_draw_insertion_cursor has been deprecated since version 3.4 and should not be used in newly-written code. Use gtk_render_insertion_cursor() instead. 888 * Draws a text caret on cr at location. This is not a style function 889 * but merely a convenience function for drawing the standard cursor shape. 890 * Params: 891 * widget = a GtkWidget 892 * cr = cairo context to draw to 893 * location = location where to draw the cursor (location->width is ignored) 894 * isPrimary = if the cursor should be the primary cursor color. 895 * direction = whether the cursor is left-to-right or 896 * right-to-left. Should never be GTK_TEXT_DIR_NONE 897 * drawArrow = TRUE to draw a directional arrow on the 898 * cursor. Should be FALSE unless the cursor is split. 899 * Since 3.0 900 */ 901 public static void drawInsertionCursor(Widget widget, Context cr, ref Rectangle location, int isPrimary, GtkTextDirection direction, int drawArrow) 902 { 903 // void gtk_draw_insertion_cursor (GtkWidget *widget, cairo_t *cr, const GdkRectangle *location, gboolean is_primary, GtkTextDirection direction, gboolean draw_arrow); 904 gtk_draw_insertion_cursor((widget is null) ? null : widget.getWidgetStruct(), (cr is null) ? null : cr.getContextStruct(), &location, isPrimary, direction, drawArrow); 905 } 906 }