sprint 1-alpha
|
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_STATUSBAR_H 00023 #define _SPRINT_STATUSBAR_H 00024 00025 #include <sprint/gtl/Window.h> 00026 #include <sprint/gtl/detail/commctrl.h> 00027 00031 namespace sprint { 00032 namespace gtl { 00033 00035 class StatusBar: public CWindow { 00036 public: 00037 void Create(HWND hParent, int id) 00038 { 00039 CommonControl::Instance(); 00040 00041 m_hwnd = ::CreateWindowEx(0, STATUSCLASSNAME, NULL, 00042 WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0, 00043 hParent, (HMENU)id, GetModuleHandle(NULL), NULL); 00044 } 00045 00046 inline void SetParts(const int *w, int n) 00047 { 00048 ::SendMessage(m_hwnd, SB_SETPARTS, n, (LPARAM)w); 00049 } 00050 00051 inline void SetText(WPARAM id, LPCSTR txt) 00052 { 00053 ::SendMessage(m_hwnd, SB_SETTEXT, id, (LPARAM)txt); 00054 } 00055 00056 inline void OnSize() 00057 { 00058 ::SendMessage(m_hwnd, WM_SIZE, 0, 0); 00059 } 00060 00061 bool SetText(int nPane, LPCTSTR lpszText, int nType = 0) 00062 { 00063 return (bool)::SendMessage(m_hwnd, SB_SETTEXT, (nPane | nType), (LPARAM)lpszText); 00064 } 00065 00066 bool GetRect(int nPane, LPRECT lpRect) const 00067 { 00068 return (bool)::SendMessage(m_hwnd, SB_GETRECT, nPane, (LPARAM)lpRect); 00069 } 00070 00071 bool GetBorders(int* pBorders) const 00072 { 00073 return (bool)::SendMessage(m_hwnd, SB_GETBORDERS, 0, (LPARAM)pBorders); 00074 } 00075 00076 bool GetBorders(int& nHorz, int& nVert, int& nSpacing) const 00077 { 00078 int borders[3] = { 0, 0, 0 }; 00079 bool bResult = (BOOL)::SendMessage(m_hwnd, SB_GETBORDERS, 0, (LPARAM)&borders); 00080 if(bResult) 00081 { 00082 nHorz = borders[0]; 00083 nVert = borders[1]; 00084 nSpacing = borders[2]; 00085 } 00086 return bResult; 00087 } 00088 00089 void SetMinHeight(int nMin) 00090 { 00091 ::SendMessage(m_hwnd, SB_SETMINHEIGHT, nMin, 0L); 00092 } 00093 00094 bool SetSimple(BOOL bSimple = TRUE) 00095 { 00096 return (bool)::SendMessage(m_hwnd, SB_SIMPLE, bSimple, 0L); 00097 } 00098 00099 bool IsSimple() const 00100 { 00101 return (bool)::SendMessage(m_hwnd, SB_ISSIMPLE, 0, 0L); 00102 } 00103 00104 }; 00105 00106 } 00107 } 00108 00109 00110 #endif 00111