home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / ADDONINC.PAK / ITX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  7.9 KB  |  218 lines

  1. /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2.  
  3.  Created: 1/1/96
  4.  Copyright (c) 1987, 1996 Borland International Inc.  All Rights Reserved.
  5.  $Header:   Y:\admin\bride\addon\deliver\interfac\itx.h_v   1.15   18 Nov 1996 11:30:08   JDOUGLAS  $
  6.  $Revision:   1.15  $
  7.  
  8.  Interface declared in this file:
  9.  
  10.  implemented by IDE
  11.     ITargetManager
  12.     ITargetManagerDialogControl
  13.     ITargetManagerDialogList
  14.     ITargetManagerPropertyDialog
  15.  
  16.  implemented by IDE client
  17.     ITargetType
  18.     ITargetPropertyPage
  19.  
  20.  Overview:
  21.     Client should call ITargetManager::AddTargetType() to register the
  22.     implemented ITargetType interface. ITargetType interface should support
  23.     ITargetPropertyPage interface if it is to be shown in TargetExpert dialog.
  24.  
  25.     Client target must call ITargetManager::TreatAsTarget() in
  26.     ITargetType::ConvertNodeToTarget() to notify Target manager that the node is
  27.     to become a target.
  28.  
  29.     A client can derived from IDE built-in target by calling
  30.     ITargetServer::TargetAdd() or ConvertNodeToTarget() before calling 
  31.     ITargetManager::TreatAsTarget() in ITargetType::ConvertNodeToTarget().
  32.    
  33. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/  
  34. #ifndef __ITX_H
  35. #define __ITX_H
  36.  
  37. #include <ideaddon\common.h>
  38. #include <ideaddon\IPolyStr.h>
  39. #include <ideaddon\itx.uid>
  40.  
  41. /******************************************************************************
  42. *
  43. * ITargetType:
  44. *
  45. *   This implementation only supports TargetType that has one platform.
  46. *   i.e. Addon target can't create a target type like Application [.exe] that
  47. *         supports Win32 and Win 3.1. The workaround is to create both Win32
  48. *         Application [.exe] target and Win 3.1 Application [.exe]. target.
  49. *
  50. *   This simplification greatly reduces the complexity of the interfaces being
  51. *   exposed here.
  52. *
  53. ******************************************************************************/
  54. struct ITargetType : IUnknown {
  55.   //
  56.   // IsTargetable() returns 1 if fileExt matches the target's file extension.
  57.   //
  58.   virtual BOOL BCWADDON_CMETHOD IsTargetable(IPolyString* fileExt) = 0;
  59.   //
  60.   // ConvertNodeToTarget() converts any project node to a target
  61.   //
  62.   virtual ProjectNode BCWADDON_CMETHOD ConvertNodeToTarget(ProjectNode node, IPolyString* name) = 0;
  63.   //
  64.   // ConvertTargetToNode() converts targeg back to a node
  65.   //
  66.   // ProjectNode  node : If node is NULL, then this function should create a
  67.   //                     new node and make the new node a target. Otherwise,
  68.   //                     convert node to a target.
  69.   // IPolyString* name : If node is NULL, name is the name of the new target.
  70.   //                     Otherwise name is ignored.
  71.   //
  72.   // NOTE:  Must call ITargetManager::TreatAsTarget() to notify Target manager
  73.   //        to treat node as target inside COnvertNodeToTarget() implementation.
  74.   //
  75.   virtual STDMETHODIMP ConvertTargetToNode(ProjectNode node) = 0;
  76.  
  77.   //
  78.   //  GetClassID() returns the class id of the target
  79.   //
  80.   //Pointer to CLSID of component object
  81.   //
  82.   virtual HRESULT BCWADDON_CMETHOD GetClassID(CLSID *pClassID) = 0;
  83. };
  84.  
  85. /******************************************************************************
  86. *
  87. * ITargetManager
  88. *
  89. ******************************************************************************/
  90.  
  91. DECLARE_HANDLE   (HTARGET);
  92.  
  93. struct ITargetManager : IUnknown {
  94.   //
  95.   // An target object calls AddTargetType to notify target manager about its 
  96.   // existence
  97.   //
  98.   //
  99.   //  targetType:   ITargetType interface implemented by addon
  100.   //  description:  The text to be displayed in Target type listbox
  101.   //                in TargetExpert dialog.
  102.   //  hInst:        DLL instance that contains the dialog template.
  103.   //  dlgId:        target expert dialog template resource id.
  104.   //         
  105.   virtual HTARGET BCWADDON_CMETHOD AddTargetType( ITargetType* targetType
  106.                                 , IPolyString* description
  107.                                 , HINSTANCE hInst
  108.                                 , UINT dlgId) = 0;
  109.   virtual void BCWADDON_CMETHOD TreatAsTarget( ITargetType* targetType
  110.                                 , ProjectNode targetNode) = 0;
  111. };
  112.  
  113. /******************************************************************************
  114. *
  115. * ITargetManagerDialogControl is the interface used to access the window
  116. * in TargetExpert dialog
  117. *
  118. ******************************************************************************/
  119. struct ITargetManagerDialogControl : IUnknown {
  120.   //
  121.   // Enable() enable or disable a control
  122.   //
  123.   virtual STDMETHODIMP Enable(BOOL fEnable) = 0;
  124. };
  125. /******************************************************************************
  126. *
  127. * ITargetManagerDialogList is the interface to access the combobox and listbox
  128. * control in TargetExpert dialog
  129. *
  130. ******************************************************************************/
  131. struct ITargetManagerDialogList : ITargetManagerDialogControl {
  132.   //
  133.   // Add() add str to the list and return an interger id that identifies
  134.   //  the added string
  135.   //
  136.   virtual STDMETHODIMP_(UINT) Add(IPolyString* str, HTARGET htarget) = 0;
  137.   //
  138.   // Select() selects the item the contains str
  139.   //
  140.   virtual STDMETHODIMP        Select(IPolyString* str) = 0;
  141.   //
  142.   // Clear() clears the content of the listbox or combobox
  143.   //
  144.   virtual STDMETHODIMP        Clear() = 0;
  145. };
  146.  
  147. /******************************************************************************
  148. *
  149. * ITargetManagerPropertyDialog is the interface to access TargetExpert dialog
  150. *
  151. ******************************************************************************/
  152. struct ITargetManagerPropertyDialog : IUnknown {
  153.   //
  154.   // GetTargetTypeList() returns the target type listbox in TargetExpert dialog
  155.   //
  156.   virtual ITargetManagerDialogList* BCWADDON_CMETHOD GetTargetTypeList() = 0;
  157.   // 
  158.   // GetPlatformList() returns the platform combobox in TargetExpert dialog
  159.   //
  160.   virtual ITargetManagerDialogList* BCWADDON_CMETHOD GetPlatformList() = 0;
  161.   // 
  162.   // GetImageList() returns the model combobox in TargetExpert dialog
  163.   //
  164.   virtual ITargetManagerDialogList* BCWADDON_CMETHOD GetImageList() = 0;
  165.   // 
  166.   // GetAdvanceButton() returns the advance button in TargetExpert dialog
  167.   //
  168.   virtual ITargetManagerDialogControl* BCWADDON_CMETHOD GetAdvancedButton() = 0;
  169.   // 
  170.   // GetControlWindow() returns the widnow handle of control id
  171.   //  in TargetExpert dialog
  172.   //
  173.   virtual HWND BCWADDON_CMETHOD GetControlWindow(UINT id) = 0;
  174. };
  175.  
  176. /******************************************************************************
  177. *
  178. * ITargetPropertyPage : A target type implements this interface to display
  179. * UI in TargetExpert dialog
  180. *
  181. ******************************************************************************/
  182. struct ITargetPropertyPage : IUnknown {
  183.   //
  184.   //
  185.   // PlatformSelectionChangeNotification() is called when the supported
  186.   // platform is selected
  187.   //
  188.   virtual void BCWADDON_CMETHOD PlatformSelectionChangeNotification(UINT id) = 0;
  189.   //
  190.   // AdvancedDialog() is called when advance button is clicked
  191.   //
  192.   virtual void BCWADDON_CMETHOD AdvancedDialog(HWND hwndParent) = 0;
  193.   //
  194.   // Setup() is called on the selected target type when the TargetExpert dialog
  195.   //  is displayed initially.
  196.   //
  197.   //
  198.   virtual void BCWADDON_CMETHOD Setup(ProjectNode) = 0;
  199.   //
  200.   // OnCommand() is called to process WM_COMMAD message
  201.   //
  202.   virtual void BCWADDON_CMETHOD OnCommand(UINT id) = 0;
  203.   //
  204.   // MakeTarget() is called when user client Ok in TargetExpert dialog
  205.   //
  206.   //virtual ProjectNode   MakeTarget(ProjectNode node, IPolyString* name) = 0;
  207.   //
  208.   // GetDlgItems() is called to retrieve the control values
  209.   //
  210.   virtual void BCWADDON_CMETHOD GetDlgItems() = 0;
  211.   //
  212.   // SetDlgItems() is called to set the control values
  213.   //
  214.   virtual void BCWADDON_CMETHOD SetDlgItems() = 0;
  215. };
  216.  
  217. #endif // __ITX_H
  218.