nux-0.9.46

Nux/ComboBoxComplex.h

Go to the documentation of this file.
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 COMBOBOX_COMPLEX_H
00024 #define COMBOBOX_COMPLEX_H
00025 
00026 #include "AbstractComboBox.h"
00027 
00028 namespace nux
00029 {
00030 
00031   class Menu;
00032   class ActionItem;
00033   class PopUpWindow;
00034   class ListControl;
00035   class TableCtrl;
00036   class TableItem;
00037   class HLayout;
00038 
00039   class ComboBoxComplex : public AbstractComboBox
00040   {
00041   public:
00042     ComboBoxComplex (NUX_FILE_LINE_PROTO);
00043     ~ComboBoxComplex();
00044     virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
00045 
00046 //    // make the class abstract
00047 //    virtual void Draw(GraphicsEngine& GfxContext, bool force_draw) = 0;
00048 //    virtual void DrawContent(GraphicsEngine& GfxContext, bool force_draw) = 0;
00049 //    virtual void PostDraw(GraphicsEngine& GfxContext, bool force_draw) = 0;
00050 
00051     void SetPopupWindowSize (unsigned int width, unsigned int height);
00052     void SetPopupWidth (unsigned int width);
00053 
00054   protected:
00055     virtual long PostLayoutManagement (long LayoutResult);
00056 
00057   public:
00058     void AddItem (TableItem *item);
00059     void RemoveItem (TableItem *item);
00060     void RemoveAllItem();
00061 
00062     // emitters
00063     void OnMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
00064     void OnMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags);
00065     void OnPopupStop();
00066 
00067     // signals
00068     void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
00069     void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags);
00070     void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
00071     void RecvSigActionTriggered (TableCtrl &table, TableItem &item, unsigned int row, unsigned int column);
00072     void RecvSigTerminateMenuCascade();
00073 
00074     sigc::signal<void, TableItem &> sigSelectedItem;
00075 
00076     const TableItem *GetSelection() const
00077     {
00078       return m_SelectedTreeNode;
00079     }
00080 
00081   protected:
00082     void InitializeWidgets();
00083     void InitializeLayout();
00084     void DestroyLayout();
00085 
00086   protected:
00087 //    InputArea m_ComboArea;
00088 //    InputArea m_Button;
00089 //    bool m_MenuIsActive;
00090     const TableItem *m_SelectedTreeNode;
00091 //     bool m_IsOpeningMenu;
00092 
00093     PopUpWindow    *m_PopupWindow;
00094     ListControl    *m_ListBox;
00095     HLayout        *m_Layout;
00096   };
00097 
00098 }
00099 
00100 #endif // COMBOBOX_COMPLEX_H