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