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