예제 #1
0
OpUnreadBadge::OpUnreadBadge() 
: OpButton(OpButton::TYPE_CUSTOM, OpButton::STYLE_TEXT)
, m_minimum_width(0)
{
#ifdef QUICK_TOOLKIT_ACCORDION_MAC_STYLE // Mac has ugly unread counts that need to be center aligned
	SetJustify(JUSTIFY_CENTER, FALSE);
	init_status = SetText(UNI_L("00"));
#else
	SetJustify(JUSTIFY_RIGHT, FALSE);
	init_status = SetText(UNI_L("0000"));
#endif // QUICK_TOOLKIT_ACCORDION_MAC_STYLE
	CHECK_STATUS(init_status);

	SetDead(TRUE);
	INT32 h;
	VisualDeviceHandler vis_dev_handler(this);
	GetRequiredSize(m_minimum_width, h);
	init_status = SetText(UNI_L(""));
}
예제 #2
0
OGRFieldDefn::OGRFieldDefn( OGRFieldDefn *poPrototype )

{
    Initialize( poPrototype->GetNameRef(), poPrototype->GetType() );

    SetJustify( poPrototype->GetJustify() );
    SetWidth( poPrototype->GetWidth() );
    SetPrecision( poPrototype->GetPrecision() );
//    SetDefault( poPrototype->GetDefaultRef() );
}
예제 #3
0
void    plDynamicTextMap::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height )
{
    if( !IIsValid() )
        return;

    SetJustify( fJustify );
    fCurrFont->SetRenderClipping( clipX, clipY, width, height );
    fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
    fCurrFont->RenderString( this, x, y, text );
}
예제 #4
0
void OGRFieldDefn::Set( const char *pszNameIn,
                        OGRFieldType eTypeIn,
                        int nWidthIn, int nPrecisionIn,
                        OGRJustification eJustifyIn )
{
    SetName( pszNameIn );
    SetType( eTypeIn );
    SetWidth( nWidthIn );
    SetPrecision( nPrecisionIn );
    SetJustify( eJustifyIn );
}
예제 #5
0
void    plDynamicTextMap::DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height, uint16_t *lastX, uint16_t *lastY )
{
    if( !IIsValid() )
        return;

    SetJustify( fJustify );
    fCurrFont->SetRenderWrapping( x, y, width, height );
    fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
    fCurrFont->SetRenderFlag( plFont::kRenderIntoAlpha, fFontBlockRGB );
    fCurrFont->RenderString( this, x, y, text, lastX, lastY );
}
예제 #6
0
void    plDynamicTextMap::DrawString( uint16_t x, uint16_t y, const wchar_t *text )
{
    if( !IIsValid() )
        return;

    SetJustify( fJustify );
    fCurrFont->SetRenderFlag( plFont::kRenderWrap | plFont::kRenderClip, false );
    fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
    fCurrFont->SetRenderFlag( plFont::kRenderIntoAlpha, fFontBlockRGB );
    fCurrFont->RenderString( this, x, y, text );
}
예제 #7
0
uint16_t      plDynamicTextMap::CalcStringWidth( const wchar_t *text, uint16_t *height )
{
// ===> Don't need to validate creation
//  if( !IIsValid() )
//      return 0;

    SetJustify( fJustify );
    uint16_t w, h, a, lastX, lastY;
    uint32_t firstClipped;
    fCurrFont->SetRenderFlag( plFont::kRenderClip | plFont::kRenderWrap, false );
    fCurrFont->CalcStringExtents( text, w, h, a, firstClipped, lastX, lastY );
    if( height != nil )
        *height = h;
    return w;
}
예제 #8
0
void    plDynamicTextMap::SetFont( const char *face, uint16_t size, uint8_t fontFlags, bool antiAliasRGB )
{
// ===> Don't need to validate creation
//  if( !IIsValid() )
//      return;

    delete [] fFontFace;
    if (plLocalization::UsingUnicode())
    {
        // unicode has a bunch of chars that most fonts don't have, so we override the font choice with one
        // that will work with the desired language
        hsStatusMessageF("We are using a unicode language, overriding font choice of %s", face ? face : "nil");
        fFontFace = hsStrcpy( "Unicode" );
    }
    else
        fFontFace = ( face != nil ) ? hsStrcpy( face ) : nil;
    fFontSize = size;
    fFontFlags = fontFlags;
    fFontAntiAliasRGB = antiAliasRGB;

    fCurrFont = plFontCache::GetInstance().GetFont( fFontFace, (uint8_t)fFontSize,
                        ( ( fFontFlags & kFontBold ) ? plFont::kFlagBold : 0 ) | 
                        ( ( fFontFlags & kFontItalic ) ? plFont::kFlagItalic : 0 ) );
    if ( fCurrFont == nil )
    {
        if (!fCurrFont)
            hsStatusMessageF("Font missing - %s. Using Arial", fFontFace ? fFontFace : "nil");

        if ( fFontFace )
            delete [] fFontFace;
        fFontFace = hsStrcpy( "Arial" );
        // lets try again with Arial
        fCurrFont = plFontCache::GetInstance().GetFont( fFontFace, (uint8_t)fFontSize,
                            ( ( fFontFlags & kFontBold ) ? plFont::kFlagBold : 0 ) | 
                            ( ( fFontFlags & kFontItalic ) ? plFont::kFlagItalic : 0 ) );
    }

    // This will be nil if we're just running the page optimizer.
    if (fCurrFont)
    {
        fCurrFont->SetRenderYJustify( plFont::kRenderJustYTop );
        SetJustify( fJustify );
    }
}
예제 #9
0
void    plDynamicTextMap::CalcWrappedStringSize( const wchar_t *text, uint16_t *width, uint16_t *height, uint32_t *firstClippedChar, uint16_t *maxAscent, uint16_t *lastX, uint16_t *lastY )
{
// ===> Don't need to validate creation
//  if( !IIsValid() )
//      return;

    SetJustify( fJustify );
    uint16_t w, h, a, lX, lY;
    uint32_t firstClipped;
    fCurrFont->SetRenderWrapping( 0, 0, *width, *height );
    fCurrFont->CalcStringExtents( text, w, h, a, firstClipped, lX, lY );
    *width = w;
    *height = h;
    if( firstClippedChar != nil )
        *firstClippedChar = firstClipped;
    if( maxAscent != nil )
        *maxAscent = a;
    if( lastX != nil )
        *lastX = lX;
    if( lastY != nil )
        *lastY = lY;
}
예제 #10
0
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Deprecated REMOVE IT ASAP
//
OP_STATUS OpLabel::SetLabel(const uni_char* newlabel, BOOL center)
{
	SetJustify(center ? JUSTIFY_CENTER : JUSTIFY_LEFT, FALSE);

	return SetText(newlabel);
}
예제 #11
0
bool    plDynamicTextMap::MsgReceive( plMessage *msg )
{
    plDynamicTextMsg    *textMsg = plDynamicTextMsg::ConvertNoRef( msg );
    if( textMsg != nil )
    {
        if( textMsg->fCmd & plDynamicTextMsg::kClear )
            ClearToColor( textMsg->fClearColor );

        if( textMsg->fCmd & plDynamicTextMsg::kSetTextColor )
            SetTextColor( textMsg->fColor, textMsg->fBlockRGB );

        if( (textMsg->fCmd & plDynamicTextMsg::kSetFont ) && textMsg->fString)
            SetFont( textMsg->fString, textMsg->fX, (uint8_t)(textMsg->fFlags) );
        
        if( textMsg->fCmd & plDynamicTextMsg::kSetLineSpacing )
            SetLineSpacing( textMsg->fLineSpacing );

        if( textMsg->fCmd & plDynamicTextMsg::kSetJustify )
            SetJustify( (Justify)textMsg->fFlags );

        if( textMsg->fCmd & plDynamicTextMsg::kFillRect )
            FillRect( textMsg->fLeft, textMsg->fTop, textMsg->fRight - textMsg->fLeft + 1,
                        textMsg->fBottom - textMsg->fTop + 1, textMsg->fColor );

        if( textMsg->fCmd & plDynamicTextMsg::kFrameRect )
            FrameRect( textMsg->fLeft, textMsg->fTop, textMsg->fRight - textMsg->fLeft + 1,
                        textMsg->fBottom - textMsg->fTop + 1, textMsg->fColor );

        if( (textMsg->fCmd & plDynamicTextMsg::kDrawString ) && textMsg->fString)
            DrawString( textMsg->fX, textMsg->fY, textMsg->fString );

        if( (textMsg->fCmd & plDynamicTextMsg::kDrawClippedString ) && textMsg->fString)
            DrawClippedString( textMsg->fX, textMsg->fY, textMsg->fString,
                                textMsg->fLeft, textMsg->fTop, textMsg->fRight - textMsg->fLeft + 1,
                                textMsg->fBottom - textMsg->fTop + 1 );

        if( (textMsg->fCmd & plDynamicTextMsg::kDrawWrappedString ) && textMsg->fString)
            DrawWrappedString( textMsg->fX, textMsg->fY, textMsg->fString, textMsg->fRight, textMsg->fBottom );

        if( textMsg->fCmd & plDynamicTextMsg::kDrawImage )
        {
            plMipmap *mip = plMipmap::ConvertNoRef( textMsg->fImageKey ? textMsg->fImageKey->ObjectIsLoaded() : nil);
            if( mip != nil )
                DrawImage( textMsg->fX, textMsg->fY, mip, textMsg->fFlags ? kImgBlend : kImgNoAlpha );
        }

        if( textMsg->fCmd & plDynamicTextMsg::kDrawClippedImage )
        {
            plMipmap *mip = plMipmap::ConvertNoRef( textMsg->fImageKey ? textMsg->fImageKey->ObjectIsLoaded() : nil);
            if( mip != nil )
                DrawClippedImage( textMsg->fX, textMsg->fY, mip, textMsg->fLeft, textMsg->fTop, 
                                textMsg->fRight, textMsg->fBottom, textMsg->fFlags ? kImgBlend : kImgNoAlpha );
        }

        if( textMsg->fCmd & plDynamicTextMsg::kFlush )
            FlushToHost();

        if( textMsg->fCmd & plDynamicTextMsg::kPurgeImage )
            PurgeImage();

        return true;
    }

    return plMipmap::MsgReceive( msg );
}