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 = GtkStatusIcon.html 27 * outPack = gtk 28 * outFile = StatusIcon 29 * strct = GtkStatusIcon 30 * realStrct= 31 * ctorStrct= 32 * clss = StatusIcon 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_status_icon_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - gtk_status_icon_new_from_stock 45 * - gtk_status_icon_new_from_file 46 * - gtk_status_icon_new_from_icon_name 47 * omit signals: 48 * imports: 49 * - glib.Str 50 * - gio.Icon 51 * - gio.IconIF 52 * - gdk.Pixbuf 53 * - gdk.Screen 54 * - gtk.Menu 55 * - gtk.Tooltip 56 * structWrap: 57 * - GIcon* -> IconIF 58 * - GdkPixbuf* -> Pixbuf 59 * - GdkScreen* -> Screen 60 * - GtkMenu* -> Menu 61 * - GtkTooltip* -> Tooltip 62 * module aliases: 63 * local aliases: 64 * overrides: 65 */ 66 67 module gtk.StatusIcon; 68 69 public import gtkc.gtktypes; 70 71 private import gtkc.gtk; 72 private import glib.ConstructionException; 73 private import gobject.ObjectG; 74 75 private import gobject.Signals; 76 public import gtkc.gdktypes; 77 78 private import glib.Str; 79 private import gio.Icon; 80 private import gio.IconIF; 81 private import gdk.Pixbuf; 82 private import gdk.Screen; 83 private import gtk.Menu; 84 private import gtk.Tooltip; 85 86 87 88 private import gobject.ObjectG; 89 90 /** 91 * The "system tray" or notification area is normally used for transient icons 92 * that indicate some special state. For example, a system tray icon might 93 * appear to tell the user that they have new mail, or have an incoming instant 94 * message, or something along those lines. The basic idea is that creating an 95 * icon in the notification area is less annoying than popping up a dialog. 96 * 97 * A GtkStatusIcon object can be used to display an icon in a "system tray". 98 * The icon can have a tooltip, and the user can interact with it by 99 * activating it or popping up a context menu. Critical information should 100 * not solely be displayed in a GtkStatusIcon, since it may not be 101 * visible (e.g. when the user doesn't have a notification area on his panel). 102 * This can be checked with gtk_status_icon_is_embedded(). 103 * 104 * On X11, the implementation follows the freedesktop.org "System Tray" 105 * specification. 106 * Implementations of the "tray" side of this specification can 107 * be found e.g. in the GNOME 2 and KDE panel applications. 108 * 109 * Note that a GtkStatusIcon is not a widget, but just 110 * a GObject. Making it a widget would be impractical, since the system tray 111 * on Win32 doesn't allow to embed arbitrary widgets. 112 */ 113 public class StatusIcon : ObjectG 114 { 115 116 /** the main Gtk struct */ 117 protected GtkStatusIcon* gtkStatusIcon; 118 119 120 public GtkStatusIcon* getStatusIconStruct() 121 { 122 return gtkStatusIcon; 123 } 124 125 126 /** the main Gtk struct as a void* */ 127 protected override void* getStruct() 128 { 129 return cast(void*)gtkStatusIcon; 130 } 131 132 /** 133 * Sets our main struct and passes it to the parent class 134 */ 135 public this (GtkStatusIcon* gtkStatusIcon) 136 { 137 super(cast(GObject*)gtkStatusIcon); 138 this.gtkStatusIcon = gtkStatusIcon; 139 } 140 141 protected override void setStruct(GObject* obj) 142 { 143 super.setStruct(obj); 144 gtkStatusIcon = cast(GtkStatusIcon*)obj; 145 } 146 147 /** 148 * Creates a status icon displaying a stock icon. Sample stock icon 149 * names are StockID.OPEN, StockID.QUIT. You can register your 150 * own stock icon names, see gtk_icon_factory_add_default() and 151 * gtk_icon_factory_add(). 152 * Since 2.10 153 * Params: 154 * stock_id = a stock icon id 155 * Returns: 156 * a new GtkStatusIcon 157 * Throws: ConstructionException GTK+ fails to create the object. 158 */ 159 public this (StockID stockID) 160 { 161 // GtkStatusIcon* gtk_status_icon_new_from_stock (const gchar *stock_id); 162 auto p = gtk_status_icon_new_from_stock(Str.toStringz(StockDesc[stockID])); 163 if(p is null) 164 { 165 throw new ConstructionException("null returned by gtk_status_icon_new_from_stock"); 166 } 167 this(cast(GtkStatusIcon*)p); 168 } 169 170 /** 171 * Creates a status icon displaying an icon from the current icon theme. 172 * If the current icon theme is changed, the icon will be updated 173 * appropriately. 174 * Since 2.10 175 * Params: 176 * iconName = an icon name 177 * loadFromFile = treat iconName as a filename and load that image 178 * with gtk_status_icon_new_from_file. 179 * Throws: ConstructionException GTK+ fails to create the object. 180 */ 181 public this (string iconName, bool loadFromFile = false) 182 { 183 //TODO: look at a better way to do this. 184 GtkStatusIcon* p; 185 186 if(loadFromFile) 187 { 188 // GtkStatusIcon* gtk_status_icon_new_from_file (const gchar *filename); 189 p = cast(GtkStatusIcon*)gtk_status_icon_new_from_file(Str.toStringz(iconName)); 190 } 191 else 192 { 193 // GtkStatusIcon* gtk_status_icon_new_from_icon_name (const gchar *icon_name); 194 p = cast(GtkStatusIcon*)gtk_status_icon_new_from_icon_name(Str.toStringz(iconName)); 195 } 196 197 if(p is null) 198 { 199 throw new ConstructionException("null returned by gtk_status_icon_new_from_"); 200 } 201 202 this(p); 203 } 204 205 /** 206 */ 207 int[string] connectedSignals; 208 209 void delegate(StatusIcon)[] onActivateListeners; 210 /** 211 * Gets emitted when the user activates the status icon. 212 * If and how status icons can activated is platform-dependent. 213 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 214 * be used by applications and should be wrapped by language bindings. 215 * Since 2.10 216 */ 217 void addOnActivate(void delegate(StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 218 { 219 if ( !("activate" in connectedSignals) ) 220 { 221 Signals.connectData( 222 getStruct(), 223 "activate", 224 cast(GCallback)&callBackActivate, 225 cast(void*)this, 226 null, 227 connectFlags); 228 connectedSignals["activate"] = 1; 229 } 230 onActivateListeners ~= dlg; 231 } 232 extern(C) static void callBackActivate(GtkStatusIcon* statusIconStruct, StatusIcon _statusIcon) 233 { 234 foreach ( void delegate(StatusIcon) dlg ; _statusIcon.onActivateListeners ) 235 { 236 dlg(_statusIcon); 237 } 238 } 239 240 bool delegate(GdkEvent*, StatusIcon)[] onButtonPressListeners; 241 /** 242 * The ::button-press-event signal will be emitted when a button 243 * (typically from a mouse) is pressed. 244 * Whether this event is emitted is platform-dependent. Use the ::activate 245 * and ::popup-menu signals in preference. 246 * TRUE to stop other handlers from being invoked 247 * for the event. FALSE to propagate the event further. 248 * Since 2.14 249 */ 250 void addOnButtonPress(bool delegate(GdkEvent*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 251 { 252 if ( !("button-press-event" in connectedSignals) ) 253 { 254 Signals.connectData( 255 getStruct(), 256 "button-press-event", 257 cast(GCallback)&callBackButtonPress, 258 cast(void*)this, 259 null, 260 connectFlags); 261 connectedSignals["button-press-event"] = 1; 262 } 263 onButtonPressListeners ~= dlg; 264 } 265 extern(C) static gboolean callBackButtonPress(GtkStatusIcon* statusIconStruct, GdkEvent* event, StatusIcon _statusIcon) 266 { 267 foreach ( bool delegate(GdkEvent*, StatusIcon) dlg ; _statusIcon.onButtonPressListeners ) 268 { 269 if ( dlg(event, _statusIcon) ) 270 { 271 return 1; 272 } 273 } 274 275 return 0; 276 } 277 278 bool delegate(GdkEvent*, StatusIcon)[] onButtonReleaseListeners; 279 /** 280 * The ::button-release-event signal will be emitted when a button 281 * (typically from a mouse) is released. 282 * Whether this event is emitted is platform-dependent. Use the ::activate 283 * and ::popup-menu signals in preference. 284 * TRUE to stop other handlers from being invoked 285 * for the event. FALSE to propagate the event further. 286 * Since 2.14 287 */ 288 void addOnButtonRelease(bool delegate(GdkEvent*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 289 { 290 if ( !("button-release-event" in connectedSignals) ) 291 { 292 Signals.connectData( 293 getStruct(), 294 "button-release-event", 295 cast(GCallback)&callBackButtonRelease, 296 cast(void*)this, 297 null, 298 connectFlags); 299 connectedSignals["button-release-event"] = 1; 300 } 301 onButtonReleaseListeners ~= dlg; 302 } 303 extern(C) static gboolean callBackButtonRelease(GtkStatusIcon* statusIconStruct, GdkEvent* event, StatusIcon _statusIcon) 304 { 305 foreach ( bool delegate(GdkEvent*, StatusIcon) dlg ; _statusIcon.onButtonReleaseListeners ) 306 { 307 if ( dlg(event, _statusIcon) ) 308 { 309 return 1; 310 } 311 } 312 313 return 0; 314 } 315 316 void delegate(guint, guint, StatusIcon)[] onPopupMenuListeners; 317 /** 318 * Gets emitted when the user brings up the context menu 319 * of the status icon. Whether status icons can have context 320 * menus and how these are activated is platform-dependent. 321 * The button and activate_time parameters should be 322 * passed as the last to arguments to gtk_menu_popup(). 323 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 324 * be used by applications and should be wrapped by language bindings. 325 * Since 2.10 326 */ 327 void addOnPopupMenu(void delegate(guint, guint, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 328 { 329 if ( !("popup-menu" in connectedSignals) ) 330 { 331 Signals.connectData( 332 getStruct(), 333 "popup-menu", 334 cast(GCallback)&callBackPopupMenu, 335 cast(void*)this, 336 null, 337 connectFlags); 338 connectedSignals["popup-menu"] = 1; 339 } 340 onPopupMenuListeners ~= dlg; 341 } 342 extern(C) static void callBackPopupMenu(GtkStatusIcon* statusIconStruct, guint button, guint activateTime, StatusIcon _statusIcon) 343 { 344 foreach ( void delegate(guint, guint, StatusIcon) dlg ; _statusIcon.onPopupMenuListeners ) 345 { 346 dlg(button, activateTime, _statusIcon); 347 } 348 } 349 350 bool delegate(gint, gint, gboolean, Tooltip, StatusIcon)[] onQueryTooltipListeners; 351 /** 352 * Emitted when the hover timeout has expired with the 353 * cursor hovering above status_icon; or emitted when status_icon got 354 * focus in keyboard mode. 355 * Using the given coordinates, the signal handler should determine 356 * whether a tooltip should be shown for status_icon. If this is 357 * the case TRUE should be returned, FALSE otherwise. Note that if 358 * keyboard_mode is TRUE, the values of x and y are undefined and 359 * should not be used. 360 * The signal handler is free to manipulate tooltip with the therefore 361 * destined function calls. 362 * Whether this signal is emitted is platform-dependent. 363 * For plain text tooltips, use "tooltip-text" in preference. 364 * TRUE if the tooltip was trigged using the keyboard 365 * TRUE if tooltip should be shown right now, FALSE otherwise. 366 * Since 2.16 367 */ 368 void addOnQueryTooltip(bool delegate(gint, gint, gboolean, Tooltip, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 369 { 370 if ( !("query-tooltip" in connectedSignals) ) 371 { 372 Signals.connectData( 373 getStruct(), 374 "query-tooltip", 375 cast(GCallback)&callBackQueryTooltip, 376 cast(void*)this, 377 null, 378 connectFlags); 379 connectedSignals["query-tooltip"] = 1; 380 } 381 onQueryTooltipListeners ~= dlg; 382 } 383 extern(C) static gboolean callBackQueryTooltip(GtkStatusIcon* statusIconStruct, gint x, gint y, gboolean keyboardMode, GtkTooltip* tooltip, StatusIcon _statusIcon) 384 { 385 foreach ( bool delegate(gint, gint, gboolean, Tooltip, StatusIcon) dlg ; _statusIcon.onQueryTooltipListeners ) 386 { 387 if ( dlg(x, y, keyboardMode, ObjectG.getDObject!(Tooltip)(tooltip), _statusIcon) ) 388 { 389 return 1; 390 } 391 } 392 393 return 0; 394 } 395 396 bool delegate(GdkEvent*, StatusIcon)[] onScrollListeners; 397 /** 398 * The ::scroll-event signal is emitted when a button in the 4 to 7 399 * range is pressed. Wheel mice are usually configured to generate 400 * button press events for buttons 4 and 5 when the wheel is turned. 401 * Whether this event is emitted is platform-dependent. 402 * TRUE to stop other handlers from being invoked for the event. 403 * FALSE to propagate the event further. 404 * Since 2.16 405 */ 406 void addOnScroll(bool delegate(GdkEvent*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 407 { 408 if ( !("scroll-event" in connectedSignals) ) 409 { 410 Signals.connectData( 411 getStruct(), 412 "scroll-event", 413 cast(GCallback)&callBackScroll, 414 cast(void*)this, 415 null, 416 connectFlags); 417 connectedSignals["scroll-event"] = 1; 418 } 419 onScrollListeners ~= dlg; 420 } 421 extern(C) static gboolean callBackScroll(GtkStatusIcon* statusIconStruct, GdkEvent* event, StatusIcon _statusIcon) 422 { 423 foreach ( bool delegate(GdkEvent*, StatusIcon) dlg ; _statusIcon.onScrollListeners ) 424 { 425 if ( dlg(event, _statusIcon) ) 426 { 427 return 1; 428 } 429 } 430 431 return 0; 432 } 433 434 bool delegate(gint, StatusIcon)[] onSizeChangedListeners; 435 /** 436 * Gets emitted when the size available for the image 437 * changes, e.g. because the notification area got resized. 438 * TRUE if the icon was updated for the new 439 * size. Otherwise, GTK+ will scale the icon as necessary. 440 * Since 2.10 441 */ 442 void addOnSizeChanged(bool delegate(gint, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 443 { 444 if ( !("size-changed" in connectedSignals) ) 445 { 446 Signals.connectData( 447 getStruct(), 448 "size-changed", 449 cast(GCallback)&callBackSizeChanged, 450 cast(void*)this, 451 null, 452 connectFlags); 453 connectedSignals["size-changed"] = 1; 454 } 455 onSizeChangedListeners ~= dlg; 456 } 457 extern(C) static gboolean callBackSizeChanged(GtkStatusIcon* statusIconStruct, gint size, StatusIcon _statusIcon) 458 { 459 foreach ( bool delegate(gint, StatusIcon) dlg ; _statusIcon.onSizeChangedListeners ) 460 { 461 if ( dlg(size, _statusIcon) ) 462 { 463 return 1; 464 } 465 } 466 467 return 0; 468 } 469 470 471 /** 472 * Creates an empty status icon object. 473 * Since 2.10 474 * Throws: ConstructionException GTK+ fails to create the object. 475 */ 476 public this () 477 { 478 // GtkStatusIcon * gtk_status_icon_new (void); 479 auto p = gtk_status_icon_new(); 480 if(p is null) 481 { 482 throw new ConstructionException("null returned by gtk_status_icon_new()"); 483 } 484 this(cast(GtkStatusIcon*) p); 485 } 486 487 /** 488 * Creates a status icon displaying pixbuf. 489 * The image will be scaled down to fit in the available 490 * space in the notification area, if necessary. 491 * Since 2.10 492 * Params: 493 * pixbuf = a GdkPixbuf 494 * Throws: ConstructionException GTK+ fails to create the object. 495 */ 496 public this (Pixbuf pixbuf) 497 { 498 // GtkStatusIcon * gtk_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf); 499 auto p = gtk_status_icon_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct()); 500 if(p is null) 501 { 502 throw new ConstructionException("null returned by gtk_status_icon_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct())"); 503 } 504 this(cast(GtkStatusIcon*) p); 505 } 506 507 /** 508 * Creates a status icon displaying a GIcon. If the icon is a 509 * themed icon, it will be updated when the theme changes. 510 * Since 2.14 511 * Params: 512 * icon = a GIcon 513 * Throws: ConstructionException GTK+ fails to create the object. 514 */ 515 public this (IconIF icon) 516 { 517 // GtkStatusIcon * gtk_status_icon_new_from_gicon (GIcon *icon); 518 auto p = gtk_status_icon_new_from_gicon((icon is null) ? null : icon.getIconTStruct()); 519 if(p is null) 520 { 521 throw new ConstructionException("null returned by gtk_status_icon_new_from_gicon((icon is null) ? null : icon.getIconTStruct())"); 522 } 523 this(cast(GtkStatusIcon*) p); 524 } 525 526 /** 527 * Makes status_icon display pixbuf. 528 * See gtk_status_icon_new_from_pixbuf() for details. 529 * Since 2.10 530 * Params: 531 * pixbuf = a GdkPixbuf or NULL. [allow-none] 532 */ 533 public void setFromPixbuf(Pixbuf pixbuf) 534 { 535 // void gtk_status_icon_set_from_pixbuf (GtkStatusIcon *status_icon, GdkPixbuf *pixbuf); 536 gtk_status_icon_set_from_pixbuf(gtkStatusIcon, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 537 } 538 539 /** 540 * Makes status_icon display the file filename. 541 * See gtk_status_icon_new_from_file() for details. 542 * Since 2.10 543 * Params: 544 * filename = a filename. [type filename] 545 */ 546 public void setFromFile(string filename) 547 { 548 // void gtk_status_icon_set_from_file (GtkStatusIcon *status_icon, const gchar *filename); 549 gtk_status_icon_set_from_file(gtkStatusIcon, Str.toStringz(filename)); 550 } 551 552 /** 553 * Warning 554 * gtk_status_icon_set_from_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_status_icon_set_from_icon_name() instead. 555 * Makes status_icon display the stock icon with the id stock_id. 556 * See gtk_status_icon_new_from_stock() for details. 557 * Since 2.10 558 * Params: 559 * stockId = a stock icon id 560 */ 561 public void setFromStock(string stockId) 562 { 563 // void gtk_status_icon_set_from_stock (GtkStatusIcon *status_icon, const gchar *stock_id); 564 gtk_status_icon_set_from_stock(gtkStatusIcon, Str.toStringz(stockId)); 565 } 566 567 /** 568 * Makes status_icon display the icon named icon_name from the 569 * current icon theme. 570 * See gtk_status_icon_new_from_icon_name() for details. 571 * Since 2.10 572 * Params: 573 * iconName = an icon name 574 */ 575 public void setFromIconName(string iconName) 576 { 577 // void gtk_status_icon_set_from_icon_name (GtkStatusIcon *status_icon, const gchar *icon_name); 578 gtk_status_icon_set_from_icon_name(gtkStatusIcon, Str.toStringz(iconName)); 579 } 580 581 /** 582 * Makes status_icon display the GIcon. 583 * See gtk_status_icon_new_from_gicon() for details. 584 * Since 2.14 585 * Params: 586 * icon = a GIcon 587 */ 588 public void setFromGicon(IconIF icon) 589 { 590 // void gtk_status_icon_set_from_gicon (GtkStatusIcon *status_icon, GIcon *icon); 591 gtk_status_icon_set_from_gicon(gtkStatusIcon, (icon is null) ? null : icon.getIconTStruct()); 592 } 593 594 /** 595 * Gets the type of representation being used by the GtkStatusIcon 596 * to store image data. If the GtkStatusIcon has no image data, 597 * the return value will be GTK_IMAGE_EMPTY. 598 * Since 2.10 599 * Returns: the image representation being used 600 */ 601 public GtkImageType getStorageType() 602 { 603 // GtkImageType gtk_status_icon_get_storage_type (GtkStatusIcon *status_icon); 604 return gtk_status_icon_get_storage_type(gtkStatusIcon); 605 } 606 607 /** 608 * Gets the GdkPixbuf being displayed by the GtkStatusIcon. 609 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 610 * GTK_IMAGE_PIXBUF (see gtk_status_icon_get_storage_type()). 611 * The caller of this function does not own a reference to the 612 * returned pixbuf. 613 * Since 2.10 614 * Returns: the displayed pixbuf, or NULL if the image is empty. [transfer none] 615 */ 616 public Pixbuf getPixbuf() 617 { 618 // GdkPixbuf * gtk_status_icon_get_pixbuf (GtkStatusIcon *status_icon); 619 auto p = gtk_status_icon_get_pixbuf(gtkStatusIcon); 620 621 if(p is null) 622 { 623 return null; 624 } 625 626 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 627 } 628 629 /** 630 * Warning 631 * gtk_status_icon_get_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_status_icon_get_icon_name() instead. 632 * Gets the id of the stock icon being displayed by the GtkStatusIcon. 633 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 634 * GTK_IMAGE_STOCK (see gtk_status_icon_get_storage_type()). 635 * The returned string is owned by the GtkStatusIcon and should not 636 * be freed or modified. 637 * Since 2.10 638 * Returns: stock id of the displayed stock icon, or NULL if the image is empty. 639 */ 640 public string getStock() 641 { 642 // const gchar * gtk_status_icon_get_stock (GtkStatusIcon *status_icon); 643 return Str.toString(gtk_status_icon_get_stock(gtkStatusIcon)); 644 } 645 646 /** 647 * Gets the name of the icon being displayed by the GtkStatusIcon. 648 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 649 * GTK_IMAGE_ICON_NAME (see gtk_status_icon_get_storage_type()). 650 * The returned string is owned by the GtkStatusIcon and should not 651 * be freed or modified. 652 * Since 2.10 653 * Returns: name of the displayed icon, or NULL if the image is empty. 654 */ 655 public string getIconName() 656 { 657 // const gchar * gtk_status_icon_get_icon_name (GtkStatusIcon *status_icon); 658 return Str.toString(gtk_status_icon_get_icon_name(gtkStatusIcon)); 659 } 660 661 /** 662 * Retrieves the GIcon being displayed by the GtkStatusIcon. 663 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 664 * GTK_IMAGE_GICON (see gtk_status_icon_get_storage_type()). 665 * The caller of this function does not own a reference to the 666 * returned GIcon. 667 * If this function fails, icon is left unchanged; 668 * Since 2.14 669 * Returns: the displayed icon, or NULL if the image is empty. [transfer none] 670 */ 671 public IconIF getGicon() 672 { 673 // GIcon * gtk_status_icon_get_gicon (GtkStatusIcon *status_icon); 674 auto p = gtk_status_icon_get_gicon(gtkStatusIcon); 675 676 if(p is null) 677 { 678 return null; 679 } 680 681 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 682 } 683 684 /** 685 * Gets the size in pixels that is available for the image. 686 * Stock icons and named icons adapt their size automatically 687 * if the size of the notification area changes. For other 688 * storage types, the size-changed signal can be used to 689 * react to size changes. 690 * Note that the returned size is only meaningful while the 691 * status icon is embedded (see gtk_status_icon_is_embedded()). 692 * Since 2.10 693 * Returns: the size that is available for the image 694 */ 695 public int getSize() 696 { 697 // gint gtk_status_icon_get_size (GtkStatusIcon *status_icon); 698 return gtk_status_icon_get_size(gtkStatusIcon); 699 } 700 701 /** 702 * Sets the GdkScreen where status_icon is displayed; if 703 * the icon is already mapped, it will be unmapped, and 704 * then remapped on the new screen. 705 * Since 2.12 706 * Params: 707 * screen = a GdkScreen 708 */ 709 public void setScreen(Screen screen) 710 { 711 // void gtk_status_icon_set_screen (GtkStatusIcon *status_icon, GdkScreen *screen); 712 gtk_status_icon_set_screen(gtkStatusIcon, (screen is null) ? null : screen.getScreenStruct()); 713 } 714 715 /** 716 * Returns the GdkScreen associated with status_icon. 717 * Since 2.12 718 * Returns: a GdkScreen. [transfer none] 719 */ 720 public Screen getScreen() 721 { 722 // GdkScreen * gtk_status_icon_get_screen (GtkStatusIcon *status_icon); 723 auto p = gtk_status_icon_get_screen(gtkStatusIcon); 724 725 if(p is null) 726 { 727 return null; 728 } 729 730 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 731 } 732 733 /** 734 * Sets text as the contents of the tooltip. 735 * This function will take care of setting "has-tooltip" to 736 * TRUE and of the default handler for the "query-tooltip" 737 * signal. 738 * See also the "tooltip-text" property and 739 * gtk_tooltip_set_text(). 740 * Since 2.16 741 * Params: 742 * text = the contents of the tooltip for status_icon 743 */ 744 public void setTooltipText(string text) 745 { 746 // void gtk_status_icon_set_tooltip_text (GtkStatusIcon *status_icon, const gchar *text); 747 gtk_status_icon_set_tooltip_text(gtkStatusIcon, Str.toStringz(text)); 748 } 749 750 /** 751 * Gets the contents of the tooltip for status_icon. 752 * Since 2.16 753 * Returns: the tooltip text, or NULL. You should free the returned string with g_free() when done. 754 */ 755 public string getTooltipText() 756 { 757 // gchar * gtk_status_icon_get_tooltip_text (GtkStatusIcon *status_icon); 758 return Str.toString(gtk_status_icon_get_tooltip_text(gtkStatusIcon)); 759 } 760 761 /** 762 * Sets markup as the contents of the tooltip, which is marked up with 763 * the Pango text markup language. 764 * This function will take care of setting "has-tooltip" to TRUE 765 * and of the default handler for the "query-tooltip" signal. 766 * See also the "tooltip-markup" property and 767 * gtk_tooltip_set_markup(). 768 * Since 2.16 769 * Params: 770 * markup = the contents of the tooltip for status_icon, or NULL. [allow-none] 771 */ 772 public void setTooltipMarkup(string markup) 773 { 774 // void gtk_status_icon_set_tooltip_markup (GtkStatusIcon *status_icon, const gchar *markup); 775 gtk_status_icon_set_tooltip_markup(gtkStatusIcon, Str.toStringz(markup)); 776 } 777 778 /** 779 * Gets the contents of the tooltip for status_icon. 780 * Since 2.16 781 * Returns: the tooltip text, or NULL. You should free the returned string with g_free() when done. 782 */ 783 public string getTooltipMarkup() 784 { 785 // gchar * gtk_status_icon_get_tooltip_markup (GtkStatusIcon *status_icon); 786 return Str.toString(gtk_status_icon_get_tooltip_markup(gtkStatusIcon)); 787 } 788 789 /** 790 * Sets the has-tooltip property on status_icon to has_tooltip. 791 * See "has-tooltip" for more information. 792 * Since 2.16 793 * Params: 794 * hasTooltip = whether or not status_icon has a tooltip 795 */ 796 public void setHasTooltip(int hasTooltip) 797 { 798 // void gtk_status_icon_set_has_tooltip (GtkStatusIcon *status_icon, gboolean has_tooltip); 799 gtk_status_icon_set_has_tooltip(gtkStatusIcon, hasTooltip); 800 } 801 802 /** 803 * Returns the current value of the has-tooltip property. 804 * See "has-tooltip" for more information. 805 * Since 2.16 806 * Returns: current value of has-tooltip on status_icon. 807 */ 808 public int getHasTooltip() 809 { 810 // gboolean gtk_status_icon_get_has_tooltip (GtkStatusIcon *status_icon); 811 return gtk_status_icon_get_has_tooltip(gtkStatusIcon); 812 } 813 814 /** 815 * Sets the title of this tray icon. 816 * This should be a short, human-readable, localized string 817 * describing the tray icon. It may be used by tools like screen 818 * readers to render the tray icon. 819 * Since 2.18 820 * Params: 821 * title = the title 822 */ 823 public void setTitle(string title) 824 { 825 // void gtk_status_icon_set_title (GtkStatusIcon *status_icon, const gchar *title); 826 gtk_status_icon_set_title(gtkStatusIcon, Str.toStringz(title)); 827 } 828 829 /** 830 * Gets the title of this tray icon. See gtk_status_icon_set_title(). 831 * Since 2.18 832 * Returns: the title of the status icon 833 */ 834 public string getTitle() 835 { 836 // const gchar * gtk_status_icon_get_title (GtkStatusIcon *status_icon); 837 return Str.toString(gtk_status_icon_get_title(gtkStatusIcon)); 838 } 839 840 /** 841 * Sets the name of this tray icon. 842 * This should be a string identifying this icon. It is may be 843 * used for sorting the icons in the tray and will not be shown to 844 * the user. 845 * Since 2.20 846 * Params: 847 * name = the name 848 */ 849 public void setName(string name) 850 { 851 // void gtk_status_icon_set_name (GtkStatusIcon *status_icon, const gchar *name); 852 gtk_status_icon_set_name(gtkStatusIcon, Str.toStringz(name)); 853 } 854 855 /** 856 * Shows or hides a status icon. 857 * Since 2.10 858 * Params: 859 * visible = TRUE to show the status icon, FALSE to hide it 860 */ 861 public void setVisible(int visible) 862 { 863 // void gtk_status_icon_set_visible (GtkStatusIcon *status_icon, gboolean visible); 864 gtk_status_icon_set_visible(gtkStatusIcon, visible); 865 } 866 867 /** 868 * Returns whether the status icon is visible or not. 869 * Note that being visible does not guarantee that 870 * the user can actually see the icon, see also 871 * gtk_status_icon_is_embedded(). 872 * Since 2.10 873 * Returns: TRUE if the status icon is visible 874 */ 875 public int getVisible() 876 { 877 // gboolean gtk_status_icon_get_visible (GtkStatusIcon *status_icon); 878 return gtk_status_icon_get_visible(gtkStatusIcon); 879 } 880 881 /** 882 * Returns whether the status icon is embedded in a notification 883 * area. 884 * Since 2.10 885 * Returns: TRUE if the status icon is embedded in a notification area. 886 */ 887 public int isEmbedded() 888 { 889 // gboolean gtk_status_icon_is_embedded (GtkStatusIcon *status_icon); 890 return gtk_status_icon_is_embedded(gtkStatusIcon); 891 } 892 893 /** 894 * Menu positioning function to use with gtk_menu_popup() 895 * to position menu aligned to the status icon user_data. 896 * Since 2.10 897 * Params: 898 * menu = the GtkMenu 899 * x = return location for the x position. [out] 900 * y = return location for the y position. [out] 901 * pushIn = whether the first menu item should be offset 902 * (pushed in) to be aligned with the menu popup position 903 * (only useful for GtkOptionMenu). [out] 904 * userData = the status icon to position the menu on. [type GtkStatusIcon] 905 */ 906 public static void positionMenu(Menu menu, out int x, out int y, out int pushIn, void* userData) 907 { 908 // void gtk_status_icon_position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data); 909 gtk_status_icon_position_menu((menu is null) ? null : menu.getMenuStruct(), &x, &y, &pushIn, userData); 910 } 911 912 /** 913 * Obtains information about the location of the status icon 914 * on screen. This information can be used to e.g. position 915 * popups like notification bubbles. 916 * See gtk_status_icon_position_menu() for a more convenient 917 * alternative for positioning menus. 918 * Note that some platforms do not allow GTK+ to provide 919 * this information, and even on platforms that do allow it, 920 * the information is not reliable unless the status icon 921 * is embedded in a notification area, see 922 * gtk_status_icon_is_embedded(). 923 * Since 2.10 924 * Params: 925 * screen = return location for 926 * the screen, or NULL if the information is not needed. [out][transfer none][allow-none] 927 * area = return location for the area occupied by 928 * the status icon, or NULL. [out][allow-none] 929 * orientation = return location for the 930 * orientation of the panel in which the status icon is embedded, 931 * or NULL. A panel at the top or bottom of the screen is 932 * horizontal, a panel at the left or right is vertical. [out][allow-none] 933 * Returns: TRUE if the location information has been filled in 934 */ 935 public int getGeometry(out Screen screen, out Rectangle area, out GtkOrientation orientation) 936 { 937 // gboolean gtk_status_icon_get_geometry (GtkStatusIcon *status_icon, GdkScreen **screen, GdkRectangle *area, GtkOrientation *orientation); 938 GdkScreen* outscreen = null; 939 940 auto p = gtk_status_icon_get_geometry(gtkStatusIcon, &outscreen, &area, &orientation); 941 942 screen = ObjectG.getDObject!(Screen)(outscreen); 943 return p; 944 } 945 946 /** 947 * This function is only useful on the X11/freedesktop.org platform. 948 * It returns a window ID for the widget in the underlying 949 * status icon implementation. This is useful for the Galago 950 * notification service, which can send a window ID in the protocol 951 * in order for the server to position notification windows 952 * pointing to a status icon reliably. 953 * This function is not intended for other use cases which are 954 * more likely to be met by one of the non-X11 specific methods, such 955 * as gtk_status_icon_position_menu(). 956 * Since 2.14 957 * Returns: An 32 bit unsigned integer identifier for the underlying X11 Window 958 */ 959 public uint getX11_WindowId() 960 { 961 // guint32 gtk_status_icon_get_x11_window_id (GtkStatusIcon *status_icon); 962 return gtk_status_icon_get_x11_window_id(gtkStatusIcon); 963 } 964 }