mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:42:44 +00:00 
			
		
		
		
	 18d344609f
			
		
	
	
		18d344609f
		
	
	
	
	
		
			
			This widget provides a scrollable view onto another (child) widget. If the child is larger than the parent, scrollbars are provided for panning around the child.
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			758 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			758 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibGUI/AbstractScrollableWidget.h>
 | |
| 
 | |
| namespace GUI {
 | |
| 
 | |
| class ScrollableContainerWidget : public GUI::AbstractScrollableWidget {
 | |
|     C_OBJECT(ScrollableContainerWidget);
 | |
| 
 | |
| public:
 | |
|     virtual ~ScrollableContainerWidget();
 | |
| 
 | |
|     void set_widget(GUI::Widget*);
 | |
|     GUI::Widget* widget() { return m_widget; }
 | |
|     GUI::Widget const* widget() const { return m_widget; }
 | |
| 
 | |
| protected:
 | |
|     virtual void did_scroll() override;
 | |
|     virtual void resize_event(GUI::ResizeEvent&) override;
 | |
| 
 | |
| private:
 | |
|     void update_widget_size();
 | |
|     void update_widget_position();
 | |
| 
 | |
|     ScrollableContainerWidget();
 | |
| 
 | |
|     RefPtr<GUI::Widget> m_widget;
 | |
| };
 | |
| 
 | |
| }
 |