[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2392.0. "Misc DECW programming questions." by SFCPMO::GREENE (CASE: No pain, no gain! ) Mon Mar 05 1990 16:34

    I am posting some questions that my customer gave to me about some
    DECwindows programming issues.  I don't know anything about DECwindows
    programming so I thought the readers of this conference would best be
    able to understand and answer the questions here.
    
    If these questions have been posted previously forgive me; but response
    time is on the order of 1+ minutes per command/note.  Thanks in advance
    for the help.
    
    
    						Dave
    
    Customer questions and code example follows:
    
    

         I am attempting to create custom icons for DECwindows applications.
         I have met with limited success.  The following are problems I
         cannot solve using the supplied DECwindows documentation:

           *  The window manager ignores my request if the ICON SIZE is set
              to SMALL in the CUSTOMIZE WINDOW... portion of the Session
              Manager box.   This happens  even when I specify a bitmap
              file of 16x16 pixels instead of the usual 32x32.

           *  I have not succeeded in changing the pixmap that represents
              the SHRINK-TO-ICON button in the window's title bar.


         Additionally, I have the following questions:

           *  What is the purpose of the X$L_HINT_ICON_MASK portion of the
              X$WMHINTS structure?  I attempted to use it the way the
              documentation describes (DECwindows Programming - Volume 2C
              page 8-9)  but it does not seem to work as advertised.

           *  What is the ZOOM state of a window?  Is it supported by
              DECwindows?

           *  What is the correct format to include BITMAP data within the
              body of a FORTRAN program so I do not have to use
              X$READ_BITMAP_FILE?


   ATTACHED CODE EXAMPLE FOLLOWS:


      FUNCTION SFC$SET_ICON ( DPY, WINDOW, ICON_NAME,
     1                        ICON_TEXT, WINDOW_TEXT )
***************************************************************************
*
*    Purpose:  Set's a DECwindows program's ICON pixmap and text.
*              Also set's the program's TITLE BAR text, either
*              implicitly the same as the ICON text, or explicitly.
*
***************************************************************************
*
*  Program Variables:
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Inputs:
*
*         DPY - I4 - Identifies the terminal the program is displaying on
*   ICON_NAME - CH - Name of the BITMAP file to be read and used as an ICON
*   ICON_TEXT - CH - The text to appear in the ICON
* WINDOW_TEXT - CH - The text to appear in the TITLE BAR
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Outputs:
*
* SFC$SET_ICON - I4 - Identifier of the created ICON pixmap
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Local:
*
*          HIGH - I4 - Dummy Variable (PIXMAP height in pixels)
*        STATUS - I4 - Return status variable for the XTOOLKIT routine calls
*          WIDE - I4 - Dummy Variable (PIXMAP Width in pixels)
*          XHOT - I4 - Dummy Variable (Hot Spot X Coordinate)
*          YHOT - I4 - Dummy Variable (Hot Spot Y Coordinate)
*
***************************************************************************

      INCLUDE 'SYS$LIBRARY:DECW$XLIBDEF'

      INTEGER*4 DPY, WINDOW
      INTEGER*4 WIDE, HIGH, XHOT, YHOT
      INTEGER*4 SFC$SET_ICON
      INTEGER*4 STATUS
      CHARACTER*30 ICON_NAME
      CHARACTER*80 ICON_TEXT
      CHARACTER*80 WINDOW_TEXT

      RECORD /X$SIZE_HINTS/ SZHINTS

      STATUS = X$READ_BITMAP_FILE(
     1              DPY,
     2              WINDOW,
     3              ICON_NAME,
     4              WIDE, HIGH,
     5              SFC$SET_ICON,
     6              XHOT, YHOT)

      IF (WINDOW_TEXT .EQ. '') THEN
         WINDOW_TEXT = ICON_TEXT
      ELSE
      ENDIF

      CALL X$SET_STANDARD_PROPERTIES (
     1      DPY,
     2      WINDOW,
     3      WINDOW_TEXT,
     4      ICON_TEXT,
     5      SFC$SET_ICON,
     6      ,
     7      0,
     8      SZHINTS )

      CALL X$SYNC(DPY,.FALSE.)

      RETURN

      END
T.RTitleUserPersonal
Name
DateLines
2392.1two pixmap resources in shellR2ME2::OBRYANWhen in doubt, let the user decide.Mon Mar 05 1990 23:4441
RE:.0

I think I can answer your first question.

>         I am attempting to create custom icons for DECwindows applications.
>           *  The window manager ignores my request if the ICON SIZE is set
>              to SMALL in the CUSTOMIZE WINDOW... portion of the Session
>              Manager box.   This happens  even when I specify a bitmap
>              file of 16x16 pixels instead of the usual 32x32.
First point: the small icon should be 17x17.

Second point: there are TWO pixmap resources on the shell, one is for
the "small" pixmap and one for the "large".  The "small" one is used
on the shell title bar AND, if the session manager is set to "small icon"
mode, it is also used in the icon box.  The large icon resource is only
used in the icon box when "large icon" mode is set.  Naturally, both
resources should be set by the application.

Here is a small C code segment from a sample main program.  (This
code assumes the icons are stored in the UIL/UID file.)

DRMRegisterArg r_toplevel_fetch_arguments[] = {
	{ XtNiconName, (caddr_t) K_ICON_TITLE_NAME },
	{ XtNiconPixmap, (caddr_t) K_BIG_ICON_NAME },
	{ XtNiconifyPixmap, (caddr_t) K_LITTLE_ICON_NAME }};
int l_toplevel_fetch_count = array_size( r_toplevel_fetch_arguments );

   ...

    /* Set the icons and various attributes for this application. */
    if (DwtFetchSetValues(ar_UIHierarchy,
		ar_toplevel_object,		/* shell widget id */
		r_toplevel_fetch_arguments,
		l_toplevel_fetch_count) != DRMSuccess)
	{
	printf("Can't set shell/main_window attributes.\n");
	return 0;
	};

Good luck.
2392.2creating your own icon pixmaps...GSRC::WESTVariables don't, Constants aren'tTue Mar 06 1990 23:0155
RE: .0  (Hi Dave)

  My FORTRAN is rusty so the following is the steps to take in create/changing
your icon pixmap (small) than the code to do the work.  I have done this from
Ada.

  First, you need to create your pixmap.  The easiest way is to use BITMAP.EXE
found in DECW$EXAMPLES (under VMS).  Something like the following:

	$ mc decw$examples:bitmap my_icon.bit 17x17

  Note the size of the pixmap...this is important as was pointed out in .-1.

  Since the property you want to change is unique only to DECwindows you will
need the DEC_WM_HINTS record structure.  This is the property that you will
modify.  I found the structure definition in SYS$LIBRARY:DECW$DWTSTRUCT.FOR
with the spec of STRUCTURE /dwt$wm_hints_rec/.

  You will need to obtain the atom ID of this property.  This is done with
the XInternAtom call using the property name of DEC_WM_HINTS.  The case is
important.

  The next step is to create a bitmap/pixmap ID for your icon.  As was done
in the code example in .0 you want to use the call XReadBitmapFile.  Remember
that a bitmap is really a pixmap with a depth of 1.

  With your object, of type dwt$wm_hints_rec, you want to set the element
dwt$l_hints_value_mask to the value of dec$c_decwm_iconify_pixmap_mask and
then set the element dwt$l_hints_iconify_pixmap to the value of the bitmap
ID returned from the XReadBitmapFile call.

  The window that you will affect is the top level window of your tree.  If
this window is mapped then you will want to unmap it before changing the
property.  After unmapping the window you will want to make the call
XChangeProperty.  The following is what is assigned to each parameter:

  display	=> obvious
  window	=> top_level_window_id
  property_id	=> the_atom_returned_from_XInternAtom
  type_id	=> the_atom_returned_from_XInternAtom
  format	=> 32
  change_mode	=> PropModeReplace
  prop_data	=> dwt$wm_hints_rec_variable
  num_elements	=> 9

  Once this call has been made then just map the window and if all went ok you
should see your icon pixmap.

  I don't believe I've left anything out (I'm doing this from memory...).  If
someone spots an error then please point it out.

  Hope this helps...

					-=> Jim <=-

2392.3...well someone had to...GSRC::WESTVariables don&#039;t, Constants aren&#039;tTue Mar 06 1990 23:1012

   ok...ok...ok...I will say it before someone else does :-)

  In the future, questions like these should be directed to the

	DECWINDOWS_PROGRAMMING

  conference.  (Press KP7 to select this conference)

					-=> Jim <=-

2392.4Some pointersSTAR::CYPRYCHWed Mar 07 1990 09:1214
    See notes #34,  #2361,  #2371 (I am now taping these
    numbers to the wall of my office :-))
    
    In #34 there are some programming examples,  you should
    be sure to allocate the DECWmHints structure, which the
    code portion doesn't do.
    
    This stuff is all documented in DECwindows V2 documentation.
    
    RE: .0  Zooming
    
    DECwindows  window manager does not support zooming.
    
    - Nancy
2392.5Thanks for the help.SFCPMO::GREENECASE: No pain, no gain! Thu Mar 08 1990 13:556
    Thanks for the replies/info/pointers.
    
    
    							Dave
    
    p.s.  Sorry, didn't know about the DECwindows programming conference.