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 = GtkCellArea.html 27 * outPack = gtk 28 * outFile = CellArea 29 * strct = GtkCellArea 30 * realStrct= 31 * ctorStrct= 32 * clss = CellArea 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - BuildableIF 40 * - CellLayoutIF 41 * prefixes: 42 * - gtk_cell_area_ 43 * omit structs: 44 * omit prefixes: 45 * omit code: 46 * omit signals: 47 * imports: 48 * - std.stdarg 49 * - cairo.Context 50 * - glib.Str 51 * - glib.ListG 52 * - gobject.ParamSpec 53 * - gobject.Value 54 * - gdk.Event 55 * - gtk.CellAreaContext 56 * - gtk.CellEditable 57 * - gtk.CellEditableIF 58 * - gtk.CellRenderer 59 * - gtk.TreeIter 60 * - gtk.TreeModel 61 * - gtk.TreeModelIF 62 * - gtk.Widget 63 * - gtk.BuildableIF 64 * - gtk.BuildableT 65 * - gtk.CellLayoutIF 66 * - gtk.CellLayoutT 67 * structWrap: 68 * - GList* -> ListG 69 * - GParamSpec* -> ParamSpec 70 * - GValue* -> Value 71 * - GdkEvent* -> Event 72 * - GtkCellAreaContext* -> CellAreaContext 73 * - GtkCellEditable* -> CellEditableIF 74 * - GtkCellRenderer* -> CellRenderer 75 * - GtkTreeIter* -> TreeIter 76 * - GtkTreeModel* -> TreeModelIF 77 * - GtkWidget* -> Widget 78 * - cairo_t* -> Context 79 * module aliases: 80 * local aliases: 81 * overrides: 82 */ 83 84 module gtk.CellArea; 85 86 public import gtkc.gtktypes; 87 88 private import gtkc.gtk; 89 private import glib.ConstructionException; 90 private import gobject.ObjectG; 91 92 private import gobject.Signals; 93 public import gtkc.gdktypes; 94 95 private import cairo.Context; 96 private import glib.Str; 97 private import glib.ListG; 98 private import gobject.ParamSpec; 99 private import gobject.Value; 100 private import gdk.Event; 101 private import gtk.CellAreaContext; 102 private import gtk.CellEditable; 103 private import gtk.CellEditableIF; 104 private import gtk.CellRenderer; 105 private import gtk.TreeIter; 106 private import gtk.TreeModel; 107 private import gtk.TreeModelIF; 108 private import gtk.Widget; 109 private import gtk.BuildableIF; 110 private import gtk.BuildableT; 111 private import gtk.CellLayoutIF; 112 private import gtk.CellLayoutT; 113 114 115 version(Tango) { 116 private import tango.core.Vararg; 117 118 version = druntime; 119 } else version(D_Version2) { 120 private import core.vararg; 121 122 version = druntime; 123 } else { 124 private import std.stdarg; 125 } 126 127 128 private import gobject.ObjectG; 129 130 /** 131 * The GtkCellArea is an abstract class for GtkCellLayout widgets 132 * (also referred to as "layouting widgets") to interface with an 133 * arbitrary number of GtkCellRenderers and interact with the user 134 * for a given GtkTreeModel row. 135 * 136 * The cell area handles events, focus navigation, drawing and 137 * size requests and allocations for a given row of data. 138 * 139 * Usually users dont have to interact with the GtkCellArea directly 140 * unless they are implementing a cell-layouting widget themselves. 141 * 142 * Requesting area sizes 143 * 144 * As outlined in GtkWidget's 145 * geometry management section, GTK+ uses a height-for-width 146 * geometry management system to compute the sizes of widgets and user 147 * interfaces. GtkCellArea uses the same semantics to calculate the 148 * size of an area for an arbitrary number of GtkTreeModel rows. 149 * 150 * When requesting the size of a cell area one needs to calculate 151 * the size for a handful of rows, and this will be done differently by 152 * different layouting widgets. For instance a GtkTreeViewColumn 153 * always lines up the areas from top to bottom while a GtkIconView 154 * on the other hand might enforce that all areas received the same 155 * width and wrap the areas around, requesting height for more cell 156 * areas when allocated less width. 157 * 158 * It's also important for areas to maintain some cell 159 * alignments with areas rendered for adjacent rows (cells can 160 * appear "columnized" inside an area even when the size of 161 * cells are different in each row). For this reason the GtkCellArea 162 * uses a GtkCellAreaContext object to store the alignments 163 * and sizes along the way (as well as the overall largest minimum 164 * and natural size for all the rows which have been calculated 165 * with the said context). 166 * 167 * The GtkCellAreaContext is an opaque object specific to the 168 * GtkCellArea which created it (see gtk_cell_area_create_context()). 169 * The owning cell-layouting widget can create as many contexts as 170 * it wishes to calculate sizes of rows which should receive the 171 * same size in at least one orientation (horizontally or vertically), 172 * However, it's important that the same GtkCellAreaContext which 173 * was used to request the sizes for a given GtkTreeModel row be 174 * used when rendering or processing events for that row. 175 * 176 * In order to request the width of all the rows at the root level 177 * of a GtkTreeModel one would do the following: 178 * 179 * $(DDOC_COMMENT example) 180 * 181 * Note that in this example it's not important to observe the 182 * returned minimum and natural width of the area for each row 183 * unless the cell-layouting object is actually interested in the 184 * widths of individual rows. The overall width is however stored 185 * in the accompanying GtkCellAreaContext object and can be consulted 186 * at any time. 187 * 188 * This can be useful since GtkCellLayout widgets usually have to 189 * support requesting and rendering rows in treemodels with an 190 * exceedingly large amount of rows. The GtkCellLayout widget in 191 * that case would calculate the required width of the rows in an 192 * idle or timeout source (see g_timeout_add()) and when the widget 193 * is requested its actual width in GtkWidgetClass.get_preferred_width() 194 * it can simply consult the width accumulated so far in the 195 * GtkCellAreaContext object. 196 * 197 * A simple example where rows are rendered from top to bottom and 198 * take up the full width of the layouting widget would look like: 199 * 200 * $(DDOC_COMMENT example) 201 * 202 * In the above example the Foo widget has to make sure that some 203 * row sizes have been calculated (the amount of rows that Foo judged 204 * was appropriate to request space for in a single timeout iteration) 205 * before simply returning the amount of space required by the area via 206 * the GtkCellAreaContext. 207 * 208 * Requesting the height for width (or width for height) of an area is 209 * a similar task except in this case the GtkCellAreaContext does not 210 * store the data (actually, it does not know how much space the layouting 211 * widget plans to allocate it for every row. It's up to the layouting 212 * widget to render each row of data with the appropriate height and 213 * width which was requested by the GtkCellArea). 214 * 215 * In order to request the height for width of all the rows at the 216 * root level of a GtkTreeModel one would do the following: 217 * 218 * $(DDOC_COMMENT example) 219 * 220 * Note that in the above example we would need to cache the heights 221 * returned for each row so that we would know what sizes to render the 222 * areas for each row. However we would only want to really cache the 223 * heights if the request is intended for the layouting widgets real 224 * allocation. 225 * 226 * In some cases the layouting widget is requested the height for an 227 * arbitrary for_width, this is a special case for layouting widgets 228 * who need to request size for tens of thousands of rows. For this 229 * case it's only important that the layouting widget calculate 230 * one reasonably sized chunk of rows and return that height 231 * synchronously. The reasoning here is that any layouting widget is 232 * at least capable of synchronously calculating enough height to fill 233 * the screen height (or scrolled window height) in response to a single 234 * call to GtkWidgetClass.get_preferred_height_for_width(). Returning 235 * a perfect height for width that is larger than the screen area is 236 * inconsequential since after the layouting receives an allocation 237 * from a scrolled window it simply continues to drive the scrollbar 238 * values while more and more height is required for the row heights 239 * that are calculated in the background. 240 * 241 * <hr> 242 * 243 * Rendering Areas 244 * 245 * Once area sizes have been aquired at least for the rows in the 246 * visible area of the layouting widget they can be rendered at 247 * GtkWidgetClass.draw() time. 248 * 249 * A crude example of how to render all the rows at the root level 250 * runs as follows: 251 * 252 * $(DDOC_COMMENT example) 253 * 254 * Note that the cached height in this example really depends on how 255 * the layouting widget works. The layouting widget might decide to 256 * give every row its minimum or natural height or, if the model content 257 * is expected to fit inside the layouting widget without scrolling, it 258 * would make sense to calculate the allocation for each row at 259 * "size-allocate" time using gtk_distribute_natural_allocation(). 260 * 261 * <hr> 262 * 263 * Handling Events and Driving Keyboard Focus 264 * 265 * Passing events to the area is as simple as handling events on any 266 * normal widget and then passing them to the gtk_cell_area_event() 267 * API as they come in. Usually GtkCellArea is only interested in 268 * button events, however some customized derived areas can be implemented 269 * who are interested in handling other events. Handling an event can 270 * trigger the "focus-changed" signal to fire; as well as 271 * "add-editable" in the case that an editable cell was 272 * clicked and needs to start editing. You can call 273 * gtk_cell_area_stop_editing() at any time to cancel any cell editing 274 * that is currently in progress. 275 * 276 * The GtkCellArea drives keyboard focus from cell to cell in a way 277 * similar to GtkWidget. For layouting widgets that support giving 278 * focus to cells it's important to remember to pass GTK_CELL_RENDERER_FOCUSED 279 * to the area functions for the row that has focus and to tell the 280 * area to paint the focus at render time. 281 * 282 * Layouting widgets that accept focus on cells should implement the 283 * GtkWidgetClass.focus() virtual method. The layouting widget is always 284 * responsible for knowing where GtkTreeModel rows are rendered inside 285 * the widget, so at GtkWidgetClass.focus() time the layouting widget 286 * should use the GtkCellArea methods to navigate focus inside the area 287 * and then observe the GtkDirectionType to pass the focus to adjacent 288 * rows and areas. 289 * 290 * A basic example of how the GtkWidgetClass.focus() virtual method 291 * should be implemented: 292 * 293 * $(DDOC_COMMENT example) 294 * 295 * Note that the layouting widget is responsible for matching the 296 * GtkDirectionType values to the way it lays out its cells. 297 * 298 * <hr> 299 * 300 * Cell Properties 301 * 302 * The GtkCellArea introduces cell properties 303 * for GtkCellRenderers in very much the same way that GtkContainer 304 * introduces child properties 305 * for GtkWidgets. This provides some general interfaces for defining 306 * the relationship cell areas have with their cells. For instance in a 307 * GtkCellAreaBox a cell might "expand" and receive extra space when 308 * the area is allocated more than its full natural request, or a cell 309 * might be configured to "align" with adjacent rows which were requested 310 * and rendered with the same GtkCellAreaContext. 311 * 312 * Use gtk_cell_area_class_install_cell_property() to install cell 313 * properties for a cell area class and gtk_cell_area_class_find_cell_property() 314 * or gtk_cell_area_class_list_cell_properties() to get information about 315 * existing cell properties. 316 * 317 * To set the value of a cell property, use gtk_cell_area_cell_set_property(), 318 * gtk_cell_area_cell_set() or gtk_cell_area_cell_set_valist(). To obtain 319 * the value of a cell property, use gtk_cell_area_cell_get_property(), 320 * gtk_cell_area_cell_get() or gtk_cell_area_cell_get_valist(). 321 */ 322 public class CellArea : ObjectG, BuildableIF, CellLayoutIF 323 { 324 325 /** the main Gtk struct */ 326 protected GtkCellArea* gtkCellArea; 327 328 329 public GtkCellArea* getCellAreaStruct() 330 { 331 return gtkCellArea; 332 } 333 334 335 /** the main Gtk struct as a void* */ 336 protected override void* getStruct() 337 { 338 return cast(void*)gtkCellArea; 339 } 340 341 /** 342 * Sets our main struct and passes it to the parent class 343 */ 344 public this (GtkCellArea* gtkCellArea) 345 { 346 super(cast(GObject*)gtkCellArea); 347 this.gtkCellArea = gtkCellArea; 348 } 349 350 protected override void setStruct(GObject* obj) 351 { 352 super.setStruct(obj); 353 gtkCellArea = cast(GtkCellArea*)obj; 354 } 355 356 // add the Buildable capabilities 357 mixin BuildableT!(GtkCellArea); 358 359 // add the CellLayout capabilities 360 mixin CellLayoutT!(GtkCellArea); 361 362 /** 363 */ 364 int[string] connectedSignals; 365 366 void delegate(CellRenderer, CellEditableIF, GdkRectangle*, string, CellArea)[] onAddEditableListeners; 367 /** 368 * Indicates that editing has started on renderer and that editable 369 * should be added to the owning cell-layouting widget at cell_area. 370 * Since 3.0 371 */ 372 void addOnAddEditable(void delegate(CellRenderer, CellEditableIF, GdkRectangle*, string, CellArea) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 373 { 374 if ( !("add-editable" in connectedSignals) ) 375 { 376 Signals.connectData( 377 getStruct(), 378 "add-editable", 379 cast(GCallback)&callBackAddEditable, 380 cast(void*)this, 381 null, 382 connectFlags); 383 connectedSignals["add-editable"] = 1; 384 } 385 onAddEditableListeners ~= dlg; 386 } 387 extern(C) static void callBackAddEditable(GtkCellArea* areaStruct, GtkCellRenderer* renderer, GtkCellEditable* editable, GdkRectangle* cellArea, gchar* path, CellArea _cellArea) 388 { 389 foreach ( void delegate(CellRenderer, CellEditableIF, GdkRectangle*, string, CellArea) dlg ; _cellArea.onAddEditableListeners ) 390 { 391 dlg(ObjectG.getDObject!(CellRenderer)(renderer), ObjectG.getDObject!(CellEditable, CellEditableIF)(editable), cellArea, Str.toString(path), _cellArea); 392 } 393 } 394 395 void delegate(TreeModelIF, TreeIter, gboolean, gboolean, CellArea)[] onApplyAttributesListeners; 396 /** 397 * This signal is emitted whenever applying attributes to area from model 398 * Since 3.0 399 */ 400 void addOnApplyAttributes(void delegate(TreeModelIF, TreeIter, gboolean, gboolean, CellArea) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 401 { 402 if ( !("apply-attributes" in connectedSignals) ) 403 { 404 Signals.connectData( 405 getStruct(), 406 "apply-attributes", 407 cast(GCallback)&callBackApplyAttributes, 408 cast(void*)this, 409 null, 410 connectFlags); 411 connectedSignals["apply-attributes"] = 1; 412 } 413 onApplyAttributesListeners ~= dlg; 414 } 415 extern(C) static void callBackApplyAttributes(GtkCellArea* areaStruct, GtkTreeModel* model, GtkTreeIter* iter, gboolean isExpander, gboolean isExpanded, CellArea _cellArea) 416 { 417 foreach ( void delegate(TreeModelIF, TreeIter, gboolean, gboolean, CellArea) dlg ; _cellArea.onApplyAttributesListeners ) 418 { 419 dlg(ObjectG.getDObject!(TreeModel, TreeModelIF)(model), ObjectG.getDObject!(TreeIter)(iter), isExpander, isExpanded, _cellArea); 420 } 421 } 422 423 void delegate(CellRenderer, string, CellArea)[] onFocusChangedListeners; 424 /** 425 * Indicates that focus changed on this area. This signal 426 * is emitted either as a result of focus handling or event 427 * handling. 428 * It's possible that the signal is emitted even if the 429 * currently focused renderer did not change, this is 430 * because focus may change to the same renderer in the 431 * same cell area for a different row of data. 432 * Since 3.0 433 */ 434 void addOnFocusChanged(void delegate(CellRenderer, string, CellArea) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 435 { 436 if ( !("focus-changed" in connectedSignals) ) 437 { 438 Signals.connectData( 439 getStruct(), 440 "focus-changed", 441 cast(GCallback)&callBackFocusChanged, 442 cast(void*)this, 443 null, 444 connectFlags); 445 connectedSignals["focus-changed"] = 1; 446 } 447 onFocusChangedListeners ~= dlg; 448 } 449 extern(C) static void callBackFocusChanged(GtkCellArea* areaStruct, GtkCellRenderer* renderer, gchar* path, CellArea _cellArea) 450 { 451 foreach ( void delegate(CellRenderer, string, CellArea) dlg ; _cellArea.onFocusChangedListeners ) 452 { 453 dlg(ObjectG.getDObject!(CellRenderer)(renderer), Str.toString(path), _cellArea); 454 } 455 } 456 457 void delegate(CellRenderer, CellEditableIF, CellArea)[] onRemoveEditableListeners; 458 /** 459 * Indicates that editing finished on renderer and that editable 460 * should be removed from the owning cell-layouting widget. 461 * Since 3.0 462 */ 463 void addOnRemoveEditable(void delegate(CellRenderer, CellEditableIF, CellArea) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 464 { 465 if ( !("remove-editable" in connectedSignals) ) 466 { 467 Signals.connectData( 468 getStruct(), 469 "remove-editable", 470 cast(GCallback)&callBackRemoveEditable, 471 cast(void*)this, 472 null, 473 connectFlags); 474 connectedSignals["remove-editable"] = 1; 475 } 476 onRemoveEditableListeners ~= dlg; 477 } 478 extern(C) static void callBackRemoveEditable(GtkCellArea* areaStruct, GtkCellRenderer* renderer, GtkCellEditable* editable, CellArea _cellArea) 479 { 480 foreach ( void delegate(CellRenderer, CellEditableIF, CellArea) dlg ; _cellArea.onRemoveEditableListeners ) 481 { 482 dlg(ObjectG.getDObject!(CellRenderer)(renderer), ObjectG.getDObject!(CellEditable, CellEditableIF)(editable), _cellArea); 483 } 484 } 485 486 487 /** 488 * Adds renderer to area with the default child cell properties. 489 * Params: 490 * renderer = the GtkCellRenderer to add to area 491 * Since 3.0 492 */ 493 public void add(CellRenderer renderer) 494 { 495 // void gtk_cell_area_add (GtkCellArea *area, GtkCellRenderer *renderer); 496 gtk_cell_area_add(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct()); 497 } 498 499 /** 500 * Removes renderer from area. 501 * Params: 502 * renderer = the GtkCellRenderer to remove from area 503 * Since 3.0 504 */ 505 public void remove(CellRenderer renderer) 506 { 507 // void gtk_cell_area_remove (GtkCellArea *area, GtkCellRenderer *renderer); 508 gtk_cell_area_remove(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct()); 509 } 510 511 /** 512 * Checks if area contains renderer. 513 * Params: 514 * renderer = the GtkCellRenderer to check 515 * Returns: TRUE if renderer is in the area. Since 3.0 516 */ 517 public int hasRenderer(CellRenderer renderer) 518 { 519 // gboolean gtk_cell_area_has_renderer (GtkCellArea *area, GtkCellRenderer *renderer); 520 return gtk_cell_area_has_renderer(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct()); 521 } 522 523 /** 524 * Calls callback for every GtkCellRenderer in area. 525 * Params: 526 * callback = the GtkCellCallback to call. [scope call] 527 * callbackData = user provided data pointer 528 * Since 3.0 529 */ 530 public void foreac(GtkCellCallback callback, void* callbackData) 531 { 532 // void gtk_cell_area_foreach (GtkCellArea *area, GtkCellCallback callback, gpointer callback_data); 533 gtk_cell_area_foreach(gtkCellArea, callback, callbackData); 534 } 535 536 /** 537 * Calls callback for every GtkCellRenderer in area with the 538 * allocated rectangle inside cell_area. 539 * Params: 540 * context = the GtkCellAreaContext for this row of data. 541 * widget = the GtkWidget that area is rendering to 542 * cellArea = the widget relative coordinates and size for area 543 * backgroundArea = the widget relative coordinates of the background area 544 * callback = the GtkCellAllocCallback to call. [scope call] 545 * callbackData = user provided data pointer 546 * Since 3.0 547 */ 548 public void foreachAlloc(CellAreaContext context, Widget widget, ref Rectangle cellArea, ref Rectangle backgroundArea, GtkCellAllocCallback callback, void* callbackData) 549 { 550 // void gtk_cell_area_foreach_alloc (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, const GdkRectangle *cell_area, const GdkRectangle *background_area, GtkCellAllocCallback callback, gpointer callback_data); 551 gtk_cell_area_foreach_alloc(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), &cellArea, &backgroundArea, callback, callbackData); 552 } 553 554 /** 555 * Delegates event handling to a GtkCellArea. 556 * Params: 557 * context = the GtkCellAreaContext for this row of data. 558 * widget = the GtkWidget that area is rendering to 559 * event = the GdkEvent to handle 560 * cellArea = the widget relative coordinates for area 561 * flags = the GtkCellRendererState for area in this row. 562 * Returns: TRUE if the event was handled by area. Since 3.0 563 */ 564 public int event(CellAreaContext context, Widget widget, Event event, ref Rectangle cellArea, GtkCellRendererState flags) 565 { 566 // gint gtk_cell_area_event (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, GdkEvent *event, const GdkRectangle *cell_area, GtkCellRendererState flags); 567 return gtk_cell_area_event(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), (event is null) ? null : event.getEventStruct(), &cellArea, flags); 568 } 569 570 /** 571 * Renders area's cells according to area's layout onto widget at 572 * the given coordinates. 573 * Params: 574 * context = the GtkCellAreaContext for this row of data. 575 * widget = the GtkWidget that area is rendering to 576 * cr = the cairo_t to render with 577 * backgroundArea = the widget relative coordinates for area's background 578 * cellArea = the widget relative coordinates for area 579 * flags = the GtkCellRendererState for area in this row. 580 * paintFocus = whether area should paint focus on focused cells for focused rows or not. 581 * Since 3.0 582 */ 583 public void render(CellAreaContext context, Widget widget, Context cr, ref Rectangle backgroundArea, ref Rectangle cellArea, GtkCellRendererState flags, int paintFocus) 584 { 585 // void gtk_cell_area_render (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, cairo_t *cr, const GdkRectangle *background_area, const GdkRectangle *cell_area, GtkCellRendererState flags, gboolean paint_focus); 586 gtk_cell_area_render(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), (cr is null) ? null : cr.getContextStruct(), &backgroundArea, &cellArea, flags, paintFocus); 587 } 588 589 /** 590 * Derives the allocation of renderer inside area if area 591 * were to be renderered in cell_area. 592 * Params: 593 * context = the GtkCellAreaContext used to hold sizes for area. 594 * widget = the GtkWidget that area is rendering on 595 * renderer = the GtkCellRenderer to get the allocation for 596 * cellArea = the whole allocated area for area in widget 597 * for this row 598 * allocation = where to store the allocation for renderer. [out] 599 * Since 3.0 600 */ 601 public void getCellAllocation(CellAreaContext context, Widget widget, CellRenderer renderer, ref Rectangle cellArea, out Rectangle allocation) 602 { 603 // void gtk_cell_area_get_cell_allocation (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, GtkCellRenderer *renderer, const GdkRectangle *cell_area, GdkRectangle *allocation); 604 gtk_cell_area_get_cell_allocation(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), (renderer is null) ? null : renderer.getCellRendererStruct(), &cellArea, &allocation); 605 } 606 607 /** 608 * Gets the GtkCellRenderer at x and y coordinates inside area and optionally 609 * returns the full cell allocation for it inside cell_area. 610 * Params: 611 * context = the GtkCellAreaContext used to hold sizes for area. 612 * widget = the GtkWidget that area is rendering on 613 * cellArea = the whole allocated area for area in widget 614 * for this row 615 * x = the x position 616 * y = the y position 617 * allocArea = where to store the inner allocated area of the 618 * returned cell renderer, or NULL. [out][allow-none] 619 * Returns: the GtkCellRenderer at x and y. [transfer none] Since 3.0 620 */ 621 public CellRenderer getCellAtPosition(CellAreaContext context, Widget widget, ref Rectangle cellArea, int x, int y, out Rectangle allocArea) 622 { 623 // GtkCellRenderer * gtk_cell_area_get_cell_at_position (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, const GdkRectangle *cell_area, gint x, gint y, GdkRectangle *alloc_area); 624 auto p = gtk_cell_area_get_cell_at_position(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), &cellArea, x, y, &allocArea); 625 626 if(p is null) 627 { 628 return null; 629 } 630 631 return ObjectG.getDObject!(CellRenderer)(cast(GtkCellRenderer*) p); 632 } 633 634 /** 635 * Creates a GtkCellAreaContext to be used with area for 636 * all purposes. GtkCellAreaContext stores geometry information 637 * for rows for which it was operated on, it is important to use 638 * the same context for the same row of data at all times (i.e. 639 * one should render and handle events with the same GtkCellAreaContext 640 * which was used to request the size of those rows of data). 641 * Returns: a newly created GtkCellAreaContext which can be used with area. [transfer full] Since 3.0 642 */ 643 public CellAreaContext createContext() 644 { 645 // GtkCellAreaContext * gtk_cell_area_create_context (GtkCellArea *area); 646 auto p = gtk_cell_area_create_context(gtkCellArea); 647 648 if(p is null) 649 { 650 return null; 651 } 652 653 return ObjectG.getDObject!(CellAreaContext)(cast(GtkCellAreaContext*) p); 654 } 655 656 /** 657 * This is sometimes needed for cases where rows need to share 658 * alignments in one orientation but may be separately grouped 659 * in the opposing orientation. 660 * For instance, GtkIconView creates all icons (rows) to have 661 * the same width and the cells theirin to have the same 662 * horizontal alignments. However each row of icons may have 663 * a separate collective height. GtkIconView uses this to 664 * request the heights of each row based on a context which 665 * was already used to request all the row widths that are 666 * to be displayed. 667 * Params: 668 * context = the GtkCellAreaContext to copy 669 * Returns: a newly created GtkCellAreaContext copy of context. [transfer full] Since 3.0 670 */ 671 public CellAreaContext copyContext(CellAreaContext context) 672 { 673 // GtkCellAreaContext * gtk_cell_area_copy_context (GtkCellArea *area, GtkCellAreaContext *context); 674 auto p = gtk_cell_area_copy_context(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct()); 675 676 if(p is null) 677 { 678 return null; 679 } 680 681 return ObjectG.getDObject!(CellAreaContext)(cast(GtkCellAreaContext*) p); 682 } 683 684 /** 685 * Gets whether the area prefers a height-for-width layout 686 * or a width-for-height layout. 687 * Returns: The GtkSizeRequestMode preferred by area. Since 3.0 688 */ 689 public GtkSizeRequestMode getRequestMode() 690 { 691 // GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area); 692 return gtk_cell_area_get_request_mode(gtkCellArea); 693 } 694 695 /** 696 * Retrieves a cell area's initial minimum and natural width. 697 * area will store some geometrical information in context along the way; 698 * when requesting sizes over an arbitrary number of rows, it's not important 699 * to check the minimum_width and natural_width of this call but rather to 700 * consult gtk_cell_area_context_get_preferred_width() after a series of 701 * requests. 702 * Params: 703 * context = the GtkCellAreaContext to perform this request with 704 * widget = the GtkWidget where area will be rendering 705 * minimumWidth = location to store the minimum width, or NULL. [out][allow-none] 706 * naturalWidth = location to store the natural width, or NULL. [out][allow-none] 707 * Since 3.0 708 */ 709 public void getPreferredWidth(CellAreaContext context, Widget widget, out int minimumWidth, out int naturalWidth) 710 { 711 // void gtk_cell_area_get_preferred_width (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, gint *minimum_width, gint *natural_width); 712 gtk_cell_area_get_preferred_width(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), &minimumWidth, &naturalWidth); 713 } 714 715 /** 716 * Retrieves a cell area's minimum and natural height if it would be given 717 * the specified width. 718 * area stores some geometrical information in context along the way 719 * while calling gtk_cell_area_get_preferred_width(). It's important to 720 * perform a series of gtk_cell_area_get_preferred_width() requests with 721 * context first and then call gtk_cell_area_get_preferred_height_for_width() 722 * on each cell area individually to get the height for width of each 723 * fully requested row. 724 * If at some point, the width of a single row changes, it should be 725 * requested with gtk_cell_area_get_preferred_width() again and then 726 * the full width of the requested rows checked again with 727 * gtk_cell_area_context_get_preferred_width(). 728 * Params: 729 * context = the GtkCellAreaContext which has already been requested for widths. 730 * widget = the GtkWidget where area will be rendering 731 * width = the width for which to check the height of this area 732 * minimumHeight = location to store the minimum height, or NULL. [out][allow-none] 733 * naturalHeight = location to store the natural height, or NULL. [out][allow-none] 734 * Since 3.0 735 */ 736 public void getPreferredHeightForWidth(CellAreaContext context, Widget widget, int width, out int minimumHeight, out int naturalHeight) 737 { 738 // void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, gint width, gint *minimum_height, gint *natural_height); 739 gtk_cell_area_get_preferred_height_for_width(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), width, &minimumHeight, &naturalHeight); 740 } 741 742 /** 743 * Retrieves a cell area's initial minimum and natural height. 744 * area will store some geometrical information in context along the way; 745 * when requesting sizes over an arbitrary number of rows, it's not important 746 * to check the minimum_height and natural_height of this call but rather to 747 * consult gtk_cell_area_context_get_preferred_height() after a series of 748 * requests. 749 * Params: 750 * context = the GtkCellAreaContext to perform this request with 751 * widget = the GtkWidget where area will be rendering 752 * minimumHeight = location to store the minimum height, or NULL. [out][allow-none] 753 * naturalHeight = location to store the natural height, or NULL. [out][allow-none] 754 * Since 3.0 755 */ 756 public void getPreferredHeight(CellAreaContext context, Widget widget, out int minimumHeight, out int naturalHeight) 757 { 758 // void gtk_cell_area_get_preferred_height (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, gint *minimum_height, gint *natural_height); 759 gtk_cell_area_get_preferred_height(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), &minimumHeight, &naturalHeight); 760 } 761 762 /** 763 * Retrieves a cell area's minimum and natural width if it would be given 764 * the specified height. 765 * area stores some geometrical information in context along the way 766 * while calling gtk_cell_area_get_preferred_height(). It's important to 767 * perform a series of gtk_cell_area_get_preferred_height() requests with 768 * context first and then call gtk_cell_area_get_preferred_width_for_height() 769 * on each cell area individually to get the height for width of each 770 * fully requested row. 771 * If at some point, the height of a single row changes, it should be 772 * requested with gtk_cell_area_get_preferred_height() again and then 773 * the full height of the requested rows checked again with 774 * gtk_cell_area_context_get_preferred_height(). 775 * Params: 776 * context = the GtkCellAreaContext which has already been requested for widths. 777 * widget = the GtkWidget where area will be rendering 778 * height = the height for which to check the width of this area 779 * minimumWidth = location to store the minimum width, or NULL. [out][allow-none] 780 * naturalWidth = location to store the natural width, or NULL. [out][allow-none] 781 * Since 3.0 782 */ 783 public void getPreferredWidthForHeight(CellAreaContext context, Widget widget, int height, out int minimumWidth, out int naturalWidth) 784 { 785 // void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, gint height, gint *minimum_width, gint *natural_width); 786 gtk_cell_area_get_preferred_width_for_height(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), height, &minimumWidth, &naturalWidth); 787 } 788 789 /** 790 * Gets the current GtkTreePath string for the currently 791 * applied GtkTreeIter, this is implicitly updated when 792 * gtk_cell_area_apply_attributes() is called and can be 793 * used to interact with renderers from GtkCellArea 794 * subclasses. 795 * Returns: The current GtkTreePath string for the current attributes applied to area. This string belongs to the area and should not be freed. Since 3.0 796 */ 797 public string getCurrentPathString() 798 { 799 // const gchar * gtk_cell_area_get_current_path_string (GtkCellArea *area); 800 return Str.toString(gtk_cell_area_get_current_path_string(gtkCellArea)); 801 } 802 803 /** 804 * Applies any connected attributes to the renderers in 805 * area by pulling the values from tree_model. 806 * Params: 807 * treeModel = the GtkTreeModel to pull values from 808 * iter = the GtkTreeIter in tree_model to apply values for 809 * isExpander = whether iter has children 810 * isExpanded = whether iter is expanded in the view and 811 * children are visible 812 * Since 3.0 813 */ 814 public void applyAttributes(TreeModelIF treeModel, TreeIter iter, int isExpander, int isExpanded) 815 { 816 // void gtk_cell_area_apply_attributes (GtkCellArea *area, GtkTreeModel *tree_model, GtkTreeIter *iter, gboolean is_expander, gboolean is_expanded); 817 gtk_cell_area_apply_attributes(gtkCellArea, (treeModel is null) ? null : treeModel.getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct(), isExpander, isExpanded); 818 } 819 820 /** 821 * Connects an attribute to apply values from column for the 822 * GtkTreeModel in use. 823 * Params: 824 * renderer = the GtkCellRenderer to connect an attribute for 825 * attribute = the attribute name 826 * column = the GtkTreeModel column to fetch attribute values from 827 * Since 3.0 828 */ 829 public void attributeConnect(CellRenderer renderer, string attribute, int column) 830 { 831 // void gtk_cell_area_attribute_connect (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *attribute, gint column); 832 gtk_cell_area_attribute_connect(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), Str.toStringz(attribute), column); 833 } 834 835 /** 836 * Disconnects attribute for the renderer in area so that 837 * attribute will no longer be updated with values from the 838 * model. 839 * Params: 840 * renderer = the GtkCellRenderer to disconnect an attribute for 841 * attribute = the attribute name 842 * Since 3.0 843 */ 844 public void attributeDisconnect(CellRenderer renderer, string attribute) 845 { 846 // void gtk_cell_area_attribute_disconnect (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *attribute); 847 gtk_cell_area_attribute_disconnect(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), Str.toStringz(attribute)); 848 } 849 850 /** 851 * Installs a cell property on a cell area class. 852 * Params: 853 * aclass = a GtkCellAreaClass 854 * propertyId = the id for the property 855 * pspec = the GParamSpec for the property 856 * Since 3.0 857 */ 858 public static void classInstallCellProperty(GtkCellAreaClass* aclass, uint propertyId, ParamSpec pspec) 859 { 860 // void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass, guint property_id, GParamSpec *pspec); 861 gtk_cell_area_class_install_cell_property(aclass, propertyId, (pspec is null) ? null : pspec.getParamSpecStruct()); 862 } 863 864 /** 865 * Finds a cell property of a cell area class by name. 866 * Params: 867 * aclass = a GtkCellAreaClass 868 * propertyName = the name of the child property to find 869 * Returns: the GParamSpec of the child property or NULL if aclass has no child property with that name. [transfer none] Since 3.0 870 */ 871 public static ParamSpec classFindCellProperty(GtkCellAreaClass* aclass, string propertyName) 872 { 873 // GParamSpec * gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass, const gchar *property_name); 874 auto p = gtk_cell_area_class_find_cell_property(aclass, Str.toStringz(propertyName)); 875 876 if(p is null) 877 { 878 return null; 879 } 880 881 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 882 } 883 884 /** 885 * Returns all cell properties of a cell area class. 886 * Params: 887 * aclass = a GtkCellAreaClass 888 * Returns: a newly allocated NULL-terminated array of GParamSpec*. The array must be freed with g_free(). [array length=n_properties][transfer container] Since 3.0 889 */ 890 public static ParamSpec[] classListCellProperties(GtkCellAreaClass* aclass) 891 { 892 // GParamSpec ** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass, guint *n_properties); 893 uint nProperties; 894 auto p = gtk_cell_area_class_list_cell_properties(aclass, &nProperties); 895 896 if(p is null) 897 { 898 return null; 899 } 900 901 ParamSpec[] arr = new ParamSpec[nProperties]; 902 for(int i = 0; i < nProperties; i++) 903 { 904 arr[i] = ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p[i]); 905 } 906 907 return arr; 908 } 909 910 /** 911 * Sets one or more cell properties for renderer in area. 912 * Params: 913 * renderer = a GtkCellRenderer which inside area 914 * firstPropertyName = the name of the first cell property to set 915 * varArgs = a NULL-terminated list of property names and values, starting 916 * with first_prop_name 917 * Since 3.0 918 */ 919 public void cellSetValist(CellRenderer renderer, string firstPropertyName, void* varArgs) 920 { 921 // void gtk_cell_area_cell_set_valist (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *first_property_name, va_list var_args); 922 gtk_cell_area_cell_set_valist(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), Str.toStringz(firstPropertyName), varArgs); 923 } 924 925 /** 926 * Gets the values of one or more cell properties for renderer in area. 927 * Params: 928 * renderer = a GtkCellRenderer inside area 929 * firstPropertyName = the name of the first property to get 930 * varArgs = return location for the first property, followed 931 * optionally by more name/return location pairs, followed by NULL 932 * Since 3.0 933 */ 934 public void cellGetValist(CellRenderer renderer, string firstPropertyName, void* varArgs) 935 { 936 // void gtk_cell_area_cell_get_valist (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *first_property_name, va_list var_args); 937 gtk_cell_area_cell_get_valist(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), Str.toStringz(firstPropertyName), varArgs); 938 } 939 940 /** 941 * Sets a cell property for renderer in area. 942 * Params: 943 * renderer = a GtkCellRenderer inside area 944 * propertyName = the name of the cell property to set 945 * value = the value to set the cell property to 946 * Since 3.0 947 */ 948 public void cellSetProperty(CellRenderer renderer, string propertyName, Value value) 949 { 950 // void gtk_cell_area_cell_set_property (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *property_name, const GValue *value); 951 gtk_cell_area_cell_set_property(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 952 } 953 954 /** 955 * Gets the value of a cell property for renderer in area. 956 * Params: 957 * renderer = a GtkCellRenderer inside area 958 * propertyName = the name of the property to get 959 * value = a location to return the value 960 * Since 3.0 961 */ 962 public void cellGetProperty(CellRenderer renderer, string propertyName, Value value) 963 { 964 // void gtk_cell_area_cell_get_property (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *property_name, GValue *value); 965 gtk_cell_area_cell_get_property(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 966 } 967 968 /** 969 * Returns whether the area can do anything when activated, 970 * after applying new attributes to area. 971 * Returns: whether area can do anything when activated. Since 3.0 972 */ 973 public int isActivatable() 974 { 975 // gboolean gtk_cell_area_is_activatable (GtkCellArea *area); 976 return gtk_cell_area_is_activatable(gtkCellArea); 977 } 978 979 /** 980 * Activates area, usually by activating the currently focused 981 * cell, however some subclasses which embed widgets in the area 982 * can also activate a widget if it currently has the focus. 983 * Params: 984 * context = the GtkCellAreaContext in context with the current row data 985 * widget = the GtkWidget that area is rendering on 986 * cellArea = the size and location of area relative to widget's allocation 987 * flags = the GtkCellRendererState flags for area for this row of data. 988 * editOnly = if TRUE then only cell renderers that are GTK_CELL_RENDERER_MODE_EDITABLE 989 * will be activated. 990 * Returns: Whether area was successfully activated. Since 3.0 991 */ 992 public int activate(CellAreaContext context, Widget widget, ref Rectangle cellArea, GtkCellRendererState flags, int editOnly) 993 { 994 // gboolean gtk_cell_area_activate (GtkCellArea *area, GtkCellAreaContext *context, GtkWidget *widget, const GdkRectangle *cell_area, GtkCellRendererState flags, gboolean edit_only); 995 return gtk_cell_area_activate(gtkCellArea, (context is null) ? null : context.getCellAreaContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), &cellArea, flags, editOnly); 996 } 997 998 /** 999 * This should be called by the area's owning layout widget 1000 * when focus is to be passed to area, or moved within area 1001 * for a given direction and row data. 1002 * Implementing GtkCellArea classes should implement this 1003 * method to receive and navigate focus in its own way particular 1004 * to how it lays out cells. 1005 * Params: 1006 * direction = the GtkDirectionType 1007 * Returns: TRUE if focus remains inside area as a result of this call. Since 3.0 1008 */ 1009 public int focus(GtkDirectionType direction) 1010 { 1011 // gboolean gtk_cell_area_focus (GtkCellArea *area, GtkDirectionType direction); 1012 return gtk_cell_area_focus(gtkCellArea, direction); 1013 } 1014 1015 /** 1016 * Explicitly sets the currently focused cell to renderer. 1017 * This is generally called by implementations of 1018 * GtkCellAreaClass.focus() or GtkCellAreaClass.event(), 1019 * however it can also be used to implement functions such 1020 * as gtk_tree_view_set_cursor_on_cell(). 1021 * Params: 1022 * renderer = the GtkCellRenderer to give focus to 1023 * Since 3.0 1024 */ 1025 public void setFocusCell(CellRenderer renderer) 1026 { 1027 // void gtk_cell_area_set_focus_cell (GtkCellArea *area, GtkCellRenderer *renderer); 1028 gtk_cell_area_set_focus_cell(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct()); 1029 } 1030 1031 /** 1032 * Retrieves the currently focused cell for area 1033 * Returns: the currently focused cell in area. [transfer none] Since 3.0 1034 */ 1035 public CellRenderer getFocusCell() 1036 { 1037 // GtkCellRenderer * gtk_cell_area_get_focus_cell (GtkCellArea *area); 1038 auto p = gtk_cell_area_get_focus_cell(gtkCellArea); 1039 1040 if(p is null) 1041 { 1042 return null; 1043 } 1044 1045 return ObjectG.getDObject!(CellRenderer)(cast(GtkCellRenderer*) p); 1046 } 1047 1048 /** 1049 * Adds sibling to renderer's focusable area, focus will be drawn 1050 * around renderer and all of its siblings if renderer can 1051 * focus for a given row. 1052 * Events handled by focus siblings can also activate the given 1053 * focusable renderer. 1054 * Params: 1055 * renderer = the GtkCellRenderer expected to have focus 1056 * sibling = the GtkCellRenderer to add to renderer's focus area 1057 * Since 3.0 1058 */ 1059 public void addFocusSibling(CellRenderer renderer, CellRenderer sibling) 1060 { 1061 // void gtk_cell_area_add_focus_sibling (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellRenderer *sibling); 1062 gtk_cell_area_add_focus_sibling(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), (sibling is null) ? null : sibling.getCellRendererStruct()); 1063 } 1064 1065 /** 1066 * Removes sibling from renderer's focus sibling list 1067 * (see gtk_cell_area_add_focus_sibling()). 1068 * Params: 1069 * renderer = the GtkCellRenderer expected to have focus 1070 * sibling = the GtkCellRenderer to remove from renderer's focus area 1071 * Since 3.0 1072 */ 1073 public void removeFocusSibling(CellRenderer renderer, CellRenderer sibling) 1074 { 1075 // void gtk_cell_area_remove_focus_sibling (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellRenderer *sibling); 1076 gtk_cell_area_remove_focus_sibling(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), (sibling is null) ? null : sibling.getCellRendererStruct()); 1077 } 1078 1079 /** 1080 * Returns whether sibling is one of renderer's focus siblings 1081 * (see gtk_cell_area_add_focus_sibling()). 1082 * Params: 1083 * renderer = the GtkCellRenderer expected to have focus 1084 * sibling = the GtkCellRenderer to check against renderer's sibling list 1085 * Returns: TRUE if sibling is a focus sibling of renderer Since 3.0 1086 */ 1087 public int isFocusSibling(CellRenderer renderer, CellRenderer sibling) 1088 { 1089 // gboolean gtk_cell_area_is_focus_sibling (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellRenderer *sibling); 1090 return gtk_cell_area_is_focus_sibling(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), (sibling is null) ? null : sibling.getCellRendererStruct()); 1091 } 1092 1093 /** 1094 * Gets the focus sibling cell renderers for renderer. 1095 * Params: 1096 * renderer = the GtkCellRenderer expected to have focus 1097 * Returns: A GList of GtkCellRenderers. The returned list is internal and should not be freed. [element-type GtkCellRenderer][transfer none] Since 3.0 1098 */ 1099 public ListG getFocusSiblings(CellRenderer renderer) 1100 { 1101 // const GList * gtk_cell_area_get_focus_siblings (GtkCellArea *area, GtkCellRenderer *renderer); 1102 auto p = gtk_cell_area_get_focus_siblings(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct()); 1103 1104 if(p is null) 1105 { 1106 return null; 1107 } 1108 1109 return ObjectG.getDObject!(ListG)(cast(GList*) p); 1110 } 1111 1112 /** 1113 * Gets the GtkCellRenderer which is expected to be focusable 1114 * for which renderer is, or may be a sibling. 1115 * This is handy for GtkCellArea subclasses when handling events, 1116 * after determining the renderer at the event location it can 1117 * then chose to activate the focus cell for which the event 1118 * cell may have been a sibling. 1119 * Params: 1120 * renderer = the GtkCellRenderer 1121 * Returns: the GtkCellRenderer for which renderer is a sibling, or NULL. [transfer none] Since 3.0 1122 */ 1123 public CellRenderer getFocusFromSibling(CellRenderer renderer) 1124 { 1125 // GtkCellRenderer * gtk_cell_area_get_focus_from_sibling (GtkCellArea *area, GtkCellRenderer *renderer); 1126 auto p = gtk_cell_area_get_focus_from_sibling(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct()); 1127 1128 if(p is null) 1129 { 1130 return null; 1131 } 1132 1133 return ObjectG.getDObject!(CellRenderer)(cast(GtkCellRenderer*) p); 1134 } 1135 1136 /** 1137 * Gets the GtkCellRenderer in area that is currently 1138 * being edited. 1139 * Returns: The currently edited GtkCellRenderer. [transfer none] Since 3.0 1140 */ 1141 public CellRenderer getEditedCell() 1142 { 1143 // GtkCellRenderer * gtk_cell_area_get_edited_cell (GtkCellArea *area); 1144 auto p = gtk_cell_area_get_edited_cell(gtkCellArea); 1145 1146 if(p is null) 1147 { 1148 return null; 1149 } 1150 1151 return ObjectG.getDObject!(CellRenderer)(cast(GtkCellRenderer*) p); 1152 } 1153 1154 /** 1155 * Gets the GtkCellEditable widget currently used 1156 * to edit the currently edited cell. 1157 * Returns: The currently active GtkCellEditable widget. [transfer none] Since 3.0 1158 */ 1159 public CellEditableIF getEditWidget() 1160 { 1161 // GtkCellEditable * gtk_cell_area_get_edit_widget (GtkCellArea *area); 1162 auto p = gtk_cell_area_get_edit_widget(gtkCellArea); 1163 1164 if(p is null) 1165 { 1166 return null; 1167 } 1168 1169 return ObjectG.getDObject!(CellEditable, CellEditableIF)(cast(GtkCellEditable*) p); 1170 } 1171 1172 /** 1173 * This is used by GtkCellArea subclasses when handling events 1174 * to activate cells, the base GtkCellArea class activates cells 1175 * for keyboard events for free in its own GtkCellArea->activate() 1176 * implementation. 1177 * Params: 1178 * widget = the GtkWidget that area is rendering onto 1179 * renderer = the GtkCellRenderer in area to activate 1180 * event = the GdkEvent for which cell activation should occur 1181 * cellArea = the GdkRectangle in widget relative coordinates 1182 * of renderer for the current row. 1183 * flags = the GtkCellRendererState for renderer 1184 * Returns: whether cell activation was successful Since 3.0 1185 */ 1186 public int activateCell(Widget widget, CellRenderer renderer, Event event, ref Rectangle cellArea, GtkCellRendererState flags) 1187 { 1188 // gboolean gtk_cell_area_activate_cell (GtkCellArea *area, GtkWidget *widget, GtkCellRenderer *renderer, GdkEvent *event, const GdkRectangle *cell_area, GtkCellRendererState flags); 1189 return gtk_cell_area_activate_cell(gtkCellArea, (widget is null) ? null : widget.getWidgetStruct(), (renderer is null) ? null : renderer.getCellRendererStruct(), (event is null) ? null : event.getEventStruct(), &cellArea, flags); 1190 } 1191 1192 /** 1193 * Explicitly stops the editing of the currently edited cell. 1194 * If canceled is TRUE, the currently edited cell renderer 1195 * will emit the ::editing-canceled signal, otherwise the 1196 * the ::editing-done signal will be emitted on the current 1197 * edit widget. 1198 * See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget(). 1199 * Params: 1200 * canceled = whether editing was canceled. 1201 * Since 3.0 1202 */ 1203 public void stopEditing(int canceled) 1204 { 1205 // void gtk_cell_area_stop_editing (GtkCellArea *area, gboolean canceled); 1206 gtk_cell_area_stop_editing(gtkCellArea, canceled); 1207 } 1208 1209 /** 1210 * This is a convenience function for GtkCellArea implementations 1211 * to get the inner area where a given GtkCellRenderer will be 1212 * rendered. It removes any padding previously added by gtk_cell_area_request_renderer(). 1213 * Params: 1214 * widget = the GtkWidget that area is rendering onto 1215 * cellArea = the widget relative coordinates where one of area's cells 1216 * is to be placed 1217 * innerArea = the return location for the inner cell area. [out] 1218 * Since 3.0 1219 */ 1220 public void innerCellArea(Widget widget, ref Rectangle cellArea, out Rectangle innerArea) 1221 { 1222 // void gtk_cell_area_inner_cell_area (GtkCellArea *area, GtkWidget *widget, const GdkRectangle *cell_area, GdkRectangle *inner_area); 1223 gtk_cell_area_inner_cell_area(gtkCellArea, (widget is null) ? null : widget.getWidgetStruct(), &cellArea, &innerArea); 1224 } 1225 1226 /** 1227 * This is a convenience function for GtkCellArea implementations 1228 * to request size for cell renderers. It's important to use this 1229 * function to request size and then use gtk_cell_area_inner_cell_area() 1230 * at render and event time since this function will add padding 1231 * around the cell for focus painting. 1232 * Params: 1233 * renderer = the GtkCellRenderer to request size for 1234 * orientation = the GtkOrientation in which to request size 1235 * widget = the GtkWidget that area is rendering onto 1236 * forSize = the allocation contextual size to request for, or -1 if 1237 * the base request for the orientation is to be returned. 1238 * minimumSize = location to store the minimum size, or NULL. [out][allow-none] 1239 * naturalSize = location to store the natural size, or NULL. [out][allow-none] 1240 * Since 3.0 1241 */ 1242 public void requestRenderer(CellRenderer renderer, GtkOrientation orientation, Widget widget, int forSize, out int minimumSize, out int naturalSize) 1243 { 1244 // void gtk_cell_area_request_renderer (GtkCellArea *area, GtkCellRenderer *renderer, GtkOrientation orientation, GtkWidget *widget, gint for_size, gint *minimum_size, gint *natural_size); 1245 gtk_cell_area_request_renderer(gtkCellArea, (renderer is null) ? null : renderer.getCellRendererStruct(), orientation, (widget is null) ? null : widget.getWidgetStruct(), forSize, &minimumSize, &naturalSize); 1246 } 1247 }