home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l040 / 13.ddi / RTLOWL.ZIP / BWCC.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-10-28  |  7.2 KB  |  203 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Turbo Pascal                                    }
  4. {       Borland Custom Control Interface Unit           }
  5. {                                                       }
  6. {       Copyright (c) 1991 Borland International        }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit BWCC;
  11.  
  12. interface
  13.  
  14. uses WinTypes, OWindows, ODialogs;
  15.  
  16. const
  17.   BwccVersion        = $0103;
  18.  
  19. { From version 1.02 onward BWCCGetversion returns a Longint
  20.   The low-order word contains the version number
  21.   and the high-order word contains the locale. }
  22.  
  23. const
  24.   Bwcc_Locale_US    = 1;
  25.   Bwcc_Locale_JAPAN = 2;
  26.  
  27. { Our Custom Dialog class }
  28.   BorDlgClass   = 'BorDlg';
  29.  
  30. { Borland dialog window uses this property for instance data
  31.   users should not use a property with this name! }
  32.   BorDlgProp    = 'FB';
  33.  
  34.   IdHelp        = 998;               { Id of help button }
  35.  
  36. { Button style definitions:
  37.   the Borland buttons use Windows button styles for button type: i.e.
  38.   bs_PushButton/bs_DefPushButton }
  39.  
  40.   Button_Class ='BorBtn';            { Our Bitmap Buttons }
  41.   Radio_Class  ='BorRadio';          { Our radio buttons }
  42.   Check_Class  ='BorCheck';          { Our Checkboxes }
  43.  
  44. { Styles }
  45.   bbs_Bitmap:Longint    =  $8000;    { this is a bitmap static }
  46.   bbs_DlgPaint:Longint  =  $4000;    { used at runtime by dialog class }
  47.   bbs_ParentNotify:Longint=$2000;    { Notify parent of TAB keys and focus }
  48.   bbs_OwnerDraw:Longint =  $1000;    { let parent paint via wm_DrawItem }
  49.  
  50. { Messages }
  51.   bbm_SetBits    =  ( BM_SETSTYLE + 10);
  52.  
  53. { Notifications }
  54.   bbn_SetFocus      =  ( bn_DoubleClicked + 10);
  55.   bbn_SetFocusmouse =  ( bn_DoubleClicked + 11);
  56.   bbn_GotaTab       =  ( bn_DoubleClicked + 12);
  57.   bbn_GotaBTab      =  ( bn_DoubleClicked + 13);
  58.  
  59.   Shade_Class = 'BorShade';
  60.  
  61. {   The following is the name of the window message passed to
  62.     RegisterWindowMessage for CtlColor processing for group box shades:}
  63.   BWCC_CtlColor_Shade = 'BWCC_CtlColor_Shade';
  64.  
  65.   bss_Group         =      1;        {  group box              }
  66.   bss_Hdip          =      2;        {  horizontal border      }
  67.   bss_Vdip          =      3;        {  hertical border        }
  68.   bss_Hbump         =      4;        {  horizontal speed bump  }
  69.   bss_Vbump         =      5;        {  vertical speed bump    }
  70.   bss_RGroup        =      6;        {  raised group box }
  71.  
  72. (*!!  bss_DlgErase      =  $8000;        {  Dialog Window erases for us }
  73.   bss_DlgPaint      =  $4000;        {  Dialog Window paints for us }
  74. *)
  75.   bss_Caption       = $8000;   { Caption is above group }
  76.   bss_CtlColor      = $4000;   { Send wm_CtlColor message to parent of control }
  77.   bss_NoPrefix      = $2000;   { & in caption does not underline the next letter }
  78.   bss_Left          = $0000;   { Caption is left-justified }
  79.   bss_Center        = $0100;   { Caption is centered }
  80.   bss_Right         = $0200;   { Caption is right-justified }
  81.   bss_AlignMask     = $0300;
  82.  
  83.   Static_Class =   'BorStatic';      {  Our statics }
  84.  
  85. { Function declarations }
  86.  
  87. function DialogBox(Instance: THandle; Templatename: PChar;
  88.   WndParent: HWnd; DialogFunc: TFarProc): Integer;
  89. function DialogBoxParam(Instance: THandle; TemplateName: PChar;
  90.   WndParent: HWnd; DialogFunc: TFarProc; InitParam: LongInt): Integer;
  91. function CreateDialog(Instance: THandle; TemplateName: PChar;
  92.   WndParent: HWnd; DialogFunc: TFarProc): HWnd;
  93. function CreateDialogParam(Instance: THandle; TemplateName: PChar;
  94.   WndParent: HWnd; DialogFunc: TFarProc; InitParam: LongInt): HWnd;
  95. function BWCCMessageBox(WndParent: HWnd; Txt, Caption: PChar;
  96.   TextType: Word): Integer;
  97. function BWCCDefDlgProc(Dlg: HWnd; Msg, wParam: Word; lParam:
  98.   LongInt): LongInt;
  99. function BWCCGetPattern: HBrush;
  100. function BWCCGetVersion: Longint;
  101. function SpecialLoadDialog(hResMod: THandle; Templatename: PChar;
  102.   DialogFunc: TFarProc): THandle;
  103. function MangleDialog(hDlg: THandle; hResMod: THandle;
  104.   DialogFunc: TFarProc): THandle;
  105. function BWCCDefWindowProc(hWindow: HWnd; Message, wParam: Word;
  106.   lParam: LongInt): LongInt;
  107. function BWCCDefMDIChildProc(hWindow: HWnd; Message, wParam: Word;
  108.   lParam: LongInt): LongInt;
  109.  
  110. { ObjectWindows objects specific to BWCC }
  111.  
  112. type
  113.   PBDivider = ^TBDivider;
  114.   TBDivider = object(TControl)
  115.     constructor Init(AParent: PWindowsObject; AnId: Integer; AText: PChar;
  116.       X, Y, W, H: Integer;  IsVertical, IsBump: Boolean);
  117.     constructor InitResource(AParent: PWindowsObject; ResourceID: Word);
  118.     function GetClassName: PChar; virtual;
  119.   end;
  120.  
  121.   PBStaticBmp = ^TBStaticBmp;
  122.   TBStaticBmp = object(TControl)
  123.     constructor Init(AParent: PWindowsObject; AnId: Integer; AText: PChar;
  124.       X, Y, W, H: Integer);
  125.     constructor InitResource(AParent: PWindowsObject; ResourceID: Word);
  126.     function GetClassName: PChar; virtual;
  127.   end;
  128.  
  129. implementation
  130.  
  131. function SpecialLoadDialog;             external 'BWCC' index 1;
  132. function DialogBox;                     external 'BWCC' index 2;
  133. function DialogBoxParam;                external 'BWCC' index 3;
  134. function CreateDialog;                  external 'BWCC' index 4;
  135. function CreateDialogParam;             external 'BWCC' index 5;
  136. function BWCCDefDlgProc;                external 'BWCC' index 6;
  137. function BWCCMessageBox;                external 'BWCC' index 9;
  138. function BWCCGetPattern;                external 'BWCC' index 10;
  139. function BWCCGetVersion;                external 'BWCC' index 11;
  140. function MangleDialog;                  external 'BWCC' index 12;
  141. function BWCCDefWindowProc;             external 'BWCC' index 14;
  142. function BWCCDefMDIChildProc;           external 'BWCC' index 15;
  143.  
  144. { TBDivider }
  145.  
  146. constructor TBDivider.Init(AParent: PWindowsObject; AnId: Integer;
  147.   AText: PChar; X, Y, W, H: Integer;  IsVertical, IsBump: Boolean);
  148. begin
  149.   TControl.Init(AParent, AnId, AText, X, Y, W, H);
  150.   DisableTransfer;
  151.   if IsVertical then
  152.     if IsBump then
  153.       Attr.Style := Attr.Style or BSS_VBUMP
  154.     else
  155.       Attr.Style := Attr.Style or BSS_VDIP
  156.   else
  157.     if IsBump then
  158.       Attr.Style := Attr.Style or BSS_HBUMP
  159.     else
  160.       Attr.Style := Attr.Style or BSS_HDIP;
  161. end;
  162.  
  163. constructor TBDivider.InitResource(AParent: PWindowsObject;
  164.   ResourceID: Word);
  165. begin
  166.   TControl.InitResource(AParent, ResourceID);
  167.   DisableTransfer;
  168. end;
  169.  
  170. function TBDivider.GetClassName: PChar;
  171. begin
  172.   GetClassName := 'BORSHADE';
  173. end;
  174.  
  175. { TBStaticBmp }
  176.  
  177. constructor TBStaticBmp.Init(AParent: PWindowsObject; AnId: Integer;
  178.   AText: PChar; X, Y, W, H: Integer);
  179. begin
  180.   TControl.Init(AParent, AnId, AText, X, Y, W, H);
  181.   Attr.Style := Attr.Style or BBS_BITMAP;
  182.   DisableTransfer;
  183. end;
  184.  
  185. constructor TBStaticBmp.InitResource(AParent: PWindowsObject; ResourceID: Word);
  186. begin
  187.   TControl.InitResource(AParent, ResourceID);
  188.   DisableTransfer;
  189. end;
  190.  
  191. function TBStaticBmp.GetClassName: PChar;
  192. begin
  193.   GetClassName := 'BORBTN';
  194. end;
  195.  
  196. begin
  197.   OWindows.CreateDialogParam := CreateDialogParam;
  198.   OWindows.DialogBoxParam := DialogBoxParam;
  199.   OWindows.DefDlgProc := BWCCDefDlgProc;
  200.   OWindows.MessageBox := BWCCMessageBox;
  201.   OWindows.BWCCClassNames := True;
  202. end.
  203.