Leaked source code of windows server 2003
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.

327 lines
9.5 KiB

  1. /****************************************************************************
  2. *
  3. * FILE: RToolbar.h
  4. *
  5. * CREATED: Chris Pirich (ChrisPi) 7-27-95
  6. *
  7. ****************************************************************************/
  8. #ifndef _RTOOLBAR_H_
  9. #define _RTOOLBAR_H_
  10. #include "GenContainers.h"
  11. #include "GenControls.h"
  12. #include "ConfRoom.h"
  13. #include "imsconf3.h"
  14. #include "ProgressBar.h"
  15. #include "VidView.h"
  16. // Forward declarations
  17. class CVideoWindow;
  18. class CRoomListView;
  19. class CProgressTrackbar;
  20. class CAudioControl;
  21. class CButton;
  22. class CRosterParent;
  23. class CCallingBar;
  24. // The NetMeeting main ui window
  25. class DECLSPEC_UUID("{00FF7C0C-D831-11d2-9CAE-00C04FB17782}")
  26. CMainUI : public CToolbar,
  27. public IConferenceChangeHandler,
  28. public IScrollChange,
  29. public IVideoChange,
  30. public IButtonChange
  31. {
  32. public:
  33. // NMAPP depends on the order of these
  34. enum CreateViewMode
  35. {
  36. CreateFull = 0,
  37. CreateDataOnly,
  38. CreatePreviewOnly,
  39. CreateRemoteOnly,
  40. CreatePreviewNoPause,
  41. CreateRemoteNoPause,
  42. CreateTelephone,
  43. } ;
  44. // Methods:
  45. CMainUI();
  46. BOOL Create(
  47. HWND hwndParent, // The parent window for this one
  48. CConfRoom *pConfRoom, // The main conference room class for
  49. // implementing some features
  50. CreateViewMode eMode = CreateFull,
  51. BOOL bEmbedded = FALSE
  52. );
  53. // Leaving these for now in case I need them later
  54. VOID UpdateButtons() {}
  55. VOID ForwardSysChangeMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
  56. VOID SaveSettings();
  57. HRESULT STDMETHODCALLTYPE QueryInterface(REFGUID riid, LPVOID *ppv)
  58. {
  59. if (__uuidof(CMainUI) == riid)
  60. {
  61. *ppv = this;
  62. AddRef();
  63. return(S_OK);
  64. }
  65. return(CToolbar::QueryInterface(riid, ppv));
  66. }
  67. ULONG STDMETHODCALLTYPE AddRef()
  68. { return(CToolbar::AddRef()); }
  69. ULONG STDMETHODCALLTYPE Release()
  70. { return(CToolbar::Release()); }
  71. // IGenWindow stuff
  72. virtual HBRUSH GetBackgroundBrush();
  73. virtual HPALETTE GetPalette();
  74. // IConferenceChangeHandler stuff
  75. virtual void OnCallStarted();
  76. virtual void OnCallEnded();
  77. virtual void OnAudioLevelChange(BOOL fSpeaker, DWORD dwVolume);
  78. virtual void OnAudioMuteChange(BOOL fSpeaker, BOOL fMute);
  79. virtual void OnChangeParticipant(CParticipant *pPart, NM_MEMBER_NOTIFY uNotify);
  80. virtual void OnChangePermissions();
  81. virtual void OnVideoChannelChanged(NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel);
  82. virtual void StateChange(CVideoWindow *pVideo, NM_VIDEO_STATE uState);
  83. // Change to/from compact view
  84. void SetCompact(
  85. BOOL bCompact // TRUE if going to compact view
  86. );
  87. // Returns TRUE if we are currently in compact view
  88. BOOL IsCompact() { return(m_eViewMode == ViewCompact); }
  89. // Change to/from data-only view
  90. void SetDataOnly(
  91. BOOL bDataOnly // TRUE if going to data-only view
  92. );
  93. // Returns TRUE if we are currently in compact view
  94. BOOL IsDataOnly() { return(m_eViewMode == ViewDataOnly); }
  95. // Change to/from dialing view
  96. void SetDialing(
  97. BOOL bDialing // TRUE if going to dialing view
  98. );
  99. // Returns TRUE if we are currently in dialing view
  100. BOOL IsDialing() { return(m_bDialing != FALSE); }
  101. // Returns TRUE if you can change dialing mode
  102. BOOL IsDialingAllowed() { return(m_eViewMode != ViewDataOnly); }
  103. // Change to/from Picture-in-picture view
  104. void SetPicInPic(
  105. BOOL bPicInPic // TRUE if going to Picture-in-picture view
  106. );
  107. // Returns TRUE if we are currently in Picture-in-picture view
  108. BOOL IsPicInPic() { return(m_bPicInPic != FALSE); }
  109. // Returns TRUE if you can change Picture-in-picture mode
  110. BOOL IsPicInPicAllowed();
  111. // Change to/from compact view
  112. void SetAudioTuning(
  113. BOOL bTuning // TRUE if going to audio tuning view
  114. );
  115. // Returns TRUE if we are currently in audio tuning view
  116. BOOL IsAudioTuning() { return(m_bAudioTuning != FALSE); }
  117. // Accessor for the local video window
  118. CVideoWindow* GetLocalVideo() { return(m_pLocalVideo); }
  119. // Accessor for the remote video window
  120. CVideoWindow* GetRemoteVideo() { return(m_pRemoteVideo); }
  121. // Get the roster window
  122. CRoomListView *GetRoster() const;
  123. // Init menu items
  124. void OnInitMenu(HMENU hMenu);
  125. // Public function for sending commands to this window
  126. void OnCommand(int id) { OnCommand(GetWindow(), id, NULL, 0); }
  127. // IScrollChange
  128. virtual void OnScroll(CProgressTrackbar *pTrackbar, UINT code, int pos);
  129. // IButtonChange
  130. virtual void OnClick(CButton *pButton);
  131. BOOL OnQueryEndSession();
  132. void OnClose();
  133. // Get the ConfRoom for this object
  134. CConfRoom *GetConfRoom() { return(m_pConfRoom); }
  135. static BOOL NewVideoWindow(CConfRoom *pConfRoom);
  136. static void CleanUpVideoWindow();
  137. protected:
  138. virtual ~CMainUI();
  139. virtual LRESULT ProcessMessage(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
  140. private:
  141. enum TempViewMode
  142. {
  143. ViewNormal = 0,
  144. ViewCompact,
  145. ViewDataOnly,
  146. } ;
  147. static CFrame *s_pVideoFrame;
  148. // Implements some features
  149. CConfRoom *m_pConfRoom;
  150. // The background brush
  151. HBRUSH m_hbBack;
  152. // Local video window
  153. CVideoWindow *m_pLocalVideo;
  154. // Remote video window
  155. CVideoWindow *m_pRemoteVideo;
  156. // Audio output (microphone) level
  157. CProgressTrackbar * m_pAudioMic;
  158. // Audio input (speaker) level
  159. CProgressTrackbar * m_pAudioSpeaker;
  160. // The roster window
  161. CRosterParent *m_pRoster;
  162. // The roster window
  163. CCallingBar *m_pCalling;
  164. // The accelerator table for this window
  165. CTranslateAccelTable *m_pAccel;
  166. // The current view mode
  167. TempViewMode m_eViewMode : 4;
  168. // Whether we are currently in dialing mode
  169. BOOL m_bDialing : 1;
  170. // Whether we are currently in audio tuning mode
  171. BOOL m_bAudioTuning : 1;
  172. // Whether we are previewing the local video
  173. BOOL m_bPreviewing : 1;
  174. // Whether we are showing the PiP window
  175. BOOL m_bPicInPic : 1;
  176. // Whether we are currently showing the AV toolbar
  177. BOOL m_bShowAVTB : 1;
  178. // Whether anybody changed the view state
  179. BOOL m_bStateChanged : 1;
  180. // Creates the calling toolbar
  181. void CreateDialTB(
  182. CGenWindow *pParent // The parent window
  183. );
  184. // Creates the "band" with the video window and "data" buttons
  185. void CreateVideoAndAppsTB(
  186. CGenWindow *pParent, // The parent window
  187. CreateViewMode eMode, // The view mode
  188. BOOL bEmbedded
  189. );
  190. // Creates the A/V toolbar
  191. void CreateAVTB(
  192. CGenWindow *pParent, // The parent window
  193. CreateViewMode eMode // The view mode
  194. );
  195. // Creates the answering toolbar
  196. void CreateCallsTB(
  197. CGenWindow *pParent // The parent window
  198. );
  199. // Creates the "data" toolbar
  200. void CreateAppsTB(
  201. CGenWindow *pParent // The parent window
  202. );
  203. // Creates the video and showAV button
  204. void CreateVideoAndShowAVTB(
  205. CGenWindow *pParent // The parent window
  206. );
  207. // Creates the dialing window
  208. void CreateDialingWindow(
  209. CGenWindow *pParent // The parent window
  210. );
  211. // Creates the audio-tuning window
  212. void CreateAudioTuningWindow(
  213. CGenWindow *pParent // The parent window
  214. );
  215. void CreateRosterArea(
  216. CGenWindow *pParent, // The parent window
  217. CreateViewMode eMode // The view mode
  218. );
  219. // Update the visible state of all the windows
  220. void UpdateViewState();
  221. public:
  222. // Change to/from compact view
  223. void SetShowAVTB(
  224. BOOL bShow // TRUE if showing the AV toolbar
  225. );
  226. // Returns TRUE if we are currently showing the AV toolbar in compact mode
  227. BOOL IsShowAVTB() { return(m_bShowAVTB != FALSE); }
  228. BOOL IsStateChanged() { return(m_bStateChanged != FALSE); }
  229. private:
  230. // Get the associated audio control object
  231. CAudioControl *GetAudioControl();
  232. // Handles some commands and forwards the rest to the parent
  233. void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  234. // Timer message for audio levels
  235. void OnTimer(HWND hwnd, UINT id);
  236. // Unadvise the IConferenceChangeHandler
  237. void OnDestroy(HWND hwnd);
  238. // Roster context menu
  239. void OnContextMenu(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos);
  240. // Toggle the mic/speaker mute mode
  241. void ToggleMute(BOOL bSpeaker);
  242. // Update the control state to reflect the mute state
  243. void UpdateMuteState(BOOL bSpeaker, CButton *pButton);
  244. // Update the state of the Play/Pause button
  245. BOOL GetPlayPauseState();
  246. // Update the state of the Play/Pause button
  247. void UpdatePlayPauseState();
  248. // Toggle the pause state of all I/O devices
  249. void TogglePlayPause();
  250. // Change the audio level by the given percent (up or down)
  251. void BumpAudio(BOOL bSpeaker, int pct);
  252. // Set a property on the audio channel
  253. void SetAudioProperty(BOOL bSpeaker, NM_AUDPROP uID, ULONG uValue);
  254. // Get the video HWND
  255. HWND GetVideoWindow(BOOL bLocal);
  256. // Returns TRUE if you can preview
  257. BOOL CanPreview();
  258. // Are we currently in preview mode?
  259. BOOL IsPreviewing() { return((m_bPreviewing || NULL == GetVideoWindow(FALSE)) && CanPreview()); }
  260. };
  261. // Private structure for defining a button
  262. struct Buttons
  263. {
  264. int idbStates; // Bitmap ID for the states
  265. UINT nInputStates; // Number of input states in the bitmap
  266. UINT nCustomStates; // Number of custom states in the bitmap
  267. int idCommand; // Command ID for WM_COMMAND messages
  268. UINT idTooltip; // String ID for the tooltip
  269. } ;
  270. // Helper function for adding a bunch of buttons to a parent window
  271. void AddButtons(
  272. CGenWindow *pParent, // The parent window
  273. const Buttons buttons[], // Array of structures describing the buttons
  274. int nButtons, // Number of buttons to create
  275. BOOL bTranslateColors = TRUE, // Use system background colors
  276. CGenWindow *pCreated[] = NULL, // Created CGenWindow's will be put here
  277. IButtonChange *pNotify=NULL // Notification of clicks
  278. );
  279. #endif // _RTOOLBAR_H_