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