This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOptionsColorsDlg.cpp
100 lines (82 loc) · 2.58 KB
/
OptionsColorsDlg.cpp
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
94
95
96
97
98
99
100
// OptionsColorsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "zsIRC.h"
#include "OptionsColorsDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COptionsColorsDlg dialog
COptionsColorsDlg::COptionsColorsDlg(CWnd* pParent /*=NULL*/)
: CScrollableDialog(COptionsColorsDlg::IDD)
{
//{{AFX_DATA_INIT(COptionsColorsDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void COptionsColorsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptionsColorsDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptionsColorsDlg, CScrollableDialog)
//{{AFX_MSG_MAP(COptionsColorsDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptionsColorsDlg message handlers
BOOL COptionsColorsDlg::OnInitDialog()
{
// CScrollableDialog::OnInitDialog();
CScrollableDialog::OnInitDialog();
UINT nIDS[] = {
IDC_BACKGROUNDCOLOR,
IDC_FOREGROUNDCOLOR,
IDC_ACTIONCOLOR,
IDC_JOINCOLOR,
IDC_MODECOLOR,
IDC_NOTICECOLOR,
IDC_PARTCOLOR,
};
CColorButton * pElements[] = {
&m_BackgroundColor,
&m_ForegroundColor,
&m_ActionColor,
&m_JoinColor,
&m_ModeColor,
&m_NoticeColor,
&m_PartColor,
};
for (int i=0; i<7; i++) {
CWnd * w = GetDlgItem(nIDS[i]);
pElements[i]->Detach();
CRect r;
w->GetWindowRect(&r);
ScreenToClient(&r);
w->ShowWindow(SW_HIDE);
pElements[i]->Create(_T(""),WS_CHILD | WS_VISIBLE,r,this,12345+i);
}
m_BackgroundColor.SetColor(SETUP.cBackgroundColor);
m_ForegroundColor.SetColor(SETUP.cForegroundColor);
m_ActionColor.SetColor(SETUP.cAction);
m_JoinColor.SetColor(SETUP.cJoin);
m_ModeColor.SetColor(SETUP.cMode);
m_PartColor.SetColor(SETUP.cPart);
m_NoticeColor.SetColor(SETUP.cNotice);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COptionsColorsDlg::ApplyChanges() {
SETUP.cBackgroundColor = m_BackgroundColor.GetColor();
SETUP.cForegroundColor = m_ForegroundColor.GetColor();
SETUP.cAction = m_ActionColor.GetColor();
SETUP.cJoin = m_JoinColor.GetColor();
SETUP.cMode = m_ModeColor.GetColor();
SETUP.cPart = m_PartColor.GetColor();
SETUP.cNotice = m_NoticeColor.GetColor();
}