Source code of Windows XP (NT5)
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.

224 lines
5.7 KiB

  1. /*****************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1999 - 2000
  4. *
  5. * TITLE: videodlg.h
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: RickTu
  10. *
  11. * DATE: 10/14/99
  12. *
  13. * DESCRIPTION: CVideoCaptureDialog class definitions
  14. *
  15. *****************************************************************************/
  16. #ifndef _WIA_VIDEO_CAPTURE_DIALOG_CLASS_H_
  17. #define _WIA_VIDEO_CAPTURE_DIALOG_CLASS_H_
  18. //
  19. // Thread queue messages
  20. //
  21. #define TQ_DESTROY (WM_USER+1)
  22. #define TQ_GETTHUMBNAIL (WM_USER+2)
  23. #define TQ_GETPREVIEW (WM_USER+3)
  24. #define TQ_DELETEITEM (WM_USER+4)
  25. //
  26. // Private messages
  27. //
  28. #define PWM_POSTINIT (WM_USER+1)
  29. #define PWM_CHANGETOPARENT (WM_USER+2)
  30. #define PWM_THUMBNAILSTATUS (WM_USER+3)
  31. #define PWM_PREVIEWSTATUS (WM_USER+4)
  32. #define PWM_PREVIEWPERCENT (WM_USER+5)
  33. //
  34. // ICON defines
  35. //
  36. #define DEF_PICTURE_ICON 0
  37. #define DEF_FOLDER_ICON 1
  38. #define DEF_PARENT_ICON 2
  39. //
  40. // Messages to send to keep view up to date
  41. //
  42. // The LPARAM has the BSTR of the item to delete...
  43. //
  44. #define VD_NEW_ITEM (WM_USER+20)
  45. #define VD_DELETE_ITEM (WM_USER+21)
  46. //
  47. // No params for this one
  48. //
  49. #define VD_DEVICE_DISCONNECTED (WM_USER+22)
  50. class CVideoCaptureDialog
  51. {
  52. private:
  53. enum
  54. {
  55. MULTISEL_MODE = 1,
  56. SINGLESEL_MODE = 2,
  57. BOTH_MODES = 3
  58. };
  59. private:
  60. HWND m_hWnd;
  61. PDEVICEDIALOGDATA m_pDeviceDialogData;
  62. SIZE m_CurrentAspectRatio;
  63. CThreadMessageQueue *m_pThreadMessageQueue;
  64. CSimpleEvent m_CancelEvent;
  65. HANDLE m_hBackgroundThread;
  66. BOOL m_bFirstTime;
  67. HIMAGELIST m_hImageList;
  68. HFONT m_hBigFont;
  69. DWORD m_nDialogMode;
  70. SIZE m_sizeMinimumWindow;
  71. SIZE m_sizeThumbnails;
  72. INT m_nParentFolderImageListIndex;
  73. HACCEL m_hAccelTable;
  74. INT m_nListViewWidth;
  75. HICON m_hIconLarge;
  76. HICON m_hIconSmall;
  77. CCameraItemList m_CameraItemList;
  78. CCameraItem *m_pCurrentParentItem;
  79. CSimpleStringWide m_strwDeviceId;
  80. CComPtr<IWiaVideo> m_pWiaVideo;
  81. CComPtr<IWiaDevMgr> m_pDevMgr;
  82. CComPtr<IUnknown> m_pCreateCallback;
  83. CComPtr<IUnknown> m_pDeleteCallback;
  84. CComPtr<IUnknown> m_pDisconnectedCallback;
  85. private:
  86. //
  87. // No implementation
  88. //
  89. CVideoCaptureDialog(void);
  90. CVideoCaptureDialog &operator=( const CVideoCaptureDialog & );
  91. CVideoCaptureDialog( const CVideoCaptureDialog & );
  92. private:
  93. CVideoCaptureDialog( HWND hWnd );
  94. protected:
  95. //
  96. // Message functions
  97. //
  98. LRESULT OnInitDialog( WPARAM, LPARAM );
  99. LRESULT OnSize( WPARAM, LPARAM );
  100. LRESULT OnShow( WPARAM, LPARAM );
  101. LRESULT OnGetMinMaxInfo( WPARAM, LPARAM );
  102. LRESULT OnDestroy( WPARAM, LPARAM );
  103. LRESULT OnCommand( WPARAM wParam, LPARAM lParam );
  104. LRESULT OnTimer( WPARAM, LPARAM );
  105. LRESULT OnNotify( WPARAM wParam, LPARAM lParam );
  106. LRESULT OnNewItemEvent( WPARAM, LPARAM lParam );
  107. LRESULT OnDeleteItemEvent( WPARAM, LPARAM lParam );
  108. LRESULT OnDeviceDisconnect( WPARAM, LPARAM );
  109. LRESULT OnHelp( WPARAM wParam, LPARAM lParam );
  110. LRESULT OnContextMenu( WPARAM wParam, LPARAM lParam );
  111. LRESULT OnChangeToParent( WPARAM, LPARAM );
  112. LRESULT OnPostInit( WPARAM, LPARAM );
  113. LRESULT OnThumbnailStatus( WPARAM, LPARAM );
  114. LRESULT OnDblClkImageList( WPARAM, LPARAM );
  115. LRESULT OnImageListKeyDown( WPARAM, LPARAM lParam );
  116. LRESULT OnImageListItemChanged( WPARAM, LPARAM );
  117. VOID OnOK( WPARAM, LPARAM );
  118. VOID OnCancel( WPARAM, LPARAM );
  119. VOID OnCapture( WPARAM, LPARAM );
  120. VOID OnSelectAll( WPARAM, LPARAM );
  121. //
  122. // Util functions
  123. VOID ResizeAll( VOID );
  124. HRESULT EnumerateItems( CCameraItem *pCurrentParent, IEnumWiaItem *pIWiaEnumItem );
  125. HRESULT EnumerateAllCameraItems( VOID );
  126. BOOL FindMaximumThumbnailSize( VOID );
  127. HBITMAP CreateDefaultThumbnail( HDC hDC, HFONT hFont, INT nWidth, INT nHeight, LPCWSTR pszTitle, INT nType );
  128. VOID CreateThumbnails( BOOL bForce=FALSE );
  129. void CreateThumbnails( CCameraItem *pRoot, HIMAGELIST hImageList, bool bForce );
  130. VOID RequestThumbnails( CCameraItem *pRoot );
  131. BOOL ChangeFolder( CCameraItem *pNode );
  132. VOID HandleSelectionChange( VOID );
  133. BOOL PopulateList( CCameraItem *pOldParent=NULL );
  134. VOID MarkItemDeletePending( INT nIndex, BOOL bSet );
  135. BOOL SetSelectedListItem( INT nIndex );
  136. INT FindItemInList( CCameraItem *pItem );
  137. INT GetSelectionIndices( CSimpleDynamicArray<int> &aIndices );
  138. CCameraItem *GetListItemNode( int nIndex );
  139. BOOL AddItemToListView( IWiaItem * pItem );
  140. HWND GetGraphWindowHandle(void);
  141. public: // For now
  142. //
  143. // Background thread messages
  144. //
  145. static BOOL WINAPI OnThreadDestroy( CThreadMessage *pMsg );
  146. static BOOL WINAPI OnGetThumbnail( CThreadMessage *pMsg );
  147. static BOOL WINAPI OnThreadDeleteItem( CThreadMessage *pMsg );
  148. public:
  149. static INT_PTR CALLBACK DialogProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  150. };
  151. class CVideoCallback : public IWiaEventCallback
  152. {
  153. private:
  154. HWND m_hWnd;
  155. LONG m_cRef;
  156. public:
  157. CVideoCallback();
  158. STDMETHOD(Initialize)( HWND hwnd );
  159. //
  160. // IWiaEventCallback stuff
  161. //
  162. STDMETHOD_(ULONG, AddRef)(VOID);
  163. STDMETHOD_(ULONG, Release)(VOID);
  164. STDMETHOD(QueryInterface)(REFIID riid, LPVOID *ppvObject);
  165. STDMETHOD(ImageEventCallback)(const GUID __RPC_FAR *pEventGUID, BSTR bstrEventDescription, BSTR bstrDeviceID, BSTR bstrDeviceDescription, DWORD dwDeviceType, BSTR bstrFullItemName, ULONG __RPC_FAR *pulEventType, ULONG ulReserved);
  166. };
  167. #endif