mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:02:45 +00:00 
			
		
		
		
	 1682f0b760
			
		
	
	
		1682f0b760
		
	
	
	
	
		
			
			SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
		
			
				
	
	
		
			45 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibGUI/Painter.h>
 | |
| #include <LibGUI/SeparatorWidget.h>
 | |
| #include <LibGfx/Palette.h>
 | |
| 
 | |
| REGISTER_WIDGET(GUI, HorizontalSeparator)
 | |
| REGISTER_WIDGET(GUI, VerticalSeparator)
 | |
| 
 | |
| namespace GUI {
 | |
| 
 | |
| SeparatorWidget::SeparatorWidget(Gfx::Orientation orientation)
 | |
|     : m_orientation(orientation)
 | |
| {
 | |
|     if (m_orientation == Gfx::Orientation::Vertical)
 | |
|         set_fixed_width(8);
 | |
|     else
 | |
|         set_fixed_height(8);
 | |
| }
 | |
| 
 | |
| SeparatorWidget::~SeparatorWidget()
 | |
| {
 | |
| }
 | |
| 
 | |
| void SeparatorWidget::paint_event(PaintEvent& event)
 | |
| {
 | |
|     Painter painter(*this);
 | |
|     painter.add_clip_rect(event.rect());
 | |
| 
 | |
|     if (m_orientation == Gfx::Orientation::Vertical) {
 | |
|         painter.translate(rect().center().x() - 1, 0);
 | |
|         painter.draw_line({ 0, 0 }, { 0, rect().bottom() }, palette().threed_shadow1());
 | |
|         painter.draw_line({ 1, 0 }, { 1, rect().bottom() }, palette().threed_highlight());
 | |
|     } else {
 | |
|         painter.translate(0, rect().center().y() - 1);
 | |
|         painter.draw_line({ 0, 0 }, { rect().right(), 0 }, palette().threed_shadow1());
 | |
|         painter.draw_line({ 0, 1 }, { rect().right(), 1 }, palette().threed_highlight());
 | |
|     }
 | |
| }
 | |
| 
 | |
| }
 |