summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-20 11:11:24 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-20 11:11:24 +0000
commitf61951e818a58575ac1caa116a7819afe2dce24d (patch)
tree53e8a711edb0ae398e160260a5e82aafcfeaf34c /plugins
parent7e0f9f7347ca4a778d1a6167a878de12fd4baa03 (diff)
minus std::vector
git-svn-id: http://svn.miranda-ng.org/main/trunk@5754 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TabSRMM/src/sidebar.cpp234
-rw-r--r--plugins/TabSRMM/src/sidebar.h239
2 files changed, 227 insertions, 246 deletions
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp
index 18e44fe8df..7eab1ccba3 100644
--- a/plugins/TabSRMM/src/sidebar.cpp
+++ b/plugins/TabSRMM/src/sidebar.cpp
@@ -364,12 +364,12 @@ void CSideBarButton::invokeContextMenu()
}
}
-CSideBar::CSideBar(TContainerData *pContainer)
+CSideBar::CSideBar(TContainerData *pContainer) :
+ m_buttonlist(1, PtrKeySortT)
{
m_pContainer = pContainer;
m_up = m_down = 0;
m_hwndScrollWnd = 0;
- m_buttonlist.clear();
m_activeItem = 0;
m_isVisible = true;
@@ -379,7 +379,6 @@ CSideBar::CSideBar(TContainerData *pContainer)
CSideBar::~CSideBar()
{
destroyScroller();
- m_buttonlist.clear();
if (m_hwndScrollWnd)
::DestroyWindow(m_hwndScrollWnd);
@@ -488,15 +487,10 @@ void CSideBar::destroyScroller()
* Does not remove the sessions. This is basically only used when switching
* from a sidebar to a tabbed interface
*/
+
void CSideBar::removeAll()
{
- ButtonIterator item = m_buttonlist.begin();
-
- while(item != m_buttonlist.end()) {
- delete *item;
- item++;
- }
- m_buttonlist.clear();
+ m_buttonlist.destroy();
}
/**
@@ -510,37 +504,39 @@ void CSideBar::removeAll()
void CSideBar::populateAll()
{
HWND hwndTab = ::GetDlgItem(m_pContainer->hwnd, IDC_MSGTABS);
+ if (hwndTab == NULL)
+ return;
+
+ int iItems = (int)TabCtrl_GetItemCount(hwndTab);
+
+ TCITEM item = {0};
+ item.mask = TCIF_PARAM;
+
+ m_iTopButtons = 0;
- if (hwndTab) {
- int iItems = (int)TabCtrl_GetItemCount(hwndTab);
- TCITEM item = {0};
-
- item.mask = TCIF_PARAM;
- std::vector<CSideBarButton *>::iterator b_item;
-
- m_iTopButtons = 0;
-
- for (int i=0; i < iItems; i++) {
- TabCtrl_GetItem(hwndTab, i, &item);
- if (item.lParam && ::IsWindow((HWND)item.lParam)) {
- TWindowData *dat = (TWindowData*)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
- if (dat) {
- if ((b_item = findSession(dat)) == m_buttonlist.end())
- addSession(dat, i);
- else {
- (*b_item)->setLayout(m_currentLayout);
- if (m_dwFlags & SIDEBARLAYOUT_VERTICALORIENTATION) {
- (*b_item)->measureItem();
- m_topHeight += ((*b_item)->getHeight() + 1);
- }
- else
- m_topHeight += (m_elementHeight + 1);
- }
- }
+ for (int i=0; i < iItems; i++) {
+ TabCtrl_GetItem(hwndTab, i, &item);
+ if (item.lParam == 0 || !IsWindow((HWND)item.lParam))
+ continue;
+
+ TWindowData *dat = (TWindowData*)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ if (dat == NULL)
+ continue;
+
+ CSideBarButton *b_item = findSession(dat);
+ if (b_item == NULL)
+ addSession(dat, i);
+ else {
+ b_item->setLayout(m_currentLayout);
+ if (m_dwFlags & SIDEBARLAYOUT_VERTICALORIENTATION) {
+ b_item->measureItem();
+ m_topHeight += b_item->getHeight() + 1;
}
+ else m_topHeight += m_elementHeight + 1;
}
}
}
+
/**
* Add a new session to the switchbar.
*
@@ -565,12 +561,11 @@ void CSideBar::addSession(const TWindowData *dat, int position)
m_topHeight += (m_elementHeight + 1);
m_iTopButtons++;
- if (position == -1 || (size_t)position >= m_buttonlist.size())
- m_buttonlist.push_back(item);
- else {
- ButtonIterator it = m_buttonlist.begin() + position;
- m_buttonlist.insert(it, item);
- }
+ if (position == -1 || position >= m_buttonlist.getCount())
+ m_buttonlist.insert(item);
+ else
+ m_buttonlist.insert(item, position);
+
SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_TOGGLESIDEBAR : IDC_CHAT_TOGGLESIDEBAR, BM_SETIMAGE, IMAGE_ICON,
(LPARAM)(m_dwFlags & SIDEBARORIENTATION_LEFT ? PluginConfig.g_buttonBarIcons[ICON_DEFAULT_LEFT] : PluginConfig.g_buttonBarIcons[ICON_DEFAULT_RIGHT]));
@@ -585,18 +580,17 @@ void CSideBar::addSession(const TWindowData *dat, int position)
HRESULT CSideBar::removeSession(const TWindowData *dat)
{
if (dat) {
- std::vector<CSideBarButton *>::iterator item = findSession(dat);
+ CSideBarButton *item = findSession(dat);
- if (item != m_buttonlist.end()) {
+ if (item != NULL) {
m_iTopButtons--;
if (m_dwFlags & SIDEBARLAYOUT_DYNHEIGHT) {
- SIZE sz = (*item)->getSize();
+ SIZE sz = item->getSize();
m_topHeight -= (sz.cy + 1);
}
- else
- m_topHeight -= (m_elementHeight + 1);
- delete *item;
- m_buttonlist.erase(item);
+ else m_topHeight -= (m_elementHeight + 1);
+
+ m_buttonlist.remove(item);
Invalidate();
return(S_OK);
}
@@ -620,17 +614,16 @@ void CSideBar::scrollIntoView(const CSideBarButton *item)
if (item == 0)
item = m_activeItem;
- ButtonIterator it = m_buttonlist.begin();
-
- while(it != m_buttonlist.end()) {
- itemHeight = (*it)->getHeight();
+ int i;
+ for (i=0; i < m_buttonlist.getCount(); i++) {
+ CSideBarButton &p = m_buttonlist[i];
+ itemHeight = p.getHeight();
spaceUsed += (itemHeight + 1);
- if (*it == item )
+ if (&p == item)
break;
- it++;
}
- RECT rc;
+ RECT rc;
GetClientRect(m_hwndScrollWnd, &rc);
if (m_topHeight <= rc.bottom) {
@@ -638,14 +631,15 @@ void CSideBar::scrollIntoView(const CSideBarButton *item)
Layout();
return;
}
- if (it == m_buttonlist.end() || (it == m_buttonlist.begin() && m_firstVisibleOffset == 0)) {
+
+ if (i == m_buttonlist.getCount() || (i == 0 && m_firstVisibleOffset == 0)) {
Layout();
- return; // do nothing for the first item and .end() should not really happen
+ return; // do nothing for the first item and .end() should not really happen
}
if (spaceUsed <= rc.bottom && spaceUsed - (itemHeight + 1) >= m_firstVisibleOffset) {
Layout();
- return; // item fully visible, do nothing
+ return; // item fully visible, do nothing
}
/*
@@ -654,15 +648,15 @@ void CSideBar::scrollIntoView(const CSideBarButton *item)
if (spaceUsed < m_firstVisibleOffset || spaceUsed - (itemHeight + 1) < m_firstVisibleOffset) {
m_firstVisibleOffset = spaceUsed - (itemHeight + 1);
fNeedLayout = true;
- } else {
+ }
+ else {
if (spaceUsed > rc.bottom) { // partially or not at all visible at the bottom
fNeedLayout = true;
m_firstVisibleOffset = spaceUsed - rc.bottom;
}
}
- //if (fNeedLayout)
- Layout();
+ Layout();
}
/**
* Invalidate the button associated with the given session.
@@ -674,23 +668,22 @@ void CSideBar::updateSession(const TWindowData *dat)
if (!m_isVisible || !m_isActive)
return;
- ButtonIterator item = findSession(dat);
- if (item != m_buttonlist.end()) {
- if (m_dwFlags & SIDEBARLAYOUT_DYNHEIGHT) {
- LONG oldHeight = (*item)->getHeight();
- m_topHeight -= (oldHeight + 1);
- SIZE sz = (*item)->measureItem();
- m_topHeight += (sz.cy + 1);
- if (sz.cy != oldHeight) {
- Invalidate();
- ::InvalidateRect((*item)->getHwnd(), NULL, TRUE);
- }
- else
- ::InvalidateRect((*item)->getHwnd(), NULL, FALSE);
+ CSideBarButton *item = findSession(dat);
+ if (item == NULL)
+ return;
+
+ if (m_dwFlags & SIDEBARLAYOUT_DYNHEIGHT) {
+ LONG oldHeight = item->getHeight();
+ m_topHeight -= (oldHeight + 1);
+ SIZE sz = item->measureItem();
+ m_topHeight += (sz.cy + 1);
+ if (sz.cy != oldHeight) {
+ Invalidate();
+ ::InvalidateRect(item->getHwnd(), NULL, TRUE);
}
- else
- ::InvalidateRect((*item)->getHwnd(), NULL, FALSE);
+ else ::InvalidateRect(item->getHwnd(), NULL, FALSE);
}
+ else ::InvalidateRect(item->getHwnd(), NULL, FALSE);
}
/**
@@ -704,10 +697,10 @@ void CSideBar::updateSession(const TWindowData *dat)
*/
const CSideBarButton* CSideBar::setActiveItem(const TWindowData *dat)
{
- ButtonIterator item = findSession(dat);
- if (item != m_buttonlist.end()) {
- return(setActiveItem(*item));
- }
+ CSideBarButton *item = findSession(dat);
+ if (item != NULL)
+ return setActiveItem(item);
+
return 0;
}
@@ -741,7 +734,7 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
HDWP hdwp = ::BeginDeferWindowPos(1);
int topCount = 0, bottomCount = 0;
- size_t i = 0, j = 0;
+ size_t j = 0;
BOOL topEnabled = FALSE, bottomEnabled = FALSE;
HWND hwnd;
LONG spaceUsed = 0;
@@ -750,26 +743,24 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
m_firstVisibleOffset = max(0, m_firstVisibleOffset);
- ButtonIterator item = m_buttonlist.begin();
-
m_totalItemHeight = 0;
LONG height = m_elementHeight;
- while (item != m_buttonlist.end()) {
- hwnd = (*item)->getHwnd();
+ for (int i=0; i < m_buttonlist.getCount(); i++) {
+ CSideBarButton &p = m_buttonlist[i];
+ hwnd = p.getHwnd();
if (m_dwFlags & SIDEBARLAYOUT_DYNHEIGHT)
- height = (*item)->getHeight();
+ height = p.getHeight();
if (spaceUsed > iSpaceAvail || m_totalItemHeight + height < m_firstVisibleOffset) {
::ShowWindow(hwnd, SW_HIDE);
- item++;
m_totalItemHeight += (height + 1);
continue;
}
- if ((*item)->isTopAligned()) {
+ if (p.isTopAligned()) {
if (m_totalItemHeight <= m_firstVisibleOffset) { // partially visible
if (!fOnlyCalc)
hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, -(m_firstVisibleOffset - m_totalItemHeight),
@@ -779,15 +770,11 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
}
else {
if (!fOnlyCalc)
- hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, spaceUsed,
- m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
+ hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, spaceUsed, m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
spaceUsed += (height + 1);
m_totalItemHeight += (height + 1);
}
- }/*
- else {
- }*/
- item++;
+ }
}
topEnabled = m_firstVisibleOffset > 0;
bottomEnabled = (m_totalItemHeight - m_firstVisibleOffset > rc->bottom);
@@ -821,10 +808,8 @@ void CSideBar::showAll(int showCmd)
::ShowWindow(m_up->getHwnd(), showCmd);
::ShowWindow(m_down->getHwnd(), showCmd);
- std::vector<CSideBarButton *>::iterator item = m_buttonlist.begin();
-
- while(item != m_buttonlist.end())
- ::ShowWindow((*item++)->getHwnd(), showCmd);
+ for (int i=0; i < m_buttonlist.getCount(); i++)
+ ::ShowWindow(m_buttonlist[i].getHwnd(), showCmd);
}
/**
@@ -835,20 +820,19 @@ void CSideBar::showAll(int showCmd)
*
* @return CSideBarButtonItem*: pointer to the found item. Zero, if none was found
*/
-ButtonIterator CSideBar::findSession(const TWindowData *dat)
+
+CSideBarButton* CSideBar::findSession(const TWindowData *dat)
{
- if (dat) {
- std::vector<CSideBarButton *>::iterator item = m_buttonlist.begin();
+ if (dat == NULL)
+ return NULL;
- if (m_buttonlist.size() > 0) {
- while(item != m_buttonlist.end()) {
- if ((*item)->getDat() == dat)
- return(item);
- item++;
- }
- }
+ for (int i=0; i < m_buttonlist.getCount(); i++) {
+ CSideBarButton &p = m_buttonlist[i];
+ if (p.getDat() == dat)
+ return &p;
}
- return(m_buttonlist.end());
+
+ return NULL;
}
/**
@@ -859,20 +843,19 @@ ButtonIterator CSideBar::findSession(const TWindowData *dat)
*
* @return CSideBarButtonItem*: pointer to the found item. Zero, if none was found
*/
-ButtonIterator CSideBar::findSession(const HANDLE hContact)
+
+CSideBarButton* CSideBar::findSession(const HANDLE hContact)
{
- if (hContact) {
- std::vector<CSideBarButton *>::iterator item = m_buttonlist.begin();
-
- if (m_buttonlist.size() > 0) {
- while(item != m_buttonlist.end()) {
- if ((*item)->getContactHandle() == hContact)
- return(item);
- item++;
- }
- }
+ if (hContact == NULL)
+ return NULL;
+
+ for (int i=0; i < m_buttonlist.getCount(); i++) {
+ CSideBarButton &p = m_buttonlist[i];
+ if (p.getContactHandle() == hContact)
+ return &p;
}
- return(m_buttonlist.end());
+
+ return NULL;
}
void CSideBar::processScrollerButtons(UINT commandID)
@@ -901,10 +884,9 @@ void CSideBar::resizeScrollWnd(LONG x, LONG y, LONG width, LONG height) const
void CSideBar::invalidateButton(const TWindowData *dat)
{
if (m_isActive && m_isVisible) {
- ButtonIterator it = findSession(dat);
-
- if (it != this->m_buttonlist.end())
- RedrawWindow((*it)->m_buttonControl->hwnd, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
+ CSideBarButton *item = findSession(dat);
+ if (item != NULL)
+ RedrawWindow(item->m_buttonControl->hwnd, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
}
}
diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h
index 6b5fac5d29..4c7c25d908 100644
--- a/plugins/TabSRMM/src/sidebar.h
+++ b/plugins/TabSRMM/src/sidebar.h
@@ -42,10 +42,10 @@ struct TSideBarNotify
struct TSideBarLayout
{
- TCHAR szName[50]; // everything wants a name...
- LONG width; // width of the switchbar element (a single button)
- LONG height; // height of a single switchbar element
- DWORD dwFlags; // flags, obviously :)
+ TCHAR szName[50]; // everything wants a name...
+ LONG width; // width of the switchbar element (a single button)
+ LONG height; // height of a single switchbar element
+ DWORD dwFlags; // flags, obviously :)
/*
* the following 4 items define pointers to the actual renderer functions for that sidebar layout
@@ -68,41 +68,39 @@ public:
CSideBarButton(const TWindowData *dat, CSideBar *sideBar);
~CSideBarButton();
- LONG getHeight() const { return(m_sz.cy); }
- const SIZE& getSize() const { return(m_sz); }
- void setSize(const SIZE& newSize){ m_sz = newSize; }
- const bool isTopAligned() const { return(m_isTopAligned); }
- const HWND getHwnd() const { return(m_hwnd); }
- const UINT getID() const { return(m_id); }
- const HANDLE getContactHandle() const { return(m_dat->hContact); }
- const TWindowData* getDat() const { return(m_dat); }
- const TSideBarLayout* getLayout() const { return(m_sideBarLayout); }
-
- void RenderThis (const HDC hdc) const;
- void renderIconAndNick (const HDC hdc, const RECT *rcItem) const;
- int testCloseButton() const;
- void Show(const int showCmd) const;
- void activateSession() const;
- const SIZE& measureItem();
- void setLayout(const TSideBarLayout *newLayout);
- void invokeContextMenu();
+ LONG getHeight() const { return(m_sz.cy); }
+ const SIZE& getSize() const { return(m_sz); }
+ void setSize(const SIZE& newSize) { m_sz = newSize; }
+ const bool isTopAligned() const { return(m_isTopAligned); }
+ const HWND getHwnd() const { return(m_hwnd); }
+ const UINT getID() const { return(m_id); }
+ const HANDLE getContactHandle() const { return(m_dat->hContact); }
+ const TWindowData* getDat() const { return(m_dat); }
+ const TSideBarLayout* getLayout() const { return(m_sideBarLayout); }
+
+ void RenderThis(const HDC hdc) const;
+ void renderIconAndNick(const HDC hdc, const RECT *rcItem) const;
+ int testCloseButton() const;
+ void Show(const int showCmd) const;
+ void activateSession() const;
+ const SIZE& measureItem();
+ void setLayout(const TSideBarLayout *newLayout);
+ void invokeContextMenu();
public:
- CSideBar* m_sideBar;
- const TSButtonCtrl* m_buttonControl; // private data struct of the Win32 button object
+ CSideBar* m_sideBar;
+ const TSButtonCtrl* m_buttonControl; // private data struct of the Win32 button object
private:
- void _create();
+ void _create();
private:
- const TSideBarLayout* m_sideBarLayout;
- HWND m_hwnd; // window handle for the TSButton object
- const TWindowData* m_dat; // session data
- UINT m_id; // control id
- bool m_isTopAligned;
- SIZE m_sz;
+ const TSideBarLayout* m_sideBarLayout;
+ HWND m_hwnd; // window handle for the TSButton object
+ const TWindowData* m_dat; // session data
+ UINT m_id; // control id
+ bool m_isTopAligned;
+ SIZE m_sz;
};
-typedef std::vector<CSideBarButton *>::iterator ButtonIterator;
-
class CSideBar
{
public:
@@ -135,100 +133,101 @@ public:
CSideBar(TContainerData *pContainer);
~CSideBar();
- void Init (const bool fForce = false);
- void addSession (const TWindowData *dat, int position = -1);
- HRESULT removeSession (const TWindowData *dat);
- void updateSession (const TWindowData *dat);
-
- void processScrollerButtons (UINT cmd);
- void Layout (const RECT *rc = 0, bool fOnlyCalc = false);
- void setVisible (bool fNewVisibility);
- void showAll (int showCmd);
-
- const LONG getWidth() const { return(m_isVisible ? m_width + SIDEBAR_GAP : 0); }
- const DWORD getFlags() const { return(m_dwFlags); }
- const TContainerData* getContainer() const { return(m_pContainer); }
- const bool isActive() const { return(m_isActive); }
- const bool isVisible() const { return(m_isVisible); }
- const CSideBarButton* getActiveItem() const { return(m_activeItem); }
- const CSideBarButton* getScrollUp() const { return(m_up); }
- const CSideBarButton* getScrollDown() const { return(m_down); }
- bool isSkinnedContainer() const { return(CSkin::m_skinEnabled ? true : false); }
- const UINT getLayoutId() const { return(m_uLayout); }
- void invalidateButton (const TWindowData *dat);
-
- const CSideBarButton* setActiveItem (const CSideBarButton *newItem)
- {
- CSideBarButton *oldItem = m_activeItem;
- m_activeItem = const_cast<CSideBarButton *>(newItem);
- if (oldItem)
- ::InvalidateRect(oldItem->getHwnd(), NULL, FALSE);
- ::InvalidateRect(m_activeItem->getHwnd(), NULL, FALSE);
- scrollIntoView(m_activeItem);
- return(oldItem);
- }
- /**
- * this item has its close button currently hovered
- * @param item: the CSideBarButton* which is hovered
- */
- void setHoveredClose (CSideBarButton* item)
- {
- m_hoveredClose = item;
- }
- HWND getScrollWnd() const { return(m_hwndScrollWnd); }
- const CSideBarButton* getHoveredClose() const { return(m_hoveredClose); }
- const CSideBarButton* setActiveItem (const TWindowData *dat);
-
- static const TSideBarLayout* getLayouts (int& uLayoutCount)
- {
- uLayoutCount = NR_LAYOUTS;
- return(m_layouts);
- }
- void scrollIntoView (const CSideBarButton *item = 0);
- void resizeScrollWnd (LONG x, LONG y, LONG width, LONG height) const;
- static LRESULT CALLBACK wndProcStub (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ void Init(const bool fForce = false);
+ void addSession(const TWindowData *dat, int position);
+ HRESULT removeSession(const TWindowData *dat);
+ void updateSession(const TWindowData *dat);
+
+ void processScrollerButtons(UINT cmd);
+ void Layout(const RECT *rc = 0, bool fOnlyCalc = false);
+ void setVisible(bool fNewVisibility);
+ void showAll(int showCmd);
+
+ const LONG getWidth() const { return(m_isVisible ? m_width + SIDEBAR_GAP : 0); }
+ const DWORD getFlags() const { return(m_dwFlags); }
+ const TContainerData* getContainer() const { return(m_pContainer); }
+ const bool isActive() const { return(m_isActive); }
+ const bool isVisible() const { return(m_isVisible); }
+ const CSideBarButton* getActiveItem() const { return(m_activeItem); }
+ const CSideBarButton* getScrollUp() const { return(m_up); }
+ const CSideBarButton* getScrollDown() const { return(m_down); }
+ bool isSkinnedContainer() const { return(CSkin::m_skinEnabled ? true : false); }
+ const UINT getLayoutId() const { return(m_uLayout); }
+ void invalidateButton(const TWindowData *dat);
+
+ const CSideBarButton* setActiveItem(const CSideBarButton *newItem)
+ {
+ CSideBarButton *oldItem = m_activeItem;
+ m_activeItem = const_cast<CSideBarButton *>(newItem);
+ if (oldItem)
+ ::InvalidateRect(oldItem->getHwnd(), NULL, FALSE);
+ ::InvalidateRect(m_activeItem->getHwnd(), NULL, FALSE);
+ scrollIntoView(m_activeItem);
+ return(oldItem);
+ }
+ /**
+ * this item has its close button currently hovered
+ * @param item: the CSideBarButton* which is hovered
+ */
+ void setHoveredClose (CSideBarButton* item)
+ {
+ m_hoveredClose = item;
+ }
+ HWND getScrollWnd() const { return(m_hwndScrollWnd); }
+ const CSideBarButton* getHoveredClose() const { return(m_hoveredClose); }
+ const CSideBarButton* setActiveItem (const TWindowData *dat);
+
+ static LRESULT CALLBACK wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+ static const TSideBarLayout* getLayouts (int& uLayoutCount)
+ {
+ uLayoutCount = NR_LAYOUTS;
+ return(m_layouts);
+ }
+ void scrollIntoView (const CSideBarButton *item = 0);
+ void resizeScrollWnd (LONG x, LONG y, LONG width, LONG height) const;
private:
- void createScroller();
- void destroyScroller();
- void populateAll();
- void removeAll();
- void Invalidate();
- ButtonIterator findSession (const TWindowData *dat);
- ButtonIterator findSession (const HANDLE hContact);
+ void createScroller();
+ void destroyScroller();
+ void populateAll();
+ void removeAll();
+ void Invalidate();
+ CSideBarButton* findSession(const TWindowData *dat);
+ CSideBarButton* findSession(const HANDLE hContact);
- LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
- HWND m_hwndScrollWnd;
- std::vector<CSideBarButton*> m_buttonlist; // our list of buttons
- TContainerData* m_pContainer; // our master and commander...
- LONG m_width; // required width of the bar (m_elementWidth + padding)
- DWORD m_dwFlags;
- CSideBarButton* m_up, *m_down; // the scroller buttons (up down)
- CSideBarButton* m_activeItem; // active button item (for highlighting)
- const CSideBarButton* m_hoveredClose; // item which must display an active close button
- LONG m_topHeight, m_bottomHeight;
- LONG m_firstVisibleOffset, m_totalItemHeight;
- int m_iTopButtons, m_iBottomButtons;
- LONG m_elementHeight, m_elementWidth; // width / height for a single element.
- // can be dynamic (see measeureItem() in CSideBarButtonItem
- bool m_isActive; // the sidebar is active (false, if it does _nothing at all_
- bool m_isVisible; // visible aswell (not collapsed)
- TSideBarLayout* m_currentLayout; // the layout in use. will be passed to new button items
- UINT m_uLayout; // layout id number, currently in use
+ HWND m_hwndScrollWnd;
+ OBJLIST<CSideBarButton> m_buttonlist; // our list of buttons
+ TContainerData* m_pContainer; // our master and commander...
+ LONG m_width; // required width of the bar (m_elementWidth + padding)
+ DWORD m_dwFlags;
+ CSideBarButton* m_up, *m_down; // the scroller buttons (up down)
+ CSideBarButton* m_activeItem; // active button item (for highlighting)
+ const CSideBarButton* m_hoveredClose; // item which must display an active close button
+ LONG m_topHeight, m_bottomHeight;
+ LONG m_firstVisibleOffset, m_totalItemHeight;
+ int m_iTopButtons, m_iBottomButtons;
+ LONG m_elementHeight, m_elementWidth; // width / height for a single element.
+ // can be dynamic (see measeureItem() in CSideBarButtonItem
+ bool m_isActive; // the sidebar is active (false, if it does _nothing at all_
+ bool m_isVisible; // visible aswell (not collapsed)
+ TSideBarLayout* m_currentLayout; // the layout in use. will be passed to new button items
+ UINT m_uLayout; // layout id number, currently in use
private:
- /*
- * layouts. m_layouts[] is static and contains layout descriptions
- * renderer functions are static aswell
- */
- static TSideBarLayout m_layouts[NR_LAYOUTS];
- static void __fastcall m_DefaultBackgroundRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
- static void __fastcall m_DefaultContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
- static void __fastcall m_AdvancedContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
-
- static const SIZE& __fastcall m_measureAdvancedVertical(CSideBarButton *item);
+ /*
+ * layouts. m_layouts[] is static and contains layout descriptions
+ * renderer functions are static aswell
+ */
+ static TSideBarLayout m_layouts[NR_LAYOUTS];
+ static void __fastcall m_DefaultBackgroundRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+ static void __fastcall m_DefaultContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+ static void __fastcall m_AdvancedContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+
+ static const SIZE& __fastcall m_measureAdvancedVertical(CSideBarButton *item);
};
inline void CSideBarButton::setLayout(const TSideBarLayout *newLayout)