home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / XfeWidgets / tests / DashBoardTest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.7 KB  |  179 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /*-----------------------------------------*/
  19. /*                                                                        */
  20. /* Name:        DashBoardTest.c                                            */
  21. /* Description:    Test for XfeDashBoard widget.                            */
  22. /* Author:        Ramiro Estrugo <ramiro@netscape.com>                    */
  23. /*                                                                        */
  24. /*----------------------------------------------------------------------*/
  25.  
  26.  
  27.  
  28. #include <Xfe/XfeTest.h>
  29.  
  30. static Widget    create_frame_shell            (Widget,String);
  31.  
  32. int
  33. main(int argc,char *argv[])
  34. {
  35.     Widget    frame1;
  36.     Widget    frame2;
  37.     Widget    frame3;
  38.     Widget    frame4;
  39.     
  40.     XfeAppCreate("DashBoardTest",&argc,argv);
  41.     
  42.     frame1 = create_frame_shell(XfeAppShell(),"Frame1");
  43.  
  44.     frame2 = create_frame_shell(XfeAppShell(),"Frame2");
  45.  
  46.     frame3 = create_frame_shell(XfeAppShell(),"Frame3");
  47.  
  48.     frame4 = create_frame_shell(XfeAppShell(),"Frame4");
  49.  
  50.     XtPopup(frame1,XtGrabNone);
  51.  
  52.     XtPopup(frame2,XtGrabNone);
  53.  
  54.     XtPopup(frame3,XtGrabNone);
  55.  
  56.     XtPopup(frame4,XtGrabNone);
  57.  
  58.     XfeAppMainLoop();
  59.  
  60.     return 0;
  61. }
  62. /*----------------------------------------------------------------------*/
  63. static Widget
  64. create_frame_shell(Widget parent,String name)
  65. {
  66.     Widget    frame;
  67.     Widget    form;
  68.     Widget    docked_task_bar;
  69.     Widget    dash_board;
  70.  
  71.     static Widget    floating_shell = NULL;
  72.     static Boolean    first_instance = True;
  73.  
  74.     frame = XtVaCreatePopupShell(name,
  75.                                  xfeFrameShellWidgetClass,
  76.                                  parent,
  77.                                  NULL);
  78.  
  79.     XfeAddEditresSupport(frame);
  80.  
  81.     form = XtVaCreateManagedWidget("Form",
  82.                                    xmFormWidgetClass,
  83.                                    frame,
  84.                                    NULL);
  85.  
  86.     if (first_instance)
  87.     {
  88.         int            mask;
  89.         int            func;
  90.         
  91.         
  92.         Widget floating_task_bar;
  93.         
  94.         first_instance = False;
  95.         
  96.         mask = MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU;
  97.         func = MWM_FUNC_CLOSE | MWM_FUNC_MOVE;
  98.  
  99.         floating_shell =
  100.             XtVaCreatePopupShell("FloatingShell",
  101.                                  xmDialogShellWidgetClass,
  102.                                  XfeAncestorFindApplicationShell(parent),
  103.                                  XmNvisual,                XfeVisual(parent),
  104.                                  XmNcolormap,            XfeColormap(parent),
  105.                                  XmNdepth,                XfeDepth(parent),
  106.                                  XmNmwmDecorations,        mask,
  107.                                  XmNmwmFunctions,        func,
  108.                                  XmNallowShellResize,    True,
  109.                                  XmNdeleteResponse,        XmDO_NOTHING,
  110.                                  NULL);
  111.  
  112.         
  113.         floating_task_bar = XfeCreateLoadedTaskBar(floating_shell,
  114.                                                    "FloatingTaskBar",
  115.                                                    True,
  116.                                                    "Task_",
  117.                                                    NULL,
  118.                                                    4,
  119.                                                    NULL);
  120.     }
  121.  
  122.     dash_board = XtVaCreateManagedWidget("DashBoard",
  123.                                          xfeDashBoardWidgetClass,
  124.                                          form,
  125.                                          NULL);
  126.  
  127.     XtAddCallback(dash_board,XmNdockCallback,XfeDockCallback,NULL);
  128.     XtAddCallback(dash_board,XmNundockCallback,XfeUndockCallback,NULL);
  129.  
  130.     XtVaSetValues(dash_board,
  131.                   XmNfloatingShell,    floating_shell,
  132.                   NULL);
  133.     
  134.     /* Create the progress bar */
  135.     XtVaCreateManagedWidget("ProgressBar",
  136.                             xfeProgressBarWidgetClass,
  137.                             dash_board,
  138.                             XmNusePreferredHeight,        True,
  139.                             XmNusePreferredWidth,        True,
  140.                             XmNshadowThickness,            1,
  141.                             XmNshadowType,                XmSHADOW_IN,
  142.                             XmNhighlightThickness,        0,
  143.                             XmNtraversalOn,                False,
  144.                             NULL);
  145.  
  146.     /* Create the status bar */
  147.     XtVaCreateWidget("StatusBar",
  148.                      xfeLabelWidgetClass,
  149.                      dash_board,
  150.                      XmNusePreferredHeight,        False,
  151.                      XmNusePreferredWidth,        True,
  152.                      XmNshadowThickness,        2,
  153.                      XmNshadowType,                XmSHADOW_IN,
  154.                      XmNhighlightThickness,        0,
  155.                      XmNtraversalOn,            False,
  156.                      NULL);
  157.     
  158.     /* Create the task bar */
  159.     docked_task_bar = XfeCreateLoadedTaskBar(dash_board,
  160.                                              "DockedTaskBar",
  161.                                              False,
  162.                                              "T",
  163.                                              NULL,
  164.                                              4,
  165.                                              NULL);
  166.  
  167.     XtVaSetValues(docked_task_bar,
  168.                   XmNorientation,            XmHORIZONTAL,
  169.                   XmNusePreferredWidth,        True,
  170.                   XmNusePreferredHeight,    True,
  171.                   XmNhighlightThickness,    0,
  172.                   XmNshadowThickness,        0,
  173.                   XmNtraversalOn,            False,
  174.                   NULL);
  175.     
  176.     return frame;
  177. }
  178. /*----------------------------------------------------------------------*/
  179.