SDC C-Project CF Review 프로그램
LYW
2021-08-25 03152a241b9463c582b56896f5f5f73717497ab4
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#pragma once
#include "afxcmn.h"
 
#include <map>
 
struct _ColorButtonOption
{
    _ColorButtonOption()
    {
        nStyle=1;
        nEdgeStyle=0;
 
        clrEdgeLeftTop;
        clrEdgeRightBottom;
 
        //clrButtonShow = RGB(240,240,240);
        clrButtonShow = RGB(37, 86, 210);
        clrButtonPush = RGB(37, 86, 190);
        clrButtonHorver = RGB(37, 86, 210);
        clrButtonDisable = RGB(150,150,150);
 
        clrFontNormal = RGB(0,0,0);
        clrFontPush = RGB(0,0,0);
        clrFontMouseOver = RGB(128, 128, 128);
        clrFontDisable = RGB(150,150,150);
 
 
        bTextEnable = TRUE;
        nFontBoxOffsetX = nFontBoxOffsetY = 0;
        nTextPushX = nTextPushY = 1;
 
        bTextShadow = FALSE;
        nTextShadowX = nTextShadowY=1;
    }
    int nStyle;//0ÀϹÝ, 1±×¶óµ¥À̼Ç
    int nEdgeStyle;//0:3d, 1:Flat
 
    COLORREF clrEdgeLeftTop;
    COLORREF clrEdgeRightBottom;
 
    COLORREF clrButtonShow;
    COLORREF clrButtonPush;
    COLORREF clrButtonHorver;
    COLORREF clrButtonDisable;
 
 
    //±ÛÀÚÃâ·Â°ü·Ã ÅÂÇö[2016/9/19]
    bool bTextEnable;
    int nFontBoxOffsetX, nFontBoxOffsetY; //Á¤°¡¿îµ¥ ±âÁØÀ¸·Î ±ÛÀÚÇ¥½Ã OFFSET
    int nTextPushX, nTextPushY;//´­·ÁÁø ¸ð¾çÀ̵ÆÀ»°æ¿ì, ±ÛÀÚÀÇ À§Ä¡ ¿É¼Â ¼³Á¤
 
    COLORREF clrFontNormal;
    COLORREF clrFontPush;
    COLORREF clrFontMouseOver;
    COLORREF clrFontDisable;
 
    //ÆùÆ® ±×¸²ÀÚ Ãâ·Â ÅÂÇö[2016/9/19]
    bool bTextShadow;
    int nTextShadowX, nTextShadowY;
};
 
typedef struct {
    double r;       // percent
    double g;       // percent
    double b;       // percent
} rgb;
 
typedef struct {
    double h;       // angle in degrees
    double s;       // percent
    double v;       // percent
 
} hsv;
 
class CakButtonColor : public CButton
{
    DECLARE_DYNAMIC(CakButtonColor);
 
public:
    CakButtonColor(void);
    ~CakButtonColor(void);
 
    void clear();
    void addControl(CButton* pButton);
 
    void setButtonColorOption(_ColorButtonOption ButtonColorOption){m_ButtonColorOption=ButtonColorOption;};
    _ColorButtonOption getButtonColorOption(){return m_ButtonColorOption;};
 
    //OnDrawItem¿¡¼­ È£ÃâÇϸéµÊ
    bool processDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
 
    //¾Æ·¡²¨´Â µî·Ï¾ÈÇØµµ ±¦ÂúÁö¸¸ Ä÷ÀÌ ³·¾ÆÁü ÅÂÇö[2016/9/19]
    void processMouseHover(int nIDCtl);
    void processDoubleClick(int nIDCtl);
 
    int GetCheck() const {return m_bCheckBoxFlag;};
    void SetCheck(int nCheck) ;
 
protected:
    COLORREF getAlphaColor(COLORREF colorA, COLORREF colorB, double dColorBAlpha);
    void getButtonColor3Point(COLORREF color, COLORREF* part1Top, COLORREF* part1Bottom, COLORREF* part2Bottom);
 
    void draw2PartGraditionRect(CDC* pDC, CRect rectDraw, COLORREF clrPart1T, COLORREF clrPart1B, COLORREF clrPart2T, COLORREF clrPart2B);
    bool drawButton3dNormal(CButton* pButton, LPDRAWITEMSTRUCT lpDrawItemStruct, _ColorButtonOption* pOption);//0¹ø ³ë¸Ö 3d ÅÂÇö[2016/9/19]
    bool drawButton3dGradation( CButton* pButton, LPDRAWITEMSTRUCT lpDrawItemStruct, _ColorButtonOption* pOption );
    hsv rgb2hsv(rgb in);
    rgb hsv2rgb(hsv in);
protected:
    std::map<int,CButton*> m_mapControls;
    CButton* m_pButtonHover;
    _ColorButtonOption m_ButtonColorOption;
 
    //subclassing¹æ½Ä¿¡¼­ »ç¿ëµÇ´Â°Íµé ÅÂÇö[2016/9/22]
protected:
    BOOL m_bHover;
    BOOL m_bTracking;
    BOOL m_bCheckBoxType;
    BOOL m_bCheckBoxFlag;
 
public:
    void SetUpdateStateNotify(HWND hParent){m_hNotifyParent = hParent;};
protected:
    HWND m_hNotifyParent;
protected:
    DECLARE_MESSAGE_MAP()
public:
    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
protected:
    virtual void PreSubclassWindow();
public:
    virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
    afx_msg void OnMouseHover(UINT nFlags, CPoint point);
    afx_msg void OnMouseLeave();
    COLORREF getBrightColor( COLORREF color, double dBright );
protected:
    virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
public:
    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
};
 
 
/*
//¾Æ·¡´Â »ç¿ë¿¹½Ã
 
void CButtonTestDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    // TODO: ¿©±â¿¡ ¸Þ½ÃÁö Ã³¸®±â Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº»°ªÀ» È£ÃâÇÕ´Ï´Ù.
 
    m_akButtonColorNormal.processDrawItem(nIDCtl, lpDrawItemStruct);
    m_akButtonColorGradition.processDrawItem(nIDCtl, lpDrawItemStruct);
    //m_bcFlatGradition.processDrawItem(nIDCtl, lpDrawItemStruct);
 
    CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
 
BOOL CButtonTestDlg::PreTranslateMessage(MSG* pMsg)
{
    // TODO: ¿©±â¿¡ Æ¯¼öÈ­µÈ Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº» Å¬·¡½º¸¦ È£ÃâÇÕ´Ï´Ù.
    if(pMsg->message == WM_MOUSEMOVE)
    {
        m_akButtonColorNormal.processMouseHover(CWnd::FromHandle(pMsg->hwnd)->GetDlgCtrlID());
        m_akButtonColorGradition.processMouseHover(CWnd::FromHandle(pMsg->hwnd)->GetDlgCtrlID());
        //m_bcFlatGradition.processMouseHover(CWnd::FromHandle(pMsg->hwnd)->GetDlgCtrlID());
    }
    else if(pMsg->message == WM_LBUTTONDBLCLK)
    {
        m_akButtonColorNormal.processDoubleClick(CWnd::FromHandle(pMsg->hwnd)->GetDlgCtrlID());
        m_akButtonColorGradition.processDoubleClick(CWnd::FromHandle(pMsg->hwnd)->GetDlgCtrlID());
        //m_bcFlatGradition.processDoubleClick(CWnd::FromHandle(pMsg->hwnd)->GetDlgCtrlID());
 
    }
    return CDialog::PreTranslateMessage(pMsg);
}
 
*/