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