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