home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / BLAKJAK.PAK / OWLMAIN.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  3KB  |  127 lines

  1. //-----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1995 by Borland International
  3. // Owlmain.h
  4. //-----------------------------------------------------------------------------
  5.  
  6. #ifndef __OWLMAIN_H
  7. #define __OWLMAIN_H
  8.  
  9. class TBlackjackFrame: public TFrameWindow
  10. {
  11. public:
  12.  
  13.     TWindow* BlackjackDialog;
  14.     TBlackjackFrame(  TWindow * ParentWindow,
  15.                              const char far * title,
  16.                              TWindow *clientWnd,
  17.                              BOOL ShrinkToClient)
  18.           :TFrameWindow(ParentWindow,
  19.                              title,
  20.                              clientWnd,
  21.                              ShrinkToClient)
  22.           {/*Empty body */}
  23.  
  24.     ~TBlackjackFrame(){/* Empty body */}
  25.  
  26.     // Center the frame windows initial position here
  27.     void SetupWindow();
  28. };
  29.  
  30. class TBlackjack : public TDialog
  31. {
  32. private:
  33.     static const int TextLen;
  34.     int BankRollEnteredFirstTime;
  35.     char prevBet[20];
  36.     char prevBankroll[20];
  37.  
  38. public:
  39.     TBrush      Brush;
  40.     TButton     *pBankrollBtn;
  41.     TButton     *pBetBtn;
  42.     TButton     *pHitBtn;
  43.     TButton     *pStandBtn;
  44.  
  45.     TStatic     *pIdDispBankroll1;
  46.     TStatic     *pIdDispBet;
  47.     TStatic     *pIdDispPPoints;
  48.     TStatic     *pIdDispDPoints;
  49.  
  50.     TEdit       *pEInputBankRoll;
  51.     TEdit       *pEInputBet;
  52.  
  53.     TFilterValidator *pValidBankRoll;
  54.     TFilterValidator *pValidBet;
  55.     TVbxMhCardDeck   *ppVBXCard[52];
  56.  
  57.     // VBXCardCount, keeps the card count of the  VBX cards.
  58.     // Count 12 means, 0 to 11 cards have been dealt.
  59.     int VBXCardCount;
  60.  
  61.     TInputDialog *pInputDialog;
  62.  
  63.     // This is the black jack class.
  64.     Blackjack bj;
  65.  
  66.     TBlackjack(TWindow *pWin);
  67.     ~TBlackjack();
  68.  
  69.     // Displays the cards in the dialog.
  70.     void   InitBlackjack();
  71.  
  72.  
  73.  
  74. protected:
  75.     void     SetupWindow();
  76.     BOOL     EvInitDialog(HWND hWnd);
  77.     void     DisplayCardOnTable();
  78.     void     RemoveAllCardsOnTable();
  79.     void     IdStandBtn();
  80.     void     IdHitBtn();
  81.     void        IdBankrollBtn();
  82.     void        IdBetBtn();
  83.     void         ProcessBetButton();
  84.     void         ProcessPlayButton();
  85.     void     IdDispPPoints();
  86.     void     gameOverCleanupBusted(int )throw(const char *);
  87.     void         CheckBankRollInput();
  88.     void        CheckBetInput();
  89.     operator << (Dealer &rhs);
  90.     operator << (Player &rhs);
  91.  
  92.   DECLARE_RESPONSE_TABLE(TBlackjack);
  93. };
  94.  
  95. class TBlackjackApp : public TApplication {
  96. public:
  97.     TVbxMhCardDeck *pCard;
  98.     TBlackjackApp(const char far* name) : TApplication(name) {}
  99.     ~TBlackjackApp();
  100.  
  101.     void   InitMainWindow();
  102.     void   IdAbout();
  103.  
  104.     LRESULT       EvCommand(UINT, HWND, UINT);
  105.     DECLARE_RESPONSE_TABLE(TBlackjackApp);
  106. };
  107.  
  108. class MovableDialog: public TDialog
  109. {
  110. private:
  111.     int topLeftX, topLeftY;
  112. public:
  113.     MovableDialog(int topLeft_x, int topLeft_y, TWindow *pWin, TResId id):
  114.     TDialog(pWin, id),
  115.     topLeftX(topLeft_x), topLeftY(topLeft_y){}
  116.  
  117.     ~MovableDialog(){};
  118.  
  119.     // Move the dialog here
  120.     void SetupWindow();
  121. };
  122.  
  123. int ConvToVBXNum(int cardNum);
  124. int ConvToVBXSuite(int cardSuite);
  125.  
  126. #endif
  127.