Skip to content

Commit

Permalink
added function override for AddAllOtherAnchors
Browse files Browse the repository at this point in the history
added missing argument to specify bottom right corner
  • Loading branch information
ppescher committed Jan 3, 2018
1 parent a198f5d commit 3ae8462
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ResizableComboBox/DemoDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ BOOL CDemoDlg::OnInitDialog()
AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_EDIT1, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_LIST1, TOP_RIGHT, BOTTOM_RIGHT);

AddAllOtherAnchors(TOP_LEFT, TOP_RIGHT);

m_ctrlList1.AddString(_T("a very very very loooong item text"));
m_ctrlList1.SetHorizontalExtent(400);
Expand Down
6 changes: 4 additions & 2 deletions ResizableLib/ResizableLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ void CResizableLayout::AddAnchor(HWND hWnd, ANCHOR anchorTopLeft, ANCHOR anchorB
* This function adds all the controls not yet added to the layout manager
* and sets anchor points for its top-left and bottom-right corners.
*
* @param anchorTopLeft Anchor point for the top-left corner
* @param anchorBottomRight Anchor point for the bottom-right corner
* @param anchor Anchor point for the top-left and bottom-right corner
*
* @remarks Overlapping controls, like group boxes and the controls inside,
Expand All @@ -120,7 +122,7 @@ void CResizableLayout::AddAnchor(HWND hWnd, ANCHOR anchorTopLeft, ANCHOR anchorB
*
* @sa AddAnchor
*/
void CResizableLayout::AddAllOtherAnchors(ANCHOR anchor)
void CResizableLayout::AddAllOtherAnchors(ANCHOR anchorTopLeft, ANCHOR anchorBottomRight)
{
HWND hParent = GetResizableWnd()->GetSafeHwnd();
ASSERT(::IsWindow(hParent));
Expand All @@ -130,7 +132,7 @@ void CResizableLayout::AddAllOtherAnchors(ANCHOR anchor)
{
POSITION pos;
if (!m_mapLayout.Lookup(hWnd, pos))
AddAnchor(hWnd, anchor, anchor);
AddAnchor(hWnd, anchorTopLeft, anchorBottomRight);

hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT);
}
Expand Down
7 changes: 6 additions & 1 deletion ResizableLib/ResizableLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ class CResizableLayout

//@{
//! @brief Add anchor points for all the remaining controls to the layout
void AddAllOtherAnchors(ANCHOR anchor);
void AddAllOtherAnchors(ANCHOR anchorTopLeft, ANCHOR anchorBottomRight);

void AddAllOtherAnchors(ANCHOR anchor)
{
AddAllOtherAnchors(anchor, anchor);
}

void AddAllOtherAnchors()
{
Expand Down

0 comments on commit 3ae8462

Please sign in to comment.