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