nux-0.9.48
|
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 HSPLITTER_H 00024 #define HSPLITTER_H 00025 00026 00027 namespace nux 00028 { 00029 00030 class Layout; 00031 00032 class HSplitter: public View 00033 { 00034 NUX_DECLARE_OBJECT_TYPE (HSplitter, View); 00035 public: 00036 HSplitter (NUX_FILE_LINE_PROTO); 00037 ~HSplitter(); 00038 00039 virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); 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 typedef InputArea MySplitter; 00082 std::vector<Area *> m_InterfaceObject; 00083 std::vector<MySplitter *> m_SplitterObject; 00084 std::vector<float> m_SplitConfig; 00085 00086 Point m_point; 00087 bool new_addition; 00088 00089 bool m_ResizeOnSplitterRelease; 00090 t_s32 m_current_width; 00091 t_s32 m_current_height; 00092 t_s32 m_current_x; 00093 t_s32 m_current_y; 00094 00095 bool m_initial_config; 00096 00097 // splitter bar differential position; 00098 t_s32 mvt_dx, mvt_dy; 00099 t_s32 m_focus_splitter_index; 00100 }; 00101 00102 } 00103 00104 #endif // HSPLITTER_H 00105 00106