HoverRace  2.0
MessageAnnouncement.h
Go to the documentation of this file.
1 
2 // MessageAnnouncement.h
3 //
4 // Copyright (c) 2014-2016 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "Announcement.h"
25 
26 namespace HoverRace {
27 namespace Client {
28 
34 {
36 
37 public:
38  MessageAnnouncement(const std::string &label,
39  std::shared_ptr<Player::Player> player = {}) :
40  MessageAnnouncement(label, "", std::move(player)) { }
41  MessageAnnouncement(const std::string &label, const std::string &text,
42  std::shared_ptr<Player::Player> player = {}) :
43  MessageAnnouncement("message", label, text, player) { }
44 protected:
45  MessageAnnouncement(const std::string &postType,
46  const std::string &label, const std::string &text,
47  std::shared_ptr<Player::Player> player = { });
48 
49 public:
50  virtual ~MessageAnnouncement() { }
51 
52 public:
53  std::shared_ptr<Display::Box> CreateIcon(Display::Display &display,
54  Display::Container &parent) const override;
55  void CreateContents(Display::Display &display,
56  Display::FlexGrid &grid) const override;
57 
58 private:
59  const std::string text;
60 };
61 
62 } // namespace Client
63 } // namespace HoverRace
MessageAnnouncement(const std::string &label, std::shared_ptr< Player::Player > player={})
Definition: MessageAnnouncement.h:38
Announcement(const std::string &postType, const std::string &label, std::shared_ptr< Player::Player > player)
Constructor.
Definition: Announcement.h:53
void CreateContents(Display::Display &display, Display::FlexGrid &grid) const override
Fill in the UI contents of the announcement.
Definition: MessageAnnouncement.cpp:54
virtual ~MessageAnnouncement()
Definition: MessageAnnouncement.h:50
const std::string postType
Definition: Announcement.h:97
MessageAnnouncement(const std::string &label, const std::string &text, std::shared_ptr< Player::Player > player={})
Definition: MessageAnnouncement.h:41
const std::string label
Definition: Announcement.h:98
Base class for display managers.
Definition: Display.h:73
Basic message.
Definition: MessageAnnouncement.h:33
An invisible container for other UI widgets.
Definition: Container.h:49
A container that arranges components into a grid that is automatically sized to the contents...
Definition: FlexGrid.h:52
std::shared_ptr< Player::Player > player
Definition: Announcement.h:99
const std::string text
Definition: MessageAnnouncement.h:59
std::shared_ptr< Display::Box > CreateIcon(Display::Display &display, Display::Container &parent) const override
Create the optional icon to display next to the announcement.
Definition: MessageAnnouncement.cpp:44
Definition: Announcement.h:24
Base class for announcements.
Definition: Announcement.h:43