tdesktop/Telegram/SourceFiles/info/profile/info_profile_members.h

141 lines
3.7 KiB
C
Raw Normal View History

2017-09-25 16:06:53 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2017-09-25 16:06:53 +00:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2017-09-25 16:06:53 +00:00
*/
#pragma once
#include "ui/rp_widget.h"
#include "boxes/peer_list_box.h"
2017-09-25 16:06:53 +00:00
namespace Ui {
class InputField;
2017-09-25 16:06:53 +00:00
class CrossButton;
class IconButton;
class FlatLabel;
struct ScrollToRequest;
class AbstractButton;
class SettingsButton;
2017-09-25 16:06:53 +00:00
} // namespace Ui
namespace Window {
class Show;
} // namespace Window
2017-09-25 16:06:53 +00:00
namespace Info {
class Controller;
2017-09-25 16:06:53 +00:00
enum class Wrap;
namespace Profile {
class Memento;
struct MembersState {
std::unique_ptr<PeerListState> list;
2018-09-21 16:28:46 +00:00
std::optional<QString> search;
};
class Members
: public Ui::RpWidget
, private PeerListContentDelegate {
2017-09-25 16:06:53 +00:00
public:
Members(
QWidget *parent,
2018-01-22 19:51:38 +00:00
not_null<Controller*> controller);
2017-09-25 16:06:53 +00:00
2017-11-21 09:20:56 +00:00
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
std::unique_ptr<MembersState> saveState();
void restoreState(std::unique_ptr<MembersState> state);
int desiredHeight() const;
rpl::producer<int> onlineCountValue() const;
2017-09-25 16:06:53 +00:00
protected:
void visibleTopBottomUpdated(
int visibleTop,
int visibleBottom) override;
int resizeGetHeight(int newWidth) override;
private:
using ListWidget = PeerListContent;
// PeerListContentDelegate interface.
void peerListSetTitle(rpl::producer<QString> title) override;
void peerListSetAdditionalTitle(rpl::producer<QString> title) override;
2020-03-13 13:05:21 +00:00
bool peerListIsRowChecked(not_null<PeerListRow*> row) override;
int peerListSelectedRowsCount() override;
void peerListScrollToTop() override;
2020-03-13 13:05:21 +00:00
void peerListAddSelectedPeerInBunch(
not_null<PeerData*> peer) override;
2020-03-13 13:05:21 +00:00
void peerListAddSelectedRowInBunch(
not_null<PeerListRow*> row) override;
void peerListFinishSelectedRowsBunch() override;
void peerListSetDescription(
object_ptr<Ui::FlatLabel> description) override;
void peerListShowBox(
object_ptr<Ui::BoxContent> content,
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
void peerListHideLayer() override;
not_null<QWidget*> peerListToastParent() override;
2017-09-25 16:06:53 +00:00
//void peerListAppendRow(
// std::unique_ptr<PeerListRow> row) override {
// PeerListContentDelegate::peerListAppendRow(std::move(row));
// updateSearchEnabledByContent();
//}
//void peerListPrependRow(
// std::unique_ptr<PeerListRow> row) override {
// PeerListContentDelegate::peerListPrependRow(std::move(row));
// updateSearchEnabledByContent();
//}
//void peerListRemoveRow(not_null<PeerListRow*> row) override {
// PeerListContentDelegate::peerListRemoveRow(row);
// updateSearchEnabledByContent();
//}
void setupHeader();
object_ptr<Ui::FlatLabel> setupTitle();
void setupList();
2017-09-25 16:06:53 +00:00
void setupButtons();
//void updateSearchOverrides();
2017-09-25 16:06:53 +00:00
void addMember();
void showMembersWithSearch(bool withSearch);
//void toggleSearch(anim::type animated = anim::type::normal);
//void cancelSearch();
//void searchAnimationCallback();
void updateHeaderControlsGeometry(int newWidth);
//void updateSearchEnabledByContent();
2017-09-25 16:06:53 +00:00
std::unique_ptr<Window::Show> _show;
2017-11-19 16:31:58 +00:00
//Wrap _wrap;
not_null<Controller*> _controller;
2017-09-25 16:06:53 +00:00
not_null<PeerData*> _peer;
std::unique_ptr<PeerListController> _listController;
object_ptr<Ui::RpWidget> _header = { nullptr };
object_ptr<ListWidget> _list = { nullptr };
Ui::SettingsButton *_openMembers = nullptr;
Ui::RpWidget *_titleWrap = nullptr;
Ui::FlatLabel *_title = nullptr;
Ui::IconButton *_addMember = nullptr;
//base::unique_qptr<Ui::InputField> _searchField;
Ui::IconButton *_search = nullptr;
//Ui::CrossButton *_cancelSearch = nullptr;
2019-04-02 09:13:30 +00:00
//Ui::Animations::Simple _searchShownAnimation;
//bool _searchShown = false;
//base::Timer _searchTimer;
2017-09-25 16:06:53 +00:00
rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
2017-09-25 16:06:53 +00:00
};
} // namespace Profile
} // namespace Info