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/CheckBox.h>
|
||||||
#include <LibGUI/FileIconProvider.h>
|
#include <LibGUI/FileIconProvider.h>
|
||||||
#include <LibGUI/FilePicker.h>
|
#include <LibGUI/FilePicker.h>
|
||||||
#include <LibGUI/Link.h>
|
#include <LibGUI/LinkLabel.h>
|
||||||
#include <LibGUI/MessageBox.h>
|
#include <LibGUI/MessageBox.h>
|
||||||
#include <LibGUI/TabWidget.h>
|
#include <LibGUI/TabWidget.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
@ -288,7 +288,7 @@ void PropertiesDialog::make_property_value_pairs(const Vector<PropertyValuePair>
|
||||||
if (!pair.link.has_value()) {
|
if (!pair.link.has_value()) {
|
||||||
label_container.add<GUI::Label>(pair.value).set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
label_container.add<GUI::Label>(pair.value).set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||||
} else {
|
} 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.set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||||
link.on_click = [pair]() {
|
link.on_click = [pair]() {
|
||||||
Desktop::Launcher::open(pair.link.value());
|
Desktop::Launcher::open(pair.link.value());
|
||||||
|
|
|
@ -46,7 +46,7 @@ set(SOURCES
|
||||||
Label.cpp
|
Label.cpp
|
||||||
Layout.cpp
|
Layout.cpp
|
||||||
LazyWidget.cpp
|
LazyWidget.cpp
|
||||||
Link.cpp
|
LinkLabel.cpp
|
||||||
ListView.cpp
|
ListView.cpp
|
||||||
Menu.cpp
|
Menu.cpp
|
||||||
MenuBar.cpp
|
MenuBar.cpp
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <LibCore/Event.h>
|
#include <LibCore/Event.h>
|
||||||
#include <LibGUI/Event.h>
|
#include <LibGUI/Event.h>
|
||||||
#include <LibGUI/Link.h>
|
#include <LibGUI/LinkLabel.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
|
@ -35,20 +35,20 @@
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
Link::Link(const StringView& text)
|
LinkLabel::LinkLabel(const StringView& text)
|
||||||
: Label(text)
|
: Label(text)
|
||||||
{
|
{
|
||||||
set_foreground_role(Gfx::ColorRole::Link);
|
set_foreground_role(Gfx::ColorRole::Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Link::mousedown_event(MouseEvent&)
|
void LinkLabel::mousedown_event(MouseEvent&)
|
||||||
{
|
{
|
||||||
if (on_click) {
|
if (on_click) {
|
||||||
on_click();
|
on_click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Link::paint_event(PaintEvent& event)
|
void LinkLabel::paint_event(PaintEvent& event)
|
||||||
{
|
{
|
||||||
Label::paint_event(event);
|
Label::paint_event(event);
|
||||||
GUI::Painter painter(*this);
|
GUI::Painter painter(*this);
|
||||||
|
@ -58,26 +58,26 @@ void Link::paint_event(PaintEvent& event)
|
||||||
Widget::palette().link());
|
Widget::palette().link());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Link::enter_event(Core::Event&)
|
void LinkLabel::enter_event(Core::Event&)
|
||||||
{
|
{
|
||||||
m_hovered = true;
|
m_hovered = true;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Link::leave_event(Core::Event&)
|
void LinkLabel::leave_event(Core::Event&)
|
||||||
{
|
{
|
||||||
m_hovered = false;
|
m_hovered = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Link::second_paint_event(PaintEvent&)
|
void LinkLabel::second_paint_event(PaintEvent&)
|
||||||
{
|
{
|
||||||
if (window()->width() < font().width(text())) {
|
if (window()->width() < font().width(text())) {
|
||||||
set_tooltip(text());
|
set_tooltip(text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Link::resize_event(ResizeEvent&)
|
void LinkLabel::resize_event(ResizeEvent&)
|
||||||
{
|
{
|
||||||
if (window()->width() < font().width(text())) {
|
if (window()->width() < font().width(text())) {
|
||||||
set_tooltip(text());
|
set_tooltip(text());
|
|
@ -30,10 +30,11 @@
|
||||||
#include <LibGUI/Label.h>
|
#include <LibGUI/Label.h>
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
class Link : public Label {
|
class LinkLabel : public Label {
|
||||||
C_OBJECT(Link)
|
C_OBJECT(LinkLabel);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Link(const StringView&);
|
LinkLabel(const StringView&);
|
||||||
Function<void()> on_click;
|
Function<void()> on_click;
|
||||||
|
|
||||||
private:
|
private:
|
Loading…
Add table
Add a link
Reference in a new issue