Initial release

This commit is contained in:
civ
2026-08-16 18:24:52 +07:00
commit 876886a39a
13244 changed files with 2353959 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
// This file is part of VSTGUI. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this
// distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
#pragma once
#include "vstguifwd.h"
#include "cviewcontainer.h"
#include "cfont.h"
#include "ccolor.h"
#include "controls/icontrollistener.h"
namespace VSTGUI {
class CTabChildView;
//-----------------------------------------------------------------------------
class CTabView : public CViewContainer, public IControlListener
//! @brief a tab view
/// @ingroup containerviews
//-----------------------------------------------------------------------------
{
public:
enum TabPosition {
kPositionLeft = 0,
kPositionRight,
kPositionTop,
kPositionBottom
};
enum TabAlignment {
kAlignCenter = 0,
kAlignLeft,
kAlignRight,
kAlignTop = kAlignLeft,
kAlignBottom = kAlignRight
};
CTabView (const CRect& size, CBitmap* tabBitmap, CBitmap* background = nullptr, TabPosition tabPosition = kPositionTop, int32_t style = 0);
CTabView (const CRect& size, const CRect& tabSize, CBitmap* background = nullptr, TabPosition tabPosition = kPositionTop, int32_t style = 0);
//-----------------------------------------------------------------------------
/// @name Tab View Functions
//-----------------------------------------------------------------------------
//@{
/** add a tab */
virtual bool addTab (CView* view, UTF8StringPtr name = nullptr, CBitmap* tabBitmap = nullptr);
/** add a tab */
virtual bool addTab (CView* view, CControl* button);
/** remove a tab */
virtual bool removeTab (CView* view);
/** remove all tabs */
virtual bool removeAllTabs ();
/** select tab at index */
virtual bool selectTab (int32_t index);
/** get current index of selected tab */
virtual int32_t getCurrentSelectedTab () const { return currentTab; }
/** the size of one tab */
virtual CRect& getTabViewSize (CRect& rect) const;
/** call this after the tabs are added. Tabs added after this call will have the default font style. */
virtual void setTabFontStyle (const CFontRef font, CCoord fontSize = 12, CColor selectedColor = kBlackCColor, CColor deselectedColor = kWhiteCColor);
/** call this after you have added all tabs to align them according to alignment */
virtual void alignTabs (TabAlignment alignment = kAlignCenter);
virtual void setTabViewInsets (const CPoint& inset);
//@}
void drawBackgroundRect (CDrawContext *pContext, const CRect& _updateRect) override;
void valueChanged (CControl *pControl) override;
void setViewSize (const CRect &rect, bool invalid = true) override;
void setAutosizeFlags (int32_t flags) override;
//-----------------------------------------------------------------------------
CLASS_METHODS (CTabView, CViewContainer)
protected:
~CTabView () noexcept override;
void setCurrentChild (CTabChildView* childView);
int32_t numberOfChilds;
int32_t currentTab;
TabPosition tabPosition;
int32_t style;
CRect tabSize;
CPoint tabViewInset;
CBitmap* tabBitmap;
CTabChildView* firstChild;
CTabChildView* lastChild;
CTabChildView* currentChild;
};
} // VSTGUI