///////////////////////////////////////////////////////////////////////////////
//////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
//                                                                           //
// This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;    //
// the contents of this file may not be disclosed to third parties, copied   //
// or duplicated in any form, in whole or in part, without the prior written //
// permission of Silicon Graphics, Inc.                                      //
//                                                                           //
// RESTRICTED RIGHTS LEGEND:                                                 //
// Use,duplication or disclosure by the Government is subject to restrictions /
// as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data    //
// and Computer Software clause at DFARS 252.227-7013, and/or in similar or  //
// successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -   //
// rights reserved under the Copyright Laws of the United States.            //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////

#ifndef VKDISPLAY_H
#define VKDISPLAY_H

///////////////////////////////////////////////////////////////////////////////
// VkDisplay.h

#include <X11/Xlib.h>
#include <Vk/VkComponent.h>
#include <Vk/VkComponentList.h>

class VkApp;
class VkScreen;
class VkSimpleWindow;
class VkBusyDialog;
class VkDialogManager;
class VkCursorList;


/*******************************************************
CLASS
    VkDisplay

OVERVIEW

    this class encapsulates the application data which
    is "display" related...

    - every app has at least one "display" object...

******************************************************/

class VkDisplay : public VkComponent {

    friend class VkApp;
    friend class VkScreen;
    friend class VkSimpleWindow;
    friend class VkQuickHelp;

  public:

  // Normal constructor -- most apps should use this one
    VkDisplay(char              *display,
	      char              *name,
	      int               *arg_c, 
	      char             **arg_v,
	      XrmOptionDescRec  *optionList       = NULL,
	      int                sizeOfOptionList = 0);

    virtual      ~VkDisplay();

    Display      *display() const { return _dpy;}
    char         *displayString() const { return _display; }
    char        **argv() const { return _argv; }
    char         *argv(int index);
    int           argc() const { return _argc;}

    // Event handling API...
    //
    void         handleRawHelpEvent(XEvent *event);
    void         handleRawEvent(XEvent *event);

    // Operations on all windows... 
    //
    virtual void raise();
    virtual void lower();
    virtual void iconify();
    virtual void open();
    virtual void show();
    virtual void hide();
    virtual void busy(const char *msg = NULL, 
		      VkSimpleWindow *parent = NULL);
    virtual void veryBusy(const char *msg = NULL, 
			  VkSimpleWindow *parent = NULL);
    virtual void notBusy();
    virtual void progressing(const char *msg = NULL);
    Boolean      isBusy();

    int          windowCount();
    Boolean      hasWindows();

    VkComponentList   *screenList() { return &_scrList; }

    void useOverlayDialogs(const Boolean flag = TRUE);
    void useOverlayHelp(const Boolean flag = TRUE);
    void useOverlayMenus(const Boolean flag = TRUE);

  protected:

    // NOTE:  utility for VkScreen contructor... [ don't touch ]
    void    addScreen( VkScreen *screen );

  private:

    char              **_argv;
    int                 _argc;
    Display            *_dpy;
    VkComponentList     _scrList;
    Boolean             _default;
    char               *_display;

    // Constructors' real initialization code
    void	VkDisplayInitialize(char              *display,
				    char              *name,
				    XrmOptionDescRec  *optionList,
				    int                sizeOfOptionList);

  private:

    // This class is not intended to be copied.  Strangers will get a
    // compile-time error.  Because there is no implementing code, friends
    // and inadvertant local use will get an ld-time error.  If a copy
    // constructor or operator= is ever needed, simply write them and
    // make these entries public.
    VkDisplay(const VkDisplay&);
    VkDisplay &operator =(const VkDisplay&);
}; 

#endif /* VKDISPLAY_H */
