1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef AGS_SHARED_GUI_GUI_LABEL_H 24 #define AGS_SHARED_GUI_GUI_LABEL_H 25 26 #include "ags/lib/std/vector.h" 27 #include "ags/shared/gui/gui_object.h" 28 #include "ags/shared/util/string.h" 29 30 namespace AGS3 { 31 32 class SplitLines; 33 34 namespace AGS { 35 namespace Shared { 36 37 class GUILabel : public GUIObject { 38 public: 39 GUILabel(); 40 41 // Gets label's text property in original set form (with macros etc) 42 String GetText() const; 43 // Gets which macro are contained within label's text 44 GUILabelMacro GetTextMacros() const; 45 46 // Operations 47 void Draw(Bitmap *ds) override; 48 void SetText(const String &text); 49 50 // Serialization 51 void ReadFromFile(Stream *in, GuiVersion gui_version) override; 52 void WriteToFile(Stream *out) const override; 53 void ReadFromSavegame(Shared::Stream *in, GuiSvgVersion svg_ver) override; 54 void WriteToSavegame(Shared::Stream *out) const override; 55 56 // TODO: these members are currently public; hide them later 57 public: 58 String Text; 59 int32_t Font; 60 color_t TextColor; 61 HorAlignment TextAlignment; 62 63 private: 64 void PrepareTextToDraw(); 65 size_t SplitLinesForDrawing(SplitLines &lines); 66 67 // Information on macros contained within Text field 68 GUILabelMacro _textMacro; 69 // prepared text buffer/cache 70 String _textToDraw; 71 }; 72 73 } // namespace Shared 74 } // namespace AGS 75 } // namespace AGS3 76 77 #endif 78