Alphabetical Class Index   File Members   Compound Members   File List  

AppearanceDlg.h

00001 //
00002 // Copyright (c) 2002 by Tech Soft 3D, LLC.
00003 // The information contained herein is confidential and proprietary to
00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 // and criminal remedies in the event of unauthorized use or misappropriation
00007 // of its trade secrets.  Use of this information by anyone other than
00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 // written non-disclosure agreement, expressly prescribing the scope and
00010 // manner of such use.
00011 //
00012 // $Header: /files/homes/master/cvs/hoops_master/docs_hoops/HoopsAtl/ref_manual/Attic/_appearance_dlg_8h-source.html,v 1.1.2.2 2004/06/28 20:59:56 rob Exp $
00013 //
00014 
00015 #ifndef __APPEARANCEDLG_H_
00016 #define __APPEARANCEDLG_H_
00017 
00018 #include "resource.h"       // main symbols
00019 #include <atlhost.h>
00020 
00022 // CAppearanceDlg
00023 class CAppearanceDlg : 
00024     public CAxDialogImpl<CAppearanceDlg>
00025 {
00026 public:
00027     CAppearanceDlg()
00028     {
00029     }
00030 
00031     ~CAppearanceDlg()
00032     {
00033     }
00034 
00035     enum { IDD = IDD_APPEARANCEDLG };
00036 
00037 BEGIN_MSG_MAP(CAppearanceDlg)
00038     MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
00039     COMMAND_ID_HANDLER(IDOK, OnOK)
00040     COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
00041     COMMAND_HANDLER(IDC_BUTTON_COLOR_BACKGROUND_BOTTOM, BN_CLICKED, OnClickedButton_color_background_bottom)
00042     COMMAND_HANDLER(IDC_BUTTON_COLOR_BACKGROUND_TOP, BN_CLICKED, OnClickedButton_color_background_top)
00043     MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem)
00044     COMMAND_HANDLER(IDOK, BN_CLICKED, OnOK)
00045 END_MSG_MAP()
00046 // Handler prototypes:
00047 //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00048 //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00049 //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
00050 
00051     LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
00052     {
00053         return 1;  // Let the system set the focus
00054     }
00055 
00056     LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00057     {
00058         EndDialog(wID);
00059         return 0;
00060     }
00061 
00062     LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00063     {
00064         EndDialog(wID);
00065         return 0;
00066     }
00067     LRESULT OnClickedButton_color_background_bottom(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00068     {
00069         ChooseBkColor(m_bottom_color);
00070         // TODO : Add Code for control notification handler.
00071         return 0;
00072     }
00073     LRESULT OnClickedButton_color_background_top(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
00074     {
00075         // TODO : Add Code for control notification handler.
00076         ChooseBkColor(m_top_color);
00077         return 0;
00078 
00079     }
00080 
00081     bool CAppearanceDlg::ChooseBkColor(COLORREF &cr);
00082 
00083 
00084     COLORREF m_bottom_color;    COLORREF m_top_color;
00085     LRESULT OnDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
00086     {   
00087 
00088         RECT r;
00089         HWND button = GetDlgItem(IDC_BUTTON_COLOR_BACKGROUND_TOP);
00090         ::GetWindowRect(button, &r);
00091         HDC dc= ::GetDC(button);        
00092         HBRUSH brush = CreateSolidBrush(RGB(GetRValue(m_top_color),GetGValue(m_top_color),GetBValue(m_top_color)));
00093         HBRUSH *pOldBrush = (HBRUSH *)SelectObject(dc, brush);
00094         Rectangle(dc, 0+2,0+2,r.right-r.left-2,r.bottom-r.top-2);
00095         SelectObject(dc, pOldBrush);
00096 
00097         button = GetDlgItem(IDC_BUTTON_COLOR_BACKGROUND_BOTTOM);
00098         ::GetWindowRect(button, &r);
00099         dc= ::GetDC(button);        
00100         brush = CreateSolidBrush(RGB(GetRValue(m_bottom_color),GetGValue(m_bottom_color),GetBValue(m_bottom_color)));
00101         pOldBrush = (HBRUSH *)SelectObject(dc, brush);
00102         Rectangle(dc, 0+2,0+2,r.right-r.left-2,r.bottom-r.top-2);
00103         SelectObject(dc, pOldBrush);
00104         
00105         // TODO : Add Code for message handler. Call DefWindowProc if necessary.
00106         return 0;
00107     }
00108 };
00109 
00110 #endif //__APPEARANCEDLG_H_