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 return Str.toString(gtk_status_icon_get_tooltip_markup(gtkStatusIcon)); 504 } 505 506 /** 507 * Gets the contents of the tooltip for @status_icon. 508 * 509 * Deprecated: Use notifications 510 * 511 * Return: the tooltip text, or %NULL. You should free the 512 * returned string with g_free() when done. 513 * 514 * Since: 2.16 515 */ 516 public string getTooltipText() 517 { 518 return Str.toString(gtk_status_icon_get_tooltip_text(gtkStatusIcon)); 519 } 520 521 /** 522 * Returns whether the status icon is visible or not. 523 * Note that being visible does not guarantee that 524 * the user can actually see the icon, see also 525 * gtk_status_icon_is_embedded(). 526 * 527 * Deprecated: Use notifications 528 * 529 * Return: %TRUE if the status icon is visible 530 * 531 * Since: 2.10 532 */ 533 public bool getVisible() 534 { 535 return gtk_status_icon_get_visible(gtkStatusIcon) != 0; 536 } 537 538 /** 539 * This function is only useful on the X11/freedesktop.org platform. 540 * It returns a window ID for the widget in the underlying 541 * status icon implementation. This is useful for the Galago 542 * notification service, which can send a window ID in the protocol 543 * in order for the server to position notification windows 544 * pointing to a status icon reliably. 545 * 546 * This function is not intended for other use cases which are 547 * more likely to be met by one of the non-X11 specific methods, such 548 * as gtk_status_icon_position_menu(). 549 * 550 * Deprecated: Use notifications 551 * 552 * Return: An 32 bit unsigned integer identifier for the 553 * underlying X11 Window 554 * 555 * Since: 2.14 556 */ 557 public uint getX11WindowId() 558 { 559 return gtk_status_icon_get_x11_window_id(gtkStatusIcon); 560 } 561 562 /** 563 * Returns whether the status icon is embedded in a notification 564 * area. 565 * 566 * Deprecated: Use notifications 567 * 568 * Return: %TRUE if the status icon is embedded in 569 * a notification area. 570 * 571 * Since: 2.10 572 */ 573 public bool isEmbedded() 574 { 575 return gtk_status_icon_is_embedded(gtkStatusIcon) != 0; 576 } 577 578 /** 579 * Makes @status_icon display the file @filename. 580 * See gtk_status_icon_new_from_file() for details. 581 * 582 * Deprecated: Use notifications 583 * 584 * Params: 585 * filename = a filename 586 * 587 * Since: 2.10 588 */ 589 public void setFromFile(string filename) 590 { 591 gtk_status_icon_set_from_file(gtkStatusIcon, Str.toStringz(filename)); 592 } 593 594 /** 595 * Makes @status_icon display the #GIcon. 596 * See gtk_status_icon_new_from_gicon() for details. 597 * 598 * Deprecated: Use notifications 599 * 600 * Params: 601 * icon = a GIcon 602 * 603 * Since: 2.14 604 */ 605 public void setFromGicon(IconIF icon) 606 { 607 gtk_status_icon_set_from_gicon(gtkStatusIcon, (icon is null) ? null : icon.getIconStruct()); 608 } 609 610 /** 611 * Makes @status_icon display the icon named @icon_name from the 612 * current icon theme. 613 * See gtk_status_icon_new_from_icon_name() for details. 614 * 615 * Deprecated: Use notifications 616 * 617 * Params: 618 * iconName = an icon name 619 * 620 * Since: 2.10 621 */ 622 public void setFromIconName(string iconName) 623 { 624 gtk_status_icon_set_from_icon_name(gtkStatusIcon, Str.toStringz(iconName)); 625 } 626 627 /** 628 * Makes @status_icon display @pixbuf. 629 * See gtk_status_icon_new_from_pixbuf() for details. 630 * 631 * Deprecated: Use notifications 632 * 633 * Params: 634 * pixbuf = a #GdkPixbuf or %NULL 635 * 636 * Since: 2.10 637 */ 638 public void setFromPixbuf(Pixbuf pixbuf) 639 { 640 gtk_status_icon_set_from_pixbuf(gtkStatusIcon, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 641 } 642 643 /** 644 * Makes @status_icon display the stock icon with the id @stock_id. 645 * See gtk_status_icon_new_from_stock() for details. 646 * 647 * Deprecated: Use gtk_status_icon_set_from_icon_name() instead. 648 * 649 * Params: 650 * stockId = a stock icon id 651 * 652 * Since: 2.10 653 */ 654 public void setFromStock(string stockId) 655 { 656 gtk_status_icon_set_from_stock(gtkStatusIcon, Str.toStringz(stockId)); 657 } 658 659 /** 660 * Sets the has-tooltip property on @status_icon to @has_tooltip. 661 * See #GtkStatusIcon:has-tooltip for more information. 662 * 663 * Deprecated: Use notifications 664 * 665 * Params: 666 * hasTooltip = whether or not @status_icon has a tooltip 667 * 668 * Since: 2.16 669 */ 670 public void setHasTooltip(bool hasTooltip) 671 { 672 gtk_status_icon_set_has_tooltip(gtkStatusIcon, hasTooltip); 673 } 674 675 /** 676 * Sets the name of this tray icon. 677 * This should be a string identifying this icon. It is may be 678 * used for sorting the icons in the tray and will not be shown to 679 * the user. 680 * 681 * Deprecated: Use notifications 682 * 683 * Params: 684 * name = the name 685 * 686 * Since: 2.20 687 */ 688 public void setName(string name) 689 { 690 gtk_status_icon_set_name(gtkStatusIcon, Str.toStringz(name)); 691 } 692 693 /** 694 * Sets the #GdkScreen where @status_icon is displayed; if 695 * the icon is already mapped, it will be unmapped, and 696 * then remapped on the new screen. 697 * 698 * Deprecated: Use notifications 699 * 700 * Params: 701 * screen = a #GdkScreen 702 * 703 * Since: 2.12 704 */ 705 public void setScreen(Screen screen) 706 { 707 gtk_status_icon_set_screen(gtkStatusIcon, (screen is null) ? null : screen.getScreenStruct()); 708 } 709 710 /** 711 * Sets the title of this tray icon. 712 * This should be a short, human-readable, localized string 713 * describing the tray icon. It may be used by tools like screen 714 * readers to render the tray icon. 715 * 716 * Deprecated: Use notifications 717 * 718 * Params: 719 * title = the title 720 * 721 * Since: 2.18 722 */ 723 public void setTitle(string title) 724 { 725 gtk_status_icon_set_title(gtkStatusIcon, Str.toStringz(title)); 726 } 727 728 /** 729 * Sets @markup as the contents of the tooltip, which is marked up with 730 * the [Pango text markup language][PangoMarkupFormat]. 731 * 732 * This function will take care of setting #GtkStatusIcon:has-tooltip to %TRUE 733 * and of the default handler for the #GtkStatusIcon::query-tooltip signal. 734 * 735 * See also the #GtkStatusIcon:tooltip-markup property and 736 * gtk_tooltip_set_markup(). 737 * 738 * Deprecated: Use notifications 739 * 740 * Params: 741 * markup = the contents of the tooltip for @status_icon, or %NULL 742 * 743 * Since: 2.16 744 */ 745 public void setTooltipMarkup(string markup) 746 { 747 gtk_status_icon_set_tooltip_markup(gtkStatusIcon, Str.toStringz(markup)); 748 } 749 750 /** 751 * Sets @text as the contents of the tooltip. 752 * 753 * This function will take care of setting #GtkStatusIcon:has-tooltip to 754 * %TRUE and of the default handler for the #GtkStatusIcon::query-tooltip 755 * signal. 756 * 757 * See also the #GtkStatusIcon:tooltip-text property and 758 * gtk_tooltip_set_text(). 759 * 760 * Deprecated: Use notifications 761 * 762 * Params: 763 * text = the contents of the tooltip for @status_icon 764 * 765 * Since: 2.16 766 */ 767 public void setTooltipText(string text) 768 { 769 gtk_status_icon_set_tooltip_text(gtkStatusIcon, Str.toStringz(text)); 770 } 771 772 /** 773 * Shows or hides a status icon. 774 * 775 * Deprecated: Use notifications 776 * 777 * Params: 778 * visible = %TRUE to show the status icon, %FALSE to hide it 779 * 780 * Since: 2.10 781 */ 782 public void setVisible(bool visible) 783 { 784 gtk_status_icon_set_visible(gtkStatusIcon, visible); 785 } 786 787 int[string] connectedSignals; 788 789 void delegate(StatusIcon)[] onActivateListeners; 790 /** 791 * Gets emitted when the user activates the status icon. 792 * If and how status icons can activated is platform-dependent. 793 * 794 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 795 * be used by applications and should be wrapped by language bindings. 796 * 797 * Since: 2.10 798 */ 799 void addOnActivate(void delegate(StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 800 { 801 if ( "activate" !in connectedSignals ) 802 { 803 Signals.connectData( 804 this, 805 "activate", 806 cast(GCallback)&callBackActivate, 807 cast(void*)this, 808 null, 809 connectFlags); 810 connectedSignals["activate"] = 1; 811 } 812 onActivateListeners ~= dlg; 813 } 814 extern(C) static void callBackActivate(GtkStatusIcon* statusiconStruct, StatusIcon _statusicon) 815 { 816 foreach ( void delegate(StatusIcon) dlg; _statusicon.onActivateListeners ) 817 { 818 dlg(_statusicon); 819 } 820 } 821 822 bool delegate(GdkEventButton*, StatusIcon)[] onButtonPressListeners; 823 /** 824 * The ::button-press-event signal will be emitted when a button 825 * (typically from a mouse) is pressed. 826 * 827 * Whether this event is emitted is platform-dependent. Use the ::activate 828 * and ::popup-menu signals in preference. 829 * 830 * Params: 831 * event = the #GdkEventButton which triggered 832 * this signal 833 * 834 * Return: %TRUE to stop other handlers from being invoked 835 * for the event. %FALSE to propagate the event further. 836 * 837 * Since: 2.14 838 */ 839 void addOnButtonPress(bool delegate(GdkEventButton*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 840 { 841 if ( "button-press-event" !in connectedSignals ) 842 { 843 Signals.connectData( 844 this, 845 "button-press-event", 846 cast(GCallback)&callBackButtonPress, 847 cast(void*)this, 848 null, 849 connectFlags); 850 connectedSignals["button-press-event"] = 1; 851 } 852 onButtonPressListeners ~= dlg; 853 } 854 extern(C) static int callBackButtonPress(GtkStatusIcon* statusiconStruct, GdkEventButton* event, StatusIcon _statusicon) 855 { 856 foreach ( bool delegate(GdkEventButton*, StatusIcon) dlg; _statusicon.onButtonPressListeners ) 857 { 858 if ( dlg(event, _statusicon) ) 859 { 860 return 1; 861 } 862 } 863 864 return 0; 865 } 866 867 bool delegate(Event, StatusIcon)[] onButtonPressEventGenericListeners; 868 /** 869 * The ::button-press-event signal will be emitted when a button 870 * (typically from a mouse) is pressed. 871 * 872 * Whether this event is emitted is platform-dependent. Use the ::activate 873 * and ::popup-menu signals in preference. 874 * 875 * Params: 876 * event = the #GdkEventButton which triggered 877 * this signal 878 * 879 * Return: %TRUE to stop other handlers from being invoked 880 * for the event. %FALSE to propagate the event further. 881 * 882 * Since: 2.14 883 */ 884 void addOnButtonPress(bool delegate(Event, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 885 { 886 if ( "button-press-event-generic-event" !in connectedSignals ) 887 { 888 Signals.connectData( 889 this, 890 "button-press-event", 891 cast(GCallback)&callBackButtonPressEventGeneric, 892 cast(void*)this, 893 null, 894 connectFlags); 895 connectedSignals["button-press-event-generic-event"] = 1; 896 } 897 onButtonPressEventGenericListeners ~= dlg; 898 } 899 extern(C) static int callBackButtonPressEventGeneric(GtkStatusIcon* statusiconStruct, GdkEvent* event, StatusIcon _statusicon) 900 { 901 foreach ( bool delegate(Event, StatusIcon) dlg; _statusicon.onButtonPressEventGenericListeners ) 902 { 903 if ( dlg(ObjectG.getDObject!(Event)(event), _statusicon) ) 904 { 905 return 1; 906 } 907 } 908 909 return 0; 910 } 911 912 bool delegate(GdkEventButton*, StatusIcon)[] onButtonReleaseListeners; 913 /** 914 * The ::button-release-event signal will be emitted when a button 915 * (typically from a mouse) is released. 916 * 917 * Whether this event is emitted is platform-dependent. Use the ::activate 918 * and ::popup-menu signals in preference. 919 * 920 * Params: 921 * event = the #GdkEventButton which triggered 922 * this signal 923 * 924 * Return: %TRUE to stop other handlers from being invoked 925 * for the event. %FALSE to propagate the event further. 926 * 927 * Since: 2.14 928 */ 929 void addOnButtonRelease(bool delegate(GdkEventButton*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 930 { 931 if ( "button-release-event" !in connectedSignals ) 932 { 933 Signals.connectData( 934 this, 935 "button-release-event", 936 cast(GCallback)&callBackButtonRelease, 937 cast(void*)this, 938 null, 939 connectFlags); 940 connectedSignals["button-release-event"] = 1; 941 } 942 onButtonReleaseListeners ~= dlg; 943 } 944 extern(C) static int callBackButtonRelease(GtkStatusIcon* statusiconStruct, GdkEventButton* event, StatusIcon _statusicon) 945 { 946 foreach ( bool delegate(GdkEventButton*, StatusIcon) dlg; _statusicon.onButtonReleaseListeners ) 947 { 948 if ( dlg(event, _statusicon) ) 949 { 950 return 1; 951 } 952 } 953 954 return 0; 955 } 956 957 bool delegate(Event, StatusIcon)[] onButtonReleaseEventGenericListeners; 958 /** 959 * The ::button-release-event signal will be emitted when a button 960 * (typically from a mouse) is released. 961 * 962 * Whether this event is emitted is platform-dependent. Use the ::activate 963 * and ::popup-menu signals in preference. 964 * 965 * Params: 966 * event = the #GdkEventButton which triggered 967 * this signal 968 * 969 * Return: %TRUE to stop other handlers from being invoked 970 * for the event. %FALSE to propagate the event further. 971 * 972 * Since: 2.14 973 */ 974 void addOnButtonRelease(bool delegate(Event, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 975 { 976 if ( "button-release-event-generic-event" !in connectedSignals ) 977 { 978 Signals.connectData( 979 this, 980 "button-release-event", 981 cast(GCallback)&callBackButtonReleaseEventGeneric, 982 cast(void*)this, 983 null, 984 connectFlags); 985 connectedSignals["button-release-event-generic-event"] = 1; 986 } 987 onButtonReleaseEventGenericListeners ~= dlg; 988 } 989 extern(C) static int callBackButtonReleaseEventGeneric(GtkStatusIcon* statusiconStruct, GdkEvent* event, StatusIcon _statusicon) 990 { 991 foreach ( bool delegate(Event, StatusIcon) dlg; _statusicon.onButtonReleaseEventGenericListeners ) 992 { 993 if ( dlg(ObjectG.getDObject!(Event)(event), _statusicon) ) 994 { 995 return 1; 996 } 997 } 998 999 return 0; 1000 } 1001 1002 void delegate(uint, uint, StatusIcon)[] onPopupMenuListeners; 1003 /** 1004 * Gets emitted when the user brings up the context menu 1005 * of the status icon. Whether status icons can have context 1006 * menus and how these are activated is platform-dependent. 1007 * 1008 * The @button and @activate_time parameters should be 1009 * passed as the last to arguments to gtk_menu_popup(). 1010 * 1011 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 1012 * be used by applications and should be wrapped by language bindings. 1013 * 1014 * Params: 1015 * button = the button that was pressed, or 0 if the 1016 * signal is not emitted in response to a button press event 1017 * activateTime = the timestamp of the event that 1018 * triggered the signal emission 1019 * 1020 * Since: 2.10 1021 */ 1022 void addOnPopupMenu(void delegate(uint, uint, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1023 { 1024 if ( "popup-menu" !in connectedSignals ) 1025 { 1026 Signals.connectData( 1027 this, 1028 "popup-menu", 1029 cast(GCallback)&callBackPopupMenu, 1030 cast(void*)this, 1031 null, 1032 connectFlags); 1033 connectedSignals["popup-menu"] = 1; 1034 } 1035 onPopupMenuListeners ~= dlg; 1036 } 1037 extern(C) static void callBackPopupMenu(GtkStatusIcon* statusiconStruct, uint button, uint activateTime, StatusIcon _statusicon) 1038 { 1039 foreach ( void delegate(uint, uint, StatusIcon) dlg; _statusicon.onPopupMenuListeners ) 1040 { 1041 dlg(button, activateTime, _statusicon); 1042 } 1043 } 1044 1045 bool delegate(int, int, bool, Tooltip, StatusIcon)[] onQueryTooltipListeners; 1046 /** 1047 * Emitted when the hover timeout has expired with the 1048 * cursor hovering above @status_icon; or emitted when @status_icon got 1049 * focus in keyboard mode. 1050 * 1051 * Using the given coordinates, the signal handler should determine 1052 * whether a tooltip should be shown for @status_icon. If this is 1053 * the case %TRUE should be returned, %FALSE otherwise. Note that if 1054 * @keyboard_mode is %TRUE, the values of @x and @y are undefined and 1055 * should not be used. 1056 * 1057 * The signal handler is free to manipulate @tooltip with the therefore 1058 * destined function calls. 1059 * 1060 * Whether this signal is emitted is platform-dependent. 1061 * For plain text tooltips, use #GtkStatusIcon:tooltip-text in preference. 1062 * 1063 * Params: 1064 * x = the x coordinate of the cursor position where the request has been 1065 * emitted, relative to @status_icon 1066 * y = the y coordinate of the cursor position where the request has been 1067 * emitted, relative to @status_icon 1068 * keyboardMode = %TRUE if the tooltip was trigged using the keyboard 1069 * tooltip = a #GtkTooltip 1070 * 1071 * Return: %TRUE if @tooltip should be shown right now, %FALSE otherwise. 1072 * 1073 * Since: 2.16 1074 */ 1075 void addOnQueryTooltip(bool delegate(int, int, bool, Tooltip, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1076 { 1077 if ( "query-tooltip" !in connectedSignals ) 1078 { 1079 Signals.connectData( 1080 this, 1081 "query-tooltip", 1082 cast(GCallback)&callBackQueryTooltip, 1083 cast(void*)this, 1084 null, 1085 connectFlags); 1086 connectedSignals["query-tooltip"] = 1; 1087 } 1088 onQueryTooltipListeners ~= dlg; 1089 } 1090 extern(C) static int callBackQueryTooltip(GtkStatusIcon* statusiconStruct, int x, int y, bool keyboardMode, GtkTooltip* tooltip, StatusIcon _statusicon) 1091 { 1092 foreach ( bool delegate(int, int, bool, Tooltip, StatusIcon) dlg; _statusicon.onQueryTooltipListeners ) 1093 { 1094 if ( dlg(x, y, keyboardMode, ObjectG.getDObject!(Tooltip)(tooltip), _statusicon) ) 1095 { 1096 return 1; 1097 } 1098 } 1099 1100 return 0; 1101 } 1102 1103 bool delegate(GdkEventScroll*, StatusIcon)[] onScrollListeners; 1104 /** 1105 * The ::scroll-event signal is emitted when a button in the 4 to 7 1106 * range is pressed. Wheel mice are usually configured to generate 1107 * button press events for buttons 4 and 5 when the wheel is turned. 1108 * 1109 * Whether this event is emitted is platform-dependent. 1110 * 1111 * Params: 1112 * event = the #GdkEventScroll which triggered 1113 * this signal 1114 * 1115 * Return: %TRUE to stop other handlers from being invoked for the event. 1116 * %FALSE to propagate the event further. 1117 * 1118 * Since: 2.16 1119 */ 1120 void addOnScroll(bool delegate(GdkEventScroll*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1121 { 1122 if ( "scroll-event" !in connectedSignals ) 1123 { 1124 Signals.connectData( 1125 this, 1126 "scroll-event", 1127 cast(GCallback)&callBackScroll, 1128 cast(void*)this, 1129 null, 1130 connectFlags); 1131 connectedSignals["scroll-event"] = 1; 1132 } 1133 onScrollListeners ~= dlg; 1134 } 1135 extern(C) static int callBackScroll(GtkStatusIcon* statusiconStruct, GdkEventScroll* event, StatusIcon _statusicon) 1136 { 1137 foreach ( bool delegate(GdkEventScroll*, StatusIcon) dlg; _statusicon.onScrollListeners ) 1138 { 1139 if ( dlg(event, _statusicon) ) 1140 { 1141 return 1; 1142 } 1143 } 1144 1145 return 0; 1146 } 1147 1148 bool delegate(Event, StatusIcon)[] onScrollEventGenericListeners; 1149 /** 1150 * The ::scroll-event signal is emitted when a button in the 4 to 7 1151 * range is pressed. Wheel mice are usually configured to generate 1152 * button press events for buttons 4 and 5 when the wheel is turned. 1153 * 1154 * Whether this event is emitted is platform-dependent. 1155 * 1156 * Params: 1157 * event = the #GdkEventScroll which triggered 1158 * this signal 1159 * 1160 * Return: %TRUE to stop other handlers from being invoked for the event. 1161 * %FALSE to propagate the event further. 1162 * 1163 * Since: 2.16 1164 */ 1165 void addOnScroll(bool delegate(Event, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1166 { 1167 if ( "scroll-event-generic-event" !in connectedSignals ) 1168 { 1169 Signals.connectData( 1170 this, 1171 "scroll-event", 1172 cast(GCallback)&callBackScrollEventGeneric, 1173 cast(void*)this, 1174 null, 1175 connectFlags); 1176 connectedSignals["scroll-event-generic-event"] = 1; 1177 } 1178 onScrollEventGenericListeners ~= dlg; 1179 } 1180 extern(C) static int callBackScrollEventGeneric(GtkStatusIcon* statusiconStruct, GdkEvent* event, StatusIcon _statusicon) 1181 { 1182 foreach ( bool delegate(Event, StatusIcon) dlg; _statusicon.onScrollEventGenericListeners ) 1183 { 1184 if ( dlg(ObjectG.getDObject!(Event)(event), _statusicon) ) 1185 { 1186 return 1; 1187 } 1188 } 1189 1190 return 0; 1191 } 1192 1193 bool delegate(int, StatusIcon)[] onSizeChangedListeners; 1194 /** 1195 * Gets emitted when the size available for the image 1196 * changes, e.g. because the notification area got resized. 1197 * 1198 * Params: 1199 * size = the new size 1200 * 1201 * Return: %TRUE if the icon was updated for the new 1202 * size. Otherwise, GTK+ will scale the icon as necessary. 1203 * 1204 * Since: 2.10 1205 */ 1206 void addOnSizeChanged(bool delegate(int, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1207 { 1208 if ( "size-changed" !in connectedSignals ) 1209 { 1210 Signals.connectData( 1211 this, 1212 "size-changed", 1213 cast(GCallback)&callBackSizeChanged, 1214 cast(void*)this, 1215 null, 1216 connectFlags); 1217 connectedSignals["size-changed"] = 1; 1218 } 1219 onSizeChangedListeners ~= dlg; 1220 } 1221 extern(C) static int callBackSizeChanged(GtkStatusIcon* statusiconStruct, int size, StatusIcon _statusicon) 1222 { 1223 foreach ( bool delegate(int, StatusIcon) dlg; _statusicon.onSizeChangedListeners ) 1224 { 1225 if ( dlg(size, _statusicon) ) 1226 { 1227 return 1; 1228 } 1229 } 1230 1231 return 0; 1232 } 1233 }