chxavtextcontrol.h
来自「symbian 下的helix player源代码」· C头文件 代码 · 共 138 行
H
138 行
/************************************************************************
* chxavtextcontrol.h
* ------------------
*
* Synopsis:
* Text control for ui.
*
* Target:
* Symbian OS
*
*
* (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
*
************************************************************************/
#ifndef _chxavtextcontrol_h_
#define _chxavtextcontrol_h_
// Helix includes...
#include "hxstring.h"
// Include from this project...
#include "chxavcommand.h"
#include "chxavcontrol.h"
// class CHXAvTextControl
class CHXAvTextControl
: public CHXAvControl
{
public:
struct TextControlAttributes
{
TextControlAttributes()
: bIsBold(false)
, fontHeight(12)
, bIsTransparent(true)
, textColor(0,0,0)
, bgColor(255,255,255)
, justify(CGraphicsContext::ELeft)
, fontName("Swiss"){}
bool bIsBold;
TInt fontHeight;
bool bIsTransparent;
TRgb textColor;
TRgb bgColor;
CGraphicsContext::TTextAlign justify;
CHXString fontName;
};
public:
// creation
static CHXAvTextControl* NewL(const CCoeControl& container, TInt cid);
void ConstructL(const CCoeControl& parent);
CHXAvTextControl(TInt cid = -1);
virtual ~CHXAvTextControl();
void SetTruncateWithEllipsis(bool bUseEllipsis);
void SetCommandL(const CHXAvCommand& commandProto);
void SetBGBitmapL(CFbsBitmap* pbmpParentBG);
void SetText(const TDesC& text);
void SetTextColor(const TRgb& color);
void SetBackgroundColor(const TRgb& color);
void SetFontName(const CHXString& fontName);
void SetFontHeight(int height);
void SetFontBold(bool bold);
void SetJustification(CGraphicsContext::TTextAlign justify);
void SetTransparent(bool transparent);
void SetAttributes(const CHXAvTextControl::TextControlAttributes& attr);
void UpdateFont(const CFont* pExternalFont = 0);
const TextControlAttributes& GetAttr() const;
const TDesC& GetText() const;
const CFont* GetFont() const;
public:
// CCoeControl
//virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
private:
// CCoeControl
virtual void Draw(const TRect& rect) const;
private:
CFont* CreateFont() const;
private:
HBufC* m_pText;
CFont* m_pFont;
const CFont* m_pExternalFont;
CHXAvCommand* m_pCommand;
CFbsBitmap* m_pbmpBG;
bool m_bUseEllipsisForTruncation;
TextControlAttributes m_attr;
};
inline
const TDesC& CHXAvTextControl::GetText() const
{
return *m_pText;
}
inline
const CHXAvTextControl::TextControlAttributes& CHXAvTextControl::GetAttr() const
{
return m_attr;
}
inline
const CFont* CHXAvTextControl::GetFont() const
{
return m_pFont ? m_pFont : m_pExternalFont;
}
/////////////////////////////////////////////////////////
// if true, ellipsis are added at end of truncated text;
// the text itself may be truncated further to make space
// for the ellipsis
//
// if false, the text is truncated so that as much whole text
// characters will fit in the rectangle as possible
//
inline
void CHXAvTextControl::SetTruncateWithEllipsis(bool bUseEllipsis)
{
m_bUseEllipsisForTruncation = bUseEllipsis;
}
#endif // _chxavtextcontrol_h_
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?