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