extern void WndSelPopItem( a_window *wnd, void *parm, bool paint_immed ) { wnd_coord piece; if( !WndSelGetEndPiece( wnd, parm, &piece ) ) { WndNullPopItem( wnd ); return; } wnd->sel_end = piece; WndSelPopPiece( wnd, paint_immed ); }
extern void WndKeyPopItem( a_window *wnd, bool paint_immed ) { if( !WndHasCurrent( wnd ) || _Isnt( wnd, WSW_CHAR_CURSOR ) ) { WndNullPopItem( wnd ); return; } if( wnd->sel_start.row == WND_NO_ROW ) { WndNoSelect( wnd ); wnd->sel_start = wnd->current; } if( wnd->sel_end.row == WND_NO_ROW ) { wnd->sel_end = wnd->current; } WndSelPopPiece( wnd, paint_immed ); }
extern void WndPopUp( a_window *wnd, gui_menu_struct *menu ) { gui_point point; point.x = 0; point.y = 0; wnd->sel_end.row = 0; if( !WndHasCurrent( wnd ) ) { WndFirstCurrent( wnd ); } if( WndHasCurrent( wnd ) ) { WndNoSelect( wnd ); wnd->current.col = 0; // just to be sure WndCurrToGUIPoint( wnd, &point ); wnd->sel_end = wnd->current; wnd->sel_start = wnd->current; } WndNullPopItem( wnd ); SetWndMenuRow( wnd ); WndInvokePopUp( wnd, &point, menu ); }
static a_window *WndCreateWithStructBody( wnd_create_struct *info, gui_create_info *init ) { a_window *wnd; gui_window *gui; char buff[256]; int size; if( info->title == NULL ) { buff[0] = '\0'; } else { // might be clobbered by create strcpy( buff, info->title ); } if( info->title != NULL ) strcpy( buff, info->title ); // might be clobbered by create size = sizeof( *wnd ) + ( WndMaxDirtyRects - 1 ) * sizeof( wnd->dirty ); // wnd = WndAlloc( size ); if( wnd == NULL ) { WndFree( info->extra ); WndNoMemory(); } memset( wnd, 0, size ); wnd->u.button_down.row = (char)-1; wnd->gui = NULL; wnd->info = info->info; wnd->wndclass = info->wndclass; wnd->extra = info->extra; wnd->title_size = info->title_size; wnd->rows = 1; // just so it's not zero in init code WndNoSelect( wnd ); WndNoCurrent( wnd ); WndSetCurrCol( wnd ); WndNullPopItem( wnd ); wnd->dirtyrects= 0; // wndnoselect changes this! wnd->vscroll_pending = 0; wnd->hscroll_pending = -1; wnd->keypiece = WND_NO_PIECE; wnd->switches = WSW_SELECT_IN_TABSTOP | WSW_MUST_CLICK_ON_PIECE | WSW_ALLOW_POPUP | WSW_SEARCH_WRAP | WSW_HIGHLIGHT_CURRENT | WSW_ONLY_MODIFY_TABSTOP | WSW_MENU_ACCURATE_ROW; if( info->rect.width == 0 || info->rect.height == 0 ) { init->rect.x = 0; init->rect.y = 0; init->rect.width = WndMax.x; init->rect.height = WndMax.y; } else { init->rect.x = info->rect.x; init->rect.y = info->rect.y; init->rect.width = info->rect.width; init->rect.height = info->rect.height; } init->scroll = info->scroll; init->style = info->style; init->style |= GUI_VSCROLL_EVENTS; init->style &= ~GUI_HSCROLL_EVENTS; init->title = ( info->title == NULL ) ? NULL : ""; if( WndMain != NULL ) { init->style |= GUI_VISIBLE; init->parent = WndMain->gui; init->num_menus = 0; init->menu = NULL; } else { init->style &= ~GUI_VISIBLE; init->scroll = GUI_NOSCROLL; init->num_menus = WndNumMenus; init->menu = WndMainMenu; init->parent = NULL; } if( init->style & GUI_POPUP ) { init->parent = NULL; } init->num_attrs = WndNumColours; init->colours = info->colour; init->call_back = WndMainEventProc; init->extra = wnd; _Set( wnd, WSW_ACTIVE ); gui = GUICreateWindow( init ); if( gui == NULL ) { WndFree( info->extra ); WndFree( wnd ); WndNoMemory(); return( NULL ); } else { if( buff[0] != '\0' ) { WndSetTitle( wnd, buff ); } } ++NumWindows; return( wnd ); }