comparison src/core/message.h @ 99:4ac71ac10c9f

core: start adding some UI elements
author David Demelier <markand@malikania.fr>
date Mon, 30 Mar 2020 23:08:23 +0200
parents ed72843a7194
children ef9135c34505
comparison
equal deleted inserted replaced
98:c7e993455985 99:4ac71ac10c9f
67 67
68 #include "texture.h" 68 #include "texture.h"
69 69
70 struct action; 70 struct action;
71 struct font; 71 struct font;
72 struct theme;
72 73
73 union event; 74 union event;
74 75
75 /** 76 /**
76 * \brief Message flags. 77 * \brief Message flags.
96 * 97 *
97 * This structure is used to display a message into the screen. It does not own 98 * This structure is used to display a message into the screen. It does not own
98 * any user properties and therefore must exist while using it. 99 * any user properties and therefore must exist while using it.
99 */ 100 */
100 struct message { 101 struct message {
101 const char *text[6]; /*!< (RW) Lines of text to show */ 102 const char *text[6]; /*!< (RW) Lines of text to show. */
102 struct texture *frame; /*!< (RW, ref) Frame to use */ 103 struct texture *frame; /*!< (RW, ref) Frame to use. */
103 struct texture *avatar; /*!< (RW, ref, optional) Avatar face (optional) */ 104 struct texture *avatar; /*!< (RW, ref, optional) Avatar face. */
104 struct font *font; /*!< (RW, ref) Font to use */
105 unsigned long colors[2]; /*!< (RW) Normal/selected colors */
106 unsigned int index; /*!< (RW) Line selected */ 105 unsigned int index; /*!< (RW) Line selected */
107 enum message_flags flags; /*!< (RW) Message flags */ 106 enum message_flags flags; /*!< (RW) Message flags */
108 enum message_state state; /*!< (RO) Current state */ 107 enum message_state state; /*!< (RO) Current state */
109 108 struct theme *theme; /*!< (RW, ref, optional) Theme to use. */
110 /*! \cond PRIVATE */ 109 unsigned int elapsed; /*!< (RO) Time elapsed. */
111
112 struct texture textures[12];
113 unsigned int elapsed;
114 int height[2];
115
116 /*! \endcond */
117 }; 110 };
118 111
119 /** 112 /**
120 * Start opening the message. This function will reset the message state and 113 * Start opening the message. This function will reset the message state and
121 * elapsed time. 114 * elapsed time.
170 */ 163 */
171 void 164 void
172 message_hide(struct message *msg); 165 message_hide(struct message *msg);
173 166
174 /** 167 /**
175 * Destroy owned resources.
176 *
177 * \pre msg != NULL
178 * \param msg the message
179 */
180 void
181 message_finish(struct message *msg);
182
183 /**
184 * Convert message into an action. 168 * Convert message into an action.
185 * 169 *
186 * \pre msg != NULL 170 * \pre msg != NULL
187 * \pre action != NULL 171 * \pre action != NULL
188 * \param msg the message to copy from 172 * \param msg the message to copy from