forked from rainmeter/rainmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeterButton.h
56 lines (41 loc) · 1.47 KB
/
MeterButton.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Copyright (C) 2005 Rainmeter Project Developers
*
* This Source Code Form is subject to the terms of the GNU General Public
* License; either version 2 of the License, or (at your option) any later
* version. If a copy of the GPL was not distributed with this file, You can
* obtain one at <https://www.gnu.org/licenses/gpl-2.0.html>. */
#ifndef __METERBUTTON_H__
#define __METERBUTTON_H__
#include "Meter.h"
#include "GeneralImage.h"
#define BUTTON_FRAMES 3
class MeterButton : public Meter
{
public:
MeterButton(Skin* skin, const WCHAR* name);
virtual ~MeterButton();
MeterButton(const MeterButton& other) = delete;
MeterButton& operator=(MeterButton other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterButton>(); }
virtual void Initialize();
virtual bool Update();
virtual bool Draw(Gfx::Canvas& canvas);
bool MouseMove(POINT pos);
bool MouseUp(POINT pos, bool execute);
bool MouseDown(POINT pos);
void SetFocus(bool f) { m_Focus = f; }
bool HitTest2(int px, int py);
protected:
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
virtual bool IsFixedSize(bool overwrite = false) { return overwrite; }
private:
GeneralImage m_Image;
std::wstring m_ImageName;
D2D1_RECT_F m_BitmapsRects[BUTTON_FRAMES]; // Cached bitmaps
std::wstring m_Command;
int m_State;
bool m_Clicked;
bool m_Focus;
};
#endif