本文整理汇总了C++中Control::IsFixedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Control::IsFixedWidth方法的具体用法?C++ Control::IsFixedWidth怎么用?C++ Control::IsFixedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control::IsFixedWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ButtonClick
void SectionBar::ButtonClick( Button& sender, bool checked )
{
if ( m_section != nullptr && sender == Title_ToolButton )
{
if ( !m_handlers.IsNull() )
if ( m_handlers->onToggleSection != nullptr )
(m_handlers->onToggleSectionReceiver->*m_handlers->onToggleSection)( *this, *m_section, true );
bool visible = m_section->IsVisible();
Control* p = &m_section->Parent();
if ( !p->IsNull() )
{
while ( !p->Parent().IsNull() )
p = &p->Parent();
p->DisableUpdates();
}
if ( visible )
m_section->Hide();
else
m_section->Show();
// On OS X, forcing event processing here causes a lot of flickering.
// On X11 and Windows, it's just the opposite...
#ifndef __PCL_MACOSX
Module->ProcessEvents();
#endif
if ( !p->IsNull() )
{
bool fixedWidth = p->IsFixedWidth();
if ( !fixedWidth )
p->SetFixedWidth();
bool fixedHeight = p->IsFixedHeight();
if ( fixedHeight )
p->SetVariableHeight();
p->AdjustToContents();
Module->ProcessEvents();
if ( !fixedWidth )
p->SetVariableWidth();
if ( fixedHeight )
p->SetFixedHeight();
p->EnableUpdates();
}
if ( !m_handlers.IsNull() )
if ( m_handlers->onToggleSection != nullptr )
(m_handlers->onToggleSectionReceiver->*m_handlers->onToggleSection)( *this, *m_section, false );
}
else if ( !Title_CheckBox.IsNull() && sender == *Title_CheckBox )
{
if ( m_section != nullptr )
m_section->Enable( checked );
if ( !m_handlers.IsNull() )
if ( m_handlers->onCheck != nullptr )
(m_handlers->onCheckReceiver->*m_handlers->onCheck)( *this, checked );
}
}
示例2: Realize
void Container::Realize(Container* parent)
{
if ( IsRealized() )
{
for ( V_Control::iterator itr = m_Controls.begin(), end = m_Controls.end(); itr != end; ++itr )
{
(*itr)->Realize( this );
}
return;
}
if ( m_Window == NULL )
{
INSPECT_SCOPE_TIMER( ( "" ) );
m_Window = new wxPanel( parent->GetWindow(), wxID_ANY );
}
if ( m_Window->GetSizer() == NULL )
{
m_Window->SetSizer( new wxBoxSizer( wxHORIZONTAL ) );
wxSizer* sizer = m_Window->GetSizer();
V_Sizer sizerList;
std::vector< i32 > proportionList;
int proportionMultiplier = 1000;
int remainingProportion = proportionMultiplier;
int numRemainingProportions = 0;
wxSizer* unboundedProportionSizer = NULL;
V_Control::const_iterator itr = m_Controls.begin();
V_Control::const_iterator end = m_Controls.end();
for( ; itr != end; ++itr )
{
Control* c = *itr;
c->Realize( this );
if ( c->GetProportionalWidth() > 0.0f )
{
int proportion = (int) ( c->GetProportionalWidth() * (f32) proportionMultiplier );
remainingProportion -= proportion;
sizerList.push_back( new wxBoxSizer( wxHORIZONTAL ) );
proportionList.push_back( proportion );
unboundedProportionSizer = NULL;
}
else
{
if ( unboundedProportionSizer == NULL )
{
unboundedProportionSizer = new wxBoxSizer( wxHORIZONTAL );
++numRemainingProportions;
}
sizerList.push_back( unboundedProportionSizer );
proportionList.push_back( -1 );
}
}
if ( numRemainingProportions > 1 )
{
remainingProportion = (int) ( (f32) remainingProportion / (f32) numRemainingProportions + 0.5f );
}
int index = 0;
int spacing = GetCanvas()->GetPad();
itr = m_Controls.begin();
end = m_Controls.end();
for( ; itr != end; ++index, ++itr )
{
Control* c = *itr;
int proportion = proportionList[ index ];
wxSizer* currentSizer = sizerList[ index ];
if ( sizer->GetItem( currentSizer ) == NULL )
{
sizer->Add( currentSizer, proportion > 0 ? proportion : remainingProportion, wxEXPAND | wxTOP | wxBOTTOM, spacing );
}
int flags = wxALIGN_CENTER_VERTICAL;
proportion = 0;
if ( !c->IsFixedWidth() )
{
proportion = 1;
flags |= wxEXPAND;
}
currentSizer->Add( spacing, 0, 0 );
currentSizer->Add( c->GetWindow(), proportion, flags );
}
sizer->Add(spacing, 0, 0);
m_Window->Layout();
}
__super::Realize(parent);
}