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