コード例 #1
0
ファイル: gendlg.c プロジェクト: MikeyG/open-watcom-v2
extern a_dialog_header *AddNewDialog( const char *dlg_name )
/**********************************************************/
// Add new dialogs to front of linked list.
// Delete default dialogs if specified.
{
    a_dialog_header *tmp_dialog;
    a_dialog_header *new_dialog;

    new_dialog = (a_dialog_header *)GUIMemAlloc( sizeof( a_dialog_header ) );
    memset( new_dialog, '\0', sizeof( *new_dialog ) );
    new_dialog->name = GUIStrDup( dlg_name, NULL );
    new_dialog->adjusted = false;
    new_dialog->def_dlg = false;
    new_dialog->defaults_set = false;
    new_dialog->ret_val = DLG_NEXT;
    new_dialog->any_check = NO_VAR;
    new_dialog->pVariables[0] = NO_VAR;
    new_dialog->pConditions[0] = NULL;

    /* check if old dialog existed */
    tmp_dialog = FindDialogByName( dlg_name );
    if( tmp_dialog != NULL ) {
        new_dialog->next = tmp_dialog->next;
        new_dialog->prev = tmp_dialog->prev;
        if( new_dialog->next != NULL ) {
            new_dialog->next->prev = new_dialog;
        }
        if( new_dialog->prev != NULL ) {
            new_dialog->prev->next = new_dialog;
        }
        if( FirstDialog == NULL ) {
            FirstDialog = new_dialog;
            LastDialog = new_dialog;
        }
        if( FirstDialog == tmp_dialog ) {
            FirstDialog = new_dialog;
        }
        if( LastDialog == tmp_dialog ) {
            LastDialog = new_dialog;
        }
        FreeDialog( tmp_dialog );        // replace old default dialog
    } else {
        new_dialog->prev = LastDialog;
        new_dialog->next = NULL;
        if( FirstDialog == NULL ) {
            FirstDialog = new_dialog;
            LastDialog = new_dialog;
        } else {
            LastDialog->next = new_dialog;
        }
        LastDialog = new_dialog;
    }

    return( new_dialog );
}
コード例 #2
0
ファイル: gendlg.c プロジェクト: MikeyG/open-watcom-v2
extern void FreeDefaultDialogs( void )
/************************************/
{
    a_dialog_header *d;
    a_dialog_header *next;

    for( d = FirstDialog; d != NULL; d = next ) {
        next = d->next;
        FreeDialog( d );
    }
    FirstDialog = NULL;
    LastDialog = NULL;
}
コード例 #3
0
ファイル: Dialog.c プロジェクト: jljusten/efi-sct
EFI_STATUS
DoDialog(
  IN CHAR16                        *DialogTitle,
  IN OUT EFI_DIALOG_CONTEXT        *DialogContext
  )
/*++

Routine Description:

  The entry point to do popup menu.

Arguments:

  DialogContext The FILE_DIALOG_CONTEXT,it contains filter
  filename string.

Returns:

  EFI_SUCCESS.

--*/
{
  EFI_STATUS                      Status;
  EFI_DIALOG                      *Dialog;

  UINTN                           ConAttrib;

  if (DialogContext == NULL) {
    return EFI_INVALID_PARAMETER;
  }

  Status                = EFI_SUCCESS;

  ConAttrib             = ST->ConOut->Mode->Attribute;
  Status = BS->AllocatePool (
                 EfiBootServicesData,
                 sizeof(EFI_DIALOG),
                 (VOID*)&Dialog
                 );
  if (EFI_ERROR(Status)) {
    return EFI_OUT_OF_RESOURCES;
  }
  BS->SetMem (Dialog, sizeof(EFI_DIALOG), 0);

  Dialog->Type = DialogContext->Type;

  //
  //set Dialog Title
  //
  Dialog->Title = DialogTitle;

  if ( Dialog->Title == NULL ) {
    BS->FreePool (Dialog);
    return EFI_OUT_OF_RESOURCES;
  }

  //
  //initialize the item values
  //
  Dialog->BodyRect.TopLeft.Row      = 10;
  Dialog->BodyRect.TopLeft.Col      = 18;
  Dialog->BodyRect.BottomRight.Row  = 17;
  Dialog->BodyRect.BottomRight.Col  = 62;

  Dialog->ForeColor = EFI_POPUP_MENU_FORECOLOR;
  Dialog->BackColor = EFI_BLUE;

  //
  //initialize the default pointer and item values
  //

  Status = DisplayDialog (Dialog, DialogContext);

  FreeDialog(Dialog);

  //
  //
  //restore original console attribute
  //
  ST->ConOut->SetAttribute ( ST->ConOut,ConAttrib);

  return EFI_SUCCESS;
}