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 = GtkComboBox.html 27 * outPack = gtk 28 * outFile = ComboBox 29 * strct = GtkComboBox 30 * realStrct= 31 * ctorStrct= 32 * clss = ComboBox 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - CellLayoutIF 40 * - CellEditableIF 41 * prefixes: 42 * - gtk_combo_box_ 43 * - gtk_ 44 * omit structs: 45 * omit prefixes: 46 * omit code: 47 * - gtk_combo_box_new 48 * - gtk_combo_box_new_text 49 * - gtk_combo_box_new_with_entry 50 * omit signals: 51 * imports: 52 * - atk.ObjectAtk 53 * - glib.Str 54 * - gtk.TreeModel 55 * - gtk.TreeModelIF 56 * - gtk.TreeIter 57 * - gtk.CellLayoutIF 58 * - gtk.CellLayoutT 59 * - gtk.CellEditableT 60 * - gtk.CellEditableIF 61 * structWrap: 62 * - AtkObject* -> ObjectAtk 63 * - GtkTreeIter* -> TreeIter 64 * - GtkTreeModel* -> TreeModelIF 65 * module aliases: 66 * local aliases: 67 * overrides: 68 */ 69 70 module gtk.ComboBox; 71 72 public import gtkc.gtktypes; 73 74 private import gtkc.gtk; 75 private import glib.ConstructionException; 76 private import gobject.ObjectG; 77 78 private import gobject.Signals; 79 public import gtkc.gdktypes; 80 81 private import atk.ObjectAtk; 82 private import glib.Str; 83 private import gtk.TreeModel; 84 private import gtk.TreeModelIF; 85 private import gtk.TreeIter; 86 private import gtk.CellLayoutIF; 87 private import gtk.CellLayoutT; 88 private import gtk.CellEditableT; 89 private import gtk.CellEditableIF; 90 91 92 93 private import gtk.Bin; 94 95 /** 96 * Description 97 * A GtkComboBox is a widget that allows the user to choose from a list of 98 * valid choices. The GtkComboBox displays the selected choice. When 99 * activated, the GtkComboBox displays a popup which allows the user to 100 * make a new choice. The style in which the selected value is displayed, 101 * and the style of the popup is determined by the current theme. It may 102 * be similar to a Windows-style combo box. 103 * The GtkComboBox uses the model-view pattern; the list of valid choices 104 * is specified in the form of a tree model, and the display of the choices 105 * can be adapted to the data in the model by using cell renderers, as you 106 * would in a tree view. This is possible since GtkComboBox implements the 107 * GtkCellLayout interface. The tree model holding the valid choices is 108 * not restricted to a flat list, it can be a real tree, and the popup will 109 * reflect the tree structure. 110 * To allow the user to enter values not in the model, the 'has-entry' 111 * property allows the GtkComboBox to contain a GtkEntry. This entry 112 * can be accessed by calling gtk_bin_get_child() on the combo box. 113 * For a simple list of textual choices, the model-view API of GtkComboBox 114 * can be a bit overwhelming. In this case, GtkComboBoxText offers a 115 * simple alternative. Both GtkComboBox and GtkComboBoxText can contain 116 * an entry. 117 * A GtkComboBox is a widget that allows the user to choose from a 118 * list of valid choices. The GtkComboBox displays the selected 119 * choice. When activated, the GtkComboBox displays a popup 120 * which allows the user to make a new choice. The style in which 121 * the selected value is displayed, and the style of the popup is 122 * determined by the current theme. It may be similar to a GtkOptionMenu, 123 * or similar to a Windows-style combo box. 124 * Unlike its predecessors GtkCombo and GtkOptionMenu, the GtkComboBox 125 * uses the model-view pattern; the list of valid choices is specified in the 126 * form of a tree model, and the display of the choices can be adapted to 127 * the data in the model by using cell renderers, as you would in a tree view. 128 * This is possible since GtkComboBox implements the GtkCellLayout interface. 129 * The tree model holding the valid choices is not restricted to a flat list, 130 * it can be a real tree, and the popup will reflect the tree structure. 131 * In addition to the model-view API, GtkComboBox offers a simple API which 132 * is suitable for text-only combo boxes, and hides the complexity of managing 133 * the data in a model. It consists of the functions gtk_combo_box_new_text(), 134 * gtk_combo_box_append_text(), gtk_combo_box_insert_text(), 135 * gtk_combo_box_prepend_text(), gtk_combo_box_remove_text() and 136 * gtk_combo_box_get_active_text(). 137 */ 138 public class ComboBox : Bin, CellLayoutIF, CellEditableIF 139 { 140 141 /** the main Gtk struct */ 142 protected GtkComboBox* gtkComboBox; 143 144 145 public GtkComboBox* getComboBoxStruct() 146 { 147 return gtkComboBox; 148 } 149 150 151 /** the main Gtk struct as a void* */ 152 protected override void* getStruct() 153 { 154 return cast(void*)gtkComboBox; 155 } 156 157 /** 158 * Sets our main struct and passes it to the parent class 159 */ 160 public this (GtkComboBox* gtkComboBox) 161 { 162 super(cast(GtkBin*)gtkComboBox); 163 this.gtkComboBox = gtkComboBox; 164 } 165 166 protected override void setStruct(GObject* obj) 167 { 168 super.setStruct(obj); 169 gtkComboBox = cast(GtkComboBox*)obj; 170 } 171 172 private int count = 0; 173 public int maxCount = 0; 174 175 176 // add the CellLayout capabilities 177 mixin CellLayoutT!(GtkComboBox); 178 179 // add the CellEditable capabilities 180 mixin CellEditableT!(GtkComboBox); 181 182 /** 183 * Creates a new empty GtkComboBox. 184 * If text is true then 185 * constructs a new text combo box, which is a 186 * GtkComboBox just displaying strings. If you use this function to create 187 * a text combo box, you should only manipulate its data source with the 188 * following convenience functions: gtk_combo_box_append_text(), 189 * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and 190 * gtk_combo_box_remove_text(). 191 * Since 2.4 192 * Returns: 193 * A new GtkComboBox. 194 * Throws: ConstructionException GTK+ fails to create the object. 195 */ 196 public this (bool text=true) 197 { 198 GtkComboBox* p; 199 if ( text ) 200 { 201 // GtkWidget* gtk_combo_box_new_text (void); 202 p = cast(GtkComboBox*)gtk_combo_box_new_text(); 203 } 204 else 205 { 206 // GtkWidget* gtk_combo_box_new (void); 207 p = cast(GtkComboBox*)gtk_combo_box_new(); 208 } 209 210 if(p is null) 211 { 212 throw new ConstructionException("null returned by gtk_combo_box_new"); 213 } 214 215 this(p); 216 } 217 218 /** */ 219 public void setActiveText(string text, bool insert=false) 220 { 221 int active = 0; 222 setActive(0); 223 while ( getActive >= 0 ) // returns -1 if end of list if reached 224 { 225 if( text == getActiveText() ) return; 226 ++active; 227 setActive(active); 228 } 229 // was not found, the combo has now nothing selected 230 if ( insert ) 231 { 232 appendText(text); 233 setActive(active); 234 } 235 } 236 237 /** */ 238 int getIndex(string text) 239 { 240 TreeIter iter = new TreeIter(); 241 TreeModelIF model = getModel(); 242 iter.setModel(model); 243 int index = 0; 244 bool found = false; 245 bool end = false; 246 if ( model.getIterFirst(iter) ) 247 { 248 while ( !end && iter !is null && !found ) 249 { 250 found = iter.getValueString(0) == text; 251 if ( !found ) 252 { 253 end = !model.iterNext(iter); 254 ++index; 255 } 256 } 257 } 258 else 259 { 260 end = true; 261 } 262 return end ? -1 : index; 263 } 264 265 /** */ 266 void prependOrReplaceText(string text) 267 { 268 int index = getIndex(text); 269 if ( index > 0 ) 270 { 271 removeText(index); 272 prependText(text); 273 } 274 else if ( index == -1 ) 275 { 276 prependText(text); 277 } 278 } 279 280 281 /** 282 */ 283 int[string] connectedSignals; 284 285 void delegate(ComboBox)[] onChangedListeners; 286 /** 287 * The changed signal is emitted when the active 288 * item is changed. The can be due to the user selecting 289 * a different item from the list, or due to a 290 * call to gtk_combo_box_set_active_iter(). 291 * It will also be emitted while typing into a GtkComboBoxEntry, 292 * as well as when selecting an item from the GtkComboBoxEntry's list. 293 * Since 2.4 294 */ 295 void addOnChanged(void delegate(ComboBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 296 { 297 if ( !("changed" in connectedSignals) ) 298 { 299 Signals.connectData( 300 getStruct(), 301 "changed", 302 cast(GCallback)&callBackChanged, 303 cast(void*)this, 304 null, 305 connectFlags); 306 connectedSignals["changed"] = 1; 307 } 308 onChangedListeners ~= dlg; 309 } 310 extern(C) static void callBackChanged(GtkComboBox* widgetStruct, ComboBox _comboBox) 311 { 312 foreach ( void delegate(ComboBox) dlg ; _comboBox.onChangedListeners ) 313 { 314 dlg(_comboBox); 315 } 316 } 317 318 void delegate(GtkScrollType, ComboBox)[] onMoveActiveListeners; 319 /** 320 * The ::move-active signal is a 321 * keybinding signal 322 * which gets emitted to move the active selection. 323 * Since 2.12 324 */ 325 void addOnMoveActive(void delegate(GtkScrollType, ComboBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 326 { 327 if ( !("move-active" in connectedSignals) ) 328 { 329 Signals.connectData( 330 getStruct(), 331 "move-active", 332 cast(GCallback)&callBackMoveActive, 333 cast(void*)this, 334 null, 335 connectFlags); 336 connectedSignals["move-active"] = 1; 337 } 338 onMoveActiveListeners ~= dlg; 339 } 340 extern(C) static void callBackMoveActive(GtkComboBox* widgetStruct, GtkScrollType scrollType, ComboBox _comboBox) 341 { 342 foreach ( void delegate(GtkScrollType, ComboBox) dlg ; _comboBox.onMoveActiveListeners ) 343 { 344 dlg(scrollType, _comboBox); 345 } 346 } 347 348 bool delegate(ComboBox)[] onPopdownListeners; 349 /** 350 * The ::popdown signal is a 351 * keybinding signal 352 * which gets emitted to popdown the combo box list. 353 * The default bindings for this signal are Alt+Up and Escape. 354 * Since 2.12 355 */ 356 void addOnPopdown(bool delegate(ComboBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 357 { 358 if ( !("popdown" in connectedSignals) ) 359 { 360 Signals.connectData( 361 getStruct(), 362 "popdown", 363 cast(GCallback)&callBackPopdown, 364 cast(void*)this, 365 null, 366 connectFlags); 367 connectedSignals["popdown"] = 1; 368 } 369 onPopdownListeners ~= dlg; 370 } 371 extern(C) static gboolean callBackPopdown(GtkComboBox* buttonStruct, ComboBox _comboBox) 372 { 373 foreach ( bool delegate(ComboBox) dlg ; _comboBox.onPopdownListeners ) 374 { 375 if ( dlg(_comboBox) ) 376 { 377 return 1; 378 } 379 } 380 381 return 0; 382 } 383 384 void delegate(ComboBox)[] onPopupListeners; 385 /** 386 * The ::popup signal is a 387 * keybinding signal 388 * which gets emitted to popup the combo box list. 389 * The default binding for this signal is Alt+Down. 390 * Since 2.12 391 * See Also 392 * GtkComboBoxText, GtkTreeModel, GtkCellRenderer 393 */ 394 void addOnPopup(void delegate(ComboBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 395 { 396 if ( !("popup" in connectedSignals) ) 397 { 398 Signals.connectData( 399 getStruct(), 400 "popup", 401 cast(GCallback)&callBackPopup, 402 cast(void*)this, 403 null, 404 connectFlags); 405 connectedSignals["popup"] = 1; 406 } 407 onPopupListeners ~= dlg; 408 } 409 extern(C) static void callBackPopup(GtkComboBox* widgetStruct, ComboBox _comboBox) 410 { 411 foreach ( void delegate(ComboBox) dlg ; _comboBox.onPopupListeners ) 412 { 413 dlg(_comboBox); 414 } 415 } 416 417 418 /** 419 * Creates a new GtkComboBox with the model initialized to model. 420 * Since 2.4 421 * Params: 422 * model = A GtkTreeModel. 423 * Throws: ConstructionException GTK+ fails to create the object. 424 */ 425 public this (TreeModelIF model) 426 { 427 // GtkWidget * gtk_combo_box_new_with_model (GtkTreeModel *model); 428 auto p = gtk_combo_box_new_with_model((model is null) ? null : model.getTreeModelTStruct()); 429 if(p is null) 430 { 431 throw new ConstructionException("null returned by gtk_combo_box_new_with_model((model is null) ? null : model.getTreeModelTStruct())"); 432 } 433 this(cast(GtkComboBox*) p); 434 } 435 436 /** 437 * Returns the wrap width which is used to determine the number of columns 438 * for the popup menu. If the wrap width is larger than 1, the combo box 439 * is in table mode. 440 * Since 2.6 441 * Returns: the wrap width. 442 */ 443 public int getWrapWidth() 444 { 445 // gint gtk_combo_box_get_wrap_width (GtkComboBox *combo_box); 446 return gtk_combo_box_get_wrap_width(gtkComboBox); 447 } 448 449 /** 450 * Sets the wrap width of combo_box to be width. The wrap width is basically 451 * the preferred number of columns when you want the popup to be layed out 452 * in a table. 453 * Since 2.4 454 * Params: 455 * width = Preferred number of columns 456 */ 457 public void setWrapWidth(int width) 458 { 459 // void gtk_combo_box_set_wrap_width (GtkComboBox *combo_box, gint width); 460 gtk_combo_box_set_wrap_width(gtkComboBox, width); 461 } 462 463 /** 464 * Returns the column with row span information for combo_box. 465 * Since 2.6 466 * Returns: the row span column. 467 */ 468 public int getRowSpanColumn() 469 { 470 // gint gtk_combo_box_get_row_span_column (GtkComboBox *combo_box); 471 return gtk_combo_box_get_row_span_column(gtkComboBox); 472 } 473 474 /** 475 * Sets the column with row span information for combo_box to be row_span. 476 * The row span column contains integers which indicate how many rows 477 * an item should span. 478 * Since 2.4 479 * Params: 480 * rowSpan = A column in the model passed during construction. 481 */ 482 public void setRowSpanColumn(int rowSpan) 483 { 484 // void gtk_combo_box_set_row_span_column (GtkComboBox *combo_box, gint row_span); 485 gtk_combo_box_set_row_span_column(gtkComboBox, rowSpan); 486 } 487 488 /** 489 * Returns the column with column span information for combo_box. 490 * Since 2.6 491 * Returns: the column span column. 492 */ 493 public int getColumnSpanColumn() 494 { 495 // gint gtk_combo_box_get_column_span_column (GtkComboBox *combo_box); 496 return gtk_combo_box_get_column_span_column(gtkComboBox); 497 } 498 499 /** 500 * Sets the column with column span information for combo_box to be 501 * column_span. The column span column contains integers which indicate 502 * how many columns an item should span. 503 * Since 2.4 504 * Params: 505 * columnSpan = A column in the model passed during construction 506 */ 507 public void setColumnSpanColumn(int columnSpan) 508 { 509 // void gtk_combo_box_set_column_span_column (GtkComboBox *combo_box, gint column_span); 510 gtk_combo_box_set_column_span_column(gtkComboBox, columnSpan); 511 } 512 513 /** 514 * Returns the index of the currently active item, or -1 if there's no 515 * active item. If the model is a non-flat treemodel, and the active item 516 * is not an immediate child of the root of the tree, this function returns 517 * gtk_tree_path_get_indices (path)[0], where 518 * path is the GtkTreePath of the active item. 519 * Since 2.4 520 * Returns: An integer which is the index of the currently active item, or -1 if there's no active item. 521 */ 522 public int getActive() 523 { 524 // gint gtk_combo_box_get_active (GtkComboBox *combo_box); 525 return gtk_combo_box_get_active(gtkComboBox); 526 } 527 528 /** 529 * Sets the active item of combo_box to be the item at index. 530 * Since 2.4 531 * Params: 532 * index = An index in the model passed during construction, or -1 to have 533 * no active item 534 */ 535 public void setActive(int index) 536 { 537 // void gtk_combo_box_set_active (GtkComboBox *combo_box, gint index_); 538 gtk_combo_box_set_active(gtkComboBox, index); 539 } 540 541 /** 542 * Sets iter to point to the current active item, if it exists. 543 * Since 2.4 544 * Params: 545 * iter = The uninitialized GtkTreeIter. [out] 546 * Returns: TRUE, if iter was set 547 */ 548 public int getActiveIter(TreeIter iter) 549 { 550 // gboolean gtk_combo_box_get_active_iter (GtkComboBox *combo_box, GtkTreeIter *iter); 551 return gtk_combo_box_get_active_iter(gtkComboBox, (iter is null) ? null : iter.getTreeIterStruct()); 552 } 553 554 /** 555 * Sets the current active item to be the one referenced by iter, or 556 * unsets the active item if iter is NULL. 557 * Since 2.4 558 * Params: 559 * iter = The GtkTreeIter, or NULL. [allow-none] 560 */ 561 public void setActiveIter(TreeIter iter) 562 { 563 // void gtk_combo_box_set_active_iter (GtkComboBox *combo_box, GtkTreeIter *iter); 564 gtk_combo_box_set_active_iter(gtkComboBox, (iter is null) ? null : iter.getTreeIterStruct()); 565 } 566 567 /** 568 * Returns the GtkTreeModel which is acting as data source for combo_box. 569 * Since 2.4 570 * Returns: A GtkTreeModel which was passed during construction. [transfer none] 571 */ 572 public TreeModelIF getModel() 573 { 574 // GtkTreeModel * gtk_combo_box_get_model (GtkComboBox *combo_box); 575 auto p = gtk_combo_box_get_model(gtkComboBox); 576 577 if(p is null) 578 { 579 return null; 580 } 581 582 return ObjectG.getDObject!(TreeModel, TreeModelIF)(cast(GtkTreeModel*) p); 583 } 584 585 /** 586 * Sets the model used by combo_box to be model. Will unset a previously set 587 * model (if applicable). If model is NULL, then it will unset the model. 588 * Note that this function does not clear the cell renderers, you have to 589 * call gtk_cell_layout_clear() yourself if you need to set up different 590 * cell renderers for the new model. 591 * Since 2.4 592 * Params: 593 * model = A GtkTreeModel. [allow-none] 594 */ 595 public void setModel(TreeModelIF model) 596 { 597 // void gtk_combo_box_set_model (GtkComboBox *combo_box, GtkTreeModel *model); 598 gtk_combo_box_set_model(gtkComboBox, (model is null) ? null : model.getTreeModelTStruct()); 599 } 600 601 /** 602 * Warning 603 * gtk_combo_box_append_text has been deprecated since version 2.24 and should not be used in newly-written code. Use GtkComboBoxText 604 * Appends string to the list of strings stored in combo_box. Note that 605 * you can only use this function with combo boxes constructed with 606 * gtk_combo_box_new_text(). 607 * Since 2.4 608 * Params: 609 * text = A string 610 */ 611 public void appendText(string text) 612 { 613 // void gtk_combo_box_append_text (GtkComboBox *combo_box, const gchar *text); 614 gtk_combo_box_append_text(gtkComboBox, Str.toStringz(text)); 615 } 616 617 /** 618 * Warning 619 * gtk_combo_box_insert_text has been deprecated since version 2.24 and should not be used in newly-written code. Use GtkComboBoxText 620 * Inserts string at position in the list of strings stored in combo_box. 621 * Note that you can only use this function with combo boxes constructed 622 * with gtk_combo_box_new_text(). 623 * Since 2.4 624 * Params: 625 * position = An index to insert text 626 * text = A string 627 */ 628 public void insertText(int position, string text) 629 { 630 // void gtk_combo_box_insert_text (GtkComboBox *combo_box, gint position, const gchar *text); 631 gtk_combo_box_insert_text(gtkComboBox, position, Str.toStringz(text)); 632 } 633 634 /** 635 * Warning 636 * gtk_combo_box_prepend_text has been deprecated since version 2.24 and should not be used in newly-written code. Use GtkComboBoxText 637 * Prepends string to the list of strings stored in combo_box. Note that 638 * you can only use this function with combo boxes constructed with 639 * gtk_combo_box_new_text(). 640 * Since 2.4 641 * Params: 642 * text = A string 643 */ 644 public void prependText(string text) 645 { 646 // void gtk_combo_box_prepend_text (GtkComboBox *combo_box, const gchar *text); 647 gtk_combo_box_prepend_text(gtkComboBox, Str.toStringz(text)); 648 } 649 650 /** 651 * Warning 652 * gtk_combo_box_remove_text has been deprecated since version 2.24 and should not be used in newly-written code. Use GtkComboBoxText 653 * Removes the string at position from combo_box. Note that you can only use 654 * this function with combo boxes constructed with gtk_combo_box_new_text(). 655 * Since 2.4 656 * Params: 657 * position = Index of the item to remove 658 */ 659 public void removeText(int position) 660 { 661 // void gtk_combo_box_remove_text (GtkComboBox *combo_box, gint position); 662 gtk_combo_box_remove_text(gtkComboBox, position); 663 } 664 665 /** 666 * Warning 667 * gtk_combo_box_get_active_text has been deprecated since version 2.24 and should not be used in newly-written code. If you used this with a GtkComboBox constructed with 668 * gtk_combo_box_new_text() then you should now use GtkComboBoxText and 669 * gtk_combo_box_text_get_active_text() instead. Or if you used this with a 670 * GtkComboBoxEntry then you should now use GtkComboBox with 671 * "has-entry" as TRUE and use 672 * gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combobox))). 673 * Returns the currently active string in combo_box or NULL if none 674 * is selected. Note that you can only use this function with combo 675 * boxes constructed with gtk_combo_box_new_text() and with 676 * GtkComboBoxEntrys. 677 * Since 2.6 678 * Returns: a newly allocated string containing the currently active text. Must be freed with g_free(). 679 */ 680 public string getActiveText() 681 { 682 // gchar * gtk_combo_box_get_active_text (GtkComboBox *combo_box); 683 return Str.toString(gtk_combo_box_get_active_text(gtkComboBox)); 684 } 685 686 /** 687 * Pops up the menu or dropdown list of combo_box. 688 * This function is mostly intended for use by accessibility technologies; 689 * applications should have little use for it. 690 * Since 2.4 691 */ 692 public void popup() 693 { 694 // void gtk_combo_box_popup (GtkComboBox *combo_box); 695 gtk_combo_box_popup(gtkComboBox); 696 } 697 698 /** 699 * Hides the menu or dropdown list of combo_box. 700 * This function is mostly intended for use by accessibility technologies; 701 * applications should have little use for it. 702 * Since 2.4 703 */ 704 public void popdown() 705 { 706 // void gtk_combo_box_popdown (GtkComboBox *combo_box); 707 gtk_combo_box_popdown(gtkComboBox); 708 } 709 710 /** 711 * Gets the accessible object corresponding to the combo box's popup. 712 * This function is mostly intended for use by accessibility technologies; 713 * applications should have little use for it. 714 * Since 2.6 715 * Returns: the accessible object corresponding to the combo box's popup. [transfer none] 716 */ 717 public ObjectAtk getPopupAccessible() 718 { 719 // AtkObject * gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box); 720 auto p = gtk_combo_box_get_popup_accessible(gtkComboBox); 721 722 if(p is null) 723 { 724 return null; 725 } 726 727 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 728 } 729 730 /** 731 * Returns the current row separator function. 732 * Since 2.6 733 * Returns: the current row separator function. 734 */ 735 public GtkTreeViewRowSeparatorFunc getRowSeparatorFunc() 736 { 737 // GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box); 738 return gtk_combo_box_get_row_separator_func(gtkComboBox); 739 } 740 741 /** 742 * Sets the row separator function, which is used to determine 743 * whether a row should be drawn as a separator. If the row separator 744 * function is NULL, no separators are drawn. This is the default value. 745 * Since 2.6 746 * Params: 747 * func = a GtkTreeViewRowSeparatorFunc 748 * data = user data to pass to func, or NULL. [allow-none] 749 * destroy = destroy notifier for data, or NULL. [allow-none] 750 */ 751 public void setRowSeparatorFunc(GtkTreeViewRowSeparatorFunc func, void* data, GDestroyNotify destroy) 752 { 753 // void gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box, GtkTreeViewRowSeparatorFunc func, gpointer data, GDestroyNotify destroy); 754 gtk_combo_box_set_row_separator_func(gtkComboBox, func, data, destroy); 755 } 756 757 /** 758 * Sets whether the popup menu should have a tearoff 759 * menu item. 760 * Since 2.6 761 * Params: 762 * addTearoffs = TRUE to add tearoff menu items 763 */ 764 public void setAddTearoffs(int addTearoffs) 765 { 766 // void gtk_combo_box_set_add_tearoffs (GtkComboBox *combo_box, gboolean add_tearoffs); 767 gtk_combo_box_set_add_tearoffs(gtkComboBox, addTearoffs); 768 } 769 770 /** 771 * Gets the current value of the :add-tearoffs property. 772 * Returns: the current value of the :add-tearoffs property. 773 */ 774 public int getAddTearoffs() 775 { 776 // gboolean gtk_combo_box_get_add_tearoffs (GtkComboBox *combo_box); 777 return gtk_combo_box_get_add_tearoffs(gtkComboBox); 778 } 779 780 /** 781 * Sets the menu's title in tearoff mode. 782 * Since 2.10 783 * Params: 784 * title = a title for the menu in tearoff mode 785 */ 786 public void setTitle(string title) 787 { 788 // void gtk_combo_box_set_title (GtkComboBox *combo_box, const gchar *title); 789 gtk_combo_box_set_title(gtkComboBox, Str.toStringz(title)); 790 } 791 792 /** 793 * Gets the current title of the menu in tearoff mode. See 794 * gtk_combo_box_set_add_tearoffs(). 795 * Since 2.10 796 * Returns: the menu's title in tearoff mode. This is an internal copy of the string which must not be freed. 797 */ 798 public string getTitle() 799 { 800 // const gchar * gtk_combo_box_get_title (GtkComboBox *combo_box); 801 return Str.toString(gtk_combo_box_get_title(gtkComboBox)); 802 } 803 804 /** 805 * Sets whether the combo box will grab focus when it is clicked with 806 * the mouse. Making mouse clicks not grab focus is useful in places 807 * like toolbars where you don't want the keyboard focus removed from 808 * the main area of the application. 809 * Since 2.6 810 * Params: 811 * focusOnClick = whether the combo box grabs focus when clicked 812 * with the mouse 813 */ 814 public void setFocusOnClick(int focusOnClick) 815 { 816 // void gtk_combo_box_set_focus_on_click (GtkComboBox *combo, gboolean focus_on_click); 817 gtk_combo_box_set_focus_on_click(gtkComboBox, focusOnClick); 818 } 819 820 /** 821 * Returns whether the combo box grabs focus when it is clicked 822 * with the mouse. See gtk_combo_box_set_focus_on_click(). 823 * Since 2.6 824 * Returns: TRUE if the combo box grabs focus when it is clicked with the mouse. 825 */ 826 public int getFocusOnClick() 827 { 828 // gboolean gtk_combo_box_get_focus_on_click (GtkComboBox *combo); 829 return gtk_combo_box_get_focus_on_click(gtkComboBox); 830 } 831 832 /** 833 * Sets whether the dropdown button of the combo box should be 834 * always sensitive (GTK_SENSITIVITY_ON), never sensitive (GTK_SENSITIVITY_OFF) 835 * or only if there is at least one item to display (GTK_SENSITIVITY_AUTO). 836 * Since 2.14 837 * Params: 838 * sensitivity = specify the sensitivity of the dropdown button 839 */ 840 public void setButtonSensitivity(GtkSensitivityType sensitivity) 841 { 842 // void gtk_combo_box_set_button_sensitivity (GtkComboBox *combo_box, GtkSensitivityType sensitivity); 843 gtk_combo_box_set_button_sensitivity(gtkComboBox, sensitivity); 844 } 845 846 /** 847 * Returns whether the combo box sets the dropdown button 848 * sensitive or not when there are no items in the model. 849 * Since 2.14 850 * Returns: GTK_SENSITIVITY_ON if the dropdown button is sensitive when the model is empty, GTK_SENSITIVITY_OFF if the button is always insensitive or GTK_SENSITIVITY_AUTO if it is only sensitive as long as the model has one item to be selected. 851 */ 852 public GtkSensitivityType getButtonSensitivity() 853 { 854 // GtkSensitivityType gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box); 855 return gtk_combo_box_get_button_sensitivity(gtkComboBox); 856 } 857 858 /** 859 * Returns whether the combo box has an entry. 860 * Since 2.24 861 * Returns: whether there is an entry in combo_box. 862 */ 863 public int getHasEntry() 864 { 865 // gboolean gtk_combo_box_get_has_entry (GtkComboBox *combo_box); 866 return gtk_combo_box_get_has_entry(gtkComboBox); 867 } 868 869 /** 870 * Sets the model column which combo_box should use to get strings from 871 * to be text_column. The column text_column in the model of combo_box 872 * must be of type G_TYPE_STRING. 873 * This is only relevant if combo_box has been created with 874 * "has-entry" as TRUE. 875 * Since 2.24 876 * Params: 877 * textColumn = A column in model to get the strings from for 878 * the internal entry 879 */ 880 public void setEntryTextColumn(int textColumn) 881 { 882 // void gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box, gint text_column); 883 gtk_combo_box_set_entry_text_column(gtkComboBox, textColumn); 884 } 885 886 /** 887 * Returns the column which combo_box is using to get the strings 888 * from to display in the internal entry. 889 * Since 2.24 890 * Returns: A column in the data source model of combo_box. 891 */ 892 public int getEntryTextColumn() 893 { 894 // gint gtk_combo_box_get_entry_text_column (GtkComboBox *combo_box); 895 return gtk_combo_box_get_entry_text_column(gtkComboBox); 896 } 897 }