[PATCH] libXt: add example to XtGetResourceList man page

walter harms wharms at bfs.de
Sun Jan 23 08:15:34 PST 2011


add example for XtGetResourceList and XtGetConstraintResourceList
add used structure to page

 Signed-off-by: walter harms <wharms at bfs.de>

---
 man/XtGetResourceList.man |   67 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/man/XtGetResourceList.man b/man/XtGetResourceList.man
index 64aa088..4c6deee 100644
--- a/man/XtGetResourceList.man
+++ b/man/XtGetResourceList.man
@@ -1,3 +1,5 @@
+.\" $Xorg: XtGetRList.man,v 1.3 2000/08/17 19:42:00 cpqbld Exp $
+.\"
 .\" Copyright 1993 X Consortium
 .\"
 .\" Permission is hereby granted, free of charge, to any person obtaining
@@ -24,6 +26,8 @@
 .\" other dealings in this Software without prior written authorization
 .\" from the X Consortium.
 .\"
+.\" $XFree86: xc/doc/man/Xt/XtGetRList.man,v 1.3 2001/02/09 03:47:51 tsi Exp $
+.\"
 .ds tk X Toolkit
 .ds xT X Toolkit Intrinsics \- C Language Interface
 .ds xI Intrinsics
@@ -178,6 +182,69 @@ is set to zero. The list returned by
 should be freed using
 .ZN XtFree
 when it is no longer needed.
+.br
+Constraint resources are inhareted from constraint widgets like the
+XawForm widget. The widget provides e.g. XtNtop.
+.sp
+XtResourceList is a pointer to the following struct:
+.nf
+typedef struct _XtResource {
+    String      resource_name;  /* Resource name                            */
+    String      resource_class; /* Resource class                           */
+    String      resource_type;  /* Representation type desired              */
+    Cardinal    resource_size;  /* Size in bytes of representation          */
+    Cardinal    resource_offset;/* Offset from base to put resource value   */
+    String      default_type;   /* representation type of specified default */
+    XtPointer   default_addr;   /* Address of default resource              */
+} XtResource, *XtResourceList;
+.fi
+.SH EXAMPLE
+The example will dump all resource connected with the labelWidgetClass.
+
+.nf
+#include <stdio.h>
+#include <Intrinsic.h>
+#include <Xaw/Label.h>
+#include <Shell.h>
+/* gcc -I /usr/include/X11/ sample.c -lX11 -lXaw */
+
+void dump_reslist()
+{
+  XtResourceList lst;
+  Cardinal ret;
+  XtGetResourceList(labelWidgetClass,&lst,&ret);
+  while(ret--)
+    {
+      printf("%s\\n",lst[ret].resource_name);
+    }
+  XtFree((char *)lst);
+  XtGetConstraintResourceList(labelWidgetClass,&lst,&ret);
+  while(ret--)
+    {
+      printf("%s\\n",lst[ret].resource_name);
+    }
+  XtFree((char *)lst);
+}
+
+int main(int argc, char *argv[])
+{
+  Widget top,label;
+  XtAppContext app;
+  top=XtOpenApplication(&app,"Xtdemo",
+                         NULL,0,
+                         &argc,argv,
+                         NULL,
+                         applicationShellWidgetClass,
+                         NULL,0);
+  label=XtVaCreateManagedWidget
+    ("Hello World", labelWidgetClass, top,
+     NULL);
+  XtRealizeWidget(top);
+  dump_reslist();
+  return 0;
+}
+.fi
+
 .SH "SEE ALSO"
 XtGetSubresources(3Xt),
 XtOffset(3Xt)
-- 
1.6.0.2



More information about the xorg-devel mailing list