// Copyright UCanCode Software Technology Inc, All Rights Reserved
// You can contact us.
// Support@UCanCode.net
// http://www.ucancode.net
/********************************************************************/
// FODropColorPaletteControl.h: interface for the CFODropColorPaletteControl class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FODROPCOLORPALETTECONTROL_H__526F9B93_F5BB_11D5_A4D3_525400EA266C__INCLUDED_)
#define AFX_FODROPCOLORPALETTECONTROL_H__526F9B93_F5BB_11D5_A4D3_525400EA266C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "FOColorCellObj.h"
#define FO_TOTAL_DROP_COLOR_CELLS 48
class CFODropColorPaletteControl : public CObject
{
protected:
DECLARE_SERIAL(CFODropColorPaletteControl);
public:
// Constructor
CFODropColorPaletteControl();
// Destructor
virtual ~CFODropColorPaletteControl();
// Creates the component and initializes the data members.
virtual void Create(CWnd *pWnd,COLORREF crDefault,CRect &rcPos,BOOL bPopup = FALSE);
// Serialize data
virtual void Serialize(CArchive &ar);
// Initialize Color Palette
virtual void InitColorPalette();
// Adjust Cells
virtual void AdjustCells(CRect rcPos);
// Compute Colors
virtual void ComputeColors();
// Draw
virtual void OnDraw(CDC *pDC);
// Update All
virtual void UpdateAll();
// Get Current Color
COLORREF GetRGB () const { return m_crCurColor; }
// Set Current Color
void SetRGB(COLORREF ref);
// Get Old Colo rRectangle
CRect GetOldColorRect();
// HitTest
virtual CFOColorCellObj* HitTest(CPoint point);
// Is Popup Style?
BOOL IsPopupStyle() const { return m_bPopup; }
// Set Popup Style
void SetPopupStyle(const BOOL bPopup) { m_bPopup = bPopup; }
// Define for WM_TFC_SELECTOK message.
virtual void OnSelectOK(WPARAM wParam, LPARAM lParam);
// Define for WM_TFC_SELECTCANCEL message.
virtual void OnSelectCancel(WPARAM wParam, LPARAM lParam);
protected:
// Total Cells
CFOColorCellObj m_crCells[FO_TOTAL_DROP_COLOR_CELLS];
public:
// virtual void Serialize(CArchive &ar);
// Save Document
virtual BOOL SaveDocument(LPCTSTR lpszPathName);
// Open Document
virtual BOOL OpenDocument(LPCTSTR lpszPathName);
// Get File
CFile * GetFile(LPCTSTR lpszFileName, UINT nOpenFlags,CFileException* pError);
// Release File
virtual void ReleaseFile(CFile* pFile, BOOL bAbort);
// Set wnd handle.
void SetWnd(CWnd *pWnd) { m_pParent = pWnd; }
// Invalidates this gadget.
void Invalidate(BOOL bRedraw = FALSE);
// Update the given rectangle.
void InvalRect(CRect rcPos);
// Capture the mouse.
void CaptureMouse(BOOL bCapture);
// WM_CHAR message.
void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
// WM_LBUTTONDOWN message.
void OnLButtonDown(UINT nFlags, CPoint point);
// WM_LBUTTONDBLCLK message.
void OnLButtonDblClk(UINT nFlags, CPoint point);
// WM_RBUTTONDOWN message.
void OnRButtonDown(UINT nFlags, CPoint point);
// WM_LBUTTONUP message.
void OnLButtonUp(UINT nFlags, CPoint point);
// WM_MOUSEMOVE message.
void OnMouseMove(UINT nFlags, CPoint point);
// WM_KEYDOWN message.
void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
// Cancel mode.
virtual void OnCancelMode();
// Get Rectangle
CRect GetRect() const { return m_rcPosition; }
// Set Rectangle
void SetRect(const CRect rc) { m_rcPosition = rc; }
// Set Custom Text
void SetCustomText(const CString strText ) { strCustom = strText; }
// Get Custom Text
CString GetCustomText() const { return strCustom; }
// Set Custom Bar
void SetCustomBar(const BOOL bCustom);
// Set Main Border Size
void SetMainBorderSize(const int nBorder);
// Get Main Border Size
int GetMainBorderSize() const { return nMainBorderSize; }
// Set Cell Border Size
void SetCellBorderSize(const int nBorder);
// Get Cell Border Size
int GetCellBorderSize() const { return nCellBorderSize; }
// Set Border Type
void SetBorderType(const UINT nType) { nBorderType = nType; }
// Get Border Type
UINT GetBorderType() const { return nBorderType; }
// Update Custom
void UpdateCustom();
public:
// Draw border for the control.
// Draw Other Border
virtual void DrawOtherBorder(CDC *pDC,CRect &rcPos,UINT nType);
// Draw Custom
virtual void OnCustomDraw(CDC *pDC,BOOL bHasColor);
// Draw Custom Selected
virtual void OnCustomDrawSelect(CDC *pDC);
// Draw a rectangle
void DrawRect(CDC *pDC, RECT rect);
// Draw a rectangle
void DrawRect(CDC *pDC, int x, int y, int w, int h);
// Draw a rectangle
void DrawRect(CDC *pDC, RECT rect, COLORREF color);
// Draw a rectangle
void DrawRect(CDC *pDC, int x, int y, int w, int h, COLORREF color);
// Draw a circle
void DrawCircle(CDC *pDC, int x, int y, int radius);
//Draw a circle
void DrawCircle(CDC *pDC, int x, int y, int radius, COLORREF color);
// Draw a line
void DrawLine(CDC *pDC, CPoint& start, CPoint& end);
// Draw a line
void DrawLine(CDC *pDC, int xStart, int yStart, int xEnd, int yEnd);
// Draw a line
void DrawLine(CDC *pDC, CPoint& start, CPoint& end, COLORREF color);
// Draw a line
void DrawLine(CDC *pDC, int xStart, int yStart, int xEnd, int yEnd, COLORREF color);
protected:
// The Rectangle of Cells
CRect rcCells;
// The Rectangle of Position
CRect m_rcPosition;
// The Rectangle of Custom
CRect rcCustom;
// the Rectangle of Custom Saved
CRect rcCustomSave;
// Sep Rectangle
CRect rcSep;
// Current Color
COLORREF m_crCurColor;
// The pointer to parent window
CWnd* m_pParent;
// Is it popup style?
BOOL m_bPopup;
// Is it custom selected?
BOOL m_bCustomSelect;
// Custom string
CString strCustom;
// Rows
int m_nRows;
// Columns
int m_nCols;
// Has it custom bar
BOOL bHasCustomBar;
// Main Border Size
int nMainBorderSize;
// Cell Border Size
int nCellBorderSize;
// Border Type
UINT nBorderType;
// Text Font
CFont fText;
};
//Define type CTypedPtrList
typedef CTypedPtrList<CObList, CFODropColorPaletteControl*> CFODropColorPaletteControlList;
#endif // !defined(AFX_FODROPCOLORPALETTECONTROL_H__526F9B93_F5BB_11D5_A4D3_525400EA266C__INCLUDED_)