程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> Delphi 應用 openmotif 庫實例

Delphi 應用 openmotif 庫實例

編輯:Delphi

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);


 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved