//#====START_GENERATED_PROLOG======================================
//#
//#
//#   COMPONENT_NAME: odother
//#
//#   CLASSES: none
//#
//#   ORIGINS: 82,27
//#
//#
//#   (C) COPYRIGHT International Business Machines Corp. 1995,1996
//#   All Rights Reserved
//#   Licensed Materials - Property of IBM
//#   US Government Users Restricted Rights - Use, duplication or
//#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//#   	
//#   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
//#   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//#   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//#   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
//#   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
//#   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
//#   OR PERFORMANCE OF THIS SOFTWARE.
//#
//#====END_GENERATED_PROLOG========================================
//#
// @(#) 1.2 com/src/samples/cardgame/iodcard.idl, odcardgamepart, od96nt, odnt9712d 11/1/96 20:40:44 [3/21/97 17:40:22]

#ifndef _CARDGAME_
#define _CARDGAME_


#ifndef _SIMPLPRT_
#include <iodsimpl.idl>
#endif


#ifdef __PRIVATE__
//=====================================================================================
// Implementation Types
//=====================================================================================

   typedef unsigned long ULONG;
   typedef ULONG HMODULE;

#ifdef _PLATFORM_OS2_
   typedef ULONG HBITMAP;
#endif

#endif


interface M_CardGame;

#ifdef _OPENDOC_1_0_
interface ODViewExtension;
interface CardGameNotebook;
#endif


interface CardGame : SimplePart
{
#ifdef __PRIVATE__

        void CommonInitCardGame();
        void LoadMyMenuBar();
        void MessageBox(in ODPlatformWindow hwnd, in char* title, in char* msg);
        void SizeFrame(in ODFacet facet);
        void CreateEmbeddedBMPParts(in ODFacet facet, in ODBoolean FirstFive);
        void CreateEmbeddedControls(in ODPlatformWindow hwnd);
        void ResizeEmbeddedBMPParts(in ODFacet facet, in ODPoint scale);
        void ResizeEmbeddedControls(in double frameWidth, in ODPoint origin);
        char* DetermineCardBitmapFileName(in short index);
        void SetCardBitmap(in short card, in short index, in ODBoolean player);
        void SetIconHandles();
        void SetTextFields();
        void SetTextColors();
        ODBoolean HandlePushButton(in ODFacet facet, in short button);
        short GetNewBet(in ODFacet facet);
        ODBoolean PlaceBet(in ODFacet facet);
        ODBoolean Hit();
        ODBoolean Stand();
        ODBoolean DoubleDown();
        ODBoolean Raise(in ODFacet facet);
        ODBoolean Call(in ODFacet facet);
        ODBoolean Fold();
        short RandomNumber();
        short DetermineCardSuit(in short index);
        short DetermineCardNumber(in short index);
        short DetermineCardValue(in short index, in short who);
        short DetermineValueOfHand(in ODBoolean player, in short count);
        short DetermineDealerDiscards();
        short DetermineDealerBet();
        void ReplaceDiscards();
        void ReDrawButtons(in ODFacet facet, in ODBoolean discard);
        void GameOver(in ODFacet facet);
        void NewGame(in ODFacet facet);
        void ChangeGame(in ODFacet facet);
        void SetNewHands();
        void RemoveEmbeddedBMPParts(in ODFacet facet, in ODBoolean FirstFive);
        void RemoveEmbeddedControls();
        void Bankrupt(in ODPlatformWindow hwnd);
#ifdef _OPENDOC_1_0_
        void SendSetDataEvent (in ODPart thePart, in char* filename);
        void InitiateLinking(in ODFacet facet, in ODEventData event);
        void PutThatLinkDown(in ODFacet facet, in ODStorageUnit StorageDrgDrp, in ODPasteAsResult resultPasteAs);
        void WriteLinkData(in ODFacet facet);
        void PushToUndoStack(in ODUShort Value, in ODULong Type);
#endif
#ifdef _PLATFORM_WIN32_
       ODBoolean HandleMouseDown(in ODFacet facet, in ODPoint where, in ODEventData event);
#endif

#endif

#ifdef __SOMIDL__
        implementation
        {
                dllname = "iodcard.dll";
                functionprefix = CardGame;
                metaclass = M_CardGame;
                majorversion = 1;
                minorversion = 0;

        override:
        somInit,
        RequestFrameShape,
        FacetAdded,
        FacetRemoved,
        GeometryChanged,
        ViewTypeChanged,
        Draw,
#ifdef _OPENDOC_1_0_
        DragEnter,
        DragWithin,
        DragLeave,
        Drop,
        CreateLink,
        LinkUpdated,
        LinkStatusChanged,
        UndoAction,
        RedoAction,
#endif
        HandleEvent,
        HandleMenuEvent,
        AdjustMenus,
        FocusAcquired,
        FocusLost,
        Externalize,
#ifdef _OPENDOC_1_0_
        HandleMouseDown,
        CreateEmbeddedFramesIterator,
        HasExtension,
        AcquireExtension,
        ReleaseExtension,
#endif
        InitPart,
        InitPartFromStorage;

        releaseorder:
                CommonInitCardGame,
                LoadMyMenuBar,
                MessageBox,
                SizeFrame,
                CreateEmbeddedBMPParts,
                CreateEmbeddedControls,
                ResizeEmbeddedBMPParts,
                ResizeEmbeddedControls,
                DetermineCardBitmapFileName,
                SetCardBitmap,
                SetIconHandles,
                SetTextFields,
                SetTextColors,
                HandlePushButton,
                GetNewBet,
                PlaceBet,
                Hit,
                Stand,
                DoubleDown,
                Raise,
                Call,
                Fold,
                RandomNumber,
                DetermineCardSuit,
                DetermineCardNumber,
                DetermineCardValue,
                DetermineValueOfHand,
                DetermineDealerDiscards,
                DetermineDealerBet,
                ReplaceDiscards,
                ReDrawButtons,
                GameOver,
                NewGame,
                ChangeGame,
                SetNewHands,
                RemoveEmbeddedBMPParts,
                RemoveEmbeddedControls,
                Bankrupt,
#ifdef _OPENDOC_1_0_
                SendSetDataEvent,
                InitiateLinking,
                PutThatLinkDown,
                WriteLinkData,
                PushToUndoStack
#endif
#ifdef _PLATFORM_WIN32_
                HandleMouseDown
#endif
                        ;

    #ifdef __PRIVATE__
        passthru C_xh_after = "typedef long RGBColor;";

        // instance variables

                ODSession               MySession;
                ODPart                  MyWrapper;
                ODMenuBar               MyMenuBar;
                HMODULE                 MyResources;

#ifdef _OPENDOC_1_0_
                CardGameNotebook        MyNoteBook;
                ODViewExtension         ViewExtension;

                HBITMAP                 SmallIcon;
                HBITMAP                 LargeIcon;
#endif


                ODPart                  DealerBMPPartWrapper[8];
                ODPart                  PlayerBMPPartWrapper[8];

                ODFacet                 DealerCardFacet[8];
                ODFacet                 PlayerCardFacet[8];
                ODFacet                 fDisplayFacet;
                ODFrame                 fDisplayFrame;

#ifdef _OPENDOC_1_0_
                ODLinkSource            fLinkSourcePtr;
                ODLink                  fLinkPtr;
                ODLinkInfo              fLinkInfo;
                char *                  fLinkStatus;
#endif

                HWND                    TitleHWND;
                HWND                    FrameHWND;
                HWND                    RectangleHWND;
                HWND                    PotHWND;
                HWND                    MoneyHWND;
#ifdef _OPENDOC_1_0_
                HWND                    MoneyLinkHWND;
#endif
                HWND                    BetHWND;
                HWND                    Button1HWND;
                HWND                    Button2HWND;
                HWND                    Button3HWND;
                HWND                    DiscardHWND;
                HWND                    HeartIconHWND;
                HWND                    SpadeIconHWND;
                HWND                    DiamondIconHWND;
                HWND                    ClubIconHWND;
                ODBoolean               EnableHelpItems;
                ODBoolean               StartOfRound;
                ODBoolean               DealerHasAce;
                ODBoolean               PlayerHasAce;
                ODBoolean               DealerFolded;
                ODBoolean               PlayerFolded;
                ODBoolean               ShowDealerCards;
                ODBoolean               BeforeDiscards;
                ODBoolean               AllowDiscards;
                ODBoolean               InLink;
                ODBoolean               Link_Server;
                ODBoolean               Link_1;
                ODBoolean               Link_2;
                ODULong                 CurrentUpdateID;
                double                  FrameWidthRatio;
                double                  FrameHeightRatio;
                short                   CurrentGame;
                short                   NextGame;
                short                   DealerCardCount;
                short                   PlayerCardCount;
                short                   DealerCard[8]; /* Zero pos not used */
                short                   PlayerCard[8]; /* Zero pos not used */
                short                   Discards[11];
                short                   DiscardCount;
                short                   DealerSum;
                short                   PlayerSum;
                short                   Money;
#ifdef _OPENDOC_1_0_
                short                   Money_Link;
#endif
                short                   Bet;
                short                   NextBet;
                short                   Ante;
                short                   Pot;

                ODTypeToken             ViewAsSmallIcon;
                ODTypeToken             ViewAsLargeIcon;
                ODTypeToken             ViewAsThumbnail;
                ODTypeToken             ViewAsFrame;

                ODTypeToken             DefaultPresentation;

                ODTypeToken             MenuFocus;

    #endif

        };
#endif
};

//};  //# Module CardGame


// Added for Part Registration

interface M_CardGame : M_ODPart
{

#ifdef __SOMIDL__
  implementation
  {
    functionprefix = M_CardGame;
    override:
      clsGetODPartHandlerName,
      clsGetODPartHandlerDisplayName,
      clsGetODPartKinds,
      clsGetOLE2ClassId,
      clsGetWindowsIconFileName;
  };
#endif
};

#endif  // _CARDGAME_

