//--------------------------------------------------------------------------- #ifndef TWLabelH #define TWLabelH //--------------------------------------------------------------------------- #include #include #include #include //--------------------------------------------------------------------------- // ÄÄÆ÷³ÍÆ® À̸§ : TWLabel // Á¦ÀÛÀÚ : ÀÌ°æ¹Î (WARSHIP) // Á¦ÀÛ ±â°£ : 1.5 days // Á¦ÀÛÀÏ : 2006.4.7 ~ 2006.4.8 // ¹öÁ¯ : ´ëÃæ 1.0 ¤¾¤¾ enum WVLayout { VL_Top, VL_Center, VL_Bottom }; enum WHLayout { HL_Left, HL_Center, HL_Right }; enum WBorderType { BT_Rect, BT_RRect, BT_Ellipse }; enum WGradientType { GT_Horz, GT_Vert }; enum WStyle { WS_Rect, WS_RRect, WS_Ellipse }; enum WTextStyle { TS_Normal, TS_Outline, TS_Shadow }; class TWBevel : public TPersistent { private: TColor m_FColor,m_BColor; int m_Width; bool m_Visible; public: TNotifyEvent m_Change; __fastcall TWBevel() : TPersistent() , m_Width(3), m_Visible(false), m_FColor(clWhite), m_BColor(clGray) {} void __fastcall DrawBevel(TCanvas *Canvas,TRect *pRect); private: void __fastcall SetWidth(int Width); void __fastcall SetVisible(bool Visible); void __fastcall SetFColor(TColor Color); void __fastcall SetBColor(TColor Color); __published: __property int Width = { read = m_Width, write = SetWidth, default = 3 }; __property bool Visible = { read = m_Visible, write = SetVisible, default = false}; __property TColor TL_Color = { read = m_FColor, write = SetFColor, default = clWhite}; __property TColor BR_Color = { read = m_BColor, write = SetBColor, default = clGray}; }; class TWTextStyle : public TPersistent { private: WTextStyle m_TextStyle; int m_Depth; TColor m_Color; public: TNotifyEvent m_Change; __fastcall TWTextStyle() : TPersistent() , m_TextStyle(TS_Normal), m_Depth(1), m_Color(clWhite) {} void __fastcall DrawText(TCanvas *Canvas, double x, double y, TStrings *sl, double dx, double dy); private: void __fastcall SetTextStyle(WTextStyle TextStyle); void __fastcall SetDepth(int Depth); void __fastcall SetColor(TColor Color); __published: __property WTextStyle Style = { read = m_TextStyle, write = SetTextStyle, default = TS_Normal }; __property int Depth = { read = m_Depth, write = SetDepth, default = 1 }; __property TColor Color = { read = m_Color, write = SetColor, default = clWhite }; }; class TWStyle : public TPersistent { private: WStyle m_Style; int m_Round; void __fastcall SetStyle(WStyle Style); void __fastcall SetRound(int Round); public: TNotifyEvent m_Change; __fastcall TWStyle() : TPersistent(), m_Style(WS_Rect), m_Round(10) {} HRGN __fastcall GetRegion(TRect *pRect); __published: __property WStyle Style = { read = m_Style, write = SetStyle, default = WS_Rect }; __property int Round = { read = m_Round, write = SetRound, default = 10 }; }; class TWBorder : public TPersistent { private: int m_Width; TColor m_Color; public: TNotifyEvent m_Change; __fastcall TWBorder() : TPersistent(), m_Width(1), m_Color(clBtnFace) {} void __fastcall DrawBorder(TCanvas *Canvas, HRGN rgn); private: void __fastcall SetWidth(int Width); void __fastcall SetColor(TColor Color); __published: __property TColor Color = { read = m_Color, write = SetColor, default=clBtnFace }; __property int Width = { read = m_Width, write = SetWidth , default=1 }; }; class TWGradient : public TPersistent { private: WGradientType m_GradType; TColor m_FColor, m_BColor; Graphics::TBitmap *m_pBmp; public: TNotifyEvent m_Change; __fastcall TWGradient(); virtual __fastcall ~TWGradient(); void __fastcall DrawGradient(TCanvas *Canvas, TRect *pRect); void __fastcall SetSize(int Width,int Height); private: void __fastcall MakeGradient(void); void __fastcall SetGradType(WGradientType GradType); void __fastcall SetFColor(TColor FColor); void __fastcall SetBColor(TColor BColor); __published: __property WGradientType Type = { read = m_GradType, write = SetGradType, default=GT_Horz }; __property TColor FColor = { read = m_FColor, write = SetFColor, default=clGray }; __property TColor BColor = { read = m_BColor, write = SetBColor, default=clGray }; }; class PACKAGE TWLabel : public TGraphicControl { public: __fastcall TWLabel(TComponent* Owner); virtual __fastcall ~TWLabel(); private: // Caption TStrings* m_Caption; void __fastcall SetCaption(TStrings* Caption); private: // Text Style TWTextStyle* m_TextStyle; void __fastcall SetTextStyle(TWTextStyle *TextStyle); private: // Rotate int m_Rotate; void __fastcall SetRotate(int rotate); private: // Font // TFontÀÇ property°¡ ¹Ù²ð ¶§ ³»ºÎÀûÀ¸·Î ÇÚµéÀ» ±³Ã¼Çϱ⠶§¹®¿¡ // ÇÚµéÀ» µû·Î °ü¸®ÇؾßÇÔ. Rotate¿¡¼­ ¹®Á¦°¡ »ý±è // dfm È­ÀÏ¿¡¼­ Rotateº¸´Ù Font Á¤º¸°¡ µÚ¿¡À־ ¹®Á¦°¡µÊ. void __fastcall OnFontChange(TObject *Sender); HFONT m_FontHandle; TFont *m_Font; void __fastcall SetFont(TFont *Font); private: // Style TWStyle *m_Style; void __fastcall SetStyle(TWStyle *Style); private: // Caption's layout WHLayout m_HLayout; WVLayout m_VLayout; void __fastcall SetHorzAlign(WHLayout hl); void __fastcall SetVertAlign(WVLayout vl); private: // Border TWBorder *m_Border; void __fastcall SetBorder(TWBorder *border); private: // Gradient TWGradient *m_Gradient; void __fastcall SetGradient(TWGradient *Gradient); private: // Bevel TWBevel *m_Bevel; void __fastcall SetBevel(TWBevel *Bevel); private: // ETC bool m_Transparency; void __fastcall SetTransparency(bool Transparency); void __fastcall OnHover(TMessage &Msg); void __fastcall OnLeave(TMessage &Msg); public: TNotifyEvent m_MouseEnter; TNotifyEvent m_MouseLeave; private: void __fastcall OnChange(TObject *Sender); void __fastcall OnPaint(TMessage &Msg); public: BEGIN_MESSAGE_MAP VCL_MESSAGE_HANDLER(WM_PAINT,TMessage,OnPaint) VCL_MESSAGE_HANDLER(CM_MOUSEENTER,TMessage,OnHover) VCL_MESSAGE_HANDLER(CM_MOUSELEAVE,TMessage,OnLeave) END_MESSAGE_MAP(TGraphicControl) __published: __property TNotifyEvent OnMouseEnter = { read = m_MouseEnter, write = m_MouseEnter }; __property TNotifyEvent OnMouseLeave = { read = m_MouseLeave, write = m_MouseLeave }; __property bool Transparency = { read = m_Transparency, write = SetTransparency, default=false}; __property TWTextStyle* TextStyle = { read = m_TextStyle, write = SetTextStyle }; __property TWBevel* Bevel = { read = m_Bevel, write = SetBevel}; __property TWStyle* Style = { read = m_Style, write = SetStyle }; __property TStrings* Caption = { read = m_Caption , write = SetCaption }; __property WHLayout LayoutHorz = { read = m_HLayout , write = SetHorzAlign }; __property WVLayout LayoutVert = { read = m_VLayout , write = SetVertAlign }; __property TWBorder* Border = { read = m_Border, write = SetBorder }; __property TWGradient* Gradient = { read = m_Gradient, write = SetGradient }; __property int Rotate = { read = m_Rotate, write = SetRotate }; __property TFont* Font = { read = m_Font, write = SetFont }; __property Align; __property Enabled; __property ShowHint; __property Visible; __property OnClick; __property OnDblClick; __property OnMouseDown; __property OnMouseMove; __property OnMouseUp; }; //--------------------------------------------------------------------------- inline void ZoomRect(tagRECT *pRect,int Value) { pRect->left -= Value; pRect->top -= Value; pRect->right += Value; pRect->bottom += Value; } #endif