home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / source / wpshidl / samples / wpcar / car.idl < prev    next >
Encoding:
Text File  |  1993-11-18  |  15.6 KB  |  549 lines

  1.  
  2. //# This file was generated by the SOM Compiler.
  3. //# FileName: car.id2.
  4. //# Generated using:
  5. //#     SOM Precompiler somopc: 2.2
  6. //#     SOM Emitter emitidl: 2.7
  7.  
  8. //
  9. //
  10. //   Module Name: CAR
  11. //
  12. //   OS/2 Work Place Shell Sample Program - SOM 2.0 / IDL Version
  13. //
  14. //   Copyright (C) 1992, 1993 IBM Corporation
  15. //
  16. //       DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  17. //       sample code created by IBM Corporation. This sample code is not
  18. //       part of any standard or IBM product and is provided to you solely
  19. //       for  the purpose of assisting you in the development of your
  20. //       applications.  The code is provided "AS IS", without
  21. //       warranty of any kind.  IBM shall not be liable for any damages
  22. //       arising out of your use of the sample code, even if they have been
  23. //       advised of the possibility of such damages.
  24. //
  25.  
  26. #ifndef car_idl
  27. #define car_idl
  28.  
  29. #include <wpdataf.idl>
  30. #include <somcls.idl>
  31.  
  32. interface M_Car;
  33.  
  34. interface Car : WPDataFile
  35.  
  36. //
  37. // CLASS: Car
  38. //
  39. // CLASS HIERARCHY:
  40. //
  41. //     SOMObject
  42. //       └── WPObject
  43. //             └── WPFileSystem
  44. //                   └── WPDataFile
  45. //                         └──  Car
  46. //
  47. // DESCRIPTION:
  48. //
  49. //    This is the sample car object class.
  50. //
  51. //    An instance of this class can be created as a Workplace object.
  52. //
  53.  
  54. {
  55.   BOOL QueryBrakes();
  56.  
  57.   //
  58.   // METHOD: QueryBrakes                                    ( ) PRIVATE
  59.   //                                                        (X) PUBLIC
  60.   // DESCRIPTION:
  61.   //
  62.   //   Query state of car's brakes
  63.   //
  64.   // RETURN:
  65.   //
  66.   //   TRUE           Brake is on
  67.   //   FALSE          Brake is off
  68.   //
  69.  
  70.   void SetBrakes(in BOOL fBrake);                 //som2 changed VOID to void
  71.  
  72.   //
  73.   // METHOD: SetBrakes                                      ( ) PRIVATE
  74.   //                                                        (X) PUBLIC
  75.   // DESCRIPTION:
  76.   //
  77.   //   Put on the brakes
  78.   //
  79.  
  80.   ULONG QueryDuration();
  81.  
  82.   //
  83.   // METHOD: QueryDuration                                  ( ) PRIVATE
  84.   //                                                        (X) PUBLIC
  85.   // DESCRIPTION:
  86.   //
  87.   //   Query Duration of horn beep
  88.   //
  89.   // RETURN:
  90.   //
  91.   //   ULONG          Duration of beep
  92.   //
  93.  
  94.   void SetDuration(in ULONG ulDuration);           //som2 changed VOID to void
  95.  
  96.   //
  97.   // METHOD: SetDuration                                    ( ) PRIVATE
  98.   //                                                        (X) PUBLIC
  99.   // DESCRIPTION:
  100.   //
  101.   //   Set Duration of horn beep
  102.   //
  103.  
  104.   ULONG QueryHighTone();
  105.  
  106.   //
  107.   // METHOD: QueryHighTone                                  ( ) PRIVATE
  108.   //                                                        (X) PUBLIC
  109.   // DESCRIPTION:
  110.   //
  111.   //   Query HighTone of horn
  112.   //
  113.   // RETURN:
  114.   //
  115.   //   ULONG          High frequency of horn
  116.   //
  117.  
  118.   void SetHighTone(in ULONG ulTone);             //som2 changed VOID to void
  119.  
  120.   //
  121.   // METHOD: SetHighTone                                    ( ) PRIVATE
  122.   //                                                        (X) PUBLIC
  123.   // DESCRIPTION:
  124.   //
  125.   //   Set HighTone of horn
  126.   //
  127.  
  128.   ULONG QueryLowTone();
  129.  
  130.   //
  131.   // METHOD: QueryLowTone                                   ( ) PRIVATE
  132.   //                                                        (X) PUBLIC
  133.   // DESCRIPTION:
  134.   //
  135.   //   Query LowTone of horn
  136.   //
  137.   // RETURN:
  138.   //
  139.   //   ULONG          High frequency of horn
  140.   //
  141.  
  142.   void SetLowTone(in ULONG ulTone);            //som2 changed VOID to void
  143.  
  144.   //
  145.   // METHOD: SetLowTone                                     ( ) PRIVATE
  146.   //                                                        (X) PUBLIC
  147.   // DESCRIPTION:
  148.   //
  149.   //   Set LowTone of horn
  150.   //
  151.  
  152.   ULONG QuerySpeed();
  153.  
  154.   //
  155.   // METHOD: QuerySpeed                                     ( ) PRIVATE
  156.   //                                                        (X) PUBLIC
  157.   // DESCRIPTION:
  158.   //
  159.   //   Query Speed of car
  160.   //
  161.   // RETURN:
  162.   //
  163.   //   ULONG          car speed
  164.   //
  165.  
  166.   void SetSpeed(in ULONG ulSpeed);           //som2 changed VOID to void
  167.  
  168.   //
  169.   // METHOD: SetSpeed                                       ( ) PRIVATE
  170.   //                                                        (X) PUBLIC
  171.   // DESCRIPTION:
  172.   //
  173.   //   Set Speed of car
  174.   //
  175.  
  176.   BOOL BeepHorn();
  177.  
  178.   //
  179.   // METHOD: BeepHorn                                       ( ) PRIVATE
  180.   //                                                        (X) PUBLIC
  181.   // DESCRIPTION:
  182.   //
  183.   //   Beep the car's horn.
  184.   //
  185.   // RETURN:
  186.   //
  187.   //   TRUE           Successful
  188.   //   FALSE          Unsuccessful
  189.   //
  190.  
  191.   ULONG AddDashboardPage(in HWND hwndNotebook);
  192.  
  193.   //
  194.   // METHOD: AddDashboardPage                               ( ) PRIVATE
  195.   //                                                        (X) PUBLIC
  196.   // DESCRIPTION:
  197.   //
  198.   //   This method adds the dashboard page to the settings notebook.
  199.   //
  200.   // RETURN:
  201.   //
  202.   //   0              Unsuccessful
  203.   //   ulPageId       Identifier for the inserted page
  204.   //
  205.   // HOW TO OVERRIDE:
  206.   //
  207.   //   Method should always be overridden in order to replace or remove
  208.   //   the dashboard page from an object which is a descendent of Car.
  209.   //   In most cases, an override of this method will not call the parent.
  210.   //
  211.  
  212.   ULONG AddHornBeepPage(in HWND hwndNotebook);
  213.  
  214.   //
  215.   // METHOD: AddHornBeepPage                                ( ) PRIVATE
  216.   //                                                        (X) PUBLIC
  217.   // DESCRIPTION:
  218.   //
  219.   //   This method adds the horn beep page to the settings
  220.   //   notebook.
  221.   //
  222.   // RETURN:
  223.   //
  224.   //   0              Unsuccessful
  225.   //   ulPageId       Identifier for the inserted page
  226.   //
  227.   // HOW TO OVERRIDE:
  228.   //
  229.   //   Method should always be overridden in order to replace or remove
  230.   //   the horn beep page from an object which is a descendent of Car.
  231.   //   In most cases, an override of this method will not call the parent.
  232.   //
  233.  
  234.   void TrapTest();                  //som2 changed VOID to void
  235.  
  236.   //
  237.   // METHOD: AddHornBeepPage                                ( ) PRIVATE
  238.   //                                                        (X) PUBLIC
  239.   // DESCRIPTION:
  240.   //
  241.   //   This method tests the exception handling in this sample.
  242.   //
  243.   // RETURN:
  244.   //
  245.   //   nothing
  246.   //
  247.   // HOW TO OVERRIDE:
  248.   //
  249.   //   n/a
  250.   //
  251.   //
  252.   //   Methods from the WPObject class
  253.   //
  254.  
  255.  
  256.  
  257. #ifdef __SOMIDL__
  258.   implementation {
  259.  
  260.     releaseorder: QueryBrakes,SetBrakes,QueryDuration,SetDuration,QueryHighTone,
  261.                   SetHighTone,QueryLowTone,SetLowTone,QuerySpeed,SetSpeed,
  262.                   BeepHorn,AddDashboardPage,AddHornBeepPage,TrapTest;
  263.  
  264.     //# Class Modifiers
  265.     externalstem = car;
  266.     local;
  267.     externalprefix = car_;
  268.     majorversion = 1;
  269.     minorversion = 2;
  270.     filestem = car;
  271.     metaclass = M_Car;
  272.     callstyle = oidl;
  273.  
  274. /* som2 The continuation mark '\' must have a space before the " in the
  275.    passthru section i.e., \" -> \ " */
  276.  
  277.     passthru C_ih =     ""
  278. "   #define INCL_WIN"
  279. "   #define INCL_DOS"
  280. "   #define INCL_GPIBITMAPS"
  281. "   #define INCL_DOSERRORS"
  282. "   #include <os2.h>"
  283. ""
  284. "   #define INCL_WPCLASS"
  285. "   #define INCL_WPFOLDER"
  286. ""
  287. "   #include <pmwp.h>"
  288. ""
  289. "   #define ID_TITLE           100"
  290. "   #define ID_ICON            101"
  291. ""
  292. "   #define IDD_DASHBOARD      200                  /* settings page (dialog) */"
  293. "   #define IDD_HORNBEEP       202"
  294. ""
  295. "   /*"
  296. "    *   The following user-defined Popup menu items (ID_xxx) should be higher"
  297. "    *   than WPMENUID_USER."
  298. "    *"
  299. "    *   The ID_OPENMENU will become a submenu of the system's popup open menu"
  300. "    *   id, WPMENUID_OPEN."
  301. "    */"
  302. "   #define ID_BEEPMENU        (WPMENUID_USER+1) /* menus added to popup menu */"
  303. "   #define ID_OPENMENU        (WPMENUID_USER+2)"
  304. "   #define ID_TRAPMENU        (WPMENUID_USER+3)"
  305. ""
  306. "   #define IDM_OPENCAR        (WPMENUID_USER+4) /* submenus of added menus */"
  307. "   #define IDM_BEEPHORN       (WPMENUID_USER+5)"
  308. "   #define IDM_TRAPCAR        (WPMENUID_USER+6)"
  309. ""
  310. "   #define IDMSG_ACCESS_VIOLATION  100"
  311. "   #define IDM_MSGBOX              999"
  312. ""
  313. "   #define ID_FRAME           3000                       /* client window id */"
  314. "   #define ID_CLIENT          3001                       /* client window id */"
  315. ""
  316. "   /*"
  317. "    *   Set unique view ids."
  318. "    */"
  319. "   #define OPEN_CAR           ID_OPENMENU"
  320. ""
  321. "   #define CAR_TIMER          1001                               /* timer id */"
  322. ""
  323. "   /*"
  324. "    *   IDs of dialog items in CAR.RC"
  325. "    */"
  326. "   #define ID_UNDO            801"
  327. "   #define ID_DEFAULT         802"
  328. "   #define ID_HELP            803"
  329. "   #define ID_HITONE          804"
  330. "   #define ID_LOTONE          805"
  331. "   #define ID_SPEEDSLIDER     806"
  332. "   #define ID_STOP            807"
  333. "   #define ID_SPEEDDATA       808"
  334. "   #define ID_GO              809"
  335. ""
  336. "   /*"
  337. "    *  Keys for save-restore methods"
  338. "    */"
  339. "   #define IDKEY_HITONE       1"
  340. "   #define IDKEY_LOTONE       2"
  341. "   #define IDKEY_DURATION     3"
  342. "   #define IDKEY_SPEED        4"
  343. "   #define IDKEY_BRAKEFLAG    5"
  344. ""
  345. "   /*"
  346. "    *   Default values of instance data items"
  347. "    */"
  348. "   #define DEFAULT_DURATION   300"
  349. "   #define DEFAULT_HITONE     400"
  350. "   #define DEFAULT_LOTONE     400"
  351. "   #define DEFAULT_SPEED      50"
  352. "   #define DEFAULT_BRAKEFLAG  FALSE"
  353. ""
  354. "   /*"
  355. "    *   Help IDs"
  356. "    *"
  357. "    *   NOTE:  At this time, no source file is provided to build help for this"
  358. "    *   sample.  A pre-built help file, CAR.HLP, is provided containing the"
  359. "    *   following help ids."
  360. "    */"
  361. "   #define ID_HELP_DEFAULT    256"
  362. "   #define ID_HELP_DASHBOARD  257"
  363. "   #define ID_HELP_OPENCAR    258"
  364. "   #define ID_HELP_HORNBEEP   259"
  365. "   #define ID_HELP_BEEPHORN   260"
  366. ""
  367. "   /*"
  368. "    *   Indexes into CARDETAILS information. (arrays)"
  369. "    */"
  370. "   #define  INDEX_MAKE         0"
  371. "   #define  INDEX_MODEL        1"
  372. "   #define  INDEX_COLOR        2"
  373. "   #define  INDEX_SALE_DATE    3"
  374. "   #define  INDEX_PRICE        4"
  375. ""
  376. "   /*"
  377. "    *   CARDETAILS:  Structure used for details view"
  378. "    */"
  379. "   typedef struct _CARDETAILS"
  380. "   {"
  381. "      PSZ     pszMake;     /* Manufacturer      */"
  382. "      PSZ     pszModel;    /* Model             */"
  383. "      PSZ     pszColor;    /* Color of car      */"
  384. "      CDATE   cdateSale;   /* Date of sale      */"
  385. "      ULONG   ulPrice;     /* Price in dollars  */"
  386. "   } CARDETAILS;"
  387. "   typedef CARDETAILS *PCARDETAILS;"
  388. "";
  389.  
  390.     passthru C_h_after =  ""
  391. "   /*"
  392. "    *   The following structures will be used to store window specific data"
  393. "    *   and a pointer to the object that created the window/dialog."
  394. "    *"
  395. "    *   They're allocated when the Client window is created.  This"
  396. "    *   allows us to pass the *somSelf pointer and use it in our"
  397. "    *   window and dialog procedures (the system only passes this"
  398. "    *   pointer to methods)."
  399. "    */"
  400. "   typedef struct _WINDOWDATA"
  401. "   {"
  402. "      USHORT   cb;            /* size of this structure */"
  403. "      Car     *somSelf;       /* pointer to this instance */"
  404. "      USEITEM  UseItem;       /* global class usage information */"
  405. "      VIEWITEM ViewItem;      /* global class view information */"
  406. "      LONG     x;             /* x position of car in open view */"
  407. "      LONG     y;             /* y position of car in open view */"
  408. "      LONG     xDir;          /* x direction (CAR_LEFT or CAR_RIGHT) */"
  409. "      LONG     yDir;          /* y direction (CAR_UP or CAR_DOWN) */"
  410. "   } WINDOWDATA;"
  411. "   typedef WINDOWDATA *PWINDOWDATA;"
  412. ""
  413. "   /*"
  414. "    *   Window data for the Dashboard dialog (settings page)"
  415. "    */"
  416. "   typedef struct _DASHDLGDATA"
  417. "   {"
  418. "      USHORT   cb;            /* size of this structure */"
  419. "      Car    *somSelf;        /* pointer to this instance         */"
  420. "      BOOL    PrevBrakes;     /* indicates if car is stopped      */"
  421. "      ULONG   PrevSpeed;      /* Speed car moves across screen    */"
  422. "   } DASHDLGDATA;"
  423. "   typedef DASHDLGDATA *PDASHDLGDATA;"
  424. ""
  425. "   /*"
  426. "    *   Window data for the Horn dialog (settings page)"
  427. "    */"
  428. "   typedef struct _HORNDLGDATA"
  429. "   {"
  430. "      USHORT   cb;            /* size of this structure */"
  431. "      Car    *somSelf;        /* pointer to this instance         */"
  432. "      ULONG   PrevDuration;   /* Duration of the car's horn beep  */"
  433. "      ULONG   PrevHighTone;   /* The high note of the car beep    */"
  434. "      ULONG   PrevLowTone;    /* The low note of the car beep     */"
  435. "   } HORNDLGDATA;"
  436. "   typedef HORNDLGDATA *PHORNDLGDATA;"
  437. ""
  438. "   /*"
  439. "    *   These defines are used as directional multipliers against x,y position."
  440. "    */"
  441. "   #define CAR_LEFT  -1"
  442. "   #define CAR_RIGHT  1"
  443. "   #define CAR_DOWN  -1"
  444. "   #define CAR_UP     1"
  445. ""
  446. "   #define ICON_WIDTH   32     /* pels */"
  447. "   #define ICON_HEIGHT  32     /* pels */"
  448. ""
  449. "   /*"
  450. "    *   Private Debug helpers go here.  They can be enabled/disabled by"
  451. "    *   defining DEBUG as a compiler directive."
  452. "    */"
  453. "   #if defined(DEBUG)"
  454. ""
  455. "      #define DebugBox(title, text) \ "
  456. "                                    \ "
  457. "                 WinMessageBox(     \ "
  458. "                    HWND_DESKTOP,   \ "
  459. "                    HWND_DESKTOP,   \ "
  460. "                    (PSZ) text,     \ "
  461. "                    (PSZ) title,    \ "
  462. "                    20,             \ "
  463. "                    MB_OK | MB_INFORMATION | MB_MOVEABLE)"
  464. "   #else"
  465. "      #define DebugBox(title, text)   /* do nothing if not debugging */"
  466. "   #endif"
  467. "";
  468.  
  469.     //# Internal Instance Variables
  470.     BOOL BrakeFlag;               // indicates if car is stopped
  471.     ULONG duration;               // Duration of the car's horn
  472.     ULONG HighTone;               // The high note of the beep
  473.     ULONG LowTone;                // The low note of the beep
  474.     ULONG speed;                  // Speed car moves across screen
  475.  
  476.     //# Method Modifiers
  477.     wpInitData: override;
  478.     wpUnInitData: override;
  479.     wpSaveState: override;
  480.     wpRestoreState: override;
  481.     wpAddSettingsPages: override;
  482.     wpFilterPopupMenu: override;
  483.     wpModifyPopupMenu: override;
  484.     wpMenuItemSelected: override;
  485.     wpMenuItemHelpSelected: override;
  486.     wpQueryDetailsData: override;
  487.     wpOpen: override;
  488.     wpSetup: override;
  489.  
  490.     //# Data Modifiers
  491.  
  492.   };
  493. #endif /* __SOMIDL__ */
  494. };
  495.  
  496. interface M_Car
  497. {
  498.   HMODULE clsQueryModuleHandle();
  499.  
  500.   //
  501.   // METHOD: clsQueryModuleHandle                           ( ) PRIVATE
  502.   //                                                        (X) PUBLIC
  503.   // DESCRIPTION:
  504.   //
  505.   //   This method returns the module handle of this class.  If this is the
  506.   //   first invocation, DosQueryModuleHandle is called to save the handle
  507.   //   for future invocations.
  508.   //
  509.   // RETURN:
  510.   //
  511.   //   0              Unsuccessful
  512.   //   non-zero       module handle
  513.   //
  514.  
  515.  
  516.  
  517. #ifdef __SOMIDL__
  518.   implementation {
  519.  
  520.     releaseorder: clsQueryModuleHandle;
  521.  
  522.     //# Class Modifiers
  523.     externalstem = car;
  524.     local;
  525.     externalprefix = carM_;              // som2 changed car_ to carM_
  526.     functionprefix = carM_;
  527.     majorversion = 1;
  528.     minorversion = 2;
  529.     filestem = car;
  530.     callstyle = oidl;
  531.  
  532.     //# Method Modifiers
  533.     wpclsInitData: override;
  534.     wpclsUnInitData: override;
  535.     wpclsQueryTitle: override;
  536.     wpclsQueryIconData: override;
  537.     wpclsQueryDefaultHelp: override;
  538.     wpclsQueryDefaultView: override;
  539.     wpclsQueryDetailsInfo: override;
  540.     wpclsQueryDetails: override;
  541.     wpclsQueryInstanceFilter: override;
  542.     wpclsQueryStyle: override;
  543.  
  544.   };
  545. #endif /* __SOMIDL__ */
  546. };
  547.  
  548. #endif  /* car_idl */
  549.