Example #1
0
bool GUIXCreateToolBar( gui_window *wnd, bool fixed, gui_ord height,
                       int num_items, gui_toolbar_struct *toolinfo, bool excl,
                       gui_colour_set *plain, gui_colour_set *standout,
                       gui_rect *float_pos )
{
    int         size;
    int         i;
    int         j;
    toolbarinfo *tbar;

    float_pos = float_pos;

    if( ( wnd->parent != NULL ) || ( plain == NULL ) || ( standout == NULL ) ) {
        return( false );
    }
    tbar = wnd->tbinfo = (toolbarinfo *)GUIMemAlloc( sizeof( toolbarinfo ) );
    if( tbar == NULL ) {
        return( false );
    }
    size = sizeof( gui_toolbar_struct ) * num_items;
    tbar->info = (gui_toolbar_struct *)GUIMemAlloc( size );
    if( tbar->info == NULL ) {
        GUIMemFree( tbar );
        wnd->tbinfo = NULL;
        return( false );
    }
    memset( tbar->info, 0, size );
    tbar->excl = excl;
    tbar->has_colours = ( plain != NULL ) && ( standout != NULL );
    if( tbar->has_colours ) {
        tbar->plain.fore = plain->fore;
        tbar->plain.back = plain->back;
        tbar->standout.fore = standout->fore;
        tbar->standout.back = standout->back;
    }
    for( i = 0; i < num_items; i++ ) {
        bool    ok;

        tbar->info[i].label = GUIStrDup( toolinfo[i].label, &ok );
        if( !ok ) {
            for( j = 0; j < i; j++ ) {
                GUIMemFree( (void *)tbar->info[j].label );
            }
            GUIMemFree( tbar->info );
            GUIMemFree( tbar );
            wnd->tbinfo = NULL;
            return( false );
        }
        tbar->info[i].id = toolinfo[i].id;
    }
    tbar->num_items = num_items;
    tbar->floattoolbar = NULL;
    tbar->switching = false;
    if( fixed ) {
        return( GUIXCreateFixedToolbar( wnd ) );
    } else {
        return( CreateFloatingToolbar( wnd, height ) );
    }
}
Example #2
0
bool GUICreateHot( gui_control_info *info, a_hot_spot_field *hot_spot_field )
{
    a_hot_spot  *hot_spot;

    if( hot_spot_field == NULL ) {
        return( false );
    }
    hot_spot = (a_hot_spot *)GUIMemAlloc( sizeof( a_hot_spot ) );
    hot_spot_field->ptr = hot_spot;
    if( hot_spot == NULL ) {
        return( false );
    }
    hot_spot_field->typ = FLD_HOT;
    if( !GUIStrDup( info->text, &hot_spot->str ) ) {
        return( false );
    }
    hot_spot->event = info->id + GUI_FIRST_USER_EVENT;
    hot_spot->row = hot_spot_field->area.row;
    hot_spot->startcol = hot_spot_field->area.col;
    hot_spot->length = hot_spot_field->area.width;
    if( info->control_class == GUI_DEFPUSH_BUTTON ) {
        hot_spot->flags = HOT_DEFAULT;
    } else {
        hot_spot->flags = (unsigned short)NULL;
   }
   return( true );
}
Example #3
0
bool GUIXSetColours( gui_window *wnd, gui_colour_set *colours )
{
    int size;
    int i;

    size = sizeof( ATTR ) * wnd->num_attrs;
    wnd->colours = (ATTR *)GUIMemAlloc( size );
    if( wnd->colours == NULL ) {
        wnd->num_attrs = 0;
        return( false );
    }
    for( i = 0; i < wnd->num_attrs; i++ ) {
        wnd->colours[i] = MakeAttr( colours[i].fore, colours[i].back );
    }
    if( wnd->vbarmenu != NULL ) {
#if !defined( ISQL_COLOURS )
        UIData->attrs[ATTR_MENU]            = wnd->colours[GUI_MENU_FRAME];
        UIData->attrs[ATTR_ACTIVE]          = wnd->colours[GUI_MENU_PLAIN];
        UIData->attrs[ATTR_INACTIVE]        = wnd->colours[GUI_MENU_GRAYED];
        UIData->attrs[ATTR_CURR_INACTIVE]   = wnd->colours[GUI_MENU_GRAYED_ACTIVE];
        UIData->attrs[ATTR_HOT]             = wnd->colours[GUI_MENU_STANDOUT];
        UIData->attrs[ATTR_HOT_QUIET]       = wnd->colours[GUI_MENU_STANDOUT];
        UIData->attrs[ATTR_CURR_ACTIVE]     = wnd->colours[GUI_MENU_ACTIVE];
        UIData->attrs[ATTR_HOT_CURR]        = wnd->colours[GUI_MENU_ACTIVE_STANDOUT];
#endif
        uimenutitlebar();
    }
    return( true );
}
Example #4
0
bool GUIDeleteHintText( gui_window *wnd, int id )
{
    int                 i;
    gui_hint_struct     *new_menu;
    int                 index;
    bool                found;

    found = FALSE;
    if( GUIHasHintType( wnd, MENU_HINT ) ) {
        for( i = 0; (i < wnd->hint.num_menu) && !found; i++ ) {
            if( wnd->hint.menu[i].id == id ) {
                found = TRUE;
                index = i;
            }
        }
        if( found ) {
            new_menu = (gui_hint_struct *)GUIMemAlloc( sizeof( gui_hint_struct )
                                    * ( wnd->hint.num_menu - 1 ) );
            memcpy( new_menu, wnd->hint.menu, sizeof( gui_hint_struct ) * index );
            memcpy( &new_menu[index], &wnd->hint.menu[index+1],
                    sizeof( gui_hint_struct ) * ( wnd->hint.num_menu - index - 1 ) );
            GUIMemFree( wnd->hint.menu );
            wnd->hint.menu = new_menu;
            wnd->hint.num_menu--;
        }
    }
    return( found );
}
Example #5
0
bool GUIListBoxDeleteItem( a_list *list, int choice )
{
    int         size;
    char        **data;
    int         i;

    size = GUIListSize( list );
    if( choice >= size ) {
        return( FALSE );
    }
    data = (char **)list->data;
    list->data = (char ** )GUIMemAlloc( sizeof( char * ) * size );
    if( list->data == NULL ) {
        list->data = data;
        return( FALSE );
    }
    for( i = 0; i < choice; i++ ) {
        ((char**)list->data)[i] = data[i];
    }
    GUIMemFree( data[choice] );
    for( i = choice; i < size; i++ ) {
        ((char **)list->data)[i] = data[i+1];
    }
    GUIMemFree( data );
    if( choice >= GUIListSize( list )  ) {
        list->choice = 0;
    }
    uiupdatelistbox( list );
    return( TRUE );
}
Example #6
0
/*
 * initDialog - initialize all dialog fields
 */
static bool initDialog( gui_window *gui, const char *ext, char *name )
{
    char        path[_MAX_PATH];
    dlg_info    *dlg = GUIGetExtra( gui );

    if( ext != NULL && hasWild( ext ) ) {
        char    *str;
        size_t  len;

        len = strlen( ext ) + 1;
        str = GUIMemAlloc( len );
        GUIMemFree( dlg->currExt );
        dlg->currExt = str;
        if( str == NULL ) {
            return( false );
        }
        memcpy( str, ext, len );
    }
    if( !setFileList( gui, dlg->currExt ) ) {
        return( false );
    }
    if( !setDirList( gui ) ) {
        return( false );
    }
    getcwd( path, sizeof( path ) );
    GUISetText( gui, CTL_DIR_NAME, path );
    if( name != NULL && *name != '\0' ) {
        GUISetText( gui, CTL_EDIT, name );
    } else if( ext != NULL ) {
        GUISetText( gui, CTL_EDIT, ext );
    }
    return( true );

} /* initDialog */
Example #7
0
bool GUIListBoxDeleteItem( a_list *list, gui_ctl_idx choice )
{
    gui_ctl_idx size;
    lb_data     old_data;
    lb_data     new_data;
    gui_ctl_idx i;

    size = GUIListSize( list );
    if( choice >= size ) {
        return( false );
    }
    new_data = (lb_data)GUIMemAlloc( sizeof( char * ) * size );
    if( new_data == NULL ) {
        return( false );
    }
    old_data = (lb_data)list->data_handle;
    for( i = 0; i < choice; i++ ) {
        new_data[i] = old_data[i];
    }
    GUIMemFree( (void *)old_data[choice] );
    for( i = choice; i < size; i++ ) {
        new_data[i] = old_data[i + 1];
    }
    GUIMemFree( (void *)old_data );
    list->data_handle = (const void *)new_data;
    if( choice >= GUIListSize( list )  ) {
        list->choice = 0;
    }
    uiupdatelistbox( list );
    return( true );
}
Example #8
0
static lb_data ResizeList( a_list *list, unsigned num_to_add, gui_ctl_idx *choice )
{
    gui_ctl_idx num;
    lb_data     old_data;
    lb_data     new_data;

    if( list->get == NULL ) {
        list->get = uigetlistelement;
    }
    num = GUIListSize( list );
    new_data = (lb_data)GUIMemAlloc( ( num + num_to_add + 1 ) * sizeof( char * ) );
    if( new_data == NULL ) {
        return( NULL );
    }
    if( *choice == -1 ) {
        *choice = num;
    }
    old_data = (lb_data)list->data_handle;
    if( old_data != NULL ) {
        memcpy( (void *)new_data, old_data, *choice * sizeof( char * ) );
        memcpy( (void *)&new_data[*choice + num_to_add], &old_data[*choice], ( num - *choice ) * sizeof( char * ) );
    }
    new_data[num + num_to_add] = NULL;
    return( new_data );
}
Example #9
0
char *GUIGetListItem( gui_window *wnd, gui_ctl_id id, gui_ctl_idx choice )
{
    int         length;
    char        *text;
    WPI_PARAM1  p1;

    length = (int)GUIToComboList( wnd, id, LB_GETTEXTLEN, CB_GETLBTEXTLEN,
                                   (WPI_PARAM1)choice,
                                   (WPI_PARAM2)NULL, (WPI_MRESULT)NULL );
    if( length > 0 ) {
        text = (char *)GUIMemAlloc( length + 1 );
#ifdef __OS2_PM__
            p1 = MPFROM2SHORT( choice, length + 1 );
#else
            p1 = choice;
#endif
        if( text != NULL ) {
            GUIToComboList( wnd, id, LB_GETTEXT , CB_GETLBTEXT,
                            p1, (WPI_PARAM2)(LPSTR)text, (WPI_MRESULT)NULL );
        }
    } else {
        text = NULL;
    }
    return( text );
}
Example #10
0
bool GUICreateHot( gui_control_info *ctl_info, VFIELD *field )
{
    a_hot_spot  *hot_spot;
    bool        ok;

    if( field == NULL ) {
        return( false );
    }
    hot_spot = (a_hot_spot *)GUIMemAlloc( sizeof( a_hot_spot ) );
    field->u.hs = hot_spot;
    if( hot_spot == NULL ) {
        return( false );
    }
    field->typ = FLD_HOT;
    hot_spot->str = GUIStrDup( ctl_info->text, &ok );
    if( !ok ) {
        return( false );
    }
    hot_spot->event = ctl_info->id + GUI_FIRST_USER_EVENT;
    hot_spot->row = field->area.row;
    hot_spot->startcol = field->area.col;
    hot_spot->length = field->area.width;
    if( ctl_info->control_class == GUI_DEFPUSH_BUTTON ) {
        hot_spot->flags = HOT_DEFAULT;
    } else {
        hot_spot->flags = 0;
    }
    return( true );
}
Example #11
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 );
    }
}
Example #12
0
void GUIInitToolbarHint( gui_window *wnd, int num_items,
                         gui_toolbar_struct *toolbar )
{
    int                 i;
    int                 size;
    gui_hint_struct     *hint_struct;
    int                 num;

    if( GetStructNum( &wnd->hint, TOOL_HINT, &hint_struct, &num ) ) {
        if( hint_struct != NULL ) {
            GUIMemFree( hint_struct );
        }
        size = sizeof( gui_hint_struct ) * num_items;
        if( size == 0 ) {
            hint_struct = NULL;
            num = 0;
        } else {
            hint_struct = (gui_hint_struct *)GUIMemAlloc( size );
            num = num_items;
            for( i = 0; i < num_items; i++ ) {
                hint_struct[i].id = toolbar[i].id;
                hint_struct[i].hinttext = toolbar[i].hinttext;
            }
        }
        SetStructNum( &wnd->hint, TOOL_HINT, hint_struct, num );
    }
}
Example #13
0
void GUIInitHint( gui_window *wnd, int num_menus, gui_menu_struct *menu, hint_type type )
{
    int                 size;
    int                 i;
    int                 index;
    gui_hint_struct     *hint_struct;
    int                 num;

    if( type == TOOL_HINT ) {
        return;
    }
    if( GetStructNum( &wnd->hint, type, &hint_struct, &num ) ) {
        if( hint_struct != NULL ) {
            GUIMemFree( hint_struct );
        }
        num = 0;
        for( i = 0; i < num_menus; i++ ) {
            num += CountMenus( &menu[i] );
        }
        size = sizeof( gui_hint_struct ) * num;
        if( size == 0 ) {
            hint_struct = NULL;
            num = 0;
        } else {
            hint_struct = (gui_hint_struct *)GUIMemAlloc( size );
            index = 0;
            for( i = 0; i < num_menus; i++ ) {
                InsertHint( &menu[i], hint_struct, &index );
            }
        }
        SetStructNum( &wnd->hint, type, hint_struct, num );
    }
}
Example #14
0
static bool FillInEmptyList( a_list *list )
{
    list->choice = 0;
    list->data_handle = (const void *)GUIMemAlloc( sizeof( char * ) );
    if( list->data_handle == NULL ) {
        return( false );
    }
    *((lb_data)list->data_handle) = NULL;
    return( true );
}
Example #15
0
static bool FillInEmptyList( a_list *list )
{
    list->choice = 0;
    list->data = (char ** )GUIMemAlloc( sizeof( char * ) );
    if( list->data == NULL ) {
        return( FALSE );
    }
    *((char **)list->data) = NULL;
    return( TRUE );
}
Example #16
0
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 );
}
Example #17
0
static char *GUIDupStrLen( const char *str, size_t len )
{
    char        *dup;

    dup = GUIMemAlloc( len + 1 );
    if( dup != NULL ) {
        memcpy( dup, str, len );
        dup[len] = NULLCHAR;
    }
    return( dup );
}
Example #18
0
static bool AddString( char **data, char *text, int choice )
{
    int length;

    if( text != NULL ) {
        length = strlen( text );
        data[choice] = (char *)GUIMemAlloc( length + 1 );
        if( data[choice] == NULL ) {
            GUIMemFree( data );
            return( FALSE );
        }
        strcpy( data[choice], text );
    } else {
        data[choice] = (char *)GUIMemAlloc( sizeof( char ) );
        if( data[choice] == NULL ) {
            GUIMemFree( data );
            return( FALSE );
        }
        data[choice][0] = NULLCHAR;
    }
    return( TRUE );
}
Example #19
0
static void PickInit( gui_window *wnd, gui_ctl_id list_id )
{
    gui_window  *root;
    int         num_windows;
    dlg_init    info;

    root = GUIGetRootWindow();
    num_windows = GUIGetNumChildWindows();
    ChildWindows = (gui_window **)GUIMemAlloc( sizeof( gui_window * ) * num_windows );
    info.dlg_wnd = wnd;
    info.list_id = list_id;
    TotalWindows = 0;
    GUIEnumChildWindows( root, &DlgInit, &info );
}
Example #20
0
a_list *GUICreateListBox( void )
{
    a_list      *list;

    list = (a_list * )GUIMemAlloc( sizeof( a_list ) );
    if( list == NULL ) {
        return( NULL );
    }
    if( !GUIFillInListBox( list ) ) {
        GUIMemFree( list );
        list = NULL;
    }
    return( list );
}
Example #21
0
bool DirParamStack( char **inf_name, char **tmp_path, DIR_PARAM_STACK_OPS function)
/*********************************************************************************/
{
    // Not really a stack; stores only one "node"

    static char *       old_inf_name = NULL;
    static char *       old_tmp_path = NULL;

    if( function == Stack_Push ) {
        // Push values on "stack"
        old_inf_name = *inf_name;
        old_tmp_path = *tmp_path;

        *inf_name = GUIMemAlloc( _MAX_PATH );
        if( *inf_name == NULL ) {
            return( FALSE );
        }
        *tmp_path = GUIMemAlloc( _MAX_PATH );
        if( *tmp_path == NULL ) {
            GUIMemFree( *inf_name );
            return( FALSE );
        }
        return( TRUE );
    } else if( function == Stack_Pop ) {
        // Pop
        GUIMemFree( *inf_name );
        GUIMemFree( *tmp_path );
        *inf_name = old_inf_name;
        *tmp_path = old_tmp_path;
        old_inf_name = NULL;
        old_tmp_path = NULL;
        return( TRUE );
    } else {
        // IsEmpty
        return( old_inf_name == NULL );
    }
}
Example #22
0
static bool AddString( lb_data data, const char *text, int choice )
{
    int length;
    char *str;

    if( text != NULL ) {
        length = strlen( text );
        str = (char *)GUIMemAlloc( length + 1 );
        if( str == NULL ) {
            GUIMemFree( (void *)data );
            return( false );
        }
        strcpy( str, text );
    } else {
        str = (char *)GUIMemAlloc( sizeof( char ) );
        if( str == NULL ) {
            GUIMemFree( (void *)data );
            return( false );
        }
        str[0] = '\0';
    }
    data[choice] = str;
    return( true );
}
Example #23
0
/*
 * addToList - add an item to a list of items
 */
static bool addToList( char ***list, int num, char *data, size_t len )
{
    *list = GUIMemRealloc( *list, ( num + 2 ) * sizeof( char * ) );
    if( *list == NULL ) {
        return( false );
    }
    (*list)[num] = GUIMemAlloc( len + 1 );
    if( (*list)[num] == NULL ) {
        return( false );
    }
    (*list)[num + 1] = NULL;
    strcpy( (*list)[num], data );
    return( true );

} /* addToList */
Example #24
0
bool GUIXSetColours( gui_window *wnd, gui_colour_set *colours )
{
    int size;

    if( colours != NULL ) {
        size = sizeof( gui_colour_set ) * wnd->num_attrs;
        wnd->colours = ( gui_colour_set * )GUIMemAlloc( size );
        if( wnd->colours == NULL ) {
            return( false );
        }
        memcpy( wnd->colours, colours, size );
        SetBKBrush( wnd );
        return( true );
    }
    return( false );
}
Example #25
0
static bool InsertDialog( gui_window *wnd, a_dialog *ui_dlg_info, int num_controls,
                          char *name, bool colours_set )
{
    dialog_node *curr;

    curr = (dialog_node *)GUIMemAlloc( sizeof( dialog_node ) );
    if( curr == NULL ) {
        return( false );
    }
    curr->wnd = wnd;
    curr->ui_dlg_info = ui_dlg_info;
    curr->next = MyDialog;
    curr->num_controls = num_controls;
    curr->name = name;
    curr->colours_set = colours_set;
    MyDialog = curr;
    return( true );
}
Example #26
0
char *GUIGetText( gui_window *wnd, gui_ctl_id id )
{
    LONG                length;
    char                *text;
    gui_control_class   control_class;
    HWND                hwnd;
    gui_ctl_idx         choice;

    if( !GUIGetControlClass( wnd, id, &control_class ) ) {
        return( NULL );
    }
    switch( control_class ) {
    case GUI_LISTBOX :
        choice = GUIGetCurrSelect( wnd, id );
        if( choice == -1 ) {
            return( NULL );
        }
        return( GUIGetListItem( wnd, id, choice ) );
    default :
        hwnd = _wpi_getdlgitem( wnd->hwnd, id );
        if( hwnd == NULLHANDLE ) {
            return( NULL );
        }
        length = _wpi_getwindowtextlength( hwnd );
        if( length > 0 ) {
            text = (char *)GUIMemAlloc( length + 1 );
            if( text != NULL ) {
                _wpi_getwindowtext( hwnd, (LPSTR)text, length + 1 );
                switch( control_class ) {
                case GUI_PUSH_BUTTON:
                case GUI_DEFPUSH_BUTTON:
                case GUI_RADIO_BUTTON:
                case GUI_CHECK_BOX:
                case GUI_STATIC:
                case GUI_GROUPBOX:
                    _wpi_menutext2win( text );
                    break;
                }
            }
            return( text );
        }
        return( NULL );
    }
}
Example #27
0
/*
 * addToList - add an item to a list of items
 */
static bool addToList( const char ***list, int num, const char *data, size_t len )
{
    char    *str;

    *list = GUIMemRealloc( *list, ( num + 2 ) * sizeof( char * ) );
    if( *list == NULL ) {
        return( false );
    }
    ++len;
    str = GUIMemAlloc( len );
    if( str == NULL ) {
        return( false );
    }
    memcpy( str, data, len );
    (*list)[num] = str;
    (*list)[num + 1] = NULL;
    return( true );

} /* addToList */
Example #28
0
static bool InsertPopup( gui_window *wnd, gui_ctl_id id, HMENU popup, hint_type type )
{
    popup_info  *info;
    HMENU       hmenu;

    hmenu = GetPopupHMENU( wnd, GUIGetHMENU( wnd ), id, NULL, NULL, type );
    if( hmenu != popup ) {
        info = (popup_info *)GUIMemAlloc( sizeof( popup_info ) );
        if( info != NULL ) {
            info->next = wnd->popup;
            wnd->popup = info;
            info->id = id;
            info->popup = popup;
            info->type = type;
            return( true );
        } else {
            return( false );
        }
    }
    return( true );
}
Example #29
0
bool GUIInitHotSpots( int num_hot_spots, gui_resource *hot )
{
    GUINumHotSpots = num_hot_spots;
    if( num_hot_spots == 0 ) {
        GUIHotSpots = NULL;
        return( TRUE );
    }
    GUIHotSpots = (hotspot_info *)GUIMemAlloc( sizeof( hotspot_info ) * num_hot_spots );
    if( GUIHotSpots == NULL ) {
        GUINumHotSpots = 0;
        return( FALSE );
    }
    GUISetHotSpotCleanup( &Cleanup );
    if( !GUIXInitHotSpots( num_hot_spots, hot ) ) {
        Cleanup();
        return( FALSE );
    } else {
        GUISetHotSpotCleanup( &Cleanup );
        return( TRUE );
    }
}
Example #30
0
extern bool GUIXCreateFixedToolbar( gui_window *wnd )
{
    int                 i;
    int                 j;
    gui_menu_struct     menu;
    char                *with_excl;
    toolbarinfo         *tbar;

    tbar = wnd->tbinfo;
    tbar->fixed = true;
    menu.num_child_menus = 0;
    menu.child = NULL;
    menu.style = GUI_ENABLED;

    for( i = 0; i < tbar->num_items; i++ ) {
        with_excl = NULL;
        menu.label = tbar->info[i].label;
        if( menu.label != NULL ) {
            with_excl = (char *)GUIMemAlloc( strlen( menu.label ) + 2 );
            if( with_excl != NULL ) {
                strcpy( with_excl, menu.label );
                strcat( with_excl, LIT( Exclamation ) );
            }
            menu.label = with_excl;
        }
        menu.id = tbar->info[i].id;
        menu.hinttext = tbar->info[i].hinttext;
        if( !GUIAppendToolbarMenu( wnd, &menu, ( i == ( tbar->num_items - 1 ) ) ) ) {
            GUIMemFree( with_excl );
            for( j = 0; j < i; j++ ) {
                GUIDeleteToolbarMenuItem( wnd, tbar->info[j].id );
            }
            return( false );
        }
        GUIMemFree( with_excl );
    }
    GUIEVENTWND( wnd, GUI_TOOLBAR_FIXED, NULL );
    return( true );
}