mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:32:44 +00:00 
			
		
		
		
	 41ef4f11dc
			
		
	
	
		41ef4f11dc
		
	
	
	
	
		
			
			This commit introduces a couple of connected changes that are hard to untangle, unfortunately: - Parse GML into the AST instead of JSON - Change the load_from_json API on Widget to load_from_gml_ast - Remove this same API from Core::Object as it isn't used outside of LibGUI and was a workaround for the object registration detection; by verifying the objects we're getting and casting we can remove this constraint. - Format GML by calling the formating APIs on the AST itself; remove GMLFormatter.cpp as it's not needed anymore. After this change, GML formatting already respects comments :^)
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			905 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			905 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();
 | |
|     virtual bool load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) override;
 | |
| 
 | |
|     ScrollableContainerWidget();
 | |
| 
 | |
|     RefPtr<GUI::Widget> m_widget;
 | |
| };
 | |
| 
 | |
| }
 |