nux-1.16.0
|
00001 /* 00002 * Copyright 2010 Inalogic® Inc. 00003 * 00004 * This program is free software: you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License, as 00006 * published by the Free Software Foundation; either version 2.1 or 3.0 00007 * of the License. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranties of 00011 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 00012 * PURPOSE. See the applicable version of the GNU Lesser General Public 00013 * License for more details. 00014 * 00015 * You should have received a copy of both the GNU Lesser General Public 00016 * License along with this program. If not, see <http://www.gnu.org/licenses/> 00017 * 00018 * Authored by: Jay Taoko <jaytaoko@inalogic.com> 00019 * 00020 */ 00021 00022 00023 #ifndef ACTIONITEM_H 00024 #define ACTIONITEM_H 00025 00026 #include "NuxGraphics/GraphicsEngine.h" 00027 00028 namespace nux 00029 { 00030 00031 class MenuBar; 00032 class MenuPage; 00033 00034 class ActionItem: public Object 00035 { 00036 public: 00037 NUX_DECLARE_OBJECT_TYPE (ActionItem, Object); 00038 00039 ActionItem (const TCHAR *label = 0, int UserValue = 0, NUX_FILE_LINE_PROTO); 00040 ~ActionItem(); 00041 00042 void Activate (bool b); 00043 void Trigger() const; 00044 00045 void DrawAsMenuItem (GraphicsEngine &GfxContext, InputArea &area, bool is_highlighted, bool draw_icone); 00046 void DrawAsToolButton (GraphicsEngine &GfxContext, InputArea &area); 00047 void Enable (bool b); 00048 bool isEnabled() const; 00049 00050 void SetLabel (const TCHAR *label); 00051 const TCHAR *GetLabel() const; 00052 int GetUserValue() const 00053 { 00054 return m_UserValue; 00055 } 00056 00057 // void SetMenu(MenuPage* menu); 00058 // MenuPage* GetMenu() const; 00059 00060 void SetFont (ObjectPtr<FontTexture> font); 00061 void SetIcon (const BaseTexture* icon); 00062 const BaseTexture* GetIcon(); 00063 00064 sigc::signal<void> sigAction; 00065 00066 private: 00068 int m_UserValue; 00069 BaseTexture* m_Icon; 00070 NString m_Label; 00071 bool m_IsActivated; 00072 MenuPage *m_Menu; 00073 bool m_Enable; 00074 00075 friend class MenuBar; 00076 friend class MenuPage; 00077 }; 00078 00079 00080 00081 } 00082 00083 #endif // ACTIONITEM_H