CReBar Class |
Description
The class responsible for creating a ReBar control. ReBar controls act as containers for child windows. An application assigns child windows, which are often other controls, to a rebar control band. ReBar controls contain one or more bands, and each band can have any combination of a gripper bar, a bitmap, a text label, and a child window.
Refer to the documentation that ships with the Microsoft Windows Software Development Kit for more information on the use of rebar controls.
CReBar Members
CReBar | CReBar();Constructor for CReBar. |
BOOL DeleteBand(const int nBand) const;Deletes a band from the rebar control.
int GetBand(const HWND hWnd) const;Returns the band number given the band's window handle.
CRect GetBandBorders(int nBand) const;Retrieves the borders of a band. The result of this message can be used to calculate the usable area in a band.
int GetBandCount() const;Retrieves the count of bands currently in the rebar control.
BOOL GetBandInfo(const int nBand, REBARBANDINFO& rbbi) const;Retrieves information about a specified band in a rebar control.
CRect GetBandRect(int i) const;Retrieves the bounding rectangle for a given band in a rebar control.
UINT GetBarHeight() const;Retrieves the height of the rebar control.
UINT GetRowCount() const;Retrieves the number of rows of bands in a rebar control.
int GetRowHeight(int nRow) const;Retrieves the height of a specified row in a rebar control.
UINT GetSizeofRBBI() const;Returns the correct value for sizeof(REBARBANDINFO).
CToolTip* GetToolTips() const;Retrieves the handle to any ToolTip control associated with the rebar control.
int HitTest(RBHITTESTINFO& rbht);
HWND HitTest(POINT pt);Determines which portion of a rebar band is at a given point on the screen, if a rebar band exists at that point.
int IDToIndex(UINT uBandID) const;Converts a band identifier to a band index in a rebar control.
BOOL InsertBand(const int nBand, REBARBANDINFO& rbbi) const;Inserts a new band in a rebar control.
BOOL IsBandVisible(int nBand) const;Returns TRUE if band is visible, otherwise FALSE
void MaximizeBand(UINT uBand, BOOL fIdeal = FALSE);Resizes a band in a rebar control to either its ideal or largest size.
void MinimizeBand(UINT uBand);Resizes a band in a rebar control to its smallest size.
BOOL MoveBand(UINT uFrom, UINT uTo);Moves a band from one index to another.
void MoveBandsLeft();Repositions the bands so that they are moved to the left.
BOOL ResizeBand(const int nBand, const CSize& sz) const;Changes the size of a rebar band.
BOOL SetBandBitmap(const int nBand, const HBITMAP hBackground) const;Sets a bitmap to the ReBar control
BOOL SetBandColor(const int nBand, const COLORREF clrFore, const COLORREF clrBack) const;Sets the colour of a ReBar band
BOOL SetBandInfo(const int nBand, REBARBANDINFO& rbbi) const;Sets characteristics of an existing band in the rebar control.
BOOL SetBarInfo(REBARINFO& rbi) const;Sets the characteristics of a rebar control.
BOOL ShowGripper(int nBand, BOOL fShow) const;Shows or hides a band
BOOL ShowBand(int nBand, BOOL fShow) const;Shows or hides a band's gripper.
BOOL SizeToRect(CRect& rect) const;Finds the best layout of the bands from the given rectangle.
Base class Members
For base class members, refer to the members of CWnd.
Remarks
Like all common controls, the rebar control requires a parent window. This parent window is often a dialog, but simple windows can also be the parent window for a rebar control.
The following code creates a ComboBox and adds it to the rebar.
void CMainFrame::AddListboxBand(int Listbox_Height) { // Get the reference to the rebar object CReBar& RB = GetReBar(); ThemeReBar RBTheme = RB.GetReBarTheme(); // Create the ComboboxEx window CREATESTRUCT cs = {0}; cs.lpszClass = _T("COMBOBOXEX32"); cs.style = WS_VISIBLE | WS_CHILD | CBS_DROPDOWN; cs.cy = 100; // required to display list cs.hMenu = (HMENU)IDC_COMBOBOXEX; m_ComboboxEx.PreCreate(cs); m_ComboboxEx.Create(GetReBar().GetHwnd()); // Put the window in a new rebar band REBARBANDINFO rbbi = {0}; rbbi.cbSize = GetSizeofRBBI(); rbbi.fMask = RBBIM_COLORS | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_CHILD | RBBIM_TEXT; rbbi.cyMinChild = Listbox_Height; rbbi.cyMaxChild = Listbox_Height; rbbi.cxMinChild = 200; rbbi.fStyle = RBBS_BREAK | RBBS_VARIABLEHEIGHT | RBBS_GRIPPERALWAYS; rbbi.clrFore = GetSysColor(COLOR_BTNTEXT); rbbi.clrBack = RBTheme.clrBand1; rbbi.hwndChild = m_ComboboxEx.GetHwnd(); rbbi.lpText = _T("Address"); RB.InsertBand(-1, rbbi); }
CRebar is used by CFrame to contain a CMenuBar and a CToolBar.
Summary Information
Header file | rebar.h |
Win32/64 support | Yes |
WinCE support | Yes |
Library required | Comctl32.lib |