CPresetBrowser.hpp

Go to the documentation of this file.
00001 #ifndef __CPresetBrowser__
00002 #define __CPresetBrowser__
00003 
00004 #include "CControlPanel.hpp"
00005 #include "CMomentaryButton.hpp"
00006 #include "CComboBox.hpp"
00007 #include "CDiskPathMenuItem.hpp"
00008 #include "IPresetHandler.hpp"
00009 #include <Host/CFileManager.hpp>
00010 
00011 //  ===========================================================================
00012 
00013 using Exponent::GUI::Controls::CControlPanel;
00014 using Exponent::GUI::Controls::CMomentaryButton;
00015 using Exponent::GUI::Controls::CComboBox;
00016 using Exponent::GUI::Controls::CDiskPathMenuItem;
00017 using Exponent::GUI::Controls::IPresetHandler;
00018 using Exponent::Host::CFileManager;
00019 
00020 //  ===========================================================================
00021 
00022 namespace Exponent
00023 {
00024     namespace GUI
00025     {
00026         namespace Controls
00027         {
00046             class CPresetBrowser : public CControlPanel, public IActionListener
00047             {
00049                 EXPONENT_CLASS_DECLARATION;
00052 //  ===========================================================================
00053         
00054             public:
00055 
00056 //  ===========================================================================
00057 
00062                 struct SPresetBrowserSetup
00063                 {
00064                     CDimension m_headArea;              
00065                     CDimension m_selectorArea;          
00067                     CRect m_bankComboArea;              
00068                     CRect m_loadButtonArea;             
00069                     CRect m_saveButtonArea;             
00071                     CFont *m_theFont;                   
00072                     CAlphaColour m_textColour;          
00074                     IImage *m_bankComboUpImage;         
00075                     IImage *m_bankComboDownImage;       
00076                     IImage *m_saveButtonUpImage;        
00077                     IImage *m_saveButtonDownImage;      
00078                     IImage *m_loadButtonUpImage;        
00079                     IImage *m_loadButtonDownImage;      
00081                     CSystemString m_rootPath;           
00086                     void initialise()
00087                     {
00088                         NULL_POINTER(m_bankComboUpImage);
00089                         NULL_POINTER(m_bankComboDownImage);
00090                         NULL_POINTER(m_saveButtonUpImage);
00091                         NULL_POINTER(m_saveButtonDownImage);
00092                         NULL_POINTER(m_loadButtonUpImage);
00093                         NULL_POINTER(m_loadButtonDownImage);
00094                         NULL_POINTER(m_theFont);
00095                     }
00096                 };
00097 
00098 //  ===========================================================================
00099 
00107                 CPresetBrowser(IControlRoot *root, const long uniqueId, const CRect &area, IActionListener *listener = NULL);
00108 
00112                 virtual ~CPresetBrowser();
00113 
00114 //  ===========================================================================
00115 
00120                 void initialise(const SPresetBrowserSetup &setup);
00121 
00127                 void setMenuWindowAttributes(CWindowAttributes *windowAttributes, const SMenuColours &colours);
00128 
00129 //  ===========================================================================
00130 
00136                 virtual void handleActionEvent(const CActionEvent &event);
00137 
00142                 virtual void registerPresetHandler(IPresetHandler *handler) { m_presetHandler = handler; }
00143 
00144 //  ===========================================================================
00145 
00146             protected:
00147 
00148 //  ===========================================================================
00149 
00154                 class CPresetBrowserSelector : public CControlPanel, public IActionListener
00155                 {
00157                     EXPONENT_CLASS_DECLARATION;
00160 //  ===========================================================================
00161             
00162                 public:
00163 
00164 //  ===========================================================================
00165 
00175                     CPresetBrowserSelector(IControlRoot *root, const long uniqueId, const CRect &area, CFont *font, IActionListener *listener = NULL, IPresetHandler *handler = NULL);
00176 
00180                     virtual ~CPresetBrowserSelector();
00181 
00182 //  ===========================================================================
00183 
00189                     virtual void handleActionEvent(const CActionEvent &event);
00190 
00191 //  ===========================================================================
00192 
00197                     void setBankPath(const CSystemString &bankPath);
00198 
00203                     const CSystemString &getSelectedPath() const { return m_filePath; }
00204 
00209                     void setFontColour(const CAlphaColour &colour) { m_fontColour = colour; }
00210 
00211 //  ===========================================================================
00212 
00213                 protected:
00214 
00215 //  ===========================================================================
00216 
00221                     class CPresetTextLabel : public CTextLabel
00222                     {
00224                         EXPONENT_CLASS_DECLARATION;
00227 //  ===========================================================================
00228             
00229                     public:
00230 
00231 //  ===========================================================================
00232 
00240                         CPresetTextLabel(IControlRoot *root, const long uniqueId, const CRect &area, const CString &text);
00241 
00245                         virtual ~CPresetTextLabel();
00246 
00247 //  ===========================================================================
00248 
00253                         virtual void drawControl(CGraphics &graphics);
00254 
00259                         virtual void handleLeftButtonDown(CMouseEvent &event);
00260 
00265                         virtual void handleDoubleClick(CMouseEvent &event);
00266 
00267 //  ===========================================================================
00268 
00273                         void selectLabel(const bool selected = true);
00274 
00279                         long getSelectionState() const;
00280 
00285                         const CString &getText() const { return m_text; }
00286 
00287 //  ===========================================================================
00288 
00289                     protected:
00290 
00291 //  ===========================================================================
00292 
00293                         bool m_selected;                                        
00294                         bool m_load;                                            
00295                     };
00296 
00297 //  ===========================================================================
00298 
00299                     long m_pageIndex;                                           
00300                     TCountedPointerArray<CFileInformation> m_bankFileList;      
00301                     IPresetHandler *m_presetHandler;                            
00303                     CSystemString m_selectedPath;                               
00304                     CSystemString m_filePath;                                   
00305                     CFont *m_theFont;                                           
00306                     CAlphaColour m_fontColour;                                  
00307                 };
00308 
00309 //  ===========================================================================
00310 
00315                 class CPresetBrowserHead : public CControlPanel, public IActionListener
00316                 {
00318                     EXPONENT_CLASS_DECLARATION;
00321 //  ===========================================================================
00322             
00323                 public:
00324 
00325 //  ===========================================================================
00326 
00331                     struct SPresetBrowserHeadSetup
00332                     {
00333                         CRect m_bankComboRect;          
00334                         CRect m_loadButtonRect;         
00335                         CRect m_saveButtonRect;         
00337                         CSystemString m_rootPath;       
00339                         IImage *m_bankComboUpImage;     
00340                         IImage *m_bankComboDownImage;   
00341                         IImage *m_saveButtonUpImage;    
00342                         IImage *m_saveButtonDownImage;  
00343                         IImage *m_loadButtonUpImage;    
00344                         IImage *m_loadButtonDownImage;  
00346                         CFont *m_theFont;               
00347                         CAlphaColour m_textColour;      
00348                     };
00349 
00350 //  ===========================================================================
00351 
00361                     CPresetBrowserHead(IControlRoot *root, const long uniqueId, const CRect &area, IActionListener *listener = NULL, IPresetHandler *presetHandler = NULL, CPresetBrowserSelector *selector = NULL);
00362 
00366                     virtual ~CPresetBrowserHead();
00367 
00368 //  ===========================================================================
00369 
00374                     const CSystemString &getBankPath() const { return m_bankPath; }
00375 
00376 //  ===========================================================================
00377 
00382                     void intialise(const SPresetBrowserHeadSetup &setup);
00383 
00389                     void setMenuWindowAttributes(CWindowAttributes *windowAttributes, const SMenuColours &colours);
00390 
00396                     virtual void handleActionEvent(const CActionEvent &event);
00397 
00398 //  ===========================================================================
00399 
00400                 protected:
00401 
00402 //  ===========================================================================
00403 
00407                     void createBankMenu();
00408 
00409 //  ===========================================================================
00410 
00415                     enum EControlIds
00416                     {
00417                         e_bankCombo = 0,                    
00418                         e_loadButton,                       
00419                         e_saveButton,                       
00420                     };
00421 
00422 //  ===========================================================================
00423 
00424                     CSystemString m_bankPath;               
00425                     CComboBox *m_bankCombo;                 
00426                     CMenu *m_bankMenu;                      
00427                     CMomentaryButton *m_loadButton;         
00428                     CMomentaryButton *m_saveButton;         
00429                     CSystemString m_rootPath;               
00430                     IPresetHandler *m_presetHandler;        
00431                     CPresetBrowserSelector *m_selector;     
00432                 };
00433 
00434 //  ===========================================================================
00435 
00436                 CPresetBrowserSelector *m_selector;         
00437                 CPresetBrowserHead *m_presetHead;           
00438                 CSystemString m_rootPath;                   
00439                 IPresetHandler *m_presetHandler;            
00441             };
00442         }
00443     }
00444 }
00445 #endif    // End of CPresetBrowser.hpp

Infinity API - CPresetBrowser.hpp Source File generated on 7 Mar 2007