ARPDAS_QNX6 1.0
tablelib.c
Go to the documentation of this file.
00001 /*
00002  * File: hello.c
00003  */
00004 #include "tablelib.h"
00005 
00006 char *tbl_labelfont = "TitleFont10ba";
00007 char *tbl_fieldfont = "FixedFont10";
00008 
00009 void tbl_vert_sep( PtWidget_t *parent, int x, int y, int h, int dbl ) {
00010   PtArg_t args[5];
00011   PhPoint_t pos;
00012   PhDim_t dim;
00013 
00014   pos.x = x; pos.y = y;
00015   dim.w = 1; dim.h = h;
00016   PtSetArg( &args[0], Pt_ARG_POS, &pos, 0 );
00017   PtSetArg( &args[1], Pt_ARG_SEP_FLAGS, Pt_SEP_VERTICAL, Pt_SEP_ORIENTATION );
00018   PtSetArg( &args[2], Pt_ARG_DIM, &dim, 0 );
00019   PtSetArg( &args[3], Pt_ARG_SEP_TYPE,
00020             dbl ? Pt_DOUBLE_LINE : Pt_SINGLE_LINE, 0 );
00021   PtSetArg(&args[4], Pt_ARG_COLOR, Pg_CYAN, 0 );
00022   PtCreateWidget(PtSeparator, parent, 5, args );
00023 }
00024 
00025 void tbl_horiz_sep( PtWidget_t *parent, int x, int y, int w, int dbl ) {
00026   PtArg_t args[4];
00027   PhPoint_t pos;
00028   PhDim_t dim;
00029 
00030   pos.x = x; pos.y = y;
00031   dim.w = w; dim.h = 1;
00032   PtSetArg( &args[0], Pt_ARG_POS, &pos, 0 );
00033   PtSetArg( &args[1], Pt_ARG_DIM, &dim, 0 );
00034   PtSetArg( &args[2], Pt_ARG_SEP_TYPE,
00035             dbl ? Pt_DOUBLE_LINE : Pt_SINGLE_LINE, 0 );
00036   PtSetArg(&args[3], Pt_ARG_COLOR, Pg_CYAN, 0 );
00037   PtCreateWidget(PtSeparator, parent, 4, args );
00038 }
00039 
00040 
00041 PtWidget_t *tbl_label_widget( PtWidget_t *window, const char *text,
00042                 int x, int y, const char *font, PgColor_t color, int align ) {
00043   PhPoint_t pos;
00044   PtArg_t args[8];
00045 
00046   pos.x = x; pos.y = y;
00047   PtSetArg(&args[0], Pt_ARG_TEXT_STRING, text, 0); 
00048   PtSetArg(&args[1], Pt_ARG_POS, &pos, 0 );
00049   PtSetArg(&args[2], Pt_ARG_TEXT_FONT, font, 0 );
00050   PtSetArg(&args[3], Pt_ARG_COLOR, color, 0 );
00051   PtSetArg(&args[4], Pt_ARG_HORIZONTAL_ALIGNMENT, align, 0 );
00052   PtSetArg(&args[5], Pt_ARG_MARGIN_WIDTH, 0, 0 );
00053   PtSetArg(&args[6], Pt_ARG_MARGIN_HEIGHT, 0, 0 );
00054   return PtCreateWidget(PtLabel, window, 7, args);
00055 }
00056 
00057 PtWidget_t *tbl_label( PtWidget_t *window, const char *text, int x, int y ) {
00058   return tbl_label_widget( window, text, x, y, tbl_labelfont,
00059                 Pg_GREEN, Pt_LEFT ); 
00060 }
00061 
00062 PtWidget_t *tbl_field( PtWidget_t *window, const char *text, int x, int y,
00063                         int w, int h ) {
00064   PtWidget_t *fld;
00065   PhDim_t dim;
00066 
00067   fld = tbl_label_widget( window, text, x, y, tbl_fieldfont,
00068         Pg_WHITE, Pt_RIGHT ); 
00069   dim.w = w; dim.h = h;
00070   PtSetResource( fld, Pt_ARG_DIM, &dim, 0 );
00071   return fld;
00072 }
00073 
00074 PtWidget_t *tbl_window( const char *title, int width, int height ) {
00075   PtArg_t args[8];
00076   PtSetArg(&args[0], Pt_ARG_WINDOW_TITLE, title, 0); 
00077   PtSetArg(&args[1], Pt_ARG_WINDOW_MANAGED_FLAGS,
00078       Pt_FALSE, Ph_WM_MAX | Ph_WM_RESIZE );
00079   PtSetArg(&args[2], Pt_ARG_WINDOW_MANAGED_FLAGS,
00080       Pt_TRUE, Ph_WM_COLLAPSE );
00081   PtSetArg(&args[3], Pt_ARG_WIDTH, width, 0); 
00082   PtSetArg(&args[4], Pt_ARG_HEIGHT, height, 0); 
00083   PtSetArg(&args[5], Pt_ARG_WINDOW_RENDER_FLAGS,
00084       Pt_FALSE, Ph_WM_RENDER_MAX | Ph_WM_RENDER_RESIZE );
00085   PtSetArg(&args[6], Pt_ARG_WINDOW_RENDER_FLAGS,
00086       Pt_TRUE, Ph_WM_RENDER_COLLAPSE );
00087   PtSetArg(&args[7], Pt_ARG_FILL_COLOR, Pg_BLACK, 0); 
00088   return PtCreateWidget( PtWindow, Pt_NO_PARENT, 8, args );
00089 }
00090 
00091 void tbl_dispfield( PtWidget_t *field, const char *text ) {
00092   PtSetResource( field, Pt_ARG_TEXT_STRING, text, 0 );
00093 }
00094 
00095 int tbl_ExtentText( const char *font, const char *str, PhRect_t *extent ) {
00096   PhRect_t *extp = PfExtentText( extent, NULL, font, str, 0 );
00097   if ( extp == NULL ) return 0;
00098   else return 1;
00099 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines