| 142 | } |
| 143 | |
| 144 | void Viewport::SetHorizontalAdjustment( Adjustment::Ptr horizontal_adjustment ) { |
| 145 | if( m_horizontal_adjustment ) { |
| 146 | m_horizontal_adjustment->GetSignal( Adjustment::OnChange ).Disconnect( m_horizontal_adjustment_signal_serial ); |
| 147 | } |
| 148 | |
| 149 | m_horizontal_adjustment = horizontal_adjustment; |
| 150 | |
| 151 | auto weak_this = std::weak_ptr<Widget>( shared_from_this() ); |
| 152 | |
| 153 | m_horizontal_adjustment_signal_serial = m_horizontal_adjustment->GetSignal( Adjustment::OnChange ).Connect( [weak_this] { |
| 154 | auto shared_this = weak_this.lock(); |
| 155 | |
| 156 | if( !shared_this ) { |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | auto viewport = std::dynamic_pointer_cast<Viewport>( shared_this ); |
| 161 | |
| 162 | if( !viewport ) { |
| 163 | return; |
| 164 | } |
| 165 | |
| 166 | viewport->UpdateView(); |
| 167 | } ); |
| 168 | } |
| 169 | |
| 170 | Adjustment::Ptr Viewport::GetVerticalAdjustment() const { |
| 171 | return m_vertical_adjustment; |
no test coverage detected