Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move some inline functions from the header to the cpp file because of… #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ResizableLib/ResizableDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
LoadWindowRect(pszSection, bRectOnly);
}

/*virtual*/ CWnd* CResizableDialog::GetResizableWnd() const
{
// make the layout know its parent window
return CWnd::FromHandle(m_hWnd);
};

BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC)
{
ClipChildren(pDC, FALSE);
Expand Down
6 changes: 1 addition & 5 deletions ResizableLib/ResizableDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ class CResizableDialog : public CDialog, public CResizableLayout,
// section to use in app's profile
void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);

virtual CWnd* GetResizableWnd() const
{
// make the layout know its parent window
return CWnd::FromHandle(m_hWnd);
};
virtual CWnd* GetResizableWnd() const;

// Generated message map functions
protected:
Expand Down
32 changes: 32 additions & 0 deletions ResizableLib/ResizableLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ void CResizableLayout::AddAnchor(HWND hWnd, ANCHOR anchorTopLeft, ANCHOR anchorB
m_mapLayout.SetAt(hWnd, pos);
}

void CResizableLayout::AddAnchor(HWND hWnd, ANCHOR anchorTopLeft)
{
AddAnchor(hWnd, anchorTopLeft, anchorTopLeft);
}

void CResizableLayout::AddAnchor(UINT nID, ANCHOR anchorTopLeft, ANCHOR anchorBottomRight)
{
AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
anchorTopLeft, anchorBottomRight);
}

void CResizableLayout::AddAnchor(UINT nID, ANCHOR anchorTopLeft)
{
AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
anchorTopLeft, anchorTopLeft);
}

/*!
* 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.
Expand Down Expand Up @@ -143,6 +160,21 @@ void CResizableLayout::AddAllOtherAnchors(ANCHOR anchorTopLeft, ANCHOR anchorBot
}
}

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

void CResizableLayout::AddAllOtherAnchors()
{
AddAllOtherAnchors(TOP_LEFT);
}

BOOL CResizableLayout::RemoveAnchor(UINT nID)
{
return RemoveAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID));
}

/*!
* This function adds a placeholder to the layout manager, that will be
* dinamically set by a callback function whenever required.
Expand Down
33 changes: 7 additions & 26 deletions ResizableLib/ResizableLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,37 +186,21 @@ class CResizableLayout
//! @brief Add anchor points for the specified control to the layout
void AddAnchor(HWND hWnd, ANCHOR anchorTopLeft, ANCHOR anchorBottomRight);

void AddAnchor(HWND hWnd, ANCHOR anchorTopLeft)
{
AddAnchor(hWnd, anchorTopLeft, anchorTopLeft);
}
void AddAnchor(HWND hWnd, ANCHOR anchorTopLeft);

void AddAnchor(UINT nID, ANCHOR anchorTopLeft, ANCHOR anchorBottomRight)
{
AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
anchorTopLeft, anchorBottomRight);
}
void AddAnchor(UINT nID, ANCHOR anchorTopLeft, ANCHOR anchorBottomRight);

void AddAnchor(UINT nID, ANCHOR anchorTopLeft)
{
AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
anchorTopLeft, anchorTopLeft);
}
void AddAnchor(UINT nID, ANCHOR anchorTopLeft);
//@}

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

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

void AddAllOtherAnchors()
{
AddAllOtherAnchors(TOP_LEFT);
}

void AddAllOtherAnchors();
//@}

//! @brief Add a callback slot to the layout for dynamic controls or anchor points
Expand Down Expand Up @@ -266,10 +250,7 @@ class CResizableLayout
return m_mapLayout.RemoveKey(hWnd);
}

BOOL RemoveAnchor(UINT nID)
{
return RemoveAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID));
}
BOOL RemoveAnchor(UINT nID);
//@}

//! @brief Reset the layout content
Expand Down