diff options
author | George Hazan <ghazan@miranda.im> | 2018-02-21 18:35:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-02-21 18:40:14 +0300 |
commit | 429c0d0524e7197a593209468fef530344f5ee05 (patch) | |
tree | 71df95fdf71c52a956de69b6f31f3a6528053442 /plugins/TabSRMM/src/sidebar.cpp | |
parent | 5b6db3290cb9c9817cba126bd7aea798a610c31d (diff) |
tabsrmm: C++'11 iterators
Diffstat (limited to 'plugins/TabSRMM/src/sidebar.cpp')
-rw-r--r-- | plugins/TabSRMM/src/sidebar.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index f736e20e98..e205025321 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -732,12 +732,11 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) LONG height = m_elementHeight;
- for (int i = 0; i < m_buttonlist.getCount(); i++) {
- CSideBarButton &p = m_buttonlist[i];
- hwnd = p.getHwnd();
+ for (auto &p : m_buttonlist) {
+ hwnd = p->getHwnd();
if (m_dwFlags & SIDEBARLAYOUT_DYNHEIGHT)
- height = p.getHeight();
+ height = p->getHeight();
if (spaceUsed > iSpaceAvail || m_totalItemHeight + height < m_firstVisibleOffset) {
::ShowWindow(hwnd, SW_HIDE);
@@ -745,7 +744,7 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) continue;
}
- if (p.isTopAligned()) {
+ if (p->isTopAligned()) {
if (m_totalItemHeight <= m_firstVisibleOffset) { // partially visible
if (!fOnlyCalc && nullptr != hwnd) /* Wine fix. */
hdwp = ::DeferWindowPos(hdwp, hwnd, nullptr, 2, -(m_firstVisibleOffset - m_totalItemHeight),
@@ -793,8 +792,8 @@ void CSideBar::showAll(int showCmd) ::ShowWindow(m_up->getHwnd(), showCmd);
::ShowWindow(m_down->getHwnd(), showCmd);
- for (int i = 0; i < m_buttonlist.getCount(); i++)
- ::ShowWindow(m_buttonlist[i].getHwnd(), showCmd);
+ for (auto &it : m_buttonlist)
+ ::ShowWindow(it->getHwnd(), showCmd);
}
/**
@@ -811,11 +810,9 @@ CSideBarButton* CSideBar::findSession(const CTabBaseDlg *dat) if (dat == nullptr)
return nullptr;
- for (int i = 0; i < m_buttonlist.getCount(); i++) {
- CSideBarButton &p = m_buttonlist[i];
- if (p.getDat() == dat)
- return &p;
- }
+ for (auto &it : m_buttonlist)
+ if (it->getDat() == dat)
+ return it;
return nullptr;
}
@@ -834,11 +831,9 @@ CSideBarButton* CSideBar::findSession(const MCONTACT hContact) if (hContact == 0)
return nullptr;
- for (int i = 0; i < m_buttonlist.getCount(); i++) {
- CSideBarButton &p = m_buttonlist[i];
- if (p.getContactHandle() == hContact)
- return &p;
- }
+ for (auto &it : m_buttonlist)
+ if (it->getContactHandle() == hContact)
+ return it;
return nullptr;
}
|