/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    Dialog2.OpenStatic.c
    Author:  Copyright  1994 Julian Smith
    Version: 1.03 (13 Mar 1995)
    Purpose: Dialogue box handling
*/


#include "Defs.h"



void	Desk_Dialog2_OpenDialogStatic( Desk_dialog2_block *dialog2, Desk_window_openpos openpos)
{
Desk_Debug_Assert( dialog2);

if ( dialog2->flags.data.type == Desk_dialog2_type_MENULEAF)
	Desk_Dialog2__CloseDialogInternal( dialog2, Desk_bool_FALSE, Desk_bool_FALSE/*dontdeletewindow*/);
	
else if ( dialog2->flags.data.type == Desk_dialog2_type_STATIC)
	Desk_Dialog2__CloseDialogInternal( dialog2, Desk_bool_FALSE/*dontclosemenu*/, Desk_bool_FALSE/*dontdeletewindow*/);
	/* This dialog2 is already open as a static dialog, so close it, 	*/
	/* but keep its window handle and don't close any existing menu.	*/

else if ( dialog2->flags.data.type == Desk_dialog2_type_MENU)
	Desk_Dialog2__CloseDialogInternal( dialog2, Desk_bool_TRUE/*close exisiting menu*/, Desk_bool_FALSE);
	/* This dialog2 is already open as a menu-window, so close it, 	*/
	/* deleting the menu. This won't be that good in RO2 - it will 	*/
	/* close the existing menu sometimes.				*/



dialog2->flags.data.type	= Desk_dialog2_type_STATIC;
Desk_Dialog2__CommonOpenCode( dialog2);

Desk_Window_Show( dialog2->window, openpos);

return NOERROR;
}

