You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.8 KiB

8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* QNX RtP screen routines header.
  2. Copyright (c) 2002 by Mike Gorchak
  3. Covered by the BSD license. */
  4. #if defined(TVOSf_QNXRtP) && !defined(QNXRTPSCR_HEADER_INCLUDED)
  5. #define QNXRTPSCR_HEADER_INCLUDED
  6. class TDisplayQNXRtP: virtual public TDisplay
  7. {
  8. protected:
  9. TDisplayQNXRtP() {};
  10. virtual ~TDisplayQNXRtP();
  11. static void Init();
  12. static void SetCursorPos(unsigned x, unsigned y);
  13. static void GetCursorPos(unsigned &x, unsigned &y);
  14. static void GetCursorShape(unsigned &start, unsigned &end);
  15. static void SetCursorShape(unsigned start, unsigned end);
  16. static ushort GetRows();
  17. static ushort GetCols();
  18. static void SetCrtMode(ushort mode);
  19. static void SetCrtModeExt(char* mode);
  20. static int CheckForWindowSize(void);
  21. static const char* GetWindowTitle(void);
  22. static int SetWindowTitle(const char* name);
  23. protected:
  24. static inline void safeput(char* &p, char* cap);
  25. protected:
  26. static int cur_x;
  27. static int cur_y;
  28. static int tty_fd;
  29. static int cursorStart;
  30. static int cursorEnd;
  31. static ushort mode;
  32. static volatile sig_atomic_t windowSizeChanged;
  33. };
  34. class TScreenQNXRtP: public TDisplayQNXRtP, public TScreen
  35. {
  36. public:
  37. TScreenQNXRtP();
  38. virtual ~TScreenQNXRtP();
  39. friend class TGKeyQNXRtP;
  40. friend class THWMouseQNXRtP;
  41. friend class TDisplayQNXRtP;
  42. protected:
  43. static void Resume();
  44. static void Suspend();
  45. static ushort fixCrtMode(ushort mode);
  46. static void setCrtData();
  47. static void clearScreen();
  48. static void setVideoMode(ushort mode);
  49. static void setVideoModeExt(char* mode);
  50. static void getCharacters(unsigned offset,ushort* buf, unsigned count);
  51. static ushort getCharacter(unsigned dst);
  52. static void setCharacter(unsigned offset, ushort value);
  53. static void setCharacters(unsigned dst, ushort* src, unsigned len);
  54. static int System(const char* command, pid_t* pidChild, int in,
  55. int out, int err);
  56. protected:
  57. static void SpecialKeysDisable(int fd);
  58. static void SpecialKeysRestore(int fd);
  59. static void StartNCurses();
  60. static void SetGTables();
  61. static void RestoreGTables();
  62. static void sigWindowSizeChanged(int sig);
  63. static void SendToTerminal(const char* const value);
  64. static void RestoreScreen();
  65. static void mapColor(char* &p, int col);
  66. static void writeBlock(int dst, int len, ushort* old, ushort* src);
  67. protected:
  68. static struct termios old_term;
  69. static struct termios new_term;
  70. static cc_t oldKeys[5];
  71. static int old_col;
  72. static int old_fore;
  73. static int old_back;
  74. static int force_redraw;
  75. };
  76. #endif // QNXRTPSCR_HEADER_INCLUDED