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 #ifndef VSPLITTER_H 00023 #define VSPLITTER_H 00024 00025 namespace nux 00026 { 00027 class layout; 00028 00029 class VSplitter: public View 00030 { 00031 NUX_DECLARE_OBJECT_TYPE (VSplitter, View); 00032 public: 00033 VSplitter (NUX_FILE_LINE_PROTO); 00034 ~VSplitter(); 00035 00036 virtual void Draw (GraphicsEngine &GfxContext, bool force_draw); 00037 virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw); 00038 virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw); 00039 00040 void AddWidget (Area *ic, float stretchfactor); 00041 void ResetSplitConfig(); 00042 00043 void clearContent(); 00044 00045 void OnSplitterMouseDown (t_s32 x, t_s32 y, unsigned long button_flags, unsigned long key_flags, t_s32 header_pos); 00046 void OnSplitterMouseUp (t_s32 x, t_s32 y, unsigned long button_flags, unsigned long key_flags, t_s32 header_pos); 00047 void OnSplitterMouseDrag (t_s32 x, t_s32 y, t_s32 dx, t_s32 dy, unsigned long button_flags, unsigned long key_flags, t_s32 header_pos); 00048 00049 virtual void OverlayDrawing (GraphicsEngine &GfxContext); 00050 00052 /* 00053 Return true if this object can break the layout, meaning, the layout can be done on the composition layout only without 00054 recomputing the whole window layout. 00055 Inherited from Area 00056 */ 00057 virtual bool CanBreakLayout() 00058 { 00059 return true; 00060 } 00061 00062 virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type); 00063 00064 protected: 00065 virtual long ComputeChildLayout(); 00066 virtual void DoneRedraw(); 00067 void ResizeSplitter (t_s32 header_pos); 00068 //void ContinuousSplitterAdjustment(); 00069 void setResizeOnSplitterRelease (bool b) 00070 { 00071 m_ResizeOnSplitterRelease = b; 00072 } 00073 bool getResizeOnSplitterRelease() 00074 { 00075 return m_ResizeOnSplitterRelease; 00076 } 00077 00078 virtual bool AcceptKeyNavFocus(); 00079 virtual Area* KeyNavIteration(KeyNavDirection direction); 00080 00081 private: 00082 00083 typedef InputArea MySplitter; 00084 std::vector<Area *> m_InterfaceObject; 00085 std::vector<MySplitter *> m_SplitterObject; 00086 std::vector<float> m_SplitConfig; 00087 00088 Point m_point; 00089 bool new_addition; 00090 00091 bool m_ResizeOnSplitterRelease; 00092 t_s32 m_current_width; 00093 t_s32 m_current_height; 00094 t_s32 m_current_x; 00095 t_s32 m_current_y; 00096 00097 bool m_initial_config; 00098 00099 // splitter bar differential position; 00100 t_s32 mvt_dx, mvt_dy; 00101 t_s32 m_focus_splitter_index; 00102 }; 00103 00104 } 00105 00106 #endif // VSPLITTER_H 00107 00108