1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:37:34 +00:00

LibGUI: Tweak FontPicker layout

Make everything a bit smaller and hide the horizontal scrollbars in the
list views since we don't really need them.
This commit is contained in:
Andreas Kling 2020-12-30 21:01:09 +01:00
parent b4d1390714
commit a68275914e
2 changed files with 12 additions and 2 deletions

View file

@ -30,6 +30,7 @@
#include <LibGUI/ItemListModel.h> #include <LibGUI/ItemListModel.h>
#include <LibGUI/Label.h> #include <LibGUI/Label.h>
#include <LibGUI/ListView.h> #include <LibGUI/ListView.h>
#include <LibGUI/ScrollBar.h>
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGfx/FontDatabase.h> #include <LibGfx/FontDatabase.h>
@ -40,7 +41,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo
, m_fixed_width_only(fixed_width_only) , m_fixed_width_only(fixed_width_only)
{ {
set_title("Font picker"); set_title("Font picker");
resize(540, 300); resize(430, 280);
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png")); set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"));
auto& widget = set_main_widget<GUI::Widget>(); auto& widget = set_main_widget<GUI::Widget>();
@ -50,6 +51,11 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo
m_family_list_view = static_cast<ListView&>(*widget.find_descendant_by_name("family_list_view")); m_family_list_view = static_cast<ListView&>(*widget.find_descendant_by_name("family_list_view"));
m_weight_list_view = static_cast<ListView&>(*widget.find_descendant_by_name("weight_list_view")); m_weight_list_view = static_cast<ListView&>(*widget.find_descendant_by_name("weight_list_view"));
m_size_list_view = static_cast<ListView&>(*widget.find_descendant_by_name("size_list_view")); m_size_list_view = static_cast<ListView&>(*widget.find_descendant_by_name("size_list_view"));
m_family_list_view->horizontal_scrollbar().set_visible(false);
m_weight_list_view->horizontal_scrollbar().set_visible(false);
m_size_list_view->horizontal_scrollbar().set_visible(false);
m_sample_text_label = static_cast<Label&>(*widget.find_descendant_by_name("sample_text_label")); m_sample_text_label = static_cast<Label&>(*widget.find_descendant_by_name("sample_text_label"));
HashTable<String> families; HashTable<String> families;

View file

@ -25,6 +25,8 @@
} }
@GUI::Widget { @GUI::Widget {
fixed_width: 100
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
} }
@ -40,6 +42,8 @@
} }
@GUI::Widget { @GUI::Widget {
fixed_width: 80
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
} }
@ -60,7 +64,7 @@
} }
title: "Sample text" title: "Sample text"
fixed_height: 100 fixed_height: 80
@GUI::Label { @GUI::Label {
name: "sample_text_label" name: "sample_text_label"