Muokkaa

Jaa


CMFCDropDownFrame Class

Provides drop-down frame window functionality to drop-down toolbars and drop-down toolbar buttons.

Syntax

class CMFCDropDownFrame : public CMiniFrameWnd

Members

Public Constructors

Name Description
CMFCDropDownFrame::CMFCDropDownFrame Default constructor.
CMFCDropDownFrame::~CMFCDropDownFrame Destructor.

Public Methods

Name Description
CMFCDropDownFrame::Create Creates a CMFCDropDownFrame object.
CMFCDropDownFrame::CreateObject Used by the framework to create a dynamic instance of this class type.
CMFCDropDownFrame::GetParentMenuBar Retrieves the parent menu bar of the drop-down frame.
CMFCDropDownFrame::GetParentPopupMenu Retrieves the parent pop-up menu of the drop-down frame.
CMFCDropDownFrame::GetThisClass Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCDropDownFrame::RecalcLayout Repositions the drop-down frame.
CMFCDropDownFrame::SetAutoDestroy Sets whether the child drop-down toolbar window is destroyed automatically.

Remarks

This class is not intended to be used directly from your code.

The framework uses this class to provide frame behavior to the CMFCDropDownToolbar and CMFCDropDownToolbarButton classes. For more information about these classes, see CMFCDropDownToolBar Class and CMFCDropDownToolbarButton Class.

Example

The following example demonstrates how to retrieve a pointer to a CMFCDropDownFrame object from a CFrameWnd class, and how to set the child drop-down toolbar window to be destroyed automatically.

CFrameWnd *pTopFrame = AFXGetParentFrame(this);
if (pTopFrame == NULL)
{
   return FALSE;
}

CMFCDropDownFrame *pDropFrame = DYNAMIC_DOWNCAST(CMFCDropDownFrame, pTopFrame);
pDropFrame->SetAutoDestroy(true);

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CFrameWnd

CMiniFrameWnd

CMFCDropDownFrame

Requirements

Header: afxdropdowntoolbar.h

CMFCDropDownFrame::Create

Creates a CMFCDropDownFrame object.

virtual BOOL Create(
    CWnd* pWndParent,
    int x,
    int y,
    CMFCDropDownToolBar* pWndOriginToolbar);

Parameters

pWndParent
[in] The parent window of the drop-down frame.

x
[in] The horizontal screen coordinate for the location of the down-down frame.

y
[in] The vertical screen coordinate for the location of the down-down frame.

pWndOriginToolbar
[in] The toolbar that has the drop-down buttons that this method uses to populate the new drop-down frame object.

Return Value

TRUE if the drop-down frame was successfully created; otherwise FALSE.

Remarks

This method calls the base CMiniFrameWnd::CreateEx method to create the drop-down frame window with the WS_POPUP style. The drop-down frame window appears at the specified screen coordinates. This method fails if the CMiniFrameWnd::CreateEx method returns FALSE.

The CMFCDropDownFrame class creates a copy of the provided CMFCDropDownToolBar parameter. This method copies the button images and button states from the pWndOriginToolbar parameter to the m_pWndOriginToolbar data member.

CMFCDropDownFrame::GetParentMenuBar

Retrieves the parent menu bar of the drop-down frame.

CMFCMenuBar* GetParentMenuBar() const;

Return Value

A pointer to the parent menu bar of the drop-down frame, or NULL if the frame has no parent.

Remarks

This method retrieves the parent menu bar from the parent button. This method returns NULL if the drop-down frame has no parent button or the parent button has no parent menu bar.

CMFCDropDownFrame::GetParentPopupMenu

Retrieves the parent pop-up menu of the drop-down frame.

CMFCDropDownFrame* GetParentPopupMenu() const;

Return Value

A pointer to the parent drop-down menu of the drop-down frame, or NULL if the frame has no parent.

Remarks

This method retrieves the parent menu from the parent button. This method returns NULL if the drop-down frame has no parent button or the parent button has no parent menu.

CMFCDropDownFrame::RecalcLayout

Repositions the drop-down frame.

virtual void RecalcLayout(BOOL bNotify = TRUE);

Parameters

bNotify
[in] Unused.

Remarks

The framework calls this method when the drop-down frame is created or the parent window is resized. This method calculates the position and size of the drop-down frame by using the position and size of the parent window.

CMFCDropDownFrame::SetAutoDestroy

Sets whether the child drop-down toolbar window is destroyed automatically.

void SetAutoDestroy(BOOL bAutoDestroy = TRUE);

Parameters

bAutoDestroy
[in] TRUE to automatically destroy the associated drop-down toolbar window; otherwise, FALSE.

Remarks

If bAutoDestroy is TRUE, then the CMFCDropDownFrame destructor destroys the associated drop-down toolbar window. The default value is TRUE.

See also

Hierarchy Chart
Classes
CMFCDropDownToolBar Class
CMFCDropDownToolbarButton Class