mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
LibGUI: Rename Link => LinkLabel
This commit is contained in:
parent
788594c0c2
commit
5452c8a566
4 changed files with 15 additions and 14 deletions
|
@ -32,7 +32,7 @@
|
|||
#include <LibGUI/CheckBox.h>
|
||||
#include <LibGUI/FileIconProvider.h>
|
||||
#include <LibGUI/FilePicker.h>
|
||||
#include <LibGUI/Link.h>
|
||||
#include <LibGUI/LinkLabel.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/TabWidget.h>
|
||||
#include <grp.h>
|
||||
|
@ -288,7 +288,7 @@ void PropertiesDialog::make_property_value_pairs(const Vector<PropertyValuePair>
|
|||
if (!pair.link.has_value()) {
|
||||
label_container.add<GUI::Label>(pair.value).set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
} else {
|
||||
auto& link = label_container.add<GUI::Link>(pair.value);
|
||||
auto& link = label_container.add<GUI::LinkLabel>(pair.value);
|
||||
link.set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
link.on_click = [pair]() {
|
||||
Desktop::Launcher::open(pair.link.value());
|
||||
|
|
|
@ -46,7 +46,7 @@ set(SOURCES
|
|||
Label.cpp
|
||||
Layout.cpp
|
||||
LazyWidget.cpp
|
||||
Link.cpp
|
||||
LinkLabel.cpp
|
||||
ListView.cpp
|
||||
Menu.cpp
|
||||
MenuBar.cpp
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <LibCore/Event.h>
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibGUI/Link.h>
|
||||
#include <LibGUI/LinkLabel.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
@ -35,20 +35,20 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
Link::Link(const StringView& text)
|
||||
LinkLabel::LinkLabel(const StringView& text)
|
||||
: Label(text)
|
||||
{
|
||||
set_foreground_role(Gfx::ColorRole::Link);
|
||||
}
|
||||
|
||||
void Link::mousedown_event(MouseEvent&)
|
||||
void LinkLabel::mousedown_event(MouseEvent&)
|
||||
{
|
||||
if (on_click) {
|
||||
on_click();
|
||||
}
|
||||
}
|
||||
|
||||
void Link::paint_event(PaintEvent& event)
|
||||
void LinkLabel::paint_event(PaintEvent& event)
|
||||
{
|
||||
Label::paint_event(event);
|
||||
GUI::Painter painter(*this);
|
||||
|
@ -58,26 +58,26 @@ void Link::paint_event(PaintEvent& event)
|
|||
Widget::palette().link());
|
||||
}
|
||||
|
||||
void Link::enter_event(Core::Event&)
|
||||
void LinkLabel::enter_event(Core::Event&)
|
||||
{
|
||||
m_hovered = true;
|
||||
update();
|
||||
}
|
||||
|
||||
void Link::leave_event(Core::Event&)
|
||||
void LinkLabel::leave_event(Core::Event&)
|
||||
{
|
||||
m_hovered = false;
|
||||
update();
|
||||
}
|
||||
|
||||
void Link::second_paint_event(PaintEvent&)
|
||||
void LinkLabel::second_paint_event(PaintEvent&)
|
||||
{
|
||||
if (window()->width() < font().width(text())) {
|
||||
set_tooltip(text());
|
||||
}
|
||||
}
|
||||
|
||||
void Link::resize_event(ResizeEvent&)
|
||||
void LinkLabel::resize_event(ResizeEvent&)
|
||||
{
|
||||
if (window()->width() < font().width(text())) {
|
||||
set_tooltip(text());
|
|
@ -30,10 +30,11 @@
|
|||
#include <LibGUI/Label.h>
|
||||
|
||||
namespace GUI {
|
||||
class Link : public Label {
|
||||
C_OBJECT(Link)
|
||||
class LinkLabel : public Label {
|
||||
C_OBJECT(LinkLabel);
|
||||
|
||||
public:
|
||||
Link(const StringView&);
|
||||
LinkLabel(const StringView&);
|
||||
Function<void()> on_click;
|
||||
|
||||
private:
|
Loading…
Add table
Add a link
Reference in a new issue