Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
etorth committed Nov 17, 2024
1 parent 8359766 commit 13fecad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 32 deletions.
54 changes: 22 additions & 32 deletions client/src/gui/friendchatboard/chatpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,7 @@ ChatPage::ChatPage(
false,
}

, chatref(new ChatItemRef
{
DIR_DOWNLEFT,
UIPage_MARGIN,
[this](const Widget *){ return h() - UIPage_MARGIN - 1; },

w() - 24, // can not stretch
true,
true,

"<layout><par>这里是引用MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM</par></layout>",

this,
true,
})
, chatref(ChatPage::createChatItemRef("<layout><par>这里是引用MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM</par></layout>", this, true))

, input
{
Expand Down Expand Up @@ -154,24 +140,9 @@ void ChatPage::afterResize()
return;
}

const auto xmlStr = chatref->getXML();
auto xmlStr = chatref->getXML();
removeChild(chatref, true);

chatref = new ChatItemRef
{
DIR_DOWNLEFT,
UIPage_MARGIN,
[this](const Widget *){ return h() - UIPage_MARGIN - 1; },

w() - 24, // can not stretch
true,
true,

xmlStr.c_str(),

this,
true,
};
chatref = ChatPage::createChatItemRef(std::move(xmlStr), this, true);
}

bool ChatPage::processEventDefault(const SDL_Event &event, bool valid)
Expand Down Expand Up @@ -237,3 +208,22 @@ bool ChatPage::processEventDefault(const SDL_Event &event, bool valid)
}
}
}

ChatItemRef *ChatPage::createChatItemRef(std::string xmlStr, Widget *self, bool autoDelete)
{
return new ChatItemRef
{
DIR_DOWNLEFT,
UIPage_MARGIN,
[self](const Widget *){ return self->h() - UIPage_MARGIN - 1; },

self->w() - 24, // can not stretch
true,
true,

xmlStr.c_str(),

self,
autoDelete,
};
}
1 change: 1 addition & 0 deletions client/src/gui/friendchatboard/chatpage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ struct ChatPage: public Widget
bool showref() const;
void afterResize() override;
bool processEventDefault(const SDL_Event &, bool) override;
static ChatItemRef *createChatItemRef(std::string, Widget *, bool);
};

0 comments on commit 13fecad

Please sign in to comment.