rainmeter-studio/Library/Section.h

74 lines
2.2 KiB
C
Raw Normal View History

/*
Copyright (C) 2012 spx
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __SECTION_H__
#define __SECTION_H__
#include <windows.h>
#include <string>
#include "Group.h"
2013-05-31 14:18:52 +00:00
class MeterWindow;
class ConfigParser;
2013-01-14 19:30:10 +00:00
2013-05-31 14:18:52 +00:00
class __declspec(novtable) Section : public Group
{
public:
2013-05-31 14:18:52 +00:00
virtual ~Section();
Section(const Section& other) = delete;
virtual UINT GetTypeID() = 0;
const WCHAR* GetName() const { return m_Name.c_str(); }
const std::wstring& GetOriginalName() const { return m_Name; }
bool HasDynamicVariables() const { return m_DynamicVariables; }
void SetDynamicVariables(bool b) { m_DynamicVariables = b; }
void ResetUpdateCounter() { m_UpdateCounter = m_UpdateDivider; }
int GetUpdateCounter() const { return m_UpdateCounter; }
int GetUpdateDivider() const { return m_UpdateDivider; }
2013-01-14 16:37:13 +00:00
const std::wstring& GetOnUpdateAction() { return m_OnUpdateAction; }
2013-01-14 19:30:10 +00:00
void DoUpdateAction();
2013-01-14 16:37:13 +00:00
2013-05-31 14:18:52 +00:00
MeterWindow* GetMeterWindow() { return m_MeterWindow; }
2013-02-25 18:57:37 +00:00
protected:
2013-05-31 14:18:52 +00:00
Section(MeterWindow* meterWindow, const WCHAR* name);
2013-05-31 14:18:52 +00:00
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
2013-02-06 10:12:16 +00:00
bool UpdateCounter();
2013-10-21 16:22:57 +00:00
// Plugins may access this string through RmGetMeasureName(). This should never be modified to
// ensure thread-safety.
const std::wstring m_Name;
bool m_DynamicVariables; // If true, the section contains dynamic variables
int m_UpdateDivider; // Divider for the update
int m_UpdateCounter; // Current update counter
2013-01-14 16:37:13 +00:00
std::wstring m_OnUpdateAction;
2013-01-14 19:30:10 +00:00
2013-05-31 14:18:52 +00:00
MeterWindow* m_MeterWindow;
};
#endif