diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/public/vgui_controls/MenuItem.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/public/vgui_controls/MenuItem.h')
| -rw-r--r-- | mp/src/public/vgui_controls/MenuItem.h | 272 |
1 files changed, 136 insertions, 136 deletions
diff --git a/mp/src/public/vgui_controls/MenuItem.h b/mp/src/public/vgui_controls/MenuItem.h index e396c284..6baa512e 100644 --- a/mp/src/public/vgui_controls/MenuItem.h +++ b/mp/src/public/vgui_controls/MenuItem.h @@ -1,136 +1,136 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#ifndef MENUITEM_H
-#define MENUITEM_H
-
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include <vgui/VGUI.h>
-#include <vgui_controls/Button.h>
-#include <vgui_controls/Menu.h>
-
-namespace vgui
-{
-
-class IBorder;
-class TextImage;
-class Menu;
-class Image;
-
-//-----------------------------------------------------------------------------
-// Purpose: The items in a menu
-// MenuItems MUST have the Menu class as parents.
-//-----------------------------------------------------------------------------
-class MenuItem : public Button
-{
- DECLARE_CLASS_SIMPLE( MenuItem, Button );
-
-public:
- MenuItem(Menu *parent, const char *panelName, const char *text, Menu *cascadeMenu = NULL, bool checkable = false);
- MenuItem(Menu *parent, const char *panelName, const wchar_t *wszText, Menu *cascadeMenu = NULL, bool checkable = false);
- ~MenuItem();
-
- virtual void Paint();
-
- // Activate the menu item as if it had been selected by the user
- virtual void FireActionSignal();
-
- virtual bool CanBeDefaultButton(void);
-
- // Handle mouse cursor entering a MenuItem.
- void OnCursorEntered();
- // Handle mouse cursor exiting a MenuItem.
- void OnCursorExited();
-
- // Close the cascading menu if we have one.
- void CloseCascadeMenu();
-
- // Pass kill focus events up to parent on loss of focus
- MESSAGE_FUNC( OnKillFocus, "MenuClose" );
-
- // Return true if this item triggers a cascading menu
- bool HasMenu();
-
- // Set the size of the text portion of the label.
- void SetTextImageSize(int wide, int tall);
-
- //Return the size of the text portion of the label.
- void GetTextImageSize(int &wide, int &tall);
-
- // Return the size of the arrow portion of the label.
- void GetArrowImageSize(int &wide, int &tall);
-
- // Return the size of the check portion of the label.
- void GetCheckImageSize(int &wide, int &tall);
-
- // Return the menu that this menuItem contains
- Menu *GetMenu();
-
- virtual void PerformLayout();
-
- // Respond to cursor movement
- void OnCursorMoved(int x, int y);
-
- // Highlight item
- MESSAGE_FUNC( ArmItem, "ArmItem" );
- // Unhighlight item.
- MESSAGE_FUNC( DisarmItem, "DisarmItem" );
-
- // is the item highlighted?
- bool IsItemArmed();
-
- // Open cascading menu if there is one.
- void OpenCascadeMenu();
-
- bool IsCheckable();
- bool IsChecked();
-
- // Set a checkable menuItem checked or unchecked.
- void SetChecked(bool state);
-
- KeyValues *GetUserData();
- void SetUserData(const KeyValues *kv);
-
- int GetActiveItem() { if ( m_pCascadeMenu ) { return m_pCascadeMenu->GetActiveItem(); } else { return 0; }}
-
- Menu *GetParentMenu();
-
- void SetCurrentKeyBinding( char const *keyName );
-
- virtual void GetContentSize( int& cw, int &ch );
-
-protected:
- void OnKeyCodeReleased(KeyCode code);
- void OnMenuClose();
- MESSAGE_FUNC( OnKeyModeSet, "KeyModeSet" );
-
- // vgui overrides
- virtual void Init( void );
- virtual void ApplySchemeSettings(IScheme *pScheme);
- virtual IBorder *GetBorder(bool depressed, bool armed, bool selected, bool keyfocus);
-
-private:
- enum { CHECK_INSET = 6 };
- Menu *m_pCascadeMenu; // menu triggered to open upon selecting this menu item
- bool m_bCheckable; // can this menu item have a little check to the left of it when you select it?
- bool m_bChecked; // whether item is checked or not.
- TextImage *m_pCascadeArrow; // little arrow that appears to the right of menuitems that open a menu
- Image *m_pCheck; // the check that appears to the left of checked menu items
- TextImage *m_pBlankCheck; // a blank image same size as the check for when items are not checked.
-
- TextImage *m_pCurrentKeyBinding; // An optional indicator for the key currently bound to this menu item
-
- KeyValues *m_pUserData;
-
-};
-
-} // namespace vgui
-
-#endif // MENUITEM_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef MENUITEM_H +#define MENUITEM_H + +#ifdef _WIN32 +#pragma once +#endif + +#include <vgui/VGUI.h> +#include <vgui_controls/Button.h> +#include <vgui_controls/Menu.h> + +namespace vgui +{ + +class IBorder; +class TextImage; +class Menu; +class Image; + +//----------------------------------------------------------------------------- +// Purpose: The items in a menu +// MenuItems MUST have the Menu class as parents. +//----------------------------------------------------------------------------- +class MenuItem : public Button +{ + DECLARE_CLASS_SIMPLE( MenuItem, Button ); + +public: + MenuItem(Menu *parent, const char *panelName, const char *text, Menu *cascadeMenu = NULL, bool checkable = false); + MenuItem(Menu *parent, const char *panelName, const wchar_t *wszText, Menu *cascadeMenu = NULL, bool checkable = false); + ~MenuItem(); + + virtual void Paint(); + + // Activate the menu item as if it had been selected by the user + virtual void FireActionSignal(); + + virtual bool CanBeDefaultButton(void); + + // Handle mouse cursor entering a MenuItem. + void OnCursorEntered(); + // Handle mouse cursor exiting a MenuItem. + void OnCursorExited(); + + // Close the cascading menu if we have one. + void CloseCascadeMenu(); + + // Pass kill focus events up to parent on loss of focus + MESSAGE_FUNC( OnKillFocus, "MenuClose" ); + + // Return true if this item triggers a cascading menu + bool HasMenu(); + + // Set the size of the text portion of the label. + void SetTextImageSize(int wide, int tall); + + //Return the size of the text portion of the label. + void GetTextImageSize(int &wide, int &tall); + + // Return the size of the arrow portion of the label. + void GetArrowImageSize(int &wide, int &tall); + + // Return the size of the check portion of the label. + void GetCheckImageSize(int &wide, int &tall); + + // Return the menu that this menuItem contains + Menu *GetMenu(); + + virtual void PerformLayout(); + + // Respond to cursor movement + void OnCursorMoved(int x, int y); + + // Highlight item + MESSAGE_FUNC( ArmItem, "ArmItem" ); + // Unhighlight item. + MESSAGE_FUNC( DisarmItem, "DisarmItem" ); + + // is the item highlighted? + bool IsItemArmed(); + + // Open cascading menu if there is one. + void OpenCascadeMenu(); + + bool IsCheckable(); + bool IsChecked(); + + // Set a checkable menuItem checked or unchecked. + void SetChecked(bool state); + + KeyValues *GetUserData(); + void SetUserData(const KeyValues *kv); + + int GetActiveItem() { if ( m_pCascadeMenu ) { return m_pCascadeMenu->GetActiveItem(); } else { return 0; }} + + Menu *GetParentMenu(); + + void SetCurrentKeyBinding( char const *keyName ); + + virtual void GetContentSize( int& cw, int &ch ); + +protected: + void OnKeyCodeReleased(KeyCode code); + void OnMenuClose(); + MESSAGE_FUNC( OnKeyModeSet, "KeyModeSet" ); + + // vgui overrides + virtual void Init( void ); + virtual void ApplySchemeSettings(IScheme *pScheme); + virtual IBorder *GetBorder(bool depressed, bool armed, bool selected, bool keyfocus); + +private: + enum { CHECK_INSET = 6 }; + Menu *m_pCascadeMenu; // menu triggered to open upon selecting this menu item + bool m_bCheckable; // can this menu item have a little check to the left of it when you select it? + bool m_bChecked; // whether item is checked or not. + TextImage *m_pCascadeArrow; // little arrow that appears to the right of menuitems that open a menu + Image *m_pCheck; // the check that appears to the left of checked menu items + TextImage *m_pBlankCheck; // a blank image same size as the check for when items are not checked. + + TextImage *m_pCurrentKeyBinding; // An optional indicator for the key currently bound to this menu item + + KeyValues *m_pUserData; + +}; + +} // namespace vgui + +#endif // MENUITEM_H |