Guest User

Untitled

a guest
Sep 13th, 2011
176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 BADA_FORM_H
  24. #define BADA_FORM_H
  25.  
  26. #include <FApp.h>
  27. #include <FUi.h>
  28. #include <FSystem.h>
  29. #include <FBase.h>
  30. #include <FUiITouchEventListener.h>
  31. #include <FUiITextEventListener.h>
  32. #include <FSysSystemTime.h>
  33.  
  34. #include "config.h"
  35. #include "common/scummsys.h"
  36. #include "common/events.h"
  37. #include "common/queue.h"
  38. #include "common/mutex.h"
  39.  
  40. //
  41. // BadaAppForm
  42. //
  43. class BadaAppForm : public Osp::Ui::Controls::Form,
  44. public Osp::Ui::IOrientationEventListener,
  45. public Osp::Ui::ITouchEventListener,
  46. public Osp::Ui::IKeyEventListener,
  47. public Osp::Base::Runtime::IRunnable {
  48. public:
  49. BadaAppForm();
  50. ~BadaAppForm();
  51.  
  52. result Construct();
  53. bool pollEvent(Common::Event &event);
  54. bool isClosing() { return _state == ClosingState; }
  55. void pushKey(Common::KeyCode keycode);
  56. void exitSystem();
  57.  
  58. private:
  59. Object *Run();
  60. result OnInitializing(void);
  61. result OnDraw(void);
  62. void OnOrientationChanged(const Osp::Ui::Control &source,
  63. Osp::Ui::OrientationStatus orientationStatus);
  64. void OnTouchDoublePressed(const Osp::Ui::Control &source,
  65. const Osp::Graphics::Point &currentPosition,
  66. const Osp::Ui::TouchEventInfo &touchInfo);
  67. void OnTouchFocusIn(const Osp::Ui::Control &source,
  68. const Osp::Graphics::Point &currentPosition,
  69. const Osp::Ui::TouchEventInfo &touchInfo);
  70. void OnTouchFocusOut(const Osp::Ui::Control &source,
  71. const Osp::Graphics::Point &currentPosition,
  72. const Osp::Ui::TouchEventInfo &touchInfo);
  73. void OnTouchLongPressed(const Osp::Ui::Control &source,
  74. const Osp::Graphics::Point &currentPosition,
  75. const Osp::Ui::TouchEventInfo &touchInfo);
  76. void OnTouchMoved(const Osp::Ui::Control &source,
  77. const Osp::Graphics::Point &currentPosition,
  78. const Osp::Ui::TouchEventInfo &touchInfo);
  79. void OnTouchPressed(const Osp::Ui::Control &source,
  80. const Osp::Graphics::Point &currentPosition,
  81. const Osp::Ui::TouchEventInfo &touchInfo);
  82. void OnTouchReleased(const Osp::Ui::Control &source,
  83. const Osp::Graphics::Point &currentPosition,
  84. const Osp::Ui::TouchEventInfo &touchInfo);
  85. void OnKeyLongPressed(const Osp::Ui::Control &source,
  86. Osp::Ui::KeyCode keyCode);
  87. void OnKeyPressed(const Osp::Ui::Control &source,
  88. Osp::Ui::KeyCode keyCode);
  89. void OnKeyReleased(const Osp::Ui::Control &source,
  90. Osp::Ui::KeyCode keyCode);
  91.  
  92. void pushEvent(Common::EventType type,
  93. const Osp::Graphics::Point &currentPosition);
  94. void terminate();
  95. void setShortcut();
  96. void showShortcut();
  97. void setVolume(bool up, bool minMax);
  98. void showKeypad();
  99.  
  100. // event handling
  101. long long _ticks;
  102. Osp::Base::Runtime::Thread *_gameThread;
  103. Osp::Base::Runtime::Mutex *_eventQueueLock;
  104. Common::Queue<Common::Event> _eventQueue;
  105. enum {None,Left,Right} _buttonState;
  106. enum {InitState, ActiveState, ClosingState, DoneState, ErrorState} _state;
  107. enum {EscapeKey, GameMenu, ShowKeypad} _shortcut;
  108. int _badaVersion;
  109. };
  110.  
  111. #endif
RAW Paste Data