diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/public/vgui_controls/Splitter.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/public/vgui_controls/Splitter.h')
| -rw-r--r-- | mp/src/public/vgui_controls/Splitter.h | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/mp/src/public/vgui_controls/Splitter.h b/mp/src/public/vgui_controls/Splitter.h index ad8173db..f788ebcb 100644 --- a/mp/src/public/vgui_controls/Splitter.h +++ b/mp/src/public/vgui_controls/Splitter.h @@ -1,98 +1,98 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//===========================================================================//
-
-#ifndef SPLITTER_H
-#define SPLITTER_H
-
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include <vgui_controls/EditablePanel.h>
-
-namespace vgui
-{
-
-enum SplitterMode_t
-{
- SPLITTER_MODE_HORIZONTAL = 0,
- SPLITTER_MODE_VERTICAL
-};
-
-
-class SplitterHandle;
-class SplitterChildPanel;
-
-//-----------------------------------------------------------------------------
-// Purpose: Thin line used to divide sections, can be moved dragged!
-//-----------------------------------------------------------------------------
-class Splitter : public EditablePanel
-{
- DECLARE_CLASS_SIMPLE( Splitter, EditablePanel );
-
-public:
- // nCount is the number of splitters to create.
- // NOTE: The constructor here will create (nCount+1) EditablePanel children
- // and name them child0...childN for .res file purposes.
- Splitter( Panel *parent, const char *name, SplitterMode_t mode, int nCount );
- ~Splitter();
-
- // Evenly respace all splitters
- void EvenlyRespaceSplitters();
-
- // respace splitters using given fractions (must sum to 1)
- void RespaceSplitters( float *flFractions );
-
- // Inherited from Panel
- virtual void ApplySettings(KeyValues *inResourceData);
- virtual void GetSettings( KeyValues *outResourceData );
- virtual void PerformLayout();
- virtual void OnSizeChanged(int newWide, int newTall);
- virtual void ApplyUserConfigSettings(KeyValues *userConfig);
- virtual void GetUserConfigSettings(KeyValues *userConfig);
- virtual bool HasUserConfigSettings() { return true; }
-
- // Sets the splitter color
- void SetSplitterColor( Color c );
-
- // Enables borders on the splitters
- void EnableBorders( bool bEnable );
-
- // Locks the size of a particular child in pixels.
- void LockChildSize( int nChildIndex, int nSize );
- void UnlockChildSize( int nChildIndex );
-
-private:
- void RecreateSplitters( int nCount );
-
- struct SplitterInfo_t
- {
- SplitterChildPanel *m_pPanel; // This panel is to the left or above the handle
- SplitterHandle *m_pHandle;
- float m_flPos;
- bool m_bLocked;
- int m_nLockedSize;
- };
-
- int GetPosRange();
- int GetSplitterCount() const;
- int GetSplitterPosition( int nIndex );
- void SetSplitterPosition( int nIndex, int nPos );
- int GetSubPanelCount() const;
- int ComputeLockedSize( int nStartingIndex );
-
- CUtlVector< SplitterInfo_t > m_Splitters;
- SplitterMode_t m_Mode;
-
- friend class SplitterHandle;
-};
-
-
-} // namespace vgui
-
-
-#endif // SPLITTER_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef SPLITTER_H +#define SPLITTER_H + +#ifdef _WIN32 +#pragma once +#endif + +#include <vgui_controls/EditablePanel.h> + +namespace vgui +{ + +enum SplitterMode_t +{ + SPLITTER_MODE_HORIZONTAL = 0, + SPLITTER_MODE_VERTICAL +}; + + +class SplitterHandle; +class SplitterChildPanel; + +//----------------------------------------------------------------------------- +// Purpose: Thin line used to divide sections, can be moved dragged! +//----------------------------------------------------------------------------- +class Splitter : public EditablePanel +{ + DECLARE_CLASS_SIMPLE( Splitter, EditablePanel ); + +public: + // nCount is the number of splitters to create. + // NOTE: The constructor here will create (nCount+1) EditablePanel children + // and name them child0...childN for .res file purposes. + Splitter( Panel *parent, const char *name, SplitterMode_t mode, int nCount ); + ~Splitter(); + + // Evenly respace all splitters + void EvenlyRespaceSplitters(); + + // respace splitters using given fractions (must sum to 1) + void RespaceSplitters( float *flFractions ); + + // Inherited from Panel + virtual void ApplySettings(KeyValues *inResourceData); + virtual void GetSettings( KeyValues *outResourceData ); + virtual void PerformLayout(); + virtual void OnSizeChanged(int newWide, int newTall); + virtual void ApplyUserConfigSettings(KeyValues *userConfig); + virtual void GetUserConfigSettings(KeyValues *userConfig); + virtual bool HasUserConfigSettings() { return true; } + + // Sets the splitter color + void SetSplitterColor( Color c ); + + // Enables borders on the splitters + void EnableBorders( bool bEnable ); + + // Locks the size of a particular child in pixels. + void LockChildSize( int nChildIndex, int nSize ); + void UnlockChildSize( int nChildIndex ); + +private: + void RecreateSplitters( int nCount ); + + struct SplitterInfo_t + { + SplitterChildPanel *m_pPanel; // This panel is to the left or above the handle + SplitterHandle *m_pHandle; + float m_flPos; + bool m_bLocked; + int m_nLockedSize; + }; + + int GetPosRange(); + int GetSplitterCount() const; + int GetSplitterPosition( int nIndex ); + void SetSplitterPosition( int nIndex, int nPos ); + int GetSubPanelCount() const; + int ComputeLockedSize( int nStartingIndex ); + + CUtlVector< SplitterInfo_t > m_Splitters; + SplitterMode_t m_Mode; + + friend class SplitterHandle; +}; + + +} // namespace vgui + + +#endif // SPLITTER_H |