home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WMEDIA.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  7KB  |  226 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WMediaPlayer -- Wrapper for the Windows 95 Media Player control.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *       MediaNotifyError --
  19.  *
  20.  *       MediaNotifyMedia --
  21.  *
  22.  *       MediaNotifyMode --
  23.  *
  24.  *       MediaNotifyPos --
  25.  *
  26.  *       MediaNotifySize --
  27.  *
  28.  *************************************************************************/
  29.  
  30. #ifndef _WMEDIA_HPP_INCLUDED
  31. #define _WMEDIA_HPP_INCLUDED
  32.  
  33. #ifndef _WNO_PRAGMA_PUSH
  34. #pragma pack(push,8);
  35. #pragma enum int;
  36. #endif
  37.  
  38. #ifndef _WCONTROL_HPP_INCLUDED
  39. #  include "wcontrol.hpp"
  40. #endif
  41.  
  42. #ifndef _WFILPATH_HPP_INCLUDED
  43. #  include "wfilpath.hpp"
  44. #endif
  45.  
  46. #ifdef _UNICODE
  47. #define WMPNotifyMedia              WMPNotifyMediaUnicode
  48. #else
  49. #define WMPNotifyMedia              WMPNotifyMediaAnsi
  50. #endif
  51.  
  52. //
  53. // MediaPlayer styles
  54. //
  55.  
  56. #define WMPNoAutoSizeWindow         ((WStyle)0x00000001) // MCIWNDF_NOAUTOSIZEWINDOW
  57. #define WMPNoPlayBar                ((WStyle)0x00000002) // MCIWNDF_NOPLAYBAR
  58. #define WMPNoAutoSizeMovie          ((WStyle)0x00000004) // MCIWNDF_NOAUTOSIZEMOVIE
  59. #define WMPNoMenu                   ((WStyle)0x00000008) // MCIWNDF_NOMENU
  60. #define WMPShowName                 ((WStyle)0x00000010) // MCIWNDF_SHOWNAME
  61. #define WMPShowPos                  ((WStyle)0x00000020) // MCIWNDF_SHOWPOS
  62. #define WMPShowMode                 ((WStyle)0x00000040) // MCIWNDF_SHOWMODE
  63. #define WMPShowAll                  ((WStyle)0x00000070) // MCIWNDF_SHOWALL
  64. #define WMPNotifyAnsi               ((WStyle)0x00000080) // MCIWNDF_NOTIFYANSI
  65. #define WMPNotifyMode               ((WStyle)0x00000100) // MCIWNDF_NOTIFYMODE
  66. #define WMPNotifyPos                ((WStyle)0x00000200) // MCIWNDF_NOTIFYPOS
  67. #define WMPNotifySize               ((WStyle)0x00000400) // MCIWNDF_NOTIFYSIZE
  68. #define WMPNotifyError              ((WStyle)0x00001000) // MCIWNDF_NOTIFYERROR
  69. #define WMPNotifyAll                ((WStyle)0x00001F00) // MCIWNDF_NOTIFYALL
  70. #define WMPNotifyMediaAnsi          ((WStyle)0x00000880) // MCIWNDF_NOTIFYMEDIAA
  71. #define WMPNotifyMediaUnicode       ((WStyle)0x00000800) // MCIWNDF_NOTIFYMEDIAW
  72. #define WMPRecord                   ((WStyle)0x00002000) // MCIWNDF_RECORD
  73. #define WMPNoErrorDlg               ((WStyle)0x00004000) // MCIWNDF_NOERRORDLG
  74. #define WMPNoOpen                   ((WStyle)0x00008000) // MCIWNDF_NOOPEN
  75.  
  76. #ifdef _UNICODE
  77. #define WMPDefault                  ((WStyle)0x50001F51L) // WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOAUTOSIZEWINDOW|MCIWNDF_NOTIFYALL|MCIWNDF_NOTIFYMEDIAW
  78. #else
  79. #define WMPDefault                  ((WStyle)0x50001FF1L) // WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOAUTOSIZEWINDOW|MCIWNDF_NOTIFYALL|MCIWNDF_NOTIFYMEDIAA
  80. #endif
  81. #define WMPDefaultOld               (((WStyle)0x50001F71L)|WMPNotifyMedia) // WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOAUTOSIZEWINDOW|MCIWNDF_NOTIFYALL|MCIWNDF_NOTIFYMEDIA
  82.  
  83. struct WMediaNotifyEventData : WEventData {
  84.    WChar* fileName;
  85.    WLong  lData;
  86. };
  87.  
  88. class WCMCLASS WMediaPlayer : public WControl {
  89.     WDeclareSubclass( WMediaPlayer, WControl );
  90.  
  91.     public:
  92.  
  93.         WMediaPlayer();
  94.  
  95.         ~WMediaPlayer();
  96.  
  97.         /*******************************************************************
  98.          * Properties
  99.          *******************************************************************/
  100.  
  101.         // CanEject
  102.  
  103.         WBool GetCanEject();
  104.  
  105.         // CanPlay
  106.  
  107.         WBool GetCanPlay();
  108.  
  109.         // CanRecord
  110.  
  111.         WBool GetCanRecord();
  112.  
  113.         // CanSave
  114.  
  115.         WBool GetCanSave();
  116.  
  117.         // Position
  118.  
  119.         #define WMEDIAPLAYER_SEEK_HOME          -1
  120.         #define WMEDIAPLAYER_SEEK_START         -1
  121.         #define WMEDIAPLAYER_SEEK_END           -2
  122.  
  123.         WBool SetPosition( WLong position );
  124.         WLong GetPosition();
  125.  
  126.         // Repeat
  127.  
  128.         WBool GetRepeat();
  129.         WBool SetRepeat( WBool repeat );
  130.  
  131.         // Speed
  132.  
  133.         WUInt GetSpeed();
  134.         WBool SetSpeed( WUInt speed=1000 );
  135.  
  136.         // Volume
  137.  
  138.         WUInt GetVolume();
  139.         WBool SetVolume( WUInt volume=1000 );
  140.  
  141.         // Zoom
  142.  
  143.         WUInt GetZoom();
  144.         WBool SetZoom( WUInt zoom=100 );
  145.  
  146.         /*******************************************************************
  147.          * Methods
  148.          *******************************************************************/
  149.  
  150.         // Close
  151.  
  152.         WBool Close();
  153.  
  154.         // Eject
  155.  
  156.         WBool Eject();
  157.  
  158.         // New
  159.  
  160.         WBool New( const WFilePath & fileName );
  161.  
  162.         // Open
  163.         //
  164.         //      The parameterless version invokes an open dialog
  165.  
  166.         WBool Open();
  167.         WBool Open( const WFilePath & fileName, WBool createIfDoesntExist=FALSE );
  168.  
  169.         // Pause
  170.  
  171.         WBool Pause();
  172.  
  173.         // Play
  174.  
  175.         WBool Play( WLong from=WMEDIAPLAYER_SEEK_START,
  176.                     WLong to=WMEDIAPLAYER_SEEK_END );
  177.  
  178.         // Record
  179.  
  180.         WBool Record();
  181.  
  182.         // Resume
  183.  
  184.         WBool Resume();
  185.  
  186.         // Save
  187.         //
  188.         //      The parameterless version invokes a save dialog
  189.  
  190.         WBool Save();
  191.         WBool Save( const WFilePath & fileName );
  192.  
  193.         // Step
  194.  
  195.         WBool Step( WLong increment );
  196.  
  197.         // Stop
  198.  
  199.         WBool Stop();
  200.  
  201.         /*******************************************************************
  202.          * Overrides
  203.          *******************************************************************/
  204.  
  205.         virtual WBool Destroy();
  206.  
  207.         virtual WBool ProcessMessage( const WMessage & msg,
  208.                                       WLong & returns );
  209.     
  210.         virtual const WChar * InitializeClass();
  211.  
  212.         virtual WStyle GetDefaultStyle() const;
  213.  
  214.         virtual WStyle GetDefaultExtendedStyle() const;
  215.  
  216.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  217.                                    void * data=NULL );
  218. };
  219.  
  220. #ifndef _WNO_PRAGMA_PUSH
  221. #pragma enum pop;
  222. #pragma pack(pop);
  223. #endif
  224.  
  225. #endif // _WMEDIA_HPP_INCLUDED
  226.