Alphabetical Class List   File List   Compound Members  

AppearanceDlg.h

00001 // AppearanceDlg.h : Declaration of the CAppearanceDlg
00002 
00003 #ifndef __APPEARANCEDLG_H_
00004 #define __APPEARANCEDLG_H_
00005 
00006 #include "resource.h"       // main symbols
00007 #include <atlhost.h>
00008 
00010 // CAppearanceDlg
00011 class CAppearanceDlg : 
00012         public CAxDialogImpl<CAppearanceDlg>
00013 {
00014 public:
00015         CAppearanceDlg()
00016         {
00017         }
00018 
00019         ~CAppearanceDlg()
00020         {
00021         }
00022 
00023         enum { IDD = IDD_APPEARANCEDLG };
00024 
00025 BEGIN_MSG_MAP(CAppearanceDlg)
00026         MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
00027         COMMAND_ID_HANDLER(IDOK, OnOK)
00028         COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
00029         COMMAND_HANDLER(IDC_BUTTON_COLOR_BACKGROUND_BOTTOM, BN_CLICKED, OnClickedButton_color_background_bottom)
00030         COMMAND_HANDLER(IDC_BUTTON_COLOR_BACKGROUND_TOP, BN_CLICKED, OnClickedButton_color_background_top)
00031         MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem)
00032         COMMAND_HANDLER(IDOK, BN_CLICKED, OnOK)
00033 END_MSG_MAP()
00034 // Handler prototypes:
00035 //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00036 //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00037 //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
00038 
00039         LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
00040         {
00041                 return 1;  // Let the system set the focus
00042         }
00043 
00044         LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00045         {
00046                 EndDialog(wID);
00047                 return 0;
00048         }
00049 
00050         LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00051         {
00052                 EndDialog(wID);
00053                 return 0;
00054         }
00055         LRESULT OnClickedButton_color_background_bottom(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00056         {
00057                 ChooseBkColor(m_bottom_color);
00058                 // TODO : Add Code for control notification handler.
00059                 return 0;
00060         }
00061         LRESULT OnClickedButton_color_background_top(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00062         {
00063                 // TODO : Add Code for control notification handler.
00064                 ChooseBkColor(m_top_color);
00065                 return 0;
00066 
00067         }
00068 
00069         bool CAppearanceDlg::ChooseBkColor(COLORREF &cr);
00070 
00071 
00072         COLORREF m_bottom_color;        COLORREF m_top_color;
00073         LRESULT OnDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
00074         {       
00075 
00076                 RECT r;
00077                 HWND button = GetDlgItem(IDC_BUTTON_COLOR_BACKGROUND_TOP);
00078                 ::GetWindowRect(button, &r);
00079                 HDC dc= ::GetDC(button);                
00080                 HBRUSH brush = CreateSolidBrush(RGB(GetRValue(m_top_color),GetGValue(m_top_color),GetBValue(m_top_color)));
00081                 HBRUSH *pOldBrush = (HBRUSH *)SelectObject(dc, brush);
00082                 Rectangle(dc, 0+2,0+2,r.right-r.left-2,r.bottom-r.top-2);
00083                 SelectObject(dc, pOldBrush);
00084 
00085                 button = GetDlgItem(IDC_BUTTON_COLOR_BACKGROUND_BOTTOM);
00086                 ::GetWindowRect(button, &r);
00087                 dc= ::GetDC(button);            
00088                 brush = CreateSolidBrush(RGB(GetRValue(m_bottom_color),GetGValue(m_bottom_color),GetBValue(m_bottom_color)));
00089                 pOldBrush = (HBRUSH *)SelectObject(dc, brush);
00090                 Rectangle(dc, 0+2,0+2,r.right-r.left-2,r.bottom-r.top-2);
00091                 SelectObject(dc, pOldBrush);
00092                 
00093                 // TODO : Add Code for message handler. Call DefWindowProc if necessary.
00094                 return 0;
00095         }
00096 };
00097 
00098 #endif //__APPEARANCEDLG_H_


Copyright © 2002 Tech Soft 3D