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