sprint 1-alpha
sprint/gtl/ReBar.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  *  GTL: GUI Template Library 
00003  *    A Cross Platform C++ Wrapper for Win32 users
00004  *  Copyright (C) 2007-2011 Paolo Medici (www.pmx.it)
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2.1 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser General Public
00017  *  License along with this library; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019  *
00020  *******************************************************************************/
00021 
00022 #ifndef _SPRINT_REBAR_H
00023 #define _SPRINT_REBAR_H
00024 
00028 #include <sprint/gtl/Window.h>
00029 #include <sprint/gtl/detail/commctrl.h>
00030 
00031 namespace sprint {
00032         namespace gtl {
00033 
00035 class ReBar: public CWindow {
00036       public:
00037              void Create(HWND hParent, int id)
00038              {
00039               CommonControl::Instance();
00040               
00041               m_hwnd = ::CreateWindow(REBARCLASSNAME, "", WS_CLIPSIBLINGS|WS_CLIPCHILDREN|RBS_VARHEIGHT|
00042                               CCS_NODIVIDER|WS_BORDER|WS_CHILD|WS_VISIBLE, 0,0,0,0, hParent,  (HMENU)id, GetModuleHandle(NULL), 0);
00043                       
00044              }
00045              
00046              void OnSize()
00047              {
00048              SendMessage(m_hwnd,WM_SIZE,0,0 );
00049              }
00050              
00051     UINT GetBandCount() const
00052         {
00053                 return (UINT)::SendMessage(m_hwnd, RB_GETBANDCOUNT, 0, 0L);
00054         }
00055 
00056         BOOL GetBandInfo(int nBand, LPREBARBANDINFO lprbbi) const
00057         {
00058                 return (BOOL)::SendMessage(m_hwnd, RB_GETBANDINFO, nBand, (LPARAM)lprbbi);
00059         }
00060 
00061         BOOL SetBandInfo(int nBand, LPREBARBANDINFO lprbbi)
00062         {
00063                 return (BOOL)::SendMessage(m_hwnd, RB_SETBANDINFO, nBand, (LPARAM)lprbbi);
00064         }
00065 
00066         BOOL GetBarInfo(LPREBARINFO lprbi) const
00067         {
00068                 return (BOOL)::SendMessage(m_hwnd, RB_GETBARINFO, 0, (LPARAM)lprbi);
00069         }
00070 
00071         BOOL SetBarInfo(const REBARINFO & rbi)
00072         {
00073                 return (BOOL)::SendMessage(m_hwnd, RB_SETBARINFO, 0, (LPARAM) &rbi);
00074         }
00075 
00076         UINT GetRowCount() const
00077         {
00078                 return (UINT)::SendMessage(m_hwnd, RB_GETROWCOUNT, 0, 0L);
00079         }
00080 
00081         UINT GetRowHeight(int nBand) const
00082         {
00083                 return (UINT)::SendMessage(m_hwnd, RB_GETROWHEIGHT, nBand, 0L);
00084         }
00085 
00086 #if (_WIN32_IE >= 0x0400)
00087         COLORREF GetTextColor() const
00088         {
00089                 return (COLORREF)::SendMessage(m_hwnd, RB_GETTEXTCOLOR, 0, 0L);
00090         }
00091 
00092         COLORREF SetTextColor(COLORREF clr)
00093         {
00094                 return (COLORREF)::SendMessage(m_hwnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr);
00095         }
00096 
00097         COLORREF GetBkColor() const
00098         {
00099                 return (COLORREF)::SendMessage(m_hwnd, RB_GETBKCOLOR, 0, 0L);
00100         }
00101 
00102         COLORREF SetBkColor(COLORREF clr)
00103         {
00104                 return (COLORREF)::SendMessage(m_hwnd, RB_SETBKCOLOR, 0, (LPARAM)clr);
00105         }
00106 
00107         UINT GetBarHeight() const
00108         {
00109                 return (UINT)::SendMessage(m_hwnd, RB_GETBARHEIGHT, 0, 0L);
00110         }
00111 
00112         BOOL GetRect(int nBand, LPRECT lpRect) const
00113         {
00114                 return (BOOL)::SendMessage(m_hwnd, RB_GETRECT, nBand, (LPARAM)lpRect);
00115         }
00116 
00117 #ifndef _WIN32_WCE
00118         HWND GetToolTips() const
00119         {
00120                 return (HWND)::SendMessage(m_hwnd, RB_GETTOOLTIPS, 0, 0L);
00121         }
00122 
00123         void SetToolTips(HWND hwndToolTip)
00124         {
00125                 ::SendMessage(m_hwnd, RB_SETTOOLTIPS, (WPARAM)hwndToolTip, 0L);
00126         }
00127 #endif // !_WIN32_WCE
00128 
00129         void GetBandBorders(int nBand, LPRECT lpRect) const
00130         {
00131                 ::SendMessage(m_hwnd, RB_GETBANDBORDERS, nBand, (LPARAM)lpRect);
00132         }
00133 
00134 #ifndef _WIN32_WCE
00135         BOOL GetColorScheme(LPCOLORSCHEME lpColorScheme) const
00136         {
00137                 return (BOOL)::SendMessage(m_hwnd, RB_GETCOLORSCHEME, 0, (LPARAM)lpColorScheme);
00138         }
00139 
00140         void SetColorScheme(LPCOLORSCHEME lpColorScheme)
00141         {
00142                 ::SendMessage(m_hwnd, RB_SETCOLORSCHEME, 0, (LPARAM)lpColorScheme);
00143         }
00144 
00145         HPALETTE GetPalette() const
00146         {
00147                 return (HPALETTE)::SendMessage(m_hwnd, RB_GETPALETTE, 0, 0L);
00148         }
00149 
00150         HPALETTE SetPalette(HPALETTE hPalette)
00151         {
00152                 return (HPALETTE)::SendMessage(m_hwnd, RB_SETPALETTE, 0, (LPARAM)hPalette);
00153         }
00154 
00155         BOOL GetUnicodeFormat() const
00156         {
00157                 return (BOOL)::SendMessage(m_hwnd, RB_GETUNICODEFORMAT, 0, 0L);
00158         }
00159 
00160         BOOL SetUnicodeFormat(BOOL bUnicode = TRUE)
00161         {
00162                 return (BOOL)::SendMessage(m_hwnd, RB_SETUNICODEFORMAT, bUnicode, 0L);
00163         }
00164 #endif // !_WIN32_WCE
00165 #endif // (_WIN32_IE >= 0x0400)
00166 
00167 #if (_WIN32_WINNT >= 0x0501)
00168         // requires uxtheme.h to be included to use MARGINS struct
00169 #ifndef _UXTHEME_H_
00170         typedef struct _MARGINS*   PMARGINS;
00171 #endif // !_UXTHEME_H_
00172         void GetBandMargins(PMARGINS pMargins) const
00173         {
00174                 ::SendMessage(m_hwnd, RB_GETBANDMARGINS, 0, (LPARAM)pMargins);
00175         }
00176 
00177         void SetWindowTheme(LPCWSTR lpstrTheme)
00178         {
00179                 ::SendMessage(m_hwnd, RB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme);
00180         }
00181 #endif // (_WIN32_WINNT >= 0x0501)
00182 
00183 #if (_WIN32_IE >= 0x0600)
00184         DWORD GetExtendedStyle() const
00185         {
00186                 return (DWORD)::SendMessage(m_hwnd, RB_GETEXTENDEDSTYLE, 0, 0L);
00187         }
00188 
00189         DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask)
00190         {
00191                 return (DWORD)::SendMessage(m_hwnd, RB_SETEXTENDEDSTYLE, dwMask, dwStyle);
00192         }
00193 #endif // (_WIN32_IE >= 0x0600)
00194 
00195 // Operations
00196         BOOL InsertBand(int nBand, const REBARBANDINFO& rbbi)
00197         {
00198                 return (BOOL)::SendMessage(m_hwnd, RB_INSERTBAND, nBand, (LPARAM)&rbbi);
00199         }
00200 
00201         BOOL AddBand(const REBARBANDINFO & rbbi)
00202         {
00203                 return InsertBand(-1, rbbi);
00204         }
00205 
00206         BOOL DeleteBand(int nBand)
00207         {
00208                 return (BOOL)::SendMessage(m_hwnd, RB_DELETEBAND, nBand, 0L);
00209         }
00210 
00211         HWND SetNotifyWnd(HWND hWnd)
00212         {
00213                 return (HWND)::SendMessage(m_hwnd, RB_SETPARENT, (WPARAM)hWnd, 0L);
00214         }
00215 
00216 #if (_WIN32_IE >= 0x0400)
00217         void BeginDrag(int nBand, DWORD dwPos)
00218         {
00219                 ::SendMessage(m_hwnd, RB_BEGINDRAG, nBand, dwPos);
00220         }
00221 
00222         void BeginDrag(int nBand, int xPos, int yPos)
00223         {
00224                 ::SendMessage(m_hwnd, RB_BEGINDRAG, nBand, MAKELPARAM(xPos, yPos));
00225         }
00226 
00227         void EndDrag()
00228         {
00229                 ::SendMessage(m_hwnd, RB_ENDDRAG, 0, 0L);
00230         }
00231 
00232         void DragMove(DWORD dwPos)
00233         {
00234                 ::SendMessage(m_hwnd, RB_DRAGMOVE, 0, dwPos);
00235         }
00236 
00237         void DragMove(int xPos, int yPos)
00238         {
00239                 ::SendMessage(m_hwnd, RB_DRAGMOVE, 0, MAKELPARAM(xPos, yPos));
00240         }
00241 
00242 #ifndef _WIN32_WCE
00243         void GetDropTarget(IDropTarget** ppDropTarget) const
00244         {
00245                 ::SendMessage(m_hwnd, RB_GETDROPTARGET, 0, (LPARAM)ppDropTarget);
00246         }
00247 #endif // !_WIN32_WCE
00248 
00249         void MaximizeBand(int nBand, BOOL bIdeal = FALSE)
00250         {
00251                 ::SendMessage(m_hwnd, RB_MAXIMIZEBAND, nBand, bIdeal);
00252         }
00253 
00254         void MinimizeBand(int nBand)
00255         {
00256                 ::SendMessage(m_hwnd, RB_MINIMIZEBAND, nBand, 0L);
00257         }
00258 
00259         BOOL SizeToRect(LPRECT lpRect)
00260         {
00261                 return (BOOL)::SendMessage(m_hwnd, RB_SIZETORECT, 0, (LPARAM)lpRect);
00262         }
00263 
00264         int IdToIndex(UINT uBandID) const
00265         {
00266                 return (int)::SendMessage(m_hwnd, RB_IDTOINDEX, uBandID, 0L);
00267         }
00268 
00269         int HitTest(LPRBHITTESTINFO lprbht) const
00270         {
00271                 return (int)::SendMessage(m_hwnd, RB_HITTEST, 0, (LPARAM)lprbht);
00272         }
00273 
00274         BOOL ShowBand(int nBand, BOOL bShow)
00275         {
00276                 return (BOOL)::SendMessage(m_hwnd, RB_SHOWBAND, nBand, bShow);
00277         }
00278 
00279 #ifndef _WIN32_WCE
00280         BOOL MoveBand(int nBand, int nNewPos)
00281         {
00282                 return (BOOL)::SendMessage(m_hwnd, RB_MOVEBAND, nBand, nNewPos);
00283         }
00284 #endif // !_WIN32_WCE
00285 #endif // (_WIN32_IE >= 0x0400)
00286 
00287 
00288 #if (_WIN32_WINNT >= 0x0600)
00289         BOOL SetBandWidth(int nBand, int cxWidth)
00290         {
00291                 return (BOOL)::SendMessage(m_hwnd, RB_SETBANDWIDTH, nBand, cxWidth);
00292         }
00293 #endif // (_WIN32_WINNT >= 0x0600)
00294              
00295       };
00296       
00297           }
00298 }
00299 
00300 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines