示例#1
0
void Alignment::UpdateChild() {
	Widget::Ptr child = GetChild();

	if( !child ) {
		return;
	}

	sf::FloatRect allocation( GetAllocation() );

	sf::Vector2f spare_space( allocation.width, allocation.height );
	spare_space -= child->GetRequisition();
	spare_space.x *= 1.f - GetScale().x;
	spare_space.y *= 1.f - GetScale().y;

	if( ( spare_space.x < 0 ) || ( spare_space.y < 0 ) ) {
#ifdef SFGUI_DEBUG
		std::cerr << "SFGUI warning: Alignment got a smaller allocation than it requested." << std::endl;
		return;
#endif
	}

	allocation.left = spare_space.x * GetAlignment().x;
	allocation.top = spare_space.y * GetAlignment().y;
	allocation.width -= spare_space.x;
	allocation.height -= spare_space.y;

	child->SetAllocation( allocation );
}
示例#2
0
void * SmallObjAllocator::Allocate( std::size_t numBytes, bool doThrow )
{
    if ( numBytes > GetMaxObjectSize() )
        return DefaultAllocator( numBytes, doThrow );

    assert( NULL != pool_ );
    if ( 0 == numBytes ) numBytes = 1;
    const std::size_t index = GetOffset( numBytes, GetAlignment() ) - 1;
    const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() );
    (void) allocCount;
    assert( index < allocCount );

    FixedAllocator & allocator = pool_[ index ];
    assert( allocator.BlockSize() >= numBytes );
    assert( allocator.BlockSize() < numBytes + GetAlignment() );
    void * place = allocator.Allocate();

    if ( ( NULL == place ) && TrimExcessMemory() )
        place = allocator.Allocate();

    if ( ( NULL == place ) && doThrow )
    {
#ifdef _MSC_VER
        throw std::bad_alloc( "could not allocate small object" );
#else
        // GCC did not like a literal string passed to std::bad_alloc.
        // so just throw the default-constructed exception.
        throw std::bad_alloc();
#endif
    }
    return place;
}
示例#3
0
void wxGenericStaticText::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    if ( m_label.empty() )
        return;
    wxPaintDC dc(this);
    PrepareDC(dc);

    wxRect rect = GetClientRect();
    if ( IsEnabled() )
    {
        dc.SetTextForeground(
                       wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
    }
    else // paint disabled text
    {
        // draw shadow of the text
        dc.SetTextForeground(
                       wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT));
        wxRect rectShadow = rect;
        rectShadow.Offset(1, 1);
        dc.DrawLabel(m_label, rectShadow, GetAlignment(), m_mnemonic);
        dc.SetTextForeground(
                       wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
    }
    dc.DrawLabel(m_label, wxNullBitmap, rect, GetAlignment(), m_mnemonic);
}
示例#4
0
bool SmallObjAllocator::IsCorrupt( void ) const
{
    if ( NULL == pool_ )
    {
        assert( false );
        return true;
    }
    if ( 0 == GetAlignment() )
    {
        assert( false );
        return true;
    }
    if ( 0 == GetMaxObjectSize() )
    {
        assert( false );
        return true;
    }
    const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() );
    for ( std::size_t ii = 0; ii < allocCount; ++ii )
    {
        if ( pool_[ ii ].IsCorrupt() )
            return true;
    }
    return false;
}
示例#5
0
void _L1TXX( short xpos, short ypos, char _WCI86FAR * str,
/*========*/ struct xycoord _WCI86FAR * concat, struct xycoord _WCI86FAR * extent )

/*  Inquire the extents of the character drawing parallelogram and
    return the concatenation point. The concatenation point is the same
    as the drawing point if it cannot be calculated exactly.    */

{
    short               hor;        /* horizontal alignment */
    short               vert;       /* vertical alignment   */
    struct xycoord      up;         /* character up vector  */
    struct xycoord      base;       /* character base line vector   */
    struct xycoord      space;      /* spacing between characters   */
    struct xycoord      length;     /* horizontal side of parallelogram */
    struct xycoord      height;     /* vertical side of parallelogram   */
    struct xycoord      trans;      /* translation for parallelogram    */

    GetVectors( &base, &up );
    GetAlignment( &hor, &vert );
    CalcSpacing( &base, &up, &space );
    CalcSides( &length, &height, &base, &up, &space, str );
    CalcTranslation( &trans, &length, &height, &up, hor, vert );
    CalcCorners( extent, &length, &height, &trans, xpos, ypos );
    if( _TextSettings.txpath == _PATH_RIGHT ||
        _TextSettings.txpath == _PATH_LEFT ) {
        CalcConcat( concat, &length, &space, xpos, ypos, hor, vert );
    } else {
        CalcConcat( concat, &height, &space, xpos, ypos, hor, vert );
    }
}
示例#6
0
FX_BOOL CXFA_FFListBox::LoadWidget() {
  CFWL_ListBox* pListBox = CFWL_ListBox::Create();
  pListBox->Initialize();
  pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground,
                         0xFFFFFFFF);
  m_pNormalWidget = (CFWL_Widget*)pListBox;
  IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
  m_pNormalWidget->SetPrivateData(pWidget, this, NULL);
  IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
  pNoteDriver->RegisterEventTarget(pWidget, pWidget);
  m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
  m_pNormalWidget->LockUpdate();
  CFX_WideStringArray wsLabelArray;
  m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
  int32_t iItems = wsLabelArray.GetSize();
  for (int32_t i = 0; i < iItems; i++) {
    pListBox->AddString(wsLabelArray[i]);
  }
  FX_DWORD dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
  if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
    dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
  }
  dwExtendedStyle |= GetAlignment();
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
  CFX_Int32Array iSelArray;
  m_pDataAcc->GetSelectedItems(iSelArray);
  int32_t iSelCount = iSelArray.GetSize();
  for (int32_t j = 0; j < iSelCount; j++) {
    FWL_HLISTITEM item = pListBox->GetItem(iSelArray[j]);
    pListBox->SetSelItem(item, TRUE);
  }
  m_pNormalWidget->UnlockUpdate();
  return CXFA_FFField::LoadWidget();
}
示例#7
0
//----------------------------------------------------------------------------
//
//	ROUTINE:	CCharacter::GetCrosshairRelativeToPlayer()
//
//	PURPOSE:	Returns a selected RelationData based on our relation
//				with the player.  To summarize, this function converts two
//				dynamic character classes into a static RelationData
//
//----------------------------------------------------------------------------
CharacterClass GetRelativeAlignment(const RelationSet& r1, const RelationData& c2)
{
    CharacterClass CC = NEUTRAL;
    CharacterAlignment CA = GetAlignment(r1, c2);

    // If we our alignment with eachother was set, then simplify into a
    // relations the crosshair system supports (ie RelationData)
    if ( CA != INVALID )
    {
        switch( CA )
        {
        case LIKE:
            CC = GOOD;
            break;
        case TOLERATE:
            CC = NEUTRAL;
            break;
        case HATE:
            CC = BAD;
            break;
        case UNDETERMINED:
            CC = UNKNOWN;
            break;
        default:
            UBER_ASSERT( 0, "Unknown relation" );
        };
    }

    return CC;
}
示例#8
0
void CXFA_FFComboBox::UpdateWidgetProperty() {
  CFWL_ComboBox* pComboBox = (CFWL_ComboBox*)m_pNormalWidget;
  if (!pComboBox) {
    return;
  }
  uint32_t dwExtendedStyle = 0;
  uint32_t dwEditStyles =
      FWL_STYLEEXT_EDT_ReadOnly | FWL_STYLEEXT_EDT_LastLineHeight;
  dwExtendedStyle |= UpdateUIProperty();
  if (m_pDataAcc->IsChoiceListAllowTextEntry()) {
    dwEditStyles &= ~FWL_STYLEEXT_EDT_ReadOnly;
    dwExtendedStyle |= FWL_STYLEEXT_CMB_DropDown;
  }
  if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
      !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
    dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
    dwExtendedStyle |= FWL_STYLEEXT_CMB_ReadOnly;
  }
  dwExtendedStyle |= GetAlignment();
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
  if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
    dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
  }
  pComboBox->EditModifyStylesEx(dwEditStyles, 0xFFFFFFFF);
}
void OpExtensionsDevToolsToolbar::OnAlignmentChanged()
{
	if (GetAlignment() == ALIGNMENT_OFF)
	{
			
	}
}
示例#10
0
void CXFA_FFNumericEdit::UpdateWidgetProperty() {
  CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget;
  if (!pWidget) {
    return;
  }
  uint32_t dwExtendedStyle =
      FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
      FWL_STYLEEXT_EDT_Validate | FWL_STYLEEXT_EDT_Number |
      FWL_STYLEEXT_EDT_LastLineHeight;
  dwExtendedStyle |= UpdateUIProperty();
  if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
  }
  int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
  if (iNumCells > 0) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
    pWidget->SetLimit(iNumCells);
  }
  dwExtendedStyle |= GetAlignment();
  if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
      !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
  }
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
}
示例#11
0
void SmallObjAllocator::Deallocate( void * p )
{
    if ( NULL == p ) return;
    assert( NULL != pool_ );
    FixedAllocator * pAllocator = NULL;
    const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() );
    Chunk * chunk = NULL;

    for ( std::size_t ii = 0; ii < allocCount; ++ii )
    {
        chunk = pool_[ ii ].HasBlock( p );
        if ( NULL != chunk )
        {
            pAllocator = &pool_[ ii ];
            break;
        }
    }
    if ( NULL == pAllocator )
    {
        DefaultDeallocator( p );
        return;
    }

    assert( NULL != chunk );
    const bool found = pAllocator->Deallocate( p, chunk );
    (void) found;
    assert( found );
}
示例#12
0
void wxGenericStaticText::DoDrawLabel(wxDC& dc, const wxRect& rect)
{
#if wxUSE_MARKUP
    if ( m_markupText )
        m_markupText->Render(dc, rect, wxMarkupText::Render_ShowAccels);
    else
#endif // wxUSE_MARKUP
        dc.DrawLabel(m_label, rect, GetAlignment(), m_mnemonic);
}
示例#13
0
wxString pgType::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Type: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP TYPE ") + GetQuotedFullIdentifier() + wxT(";")
		      + wxT("\n\nCREATE TYPE ") + GetQuotedFullIdentifier();
		if (GetTypeClass() == TYPE_COMPOSITE)
		{
			sql += wxT(" AS\n   (");
			sql += GetQuotedTypesList();
		}
		else if (GetTypeClass() == TYPE_ENUM)
		{
			sql += wxT(" AS ENUM\n   (");
			sql += GetQuotedLabelList();
		}
		else
		{
			sql += wxT("\n   (INPUT=") + qtIdent(GetInputFunction())
			       + wxT(", OUTPUT=") + qtIdent(GetOutputFunction());
			AppendIfFilled(sql, wxT(", DEFAULT="), qtDbString(GetDefault()));
			if (!GetElement().IsNull())
			{
				sql += wxT(",\n       ELEMENT=") + GetElement()
				       + wxT(", DELIMITER='") + GetDelimiter() + wxT("'");
			}
			sql += wxT(",\n       INTERNALLENGTH=") + NumToStr(GetInternalLength())
			       + wxT(", ALIGNMENT=" + GetAlignment()
			             + wxT(", STORAGE=") + GetStorage());
			if (GetConnection()->BackendMinimumVersion(8, 3))
			{
				if (GetTypmodinFunction() != wxEmptyString && GetTypmodoutFunction() != wxEmptyString)
				{
					sql += wxT(",\n       TYPMOD_IN=") + GetTypmodinFunction()
					       + wxT(", TYPMOD_OUT=") + GetTypmodoutFunction();
				}
				else if (GetTypmodinFunction() != wxEmptyString)
					sql += wxT(",\n       TYPMOD_IN=") + GetTypmodinFunction();
				else if (GetTypmodoutFunction() != wxEmptyString)
					sql += wxT(",\n       TYPMOD_OUT=") + GetTypmodoutFunction();
			}
			if (GetConnection()->BackendMinimumVersion(9, 1) && GetCollatable())
			{
				sql += wxT(",\n       COLLATABLE=true");
			}
		}
		sql += wxT(");\n")
		       + GetOwnerSql(8, 0)
		       + GetCommentSql();

		if (GetConnection()->BackendMinimumVersion(9, 1))
			sql += GetSeqLabelsSql();
	}

	return sql;
}
示例#14
0
sbStatus sbMember::FixUp( sbSchema* schema, const sbMember* previous_member )
{
  m_Type = PreFixUp( schema, m_TypeName );
  
  size_t offset = previous_member ? previous_member->m_Offset + previous_member->GetTotalSize() : 0;
  offset = FIX_ALIGNMENT( offset, GetAlignment() );
  m_Offset = offset;
  
  return sbStatus_Ok;
}
示例#15
0
void OpGoToIntranetBar::Hide(BOOL focus_page)
{
	if (GetAlignment() == ALIGNMENT_OFF)
		return;

	OpInfobar::Hide();

	if (focus_page)
		g_input_manager->InvokeAction(OpInputAction::ACTION_FOCUS_PAGE);
}
示例#16
0
int CXTPReportColumn::GetFooterAlignment() const
{
	if (m_nFooterAlignment != -1)
		return m_nFooterAlignment;

	if (GetColumns()->GetReportHeader()->GetPaintManager()->m_bUseColumnTextAlignment)
		return GetAlignment();

	return GetNormAlignment(DT_LEFT);
}
示例#17
0
void SmallObjAllocator::Deallocate( void * p, std::size_t numBytes )
{
    if ( NULL == p ) return;
    if ( numBytes > GetMaxObjectSize() )
    {
        DefaultDeallocator( p );
        return;
    }
    assert( NULL != pool_ );
    if ( 0 == numBytes ) numBytes = 1;
    const std::size_t index = GetOffset( numBytes, GetAlignment() ) - 1;
    const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() );
    assert( index < allocCount );
    FixedAllocator & allocator = pool_[ index ];
    assert( allocator.BlockSize() >= numBytes );
    assert( allocator.BlockSize() < numBytes + GetAlignment() );
    const bool found = allocator.Deallocate( p, true );
    assert( found );
}
void OpExtensionsDevToolsToolbar::ToggleVisibility()
{
	if (GetAlignment() == ALIGNMENT_OFF)
	{
		Show();
	}
	else
	{
		Hide();
	}

}
示例#19
0
	// Returns the alignment (in bytes) of the specified type.
	static int GetAlignment(const Type* type, const TargetInfo* target = nullptr) {
		if(auto intType = type->As<IntegerType>()) {
			return target->GetAlignment(intType->GetSubtype());
		}
		else if(auto floatType = type->As<FloatingType>()) {
			return target->GetAlignment(floatType->GetSubtype());
		}
		else if(auto pointerType = type->As<PointerType>()) {
            DebugValidator::IsNotNull(target);
			return target->GetPointerAlignment();
		}
		else if(auto arrayType = type->As<ArrayType>()) {
			// The alignment of an array is the alignment of its element type.
			return GetAlignment(arrayType->ElementType(), target);
		}
		else if(auto recordType = type->As<RecordType>()) {
			// If the record has no members then we use the minimum allowed alignment.
			if(recordType->FieldCount() == 0) {
				return 0;
			}

			// The alignment of a record is the alignment of its largest field.
			int max = -1;
			const Type* maxType;
			auto& fields = recordType->Fields();

			for(int i = 0; i < fields.Count(); i++) {
				int size = GetSize(fields[i].FieldType, target);

				if(size > max) {
					max = size;
					maxType = fields[i].FieldType;
				}
			}

			return GetAlignment(maxType, target);
		}
		
		return 0;
	}
示例#20
0
wxString SectionFieldDescriptor::Format(wxString& value)
{
    if ( value.Length() > GetSize() ) {
        return value.Truncate(GetSize());
    } else {
        wxString addon(GetFiller(), GetSize() - value.Length());
        if ( GetAlignment() == FA_LEFT ) {
            return value + addon;
        } else {
            return addon + value;
        }
    }
}
示例#21
0
void
HtmlText::OnPaint(wxPaintEvent & evt)
{
    wxPaintDC dc(this);
    wxHtmlRenderingInfo info;
    // Vertical align
    // Horizontal align is taken care of in LayoutCell()
    int y = m_padding;
    int align = GetAlignment();
    if (align & wxALIGN_CENTER_VERTICAL)
        y = (GetClientSize().y - m_cell->GetHeight()) / 2;
    else if (align & wxALIGN_BOTTOM)
        y = GetClientSize().y - m_padding - m_cell->GetHeight();
    // Draw the cell
    m_cell->Draw(dc, m_padding, y, 0, INT_MAX, info);
}
示例#22
0
status_t
BTextControl::Archive(BMessage *data, bool deep) const
{
	BView::Archive(data, deep);

	alignment labelAlignment, textAlignment;

	GetAlignment(&labelAlignment, &textAlignment);

	data->AddInt32("_a_label", labelAlignment);
	data->AddInt32("_a_text", textAlignment);
	data->AddFloat("_divide", Divider());

	if (ModificationMessage())
		data->AddMessage("_mod_msg", ModificationMessage());

	return B_OK;
}
示例#23
0
bool SmallObjAllocator::TrimExcessMemory( void )
{
    bool found = false;
    const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() );
    std::size_t i = 0;
    for ( ; i < allocCount; ++i )
    {
        if ( pool_[ i ].TrimEmptyChunk() )
            found = true;
    }
    for ( i = 0; i < allocCount; ++i )
    {
        if ( pool_[ i ].TrimChunkList() )
            found = true;
    }

    return found;
}
示例#24
0
void CXFA_FFTextEdit::UpdateWidgetProperty() {
  CFWL_Edit* pWidget = ToEdit(m_pNormalWidget.get());
  if (!pWidget)
    return;

  uint32_t dwStyle = 0;
  uint32_t dwExtendedStyle =
      FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar;
  dwExtendedStyle |= UpdateUIProperty();
  if (m_pNode->IsMultiLine()) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn;
    if (!m_pNode->IsVerticalScrollPolicyOff()) {
      dwStyle |= FWL_WGTSTYLE_VScroll;
      dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll;
    }
  } else if (!m_pNode->IsHorizontalScrollPolicyOff()) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
  }
  if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
    dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
  }

  XFA_Element eType;
  int32_t iMaxChars;
  std::tie(eType, iMaxChars) = m_pNode->GetMaxChars();
  if (eType == XFA_Element::ExData)
    iMaxChars = 0;

  Optional<int32_t> numCells = m_pNode->GetNumberOfCells();
  if (!numCells) {
    pWidget->SetLimit(iMaxChars);
  } else if (*numCells == 0) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
    pWidget->SetLimit(iMaxChars > 0 ? iMaxChars : 1);
  } else {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
    pWidget->SetLimit(*numCells);
  }

  dwExtendedStyle |= GetAlignment();
  m_pNormalWidget->ModifyStyles(dwStyle, 0xFFFFFFFF);
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
}
示例#25
0
void CXFA_FFTextEdit::UpdateWidgetProperty() {
  CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget;
  if (!pWidget) {
    return;
  }
  uint32_t dwStyle = 0;
  uint32_t dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus |
                             FWL_STYLEEXT_EDT_OuterScrollbar |
                             FWL_STYLEEXT_EDT_LastLineHeight;
  dwExtendedStyle |= UpdateUIProperty();
  if (m_pDataAcc->IsMultiLine()) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn;
    if (m_pDataAcc->GetVerticalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
      dwStyle |= FWL_WGTSTYLE_VScroll;
      dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll;
    }
  } else if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
  }
  if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
      !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
    dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
  }
  XFA_Element eType = XFA_Element::Unknown;
  int32_t iMaxChars = m_pDataAcc->GetMaxChars(eType);
  if (eType == XFA_Element::ExData) {
    iMaxChars = 0;
  }
  int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
  if (iNumCells == 0) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
    pWidget->SetLimit(iMaxChars > 0 ? iMaxChars : 1);
  } else if (iNumCells > 0) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
    pWidget->SetLimit(iNumCells);
  } else {
    pWidget->SetLimit(iMaxChars);
  }
  dwExtendedStyle |= GetAlignment();
  m_pNormalWidget->ModifyStyles(dwStyle, 0xFFFFFFFF);
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
}
示例#26
0
// Equality test
bool wxTextAttr::operator== (const wxTextAttr& attr) const
{
    return  GetFlags() == attr.GetFlags() &&

            (!HasTextColour() || (GetTextColour() == attr.GetTextColour())) &&
            (!HasBackgroundColour() || (GetBackgroundColour() == attr.GetBackgroundColour())) &&

            (!HasAlignment() || (GetAlignment() == attr.GetAlignment())) &&
            (!HasLeftIndent() || (GetLeftIndent() == attr.GetLeftIndent() &&
                                  GetLeftSubIndent() == attr.GetLeftSubIndent())) &&
            (!HasRightIndent() || (GetRightIndent() == attr.GetRightIndent())) &&
            (!HasTabs() || (TabsEq(GetTabs(), attr.GetTabs()))) &&

            (!HasParagraphSpacingAfter() || (GetParagraphSpacingAfter() == attr.GetParagraphSpacingAfter())) &&
            (!HasParagraphSpacingBefore() || (GetParagraphSpacingBefore() == attr.GetParagraphSpacingBefore())) &&
            (!HasLineSpacing() || (GetLineSpacing() == attr.GetLineSpacing())) &&
            (!HasCharacterStyleName() || (GetCharacterStyleName() == attr.GetCharacterStyleName())) &&
            (!HasParagraphStyleName() || (GetParagraphStyleName() == attr.GetParagraphStyleName())) &&
            (!HasListStyleName() || (GetListStyleName() == attr.GetListStyleName())) &&

            (!HasBulletStyle() || (GetBulletStyle() == attr.GetBulletStyle())) &&
            (!HasBulletText() || (GetBulletText() == attr.GetBulletText())) &&
            (!HasBulletNumber() || (GetBulletNumber() == attr.GetBulletNumber())) &&
            (GetBulletFont() == attr.GetBulletFont()) &&
            (!HasBulletName() || (GetBulletName() == attr.GetBulletName())) &&

            (!HasTextEffects() || (GetTextEffects() == attr.GetTextEffects() &&
                                   GetTextEffectFlags() == attr.GetTextEffectFlags())) &&

            (!HasOutlineLevel() || (GetOutlineLevel() == attr.GetOutlineLevel())) &&

            (!HasFontSize() || (GetFontSize() == attr.GetFontSize())) &&
            (!HasFontItalic() || (GetFontStyle() == attr.GetFontStyle())) &&
            (!HasFontWeight() || (GetFontWeight() == attr.GetFontWeight())) &&
            (!HasFontUnderlined() || (GetFontUnderlined() == attr.GetFontUnderlined())) &&
            (!HasFontStrikethrough() || (GetFontStrikethrough() == attr.GetFontStrikethrough())) &&
            (!HasFontFaceName() || (GetFontFaceName() == attr.GetFontFaceName())) &&
            (!HasFontEncoding() || (GetFontEncoding() == attr.GetFontEncoding())) &&
            (!HasFontFamily() || (GetFontFamily() == attr.GetFontFamily())) &&

            (!HasURL() || (GetURL() == attr.GetURL()));
}
示例#27
0
status_t
BTextControl::Archive(BMessage *data, bool deep) const
{
	BArchiver archiver(data);
	status_t ret = BControl::Archive(data, deep);
	alignment labelAlignment, textAlignment;

	GetAlignment(&labelAlignment, &textAlignment);

	if (ret == B_OK)
		ret = data->AddInt32("_a_label", labelAlignment);
	if (ret == B_OK)
		ret = data->AddInt32("_a_text", textAlignment);
	if (ret == B_OK)
		ret = data->AddFloat("_divide", Divider());

	if (ModificationMessage() && (ret == B_OK))
		ret = data->AddMessage("_mod_msg", ModificationMessage());

	return archiver.Finish(ret);
}
示例#28
0
bool CXFA_FFListBox::LoadWidget() {
  CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp());
  pListBox->Initialize();
  pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground,
                         0xFFFFFFFF);
  m_pNormalWidget = (CFWL_Widget*)pListBox;
  m_pNormalWidget->SetLayoutItem(this);

  IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
  CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
  pNoteDriver->RegisterEventTarget(pWidget, pWidget);

  m_pOldDelegate = m_pNormalWidget->GetDelegate();
  m_pNormalWidget->SetDelegate(this);
  m_pNormalWidget->LockUpdate();

  CFX_WideStringArray wsLabelArray;
  m_pDataAcc->GetChoiceListItems(wsLabelArray, false);
  int32_t iItems = wsLabelArray.GetSize();
  for (int32_t i = 0; i < iItems; i++) {
    pListBox->AddString(wsLabelArray[i].AsStringC());
  }
  uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
  if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
    dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
  }
  dwExtendedStyle |= GetAlignment();
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
  CFX_Int32Array iSelArray;
  m_pDataAcc->GetSelectedItems(iSelArray);
  int32_t iSelCount = iSelArray.GetSize();
  for (int32_t j = 0; j < iSelCount; j++) {
    CFWL_ListItem* item = pListBox->GetItem(iSelArray[j]);
    pListBox->SetSelItem(item, true);
  }
  m_pNormalWidget->UnlockUpdate();
  return CXFA_FFField::LoadWidget();
}
示例#29
0
void CXFA_FFPasswordEdit::UpdateWidgetProperty() {
  CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget;
  if (!pWidget) {
    return;
  }
  uint32_t dwExtendedStyle =
      FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
      FWL_STYLEEXT_EDT_Password | FWL_STYLEEXT_EDT_LastLineHeight;
  dwExtendedStyle |= UpdateUIProperty();
  CFX_WideString wsPassWord;
  m_pDataAcc->GetPasswordChar(wsPassWord);
  if (!wsPassWord.IsEmpty()) {
    pWidget->SetAliasChar(wsPassWord.GetAt(0));
  }
  if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
  }
  if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
      !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
    dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
  }
  dwExtendedStyle |= GetAlignment();
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
}
示例#30
0
void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
  CFWL_DateTimePicker* pWidget = (CFWL_DateTimePicker*)m_pNormalWidget;
  if (!pWidget) {
    return;
  }
  uint32_t dwExtendedStyle = FWL_STYLEEXT_DTP_ShortDateFormat;
  dwExtendedStyle |= UpdateUIProperty();
  dwExtendedStyle |= GetAlignment();
  m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
  uint32_t dwEditStyles = FWL_STYLEEXT_EDT_LastLineHeight;
  int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
  if (iNumCells > 0) {
    dwEditStyles |= FWL_STYLEEXT_EDT_CombText;
    pWidget->SetEditLimit(iNumCells);
  }
  if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
      !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
    dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
  }
  if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
    dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
  }
  pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF);
}