Example #1
0
gui_control *GUIAddAControl( gui_control_info *ctl_info, gui_window *wnd )
{
    dialog_node *dlg_node;
    VFIELD      *new_field;
    gui_control *control;

    dlg_node = GUIGetDlgByWnd( wnd );
    if( dlg_node == NULL ) {
        return( NULL );
    }
    if( !ResetFieldSize( dlg_node, dlg_node->num_controls + 1 ) ) {
        return( NULL );
    }
    new_field = &dlg_node->ui_dlg_info->fields[dlg_node->num_controls];
    if( !GUIDoAddControl( ctl_info, wnd, new_field ) ) {
        ResetFieldSize( dlg_node, dlg_node->num_controls );
        return( NULL );
    }

    control = GUIInsertControl( wnd, ctl_info, dlg_node->num_controls );
    if( control == NULL ) {
        GUIDoFreeField( new_field, NULL );
        ResetFieldSize( dlg_node, dlg_node->num_controls );
    }
    return( control );
}
Example #2
0
bool GUIInsertDialog( gui_window *wnd )
{
    a_dialog    *ui_dlg_info;
    dialog_node *dlg_node;

    if( GUIGetDlgByWnd( wnd ) != NULL ) {
        return( true );
    } else {
        ui_dlg_info = (a_dialog *)GUIMemAlloc( sizeof( a_dialog ) );
        if( ui_dlg_info == NULL ) {
            return( false );
        }
        memset( ui_dlg_info, 0, sizeof( a_dialog ) );
        ui_dlg_info->vs = &wnd->screen;
        if( InsertDialog( wnd, ui_dlg_info, 0, NULL, false ) ) {
            dlg_node = GUIGetDlgByWnd( wnd );
            if( dlg_node != NULL ) {
                if( ResetFieldSize( dlg_node, 0 ) ) {
                    uireinitdialog( ui_dlg_info, ui_dlg_info->fields );
                    return( true );
                }
            }
        }
        return( false );
    }
}
logical DesignerMode :: ContextMenuEvent (QContextMenuEvent *pQContextMenuEvent, QWidget *event_target )
{
logical                 term = YES;
QAction                *action;
bool ok = FALSE;
QString text;
BEGINSEQ
  if ( !context_menu )
    CreateContextMenu();

  if ( !ctx_design || !control )                     ERROR

  if ( action = context_menu->exec(pQContextMenuEvent->globalPos()) )
  switch ( action->data().toInt() )
  {
    case DMC_Label:
      ctx_design->EditFieldLabel(control);
    break;
    case DMC_Edit:
      ctx_design->EditField(control);
    break;
    case DMC_Refresh:
      ctx_design->RefreshField(control);
    break;
    case DMC_ResetSize:
      ResetFieldSize();
    break;
    case DMC_Preview:
      ctx_design->Preview(!ctx_design->HasPreview());
    break;
    case DMC_ReloadControl:
      ctx_design->RefreshControl();
    break;
    case DMC_Delete:
      ctx_design->DeleteField(control);
    break;
  }

RECOVER
  term = NO;
ENDSEQ
  return(term);
}