class CDemoWindow : public CFrameWnd { public: // ... // Keystrokes, commands, messages from outside //{{AFX_MSG( MIPlayWindow ) afx_msg void OnDestroy(); afx_msg void OnPaint(); afx_msg LRESULT OnSpendTime(WPARAM wParam, LPARAM lParam); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnShowWindow( BOOL bShow, UINT nStatus ); //}}AFX_MSG DECLARE_MESSAGE_MAP() // ... };
class CDemoWindow : public LWindow, public LPeriodical { public: CDemoWindow( LCommander *inSuperCommander); // ... void SpendTime(const EventRecord &inMacEvent); void Click(SMouseDownEvent &inMouseDown); protected: void ActivateSelf(); void DeactivateSelf(); // ... };
class stream { public: stream( const char* path_of_file ); // open file ~stream(); // go to offset in file void set_mark( long new_mark ); // skip n bytes in file void skip( long n_bytes ); // read n bytes from file into storage void get_bytes( void* storage, long n ); // read a byte from the file uint8 get_uint8(); // read a word from file in big endian format (and swap if necessary) uint16 get_mac_uint16(); uint32 get_mac_uint32(); // ... };
class DemoWebConnection { public: DemoWebConnection(); ~DemoWebConnection(); Boolean CanAccessWeb(); long OpenSite(char const *url); }; // ...
DemoWebImpl::DemoWebImpl() { // Open Internet Config ICError ret = ICStart(&icRef, 'DEMO'); } long DemoWebImpl::GoToWebSite(char const *url) { long start = 0; long length = strlen(url); return ICLaunchURL(icRef, "\phttp", (char *) url, length, &start, &length); }Windows 95 Implementation
DemoWebImpl::DemoWebImpl() { } long DemoWebImpl::GoToWebSite(char const *url) { HINSTANCE browserInstance = ShellExecute(NULL, "open", (char *) url, NULL, NULL, SW_SHOWNORMAL); if ((long) browserInstance <= 32) return ((long) browserInstance); else return 0; }
#if TARGET_IS_MACOS inline uint16 SwapIfRequired( uint16 v ) { return v; } inline int16 SwapIfRequired( int16 v ) { return v; } inline uint32 SwapIfRequired( uint32 v ) { return v; } inline int32 SwapIfRequired( int32 v ) { return v; } inline void SwapIfRequired( uint16* ) { } inline void SwapIfRequired( int16* ) { } inline void SwapIfRequired( uint32* ) { } inline void SwapIfRequired( int32* ) { } #elif TARGET_IS_WIN95 inline uint16 SwapIfRequired( uint16 v ) { return (v >> 8) | (v << 8); } inline int16 SwapIfRequired( int16 v ) { return SwapIfRequired( (uint16) v ); } inline uint32 SwapIfRequired( uint32 v ) { return (v >> 24) | (v << 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000); } inline int32 SwapIfRequired( int32 v ) { return SwapIfRequired( (uint32) v ); } inline void SwapIfRequired( uint16* p ) { *p = SwapIfRequired( *p ); } inline void SwapIfRequired( int16* p ) { *p = SwapIfRequired( *p ); } inline void SwapIfRequired( uint32* p ) { *p = SwapIfRequired( *p ); } inline void SwapIfRequired( int32* p ) { *p = SwapIfRequired( *p ); } #endif
#include "byteorder.h" // ... void SwapIfRequired(ViewLayout* view) { SwapIfRequired( &view->viewSize ); SwapIfRequired( &view->viewCTabID ); SwapIfRequired( &view->viewBkgID ); SwapIfRequired( &view->viewBouncerID ); SwapIfRequired( &view->viewBtnID ); } // ...
class resfile_flat : public resfile { public: resfile_flat( stream* file ); // stream is a resource file opened by user virtual ~resfile_flat(); virtual void* get_resource( long type, int id ); static void release_resource( void* ); // ... };
struct GEPicture; typedef GEPicture* GEPictureRef; GEPictureRef GetGEPicture( int res_id ); Rect GetGEPictureFrame( GEPictureRef ); void DrawGEPicture( GEPictureRef, const Rect* ); void DisposeGEPicture( GEPictureRef );
struct GEPicture { Rect m_bounds; virtual ~GEPicture() { } virtual void Draw( const Rect* ) = 0; };