1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GtkStyleContext.html 27 * outPack = gtk 28 * outFile = StyleContext 29 * strct = GtkStyleContext 30 * realStrct= 31 * ctorStrct= 32 * clss = StyleContext 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_style_context_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * - gtk_border_ 45 * omit code: 46 * omit signals: 47 * imports: 48 * - std.stdarg 49 * - glib.Str 50 * - cairo.Context 51 * - cairo.Surface 52 * - gobject.Value 53 * - glib.ListG 54 * - gdk.FrameClock 55 * - gdk.Pixbuf 56 * - gdk.RGBA 57 * - gdk.Screen 58 * - gdk.Window 59 * - gtk.CssSection 60 * - gtk.IconSet 61 * - gtk.IconSource 62 * - gtk.StyleProviderIF 63 * - gtk.WidgetPath 64 * - pango.PgFontDescription 65 * - pango.PgLayout 66 * structWrap: 67 * - GList* -> ListG 68 * - GValue* -> Value 69 * - GdkFrameClock* -> FrameClock 70 * - GdkPixbuf* -> Pixbuf 71 * - GdkRGBA* -> RGBA 72 * - GdkScreen* -> Screen 73 * - GdkWindow* -> Window 74 * - GtkCssSection* -> CssSection 75 * - GtkIconSet* -> IconSet 76 * - GtkIconSource* -> IconSource 77 * - GtkStyleContext* -> StyleContext 78 * - GtkStyleProvider* -> StyleProviderIF 79 * - GtkWidgetPath* -> WidgetPath 80 * - PangoFontDescription* -> PgFontDescription 81 * - PangoLayout* -> PgLayout 82 * - cairo_surface_t* -> Surface 83 * - cairo_t* -> Context 84 * module aliases: 85 * local aliases: 86 * overrides: 87 */ 88 89 module gtk.StyleContext; 90 91 public import gtkc.gtktypes; 92 93 private import gtkc.gtk; 94 private import glib.ConstructionException; 95 private import gobject.ObjectG; 96 97 private import gobject.Signals; 98 public import gtkc.gdktypes; 99 100 private import glib.Str; 101 private import cairo.Context; 102 private import cairo.Surface; 103 private import gobject.Value; 104 private import glib.ListG; 105 private import gdk.FrameClock; 106 private import gdk.Pixbuf; 107 private import gdk.RGBA; 108 private import gdk.Screen; 109 private import gdk.Window; 110 private import gtk.CssSection; 111 private import gtk.IconSet; 112 private import gtk.IconSource; 113 private import gtk.StyleProviderIF; 114 private import gtk.WidgetPath; 115 private import pango.PgFontDescription; 116 private import pango.PgLayout; 117 118 119 version(Tango) { 120 private import tango.core.Vararg; 121 122 version = druntime; 123 } else version(D_Version2) { 124 private import core.vararg; 125 126 version = druntime; 127 } else { 128 private import std.stdarg; 129 } 130 131 132 private import gobject.ObjectG; 133 134 /** 135 * GtkStyleContext is an object that stores styling information affecting 136 * a widget defined by GtkWidgetPath. 137 * 138 * In order to construct the final style information, GtkStyleContext 139 * queries information from all attached GtkStyleProviders. Style providers 140 * can be either attached explicitly to the context through 141 * gtk_style_context_add_provider(), or to the screen through 142 * gtk_style_context_add_provider_for_screen(). The resulting style is a 143 * combination of all providers' information in priority order. 144 * 145 * For GTK+ widgets, any GtkStyleContext returned by 146 * gtk_widget_get_style_context() will already have a GtkWidgetPath, a 147 * GdkScreen and RTL/LTR information set. The style context will be also 148 * updated automatically if any of these settings change on the widget. 149 * 150 * If you are using the theming layer standalone, you will need to set a 151 * widget path and a screen yourself to the created style context through 152 * gtk_style_context_set_path() and gtk_style_context_set_screen(), as well 153 * as updating the context yourself using gtk_style_context_invalidate() 154 * whenever any of the conditions change, such as a change in the 155 * "gtk-theme-name" setting or a hierarchy change in the rendered 156 * widget. 157 * 158 * Transition animations 159 * 160 * GtkStyleContext has built-in support for state change transitions. 161 * Note that these animations respect the "gtk-enable-animations" 162 * setting. 163 * 164 * For simple widgets where state changes affect the whole widget area, 165 * calling gtk_style_context_notify_state_change() with a NULL region 166 * is sufficient to trigger the transition animation. And GTK+ already 167 * does that when gtk_widget_set_state() or gtk_widget_set_state_flags() 168 * are called. 169 * 170 * If a widget needs to declare several animatable regions (i.e. not 171 * affecting the whole widget area), its "draw" signal handler 172 * needs to wrap the render operations for the different regions with 173 * calls to gtk_style_context_push_animatable_region() and 174 * gtk_style_context_pop_animatable_region(). These functions take an 175 * identifier for the region which must be unique within the style context. 176 * For simple widgets with a fixed set of animatable regions, using an 177 * enumeration works well: 178 * 179 * $(DDOC_COMMENT example) 180 * 181 * For complex widgets with an arbitrary number of animatable regions, it 182 * is up to the implementation to come up with a way to uniquely identify 183 * each animatable region. Using pointers to internal structs is one way 184 * to achieve this: 185 * 186 * $(DDOC_COMMENT example) 187 * 188 * The widget also needs to notify the style context about a state change 189 * for a given animatable region so the animation is triggered. 190 * 191 * $(DDOC_COMMENT example) 192 * 193 * gtk_style_context_notify_state_change() accepts NULL region IDs as a 194 * special value, in this case, the whole widget area will be updated 195 * by the animation. 196 * 197 * <hr> 198 * 199 * Style classes and regions 200 * 201 * Widgets can add style classes to their context, which can be used 202 * to associate different styles by class (see the section called “Selectors”). Theme engines can also use style classes to vary their 203 * rendering. GTK+ has a number of predefined style classes: 204 * GTK_STYLE_CLASS_CELL, 205 * GTK_STYLE_CLASS_ENTRY, 206 * GTK_STYLE_CLASS_BUTTON, 207 * GTK_STYLE_CLASS_COMBOBOX_ENTRY, 208 * GTK_STYLE_CLASS_CALENDAR, 209 * GTK_STYLE_CLASS_SLIDER, 210 * GTK_STYLE_CLASS_BACKGROUND, 211 * GTK_STYLE_CLASS_RUBBERBAND, 212 * GTK_STYLE_CLASS_TOOLTIP, 213 * GTK_STYLE_CLASS_MENU, 214 * GTK_STYLE_CLASS_MENUBAR, 215 * GTK_STYLE_CLASS_MENUITEM, 216 * GTK_STYLE_CLASS_TOOLBAR, 217 * GTK_STYLE_CLASS_PRIMARY_TOOLBAR, 218 * GTK_STYLE_CLASS_INLINE_TOOLBAR, 219 * GTK_STYLE_CLASS_RADIO, 220 * GTK_STYLE_CLASS_CHECK, 221 * GTK_STYLE_CLASS_TROUGH, 222 * GTK_STYLE_CLASS_SCROLLBAR, 223 * GTK_STYLE_CLASS_SCALE, 224 * GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE, 225 * GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW, 226 * GTK_STYLE_CLASS_HEADER, 227 * GTK_STYLE_CLASS_ACCELERATOR, 228 * GTK_STYLE_CLASS_GRIP, 229 * GTK_STYLE_CLASS_DOCK, 230 * GTK_STYLE_CLASS_PROGRESSBAR, 231 * GTK_STYLE_CLASS_SPINNER, 232 * GTK_STYLE_CLASS_EXPANDER, 233 * GTK_STYLE_CLASS_SPINBUTTON, 234 * GTK_STYLE_CLASS_NOTEBOOK, 235 * GTK_STYLE_CLASS_VIEW, 236 * GTK_STYLE_CLASS_SIDEBAR, 237 * GTK_STYLE_CLASS_IMAGE, 238 * GTK_STYLE_CLASS_HIGHLIGHT, 239 * GTK_STYLE_CLASS_FRAME, 240 * GTK_STYLE_CLASS_DND, 241 * GTK_STYLE_CLASS_PANE_SEPARATOR, 242 * GTK_STYLE_CLASS_SEPARATOR, 243 * GTK_STYLE_CLASS_INFO, 244 * GTK_STYLE_CLASS_WARNING, 245 * GTK_STYLE_CLASS_QUESTION, 246 * GTK_STYLE_CLASS_ERROR, 247 * GTK_STYLE_CLASS_HORIZONTAL, 248 * GTK_STYLE_CLASS_VERTICAL, 249 * GTK_STYLE_CLASS_TOP, 250 * GTK_STYLE_CLASS_BOTTOM, 251 * GTK_STYLE_CLASS_LEFT, 252 * GTK_STYLE_CLASS_RIGHT, 253 * 254 * Widgets can also add regions with flags to their context. 255 * The regions used by GTK+ widgets are: 256 * 257 * Region 258 * Flags 259 * Macro 260 * Used by 261 * 262 * row 263 * even, odd 264 * GTK_STYLE_REGION_ROW 265 * GtkTreeView 266 * 267 * column 268 * first, last, sorted 269 * GTK_STYLE_REGION_COLUMN 270 * GtkTreeView 271 * 272 * column-header 273 * 274 * GTK_STYLE_REGION_COLUMN_HEADER 275 * 276 * tab 277 * even, odd, first, last 278 * GTK_STYLE_REGION_TAB 279 * GtkNotebook 280 * 281 * <hr> 282 * 283 * Custom styling in UI libraries and applications 284 * 285 * If you are developing a library with custom GtkWidgets that 286 * render differently than standard components, you may need to add a 287 * GtkStyleProvider yourself with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK 288 * priority, either a GtkCssProvider or a custom object implementing the 289 * GtkStyleProvider interface. This way theming engines may still attempt 290 * to style your UI elements in a different way if needed so. 291 * 292 * If you are using custom styling on an applications, you probably want then 293 * to make your style information prevail to the theme's, so you must use 294 * a GtkStyleProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION 295 * priority, keep in mind that the user settings in 296 * XDG_CONFIG_HOME/gtk-3.0/gtk.css will 297 * still take precedence over your changes, as it uses the 298 * GTK_STYLE_PROVIDER_PRIORITY_USER priority. 299 * 300 * If a custom theming engine is needed, you probably want to implement a 301 * GtkStyleProvider yourself so it points to your GtkThemingEngine 302 * implementation, as GtkCssProvider uses gtk_theming_engine_load() 303 * which loads the theming engine module from the standard paths. 304 */ 305 public class StyleContext : ObjectG 306 { 307 308 /** the main Gtk struct */ 309 protected GtkStyleContext* gtkStyleContext; 310 311 312 public GtkStyleContext* getStyleContextStruct() 313 { 314 return gtkStyleContext; 315 } 316 317 318 /** the main Gtk struct as a void* */ 319 protected override void* getStruct() 320 { 321 return cast(void*)gtkStyleContext; 322 } 323 324 /** 325 * Sets our main struct and passes it to the parent class 326 */ 327 public this (GtkStyleContext* gtkStyleContext) 328 { 329 super(cast(GObject*)gtkStyleContext); 330 this.gtkStyleContext = gtkStyleContext; 331 } 332 333 protected override void setStruct(GObject* obj) 334 { 335 super.setStruct(obj); 336 gtkStyleContext = cast(GtkStyleContext*)obj; 337 } 338 339 /** 340 */ 341 int[string] connectedSignals; 342 343 void delegate(StyleContext)[] onChangedListeners; 344 /** 345 */ 346 void addOnChanged(void delegate(StyleContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 347 { 348 if ( !("changed" in connectedSignals) ) 349 { 350 Signals.connectData( 351 getStruct(), 352 "changed", 353 cast(GCallback)&callBackChanged, 354 cast(void*)this, 355 null, 356 connectFlags); 357 connectedSignals["changed"] = 1; 358 } 359 onChangedListeners ~= dlg; 360 } 361 extern(C) static void callBackChanged(GtkStyleContext* stylecontextStruct, StyleContext _styleContext) 362 { 363 foreach ( void delegate(StyleContext) dlg ; _styleContext.onChangedListeners ) 364 { 365 dlg(_styleContext); 366 } 367 } 368 369 370 /** 371 * Creates a standalone GtkStyleContext, this style context 372 * won't be attached to any widget, so you may want 373 * to call gtk_style_context_set_path() yourself. 374 * Note 375 * This function is only useful when using the theming layer 376 * separated from GTK+, if you are using GtkStyleContext to 377 * theme GtkWidgets, use gtk_widget_get_style_context() 378 * in order to get a style context ready to theme the widget. 379 * Throws: ConstructionException GTK+ fails to create the object. 380 */ 381 public this () 382 { 383 // GtkStyleContext * gtk_style_context_new (void); 384 auto p = gtk_style_context_new(); 385 if(p is null) 386 { 387 throw new ConstructionException("null returned by gtk_style_context_new()"); 388 } 389 this(cast(GtkStyleContext*) p); 390 } 391 392 /** 393 * Adds a style provider to context, to be used in style construction. 394 * Note that a style provider added by this function only affects 395 * the style of the widget to which context belongs. If you want 396 * to affect the style of all widgets, use 397 * gtk_style_context_add_provider_for_screen(). 398 * Note 399 * If both priorities are the same, A GtkStyleProvider 400 * added through this function takes precedence over another added 401 * through gtk_style_context_add_provider_for_screen(). 402 * Params: 403 * provider = a GtkStyleProvider 404 * priority = the priority of the style provider. The lower 405 * it is, the earlier it will be used in the style 406 * construction. Typically this will be in the range 407 * between GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and 408 * GTK_STYLE_PROVIDER_PRIORITY_USER 409 * Since 3.0 410 */ 411 public void addProvider(StyleProviderIF provider, uint priority) 412 { 413 // void gtk_style_context_add_provider (GtkStyleContext *context, GtkStyleProvider *provider, guint priority); 414 gtk_style_context_add_provider(gtkStyleContext, (provider is null) ? null : provider.getStyleProviderTStruct(), priority); 415 } 416 417 /** 418 * Adds a global style provider to screen, which will be used 419 * in style construction for all GtkStyleContexts under screen. 420 * GTK+ uses this to make styling information from GtkSettings 421 * available. 422 * Note 423 * If both priorities are the same, A GtkStyleProvider 424 * added through gtk_style_context_add_provider() takes precedence 425 * over another added through this function. 426 * Params: 427 * screen = a GdkScreen 428 * provider = a GtkStyleProvider 429 * priority = the priority of the style provider. The lower 430 * it is, the earlier it will be used in the style 431 * construction. Typically this will be in the range 432 * between GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and 433 * GTK_STYLE_PROVIDER_PRIORITY_USER 434 * Since 3.0 435 */ 436 public static void addProviderForScreen(Screen screen, StyleProviderIF provider, uint priority) 437 { 438 // void gtk_style_context_add_provider_for_screen (GdkScreen *screen, GtkStyleProvider *provider, guint priority); 439 gtk_style_context_add_provider_for_screen((screen is null) ? null : screen.getScreenStruct(), (provider is null) ? null : provider.getStyleProviderTStruct(), priority); 440 } 441 442 /** 443 * Warning 444 * gtk_style_context_get_direction has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_style_context_get_state() and 445 * check for GTK_STATE_FLAG_DIR_LTR and 446 * GTK_STATE_FLAG_DIR_RTL instead. 447 * Returns the widget direction used for rendering. 448 * Returns: the widget direction Since 3.0 449 */ 450 public GtkTextDirection getDirection() 451 { 452 // GtkTextDirection gtk_style_context_get_direction (GtkStyleContext *context); 453 return gtk_style_context_get_direction(gtkStyleContext); 454 } 455 456 /** 457 * Returns the sides where rendered elements connect visually with others. 458 * Returns: the junction sides Since 3.0 459 */ 460 public GtkJunctionSides getJunctionSides() 461 { 462 // GtkJunctionSides gtk_style_context_get_junction_sides (GtkStyleContext *context); 463 return gtk_style_context_get_junction_sides(gtkStyleContext); 464 } 465 466 /** 467 * Gets the parent context set via gtk_style_context_set_parent(). 468 * See that function for details. 469 * Returns: the parent context or NULL. [transfer none] Since 3.4 470 */ 471 public StyleContext getParent() 472 { 473 // GtkStyleContext * gtk_style_context_get_parent (GtkStyleContext *context); 474 auto p = gtk_style_context_get_parent(gtkStyleContext); 475 476 if(p is null) 477 { 478 return null; 479 } 480 481 return ObjectG.getDObject!(StyleContext)(cast(GtkStyleContext*) p); 482 } 483 484 /** 485 * Returns the widget path used for style matching. 486 * Returns: A GtkWidgetPath. [transfer none] Since 3.0 487 */ 488 public WidgetPath getPath() 489 { 490 // const GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context); 491 auto p = gtk_style_context_get_path(gtkStyleContext); 492 493 if(p is null) 494 { 495 return null; 496 } 497 498 return ObjectG.getDObject!(WidgetPath)(cast(GtkWidgetPath*) p); 499 } 500 501 /** 502 * Gets a style property from context for the given state. 503 * When value is no longer needed, g_value_unset() must be called 504 * to free any allocated memory. 505 * Params: 506 * property = style property name 507 * state = state to retrieve the property value for 508 * value = return location for the style property value. [out][transfer full] 509 * Since 3.0 510 */ 511 public void getProperty(string property, GtkStateFlags state, Value value) 512 { 513 // void gtk_style_context_get_property (GtkStyleContext *context, const gchar *property, GtkStateFlags state, GValue *value); 514 gtk_style_context_get_property(gtkStyleContext, Str.toStringz(property), state, (value is null) ? null : value.getValueStruct()); 515 } 516 517 /** 518 * Returns the GdkScreen to which context is attached. 519 * Returns: a GdkScreen. [transfer none] 520 */ 521 public Screen getScreen() 522 { 523 // GdkScreen * gtk_style_context_get_screen (GtkStyleContext *context); 524 auto p = gtk_style_context_get_screen(gtkStyleContext); 525 526 if(p is null) 527 { 528 return null; 529 } 530 531 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 532 } 533 534 /** 535 * Returns the GdkFrameClock to which context is attached. 536 * Returns: a GdkFrameClock, or NULL if context does not have an attached frame clock. [transfer none] Since 3.8 537 */ 538 public FrameClock getFrameClock() 539 { 540 // GdkFrameClock * gtk_style_context_get_frame_clock (GtkStyleContext *context); 541 auto p = gtk_style_context_get_frame_clock(gtkStyleContext); 542 543 if(p is null) 544 { 545 return null; 546 } 547 548 return ObjectG.getDObject!(FrameClock)(cast(GdkFrameClock*) p); 549 } 550 551 /** 552 * Returns the state used when rendering. 553 * Returns: the state flags Since 3.0 554 */ 555 public GtkStateFlags getState() 556 { 557 // GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context); 558 return gtk_style_context_get_state(gtkStyleContext); 559 } 560 561 /** 562 * Gets the value for a widget style property. 563 * When value is no longer needed, g_value_unset() must be called 564 * to free any allocated memory. 565 * Params: 566 * propertyName = the name of the widget style property 567 * value = Return location for the property value 568 */ 569 public void getStyleProperty(string propertyName, Value value) 570 { 571 // void gtk_style_context_get_style_property (GtkStyleContext *context, const gchar *property_name, GValue *value); 572 gtk_style_context_get_style_property(gtkStyleContext, Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 573 } 574 575 /** 576 * Retrieves several widget style properties from context according to the 577 * current style. 578 * Params: 579 * args = va_list of property name/return location pairs, followed by NULL 580 * Since 3.0 581 */ 582 public void getStyleValist(void* args) 583 { 584 // void gtk_style_context_get_style_valist (GtkStyleContext *context, va_list args); 585 gtk_style_context_get_style_valist(gtkStyleContext, args); 586 } 587 588 /** 589 * Retrieves several style property values from context for a given state. 590 * Params: 591 * state = state to retrieve the property values for 592 * args = va_list of property name/return location pairs, followed by NULL 593 * Since 3.0 594 */ 595 public void getValist(GtkStateFlags state, void* args) 596 { 597 // void gtk_style_context_get_valist (GtkStyleContext *context, GtkStateFlags state, va_list args); 598 gtk_style_context_get_valist(gtkStyleContext, state, args); 599 } 600 601 /** 602 * Queries the location in the CSS where property was defined for the 603 * current context. Note that the state to be queried is taken from 604 * gtk_style_context_get_state(). 605 * If the location is not available, NULL will be returned. The 606 * location might not be available for various reasons, such as the 607 * property being overridden, property not naming a supported CSS 608 * property or tracking of definitions being disabled for performance 609 * reasons. 610 * Shorthand CSS properties cannot be queried for a location and will 611 * always return NULL. 612 * Params: 613 * property = style property name 614 * Returns: NULL or the section where value was defined 615 */ 616 public CssSection getSection(string property) 617 { 618 // GtkCssSection * gtk_style_context_get_section (GtkStyleContext *context, const gchar *property); 619 auto p = gtk_style_context_get_section(gtkStyleContext, Str.toStringz(property)); 620 621 if(p is null) 622 { 623 return null; 624 } 625 626 return ObjectG.getDObject!(CssSection)(cast(GtkCssSection*) p); 627 } 628 629 /** 630 * Gets the foreground color for a given state. 631 * Params: 632 * state = state to retrieve the color for 633 * color = return value for the foreground color. [out] 634 * Since 3.0 635 */ 636 public void getColor(GtkStateFlags state, RGBA color) 637 { 638 // void gtk_style_context_get_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color); 639 gtk_style_context_get_color(gtkStyleContext, state, (color is null) ? null : color.getRGBAStruct()); 640 } 641 642 /** 643 * Gets the background color for a given state. 644 * Params: 645 * state = state to retrieve the color for 646 * color = return value for the background color. [out] 647 * Since 3.0 648 */ 649 public void getBackgroundColor(GtkStateFlags state, RGBA color) 650 { 651 // void gtk_style_context_get_background_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color); 652 gtk_style_context_get_background_color(gtkStyleContext, state, (color is null) ? null : color.getRGBAStruct()); 653 } 654 655 /** 656 * Gets the border color for a given state. 657 * Params: 658 * state = state to retrieve the color for 659 * color = return value for the border color. [out] 660 * Since 3.0 661 */ 662 public void getBorderColor(GtkStateFlags state, RGBA color) 663 { 664 // void gtk_style_context_get_border_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color); 665 gtk_style_context_get_border_color(gtkStyleContext, state, (color is null) ? null : color.getRGBAStruct()); 666 } 667 668 /** 669 * Gets the border for a given state as a GtkBorder. 670 * See GTK_STYLE_PROPERTY_BORDER_WIDTH. 671 * Params: 672 * state = state to retrieve the border for 673 * border = return value for the border settings. [out] 674 * Since 3.0 675 */ 676 public void getBorder(GtkStateFlags state, out GtkBorder border) 677 { 678 // void gtk_style_context_get_border (GtkStyleContext *context, GtkStateFlags state, GtkBorder *border); 679 gtk_style_context_get_border(gtkStyleContext, state, &border); 680 } 681 682 /** 683 * Gets the padding for a given state as a GtkBorder. 684 * See GTK_STYLE_PROPERTY_PADDING. 685 * Params: 686 * state = state to retrieve the padding for 687 * padding = return value for the padding settings. [out] 688 * Since 3.0 689 */ 690 public void getPadding(GtkStateFlags state, out GtkBorder padding) 691 { 692 // void gtk_style_context_get_padding (GtkStyleContext *context, GtkStateFlags state, GtkBorder *padding); 693 gtk_style_context_get_padding(gtkStyleContext, state, &padding); 694 } 695 696 /** 697 * Gets the margin for a given state as a GtkBorder. 698 * See GTK_STYLE_PROPERTY_MARGIN. 699 * Params: 700 * state = state to retrieve the border for 701 * margin = return value for the margin settings. [out] 702 * Since 3.0 703 */ 704 public void getMargin(GtkStateFlags state, out GtkBorder margin) 705 { 706 // void gtk_style_context_get_margin (GtkStyleContext *context, GtkStateFlags state, GtkBorder *margin); 707 gtk_style_context_get_margin(gtkStyleContext, state, &margin); 708 } 709 710 /** 711 * Warning 712 * gtk_style_context_get_font has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_style_context_get() for "font" or 713 * subproperties instead. 714 * Returns the font description for a given state. The returned 715 * object is const and will remain valid until the 716 * "changed" signal happens. 717 * Params: 718 * state = state to retrieve the font for 719 * Returns: the PangoFontDescription for the given state. This object is owned by GTK+ and should not be freed. [transfer none] Since 3.0 720 */ 721 public PgFontDescription getFont(GtkStateFlags state) 722 { 723 // const PangoFontDescription * gtk_style_context_get_font (GtkStyleContext *context, GtkStateFlags state); 724 auto p = gtk_style_context_get_font(gtkStyleContext, state); 725 726 if(p is null) 727 { 728 return null; 729 } 730 731 return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p); 732 } 733 734 /** 735 * Invalidates context style information, so it will be reconstructed 736 * again. 737 * If you're using a GtkStyleContext returned from 738 * gtk_widget_get_style_context(), you do not need to 739 * call this yourself. 740 */ 741 public void invalidate() 742 { 743 // void gtk_style_context_invalidate (GtkStyleContext *context); 744 gtk_style_context_invalidate(gtkStyleContext); 745 } 746 747 /** 748 * Warning 749 * gtk_style_context_state_is_running has been deprecated since version 3.6 and should not be used in newly-written code. This function always returns FALSE 750 * Returns TRUE if there is a transition animation running for the 751 * current region (see gtk_style_context_push_animatable_region()). 752 * If progress is not NULL, the animation progress will be returned 753 * there, 0.0 means the state is closest to being unset, while 1.0 means 754 * it's closest to being set. This means transition animation will 755 * run from 0 to 1 when state is being set and from 1 to 0 when 756 * it's being unset. 757 * Params: 758 * state = a widget state 759 * progress = return location for the transition progress. [out] 760 * Returns: TRUE if there is a running transition animation for state. Since 3.0 761 */ 762 public int stateIsRunning(GtkStateType state, out double progress) 763 { 764 // gboolean gtk_style_context_state_is_running (GtkStyleContext *context, GtkStateType state, gdouble *progress); 765 return gtk_style_context_state_is_running(gtkStyleContext, state, &progress); 766 } 767 768 /** 769 * Looks up and resolves a color name in the context color map. 770 * Params: 771 * colorName = color name to lookup 772 * color = Return location for the looked up color. [out] 773 * Returns: TRUE if color_name was found and resolved, FALSE otherwise 774 */ 775 public int lookupColor(string colorName, RGBA color) 776 { 777 // gboolean gtk_style_context_lookup_color (GtkStyleContext *context, const gchar *color_name, GdkRGBA *color); 778 return gtk_style_context_lookup_color(gtkStyleContext, Str.toStringz(colorName), (color is null) ? null : color.getRGBAStruct()); 779 } 780 781 /** 782 * Warning 783 * gtk_style_context_lookup_icon_set has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_icon_theme_lookup_icon() instead. 784 * Looks up stock_id in the icon factories associated to context and 785 * the default icon factory, returning an icon set if found, otherwise 786 * NULL. 787 * Params: 788 * stockId = an icon name 789 * Returns: The looked up GtkIconSet, or NULL. [transfer none] 790 */ 791 public IconSet lookupIconSet(string stockId) 792 { 793 // GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context, const gchar *stock_id); 794 auto p = gtk_style_context_lookup_icon_set(gtkStyleContext, Str.toStringz(stockId)); 795 796 if(p is null) 797 { 798 return null; 799 } 800 801 return ObjectG.getDObject!(IconSet)(cast(GtkIconSet*) p); 802 } 803 804 /** 805 * Warning 806 * gtk_style_context_notify_state_change has been deprecated since version 3.6 and should not be used in newly-written code. This function does nothing. 807 * Notifies a state change on context, so if the current style makes use 808 * of transition animations, one will be started so all rendered elements 809 * under region_id are animated for state state being set to value 810 * state_value. 811 * The window parameter is used in order to invalidate the rendered area 812 * as the animation runs, so make sure it is the same window that is being 813 * rendered on by the gtk_render_*() functions. 814 * If region_id is NULL, all rendered elements using context will be 815 * affected by this state transition. 816 * As a practical example, a GtkButton notifying a state transition on 817 * Params: 818 * window = a GdkWindow 819 * regionId = animatable region to notify on, or NULL. 820 * See gtk_style_context_push_animatable_region(). [allow-none] 821 * state = state to trigger transition for 822 * stateValue = TRUE if state is the state we are changing to, 823 * FALSE if we are changing away from it 824 * Since 3.0 825 */ 826 public void notifyStateChange(Window window, void* regionId, GtkStateType state, int stateValue) 827 { 828 // void gtk_style_context_notify_state_change (GtkStyleContext *context, GdkWindow *window, gpointer region_id, GtkStateType state, gboolean state_value); 829 gtk_style_context_notify_state_change(gtkStyleContext, (window is null) ? null : window.getWindowStruct(), regionId, state, stateValue); 830 } 831 832 /** 833 * Warning 834 * gtk_style_context_pop_animatable_region has been deprecated since version 3.6 and should not be used in newly-written code. This function does nothing. 835 * Pops an animatable region from context. 836 * See gtk_style_context_push_animatable_region(). 837 */ 838 public void popAnimatableRegion() 839 { 840 // void gtk_style_context_pop_animatable_region (GtkStyleContext *context); 841 gtk_style_context_pop_animatable_region(gtkStyleContext); 842 } 843 844 /** 845 * Warning 846 * gtk_style_context_push_animatable_region has been deprecated since version 3.6 and should not be used in newly-written code. This function does nothing. 847 * Pushes an animatable region, so all further gtk_render_*() calls between 848 * this call and the following gtk_style_context_pop_animatable_region() 849 * will potentially show transition animations for this region if 850 * gtk_style_context_notify_state_change() is called for a given state, 851 * and the current theme/style defines transition animations for state 852 * changes. 853 * The region_id used must be unique in context so the theming engine 854 * can uniquely identify rendered elements subject to a state transition. 855 * Params: 856 * regionId = unique identifier for the animatable region 857 * Since 3.0 858 */ 859 public void pushAnimatableRegion(void* regionId) 860 { 861 // void gtk_style_context_push_animatable_region (GtkStyleContext *context, gpointer region_id); 862 gtk_style_context_push_animatable_region(gtkStyleContext, regionId); 863 } 864 865 /** 866 * Warning 867 * gtk_style_context_cancel_animations has been deprecated since version 3.6 and should not be used in newly-written code. This function does nothing. 868 * Stops all running animations for region_id and all animatable 869 * regions underneath. 870 * A NULL region_id will stop all ongoing animations in context, 871 * when dealing with a GtkStyleContext obtained through 872 * gtk_widget_get_style_context(), this is normally done for you 873 * in all circumstances you would expect all widget to be stopped, 874 * so this should be only used in complex widgets with different 875 * animatable regions. 876 * Params: 877 * regionId = animatable region to stop, or NULL. 878 * See gtk_style_context_push_animatable_region(). [allow-none] 879 * Since 3.0 880 */ 881 public void cancelAnimations(void* regionId) 882 { 883 // void gtk_style_context_cancel_animations (GtkStyleContext *context, gpointer region_id); 884 gtk_style_context_cancel_animations(gtkStyleContext, regionId); 885 } 886 887 /** 888 * Warning 889 * gtk_style_context_scroll_animations has been deprecated since version 3.6 and should not be used in newly-written code. This function does nothing. 890 * This function is analogous to gdk_window_scroll(), and 891 * should be called together with it so the invalidation 892 * areas for any ongoing animation are scrolled together 893 * with it. 894 * Params: 895 * window = a GdkWindow used previously in 896 * gtk_style_context_notify_state_change() 897 * dx = Amount to scroll in the X axis 898 * dy = Amount to scroll in the Y axis 899 * Since 3.0 900 */ 901 public void scrollAnimations(Window window, int dx, int dy) 902 { 903 // void gtk_style_context_scroll_animations (GtkStyleContext *context, GdkWindow *window, gint dx, gint dy); 904 gtk_style_context_scroll_animations(gtkStyleContext, (window is null) ? null : window.getWindowStruct(), dx, dy); 905 } 906 907 /** 908 * Removes provider from the style providers list in context. 909 * Params: 910 * provider = a GtkStyleProvider 911 * Since 3.0 912 */ 913 public void removeProvider(StyleProviderIF provider) 914 { 915 // void gtk_style_context_remove_provider (GtkStyleContext *context, GtkStyleProvider *provider); 916 gtk_style_context_remove_provider(gtkStyleContext, (provider is null) ? null : provider.getStyleProviderTStruct()); 917 } 918 919 /** 920 * Removes provider from the global style providers list in screen. 921 * Params: 922 * screen = a GdkScreen 923 * provider = a GtkStyleProvider 924 * Since 3.0 925 */ 926 public static void removeProviderForScreen(Screen screen, StyleProviderIF provider) 927 { 928 // void gtk_style_context_remove_provider_for_screen (GdkScreen *screen, GtkStyleProvider *provider); 929 gtk_style_context_remove_provider_for_screen((screen is null) ? null : screen.getScreenStruct(), (provider is null) ? null : provider.getStyleProviderTStruct()); 930 } 931 932 /** 933 * This function recomputes the styles for all widgets under a particular 934 * GdkScreen. This is useful when some global parameter has changed that 935 * affects the appearance of all widgets, because when a widget gets a new 936 * style, it will both redraw and recompute any cached information about 937 * its appearance. As an example, it is used when the color scheme changes 938 * in the related GtkSettings object. 939 * Params: 940 * screen = a GdkScreen 941 * Since 3.0 942 */ 943 public static void resetWidgets(Screen screen) 944 { 945 // void gtk_style_context_reset_widgets (GdkScreen *screen); 946 gtk_style_context_reset_widgets((screen is null) ? null : screen.getScreenStruct()); 947 } 948 949 /** 950 * Sets the background of window to the background pattern or 951 * color specified in context for its current state. 952 * Params: 953 * window = a GdkWindow 954 * Since 3.0 955 */ 956 public void setBackground(Window window) 957 { 958 // void gtk_style_context_set_background (GtkStyleContext *context, GdkWindow *window); 959 gtk_style_context_set_background(gtkStyleContext, (window is null) ? null : window.getWindowStruct()); 960 } 961 962 /** 963 * Restores context state to a previous stage. 964 * See gtk_style_context_save(). 965 */ 966 public void restore() 967 { 968 // void gtk_style_context_restore (GtkStyleContext *context); 969 gtk_style_context_restore(gtkStyleContext); 970 } 971 972 /** 973 * Saves the context state, so all modifications done through 974 * gtk_style_context_add_class(), gtk_style_context_remove_class(), 975 * gtk_style_context_add_region(), gtk_style_context_remove_region() 976 * or gtk_style_context_set_junction_sides() can be reverted in one 977 * go through gtk_style_context_restore(). 978 */ 979 public void save() 980 { 981 // void gtk_style_context_save (GtkStyleContext *context); 982 gtk_style_context_save(gtkStyleContext); 983 } 984 985 /** 986 * Warning 987 * gtk_style_context_set_direction has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_style_context_set_state() with 988 * GTK_STATE_FLAG_DIR_LTR and GTK_STATE_FLAG_DIR_RTL 989 * instead. 990 * Sets the reading direction for rendering purposes. 991 * If you are using a GtkStyleContext returned from 992 * gtk_widget_get_style_context(), you do not need to 993 * call this yourself. 994 * Params: 995 * direction = the new direction. 996 * Since 3.0 997 */ 998 public void setDirection(GtkTextDirection direction) 999 { 1000 // void gtk_style_context_set_direction (GtkStyleContext *context, GtkTextDirection direction); 1001 gtk_style_context_set_direction(gtkStyleContext, direction); 1002 } 1003 1004 /** 1005 * Sets the sides where rendered elements (mostly through 1006 * gtk_render_frame()) will visually connect with other visual elements. 1007 * This is merely a hint that may or may not be honored 1008 * by theming engines. 1009 * Container widgets are expected to set junction hints as appropriate 1010 * for their children, so it should not normally be necessary to call 1011 * this function manually. 1012 * Params: 1013 * sides = sides where rendered elements are visually connected to 1014 * other elements 1015 * Since 3.0 1016 */ 1017 public void setJunctionSides(GtkJunctionSides sides) 1018 { 1019 // void gtk_style_context_set_junction_sides (GtkStyleContext *context, GtkJunctionSides sides); 1020 gtk_style_context_set_junction_sides(gtkStyleContext, sides); 1021 } 1022 1023 /** 1024 * Sets the parent style context for context. The parent style 1025 * context is used to implement 1026 * inheritance 1027 * of properties. 1028 * If you are using a GtkStyleContext returned from 1029 * gtk_widget_get_style_context(), the parent will be set for you. 1030 * Params: 1031 * parent = the new parent or NULL. [allow-none] 1032 * Since 3.4 1033 */ 1034 public void setParent(StyleContext parent) 1035 { 1036 // void gtk_style_context_set_parent (GtkStyleContext *context, GtkStyleContext *parent); 1037 gtk_style_context_set_parent(gtkStyleContext, (parent is null) ? null : parent.getStyleContextStruct()); 1038 } 1039 1040 /** 1041 * Sets the GtkWidgetPath used for style matching. As a 1042 * consequence, the style will be regenerated to match 1043 * the new given path. 1044 * If you are using a GtkStyleContext returned from 1045 * gtk_widget_get_style_context(), you do not need to call 1046 * this yourself. 1047 * Params: 1048 * path = a GtkWidgetPath 1049 * Since 3.0 1050 */ 1051 public void setPath(WidgetPath path) 1052 { 1053 // void gtk_style_context_set_path (GtkStyleContext *context, GtkWidgetPath *path); 1054 gtk_style_context_set_path(gtkStyleContext, (path is null) ? null : path.getWidgetPathStruct()); 1055 } 1056 1057 /** 1058 * Adds a style class to context, so posterior calls to 1059 * gtk_style_context_get() or any of the gtk_render_*() 1060 * functions will make use of this new class for styling. 1061 * In the CSS file format, a GtkEntry defining an "entry" 1062 * Params: 1063 * className = class name to use in styling 1064 * Since 3.0 1065 */ 1066 public void addClass(string className) 1067 { 1068 // void gtk_style_context_add_class (GtkStyleContext *context, const gchar *class_name); 1069 gtk_style_context_add_class(gtkStyleContext, Str.toStringz(className)); 1070 } 1071 1072 /** 1073 * Removes class_name from context. 1074 * Params: 1075 * className = class name to remove 1076 * Since 3.0 1077 */ 1078 public void removeClass(string className) 1079 { 1080 // void gtk_style_context_remove_class (GtkStyleContext *context, const gchar *class_name); 1081 gtk_style_context_remove_class(gtkStyleContext, Str.toStringz(className)); 1082 } 1083 1084 /** 1085 * Returns TRUE if context currently has defined the 1086 * given class name 1087 * Params: 1088 * className = a class name 1089 * Returns: TRUE if context has class_name defined Since 3.0 1090 */ 1091 public int hasClass(string className) 1092 { 1093 // gboolean gtk_style_context_has_class (GtkStyleContext *context, const gchar *class_name); 1094 return gtk_style_context_has_class(gtkStyleContext, Str.toStringz(className)); 1095 } 1096 1097 /** 1098 * Returns the list of classes currently defined in context. 1099 * Returns: a GList of strings with the currently defined classes. The contents of the list are owned by GTK+, but you must free the list itself with g_list_free() when you are done with it. [transfer container][element-type utf8] Since 3.0 1100 */ 1101 public ListG listClasses() 1102 { 1103 // GList * gtk_style_context_list_classes (GtkStyleContext *context); 1104 auto p = gtk_style_context_list_classes(gtkStyleContext); 1105 1106 if(p is null) 1107 { 1108 return null; 1109 } 1110 1111 return ObjectG.getDObject!(ListG)(cast(GList*) p); 1112 } 1113 1114 /** 1115 * Adds a region to context, so posterior calls to 1116 * gtk_style_context_get() or any of the gtk_render_*() 1117 * functions will make use of this new region for styling. 1118 * In the CSS file format, a GtkTreeView defining a "row" 1119 * Params: 1120 * regionName = region name to use in styling 1121 * flags = flags that apply to the region 1122 * Since 3.0 1123 */ 1124 public void addRegion(string regionName, GtkRegionFlags flags) 1125 { 1126 // void gtk_style_context_add_region (GtkStyleContext *context, const gchar *region_name, GtkRegionFlags flags); 1127 gtk_style_context_add_region(gtkStyleContext, Str.toStringz(regionName), flags); 1128 } 1129 1130 /** 1131 * Removes a region from context. 1132 * Params: 1133 * regionName = region name to unset 1134 * Since 3.0 1135 */ 1136 public void removeRegion(string regionName) 1137 { 1138 // void gtk_style_context_remove_region (GtkStyleContext *context, const gchar *region_name); 1139 gtk_style_context_remove_region(gtkStyleContext, Str.toStringz(regionName)); 1140 } 1141 1142 /** 1143 * Returns TRUE if context has the region defined. 1144 * If flags_return is not NULL, it is set to the flags 1145 * affecting the region. 1146 * Params: 1147 * regionName = a region name 1148 * flagsReturn = return location for region flags. [out][allow-none] 1149 * Returns: TRUE if region is defined Since 3.0 1150 */ 1151 public int hasRegion(string regionName, GtkRegionFlags* flagsReturn) 1152 { 1153 // gboolean gtk_style_context_has_region (GtkStyleContext *context, const gchar *region_name, GtkRegionFlags *flags_return); 1154 return gtk_style_context_has_region(gtkStyleContext, Str.toStringz(regionName), flagsReturn); 1155 } 1156 1157 /** 1158 * Returns the list of regions currently defined in context. 1159 * Returns: a GList of strings with the currently defined regions. The contents of the list are owned by GTK+, but you must free the list itself with g_list_free() when you are done with it. [transfer container][element-type utf8] Since 3.0 1160 */ 1161 public ListG listRegions() 1162 { 1163 // GList * gtk_style_context_list_regions (GtkStyleContext *context); 1164 auto p = gtk_style_context_list_regions(gtkStyleContext); 1165 1166 if(p is null) 1167 { 1168 return null; 1169 } 1170 1171 return ObjectG.getDObject!(ListG)(cast(GList*) p); 1172 } 1173 1174 /** 1175 * Attaches context to the given screen. 1176 * The screen is used to add style information from 'global' style 1177 * providers, such as the screens GtkSettings instance. 1178 * If you are using a GtkStyleContext returned from 1179 * gtk_widget_get_style_context(), you do not need to 1180 * call this yourself. 1181 * Params: 1182 * screen = a GdkScreen 1183 * Since 3.0 1184 */ 1185 public void setScreen(Screen screen) 1186 { 1187 // void gtk_style_context_set_screen (GtkStyleContext *context, GdkScreen *screen); 1188 gtk_style_context_set_screen(gtkStyleContext, (screen is null) ? null : screen.getScreenStruct()); 1189 } 1190 1191 /** 1192 * Attaches context to the given frame clock. 1193 * The frame clock is used for the timing of animations. 1194 * If you are using a GtkStyleContext returned from 1195 * gtk_widget_get_style_context(), you do not need to 1196 * call this yourself. 1197 * Params: 1198 * frameClock = a GdkFrameClock 1199 * Since 3.8 1200 */ 1201 public void setFrameClock(FrameClock frameClock) 1202 { 1203 // void gtk_style_context_set_frame_clock (GtkStyleContext *context, GdkFrameClock *frame_clock); 1204 gtk_style_context_set_frame_clock(gtkStyleContext, (frameClock is null) ? null : frameClock.getFrameClockStruct()); 1205 } 1206 1207 /** 1208 * Sets the state to be used when rendering with any 1209 * of the gtk_render_*() functions. 1210 * Params: 1211 * flags = state to represent 1212 * Since 3.0 1213 */ 1214 public void setState(GtkStateFlags flags) 1215 { 1216 // void gtk_style_context_set_state (GtkStyleContext *context, GtkStateFlags flags); 1217 gtk_style_context_set_state(gtkStyleContext, flags); 1218 } 1219 1220 /** 1221 * Sets the scale to use when getting image assets for the style . 1222 * Params: 1223 * scale = scale 1224 * Since 3.10 1225 */ 1226 public void setScale(int scale) 1227 { 1228 // void gtk_style_context_set_scale (GtkStyleContext *context, gint scale); 1229 gtk_style_context_set_scale(gtkStyleContext, scale); 1230 } 1231 1232 /** 1233 * Returns the scale used for assets. 1234 * Returns: the scale Since 3.10 1235 */ 1236 public int getScale() 1237 { 1238 // gint gtk_style_context_get_scale (GtkStyleContext *context); 1239 return gtk_style_context_get_scale(gtkStyleContext); 1240 } 1241 1242 /** 1243 * Renders an arrow pointing to angle. 1244 * $(DDOC_COMMENT example) 1245 * Params: 1246 * cr = a cairo_t 1247 * angle = arrow angle from 0 to 2 * G_PI, being 0 the arrow pointing to the north 1248 * x = X origin of the render area 1249 * y = Y origin of the render area 1250 * size = square side for render area 1251 * Since 3.0 1252 */ 1253 public void renderArrow(Context cr, double angle, double x, double y, double size) 1254 { 1255 // void gtk_render_arrow (GtkStyleContext *context, cairo_t *cr, gdouble angle, gdouble x, gdouble y, gdouble size); 1256 gtk_render_arrow(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), angle, x, y, size); 1257 } 1258 1259 /** 1260 * Renders the background of an element. 1261 * $(DDOC_COMMENT example) 1262 * Params: 1263 * cr = a cairo_t 1264 * x = X origin of the rectangle 1265 * y = Y origin of the rectangle 1266 * width = rectangle width 1267 * height = rectangle height 1268 * Since 3.0. 1269 */ 1270 public void renderBackground(Context cr, double x, double y, double width, double height) 1271 { 1272 // void gtk_render_background (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1273 gtk_render_background(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1274 } 1275 1276 /** 1277 * Renders a checkmark (as in a GtkCheckButton). 1278 * The GTK_STATE_FLAG_ACTIVE state determines whether the check is 1279 * on or off, and GTK_STATE_FLAG_INCONSISTENT determines whether it 1280 * should be marked as undefined. 1281 * $(DDOC_COMMENT example) 1282 * Params: 1283 * cr = a cairo_t 1284 * x = X origin of the rectangle 1285 * y = Y origin of the rectangle 1286 * width = rectangle width 1287 * height = rectangle height 1288 * Since 3.0 1289 */ 1290 public void renderCheck(Context cr, double x, double y, double width, double height) 1291 { 1292 // void gtk_render_check (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1293 gtk_render_check(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1294 } 1295 1296 /** 1297 * Renders an expander (as used in GtkTreeView and GtkExpander) in the area 1298 * defined by x, y, width, height. The state GTK_STATE_FLAG_ACTIVE 1299 * determines whether the expander is collapsed or expanded. 1300 * $(DDOC_COMMENT example) 1301 * Params: 1302 * cr = a cairo_t 1303 * x = X origin of the rectangle 1304 * y = Y origin of the rectangle 1305 * width = rectangle width 1306 * height = rectangle height 1307 * Since 3.0 1308 */ 1309 public void renderExpander(Context cr, double x, double y, double width, double height) 1310 { 1311 // void gtk_render_expander (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1312 gtk_render_expander(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1313 } 1314 1315 /** 1316 * Renders a extension (as in a GtkNotebook tab) in the rectangle 1317 * defined by x, y, width, height. The side where the extension 1318 * connects to is defined by gap_side. 1319 * $(DDOC_COMMENT example) 1320 * Params: 1321 * cr = a cairo_t 1322 * x = X origin of the rectangle 1323 * y = Y origin of the rectangle 1324 * width = rectangle width 1325 * height = rectangle height 1326 * gapSide = side where the gap is 1327 * Since 3.0 1328 */ 1329 public void renderExtension(Context cr, double x, double y, double width, double height, GtkPositionType gapSide) 1330 { 1331 // void gtk_render_extension (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkPositionType gap_side); 1332 gtk_render_extension(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height, gapSide); 1333 } 1334 1335 /** 1336 * Renders a focus indicator on the rectangle determined by x, y, width, height. 1337 * $(DDOC_COMMENT example) 1338 * Params: 1339 * cr = a cairo_t 1340 * x = X origin of the rectangle 1341 * y = Y origin of the rectangle 1342 * width = rectangle width 1343 * height = rectangle height 1344 * Since 3.0 1345 */ 1346 public void renderFocus(Context cr, double x, double y, double width, double height) 1347 { 1348 // void gtk_render_focus (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1349 gtk_render_focus(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1350 } 1351 1352 /** 1353 * Renders a frame around the rectangle defined by x, y, width, height. 1354 * $(DDOC_COMMENT example) 1355 * Params: 1356 * cr = a cairo_t 1357 * x = X origin of the rectangle 1358 * y = Y origin of the rectangle 1359 * width = rectangle width 1360 * height = rectangle height 1361 * Since 3.0 1362 */ 1363 public void renderFrame(Context cr, double x, double y, double width, double height) 1364 { 1365 // void gtk_render_frame (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1366 gtk_render_frame(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1367 } 1368 1369 /** 1370 * Renders a frame around the rectangle defined by (x, y, width, height), 1371 * leaving a gap on one side. xy0_gap and xy1_gap will mean X coordinates 1372 * for GTK_POS_TOP and GTK_POS_BOTTOM gap sides, and Y coordinates for 1373 * GTK_POS_LEFT and GTK_POS_RIGHT. 1374 * $(DDOC_COMMENT example) 1375 * Params: 1376 * cr = a cairo_t 1377 * x = X origin of the rectangle 1378 * y = Y origin of the rectangle 1379 * width = rectangle width 1380 * height = rectangle height 1381 * gapSide = side where the gap is 1382 * xy0_Gap = initial coordinate (X or Y depending on gap_side) for the gap 1383 * xy1_Gap = end coordinate (X or Y depending on gap_side) for the gap 1384 * Since 3.0 1385 */ 1386 public void renderFrameGap(Context cr, double x, double y, double width, double height, GtkPositionType gapSide, double xy0_Gap, double xy1_Gap) 1387 { 1388 // void gtk_render_frame_gap (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkPositionType gap_side, gdouble xy0_gap, gdouble xy1_gap); 1389 gtk_render_frame_gap(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height, gapSide, xy0_Gap, xy1_Gap); 1390 } 1391 1392 /** 1393 * Renders a handle (as in GtkHandleBox, GtkPaned and 1394 * GtkWindow's resize grip), in the rectangle 1395 * determined by x, y, width, height. 1396 * $(DDOC_COMMENT example) 1397 * Params: 1398 * cr = a cairo_t 1399 * x = X origin of the rectangle 1400 * y = Y origin of the rectangle 1401 * width = rectangle width 1402 * height = rectangle height 1403 * Since 3.0 1404 */ 1405 public void renderHandle(Context cr, double x, double y, double width, double height) 1406 { 1407 // void gtk_render_handle (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1408 gtk_render_handle(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1409 } 1410 1411 /** 1412 * Renders layout on the coordinates x, y 1413 * Params: 1414 * cr = a cairo_t 1415 * x = X origin 1416 * y = Y origin 1417 * layout = the PangoLayout to render 1418 * Since 3.0 1419 */ 1420 public void renderLayout(Context cr, double x, double y, PgLayout layout) 1421 { 1422 // void gtk_render_layout (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, PangoLayout *layout); 1423 gtk_render_layout(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct()); 1424 } 1425 1426 /** 1427 * Renders a line from (x0, y0) to (x1, y1). 1428 * Params: 1429 * cr = a cairo_t 1430 * x0 = X coordinate for the origin of the line 1431 * y0 = Y coordinate for the origin of the line 1432 * x1 = X coordinate for the end of the line 1433 * y1 = Y coordinate for the end of the line 1434 * Since 3.0 1435 */ 1436 public void renderLine(Context cr, double x0, double y0, double x1, double y1) 1437 { 1438 // void gtk_render_line (GtkStyleContext *context, cairo_t *cr, gdouble x0, gdouble y0, gdouble x1, gdouble y1); 1439 gtk_render_line(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x0, y0, x1, y1); 1440 } 1441 1442 /** 1443 * Renders an option mark (as in a GtkRadioButton), the GTK_STATE_FLAG_ACTIVE 1444 * state will determine whether the option is on or off, and 1445 * GTK_STATE_FLAG_INCONSISTENT whether it should be marked as undefined. 1446 * $(DDOC_COMMENT example) 1447 * Params: 1448 * cr = a cairo_t 1449 * x = X origin of the rectangle 1450 * y = Y origin of the rectangle 1451 * width = rectangle width 1452 * height = rectangle height 1453 * Since 3.0 1454 */ 1455 public void renderOption(Context cr, double x, double y, double width, double height) 1456 { 1457 // void gtk_render_option (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1458 gtk_render_option(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1459 } 1460 1461 /** 1462 * Renders a slider (as in GtkScale) in the rectangle defined by x, y, 1463 * width, height. orientation defines whether the slider is vertical 1464 * or horizontal. 1465 * $(DDOC_COMMENT example) 1466 * Params: 1467 * cr = a cairo_t 1468 * x = X origin of the rectangle 1469 * y = Y origin of the rectangle 1470 * width = rectangle width 1471 * height = rectangle height 1472 * orientation = orientation of the slider 1473 * Since 3.0 1474 */ 1475 public void renderSlider(Context cr, double x, double y, double width, double height, GtkOrientation orientation) 1476 { 1477 // void gtk_render_slider (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkOrientation orientation); 1478 gtk_render_slider(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height, orientation); 1479 } 1480 1481 /** 1482 * Renders an activity area (Such as in GtkSpinner or the 1483 * fill line in GtkRange), the state GTK_STATE_FLAG_ACTIVE 1484 * determines whether there is activity going on. 1485 * Params: 1486 * cr = a cairo_t 1487 * x = X origin of the rectangle 1488 * y = Y origin of the rectangle 1489 * width = rectangle width 1490 * height = rectangle height 1491 * Since 3.0 1492 */ 1493 public void renderActivity(Context cr, double x, double y, double width, double height) 1494 { 1495 // void gtk_render_activity (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height); 1496 gtk_render_activity(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, width, height); 1497 } 1498 1499 /** 1500 * Warning 1501 * gtk_render_icon_pixbuf has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_icon_theme_load_icon() instead. 1502 * Renders the icon specified by source at the given size, returning the result 1503 * in a pixbuf. 1504 * Params: 1505 * source = the GtkIconSource specifying the icon to render 1506 * size = the size to render the icon at. A size of (GtkIconSize) -1 1507 * means render at the size of the source and don't scale. [type int] 1508 * Returns: a newly-created GdkPixbuf containing the rendered icon. [transfer full] Since 3.0 1509 */ 1510 public Pixbuf renderIconPixbuf(IconSource source, GtkIconSize size) 1511 { 1512 // GdkPixbuf * gtk_render_icon_pixbuf (GtkStyleContext *context, const GtkIconSource *source, GtkIconSize size); 1513 auto p = gtk_render_icon_pixbuf(gtkStyleContext, (source is null) ? null : source.getIconSourceStruct(), size); 1514 1515 if(p is null) 1516 { 1517 return null; 1518 } 1519 1520 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 1521 } 1522 1523 /** 1524 * Renders the icon in surface at the specified x and y coordinates. 1525 * Params: 1526 * cr = a cairo_t 1527 * surface = a cairo_surface_t containing the icon to draw 1528 * x = X position for the icon 1529 * y = Y position for the incon 1530 * Since 3.10 1531 */ 1532 public void renderIconSurface(Context cr, Surface surface, double x, double y) 1533 { 1534 // void gtk_render_icon_surface (GtkStyleContext *context, cairo_t *cr, cairo_surface_t *surface, gdouble x, gdouble y); 1535 gtk_render_icon_surface(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), (surface is null) ? null : surface.getSurfaceStruct(), x, y); 1536 } 1537 1538 /** 1539 * Renders the icon in pixbuf at the specified x and y coordinates. 1540 * Params: 1541 * cr = a cairo_t 1542 * pixbuf = a GdkPixbuf containing the icon to draw 1543 * x = X position for the pixbuf 1544 * y = Y position for the pixbuf 1545 * Since 3.2 1546 */ 1547 public void renderIcon(Context cr, Pixbuf pixbuf, double x, double y) 1548 { 1549 // void gtk_render_icon (GtkStyleContext *context, cairo_t *cr, GdkPixbuf *pixbuf, gdouble x, gdouble y); 1550 gtk_render_icon(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct(), x, y); 1551 } 1552 1553 /** 1554 * Draws a text caret on cr at the specified index of layout. 1555 * Params: 1556 * cr = a cairo_t 1557 * x = X origin 1558 * y = Y origin 1559 * layout = the PangoLayout of the text 1560 * index = the index in the PangoLayout 1561 * direction = the PangoDirection of the text 1562 * Since 3.4 1563 */ 1564 public void renderInsertionCursor(Context cr, double x, double y, PgLayout layout, int index, PangoDirection direction) 1565 { 1566 // void gtk_render_insertion_cursor (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, PangoLayout *layout, int index, PangoDirection direction); 1567 gtk_render_insertion_cursor(gtkStyleContext, (cr is null) ? null : cr.getContextStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct(), index, direction); 1568 } 1569 }