ChatLeiste.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. #ifndef ChatLeiste_H
  2. #define ChatLeiste_H
  3. #include <Klient.h>
  4. #include <Zeichnung.h>
  5. #include <TextFeld.h>
  6. #include <Fenster.h>
  7. #include <Knopf.h>
  8. #include <Scroll.h>
  9. #include <Tabelle.h>
  10. #include <GSLSoundV.h>
  11. #include <Rahmen.h>
  12. using namespace Framework;
  13. using namespace Network;
  14. class Chat : public virtual ReferenceCounter
  15. {
  16. protected:
  17. LRahmen *rahmen;
  18. TextFeld *verlauf;
  19. TextFeld *nachricht;
  20. TextFeld *name;
  21. Knopf *minimieren;
  22. Knopf *close;
  23. Punkt bildschirmGröße;
  24. GSL::GSLSoundV *msgSound;
  25. bool admin;
  26. double tickVal;
  27. bool sichtbar;
  28. int animation;
  29. int breite;
  30. int höhe;
  31. bool rend;
  32. public:
  33. // Konstruktor
  34. Chat();
  35. // Destruktor
  36. ~Chat();
  37. // nicht constant
  38. void setSichtbar( bool sichtbar );
  39. void entfernen();
  40. void addNachricht( char *txt );
  41. void setAdmin();
  42. virtual void addSpieler( int accountId );
  43. virtual void removeSpieler( int accountId );
  44. virtual bool tick( double tickVal );
  45. virtual void doPublicMausEreignis( MausEreignis &me );
  46. virtual void doTastaturEreignis( TastaturEreignis &te );
  47. virtual void render( int x, Bild &zRObj );
  48. // constant
  49. TextFeld *getName() const;
  50. TextFeld *zName() const;
  51. virtual int getAccountId() const;
  52. virtual int getChatroomId() const;
  53. int getBreite() const;
  54. bool istSichtbar() const;
  55. };
  56. class ChatFenster : public Chat
  57. {
  58. private:
  59. int accountId;
  60. public:
  61. // Konstruktor
  62. ChatFenster( int accountId );
  63. // Destruktor
  64. ~ChatFenster();
  65. // nicht constant
  66. bool tick( double tickVal ) override;
  67. void doPublicMausEreignis( MausEreignis &me ) override;
  68. void doTastaturEreignis( TastaturEreignis &te ) override;
  69. void render( int x, Bild &zRObj ) override;
  70. // constant
  71. int getAccountId() const override;
  72. };
  73. class ChatroomFenster : public Chat
  74. {
  75. private:
  76. int chatroomId;
  77. ObjTabelle *spieler;
  78. Array< int > *neueSpieler;
  79. int neueSpielerAnzahl;
  80. Array< int > *alteSpieler;
  81. int alteSpielerAnzahl;
  82. TextFeld *spielerName;
  83. Knopf *einladen;
  84. public:
  85. // Konstruktor
  86. ChatroomFenster( int chatroomId );
  87. // Destruktor
  88. ~ChatroomFenster();
  89. // nicht constant
  90. void addSpieler( int accountId ) override;
  91. void removeSpieler( int accountId ) override;
  92. bool tick( double tickVal ) override;
  93. void doPublicMausEreignis( MausEreignis &me ) override;
  94. void doTastaturEreignis( TastaturEreignis &te ) override;
  95. void render( int x, Bild &zRObj ) override;
  96. bool druckFreund( void *obj, MausEreignis &me );
  97. bool druckEntfernen( void *obj, MausEreignis &me );
  98. // constant
  99. virtual int getChatroomId() const;
  100. };
  101. class ChatLeisteObj : public Zeichnung
  102. {
  103. private:
  104. RCArray< Chat > *chats;
  105. HScrollBar *hsb;
  106. Punkt bildschirmGröße;
  107. int anzahl;
  108. int nowME;
  109. public:
  110. // Konstruktor
  111. ChatLeisteObj();
  112. // Destruktor
  113. ~ChatLeisteObj();
  114. // nicht constant
  115. void chatNachricht( int vonAccount, char *txt );
  116. void chatroomNachricht( int chatroomId, char *txt );
  117. void addChat( int accountId, int chatroomId );
  118. void removeChat( int accountId, int chatroomId );
  119. void removeChat( Chat *zChat );
  120. void removeAll();
  121. void addSpieler( int chatroomId, int accountId );
  122. void removeSpieler( int chatroomId, int accountId );
  123. void setChatroomAdmin( int chatroomId );
  124. bool tick( double tickVal ) override;
  125. void doTastaturEreignis( TastaturEreignis &te ) override;
  126. void doPublicMausEreignis( MausEreignis &me ) override;
  127. void render( Bild &zRObj ) override;
  128. };
  129. class ChatLeiste : public virtual ReferenceCounter
  130. {
  131. private:
  132. Fenster *fenster;
  133. Knopf *minMax;
  134. ChatLeisteObj *chatLeiste;
  135. Punkt bildschirmGröße;
  136. Bild *minimierenBild;
  137. Bild *maximierenBild;
  138. double tickVal;
  139. int animation;
  140. bool rend;
  141. public:
  142. // Konstruktor
  143. ChatLeiste( Fenster *zNachLoginFenster );
  144. // Destruktor
  145. ~ChatLeiste();
  146. // nicht constant
  147. void chatNachricht( int vonAccount, char *txt );
  148. void chatroomNachricht( int chatroomId, int vonAccount, char *txt );
  149. void addChat( int accountId, int chatroomId );
  150. void removeChat( int accountId, int chatroomId );
  151. void removeChat( Chat *zChat );
  152. void removeAll();
  153. void addSpieler( int chatroomId, int accountId );
  154. void removeSpieler( int chatroomId, int accountId );
  155. void setChatroomAdmin( int chatroomId );
  156. bool tick( double tickVal );
  157. bool druckMinMax( MausEreignis &me );
  158. };
  159. // Nachrichten
  160. bool chatLeisteMinMaxME( void *p, void *obj, MausEreignis me );
  161. bool chatroomFensterFreundME( void *p, void *obj, MausEreignis me );
  162. bool chatroomFensterEntfernenME( void *p, void *obj, MausEreignis me );
  163. #endif