High-speed-Charting-Control/ChartDemo/Doc/html/_colour_popup_8h-source.html

157 lines
12 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ChartDemo: E:/Sources Misc/ChartDemo/ColourPopup.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
</ul>
</div>
<h1>E:/Sources Misc/ChartDemo/ColourPopup.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#if !defined(AFX_COLOURPOPUP_H__D0B75902_9830_11D1_9C0F_00A0243D1382__INCLUDED_)</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define AFX_COLOURPOPUP_H__D0B75902_9830_11D1_9C0F_00A0243D1382__INCLUDED_</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#if _MSC_VER &gt;= 1000</span>
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER &gt;= 1000</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span>
<a name="l00008"></a>00008 <span class="comment">// ColourPopup.h : header file</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// Written by Chris Maunder (chrismaunder@codeguru.com)</span>
<a name="l00011"></a>00011 <span class="comment">// Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)</span>
<a name="l00012"></a>00012 <span class="comment">// Copyright (c) 1998.</span>
<a name="l00013"></a>00013 <span class="comment">//</span>
<a name="l00014"></a>00014 <span class="comment">// This code may be used in compiled form in any way you desire. This</span>
<a name="l00015"></a>00015 <span class="comment">// file may be redistributed unmodified by any means PROVIDING it is </span>
<a name="l00016"></a>00016 <span class="comment">// not sold for profit without the authors written consent, and </span>
<a name="l00017"></a>00017 <span class="comment">// providing that this notice and the authors name is included. If </span>
<a name="l00018"></a>00018 <span class="comment">// the source code in this file is used in any commercial application </span>
<a name="l00019"></a>00019 <span class="comment">// then a simple email would be nice.</span>
<a name="l00020"></a>00020 <span class="comment">//</span>
<a name="l00021"></a>00021 <span class="comment">// This file is provided "as is" with no expressed or implied warranty.</span>
<a name="l00022"></a>00022 <span class="comment">// The author accepts no liability if it causes any damage whatsoever.</span>
<a name="l00023"></a>00023 <span class="comment">// It's free - so you get what you pay for.</span>
<a name="l00024"></a>00024
<a name="l00025"></a>00025
<a name="l00026"></a>00026 <span class="comment">// CColourPopup messages</span>
<a name="l00027"></a>00027 <span class="preprocessor">#define CPN_SELCHANGE WM_USER + 1001 // Colour Picker Selection change</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#define CPN_DROPDOWN WM_USER + 1002 // Colour Picker drop down</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define CPN_CLOSEUP WM_USER + 1003 // Colour Picker close up</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define CPN_SELENDOK WM_USER + 1004 // Colour Picker end OK</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define CPN_SELENDCANCEL WM_USER + 1005 // Colour Picker end (cancelled)</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="comment">// forward declaration</span>
<a name="l00034"></a>00034 <span class="keyword">class </span>CColourPicker;
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="comment">// To hold the colours and their names</span>
<a name="l00037"></a>00037 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00038"></a>00038 COLORREF crColour;
<a name="l00039"></a>00039 TCHAR *szName;
<a name="l00040"></a>00040 } ColourTableEntry;
<a name="l00041"></a>00041
<a name="l00043"></a>00043 <span class="comment">// CColourPopup window</span>
<a name="l00044"></a>00044
<a name="l00045"></a>00045 <span class="keyword">class </span>CColourPopup : <span class="keyword">public</span> CWnd
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047 <span class="comment">// Construction</span>
<a name="l00048"></a>00048 <span class="keyword">public</span>:
<a name="l00049"></a>00049 CColourPopup();
<a name="l00050"></a>00050 CColourPopup(CPoint p, COLORREF crColour, CWnd* pParentWnd,
<a name="l00051"></a>00051 LPCTSTR szDefaultText = NULL, LPCTSTR szCustomText = NULL);
<a name="l00052"></a>00052 <span class="keywordtype">void</span> Initialise();
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <span class="comment">// Attributes</span>
<a name="l00055"></a>00055 <span class="keyword">public</span>:
<a name="l00056"></a>00056
<a name="l00057"></a>00057 <span class="comment">// Operations</span>
<a name="l00058"></a>00058 <span class="keyword">public</span>:
<a name="l00059"></a>00059 BOOL Create(CPoint p, COLORREF crColour, CWnd* pParentWnd,
<a name="l00060"></a>00060 LPCTSTR szDefaultText = NULL, LPCTSTR szCustomText = NULL);
<a name="l00061"></a>00061
<a name="l00062"></a>00062 <span class="comment">// Overrides</span>
<a name="l00063"></a>00063 <span class="comment">// ClassWizard generated virtual function overrides</span>
<a name="l00064"></a>00064 <span class="comment">//{{AFX_VIRTUAL(CColourPopup)</span>
<a name="l00065"></a>00065 <span class="keyword">public</span>:
<a name="l00066"></a>00066 <span class="keyword">virtual</span> BOOL PreTranslateMessage(MSG* pMsg);
<a name="l00067"></a>00067 <span class="comment">//}}AFX_VIRTUAL</span>
<a name="l00068"></a>00068
<a name="l00069"></a>00069 <span class="comment">// Implementation</span>
<a name="l00070"></a>00070 <span class="keyword">public</span>:
<a name="l00071"></a>00071 <span class="keyword">virtual</span> ~CColourPopup();
<a name="l00072"></a>00072
<a name="l00073"></a>00073 <span class="keyword">protected</span>:
<a name="l00074"></a>00074 BOOL GetCellRect(<span class="keywordtype">int</span> nIndex, <span class="keyword">const</span> LPRECT&amp; rect);
<a name="l00075"></a>00075 <span class="keywordtype">void</span> FindCellFromColour(COLORREF crColour);
<a name="l00076"></a>00076 <span class="keywordtype">void</span> SetWindowSize();
<a name="l00077"></a>00077 <span class="keywordtype">void</span> CreateToolTips();
<a name="l00078"></a>00078 <span class="keywordtype">void</span> ChangeSelection(<span class="keywordtype">int</span> nIndex);
<a name="l00079"></a>00079 <span class="keywordtype">void</span> EndSelection(<span class="keywordtype">int</span> nMessage);
<a name="l00080"></a>00080 <span class="keywordtype">void</span> DrawCell(CDC* pDC, <span class="keywordtype">int</span> nIndex);
<a name="l00081"></a>00081
<a name="l00082"></a>00082 COLORREF GetColour(<span class="keywordtype">int</span> nIndex) { <span class="keywordflow">return</span> m_crColours[nIndex].crColour; }
<a name="l00083"></a>00083 LPCTSTR GetColourName(<span class="keywordtype">int</span> nIndex) { <span class="keywordflow">return</span> m_crColours[nIndex].szName; }
<a name="l00084"></a>00084 <span class="keywordtype">int</span> GetIndex(<span class="keywordtype">int</span> row, <span class="keywordtype">int</span> col) <span class="keyword">const</span>;
<a name="l00085"></a>00085 <span class="keywordtype">int</span> GetRow(<span class="keywordtype">int</span> nIndex) <span class="keyword">const</span>;
<a name="l00086"></a>00086 <span class="keywordtype">int</span> GetColumn(<span class="keywordtype">int</span> nIndex) <span class="keyword">const</span>;
<a name="l00087"></a>00087
<a name="l00088"></a>00088 <span class="comment">// protected attributes</span>
<a name="l00089"></a>00089 <span class="keyword">protected</span>:
<a name="l00090"></a>00090 <span class="keyword">static</span> ColourTableEntry m_crColours[];
<a name="l00091"></a>00091 <span class="keywordtype">int</span> m_nNumColours;
<a name="l00092"></a>00092 <span class="keywordtype">int</span> m_nNumColumns, m_nNumRows;
<a name="l00093"></a>00093 <span class="keywordtype">int</span> m_nBoxSize, m_nMargin;
<a name="l00094"></a>00094 <span class="keywordtype">int</span> m_nCurrentSel;
<a name="l00095"></a>00095 <span class="keywordtype">int</span> m_nChosenColourSel;
<a name="l00096"></a>00096 CString m_strDefaultText;
<a name="l00097"></a>00097 CString m_strCustomText;
<a name="l00098"></a>00098 CRect m_CustomTextRect, m_DefaultTextRect, m_WindowRect;
<a name="l00099"></a>00099 CFont m_Font;
<a name="l00100"></a>00100 CPalette m_Palette;
<a name="l00101"></a>00101 COLORREF m_crInitialColour, m_crColour;
<a name="l00102"></a>00102 CToolTipCtrl m_ToolTip;
<a name="l00103"></a>00103 CWnd* m_pParent;
<a name="l00104"></a>00104
<a name="l00105"></a>00105 BOOL m_bChildWindowVisible;
<a name="l00106"></a>00106
<a name="l00107"></a>00107 <span class="comment">// Generated message map functions</span>
<a name="l00108"></a>00108 <span class="keyword">protected</span>:
<a name="l00109"></a>00109 <span class="comment">//{{AFX_MSG(CColourPopup)</span>
<a name="l00110"></a>00110 afx_msg <span class="keywordtype">void</span> OnNcDestroy();
<a name="l00111"></a>00111 afx_msg <span class="keywordtype">void</span> OnLButtonUp(UINT nFlags, CPoint point);
<a name="l00112"></a>00112 afx_msg <span class="keywordtype">void</span> OnPaint();
<a name="l00113"></a>00113 afx_msg <span class="keywordtype">void</span> OnMouseMove(UINT nFlags, CPoint point);
<a name="l00114"></a>00114 afx_msg <span class="keywordtype">void</span> OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
<a name="l00115"></a>00115 afx_msg BOOL OnQueryNewPalette();
<a name="l00116"></a>00116 afx_msg <span class="keywordtype">void</span> OnPaletteChanged(CWnd* pFocusWnd);
<a name="l00117"></a>00117 afx_msg <span class="keywordtype">void</span> OnKillFocus(CWnd* pNewWnd);
<a name="l00118"></a>00118 <span class="preprocessor"> #if _MFC_VER &lt; 0x0700</span>
<a name="l00119"></a>00119 <span class="preprocessor"></span> afx_msg <span class="keywordtype">void</span> OnActivateApp(BOOL bActive, HTASK hTask);
<a name="l00120"></a>00120 <span class="preprocessor"> #else</span>
<a name="l00121"></a>00121 <span class="preprocessor"></span> afx_msg <span class="keywordtype">void</span> OnActivateApp(BOOL bActive, DWORD hTask);
<a name="l00122"></a>00122 <span class="preprocessor"> #endif</span>
<a name="l00123"></a>00123 <span class="preprocessor"></span> <span class="comment">//}}AFX_MSG</span>
<a name="l00124"></a>00124 DECLARE_MESSAGE_MAP()
<a name="l00125"></a>00125 };
<a name="l00126"></a>00126
<a name="l00128"></a>00128
<a name="l00129"></a>00129 <span class="comment">//{{AFX_INSERT_LOCATION}}</span>
<a name="l00130"></a>00130 <span class="comment">// Microsoft Developer Studio will insert additional declarations immediately before the previous line.</span>
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <span class="preprocessor">#endif // !defined(AFX_COLOURPOPUP_H__D0B75902_9830_11D1_9C0F_00A0243D1382__INCLUDED_)</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Mar 5 21:28:19 2009 for ChartDemo by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>