当前位置:编程学习 > Delphi >>

Delphi 应用 openmotif 库实例

Delphi 应用库 openmotif-2.3.1 创建windows的实例,部分源代码:

\

program xdr1;

uses
  SysUtils,
  Xlib, Libc, Xpm, LibcArpa, LibcElf, LibcRpc,LibcRpcSvc, Types;

 

type


  PWidgetList = ^WidgetList;
  Widget = ^WidgetRec;


  _CorePart = record
  self:Widget;  //Describedbelow
  widget_class:WidgetClass;
  parent:Widget;
  being_destroyed:Boolean;
  destroy_callbacks:XtCallbackList;
  constraints:XtPointer;
  x:Position;
  y:Position;
  width:Dim;
  height:Dim;
  border_width:Dim;
  managed:Boolean;
  sensitive:Boolean;
  ancestor_sensitive:Boolean;
  accelerators:XtTranslations;
  border_pixel:Pixel;
  border_pixmap:Pixmap;
  popup_list:WidgetList;
  num_popups:Cardinal;
  name:PAnsiChar;
  screen:PScreen;
  cmap:Colormap;
  window:Window;
  depth:Cardinal;
  background_pixel:Pixel;
  background_pixmap:Pixmap;
  visible:Boolean;
  mapped_when_managed:Boolean;
  end;
  CorePart = _CorePart;

  WidgetRec = record
  core:_CorePart;
  end; //*Widget, CoreRec, *CoreWidget;

 

 

  FunctionXtSetLanguageProc(app_context:XtAppContext; proc,client_data:Pointer):Pointer;cdecl;external 'libXt.so.6';

  FunctionXtOpenDisplay(a:XtAppContext;displayName,applName,className:PAnsiChar;urlist:XrmOptionDescList;
   n:Cardinal;argc:PInteger;argv:PAnsiChar):PDisplay;cdecl;external'libXt.so.6';

  FunctionXtIsApplicationShell(w:widget):Boolean;cdecl;external'libXt.so.6';
  FunctionXtIsTopLevelShell(w:widget):Boolean;cdecl;external'libXt.so.6';
 
  Function XtAppInitialize(varContxt:XtAppContext;appclass:PAnsiChar;option:XrmOptionDescList;n:Cardinal;
 argc:PInteger;argv,fallback_res:PPAnsiChar;args:PArgList;argn:Cardinal):Widget;cdecl;external'libXt.so.6';

  FunctionXtCreateWidget(n:PAnsiChar;widget_class:WidgetClass;par:Widget;args:PArgList;argn:Cardinal):Widget;cdecl;external'libXt.so.6';

  FunctionXtWidgetToApplicationContext(w:widget):XtAppContext;cdecl;external'libXt.so.6';

  FunctionXtToolkitInitialize:XtAppContext;cdecl;external 'libXt.so.6';
  FunctionXtCreateApplicationContext:XtAppContext;cdecl;external'libXt.so.6';

  FunctionXtManageChild(c:Widget):Pointer;cdecl;external 'libXt.so.6';

  Function XtVaOpenApplication(varapp_context:XtAppContext;app_class:PAnsiChar;options:XrmOptionDescList;
   no:Cardinal;argc:PInteger;argv_in_out,fallback_res:PPAnsiChar;widget_class:WidgetClass;
   args:PArgList):Widget;cdecl;external 'libXt.so.6';

  FunctionXtAppMainLoop(app:XtAppContext):Pointer;cdecl;external'libXt.so.6';

  FunctionXtRealizeWidget(w:widget):Pointer;cdecl;external'libXt.so.6';

  Function XtOpenApplication(varapp_context:XtAppContext; app_class:PAnsiChar;options:XrmOptionDescList;
   num_options:Cardinal;argc:PInteger;argv_in_out,fallback_res:PPAnsiChar;widget_class:WidgetClass;
   args:PArgList; num_args:Cardinal):Widget;cdecl;external'libXt.so.6';

 


XtSetLanguageProc(nil, @neditLanguageProc, nil);
// Initialize X toolkit (does not open display yet)
XtToolkitInitialize; //MrmInitialize;  UIL Resource Manager (URM)
context := XtCreateApplicationContext;
XtAppSetFallbackResources(context, @fallbacks);
mainWidget:=XtAppInitialize(context,'main_WT',nil,0,@rt_int,@argv,nil,nil,0);
dsp :=XtOpenDisplay(context,nil,APP_NAME,application_class,nil,0,@rt_int,@argv);
//TOPLEVEL :=XtVaAppInitialize(context,'TOPLEVEL',nil,0,@rt_int,@argv,fallbacks,nil);
TOPLEVEL:=XtVaOpenApplication(context,'TOPLEVEL',nil,0,@rt_int,@argv,nil,mainWidget.core.widget_class,nil);

Parent := XmCreateFrame(TOPLEVEL, 'Parent', nil, 0);
XtManageChild(Parent);
TextF1 := XmCreateTextField(Parent, 'TextF1', nil, 0);
XtManageChild(TextF1);

label1 := XtCreateWidget('label1', Parent.core.widget_class,Parent,nil,0);
XtManageChild(label1);
note1 := XmCreateNotebook(Parent, 'Notebook',nil,0);
XtManageChild(note1);


 

补充:软件开发 , Delphi ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,