ctrl_tree.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef CTRL_TREE_HPP
00026 #define CTRL_TREE_HPP
00027
00028 #include "ctrl_generic.hpp"
00029 #include "../utils/observer.hpp"
00030 #include "../utils/var_tree.hpp"
00031
00032 class OSGraphics;
00033 class GenericFont;
00034 class GenericBitmap;
00035
00036
00037 class CtrlTree: public CtrlGeneric, public Observer<VarTree, tree_update>,
00038 public Observer<VarPercent>
00039 {
00040 public:
00041 CtrlTree( intf_thread_t *pIntf,
00042 VarTree &rTree,
00043 const GenericFont &rFont,
00044 const GenericBitmap *pBgBitmap,
00045 const GenericBitmap *pItemBitmap,
00046 const GenericBitmap *pOpenBitmap,
00047 const GenericBitmap *pClosedBitmap,
00048 uint32_t fgColor,
00049 uint32_t playColor,
00050 uint32_t bgColor1,
00051 uint32_t bgColor2,
00052 uint32_t selColor,
00053 const UString &rHelp,
00054 VarBool *pVisible,
00055 VarBool *pFlat );
00056 virtual ~CtrlTree();
00057
00058
00059 virtual void handleEvent( EvtGeneric &rEvent );
00060
00061
00062 virtual bool mouseOver( int x, int y ) const;
00063
00064
00065 virtual void draw( OSGraphics &rImage, int xDest, int yDest );
00066
00067
00068 virtual void onResize();
00069
00070
00071 virtual bool isFocusable() const { return true; }
00072
00073
00074 virtual string getType() const { return "tree"; }
00075
00076
00077
00078
00079 bool ensureVisible( VarTree::Iterator item );
00080
00081
00082
00083
00084 bool ensureVisible( int itemIndex );
00085
00086 private:
00087
00088 VarTree &m_rTree;
00089
00090 const GenericFont &m_rFont;
00091
00092 const GenericBitmap *m_pBgBitmap;
00093
00094
00095
00096 const GenericBitmap *m_pItemBitmap;
00097
00098 const GenericBitmap *m_pOpenBitmap;
00099
00100 const GenericBitmap *m_pClosedBitmap;
00101
00102 uint32_t m_fgColor;
00103
00104 uint32_t m_playColor;
00105
00106 uint32_t m_bgColor1, m_bgColor2;
00107
00108 uint32_t m_selColor;
00109
00110 VarTree *m_pLastSelected;
00111
00112 OSGraphics *m_pImage;
00113
00114 VarTree::Iterator m_firstPos;
00115
00116
00117 bool m_dontMove;
00118
00119
00120 bool m_flat;
00121
00122
00123 virtual void onUpdate( Subject<VarTree, tree_update> &rTree ,
00124 tree_update *);
00125
00126
00127 virtual void onUpdate( Subject<VarPercent> &rPercent , void *);
00128
00129
00130 virtual void onPositionChange();
00131
00132
00133 int maxItems();
00134
00135
00136 int itemHeight();
00137
00138
00139 int itemImageWidth();
00140
00141
00142 void autoScroll();
00143
00144
00145 void makeImage();
00146
00147
00148
00149
00150
00151
00152 VarTree::Iterator findItemAtPos( int n );
00153 };
00154
00155 #endif