PixelLightAPI  .
MessageFilter.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: MessageFilter.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_MESSAGEFILTER_H__
00024 #define __PLGUI_MESSAGEFILTER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Container/Array.h>
00032 #include "PLGui/Gui/Base/MessageFilterRule.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Forward declarations                                  ]
00037 //[-------------------------------------------------------]
00038 namespace PLCore {
00039     class String;
00040 }
00041 namespace PLGui {
00042     class Gui;
00043     class GuiMessage;
00044 }
00045 
00046 
00047 //[-------------------------------------------------------]
00048 //[ Namespace                                             ]
00049 //[-------------------------------------------------------]
00050 namespace PLGui {
00051 
00052 
00053 //[-------------------------------------------------------]
00054 //[ Classes                                               ]
00055 //[-------------------------------------------------------]
00056 /**
00057 *  @brief
00058 *    Class to retrieve and filter GUI messages
00059 */
00060 class MessageFilter {
00061 
00062 
00063     //[-------------------------------------------------------]
00064     //[ Friends                                               ]
00065     //[-------------------------------------------------------]
00066     friend class Gui;
00067 
00068 
00069     //[-------------------------------------------------------]
00070     //[ Public functions                                      ]
00071     //[-------------------------------------------------------]
00072     public:
00073         /**
00074         *  @brief
00075         *    Constructor
00076         */
00077         PLGUI_API MessageFilter();
00078 
00079         /**
00080         *  @brief
00081         *    Destructor
00082         */
00083         PLGUI_API virtual ~MessageFilter();
00084 
00085         /**
00086         *  @brief
00087         *    Add filter rule
00088         *
00089         *  @param[in] nFilterType
00090         *    Filter type (inclusive or exclusive)
00091         *  @param[in] nMessageType
00092         *    Message type that is filtered
00093         *
00094         *  @remarks
00095         *    Use this constructor to filter against a message type
00096         */
00097         PLGUI_API void AddRule(EMessageFilter nFilterType, EMessageType nMessageType);
00098 
00099         /**
00100         *  @brief
00101         *    Add filter rule
00102         *
00103         *  @param[in] nFilterType
00104         *    Filter type (inclusive or exclusive)
00105         *  @param[in] sWidget
00106         *    Name of widget that is filtered
00107         *
00108         *  @remarks
00109         *    Use this constructor to filter against a widget name
00110         */
00111         PLGUI_API void AddRule(EMessageFilter nFilterType, const PLCore::String &sWidget);
00112 
00113 
00114     //[-------------------------------------------------------]
00115     //[ Protected functions                                   ]
00116     //[-------------------------------------------------------]
00117     protected:
00118         /**
00119         *  @brief
00120         *    Add GUI message
00121         *
00122         *  @param[in] cMessage
00123         *    GUI message
00124         */
00125         PLGUI_API void AddMessage(const GuiMessage &cMessage);
00126 
00127 
00128     //[-------------------------------------------------------]
00129     //[ Protected virtual MessageFilter functions             ]
00130     //[-------------------------------------------------------]
00131     protected:
00132         /**
00133         *  @brief
00134         *    Called when a GUI message has arrived
00135         *
00136         *  @param[in] cMessage
00137         *    GUI message
00138         */
00139         PLGUI_API virtual void OnGuiMessage(const GuiMessage &cMessage);
00140 
00141 
00142     //[-------------------------------------------------------]
00143     //[ Protected data                                        ]
00144     //[-------------------------------------------------------]
00145     protected:
00146         PLCore::Array<MessageFilterRule> m_lstRules;    /**< Filter rule list */
00147 
00148 
00149 };
00150 
00151 
00152 //[-------------------------------------------------------]
00153 //[ Namespace                                             ]
00154 //[-------------------------------------------------------]
00155 } // PLGui
00156 
00157 
00158 #endif // __PLGUI_MESSAGEFILTER_H__


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