| 1 |  |  | /* | 
    
    | 2 |  |  |  *  The ManaPlus Client | 
    
    | 3 |  |  |  *  Copyright (C) 2004-2009  The Mana World Development Team | 
    
    | 4 |  |  |  *  Copyright (C) 2009-2010  The Mana Developers | 
    
    | 5 |  |  |  *  Copyright (C) 2011-2019  The ManaPlus Developers | 
    
    | 6 |  |  |  *  Copyright (C) 2019-2021  Andrei Karas | 
    
    | 7 |  |  |  * | 
    
    | 8 |  |  |  *  This file is part of The ManaPlus Client. | 
    
    | 9 |  |  |  * | 
    
    | 10 |  |  |  *  This program is free software; you can redistribute it and/or modify | 
    
    | 11 |  |  |  *  it under the terms of the GNU General Public License as published by | 
    
    | 12 |  |  |  *  the Free Software Foundation; either version 2 of the License, or | 
    
    | 13 |  |  |  *  any later version. | 
    
    | 14 |  |  |  * | 
    
    | 15 |  |  |  *  This program is distributed in the hope that it will be useful, | 
    
    | 16 |  |  |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
    
    | 17 |  |  |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
    
    | 18 |  |  |  *  GNU General Public License for more details. | 
    
    | 19 |  |  |  * | 
    
    | 20 |  |  |  *  You should have received a copy of the GNU General Public License | 
    
    | 21 |  |  |  *  along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
    
    | 22 |  |  |  */ | 
    
    | 23 |  |  |  | 
    
    | 24 |  |  | #ifndef GUI_WIDGETS_CHARACTERDISPLAY_H | 
    
    | 25 |  |  | #define GUI_WIDGETS_CHARACTERDISPLAY_H | 
    
    | 26 |  |  |  | 
    
    | 27 |  |  | #include "gui/widgets/container.h" | 
    
    | 28 |  |  | #include "gui/widgets/playerbox.h" | 
    
    | 29 |  |  |  | 
    
    | 30 |  |  | #include "listeners/widgetlistener.h" | 
    
    | 31 |  |  |  | 
    
    | 32 |  |  | #include "localconsts.h" | 
    
    | 33 |  |  |  | 
    
    | 34 |  |  | class CharSelectDialog; | 
    
    | 35 |  |  | class Label; | 
    
    | 36 |  |  |  | 
    
    | 37 |  |  | namespace Net | 
    
    | 38 |  |  | { | 
    
    | 39 |  |  |     struct Character; | 
    
    | 40 |  |  | }  // namespace Net | 
    
    | 41 |  |  |  | 
    
    | 42 |  |  | class CharacterDisplay final : public Container, | 
    
    | 43 |  |  |                                public MouseListener, | 
    
    | 44 |  |  |                                public WidgetListener | 
    
    | 45 |  |  | { | 
    
    | 46 |  |  |     public: | 
    
    | 47 |  |  |         CharacterDisplay(const Widget2 *const widget, | 
    
    | 48 |  |  |                          CharSelectDialog *const charSelectDialog); | 
    
    | 49 |  |  |  | 
    
    | 50 |  |  |         A_DELETE_COPY(CharacterDisplay) | 
    
    | 51 |  |  |  | 
    
    | 52 |  |  |         ~CharacterDisplay() override final; | 
    
    | 53 |  |  |  | 
    
    | 54 |  |  |         void setCharacter(Net::Character *const character); | 
    
    | 55 |  |  |  | 
    
    | 56 |  |  |         Net::Character *getCharacter() const | 
    
    | 57 |  |  |         { return mCharacter; } | 
    
    | 58 |  |  |  | 
    
    | 59 |  |  |         void requestFocus() override final; | 
    
    | 60 |  |  |  | 
    
    | 61 |  |  |         void setActive(const bool active); | 
    
    | 62 |  |  |  | 
    
    | 63 |  |  |         bool isSelectFocused() const | 
    
    | 64 |  |  |         { return false; } | 
    
    | 65 |  |  |  | 
    
    | 66 |  |  |         bool isDeleteFocused() const | 
    
    | 67 |  |  |         { return false; } | 
    
    | 68 |  |  |  | 
    
    | 69 |  |  |         void focusSelect() | 
    
    | 70 |  |  |         { } | 
    
    | 71 |  |  |  | 
    
    | 72 |  |  |         void focusDelete() | 
    
    | 73 |  |  |         { } | 
    
    | 74 |  |  |  | 
    
    | 75 |  |  |         void setSelect(bool b) | 
    
    | 76 |  | 8 |         { mPlayerBox->setSelected(b); } | 
    
    | 77 |  |  |  | 
    
    | 78 |  |  |         void widgetHidden(const Event &event) override final; | 
    
    | 79 |  |  |  | 
    
    | 80 |  |  |         void mouseExited(MouseEvent &event) override final; | 
    
    | 81 |  |  |  | 
    
    | 82 |  |  |         void mouseMoved(MouseEvent &event) override final; | 
    
    | 83 |  |  |  | 
    
    | 84 |  |  |         void mousePressed(MouseEvent &event) override final; | 
    
    | 85 |  |  |  | 
    
    | 86 |  |  |         void update(); | 
    
    | 87 |  |  |  | 
    
    | 88 |  |  |     private: | 
    
    | 89 |  |  |         Net::Character *mCharacter; | 
    
    | 90 |  |  |         PlayerBox *mPlayerBox A_NONNULLPOINTER; | 
    
    | 91 |  |  |         Label *mName A_NONNULLPOINTER; | 
    
    | 92 |  |  | }; | 
    
    | 93 |  |  |  | 
    
    | 94 |  |  | #endif  // GUI_WIDGETS_CHARACTERDISPLAY_H |