home *** CD-ROM | disk | FTP | other *** search
-
- #ifdef _MSC_VER
- #include "stdafx.h"
- #endif
-
- #include <ssbc.h>
-
- #ifndef _MSC_VER
- void CSpreadSheet::ProcessEvent(const VBXEVENT *ptrEvent)
- {
- if(ptrEvent->Control != Ctrl)
- return;
-
- CallEvent(ptrEvent->EventIndex, ptrEvent->ParamList);
- }
- #else
- void CSpreadSheet::ProcessEvent(int EventID, const CVBControl *ptr, LPVOID data)
- {
- char far *s;
-
- s = (char far *)ptr->GetVBXClass();
- if(_fstricmp(s,"SpreadSheet"))
- {
- MessageBeep(0);
- return;
- }
-
- CallEvent(EventID, data);
- }
- #endif
-
- void CSpreadSheet::CallEvent(int EventID, LPVOID data)
- {
- switch(EventID)
- {
- {
- case Event_Advance: //IEVENT_SPREAD_ADVANCE,
- int AdvanceNext;
-
- AdvanceNext = AFX_NUM_EVENTPARAMINDEX(int, data, 0);
- Advance(AdvanceNext);
- break;
- }
-
- case Event_BlockSelected: //IEVENT_SPREAD_BLOCKSELECTED,
- {
- long BlockCol, BlockCol2, BlockRow, BlockRow2;
-
- BlockCol = AFX_NUM_EVENTPARAMINDEX(long, data, 3);
- BlockRow = AFX_NUM_EVENTPARAMINDEX(long, data, 2);
- BlockCol2 = AFX_NUM_EVENTPARAMINDEX(long, data, 1);
- BlockRow2 = AFX_NUM_EVENTPARAMINDEX(long, data, 0);
- BlockSelected(BlockCol, BlockRow, BlockCol2, BlockRow2);
- break;
- }
-
- case Event_Change: //IEVENT_SPREAD_CHANGE,
- {
- long Row, Col;
-
- Col = AFX_NUM_EVENTPARAMINDEX (long, data, 1);
- Row = AFX_NUM_EVENTPARAMINDEX (long, data, 0);
- Change(Col, Row);
- break;
- }
-
- case Event_Click: //IEVENT_SPREAD_CLICK,
- {
- long Row, Col;
-
- Col = AFX_NUM_EVENTPARAMINDEX (long, data, 1);
- Row = AFX_NUM_EVENTPARAMINDEX (long, data, 0);
- Click(Col, Row);
- break;
- }
-
- case Event_DblClick: //IEVENT_SPREAD_DBLCLICK,
- {
- long Row, Col;
-
- Col = AFX_NUM_EVENTPARAMINDEX (long, data, 1);
- Row = AFX_NUM_EVENTPARAMINDEX (long, data, 0);
- DblClick(Col, Row);
- break;
- }
-
- case Event_DragDrop: //IEVENT_SPREAD_DRAGDROP, // Standard
- {
- long Source;
- float x, y;
-
- Source = AFX_NUM_EVENTPARAMINDEX (long, data, 2);
- x = AFX_NUM_EVENTPARAMINDEX (float, data, 1);
- y = AFX_NUM_EVENTPARAMINDEX (float, data, 0);
- DragDrop(Source, x, y);
- break;
- }
-
- case Event_DragOver: //IEVENT_SPREAD_DRAGOVER, // Standard
- {
- long Source;
- float x, y;
- int State;
-
- Source = AFX_NUM_EVENTPARAMINDEX (long, data, 3);
- x = AFX_NUM_EVENTPARAMINDEX (float, data, 2);
- y = AFX_NUM_EVENTPARAMINDEX (float, data, 1);
- State = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- DragOver(Source, x, y, State);
- break;
- }
-
- case Event_EditError: //IEVENT_SPREAD_EDITERROR,
- {
- long Col, Row;
- int EditErr;
-
- Col = AFX_NUM_EVENTPARAMINDEX(long, data, 2);
- Row = AFX_NUM_EVENTPARAMINDEX(long, data, 1);
- EditErr = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- EditError(Col, Row, EditErr);
- break;
- }
-
- case Event_EditMode: //IEVENT_SPREAD_EDITMODE,
- {
- long Col, Row;
- int Mode;
- int ChangeMade;
-
- Col = AFX_NUM_EVENTPARAMINDEX(long, data, 3);
- Row = AFX_NUM_EVENTPARAMINDEX(long, data, 2);
- Mode = AFX_NUM_EVENTPARAMINDEX (int, data, 1);
- ChangeMade = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- EditMode(Col, Row, Mode, ChangeMade);
- break;
- }
-
- case Event_GotFocus: //IEVENT_SPREAD_GOTFOCUS, // Standard
- {
- GotFocus();
- break;
- }
-
- case Event_KeyDown: //IEVENT_SPREAD_KEYDOWN, // Standard
- {
- int KeyCode, Shift;
-
- KeyCode = AFX_NUM_EVENTPARAMINDEX (int, data, 1);
- Shift = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- KeyDown(KeyCode, Shift);
- break;
- }
-
- case Event_KeyPress: //IEVENT_SPREAD_KEYPRESS, // Standard
- {
- int KeyAscii;
-
- KeyAscii = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- KeyPress(&KeyAscii);
- AFX_NUM_EVENTPARAMINDEX (int, data, 0) = KeyAscii;
- break;
- }
-
- case Event_KeyUp: //IEVENT_SPREAD_KEYUP, // Standard
- {
- int KeyCode, Shift;
-
- KeyCode = AFX_NUM_EVENTPARAMINDEX (int, data, 1);
- Shift = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- KeyUp(KeyCode, Shift);
- break;
- }
-
- case Event_LeaveCell: //IEVENT_SPREAD_LEAVECELL,
- {
- long Col, Row, NewCol, NewRow;
- int Cancel;
- Col = AFX_NUM_EVENTPARAMINDEX (long, data, 4);
- Row = AFX_NUM_EVENTPARAMINDEX (long, data, 3);
- NewCol = AFX_NUM_EVENTPARAMINDEX (long, data, 2);
- NewRow = AFX_NUM_EVENTPARAMINDEX (long, data, 1);
- Cancel = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- LeaveCell(Col, Row, NewCol, NewRow, &Cancel);
- AFX_NUM_EVENTPARAMINDEX (int, data, 0) = Cancel;
- break;
- }
-
- case Event_LostFocus: //IEVENT_SPREAD_LOSTFOCUS, // Standard
- LostFocus();
- break;
-
- case Event_MouseDown: //IEVENT_SPREAD_MOUSEDOWN, // Standard
- {
- int Button, Shift;
- float x, y;
-
- Button = AFX_NUM_EVENTPARAMINDEX (float, data, 3);
- Shift = AFX_NUM_EVENTPARAMINDEX (float, data, 2);
- x = AFX_NUM_EVENTPARAMINDEX (int, data, 1);
- y = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- MouseDown(Button, Shift, x, y);
- break;
- }
-
- case Event_MouseMove: //IEVENT_SPREAD_MOUSEMOVE, // Standard
- {
- int Button, Shift;
- float x, y;
-
- Button = AFX_NUM_EVENTPARAMINDEX (float, data, 3);
- Shift = AFX_NUM_EVENTPARAMINDEX (float, data, 2);
- x = AFX_NUM_EVENTPARAMINDEX (int, data, 1);
- y = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- MouseMove(Button, Shift, x, y);
- break;
- }
-
- case Event_MouseUp: //IEVENT_SPREAD_MOUSEUP, // Standard
- {
- int Button, Shift;
- float x, y;
-
- Button = AFX_NUM_EVENTPARAMINDEX (float, data, 3);
- Shift = AFX_NUM_EVENTPARAMINDEX (float, data, 2);
- x = AFX_NUM_EVENTPARAMINDEX (int, data, 1);
- y = AFX_NUM_EVENTPARAMINDEX (int, data, 0);
- MouseUp(Button, Shift, x, y);
- break;
- }
-
- case Event_RightClick: //IEVENT_SPREAD_RIGHTCLICK,
- {
- int ClickType;
- long Col, Row;
- long x, y;
-
- ClickType = AFX_NUM_EVENTPARAMINDEX (int, data, 4);
- Col = AFX_NUM_EVENTPARAMINDEX (long, data, 3);
- Row = AFX_NUM_EVENTPARAMINDEX (long, data, 2);
- x = AFX_NUM_EVENTPARAMINDEX (float, data, 1);
- y = AFX_NUM_EVENTPARAMINDEX (float, data, 0);
- RightClick(ClickType, Col, Row, x, y);
- break;
- }
-
- case Event_SelChange: //IEVENT_SPREAD_SELCHANGE,
- {
- long BlockCol, BlockRow, BlockCol2, BlockRow2, CurCol, CurRow;
-
- BlockCol = AFX_NUM_EVENTPARAMINDEX (long, data, 5);
- BlockRow = AFX_NUM_EVENTPARAMINDEX (long, data, 4);
- BlockCol2 = AFX_NUM_EVENTPARAMINDEX (long, data, 3);
- BlockRow2 = AFX_NUM_EVENTPARAMINDEX (long, data, 2);
- CurCol = AFX_NUM_EVENTPARAMINDEX (long, data, 1);
- CurRow = AFX_NUM_EVENTPARAMINDEX (long, data, 0);
- SelChange(BlockCol, BlockRow, BlockCol2, BlockRow2, CurCol, CurRow);
- break;
- }
-
- }
- }
-