FXTrayIcon.h

00001 /*
00002 FoxTray, system tray icon for the FOX Toolkit
00003 
00004 Copyright (c) 2008, Hendrik Rittich
00005 All rights reserved.
00006 
00007 Redistribution and use in source and binary forms, with or without 
00008 modification, are permitted provided that the following conditions are
00009 met:
00010 
00011     * Redistributions of source code must retain the above copyright
00012       notice, this list of conditions and the following disclaimer.
00013     * Redistributions in binary form must reproduce the above copyright
00014       notice, this list of conditions and the following disclaimer in 
00015       the documentation and/or other materials provided with the 
00016       distribution.
00017 
00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00019 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00020 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00021 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00022 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00023 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00024 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00026 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00028 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 */
00030 
00031 #ifndef FX_TRAY_ICON_H
00032 #define FX_TRAY_ICON_H
00033 
00034 #include "fx.h"
00035 
00036 namespace FX {
00037 
00044 enum {
00045     TRAY_MENU_ON_LEFT = 0x0001, 
00046     TRAY_MENU_ON_RIGHT = 0x0002, 
00047     TRAY_CMD_ON_LEFT = 0x0004, 
00048     TRAY_CMD_ON_RIGHT = 0x0008 
00049 };
00056 class FXTrayIcon : public FXTopWindow
00057 {
00058     FXDECLARE(FXTrayIcon)
00059 public: 
00061     enum {
00062         ID_BUTTON = FXTopWindow::ID_LAST,
00063         ID_LAST
00064     };
00076     FXTrayIcon(FXApp* app, const FXString& text, FXIcon* icon, 
00077             FXPopup* pup = NULL, FXObject* target = 0, FXSelector sel = 0,
00078             FXuint opts = TRAY_MENU_ON_LEFT);
00079 
00080     ~FXTrayIcon(); 
00081 
00083     void create();
00084 
00086     void mapToManager(); 
00087 
00088     long onLeft(FXObject*, FXSelector, void*);
00089     long onRight(FXObject* obj, FXSelector, void* ptr);
00090     long onClose(FXObject*, FXSelector, void*);
00094     void setMenu(FXPopup* pup) { mPup = pup; }
00096     FXPopup* getMenu() const { return mPup; }
00097 
00099     void setIcon(FXIcon* icon);
00101     FXIcon* getIcon() const;
00102 
00104     void setText(const FXString& text);
00106     const FXString& getText() const;
00107 
00108 private:
00109     FXPopup* mPup;
00110     FXuint mOpts;
00111     FXButton* btn;
00112 
00113     void popup(FXint x, FXint y);
00114     FXTrayIcon() {}
00115 };
00116 
00121 }
00122 
00123 #endif
00124 

Generated on Sat Oct 18 14:30:53 2008 for FoxTray by  doxygen 1.5.1