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