PixelLightAPI  .
SystemButton.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SystemButton.h                                 *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLGUI_SYSTEMBUTTON_H__
00024 #define __PLGUI_SYSTEMBUTTON_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLGui/Widgets/Base/AbstractButton.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLGui {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Forward declarations                                  ]
00042 //[-------------------------------------------------------]
00043 class Timer;
00044 
00045 
00046 //[-------------------------------------------------------]
00047 //[ Classes                                               ]
00048 //[-------------------------------------------------------]
00049 /**
00050 *  @brief
00051 *    Button that represents a system button in a title bar (minimize, maximize, ...)
00052 */
00053 class SystemButton: public AbstractButton {
00054 
00055 
00056     //[-------------------------------------------------------]
00057     //[ Class definition                                      ]
00058     //[-------------------------------------------------------]
00059     pl_class(PLGUI_RTTI_EXPORT, SystemButton, "PLGui", PLGui::AbstractButton, "Button that represents a system button in a title bar (minimize, maximize, ...)")
00060         // Attributes
00061         pl_attribute(SystemCommand, pl_enum_type(ESystemCommand),   CommandRestore, ReadWrite,  GetSet, "System command that is emitted by the button", "")
00062         // Constructors
00063         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00064     pl_class_end
00065 
00066 
00067     //[-------------------------------------------------------]
00068     //[ Public functions                                      ]
00069     //[-------------------------------------------------------]
00070     public:
00071         /**
00072         *  @brief
00073         *    Constructor
00074         *
00075         *  @param[in] pParent
00076         *    Pointer to the parent widget
00077         */
00078         PLGUI_API SystemButton(Widget *pParent = nullptr);
00079 
00080         /**
00081         *  @brief
00082         *    Destructor
00083         */
00084         PLGUI_API virtual ~SystemButton();
00085 
00086         /**
00087         *  @brief
00088         *    Get widget state
00089         *
00090         *  @return
00091         *    Widget states as flags (see EWidgetState)
00092         */
00093         PLGUI_API virtual PLCore::uint32 GetWidgetState() const;
00094 
00095         /**
00096         *  @brief
00097         *    Get system command that the button represents
00098         *
00099         *  @return
00100         *    System command
00101         */
00102         PLGUI_API ESystemCommand GetSystemCommand() const;
00103 
00104         /**
00105         *  @brief
00106         *    Set system command that the button represents
00107         *
00108         *  @param[in] nSystemCommand
00109         *    System command
00110         */
00111         PLGUI_API void SetSystemCommand(ESystemCommand nSystemCommand);
00112 
00113 
00114     //[-------------------------------------------------------]
00115     //[ Private virtual AbstractButton functions              ]
00116     //[-------------------------------------------------------]
00117     private:
00118         PLGUI_API virtual void OnButtonClicked() override;
00119 
00120 
00121     //[-------------------------------------------------------]
00122     //[ Private virtual WidgetFunctions functions             ]
00123     //[-------------------------------------------------------]
00124     private:
00125         PLGUI_API virtual void OnDraw(Graphics &cGraphics) override;
00126         PLGUI_API virtual PLMath::Vector2i OnPreferredSize(const PLMath::Vector2i &vRefSize) const override;
00127         PLGUI_API virtual void OnMouseEnter() override;
00128         PLGUI_API virtual void OnMouseLeave() override;
00129 
00130 
00131     //[-------------------------------------------------------]
00132     //[ Private data                                          ]
00133     //[-------------------------------------------------------]
00134     private:
00135         ESystemCommand m_nSystemCommand;    /**< System command that is emitted by the button */
00136 
00137 
00138 };
00139 
00140 
00141 //[-------------------------------------------------------]
00142 //[ Namespace                                             ]
00143 //[-------------------------------------------------------]
00144 } // PLGui
00145 
00146 
00147 #endif // __PLGUI_SYSTEMBUTTON_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:01
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported