Klasa CMFCToolBarMenuButtonCMFCToolBarMenuButton Class
Przycisk paska narzędzi, który zawiera menu rozwijane.A toolbar button that contains a pop-up menu. Aby uzyskać więcej szczegółów, zobacz kod źródłowy znajdujący się w folderze VC \ atlmfc \ src \ MFC instalacji programu Visual Studio.For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
SkładniaSyntax
class CMFCToolBarMenuButton : public CMFCToolBarButton
Elementy członkowskieMembers
Konstruktory publicznePublic Constructors
NazwaName | OpisDescription |
---|---|
CMFCToolBarMenuButton::CMFCToolBarMenuButtonCMFCToolBarMenuButton::CMFCToolBarMenuButton | Konstruuje CMFCToolBarMenuButton obiekt.Constructs a CMFCToolBarMenuButton object. |
Metody publicznePublic Methods
NazwaName | OpisDescription |
---|---|
CMFCToolBarMenuButton:: CompareWith —CMFCToolBarMenuButton::CompareWith | Porównuje to wystąpienie z podanym CMFCToolBarButton obiektem.Compares this instance with the provided CMFCToolBarButton object. (Przesłania CMFCToolBarButton:: CompareWith —.)(Overrides CMFCToolBarButton::CompareWith.) |
CMFCToolBarMenuButton::CopyFromCMFCToolBarMenuButton::CopyFrom | Kopiuje właściwości innego przycisku paska narzędzi do bieżącego przycisku.Copies the properties of another toolbar button to the current button. (Przesłania CMFCToolBarButton:: CopyFrom.)(Overrides CMFCToolBarButton::CopyFrom.) |
CMFCToolBarMenuButton::CreateFromMenuCMFCToolBarMenuButton::CreateFromMenu | Inicjuje menu paska narzędzi z dojścia do menu systemu Windows.Initializes the toolbar menu from a Windows menu handle. |
CMFCToolBarMenuButton:: \ menuCMFCToolBarMenuButton::CreateMenu | Tworzy menu systemu Windows, które składa się z poleceń z menu paska narzędzi.Creates a Windows menu that consists of the commands in the toolbar menu. Zwraca uchwyt do menu systemu Windows.Returns a handle to the Windows menu. |
CMFCToolBarMenuButton::CreatePopupMenuCMFCToolBarMenuButton::CreatePopupMenu | Tworzy obiekt menu podręcznego ( Klasa CMFCPopupMenu), aby wyświetlić menu paska narzędzi.Creates a pop-up menu object ( CMFCPopupMenu Class) to display the toolbar menu. |
CMFCToolBarMenuButton::EnableQuickCustomizeCMFCToolBarMenuButton::EnableQuickCustomize | |
CMFCToolBarMenuButton:: GetCommandsCMFCToolBarMenuButton::GetCommands | Zapewnia dostęp tylko do odczytu do listy poleceń w menu paska narzędzi.Gives read-only access to the list of commands in the toolbar menu. |
CMFCToolBarMenuButton::GetImageRectCMFCToolBarMenuButton::GetImageRect | Pobiera prostokąt ograniczenia dla obrazu przycisku.Retrieves the bounding rectangle for the button image. |
CMFCToolBarMenuButton::GetPaletteRowsCMFCToolBarMenuButton::GetPaletteRows | Zwraca liczbę wierszy w menu podręcznym, gdy menu jest w trybie palety.Returns the number of rows in the pop-up menu when the menu is in palette mode. |
CMFCToolBarMenuButton::GetPopupMenuCMFCToolBarMenuButton::GetPopupMenu | Zwraca wskaźnik do obiektu menu podręcznego, który jest skojarzony z przyciskiem.Returns a pointer to the pop-up menu object that is associated with the button. |
CMFCToolBarMenuButton::HasButtonCMFCToolBarMenuButton::HasButton | |
CMFCToolBarMenuButton::HaveHotBorderCMFCToolBarMenuButton::HaveHotBorder | Określa, czy obramowanie przycisku ma być wyświetlane, gdy użytkownik wybierze przycisk.Determines whether a border of the button is displayed when a user selects the button. (Przesłania CMFCToolBarButton:: HaveHotBorder.)(Overrides CMFCToolBarButton::HaveHotBorder.) |
CMFCToolBarMenuButton:: isborderCMFCToolBarMenuButton::IsBorder | |
CMFCToolBarMenuButton::IsClickedOnMenuCMFCToolBarMenuButton::IsClickedOnMenu | |
CMFCToolBarMenuButton::IsDroppedDownCMFCToolBarMenuButton::IsDroppedDown | Określa, czy wyświetlane jest menu podręczne.Determines whether the pop-up menu is displayed. |
CMFCToolBarMenuButton::IsEmptyMenuAllowedCMFCToolBarMenuButton::IsEmptyMenuAllowed | Wywoływane przez platformę, aby określić, czy użytkownik może otworzyć podmenu z wybranego elementu menu.Called by the framework to determine whether a user can open a submenu from the selected menu item. |
CMFCToolBarMenuButton:: iswyłącznoociCMFCToolBarMenuButton::IsExclusive | Określa, czy przycisk jest w trybie wyłączności, czyli czy menu podręczne pozostaje otwarte nawet wtedy, gdy użytkownik przesuwa wskaźnik myszy nad innym paskiem narzędzi lub przyciskiem.Determines whether the button is in exclusive mode, that is, whether the pop-up menu remains open even when the user moves the pointer over another toolbar or button. |
CMFCToolBarMenuButton::IsMenuPaletteModeCMFCToolBarMenuButton::IsMenuPaletteMode | Określa, czy menu podręczne jest w trybie palety.Determines whether the pop-up menu is in palette mode. |
CMFCToolBarMenuButton:: isquickmodeCMFCToolBarMenuButton::IsQuickMode | |
CMFCToolBarMenuButton::IsTearOffMenuCMFCToolBarMenuButton::IsTearOffMenu | Określa, czy menu podręczne ma pasek odrywany.Determines whether the pop-up menu has a tear-off bar. |
CMFCToolBarMenuButton::OnAfterCreatePopupMenuCMFCToolBarMenuButton::OnAfterCreatePopupMenu | |
CMFCToolBarMenuButton::OnBeforeDragCMFCToolBarMenuButton::OnBeforeDrag | Określa, czy przycisk może być przeciągany.Specifies whether the button can be dragged. (Przesłania CMFCToolBarButton:: OnBeforeDrag.)(Overrides CMFCToolBarButton::OnBeforeDrag.) |
CMFCToolBarMenuButton::OnCalculateSizeCMFCToolBarMenuButton::OnCalculateSize | Wywoływane przez platformę, by obliczyć rozmiar przycisku dla określonego kontekstu urządzenia i stanu dokowania.Called by the framework to calculate the size of the button for the specified device context and docking state. (Przesłania CMFCToolBarButton:: OnCalculateSize.)(Overrides CMFCToolBarButton::OnCalculateSize.) |
CMFCToolBarMenuButton:: oncancelmodeCMFCToolBarMenuButton::OnCancelMode | Wywoływane przez platformę, aby obsłużyć WM_CANCELMODE komunikat.Called by the framework to handle the WM_CANCELMODE message. (Przesłania CMFCToolBarButton:: Oncancelmode).(Overrides CMFCToolBarButton::OnCancelMode.) |
CMFCToolBarMenuButton::OnChangeParentWndCMFCToolBarMenuButton::OnChangeParentWnd | Wywoływane przez platformę, gdy przycisk zostanie wstawiony do nowego paska narzędzi.Called by the framework when the button is inserted into a new toolbar. (Przesłania CMFCToolBarButton:: OnChangeParentWnd.)(Overrides CMFCToolBarButton::OnChangeParentWnd.) |
CMFCToolBarMenuButton:: onkliknięciaCMFCToolBarMenuButton::OnClick | Wywoływane przez platformę, gdy użytkownik kliknie przycisk myszy.Called by the framework when the user clicks the mouse button. (Przesłania CMFCToolBarButton:: onkliknięciu.)(Overrides CMFCToolBarButton::OnClick.) |
CMFCToolBarMenuButton::OnClickMenuItemCMFCToolBarMenuButton::OnClickMenuItem | Wywoływane przez platformę, gdy użytkownik wybierze element z menu podręcznego.Called by the framework when the user selects an item in the pop-up menu. |
CMFCToolBarMenuButton::OnContextHelpCMFCToolBarMenuButton::OnContextHelp | Wywoływane przez platformę, gdy nadrzędny pasek narzędzi obsługuje komunikat WM_HELPHITTEST.Called by the framework when the parent toolbar handles a WM_HELPHITTEST message. (Przesłania CMFCToolBarButton:: OnContextHelp.)(Overrides CMFCToolBarButton::OnContextHelp.) |
CMFCToolBarMenuButton:: OnDrawCMFCToolBarMenuButton::OnDraw | Wywoływane przez platformę, by narysować przycisk przy użyciu określonych stylów i opcji.Called by the framework to draw the button by using the specified styles and options. (Przesłania CMFCToolBarButton:: OnDraw.)(Overrides CMFCToolBarButton::OnDraw.) |
CMFCToolBarMenuButton::OnDrawOnCustomizeListCMFCToolBarMenuButton::OnDrawOnCustomizeList | Wywoływane przez platformę, aby narysować przycisk w okienku polecenia okna dialogowego Dostosowywanie .Called by the framework to draw the button in the Commands pane of the Customize dialog box. (Przesłania CMFCToolBarButton:: OnDrawOnCustomizeList.)(Overrides CMFCToolBarButton::OnDrawOnCustomizeList.) |
CMFCToolBarMenuButton::OpenPopupMenuCMFCToolBarMenuButton::OpenPopupMenu | Wywoływane przez platformę, gdy użytkownik otwiera menu podręczne.Called by the framework when the user opens the pop-up menu. |
CMFCToolBarMenuButton::ResetImageToDefaultCMFCToolBarMenuButton::ResetImageToDefault | Ustawia wartość domyślną obrazu, który jest skojarzony z przyciskiem.Sets to the default value the image that is associated with the button. (Przesłania CMFCToolBarButton:: ResetImageToDefault.)(Overrides CMFCToolBarButton::ResetImageToDefault.) |
CMFCToolBarMenuButton::SaveBarStateCMFCToolBarMenuButton::SaveBarState | Zapisuje stan przycisku paska narzędzi.Saves the state of the toolbar button. (Przesłania CMFCToolBarButton:: SaveBarState.)(Overrides CMFCToolBarButton::SaveBarState.) |
CMFCToolBarMenuButton:: serializowaćCMFCToolBarMenuButton::Serialize | Odczytuje ten obiekt z archiwum lub zapisuje je w archiwum.Reads this object from an archive or writes it to an archive. (Przesłania CMFCToolBarButton:: serializować).(Overrides CMFCToolBarButton::Serialize.) |
CMFCToolBarMenuButton::SetACCDataCMFCToolBarMenuButton::SetACCData | Wypełnia udostępniony CAccessibilityData obiekt z danymi dostępności za pomocą przycisku paska narzędzi.Populates the provided CAccessibilityData object with accessibility data from the toolbar button. (Przesłania CMFCToolBarButton:: SetACCData.)(Overrides CMFCToolBarButton::SetACCData.) |
CMFCToolBarMenuButton::SetMenuOnlyCMFCToolBarMenuButton::SetMenuOnly | Określa, czy przycisk można dodać do paska narzędzi.Specifies whether the button can be added to a toolbar. |
CMFCToolBarMenuButton::SetMenuPaletteModeCMFCToolBarMenuButton::SetMenuPaletteMode | Określa, czy menu podręczne jest w trybie palety.Specifies whether the pop-up menu is in palette mode. |
CMFCToolBarMenuButton::SetMessageWndCMFCToolBarMenuButton::SetMessageWnd | |
CMFCToolBarMenuButton:: SetRadioCMFCToolBarMenuButton::SetRadio | Wymusza przycisk menu paska narzędzi, aby wyświetlić ikonę wskazującą, że jest zaznaczona.Forces the toolbar menu button to display an icon indicating that it is selected. |
CMFCToolBarMenuButton::SetTearOffCMFCToolBarMenuButton::SetTearOff | Określa identyfikator paska dla menu podręcznego.Specifies a tear-off bar ID for the pop-up menu. |
Metody chronioneProtected Methods
NazwaName | OpisDescription |
---|---|
CMFCToolBarMenuButton::D rawDocumentIconCMFCToolBarMenuButton::DrawDocumentIcon | Rysuje ikonę na przycisku menu.Draws an icon on the menu button. |
Elementy członkowskie danychData Members
NazwaName | OpisDescription |
---|---|
CMFCToolBarMenuButton:: m_bAlwaysCallOwnerDrawCMFCToolBarMenuButton::m_bAlwaysCallOwnerDraw | Jeśli wartość jest równa TRUE, struktura zawsze wywołuje CFrameWndEx:: OnDrawMenuImage po narysowaniu przycisku.If TRUE, the framework always calls CFrameWndEx::OnDrawMenuImage when a button is drawn. |
UwagiRemarks
CMFCToolBarMenuButton
Może pojawić się jako menu, element menu, który ma podmenu, przycisk, który wykonuje polecenie lub wyświetla menu, lub przycisk, który wyświetla tylko menu.A CMFCToolBarMenuButton
can appear as a menu, a menu item that has a sub-menu, a button that either executes a command or displays a menu, or a button that displays only a menu. Możesz określić zachowanie i wygląd przycisku menu, określając parametry, takie jak obraz, tekst, uchwyt menu i identyfikator polecenia, które są skojarzone z przyciskiem w konstruktorze CMFCToolbarMenuButton::CMFCToolbarMenuButton
.You determine the behavior and appearance of the menu button by specifying parameters such as the image, text, menu handle, and command ID that is associated with the button in the constructor CMFCToolbarMenuButton::CMFCToolbarMenuButton
.
Klasa niestandardowa pochodna CMFCToolbarMenuButton
klasy musi używać makra DECLARE_SERIAL .A custom class derived from the CMFCToolbarMenuButton
class must use the DECLARE_SERIAL macro. Makro DECLARE_DYNCREATE generuje błąd podczas zamykania aplikacji.The DECLARE_DYNCREATE macro generates an error when the application closes.
PrzykładExample
Poniższy przykład ilustruje sposób konfigurowania CMFCToolBarMenuButton
obiektu.The following example demonstrates how to configure a CMFCToolBarMenuButton
object. Kod pokazuje, jak określić, że menu rozwijane jest w trybie palety i określa identyfikator paska odrywania, który jest tworzony, gdy użytkownik przeciągnie przycisk menu poza pasek menu.The code illustrates how to specify that the drop-down menu is in palette mode, and specify the ID for the tear-off bar that is created when the user drags the menu button off of a menu bar. Ten fragment kodu jest częścią przykładu Notatnika programu Word.This code snippet is part of the Word Pad sample.
pBorderType->SetMenuPaletteMode(TRUE, 2 /* Rows number */);
pBorderType->SetTearOff(ID_BORDER_TEAROFF);
Hierarchia dziedziczeniaInheritance Hierarchy
CMFCToolBarButtonCMFCToolBarButton
CMFCToolBarMenuButtonCMFCToolBarMenuButton
WymaganiaRequirements
Nagłówek: afxtoolbarmenubutton. hHeader: afxtoolbarmenubutton.h
CMFCToolBarMenuButton::CMFCToolBarMenuButtonCMFCToolBarMenuButton::CMFCToolBarMenuButton
Konstruuje CMFCToolBarMenuButton
obiekt.Constructs a CMFCToolBarMenuButton
object.
CMFCToolBarMenuButton();
CMFCToolBarMenuButton(const CMFCToolBarMenuButton& src);
CMFCToolBarMenuButton(
UINT uiID,
HMENU hMenu,
int iImage,
LPCTSTR lpszText=NULL,
BOOL bUserButton=FALSE);
ParametryParameters
srcsrc
podczas Istniejący CMFCToolBarMenuButton
obiekt do skopiowania do tego CMFCToolBarMenuButton
obiektu.[in] An existing CMFCToolBarMenuButton
object to be copied into this CMFCToolBarMenuButton
object.
uiIDuiID
podczas Identyfikator polecenia do wykonania, gdy użytkownik kliknie przycisk; lub (UINT)-1 dla przycisku menu, który nie wykonuje bezpośrednio polecenia.[in] The ID of the command to execute when a user clicks the button; or (UINT)-1 for a menu button that does not directly execute a command.
hMenuhMenu
podczas Uchwyt do menu; lub wartość NULL, jeśli przycisk nie ma menu.[in] A handle to a menu; or NULL if the button does not have a menu.
iImageiImage
podczas Indeks obrazu przycisku; lub-1, jeśli ten przycisk nie ma ikony lub używa ikony dla polecenia określonego przez uiID.[in] Index of the image for the button; or -1 if this button does not have an icon or uses the icon for the command specified by uiID. Indeks jest taki sam dla każdego CMFCToolBarImages
obiektu w aplikacji.The index is the same for each CMFCToolBarImages
object in your application.
lpszTextlpszText
podczas Tekst przycisku menu paska narzędzi.[in] The text of the toolbar menu button.
bUserButtonbUserButton
podczas TRUE, jeśli przycisk wyświetla obraz zdefiniowany przez użytkownika; Wartość FALSE, jeśli przycisk wyświetla wstępnie zdefiniowany obraz skojarzony z poleceniem określonym przez uiID.[in] TRUE if the button displays a user-defined image; FALSE if the button displays a predefined image associated with the command specified by uiID.
UwagiRemarks
Jeśli uiID jest PRAWIDŁOWYm identyfikatorem polecenia, przycisk wykonuje to polecenie po kliknięciu przez użytkownika.If uiID is a valid command ID, the button performs that command when the user clicks it. Jeśli HMENU jest prawidłowym uchwytem menu, przycisk udostępnia menu rozwijane, gdy pojawia się on na pasku narzędzi lub podmenu, gdy pojawia się w menu.If hMenu is a valid menu handle, the button provides a drop-down menu when it appears in a toolbar or a submenu when it appears in a menu. Jeśli zarówno uiID , jak i HMENU są prawidłowe, przycisk jest przyciskiem podziału z częścią, która wykona polecenie po kliknięciu go przez użytkownika, a częścią ze strzałką w dół, która spowoduje wyświetlenie menu po kliknięciu go przez użytkownika.If both uiID and hMenu are valid, the button is a split-button with a portion that will perform the command when the user clicks on it and a portion with a down arrow that will drop-down a menu when the user clicks on it. Jeśli jednak HMENU jest prawidłowy, użytkownik nie będzie mógł kliknąć przycisku, aby wykonać polecenie, gdy przycisk zostanie wstawiony do menu.However, if hMenu is valid, a user will not be able to click the button to perform a command when the button is inserted into a menu.
PrzykładExample
Poniższy przykład ilustruje sposób konstruowania obiektu CMFCToolBarMenuButton
klasy.The following example demonstrates how to construct an object of the CMFCToolBarMenuButton
class. Ten fragment kodu jest częścią przykładu Notatnika programu Word.This code snippet is part of the Word Pad sample.
CMFCToolBarMenuButton *pBorderType = new CMFCToolBarMenuButton(ID_BORDER_1, pPopup->GetSafeHmenu(),
GetCmdMgr()->GetCmdImage(ID_BORDER_1, FALSE),
_T("Borders"));
CMFCToolBarMenuButton:: CompareWith —CMFCToolBarMenuButton::CompareWith
virtual BOOL CompareWith(const CMFCToolBarButton& other) const;
ParametryParameters
podczas inne[in] other
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton::CopyFromCMFCToolBarMenuButton::CopyFrom
virtual void CopyFrom(const CMFCToolBarButton& src);
ParametryParameters
podczas src[in] src
UwagiRemarks
CMFCToolBarMenuButton::CreateFromMenuCMFCToolBarMenuButton::CreateFromMenu
Inicjuje menu paska narzędzi z dojścia do menu systemu Windows.Initializes the toolbar menu from a Windows menu handle.
virtual void CreateFromMenu(HMENU hMenu);
ParametryParameters
hMenuhMenu
podczas Uchwyt do menu.[in] A handle to a menu.
UwagiRemarks
Przycisk menu paska narzędzi może wyświetlić podmenu rozwijane.A toolbar menu button can display a drop-down submenu.
Struktura wywołuje tę metodę, aby zainicjować polecenia w podmenu z menu.The framework calls this method to initialize the commands in the submenu from a menu.
CMFCToolBarMenuButton:: \ menuCMFCToolBarMenuButton::CreateMenu
Tworzy menu, które składa się z poleceń w menu paska narzędzi.Creates a menu that consists of the commands in the toolbar menu. Zwraca uchwyt do menu.Returns a handle to the menu.
virtual HMENU CreateMenu() const;
Wartość zwracanaReturn Value
Uchwyt do menu, jeśli powodzenie.A handle to the menu if success. Wartość NULL, jeśli lista poleceń skojarzonych z przyciskiem menu paska narzędzi jest pusta.NULL if the list of commands associated with the toolbar menu button is empty.
UwagiRemarks
Można zastąpić tę metodę w klasie pochodnej, aby dostosować sposób generowania menu.You can override this method in a derived class to customize the way the menu is generated.
CMFCToolBarMenuButton::CreatePopupMenuCMFCToolBarMenuButton::CreatePopupMenu
Tworzy CMFCPopupMenu
obiekt do wyświetlania menu paska narzędzi.Creates a CMFCPopupMenu
object to display the toolbar menu.
virtual CMFCPopupMenu* CreatePopupMenu();
Wartość zwracanaReturn Value
Wskaźnik do CMFCPopupMenu
obiektu, który wyświetla menu rozwijane skojarzone z menu paska narzędzi.A pointer to a CMFCPopupMenu
object that displays the drop-down menu associated with the toolbar menu button.
UwagiRemarks
Ta metoda jest wywoływana przez platformę w celu przygotowania wyświetlania menu rozwijanego skojarzonego z przyciskiem.This method is called by the framework to prepare the display of the drop-down menu associated with the button.
Domyślna implementacja tylko konstruuje i zwraca nowy CMFCPopupMenu
obiekt.The default implementation just constructs and returns a new CMFCPopupMenu
object. Zastąp tę metodę, jeśli chcesz użyć typu pochodnego klasy CMFCPopupMenu lub dokonać dodatkowej inicjalizacji.Override this method if you want to use a derived type of CMFCPopupMenu Class or to perform additional initialization.
CMFCToolBarMenuButton::D rawDocumentIconCMFCToolBarMenuButton::DrawDocumentIcon
Rysuje ikonę dokumentu na przycisku menu.Draws a document icon on the menu button.
void DrawDocumentIcon(
CDC* pDC,
const CRect& rectImage,
HICON hIcon);
ParametryParameters
DomenypDC
podczas Wskaźnik do kontekstu urządzenia.[in] A pointer to the device context.
rectImagerectImage
podczas Współrzędne prostokąta obwiedni obrazu.[in] Coordinates of the image bounding rectangle.
hIconhIcon
podczas Uchwyt do ikony.[in] A handle to the icon.
UwagiRemarks
Ta metoda przyjmuje ikonę dokumentu i rysuje ją na przycisku menu, wyśrodkowane w obszarze określonym przez rectImage.This method takes a document icon and draws it on the menu button, centered in the area specified by rectImage.
CMFCToolBarMenuButton::EnableQuickCustomizeCMFCToolBarMenuButton::EnableQuickCustomize
void EnableQuickCustomize();
UwagiRemarks
CMFCToolBarMenuButton::HasButtonCMFCToolBarMenuButton::HasButton
virtual BOOL HasButton() const;
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton::HaveHotBorderCMFCToolBarMenuButton::HaveHotBorder
virtual BOOL HaveHotBorder() const;
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton:: isborderCMFCToolBarMenuButton::IsBorder
virtual BOOL IsBorder() const;
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton::IsClickedOnMenuCMFCToolBarMenuButton::IsClickedOnMenu
BOOL IsClickedOnMenu() const;
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton:: isquickmodeCMFCToolBarMenuButton::IsQuickMode
BOOL IsQuickMode();
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton:: GetCommandsCMFCToolBarMenuButton::GetCommands
Zapewnia dostęp tylko do odczytu do listy poleceń w menu paska narzędzi.Gives read-only access to the list of commands in the toolbar menu.
const CObList& GetCommands() const;
Wartość zwracanaReturn Value
Odwołanie stałe do obiektu klasy CObList , który zawiera kolekcję obiektów klasy CMFCToolBarButton .A const reference to a CObList Class object, which contains a collection of CMFCToolBarButton Class objects.
UwagiRemarks
Przycisk menu paska narzędzi może wyświetlić podmenu.A toolbar menu button can display a submenu. Możesz podać listę poleceń w podmenu konstruktora lub w CMFCToolBarMenuButton:: CreateFromMenu jako uchwyt do menu (HMENU).You can provide the list of commands in the submenu in the constructor or in CMFCToolBarMenuButton::CreateFromMenu as a handle to a menu (HMENU). Menu jest konwertowane na listę obiektów, które pochodzą z klasy CMFCToolBarButton i są przechowywane w CObList
obiekcie wewnętrznym.The menu is converted to a list of objects that are derived from CMFCToolBarButton Class and stored in the internal CObList
object. Możesz uzyskać dostęp do tej listy, wywołując tę metodę.You can access this list by calling this method.
CMFCToolBarMenuButton::GetImageRectCMFCToolBarMenuButton::GetImageRect
Pobiera prostokąt ograniczenia dla obrazu przycisku.Retrieves the bounding rectangle for the button image.
void GetImageRect(CRect& rectImage);
ParametryParameters
rectImagerectImage
określoną Odwołanie do CRect
obiektu, który odbiera współrzędne prostokąta obwiedni obrazu.[out] A reference to a CRect
object that receives the coordinates of the image bounding rectangle.
CMFCToolBarMenuButton::GetPaletteRowsCMFCToolBarMenuButton::GetPaletteRows
Zwraca liczbę wierszy z menu rozwijanego, gdy menu jest w trybie palety.Returns the number of rows in the drop-down menu when the menu is in palette mode.
int GetPaletteRows() const;
Wartość zwracanaReturn Value
Liczba wierszy w palecie.The number of rows in the palette.
UwagiRemarks
Gdy przycisk menu jest ustawiony na tryb palety, elementy menu będą wyświetlane w wielu kolumnach z ograniczoną liczbą wierszy.When the menu button is set to palette mode, menu items will appear in multiple columns with only a limited number of rows. Wywołaj tę metodę, aby uzyskać liczbę wierszy.Call this method to obtain the number of rows. Można włączyć lub wyłączyć tryb palety oraz określić liczbę wierszy przy użyciu CMFCToolBarMenuButton:: SetMenuPaletteMode.You can enable or disable palette mode and specify the number of rows using CMFCToolBarMenuButton::SetMenuPaletteMode.
CMFCToolBarMenuButton::GetPopupMenuCMFCToolBarMenuButton::GetPopupMenu
Zwraca wskaźnik do obiektu klasy CMFCPopupMenu , który reprezentuje menu rozwijane przycisku.Returns a pointer to the CMFCPopupMenu Class object that represents the drop-down menu of the button.
CMFCPopupMenu* GetPopupMenu() const;
Wartość zwracanaReturn Value
Wskaźnik do obiektu klasy CMFCPopupMenu , który został utworzony, gdy struktura nabiera podmenu przycisku menu paska narzędzi. Wartość NULL, jeśli nie jest wyświetlane żadne podmenu.A pointer to a CMFCPopupMenu Class object that was created when the framework drew the submenu of the toolbar menu button; NULL if no submenu is displayed.
UwagiRemarks
Gdy przycisk menu paska narzędzi wyświetla menu rozwijane, przycisk tworzy obiekt klasy CMFCPopupMenu do reprezentowania menu.When a toolbar menu button displays a drop-down menu, the button creates a CMFCPopupMenu Class object to represent the menu. Wywołaj tę metodę, aby uzyskać wskaźnik do CMFCPopupMenu
obiektu.Call this method to obtain a pointer to the CMFCPopupMenu
object. Zwrócony wskaźnik nie powinien być przechowywany, ponieważ jest tymczasowy i jest nieprawidłowy, gdy użytkownik zamknie menu rozwijane.You should not store the returned pointer, because it is temporary and becomes invalid when the user closes the drop-down menu.
CMFCToolBarMenuButton::IsDroppedDownCMFCToolBarMenuButton::IsDroppedDown
Wskazuje, czy menu podręczne jest aktualnie wyświetlane.Indicates whether the pop-up menu is currently displayed.
virtual BOOL IsDroppedDown() const;
Wartość zwracanaReturn Value
TRUE, jeśli przycisk menu paska narzędzi wyświetla jego podmenu; w przeciwnym razie FALSE.TRUE if the toolbar menu button displays its submenu; otherwise FALSE.
CMFCToolBarMenuButton::IsEmptyMenuAllowedCMFCToolBarMenuButton::IsEmptyMenuAllowed
Określa, czy elementy menu wyświetlają puste podmenu.Specifies whether menu items shows empty submenus.
virtual BOOL IsEmptyMenuAllowed() const;
Wartość zwracanaReturn Value
Ma wartość TRUE, jeśli struktura otwiera podmenu z aktualnie wybranego elementu menu, nawet gdy podmenu jest puste. w przeciwnym razie FALSE.TRUE if the framework opens a submenu from the currently selected menu item even when the submenu is empty; otherwise FALSE.
UwagiRemarks
Struktura wywołuje tę metodę, gdy użytkownik próbuje otworzyć podmenu z aktualnie wybranego elementu menu.The framework calls this method when a user tries to open the submenu from the currently selected menu item. Jeśli podmenu jest puste i IsEmptyMenuAllowed
zwraca wartość false, podmenu nie zostanie otwarte.If the submenu is empty and IsEmptyMenuAllowed
returns FALSE, the submenu will not open.
Domyślna implementacja zwraca wartość FALSE.The default implementation returns FALSE. Zastąp tę metodę, aby dostosować to zachowanie.Override this method to customize this behavior.
CMFCToolBarMenuButton:: iswyłącznoociCMFCToolBarMenuButton::IsExclusive
Wskazuje, czy przycisk jest w trybie wyłączności.Indicates whether the button is in exclusive mode.
virtual BOOL IsExclusive() const;
Wartość zwracanaReturn Value
Ma wartość TRUE, jeśli przycisk działa w trybie wyłączności; w przeciwnym razie FALSE.TRUE if the button is working in exclusive mode; otherwise FALSE.
UwagiRemarks
Gdy użytkownik otwiera menu podręczne dla przycisku, a następnie przesuwa wskaźnik myszy nad innym paskiem narzędzi lub przyciskiem menu, menu podręczne jest zamykane, chyba że przycisk jest w trybie wyłączności.When a user opens a popup menu for a button and then moves the mouse pointer over another toolbar or menu button, the popup menu closes unless the button is in exclusive mode.
Domyślna implementacja zawsze zwraca wartość FALSE.The default implementation always returns FALSE. Zastąp tę metodę w klasie pochodnej, jeśli chcesz włączyć tryb wyłączny.Override this method in a derived class if you want to turn on exclusive mode.
CMFCToolBarMenuButton::IsMenuPaletteModeCMFCToolBarMenuButton::IsMenuPaletteMode
Określa, czy menu rozwijane jest w trybie palety.Determines whether the drop-down menu is in palette mode.
BOOL IsMenuPaletteMode() const;
Wartość zwracanaReturn Value
Ma wartość TRUE, jeśli tryb palety jest włączony, w przeciwnym razie FALSE.TRUE if the palette mode is enabled, otherwise FALSE.
UwagiRemarks
Gdy przycisk menu jest ustawiony na tryb palety, elementy menu są wyświetlane w wielu kolumnach z ograniczoną liczbą wierszy.When the menu button is set to palette mode, menu items appear in multiple columns with only a limited number of rows. Wywołaj tę metodę, aby uzyskać liczbę wierszy.Call this method to obtain the number of rows. Możesz włączyć lub wyłączyć tryb palety, wywołując CMFCToolBarMenuButton:: SetMenuPaletteMode.You can enable or disable the palette mode by calling CMFCToolBarMenuButton::SetMenuPaletteMode.
CMFCToolBarMenuButton::IsTearOffMenuCMFCToolBarMenuButton::IsTearOffMenu
Wskazuje, czy menu rozwijane ma pasek odrywany.Indicates whether the drop-down menu has a tear-off bar.
virtual BOOL IsTearOffMenu() const;
Wartość zwracanaReturn Value
PRAWDA, jeśli przycisk menu paska narzędzi ma pasek odrywany; w przeciwnym razie FALSE.TRUE if the toolbar menu button has a tear-off bar; otherwise FALSE.
UwagiRemarks
Aby włączyć funkcję odrywania i ustawić identyfikator paska odrywania, wywołaj CMFCToolBarMenuButton:: SetTearOff.To enable the tear-off feature and set the tear-off bar ID, call CMFCToolBarMenuButton::SetTearOff.
CMFCToolBarMenuButton:: m_bAlwaysCallOwnerDrawCMFCToolBarMenuButton::m_bAlwaysCallOwnerDraw
Określa, czy struktura zawsze wywołuje CFrameWndEx:: OnDrawMenuImage po narysowaniu przycisku.Specifies whether the framework always calls CFrameWndEx::OnDrawMenuImage when a button is drawn.
static BOOL m_bAlwaysCallOwnerDraw;
UwagiRemarks
Gdy ta zmienna elementu członkowskiego ma wartość TRUE, przycisk zawsze wywołuje metodę CFrameWndEx:: OnDrawMenuImage w celu wyświetlenia obrazu na przycisku.When this member variable is set to TRUE, the button always calls CFrameWndEx::OnDrawMenuImage method to display the image on the button. Gdy m_bAlwaysCallOwnerDraw
ma wartość false, sam przycisk rysuje obraz, jeśli obraz jest wstępnie zdefiniowany.When m_bAlwaysCallOwnerDraw
is FALSE, the button itself draws the image if the image is predefined. W przeciwnym razie wywołuje OnDrawMenuImage
.Otherwise, it calls OnDrawMenuImage
.
CMFCToolBarMenuButton::OnAfterCreatePopupMenuCMFCToolBarMenuButton::OnAfterCreatePopupMenu
virtual void OnAfterCreatePopupMenu();
UwagiRemarks
CMFCToolBarMenuButton::OnBeforeDragCMFCToolBarMenuButton::OnBeforeDrag
virtual BOOL OnBeforeDrag() const;
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton::OnCalculateSizeCMFCToolBarMenuButton::OnCalculateSize
virtual SIZE OnCalculateSize(
CDC* pDC,
const CSize& sizeDefault,
BOOL bHorz);
ParametryParameters
podczas kontroler PDC[in] pDC
podczas sizeDefault[in] sizeDefault
podczas bHorz[in] bHorz
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton:: oncancelmodeCMFCToolBarMenuButton::OnCancelMode
virtual void OnCancelMode();
UwagiRemarks
CMFCToolBarMenuButton::OnChangeParentWndCMFCToolBarMenuButton::OnChangeParentWnd
virtual void OnChangeParentWnd(CWnd* pWndParent);
ParametryParameters
podczas pWndParent[in] pWndParent
UwagiRemarks
CMFCToolBarMenuButton:: onkliknięciaCMFCToolBarMenuButton::OnClick
virtual BOOL OnClick(
CWnd* pWnd,
BOOL bDelay = TRUE);
ParametryParameters
podczas pWnd[in] pWnd
podczas bDelay[in] bDelay
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton::OnClickMenuItemCMFCToolBarMenuButton::OnClickMenuItem
Wywoływane przez platformę, gdy użytkownik wybierze element z menu rozwijanego.Called by the framework when the user selects an item in the drop-down menu.
virtual BOOL OnClickMenuItem();
Wartość zwracanaReturn Value
Wartość FALSE, jeśli struktura powinna kontynuować domyślne przetwarzanie elementów menu; w przeciwnym razie wartość TRUE.FALSE if the framework should continue the default menu item processing; otherwise TRUE. Domyślna implementacja zawsze zwraca wartość FALSE.The default implementation always returns FALSE.
UwagiRemarks
Gdy użytkownik kliknie element menu, struktura wykonuje polecenie skojarzone z tym elementem.When the user clicks a menu item, the framework executes a command that is associated with that item.
Aby dostosować przetwarzanie elementów menu, Przesłoń OnClickMenuItem
w klasie pochodnej klasy CMFCToolBarMenuButton
.To customize the menu item processing, override OnClickMenuItem
in a class derived from CMFCToolBarMenuButton
class. Należy również przesłonić CFrameWndEx:: OnShowPopupMenu i zastąpić przyciski menu, które wymagają specjalnego przetwarzania z wystąpieniami klasy pochodnej.You must also override CFrameWndEx::OnShowPopupMenu and replace the menu buttons that require special processing with instances of the derived class.
CMFCToolBarMenuButton::OnContextHelpCMFCToolBarMenuButton::OnContextHelp
virtual BOOL OnContextHelp(CWnd* pWnd);
ParametryParameters
podczas pWnd[in] pWnd
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton:: OnDrawCMFCToolBarMenuButton::OnDraw
virtual void OnDraw(
CDC* pDC,
const CRect& rect,
CMFCToolBarImages* pImages,
BOOL bHorz = TRUE,
BOOL bCustomizeMode = FALSE,
BOOL bHighlight = FALSE,
BOOL bDrawBorder = TRUE,
BOOL bGrayDisabledButtons = TRUE);
ParametryParameters
podczas kontroler PDC[in] pDC
podczas prostokąt[in] rect
podczas pImages[in] pImages
podczas bHorz[in] bHorz
podczas bCustomizeMode[in] bCustomizeMode
podczas bHighlight[in] bHighlight
podczas bDrawBorder[in] bDrawBorder
podczas bGrayDisabledButtons[in] bGrayDisabledButtons
UwagiRemarks
CMFCToolBarMenuButton::OnDrawOnCustomizeListCMFCToolBarMenuButton::OnDrawOnCustomizeList
virtual int OnDrawOnCustomizeList(
CDC* pDC,
const CRect& rect,
BOOL bSelected);
ParametryParameters
podczas kontroler PDC[in] pDC
podczas prostokąt[in] rect
podczas bSelected[in] bSelected
Wartość zwracanaReturn Value
UwagiRemarks
CMFCToolBarMenuButton::OpenPopupMenuCMFCToolBarMenuButton::OpenPopupMenu
Wywoływane przez platformę, gdy użytkownik otwiera menu rozwijane przycisku menu paska narzędzi.Called by the framework when the user opens the drop-down menu of a toolbar menu button.
virtual BOOL OpenPopupMenu(CWnd* pWnd=NULL);
ParametryParameters
pWndpWnd
podczas Określa okno, które odbiera polecenia menu rozwijanego.[in] Specifies the window that receives the drop-down menu commands. Może mieć wartość NULL tylko wtedy, gdy przycisk menu paska narzędzi ma okno nadrzędne.It can be NULL only if the toolbar menu button has a parent window.
Wartość zwracanaReturn Value
Wartość TRUE, gdy obiekt klasy CMFCPopupMenu został utworzony i otwarty pomyślnie; w przeciwnym razie FALSE.TRUE when a CMFCPopupMenu Class object was created and opened successfully; otherwise FALSE.
UwagiRemarks
Ta funkcja jest wywoływana przez platformę, gdy użytkownik otwiera menu rozwijane za pomocą przycisku menu paska narzędzi.This function is called by the framework when the user opens a drop-down menu from a toolbar menu button.
CMFCToolBarMenuButton::ResetImageToDefaultCMFCToolBarMenuButton::ResetImageToDefault
virtual void ResetImageToDefault();
UwagiRemarks
CMFCToolBarMenuButton::SaveBarStateCMFCToolBarMenuButton::SaveBarState
virtual void SaveBarState();
UwagiRemarks
Struktura wywołuje tę metodę, gdy tworzy przycisk paska narzędzi w wyniku operacji przeciągania i upuszczania.The framework calls this method when it creates a toolbar button as the result of a drag-and-drop operation. Ta metoda wywołuje metodę CMFCPopupMenu:: SaveState w menu podręcznym najwyższego poziomu, które powoduje, że przycisk nadrzędny menu podręcznego spowoduje ponowne utworzenie menu.This method calls the CMFCPopupMenu::SaveState method of the top-level pop-up menu, which causes the parent button of the pop-up menu to recreate its menu.
CMFCToolBarMenuButton:: serializowaćCMFCToolBarMenuButton::Serialize
virtual void Serialize(CArchive& ar);
ParametryParameters
podczas AR[in] ar
UwagiRemarks
CMFCToolBarMenuButton::SetACCDataCMFCToolBarMenuButton::SetACCData
Ustawia dane dostępności dla elementu wstążki.Sets the accessibility data for the ribbon element.
virtual BOOL SetACCData(
CWnd* pParent,
CAccessibilityData& data);
ParametryParameters
pParentpParent
Okno nadrzędne dla elementu wstążki.The parent window for the ribbon element.
datadata
Dane ułatwień dostępu dla elementu wstążki.The accessibility data for the ribbon element.
Wartość zwracanaReturn Value
Zawsze zwraca wartość TRUE.Always returns TRUE.
UwagiRemarks
Domyślnie ta metoda ustawia dane dostępności dla elementu wstążki i zawsze zwraca wartość TRUE.By default this method sets the accessibility data for the ribbon element and always returns TRUE. Zastąp tę metodę, aby ustawić dane dostępności i zwrócić wartość wskazującą powodzenie lub niepowodzenie.Override this method to set the accessibility data and return a value that indicates success or failure.
CMFCToolBarMenuButton::SetMenuOnlyCMFCToolBarMenuButton::SetMenuOnly
Określa, czy przycisk jest rysowany jako przycisk menu czy przycisk podziału, gdy ma prawidłowy identyfikator polecenia i podmenu.Specifies whether the button is drawn as a menu button or a split button when it has both a valid command ID and a submenu.
void SetMenuOnly(BOOL bMenuOnly);
ParametryParameters
bMenuOnlybMenuOnly
podczas TRUE, aby pokazać ten przycisk jako przycisk menu, gdy ma zarówno prawidłowy identyfikator polecenia, jak i podmenu, wartość FAŁSZ wyświetla ten przycisk jako przycisk podziału, gdy ma prawidłowy identyfikator polecenia i podmenu.[in] TRUE to show this button as a menu button when it has both a valid command ID and a submenu, FALSE to show this button as a split button when it has both a valid command ID and a submenu.
UwagiRemarks
Zazwyczaj, gdy przycisk menu paska narzędzi ma zarówno podmenu, jak i identyfikator polecenia, menu wydaje się być przyciskiem podziału, który ma przycisk Main i podłączoną strzałkę w dół.Typically, when a toolbar menu button has both a submenu and a command ID, the menu appears to be a split button that has a main button and an attached down arrow button. Jeśli wywołasz tę metodę, a bMenuOnly ma wartość true, przycisk zamiast niego pojawi się jako pojedynczy przycisk menu ze strzałką w dół na przycisku.If you call this method and bMenuOnly is TRUE, the button instead appears to be a single menu button with a down arrow in the button. Gdy użytkownik kliknie strzałkę w dowolnym trybie, zostanie otwarte podmenu, a po kliknięciu przez użytkownika części przycisku w dowolnym trybie, struktura wykonuje polecenie.When the user clicks the arrow in either mode, the submenu opens, and when the user clicks the non-arrow part of the button in either mode the framework executes the command .
CMFCToolBarMenuButton::SetMenuPaletteModeCMFCToolBarMenuButton::SetMenuPaletteMode
Określa, czy menu rozwijane jest w trybie palety.Specifies whether the drop-down menu is in palette mode.
void SetMenuPaletteMode(
BOOL bMenuPaletteMode=TRUE,
int nPaletteRows=1);
ParametryParameters
bMenuPaletteModebMenuPaletteMode
podczas Określa, czy menu rozwijane jest w trybie palety.[in] Specifies whether the drop-down menu is in palette mode.
nPaletteRowsnPaletteRows
podczas Liczba wierszy w palecie.[in] Number of rows in palette.
UwagiRemarks
W trybie palety wszystkie elementy menu są wyświetlane jako wielokolumnowa paleta.In the palette mode, all menu items are displayed as a multicolumn palette. Należy określić liczbę wierszy przy użyciu nPaletteRows.You specify the number of rows by using nPaletteRows.
CMFCToolBarMenuButton::SetMessageWndCMFCToolBarMenuButton::SetMessageWnd
void SetMessageWnd(CWnd* pWndMessage);
ParametryParameters
podczas pWndMessage[in] pWndMessage
UwagiRemarks
CMFCToolBarMenuButton:: SetRadioCMFCToolBarMenuButton::SetRadio
Ustawia przycisk menu paska narzędzi, aby wyświetlić ikonę stylu przycisku radiowego, gdy jest zaznaczone.Sets the toolbar menu button to display a radio button style icon when it is checked.
virtual void SetRadio();
UwagiRemarks
Gdy przycisk menu jest rysowany podczas jego zaznaczania, wywołuje CMFCVisualManager:: OnDrawMenuCheck , aby narysować ikonę znacznika wyboru.When the menu button is drawn while it is checked, it calls CMFCVisualManager::OnDrawMenuCheck to draw a checkmark icon. Domyślnie, OnDrawMenuCheck
żądania, które w bieżącym programie Visual Manager rysują znacznik wyboru stylu CheckBox w przycisku menu.By default, OnDrawMenuCheck
requests that the current visual manager draws a checkbox style checkmark on the menu button. Po wywołaniu tej metody zamiast tego w bieżącym Menedżerze wizualizacji zostanie umieszczony znacznik wyboru stylu przycisku radiowego.After you call this method, the current visual manager instead draws a radio button style checkmark on the menu button. Tej zmiany nie można cofnąć.This change cannot be undone.
Gdy wywołasz tę metodę, a przycisk menu jest aktualnie wyświetlany, zostanie odświeżony.When you call this method and the menu button is currently being displayed, it will refresh.
CMFCToolBarMenuButton::SetTearOffCMFCToolBarMenuButton::SetTearOff
Określa identyfikator paska odrywania dla menu rozwijanego.Specifies the ID of the tear-off bar for the drop-down menu.
virtual void SetTearOff(UINT uiBarID);
ParametryParameters
uiBarIDuiBarID
podczas Określa nowy identyfikator paska odrywania.[in] Specifies a new tear-off bar ID.
UwagiRemarks
Wywołaj tę metodę, aby określić identyfikator paska odrywania, który jest tworzony, gdy użytkownik przeciąga przycisk menu poza pasek menu.Call this method to specify the ID for the tear-off bar that is created when the user drags the menu button off of a menu bar. Jeśli parametr uiBarID ma wartość 0, użytkownik nie może wycofać przycisku menu.If the uiBarID parameter is 0, the user cannot tear off the menu button.
Wywołaj CWinAppEx:: EnableTearOffMenus , aby włączyć funkcję menu odrywania w aplikacji.Call CWinAppEx::EnableTearOffMenus to enable the tear-off menu feature in your application.
Zobacz teżSee also
Wykres hierarchiiHierarchy Chart
KlasyClasses
Klasa CMFCToolBarButtonCMFCToolBarButton Class
Klasa CMFCToolBarCMFCToolBar Class
Klasa CMFCPopupMenuCMFCPopupMenu Class