mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	GLabel: Paint the text with a disabled look when appropriate.
Also turn on right-side text elision in all cases by default.
This commit is contained in:
		
							parent
							
								
									b0ccd04a9c
								
							
						
					
					
						commit
						ac7e02d984
					
				
					 1 changed files with 14 additions and 8 deletions
				
			
		|  | @ -45,14 +45,20 @@ void GLabel::paint_event(GPaintEvent& event) | |||
|             painter.blit(icon_location, *m_icon, m_icon->rect()); | ||||
|         } | ||||
|     } | ||||
|     if (!text().is_empty()) { | ||||
|         int indent = 0; | ||||
|         if (frame_thickness() > 0) | ||||
|             indent = font().glyph_width('x') / 2; | ||||
|         auto text_rect = frame_inner_rect(); | ||||
|         text_rect.move_by(indent, 0); | ||||
|         text_rect.set_width(text_rect.width() - indent * 2); | ||||
|         painter.draw_text(text_rect, text(), m_text_alignment, foreground_color()); | ||||
|     if (text().is_empty()) | ||||
|         return; | ||||
|     int indent = 0; | ||||
|     if (frame_thickness() > 0) | ||||
|         indent = font().glyph_width('x') / 2; | ||||
|     auto text_rect = frame_inner_rect(); | ||||
|     text_rect.move_by(indent, 0); | ||||
|     text_rect.set_width(text_rect.width() - indent * 2); | ||||
| 
 | ||||
|     if (is_enabled()) { | ||||
|         painter.draw_text(text_rect, text(), m_text_alignment, foreground_color(), TextElision::Right); | ||||
|     } else { | ||||
|         painter.draw_text(text_rect.translated(1, 1), text(), font(), text_alignment(), Color::White, TextElision::Right); | ||||
|         painter.draw_text(text_rect, text(), font(), text_alignment(), Color::from_rgb(0x808080), TextElision::Right); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling