Crazy Eddie's GUI System  ${CEGUI_VERSION}
Sample_FontDemo.h
1 /***********************************************************************
2 created: 23/6/2012
3 author: Lukas E Meindl
4 *************************************************************************/
5 /***************************************************************************
6 * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27 #ifndef _Sample_FontDemo_h_
28 #define _Sample_FontDemo_h_
29 
30 #include "SampleBase.h"
31 
32 #include <vector>
33 #include <map>
34 
35 #include "CEGUI/ForwardRefs.h"
36 
37 struct FontOption;
38 
39 // Sample class
40 class FontDemo : public Sample
41 {
42 public:
43  // method to initialse the samples windows and events.
44  bool initialise(CEGUI::GUIContext* guiContext);
45 
46  void initialiseDemoFonts();
47  void initialiseFontEditorInfoLabel();
48  void deinitialise();
49 
50 protected:
51  void initialiseLangToTextMap();
52  void initialiseFontSelector();
53  void initialiseTextSelector();
54  void initialiseFontCreator();
55 
56  void initialiseAutoScaleCombobox();
57  void initialiseFontFileNameCombobox();
58  void retrieveLoadedFontNames(bool areEditable);
59  void retrieveFontFileNames();
60 
61  bool handleFontCreationButtonClicked(const CEGUI::EventArgs& e);
62 
63  bool handleFontEditButtonClicked(const CEGUI::EventArgs& e);
64  bool handleFontSelectionChanged(const CEGUI::EventArgs& e);
65 
66  void checkIfEditButtonShouldBeDisabled(CEGUI::Font &font);
67  bool findFontOption(CEGUI::String fontName);
68  bool handleTextSelectionChanged(const CEGUI::EventArgs& e);
69  bool handleTextMultiLineEditboxTextChanged(const CEGUI::EventArgs& e);
70  bool handleFontFileNameSelectionChanged(const CEGUI::EventArgs& e);
71  bool handleRenewFontNameButtonClicked(const CEGUI::EventArgs& e);
72 
73  void generateNewFontName();
74  void changeFontSelectorFontSelection(const CEGUI::String& font);
75 
76  void initialiseAutoScaleOptionsArray();
77 
78  int getAutoScaleMode();
79 
80  CEGUI::GUIContext* d_guiContext;
81 
82  CEGUI::Window* d_root;
83 
84  CEGUI::Editbox* d_fontNameEditbox;
85  CEGUI::Combobox* d_fontFileNameSelector;
86  CEGUI::Editbox* d_fontSizeEditbox;
87  CEGUI::Combobox* d_fontAutoScaleCombobox;
88  CEGUI::ToggleButton* d_fontAntiAliasCheckbox;
89  CEGUI::PushButton* d_fontCreationButton;
90  CEGUI::PushButton* d_fontEditButton;
91  CEGUI::PushButton* d_renewFontNameButton;
92  CEGUI::Window* d_fontEditorInfoLabel;
93 
94  CEGUI::Listbox* d_fontSelector;
95  CEGUI::Listbox* d_textSelector;
96 
97  CEGUI::MultiLineEditbox* d_textDisplayMultiLineEditbox;
98 
99  std::vector<CEGUI::String> d_fontFileNameOptions;
100  std::map<CEGUI::String, bool> d_fontNameOptions;
101 
102  std::map<CEGUI::String, CEGUI::String> d_languageToFontMap;
103  std::map<CEGUI::String, CEGUI::String> d_languageToTextMap;
104 
105  // A vector for Auto Scale Strings in the order of the AutoScale enum
106  std::vector<CEGUI::String> d_autoScaleOptionsArray;
107 };
108 
109 
110 #endif
Definition: cegui/include/CEGUI/GUIContext.h:68
Base class for the Combobox widget.
Definition: cegui/include/CEGUI/widgets/Combobox.h:50
Base class used as the argument to all subscribers Event object.
Definition: cegui/include/CEGUI/EventArgs.h:49
Definition: Sample_FontDemo.h:40
Class that encapsulates a typeface.
Definition: cegui/include/CEGUI/Font.h:58
Base class for standard Listbox widget.
Definition: cegui/include/CEGUI/widgets/Listbox.h:81
Base class to provide logic for push button type widgets.
Definition: cegui/include/CEGUI/widgets/PushButton.h:47
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: cegui/include/CEGUI/Window.h:149
Class providing logic buttons that can have their selected state toggled.
Definition: cegui/include/CEGUI/widgets/ToggleButton.h:40
Base class for an Editbox widget.
Definition: cegui/include/CEGUI/widgets/Editbox.h:69
Base class for the multi-line edit box widget.
Definition: cegui/include/CEGUI/widgets/MultiLineEditbox.h:79
Definition: Sample_FontDemo.cpp:39
String class used within the GUI system.
Definition: cegui/include/CEGUI/String.h:62
Definition: Sample.h:36