void STFSliders::OnRangeUpdated( range_event_handler f, Control& c ) { if ( f == 0 || c.IsNull() ) { onRangeUpdated = 0; onRangeUpdatedReceiver = 0; } else { onRangeUpdated = f; onRangeUpdatedReceiver = &c; } }
void FontComboBox::OnFontHighlighted( font_event_handler f, Control& c ) { if ( f == 0 || c.IsNull() ) { onFontHighlighted = 0; onFontHighlightedReceiver = 0; } else { onFontHighlighted = f; onFontHighlightedReceiver = &c; } }
void NumericEdit::OnValueUpdated( value_event_handler f, Control& c ) { __PCL_NO_ALIAS_HANDLER; if ( f == 0 || c.IsNull() ) { onValueUpdated = 0; onValueUpdatedReceiver = 0; } else { onValueUpdated = f; onValueUpdatedReceiver = &c; } }
void NumericEdit::OnValueUpdated( value_event_handler f, Control& c ) { if ( f == nullptr || c.IsNull() ) { if ( !m_handlers.IsNull() ) { m_handlers->onValueUpdated = nullptr; m_handlers->onValueUpdatedReceiver = nullptr; } } else { INIT_EVENT_HANDLERS(); m_handlers->onValueUpdated = f; m_handlers->onValueUpdatedReceiver = &c; } }
void SectionBar::OnCheck( check_event_handler f, Control& c ) { if ( Title_CheckBox.IsNull() || f == nullptr || c.IsNull() ) { if ( !m_handlers.IsNull() ) { m_handlers->onCheck = nullptr; m_handlers->onCheckReceiver = nullptr; } } else { INIT_EVENT_HANDLERS(); m_handlers->onCheck = f; m_handlers->onCheckReceiver = &c; } }
void SectionBar::OnToggleSection( section_event_handler f, Control& c ) { if ( f == nullptr || c.IsNull() ) { if ( !m_handlers.IsNull() ) { m_handlers->onToggleSection = nullptr; m_handlers->onToggleSectionReceiver = nullptr; } } else { INIT_EVENT_HANDLERS(); m_handlers->onToggleSection = f; m_handlers->onToggleSectionReceiver = &c; } }
void SectionBar::SetSection( Control& section ) { if ( m_section != nullptr ) { m_section->OnShow( nullptr, Control::Null() ); m_section->OnHide( nullptr, Control::Null() ); m_section = nullptr; } if ( section.IsNull() ) return; m_section = §ion; m_section->OnShow( (Control::event_handler)&SectionBar::ControlShow, *this ); m_section->OnHide( (Control::event_handler)&SectionBar::ControlHide, *this ); Title_ToolButton.SetIcon( Bitmap( ScaledResource( m_section->IsVisible() ? contract_icon : expand_icon ) ) ); }
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 ); } }