| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #ifndef DIALOGS_MANAGER_h
- #define DIALOGS_MANAGER_h
- #include <OgreSingleton.h>
- #include "UiManager.h"
- #include "UiTextArea.h"
- enum MessageState
- {
- MS_CLOSED,
- MS_SHOW_WINDOW,
- MS_SHOW_TEXT,
- MS_OPENED,
- MS_HIDE_WINDOW
- };
- enum MessageStyle
- {
- MSL_SOLID,
- MSL_TRANSPARENT,
- MSL_NONE
- };
- struct MessageData
- {
- MessageData():
- widget( NULL ),
- window( NULL ),
- scissor( NULL ),
- text_area( NULL ),
- cursor( NULL ),
- state( MS_CLOSED ),
- clickable( true ),
- show_window( true ),
- show_cursor( false ),
- auto_close( false ),
- cursor_percent_y( 0 ),
- cursor_y( 0 ),
- cursor_row_selected( 0 ),
- cursor_row_current( 0 ),
- cursor_row_first( 0 ),
- cursor_row_last( 0 )
- {
- }
- UiWidget* widget;
- UiWidget* window;
- UiWidget* scissor;
- UiTextArea* text_area;
- UiWidget* cursor;
- MessageState state;
- int x = 0;
- int y = 0;
- int w = 0;
- int h = 0;
- std::vector< ScriptId > sync;
- bool clickable;
- bool show_window;
- bool show_cursor;
- bool auto_close;
- float cursor_percent_y;
- float cursor_y;
- int cursor_row_selected;
- int cursor_row_current;
- int cursor_row_first;
- int cursor_row_last;
- };
- class DialogsManager : public Ogre::Singleton< DialogsManager >
- {
- public:
- DialogsManager();
- virtual ~DialogsManager();
- void Initialise();
- void Input( const QGears::Event& event );
- void Update();
- void Clear();
- void OpenDialog(const char* d_name, int x, int y, int w, int h); // aka dialog_open
- void SetText( const char* d_name, const char* text ); // aka dialog_set_text
- int Sync( const char* d_name ); // aka dialog_wait_for_close
- void Hide(const char* d_name); // aka dialog_close
- void SetVariable( const char* d_name, const char* name, const char* value );
- void SetClickable( const char* d_name, const bool clickable );
- void SetCursor( const char* d_name, const int first_row, const int last_row );
- int GetCursor( const char* d_name ) const;
- private:
- void ShowMessage( const int id, const int x, const int y, const int width, const int height );
- void HideMessage( const int id );
- int GetMessageId( const char* d_name ) const;
- bool AutoCloseCheck( const unsigned int id );
- private:
- UiWidget* m_LimitArea;
- std::vector< MessageData* > m_Messages;
- bool m_NextPressed;
- bool m_NextRepeated;
- bool m_UpPressed;
- bool m_DownPressed;
- };
- #endif // DIALOGS_MANAGER_H
|