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