home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1996-03-31 | 30.1 KB | 1,533 lines
Save Format v1.3 @begin Form "Form1" @begin Object "WForm" WSVisible 1; WSCaption 1; WSClipSiblings 1; WSSizeable 1; WSBorder 1; WSDlgBorder 1; WSDlgFrame 1; WSSysMenu 1; WSSystemMenu 1; WSMinimizeBox 1; WSGroup 1; WSResizeBorder 1; WSExAcceptDropFile 1; WSExAcceptFiles 1; WSExWindowEdge 1; HelpFile ""; BackColor "26"; DragMode "WManualDrag"; Font "8.MS Sans Serif"; ForeColor "20"; HelpID "0"; Name "Form1"; Text "Tiles Game"; ToolTipText ""; @begin Event "Close" GencodeID 2; GencodeSrcLine 541; FunctionName "Form1::Form1_Close"; @end; @begin Event "Create" GencodeID 1; GencodeSrcLine 552; FunctionName "Form1::Form1_Create"; @end; @begin Event "Destroy" GencodeID 3; GencodeSrcLine 641; FunctionName "Form1::Form1_Destroy"; @end; @begin Event "EraseBackground" GencodeID 140; GencodeSrcLine 648; FunctionName "Form1::Form1_EraseBackground"; @end; @begin Event "Paint" GencodeID 138; GencodeSrcLine 670; FunctionName "Form1::Form1_Paint"; @end; @begin Event "RightButtonUp" GencodeID 196; GencodeSrcLine 689; FunctionName "Form1::Form1_RightButtonUp"; @end; @begin UserFunction "Continue" FunctionName "Form1::Continue"; GencodeID 59; GencodeSrcLine 704; @end; @begin UserFunction "GetPosition" FunctionName "Form1::GetPosition"; GencodeID 195; GencodeSrcLine 724; @end; @begin UserFunction "StartMove" FunctionName "Form1::StartMove"; GencodeID 197; GencodeSrcLine 756; @end; @begin UserFunction "Place" FunctionName "Form1::Place"; GencodeID 198; GencodeSrcLine 789; @end; @begin UserFunction "IsValidMove" FunctionName "Form1::IsValidMove"; GencodeID 253; GencodeSrcLine 853; @end; @begin UserFunction "IsFinished" FunctionName "Form1::IsFinished"; GencodeID 302; GencodeSrcLine 906; @end; @begin UserFunction "MakeBoard" FunctionName "Form1::MakeBoard"; GencodeID 364; GencodeSrcLine 927; @end; FDXStructName "Form1DDXStruct"; FDXGenerateStruct "1"; ResID 101; DesignName Form1; TabIndex 0; DesignRect 74,110,263,210; @begin ComponentData "Form1" @end; @end; @begin Menu ItemCount 4; DesignName "menu_1"; IsDefault 1; ResID 101; DesignRect 0,0,19,17; @begin Popup Name "menu_1_File"; Caption "&File"; @begin Item Name "menu_1_New"; Caption "New &Game"; ResID 1001; @begin Event "Click" GencodeID 365; GencodeSrcLine 999; FunctionName "Form1::menu_1_New_Click"; @end; @end; @begin Item Name "menu_1_Exit"; Caption "E&xit"; ResID 1002; @begin Event "Click" GencodeID 360; GencodeSrcLine 1016; FunctionName "Form1::menu_1_Exit_Click"; @end; @end; @end; @begin Popup Name "menu_1_item_1"; Caption "&Help"; @begin Item Name "menu_1_item_4"; Caption "A&bout"; ResID 1000; @begin Event "Click" GencodeID 366; GencodeSrcLine 1033; FunctionName "Form1::menu_1_item_4_Click"; @end; @end; @end; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "0"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_1"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 16; GencodeSrcLine 1044; FunctionName "Form1::pictb_1_Create"; @end; @begin Event "DragContinue" GencodeID 18; GencodeSrcLine 1064; FunctionName "Form1::pictb_1_DragContinue"; @end; @begin Event "DragDrop" GencodeID 19; GencodeSrcLine 1088; FunctionName "Form1::pictb_1_DragDrop"; @end; @begin Event "DragEnd" GencodeID 30; GencodeSrcLine 1118; FunctionName "Form1::pictb_1_DragEnd"; @end; @begin Event "DragFeedback" GencodeID 20; GencodeSrcLine 1131; FunctionName "Form1::pictb_1_DragFeedback"; @end; @begin Event "DragStart" GencodeID 17; GencodeSrcLine 1141; FunctionName "Form1::pictb_1_DragStart"; @end; ResID 102; DesignName pictb_1; TabIndex 1; DesignRect 47,74,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "27"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_2"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 42; GencodeSrcLine 1153; FunctionName "Form1::pictb_2_Create"; @end; @begin Event "DragContinue" GencodeID 57; GencodeSrcLine 1164; FunctionName "Form1::pictb_2_DragContinue"; @end; @begin Event "DragEnd" GencodeID 62; GencodeSrcLine 1175; FunctionName "Form1::pictb_2_DragEnd"; @end; @begin Event "DragStart" GencodeID 54; GencodeSrcLine 1198; FunctionName "Form1::pictb_2_DragStart"; @end; ResID 103; DesignName pictb_2; TabIndex 2; DesignRect 80,74,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "33"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_3"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 43; GencodeSrcLine 1217; FunctionName "Form1::pictb_3_Create"; @end; @begin Event "DragContinue" GencodeID 60; GencodeSrcLine 1228; FunctionName "Form1::pictb_3_DragContinue"; @end; @begin Event "DragEnd" GencodeID 63; GencodeSrcLine 1238; FunctionName "Form1::pictb_3_DragEnd"; @end; @begin Event "DragStart" GencodeID 55; GencodeSrcLine 1251; FunctionName "Form1::pictb_3_DragStart"; @end; ResID 104; DesignName pictb_3; TabIndex 3; DesignRect 113,74,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "1"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_4"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 44; GencodeSrcLine 1262; FunctionName "Form1::pictb_4_Create"; @end; @begin Event "DragContinue" GencodeID 61; GencodeSrcLine 1274; FunctionName "Form1::pictb_4_DragContinue"; @end; @begin Event "DragEnd" GencodeID 64; GencodeSrcLine 1285; FunctionName "Form1::pictb_4_DragEnd"; @end; @begin Event "DragStart" GencodeID 56; GencodeSrcLine 1297; FunctionName "Form1::pictb_4_DragStart"; @end; ResID 105; DesignName pictb_4; TabIndex 4; DesignRect 47,104,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "5"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_5"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 87; GencodeSrcLine 1309; FunctionName "Form1::pictb_5_Create"; @end; @begin Event "DragContinue" GencodeID 106; GencodeSrcLine 1320; FunctionName "Form1::pictb_5_DragContinue"; @end; @begin Event "DragEnd" GencodeID 111; GencodeSrcLine 1330; FunctionName "Form1::pictb_5_DragEnd"; @end; @begin Event "DragStart" GencodeID 101; GencodeSrcLine 1340; FunctionName "Form1::pictb_5_DragStart"; @end; ResID 106; DesignName pictb_5; TabIndex 5; DesignRect 80,104,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "35"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_6"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 88; GencodeSrcLine 1351; FunctionName "Form1::pictb_6_Create"; @end; @begin Event "DragContinue" GencodeID 107; GencodeSrcLine 1361; FunctionName "Form1::pictb_6_DragContinue"; @end; @begin Event "DragEnd" GencodeID 112; GencodeSrcLine 1371; FunctionName "Form1::pictb_6_DragEnd"; @end; @begin Event "DragStart" GencodeID 102; GencodeSrcLine 1381; FunctionName "Form1::pictb_6_DragStart"; @end; ResID 107; DesignName pictb_6; TabIndex 6; DesignRect 113,104,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "4"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_7"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 89; GencodeSrcLine 1392; FunctionName "Form1::pictb_7_Create"; @end; @begin Event "DragContinue" GencodeID 108; GencodeSrcLine 1403; FunctionName "Form1::pictb_7_DragContinue"; @end; @begin Event "DragEnd" GencodeID 113; GencodeSrcLine 1413; FunctionName "Form1::pictb_7_DragEnd"; @end; @begin Event "DragStart" GencodeID 103; GencodeSrcLine 1423; FunctionName "Form1::pictb_7_DragStart"; @end; ResID 108; DesignName pictb_7; TabIndex 7; DesignRect 47,135,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "12"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_8"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 90; GencodeSrcLine 1434; FunctionName "Form1::pictb_8_Create"; @end; @begin Event "DragContinue" GencodeID 109; GencodeSrcLine 1444; FunctionName "Form1::pictb_8_DragContinue"; @end; @begin Event "DragEnd" GencodeID 114; GencodeSrcLine 1454; FunctionName "Form1::pictb_8_DragEnd"; @end; @begin Event "DragStart" GencodeID 104; GencodeSrcLine 1464; FunctionName "Form1::pictb_8_DragStart"; @end; ResID 109; DesignName pictb_8; TabIndex 8; DesignRect 80,135,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "2"; DragMode "WAutomaticLeftDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_9"; Text ""; ToolTipText ""; @begin Event "Create" GencodeID 91; GencodeSrcLine 1475; FunctionName "Form1::pictb_9_Create"; @end; @begin Event "DragContinue" GencodeID 110; GencodeSrcLine 1485; FunctionName "Form1::pictb_9_DragContinue"; @end; @begin Event "DragEnd" GencodeID 115; GencodeSrcLine 1495; FunctionName "Form1::pictb_9_DragEnd"; @end; @begin Event "DragStart" GencodeID 105; GencodeSrcLine 1505; FunctionName "Form1::pictb_9_DragStart"; @end; ResID 110; DesignName pictb_9; TabIndex 9; DesignRect 113,135,33,31; @end; @begin Object "WPictureBox" WSSIcon 1; WSSNotify 1; WCCSTop 1; WCCSNoMoveY 1; WCCSBottom 1; WSVisible 1; WSClipSiblings 1; WSChild 1; BackColor "27"; DragMode "WNoDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "pictb_10"; Text ""; ToolTipText ""; ResID 111; DesignName pictb_10; TabIndex 10; DesignRect 165,98,48,44; @end; @begin Object "WLabel" WSSCenter 1; WSSNotify 1; WSSSunken 1; WCCSTop 1; WSVisible 1; WSClipSiblings 1; WSChild 1; WSExStaticEdge 1; AutoSize "0"; BackColor "-2"; DragMode "WNoDrag"; Font "8.MS Sans Serif"; ForeColor "-2"; HelpID "0"; Name "label_1"; Text " The object of this puzzle is to arrange the tiles, to create the picture on the right. This program demonstrates Drag and Drop events and Member Function creation. Refer to DragStart(), DragContinue(), and DragEnd() for drag and drop techniques."; ToolTipText ""; ResID 112; DesignName label_1; TabIndex 11; DesignRect 16,15,213,39; @end; @begin-code HPPPrefix #include "dragdrop.h" #include <stdlib.h> #include <time.h> WRect _board; WRect _r[ 9 ]; WPoint _positions[ 9 ]; WPictureBox * _missing; WBitmap bitmap[ 10 ]; int _tile[ 9 ]; int _width; int _height; int _start; int _blank; @end-code; @begin-code Code "Form1::Continue" /* --Prototype start-- public: void Continue( WEventData * event ); --Prototype end-- */ void Form1::Continue( WEventData * event ) { WDragEventData * dragEv = (WDragEventData *) event; if( dragEv->draginfo->kbState == WMK_NONE ){ event->returns = WDRAG_DROP; } else { event->returns = WDRAG_CONTINUE_DRAG; } return; } @end-code; @begin-code Code "Form1::GetPosition" /* --Prototype start-- public: int GetPosition( WPoint pt ); --Prototype end-- */ int Form1::GetPosition( WPoint pt ) { int i; for( i = 0; i < 9; i++ ){ if( pt.x > _positions[ i ].x && pt.x < _positions[ i ].x + _width && pt.y > _positions[ i ].y && pt.y < _positions[ i ].y + _height ){ return i; } } return -1; } @end-code; @begin-code Code "Form1::StartMove" /* --Prototype start-- public: void StartMove( int index, WEventData * event ); --Prototype end-- */ void Form1::StartMove( int index, WEventData * event ) { WPoint pt; WRect rect; WInt pos; WDragEventData * d_ev; d_ev = (WDragEventData *) event; rect = GetClientRectangle( TRUE ); event->returns = WDRAG_DEFAULT_START; pt.x = d_ev->currentPoint.x - rect.x; pt.y = d_ev->currentPoint.y - rect.y; pos = GetPosition( pt ); if( pos != _blank ) { _start = pos; } return; } @end-code; @begin-code Code "Form1::Place" /* --Prototype start-- public: void Place( WPictureBox * pBox, WEventData * event ); --Prototype end-- */ void Form1::Place( WPictureBox * pBox, WEventData * event ) { WRect fr; //form_rect WRect set; WDragEventData * dragEv = (WDragEventData *) event; WPoint point; int pos; int temp; fr = GetClientRectangle( TRUE ); point.x = dragEv->currentPoint.x - fr.x; point.y = dragEv->currentPoint.y - fr.y; pos = GetPosition( point ); if( pos == _blank && IsValidMove( _start ) ){ set.Create( _positions[ _blank ].x, _positions[ _blank ].y, _width, _height ); temp = _tile[ _blank ]; _tile[ _blank ] = _tile[ _start ]; _tile[ _start ] = temp; _blank = _start; pBox->SetRectangle( set ); if( IsFinished() ){ _missing->SetRectangle( WRect( _positions[ _blank ].x, _positions[ _blank ].y, _width, _height ) ); _missing->SetVisible( TRUE ); WMessageBox::Info( this, "Yes!", "You have finished. Well Done!" ); _blank = -1; } } return; } @end-code; @begin-code Code "Form1::IsValidMove" /* --Prototype start-- public: WBool IsValidMove( int index ); --Prototype end-- */ WBool Form1::IsValidMove( int index ) { WBool rtn = FALSE; switch( index ){ case 0: if( _blank == 1 || _blank == 3 ) rtn = TRUE; break; case 1: if( _blank == 0 || _blank == 2 || _blank == 4 ) rtn = TRUE; break; case 2: if( _blank == 1 || _blank == 5 ) rtn = TRUE; break; case 3: if( _blank == 0 || _blank == 4 || _blank == 6 ) rtn = TRUE; break; case 4: if( _blank == 1 || _blank == 3 || _blank == 5 || _blank == 7 ) rtn = TRUE; break; case 5: if( _blank == 2 || _blank == 4 || _blank == 8 ) rtn = TRUE; break; case 6: if( _blank == 3 || _blank == 7 ) rtn = TRUE; break; case 7: if( _blank == 6 || _blank == 4 || _blank == 8 ) rtn = TRUE; break; case 8: if( _blank == 7 || _blank == 5 ) rtn = TRUE; break; } return rtn; } @end-code; @begin-code Code "Form1::IsFinished" /* --Prototype start-- public: WBool IsFinished(); --Prototype end-- */ WBool Form1::IsFinished() { WBool rtn = TRUE; int i; for( i = 0; i < 9; i++ ){ if( _tile[ i ] != i ){ rtn = FALSE; } } return rtn; } @end-code; @begin-code Code "Form1::MakeBoard" /* --Prototype start-- public: WBool MakeBoard(); --Prototype end-- */ WBool Form1::MakeBoard() { int i; WPictureBox * pBox[ 9 ]; int move_tile; int temp; _blank = 0; _start = -1; // Setting Random positions of tiles srand( time( NULL ) ); for( i = 0; i < 9; i++ ){ _tile[ i ] = i; } for( i = 0; i < 50; ){ move_tile = (int) rand() % 9; if( IsValidMove( move_tile ) ){ i++; temp = _tile[ _blank ]; _tile[ _blank ] = _tile[ move_tile ]; _tile[ move_tile ] = temp; _blank = move_tile; } } pBox[ 0 ] = pictb_1; pBox[ 1 ] = pictb_2; pBox[ 2 ] = pictb_3; pBox[ 3 ] = pictb_4; pBox[ 4 ] = pictb_5; pBox[ 5 ] = pictb_6; pBox[ 6 ] = pictb_7; pBox[ 7 ] = pictb_8; pBox[ 8 ] = pictb_9; for( i = 0; i < 9; i++ ){ pBox[ i ]->SetRectangle( WRect( _r[ i ].x, _r[ i ].y, _width, _height ) ); } for( i = 0; i < 9; i++ ){ pBox[ i ]->SetBitmap( (const WBitmap) bitmap[ _tile[ i ] ] ); } pictb_10->SetBitmap( (const WBitmap) bitmap[ 9 ] ); pBox[ _blank ]->SetRectangle( WRect( 0, 0, 0, 0 ) ); pBox[ _blank ]->SetVisible( FALSE ); _missing = pBox[ _blank ]; return TRUE; } @end-code; @begin-code Code "Form1::Form1_Close" WBool Form1::Form1_Close( WObject *source, WEventData *event ) { extern WForm *MainForm; Destroy(); if( (WForm*) this == MainForm ) { WAppObject.Quit(); } return( TRUE ); } @end-code; @begin-code Code "Form1::Form1_Create" WBool Form1::Form1_Create( WObject *source, WCreateEventData *event ) { int i; _r[ 0 ] = pictb_1->GetRectangle(); _r[ 1 ] = pictb_2->GetRectangle(); _r[ 2 ] = pictb_3->GetRectangle(); _r[ 3 ] = pictb_4->GetRectangle(); _r[ 4 ] = pictb_5->GetRectangle(); _r[ 5 ] = pictb_6->GetRectangle(); _r[ 6 ] = pictb_7->GetRectangle(); _r[ 7 ] = pictb_8->GetRectangle(); _r[ 8 ] = pictb_9->GetRectangle(); bitmap[ 0 ].Create( BITMAP01 ); bitmap[ 1 ].Create( BITMAP02 ); bitmap[ 2 ].Create( BITMAP03 ); bitmap[ 3 ].Create( BITMAP04 ); bitmap[ 4 ].Create( BITMAP05 ); bitmap[ 5 ].Create( BITMAP06 ); bitmap[ 6 ].Create( BITMAP07 ); bitmap[ 7 ].Create( BITMAP08 ); bitmap[ 8 ].Create( BITMAP09 ); bitmap[ 9 ].Create( BITMAP10 ); _board.Create( _r[ 0 ].x - 1, _r[ 0 ].y - 1, _r[ 8 ].x + _r[ 8 ].w - _r[ 0 ].x + 2, _r[ 8 ].y + _r[ 8 ].h - _r[ 0 ].y + 2 ); for( i = 0; i < 9; i++ ){ _positions[ i ].x = _r[ i ].x; _positions[ i ].y = _r[ i ].y; } _width = _r[ 0 ].w; _height = _r[ 0 ].h; MakeBoard(); return( FALSE ); // previously:// return( TRUE ); } @end-code; @begin-code Code "Form1::Form1_Destroy" WBool Form1::Form1_Destroy( WObject *source, WEventData *event ) { FiniContainer(); return( FALSE ); // previously:// return( TRUE ); } @end-code; @begin-code Code "Form1::Form1_EraseBackground" WBool Form1::Form1_EraseBackground( WObject *source, WPaintEventData *event ) { WPaintEventData * paint; WBrush brush; brush.Create( WBBlackBrush ); paint = (WPaintEventData *) event; paint->canvas->FillRectangle( _board, &brush ); return FALSE; } @end-code; @begin-code Code "Form1::Form1_Paint" WBool Form1::Form1_Paint( WObject *source, WPaintEventData *event ) { WPaintEventData * paint; WBrush brush; brush.Create( WBBlackBrush ); paint = (WPaintEventData *) event; paint->canvas->FillRectangle( _board, &brush ); return FALSE; } @end-code; @begin-code Code "Form1::Form1_RightButtonUp" WBool Form1::Form1_RightButtonUp( WObject *source, WMouseEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::menu_1_New_Click" WBool Form1::menu_1_New_Click( WObject *source, WEventData *event ) { _missing->SetRectangle( WRect( _positions[ _blank ].x, _positions[ _blank ].y, _width, _height ) ); _missing->SetVisible( TRUE ); MakeBoard(); return TRUE; } @end-code; @begin-code Code "Form1::menu_1_Exit_Click" WBool Form1::menu_1_Exit_Click( WObject *source, WEventData *event ) { WAppObject.Quit(); return TRUE; } @end-code; @begin-code Code "Form1::menu_1_item_4_Click" WBool Form1::menu_1_item_4_Click( WObject *source, WEventData *event ) { WMessageBox::Info( this, "About", "Puzzle Game\n\nWatcom Fusion, 1996" ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_1_Create" WBool Form1::pictb_1_Create( WObject *source, WCreateEventData *event ) { // WBool result; // WBitmap bitmap; // result = bitmap.Create( BITMAP01 ); // result = pictb_1->SetBitmap( (const WBitmap) bitmap ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_1_DragContinue" WBool Form1::pictb_1_DragContinue( WObject *source, WDragEventData *event ) { // WDragEventData * dragEv = (WDragEventData *) event; // if( dragEv->draginfo->kbState == WMK_NONE ){ // event->returns = WDRAG_DROP; // } else { // event->returns = WDRAG_CONTINUE_DRAG; // } Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_1_DragDrop" WBool Form1::pictb_1_DragDrop( WObject *source, WDragEventData *event ) { WRect fr; //form_rect WRect br; // box_rect WRect set; WDragEventData * dragEv = (WDragEventData *) event; WPoint point; fr = GetClientRectangle( TRUE ); br = pictb_1->GetClientRectangle( TRUE ); point.x = dragEv->currentPoint.x - fr.x; point.y = dragEv->currentPoint.y - fr.y; set = pictb_1->GetRectangle(); set.x = point.x; set.y = point.y; pictb_1->SetRectangle( set ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_1_DragEnd" WBool Form1::pictb_1_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_1, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_1_DragFeedback" WBool Form1::pictb_1_DragFeedback( WObject *source, WDragEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_1_DragStart" WBool Form1::pictb_1_DragStart( WObject *source, WDragEventData *event ) { StartMove( 0, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_2_Create" WBool Form1::pictb_2_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_2_DragContinue" WBool Form1::pictb_2_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_2_DragEnd" WBool Form1::pictb_2_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_2, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_2_DragStart" WBool Form1::pictb_2_DragStart( WObject *source, WDragEventData *event ) { StartMove( 1, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_3_Create" WBool Form1::pictb_3_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_3_DragContinue" WBool Form1::pictb_3_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_3_DragEnd" WBool Form1::pictb_3_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_3, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_3_DragStart" WBool Form1::pictb_3_DragStart( WObject *source, WDragEventData *event ) { StartMove( 2, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_4_Create" WBool Form1::pictb_4_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_4_DragContinue" WBool Form1::pictb_4_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_4_DragEnd" WBool Form1::pictb_4_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_4, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_4_DragStart" WBool Form1::pictb_4_DragStart( WObject *source, WDragEventData *event ) { StartMove( 3, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_5_Create" WBool Form1::pictb_5_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_5_DragContinue" WBool Form1::pictb_5_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_5_DragEnd" WBool Form1::pictb_5_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_5, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_5_DragStart" WBool Form1::pictb_5_DragStart( WObject *source, WDragEventData *event ) { StartMove( 4, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_6_Create" WBool Form1::pictb_6_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_6_DragContinue" WBool Form1::pictb_6_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_6_DragEnd" WBool Form1::pictb_6_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_6, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_6_DragStart" WBool Form1::pictb_6_DragStart( WObject *source, WDragEventData *event ) { StartMove( 5, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_7_Create" WBool Form1::pictb_7_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_7_DragContinue" WBool Form1::pictb_7_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_7_DragEnd" WBool Form1::pictb_7_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_7, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_7_DragStart" WBool Form1::pictb_7_DragStart( WObject *source, WDragEventData *event ) { StartMove( 6, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_8_Create" WBool Form1::pictb_8_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_8_DragContinue" WBool Form1::pictb_8_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_8_DragEnd" WBool Form1::pictb_8_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_8, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_8_DragStart" WBool Form1::pictb_8_DragStart( WObject *source, WDragEventData *event ) { StartMove( 7, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_9_Create" WBool Form1::pictb_9_Create( WObject *source, WCreateEventData *event ) { return TRUE; } @end-code; @begin-code Code "Form1::pictb_9_DragContinue" WBool Form1::pictb_9_DragContinue( WObject *source, WDragEventData *event ) { Continue( event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_9_DragEnd" WBool Form1::pictb_9_DragEnd( WObject *source, WDragEventData *event ) { Place( pictb_9, event ); return TRUE; } @end-code; @begin-code Code "Form1::pictb_9_DragStart" WBool Form1::pictb_9_DragStart( WObject *source, WDragEventData *event ) { StartMove( 8, event ); return TRUE; } @end-code; @end;