summaryrefslogtreecommitdiff
path: root/plugins/StartPosition/src/options.h
blob: 812834699ca32a37abe4ff54417b39f15c3c99a4 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
Copyright (C) 2012-21 Miranda NG team (https://miranda-ng.org)

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 version 2
of the License.

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, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "stdafx.h"

enum ClistAlign : uint8_t
{
    left,
    right
};

enum ClistState : uint8_t
{
    hidden,
    minimized,
    normal
};

struct ClistOptions
{
    CMOption<uint8_t> isDocked;
    CMOption<uint8_t> state;

    CMOption<uint32_t> x;
    CMOption<uint32_t> y;
    CMOption<uint32_t> width;
    CMOption<uint32_t> height;

    ClistOptions() :
        isDocked(CLIST_MODULE_NAME, "Docked", 0),
        state(CLIST_MODULE_NAME, "State", ClistState::normal),
        x(CLIST_MODULE_NAME, "x", 0),
        y(CLIST_MODULE_NAME, "y", 0),
        width(CLIST_MODULE_NAME, "Width", 150),
        height(CLIST_MODULE_NAME, "Height", 350)
    { }
};

struct StartPositionOptions
{
    CMOption<uint8_t> setTopPosition;
    CMOption<uint8_t> setBottomPosition;
    CMOption<uint8_t> setSidePosition;
    CMOption<uint8_t> clistAlign;
    CMOption<uint8_t> setClistWidth;
    CMOption<uint8_t> setClistStartState;
    CMOption<uint8_t> clistState;

    CMOption<uint32_t> pixelsFromTop;
    CMOption<uint32_t> pixelsFromBottom;
    CMOption<uint32_t> pixelsFromSide;
    CMOption<uint32_t> clistWidth;

    StartPositionOptions();
};

class COptionsDlg : public CDlgBase
{
    CCtrlCheck chkPositionTop, chkPositionBottom, chkPositionSide, chkFromLeft, chkFromRight, chkWidth;
    CCtrlEdit edtPositionTop, edtPositionBottom, edtPositionSide, edtWidth;
    CCtrlCheck chkStartState, chkStartHidden, chkStartNormal;

public:
    COptionsDlg();

    bool OnInitDialog() override;
    bool OnApply() override;

private:
    void removeOldSettings();

    void onCheck_PositionTop(CCtrlCheck*);
    void onCheck_PositionBottom(CCtrlCheck*);
    void onCheck_PositionSide(CCtrlCheck*);
    void onCheck_Width(CCtrlCheck*);
    void onCheck_StartState(CCtrlCheck*);
};