mirror of
https://github.com/uowuo/abaddon.git
synced 2024-11-10 06:00:10 +00:00
add more css selectors
This commit is contained in:
parent
397702b6c9
commit
76cbaa377d
3
.gitignore
vendored
3
.gitignore
vendored
@ -351,3 +351,6 @@ MigrationBackup/
|
||||
|
||||
abaddon.ini
|
||||
testdata/
|
||||
|
||||
build/
|
||||
out/
|
||||
|
30
README.md
30
README.md
@ -26,3 +26,33 @@
|
||||
* [C++ Requests: Curl for People](https://github.com/whoshuu/cpr/)
|
||||
* [zlib](https://zlib.net/)
|
||||
* [simpleini](https://github.com/brofield/simpleini)
|
||||
|
||||
### Styling
|
||||
#### CSS selectors
|
||||
.channel-list - Container of the channel list
|
||||
.channel-row - All rows within the channel container
|
||||
.channel-row-channel - Only rows containing a channel
|
||||
.channel-row-category - Only rows containing a category
|
||||
.channel-row-guild - Only rows containing a guild
|
||||
.channel-row-label - All labels within the channel container
|
||||
|
||||
.messages - Container of user messages
|
||||
.message-container - The container which holds a user's messages
|
||||
.message-container-author - The author label for a message container
|
||||
.message-container-timestamp - The timestamp label for a message container
|
||||
.message-text - The TextView of a user message
|
||||
|
||||
.embed - Container for a message embed
|
||||
.embed-author - The author of an embed
|
||||
.embed-title - The title of an embed
|
||||
.embed-description - The description of an embed
|
||||
.embed-field-title - The title of an embed field
|
||||
.embed-field-value - The value of an embed field
|
||||
.embed-footer - The footer of an embed
|
||||
|
||||
.members - Container of the member list
|
||||
.members-row - All rows within the members container
|
||||
.members-row-label - All labels in the members container
|
||||
.members-row-member - Rows containing a member
|
||||
.members-row-role - Rows containing a role
|
||||
|
||||
|
@ -8,6 +8,8 @@ ChannelList::ChannelList() {
|
||||
m_main = Gtk::manage(new Gtk::ScrolledWindow);
|
||||
m_list = Gtk::manage(new Gtk::ListBox);
|
||||
|
||||
m_list->get_style_context()->add_class("channel-list");
|
||||
|
||||
m_guild_menu_up = Gtk::manage(new Gtk::MenuItem("Move _Up", true));
|
||||
m_guild_menu_up->signal_activate().connect(sigc::mem_fun(*this, &ChannelList::on_menu_move_up));
|
||||
m_guild_menu.append(*m_guild_menu_up);
|
||||
@ -96,6 +98,8 @@ void ChannelList::AddPrivateChannels() {
|
||||
parent_ev->add(*parent_box);
|
||||
parent_row->add(*parent_ev);
|
||||
parent_row->show_all();
|
||||
parent_row->get_style_context()->add_class("channel-row");
|
||||
parent_label->get_style_context()->add_class("channel-row-label");
|
||||
m_list->add(*parent_row);
|
||||
|
||||
ListItemInfo parent_info;
|
||||
@ -110,6 +114,10 @@ void ChannelList::AddPrivateChannels() {
|
||||
auto *dm_ev = Gtk::manage(new Gtk::EventBox);
|
||||
auto *dm_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
auto *dm_label = Gtk::manage(new Gtk::Label);
|
||||
|
||||
dm_row->get_style_context()->add_class("channel-row");
|
||||
dm_label->get_style_context()->add_class("channel-row-label");
|
||||
|
||||
if (data->Type == ChannelType::DM)
|
||||
dm_label->set_text(data->Recipients[0].Username);
|
||||
else
|
||||
@ -184,6 +192,11 @@ void ChannelList::SetListingFromGuildsInternal() {
|
||||
auto *channel_ev = Gtk::manage(new Gtk::EventBox);
|
||||
auto *channel_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
auto *channel_label = Gtk::manage(new Gtk::Label);
|
||||
|
||||
channel_row->get_style_context()->add_class("channel-row");
|
||||
channel_row->get_style_context()->add_class("channel-row-channel");
|
||||
channel_label->get_style_context()->add_class("channel-row-label");
|
||||
|
||||
channel_label->set_text("#" + channel.Name);
|
||||
channel_box->set_halign(Gtk::ALIGN_START);
|
||||
channel_box->pack_start(*channel_label);
|
||||
@ -208,6 +221,11 @@ void ChannelList::SetListingFromGuildsInternal() {
|
||||
auto *category_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
auto *category_label = Gtk::manage(new Gtk::Label);
|
||||
auto *category_arrow = Gtk::manage(new Gtk::Arrow(Gtk::ARROW_DOWN, Gtk::SHADOW_NONE));
|
||||
|
||||
category_row->get_style_context()->add_class("channel-row");
|
||||
category_row->get_style_context()->add_class("channel-row-category");
|
||||
category_label->get_style_context()->add_class("channel-row-label");
|
||||
|
||||
category_label->set_text(channel.Name);
|
||||
category_box->set_halign(Gtk::ALIGN_START);
|
||||
category_box->pack_start(*category_arrow);
|
||||
@ -247,6 +265,11 @@ void ChannelList::SetListingFromGuildsInternal() {
|
||||
auto *guild_ev = Gtk::manage(new Gtk::EventBox);
|
||||
auto *guild_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
auto *guild_label = Gtk::manage(new Gtk::Label);
|
||||
|
||||
guild_row->get_style_context()->add_class("channel-row");
|
||||
guild_row->get_style_context()->add_class("channel-row-guild");
|
||||
guild_label->get_style_context()->add_class("channel-row-label");
|
||||
|
||||
guild_label->set_markup("<b>" + Glib::Markup::escape_text(guild.Name) + "</b>");
|
||||
guild_box->set_halign(Gtk::ALIGN_START);
|
||||
guild_box->pack_start(*guild_label);
|
||||
|
@ -14,6 +14,10 @@ ChatMessageContainer::ChatMessageContainer(const MessageData *data) {
|
||||
m_author = Gtk::manage(new Gtk::Label);
|
||||
m_timestamp = Gtk::manage(new Gtk::Label);
|
||||
|
||||
get_style_context()->add_class("message-container");
|
||||
m_author->get_style_context()->add_class("message-container-author");
|
||||
m_timestamp->get_style_context()->add_class("message-container-timestamp");
|
||||
|
||||
m_author->set_markup("<span weight=\"bold\">" + Glib::Markup::escape_text(data->Author.Username) + "</span>");
|
||||
m_author->set_single_line_mode(true);
|
||||
m_author->set_line_wrap(false);
|
||||
@ -140,6 +144,8 @@ void ChatMessageItem::AddMenuItem(Gtk::MenuItem *item) {
|
||||
ChatMessageTextItem::ChatMessageTextItem(const MessageData *data) {
|
||||
m_content = data->Content;
|
||||
|
||||
get_style_context()->add_class("message-text");
|
||||
|
||||
set_can_focus(false);
|
||||
set_editable(false);
|
||||
set_wrap_mode(Gtk::WRAP_WORD_CHAR);
|
||||
@ -225,6 +231,7 @@ void ChatMessageEmbedItem::DoLayout() {
|
||||
title_label->set_markup("<b>" + Glib::Markup::escape_text(m_embed.Title) + "</b>");
|
||||
title_label->set_halign(Gtk::ALIGN_CENTER);
|
||||
title_label->set_hexpand(false);
|
||||
title_label->get_style_context()->add_class("embed-title");
|
||||
m_main->pack_start(*title_label);
|
||||
}
|
||||
|
||||
@ -236,6 +243,7 @@ void ChatMessageEmbedItem::DoLayout() {
|
||||
desc_label->set_max_width_chars(50);
|
||||
desc_label->set_halign(Gtk::ALIGN_START);
|
||||
desc_label->set_hexpand(false);
|
||||
desc_label->get_style_context()->add_class("embed-description");
|
||||
m_main->pack_start(*desc_label);
|
||||
}
|
||||
|
||||
@ -274,6 +282,8 @@ void ChatMessageEmbedItem::DoLayout() {
|
||||
field_val->set_line_wrap_mode(Pango::WRAP_WORD_CHAR);
|
||||
field_box->pack_start(*field_lbl);
|
||||
field_box->pack_start(*field_val);
|
||||
field_lbl->get_style_context()->add_class("embed-field-title");
|
||||
field_val->get_style_context()->add_class("embed-field-value");
|
||||
flow->insert(*field_box, -1);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ ChatWindow::ChatWindow() {
|
||||
m_input = Gtk::manage(new Gtk::TextView);
|
||||
m_entry_scroll = Gtk::manage(new Gtk::ScrolledWindow);
|
||||
|
||||
m_listbox->get_style_context()->add_class("messages");
|
||||
m_input->get_style_context()->add_class("message-input");
|
||||
|
||||
m_input->signal_key_press_event().connect(sigc::mem_fun(*this, &ChatWindow::on_key_press_event), false);
|
||||
|
||||
m_main->set_hexpand(true);
|
||||
|
@ -8,6 +8,8 @@ MemberList::MemberList() {
|
||||
m_main = Gtk::manage(new Gtk::ScrolledWindow);
|
||||
m_listbox = Gtk::manage(new Gtk::ListBox);
|
||||
|
||||
m_listbox->get_style_context()->add_class("members");
|
||||
|
||||
m_listbox->set_selection_mode(Gtk::SELECTION_NONE);
|
||||
|
||||
m_menu_copy_id = Gtk::manage(new Gtk::MenuItem("_Copy ID", true));
|
||||
@ -109,6 +111,11 @@ void MemberList::UpdateMemberListInternal() {
|
||||
user_row->ID = data->ID;
|
||||
auto *user_ev = Gtk::manage(new Gtk::EventBox);
|
||||
auto *user_lbl = Gtk::manage(new Gtk::Label);
|
||||
|
||||
user_row->get_style_context()->add_class("members-row");
|
||||
user_row->get_style_context()->add_class("members-row-member");
|
||||
user_lbl->get_style_context()->add_class("members-row-label");
|
||||
|
||||
user_lbl->set_single_line_mode(true);
|
||||
user_lbl->set_ellipsize(Pango::ELLIPSIZE_END);
|
||||
if (data != nullptr) {
|
||||
@ -121,6 +128,8 @@ void MemberList::UpdateMemberListInternal() {
|
||||
} else {
|
||||
user_lbl->set_text(display);
|
||||
}
|
||||
|
||||
AttachUserMenuHandler(user_row, data->ID);
|
||||
} else {
|
||||
user_lbl->set_use_markup(true);
|
||||
user_lbl->set_markup("<i>[unknown user]</i>");
|
||||
@ -130,12 +139,16 @@ void MemberList::UpdateMemberListInternal() {
|
||||
user_row->add(*user_ev);
|
||||
user_row->show_all();
|
||||
m_listbox->add(*user_row);
|
||||
AttachUserMenuHandler(user_row, data->ID);
|
||||
};
|
||||
|
||||
auto add_role = [this](std::string name) {
|
||||
auto *role_row = Gtk::manage(new Gtk::ListBoxRow);
|
||||
auto *role_lbl = Gtk::manage(new Gtk::Label);
|
||||
|
||||
role_row->get_style_context()->add_class("members-row");
|
||||
role_row->get_style_context()->add_class("members-row-role");
|
||||
role_lbl->get_style_context()->add_class("members-row-label");
|
||||
|
||||
role_lbl->set_single_line_mode(true);
|
||||
role_lbl->set_ellipsize(Pango::ELLIPSIZE_END);
|
||||
role_lbl->set_use_markup(true);
|
||||
|
Loading…
Reference in New Issue
Block a user