static int test_resize(window_t * win, display_t * disp) { uint32_t w; uint32_t h; // prepare TEST(0 == show_window(win)); WAITFOR(disp, isvisible_window(win)); // TEST size_window TEST(0 == size_window(win, &w, &h)); TEST(100 == w); TEST(100 == h); // TEST resize_window TEST(0 == resize_window(win, 200, 150)); WAITFOR(disp, size_window(win, &w, &h) == 0 && w == 200); TEST(0 == size_window(win, &w, &h)); TEST(200 == w); TEST(150 == h); TEST(0 == resize_window(win, 100, 100)); WAITFOR(disp, size_window(win, &w, &h) == 0 && w == 100); TEST(0 == size_window(win, &w, &h)); TEST(100 == w); TEST(100 == h); // unprepare TEST(0 == hide_window(win)); WAITFOR(disp, ! isvisible_window(win)); TEST(0 == isvisible_window(win)); return 0; ONERR: return EINVAL; }
int XNextEvent(Display *d, XEvent *e) { static int (*real_XNextEvent)(Display *, XEvent *); if (!real_XNextEvent) real_XNextEvent = dlsym(RTLD_NEXT, "XNextEvent"); int r = real_XNextEvent(d, e); if (!e) return r; switch (e->type) { case ButtonPress: button_press(e->xbutton.window, e->xbutton.x, e->xbutton.y); break; case ConfigureNotify: resize_window(e->xconfigure.window, e->xconfigure.width, e->xconfigure.height); break; case CreateNotify: resize_window(e->xcreatewindow.window, e->xcreatewindow.width, e->xcreatewindow.height); break; case ConfigureRequest: resize_window(e->xconfigure.window, e->xconfigure.width, e->xconfigure.height); break; case ResizeRequest: resize_window(e->xresizerequest.window, e->xresizerequest.width, e->xresizerequest.height); break; } return r; }
int resize_term( const int ysize, const int xsize) { scr_xsize = xsize; scr_ysize = ysize; stdscr = resize_window( stdscr, ysize, xsize); #ifdef DEFINE_CURSCR curscr = resize_window( curscr, ysize, xsize); #endif return( 0); }
void init_stuff() { SDL_Event event; const SDL_VideoInfo *videoInfo; if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { fprintf( stderr, "Video initialization failed: %s\n", SDL_GetError() ); } videoInfo = SDL_GetVideoInfo(); if ( !videoInfo ) { fprintf( stderr, "Video query failed: %s\n", SDL_GetError() ); } // the flags to pass to SDL_SetVideoMode. videoFlags = SDL_OPENGL // Enable OpenGL in SDL. | SDL_GL_DOUBLEBUFFER // Enable double buffering. | SDL_HWPALETTE // Store the palette in hardware. | SDL_RESIZABLE; // Enable window resizing. // Check stuff. if ( videoInfo->hw_available ) videoFlags |= SDL_HWSURFACE; else videoFlags |= SDL_SWSURFACE; if ( videoInfo->blit_hw ) videoFlags |= SDL_HWACCEL; SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); surface = SDL_SetVideoMode( screen_width, screen_height, screen_bpp, videoFlags ); // Verify there is a surface. if ( !surface ) { fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError() ); } // initialize OpenGL. init_gl(); // resize the initial window. resize_window( screen_width, screen_height ); }
Err create_windows(t_info *info, int w, int h) { resize_window(info, w, h); SDL_WM_SetCaption("Freewar: a first chaos..", NAME_ICO); SDL_WM_SetIcon(SDL_LoadBMP(NAME_ICO), 0); return (0); }
int init() { ASSERT(initSDL()); ASSERT(initGL() == 1); ASSERT(create_mesh(mesh, N, M, SCREEN_WIDTH, SCREEN_HEIGHT)); ASSERT(init_simulation()); resize_window(SCREEN_WIDTH, SCREEN_HEIGHT); #ifdef OPENMP omp_set_num_treads(MAX_THREADS); #endif ASSERT(init_simulation()); int size = (N+2)*(M+2); velocity_vectors = new Vector[size]; velocity_indices = new GLuint [size*2]; for(int i = 0; i < size*2; i++){ velocity_indices[i] = i; } for(int i = 0; i < size; i++){ velocity_vectors[i].p0.x = mesh.vertices[i].x; velocity_vectors[i].p0.y = mesh.vertices[i].y; velocity_vectors[i].p1.x = mesh.vertices[i].x; velocity_vectors[i].p1.y = mesh.vertices[i].y; } return (TRUE); }
static int init_mode(int mode) { int oldcols=vstat.cols; int oldwidth=bitmap_width; int oldheight=bitmap_height; bitmap_init_mode(mode, &bitmap_width, &bitmap_height); /* Deal with 40 col doubling */ if(oldcols != vstat.cols) { if(oldcols == 40) vstat.scaling /= 2; if(vstat.cols == 40) vstat.scaling *= 2; } if(vstat.scaling < 1) vstat.scaling = 1; map_window(); /* Resize window if necessary. */ if((!(bitmap_width == 0 && bitmap_height == 0)) && (oldwidth != bitmap_width || oldheight != bitmap_height)) resize_window(); send_rectangle(0,0,bitmap_width,bitmap_height,TRUE); sem_post(&mode_set); return(0); }
static void handle_resize_event(int width, int height) { int newFSH=1; int newFSW=1; // No change if((width == vstat.charwidth * vstat.cols * vstat.scaling) && (height == vstat.charheight * vstat.rows * vstat.scaling)) return; newFSH=width/bitmap_width; newFSW=height/bitmap_height; if(newFSW<1) newFSW=1; if(newFSH<1) newFSH=1; if(newFSH<newFSW) vstat.scaling=newFSH; else vstat.scaling=newFSW; if(vstat.scaling > 16) vstat.scaling=16; /* * We only need to resize if the width/height are not even multiples * Otherwise, we can simply resend everything */ if((width % (vstat.charwidth * vstat.cols) != 0) || (height % (vstat.charheight * vstat.rows) != 0)) resize_window(); send_rectangle(0,0,bitmap_width,bitmap_height,TRUE); }
void init (void) { int width = INIT_WIN_WIDTH; int height = INIT_WIN_HEIGHT; /* Open an OpenGL window */ if (!glfwOpenWindow (width, height, 0, 0, 0, 0, WIN_DEPTH_BITS, 0, GLFW_WINDOW)) { printf ("error: glfwOpenWindow() failed.\n"); exit (EXIT_FAILURE); } /* Set window title */ glfwSetWindowTitle ("glTetris"); /* Select clearing (background) color */ glClearColor (0.0, 0.0, 0.0, 0.0); /* Setup callbacks */ glfwSetWindowSizeCallback (resize_window); glfwSetKeyCallback (handle_input); /* Setup window with init values */ resize_window (width, height); }
static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { WebBrowser *This; static const WCHAR wszTHIS[] = {'T','H','I','S',0}; if(msg == WM_CREATE) { This = *(WebBrowser**)lParam; SetPropW(hwnd, wszTHIS, This); }else { This = GetPropW(hwnd, wszTHIS); } switch(msg) { case WM_SIZE: return resize_window(This, LOWORD(lParam), HIWORD(lParam)); case WM_DOCHOSTTASK: return process_dochost_tasks(&This->doc_host); case WM_SETFOCUS: notify_on_focus(This, TRUE); break; case WM_KILLFOCUS: notify_on_focus(This, FALSE); break; } return DefWindowProcW(hwnd, msg, wParam, lParam); }
int init_gl(int hRes, int vRes, float x_axis, float y_axis) { GLenum response; // Setup rendering state glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearDepth(1.0f); trace("resizing window. hRes: %d vRes: %d", hRes, vRes); resize_window((GLsizei)hRes, (GLsizei)vRes, x_axis, y_axis); response = glGetError(); if (response != GL_NO_ERROR) { trace("OpenGL error detected: %d", glGetError()); return 0; } glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); glEnable(GL_POLYGON_SMOOTH); glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glColor3f(1.0f, 1.0f, 1.0f); return 1; }
static int ui_scale_buddy_handler(window_info *win) { int button_len_y = (int)(0.5 + win->current_scale * 20); buddy_border_space = (int)(0.5 + win->current_scale * 5); buddy_name_step_y = (int)(0.5 + win->current_scale * 12); buddy_menu_x_len = win->box_size + MAX_USERNAME_LENGTH * win->small_font_len_x + 2 * buddy_border_space; buddy_menu_y_len = button_len_y + 2* buddy_border_space + num_displayed_buddies * buddy_name_step_y; request_box_start_x = buddy_menu_x_len - win->box_size - (int)(0.5 + (strlen(buddy_request_str) + 2) * win->small_font_len_x); resize_window(win->window_id, buddy_menu_x_len, buddy_menu_y_len); button_resize(win->window_id, buddy_button_id, buddy_menu_x_len, button_len_y, win->current_scale); widget_move(win->window_id, buddy_button_id, 0, buddy_menu_y_len - button_len_y); widget_resize(win->window_id, buddy_scroll_id, win->box_size, buddy_menu_y_len - win->box_size - button_len_y); widget_move(win->window_id, buddy_scroll_id, buddy_menu_x_len - win->box_size, win->box_size); if (buddy_add_win >= 0) destroy_window(buddy_add_win); if (buddy_change_win >= 0) destroy_window(buddy_change_win); buddy_add_win = buddy_change_win = -1; return 1; }
static int ui_scale_accept_handler(window_info *win) { int label_id = 101, yes_button = 102, no_button = 103; int win_width = (int)(0.5 + win->current_scale * 400); int win_height = 3 * buddy_border_space + 2 * win->small_font_len_y; char string[250] = {0}; int current_window; for(current_window = 0; current_window < MAX_ACCEPT_BUDDY_WINDOWS; current_window++) if(accept_windows[current_window].window_id == win->window_id) break; if(current_window == MAX_ACCEPT_BUDDY_WINDOWS) return 0; safe_snprintf(string, sizeof(string), buddy_wants_to_add_str, accept_windows[current_window].name); put_small_colored_text_in_box_zoomed(c_blue1, (unsigned char*)string, strlen(string), win_width - 2 * buddy_border_space, accept_windows[current_window].text, win->current_scale); widget_resize(win->window_id, accept_windows[current_window].checkbox, win->small_font_len_y, win->small_font_len_y); widget_move(win->window_id, accept_windows[current_window].checkbox, buddy_border_space, win_height); widget_set_size(win->window_id, label_id, win->current_scale* DEFAULT_SMALL_RATIO); widget_move(win->window_id, label_id, 2 * buddy_border_space + win->small_font_len_y, win_height); win_height += widget_get_height(win->window_id, accept_windows[current_window].checkbox) + 2 * buddy_border_space; button_resize(win->window_id, yes_button, 0, 0, win->current_scale); button_resize(win->window_id, no_button, 0, 0, win->current_scale); widget_move(win->window_id, yes_button, (win_width/2 - widget_get_width(win->window_id, yes_button)) / 2, win_height); widget_move(win->window_id, no_button, win_width/2 + (win_width/2 - widget_get_width(win->window_id, no_button)) / 2, win_height); win_height += widget_get_height(win->window_id, yes_button) + buddy_border_space; resize_window(win->window_id, win_width, win_height); return 1; }
/** Resize terminal to dimensions specified by @a text string. * @a text should look like "width,height,old-width,old-height" * where width and height are integers. */ static inline void resize_terminal_from_str(unsigned char *text) { enum { NEW_WIDTH = 0, NEW_HEIGHT, OLD_WIDTH, OLD_HEIGHT, NUMBERS }; int numbers[NUMBERS]; int i; assert(text && *text); if_assert_failed return; for (i = 0; i < NUMBERS; i++) { unsigned char *p = strchr((const char *)text, ','); if (p) { *p++ = '\0'; } else if (i < OLD_HEIGHT) { return; } numbers[i] = atoi(text); if (p) text = p; } resize_window(numbers[NEW_WIDTH], numbers[NEW_HEIGHT], numbers[OLD_WIDTH], numbers[OLD_HEIGHT]); resize_terminal(); }
/* callback for options window to change the number of recipe entries */ void change_num_recipe_entries(int * var, int value) { if ((value >= 0) && (value < max_num_recipe_entries)) *var = value; else return; if (!recipes_loaded) return; /* never reduce the allocated memory so we can reduce and increase while keeping recipes */ if (wanted_num_recipe_entries > max_prev_num_recipe_entries) { recipes_store = (recipe_entry *)realloc(recipes_store, wanted_num_recipe_entries * sizeof(recipe_entry)); memset(&recipes_store[max_prev_num_recipe_entries], 0, sizeof(recipe_entry)*(wanted_num_recipe_entries-max_prev_num_recipe_entries)); max_prev_num_recipe_entries = wanted_num_recipe_entries; } num_recipe_entries = wanted_num_recipe_entries; /* keep current recipe in range */ if (cur_recipe >= num_recipe_entries) cur_recipe = num_recipe_entries - 1; /* resize the window if its now too big for the number of recipes */ if (num_displayed_recipes > num_recipe_entries) { num_displayed_recipes = num_recipe_entries; resize_window(recipe_win, recipe_win_width, num_displayed_recipes*SLOT_SIZE); } /* reset the scroll length and position to show the new slot */ vscrollbar_set_bar_len(recipe_win, recipe_win_scroll_id, num_recipe_entries - num_displayed_recipes); vscrollbar_set_pos(recipe_win, recipe_win_scroll_id, num_recipe_entries - num_displayed_recipes); }
Err menu(t_info *info) { preload_menu(info); load_menu(info); info->exit = 0; info->menu_over = 0; while (!info->exit) { SDL_Delay(10); while (SDL_PollEvent(&(info->mysdl.event))) { if (info->mysdl.event.type == SDL_MOUSEMOTION) menu_mousemotion(info, info->mysdl.event); else if (info->mysdl.event.type == SDL_MOUSEBUTTONDOWN) menu_mousebutton(info, info->mysdl.event); else if (info->mysdl.event.type == SDL_KEYDOWN) menu_key(info, info->mysdl.event); else if (info->mysdl.event.type == SDL_VIDEORESIZE) { resize_window(info, info->mysdl.event.resize.w, info->mysdl.event.resize.h); update_menu(info); } else if (info->mysdl.event.type == SDL_QUIT) info->exit = 1; break; } } free_menu(info); SDL_Quit(); return (0); }
/** @brief Main in-game rendering routine. * * @param b Board configuration to render. */ void draw_scene(board_t *b, GLuint fb, int reflections) { char temp[80]; int clock_seconds = 0; int clock_minutes = 0; glBindFramebuffer(GL_FRAMEBUFFER, fb); transition_update(); gg_dialog_cleanup(); glDisable(GL_BLEND); glDepthFunc(GL_ALWAYS); draw_backdrop(); glEnable(GL_BLEND); glDepthFunc(GL_LEQUAL); go_3d(get_screen_width(), get_screen_height()); render_scene_3d(b, fb, reflections); mouse_square = find_square(get_true_mouse_x(), get_true_mouse_y()); glBindFramebuffer(GL_FRAMEBUFFER, fb); resize_window(get_screen_width(), get_screen_height()); glPushMatrix(); draw_ui_elements(); // draw_move_list(get_col(COL_WHITE), get_col(COL_YELLOW)); // draw_capture_list(get_col(COL_WHITE)); clock_minutes = (((SDL_GetTicks() - get_turn_counter()) / 1000) / 60); clock_seconds = ((SDL_GetTicks() - get_turn_counter()) / 1000) - (clock_minutes * 60); snprintf(temp, sizeof(temp), "%i:%02i", clock_minutes, clock_seconds); /*text_draw_string( 303, 440, temp, 1, &col_black);*/ glPopMatrix(); /*if ( get_white_in_check() == TRUE ) text_draw_string_bouncy( 180, 420, "White is in check!", 1, get_col(COL_WHITE)); else if ( get_black_in_check() == TRUE ) text_draw_string_bouncy( 180, 420, "Black is in check!", 1, get_col(COL_WHITE));*/ gg_dialog_render_all(); if (get_fading_out()) { if (!draw_fade(FADE_OUT)) set_switch_to_menu(TRUE); } else { if (get_show_egg()) draw_sonic_fade(FADE_IN); else draw_fade(FADE_IN); } /* Draw mouse cursor.. */ draw_texture(get_mouse_cursor(), get_mouse_x(), (479 - get_mouse_y() - 32), 32, 32, 1.0f, get_col(COL_WHITE)); }
static int ui_scale_misc_handler(window_info *win) { int y_len = 0; analog_clock_size = (int)(0.5 + win->current_scale * 64); compass_size = (int)(0.5 + win->current_scale * 64); knowledge_bar_height = win->small_font_len_y + 6; side_stats_bar_height = win->small_font_len_y; digital_clock_height = win->default_font_len_y; ui_scale_timer(win); y_len = compass_size; if (view_hud_timer) y_len += get_height_of_timer(); if (view_analog_clock) y_len += analog_clock_size; if (view_digital_clock) y_len += digital_clock_height; if (view_knowledge_bar) y_len += knowledge_bar_height; if (show_stats_in_hud && have_stats) y_len += num_disp_stat * side_stats_bar_height; resize_window(win->window_id, HUD_MARGIN_X, y_len); move_window(win->window_id, -1, 0, window_width-HUD_MARGIN_X, window_height-y_len); reset_cm_regions(); return 1; }
void handle_event(struct wiimote_t* wm) { if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_PLUS)) wiiuse_motion_sensing(wm, 1); if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_MINUS)) wiiuse_motion_sensing(wm, 0); if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_UP)) wiiuse_set_ir(wm, 1); if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_DOWN)) wiiuse_set_ir(wm, 0); if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_B)) wiiuse_toggle_rumble(wm); if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_ONE)) { int level; WIIUSE_GET_IR_SENSITIVITY(wm, &level); wiiuse_set_ir_sensitivity(wm, level+1); } if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_TWO)) { int level; WIIUSE_GET_IR_SENSITIVITY(wm, &level); wiiuse_set_ir_sensitivity(wm, level-1); } #if 0 if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_A)) { if (render_mode == IR) render_mode = TEAPOT; else render_mode = IR; resize_window(width, height); } #endif }
//adjusts the astrology window size/widgets position, depending on what it displays (predictor or indicator) void adjust_astrology_window() { switch(astrology_display_type) { case adtTwoProgressBars: { resize_window(astrology_win,astrology_win_x_len,astrology_win_y_len - 40); widget_move(astrology_win,ok_button_id,(astrology_win_x_len >>1) - 40, astrology_win_y_len - 40 - 40); }break; case adtThreeProgressBars: { resize_window(astrology_win,astrology_win_x_len,astrology_win_y_len); widget_move(astrology_win,ok_button_id,(astrology_win_x_len >>1) - 40, astrology_win_y_len - 40); }break; } }
int XResizeWindow(Display *display, Window w, unsigned int width, unsigned int height) { static int (*real_XResizeWindow)(Display *, Window, unsigned int, unsigned int); if (!real_XResizeWindow) real_XResizeWindow = dlsym(RTLD_NEXT, "XResizeWindow"); resize_window(w, width, height); return real_XResizeWindow(display, w, width, height); }
void window_shrink_one(char dumb, char *dumber) { in_window_command = 1; message_from(NULL, LOG_CURRENT); resize_window(1, curr_scr_win, -1); update_all_windows(); in_window_command = 0; message_from(NULL, LOG_CRAP); }
void setup_ov_mode(int on, int hide, int log) { #ifdef WANT_OPERVIEW char *default_oper = "wsckf"; Window *win = NULL; if (on) { if ((win = get_window_by_name("oper_view"))) { if (win->log) do_log(0, NULL, &win->log_fp); delete_window(win); update_all_windows(); set_input_prompt(current_window, get_string_var(INPUT_PROMPT_VAR), 0); cursor_to_input(); } send_to_server("MODE %s -%s%s", get_server_nickname(from_server), get_string_var(OPER_MODES_VAR)?get_string_var(OPER_MODES_VAR):default_oper, send_umode); } else { Window *tmp = NULL; win = current_window; if ((tmp = new_window(current_window->screen))) { malloc_strcpy(&tmp->name, "oper_view"); tmp->double_status = 0; if (hide) hide_window(tmp); else resize_window(1, tmp, -5); tmp->window_level = LOG_WALLOP|LOG_OPNOTE|LOG_SNOTE; tmp->absolute_size = 1; tmp->skip = 1; set_wset_string_var(tmp->wset, STATUS_FORMAT1_WSET, fget_string_var(FORMAT_OV_FSET)); build_status(tmp, NULL, 0); update_all_windows(); set_input_prompt(current_window, get_string_var(INPUT_PROMPT_VAR), 0); cursor_to_input(); send_to_server("MODE %s +%s", get_server_nickname(from_server), get_string_var(OPER_MODES_VAR)?get_string_var(OPER_MODES_VAR):default_oper); set_screens_current_window(win->screen, win); tmp->mangler = operlog_line_mangler; if (log != -1) { tmp->log = log; if (tmp->log) do_log(log, "~/.BitchX/operview.log", &tmp->log_fp); } } } #endif }
// Called when UI scaling changed static int ui_scale_manufacture_handler(window_info *win) { int mbw = (int)(0.5 + 43 * win->current_scale); int cbw = (int)(0.5 + 70 * win->current_scale); int space = (int)(0.5 + 7 * win->current_scale); int free_x = 0; SLOT_SIZE = (int)(0.5 + 33 * win->current_scale); PIPE_CONTROL_X = (int)(0.5 + 5 * win->current_scale) * 2 + win->small_font_len_x; recipe_win_width = SLOT_SIZE * NUM_MIX_SLOTS + win->box_size + 2; manufacture_menu_x_len = GRID_COLS * SLOT_SIZE + win->box_size; manufacture_menu_y_len = (GRID_ROWS+1) * SLOT_SIZE + (4+1) * win->small_font_len_y; text_y_offset = SLOT_SIZE + 4 + 4.5 * win->small_font_len_y; recipe_y_offset = SLOT_SIZE + 4; control_elem_size = (int)(0.5 + 5 * win->current_scale); free_x = manufacture_menu_x_len - (cbw + 2*mbw + 3*space); pipeline_x = space + cbw + free_x/2 - (SLOT_SIZE*NUM_MIX_SLOTS + PIPE_CONTROL_X)/2; resize_window(win->window_id, manufacture_menu_x_len, manufacture_menu_y_len); button_resize(win->window_id, mixone_button_id, mbw, 0, win->current_scale); button_resize(win->window_id, mixall_button_id, mbw, 0, win->current_scale); button_resize(win->window_id, clear_button_id, cbw, 0, win->current_scale); widget_move(win->window_id, mixone_button_id, manufacture_menu_x_len-2*(mbw+space), manufacture_menu_y_len - recipe_y_offset); widget_move(win->window_id, mixall_button_id, manufacture_menu_x_len-(mbw+space), manufacture_menu_y_len - recipe_y_offset); widget_move(win->window_id, clear_button_id, space, manufacture_menu_y_len - recipe_y_offset); if ((recipe_win > -1) && (recipe_win < windows_list.num_windows)) { set_window_min_size(recipe_win, recipe_win_width, 4*SLOT_SIZE); move_window(recipe_win, win->window_id, 0, win->pos_x + pipeline_x, win->pos_y + manufacture_menu_y_len - 2); resize_window(recipe_win, recipe_win_width, num_displayed_recipes*SLOT_SIZE); } last_items_string_id = (size_t)-1; return 1; }
EXPORT void arrange_twin(std::deque<HWND> const& hwnds_, long const& width_, long const& height_){ if(0 == hwnds_.size()){ // nop } else if(1 == hwnds_.size()){ resize_window(hwnds_.at(0), HWND_NOTOPMOST, SW_SHOWNORMAL, 0, 0, width_, height_); } else if(2 == hwnds_.size()){ resize_window(hwnds_.at(0), HWND_NOTOPMOST, SW_SHOWNORMAL, 0, 0, width_ / 2 , height_); resize_window(hwnds_.at(1), HWND_NOTOPMOST, SW_SHOWNORMAL, width_ / 2, 0, width_ / 2, height_); } else{ long const n = hwnds_.size() - 2; long const sub_width = width_ / n; resize_window(hwnds_.at(0), HWND_NOTOPMOST, SW_SHOWNORMAL, 0 , 0, width_ / 2, height_ / 4 * 3); resize_window(hwnds_.at(1), HWND_NOTOPMOST, SW_SHOWNORMAL, width_ / 2, 0, width_ / 2, height_ / 4 * 3); for(unsigned int i = 2; i < hwnds_.size(); i++){ resize_window(hwnds_.at(i), HWND_NOTOPMOST, SW_SHOWNORMAL, (sub_width * (i - 2)), (height_ / 4 * 3), (sub_width), (height_ / 4 * 1)); } } }
int BC_Title::update(const char *text, int flush) { int new_w, new_h; strcpy(this->text, text); get_size(this, font, text, fixed_w, new_w, new_h); if(new_w > w || new_h > h) { resize_window(new_w, new_h); } draw(flush); return 0; }
int evenement_menu (SDL_Surface* window, menu_t m, SDL_Event event, bool persist_select) { switch (event.type) { case SDL_VIDEORESIZE: resize_window(window, &event); Affiche_menu (m); break; case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_f) { window = fullscreen_window(window); Affiche_menu (m); } else if (event.key.keysym.sym == SDLK_RETURN) return selection_menu (m); else if (SDLK_UP <= event.key.keysym.sym && event.key.keysym.sym <= SDLK_LEFT) deplacement_menu_key (m, event.key.keysym.sym); else east1 (window, event.key.keysym.sym); break; case SDL_MOUSEBUTTONDOWN: return selection_menu (m); break; case SDL_MOUSEMOTION: deplacement_menu_mouse (m, &event); break; default: { Uint8 *keyboard = SDL_GetKeyState(NULL); if (keyboard [SDLK_UP]) deplacement_menu_key (m, SDLK_UP); if (keyboard [SDLK_DOWN]) deplacement_menu_key (m, SDLK_DOWN); if (keyboard [SDLK_LEFT]) deplacement_menu_key (m, SDLK_LEFT); if (keyboard [SDLK_RIGHT]) deplacement_menu_key (m, SDLK_RIGHT); if (persist_select) { if (keyboard [SDLK_RETURN]) return selection_menu (m); if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) return selection_menu (m); } } } return M_NOT; }
void ReplaceDlg::replace_directed(HWindow *pDlg, int finddir, bool showCount) { bool case_sensitive = pDlg->IsDlgButtonChecked(IDC_MATCHCASE_CHECK) == BST_CHECKED; GetDlgItemText(pDlg, IDC_TO_REPLACE_EDIT, strToReplaceData); GetDlgItemText(pDlg, IDC_REPLACEWITH_EDIT, strReplaceWithData); bPasteAsText = pDlg->IsDlgButtonChecked(IDC_USETRANSLATION_CHECK) == BST_UNCHECKED; //------------------ // Don't do anything if to-replace and replace-with data are same. Text2BinTranslator tr_find(strToReplaceData), tr_replace(strReplaceWithData); if (tr_find.bCompareBin(tr_replace, iCharacterSet, iBinaryMode)) { MessageBox(pDlg, GetLangString(IDS_REPL_SAME_STRS), MB_ICONERROR); return; } WaitCursor wc; int occ_num = 0; HWindow *pwndFocus = HWindow::GetFocus(); if (EnableDlgItem(pDlg, IDC_REPLACE_BUTTON, FALSE) == FALSE) { // Don't lose focus. if (!pwndFocus->IsWindowEnabled()) pDlg->SetFocus(); occ_num++; replace_selected_data(pDlg); } if (finddir) { while (find_and_select_data(finddir, case_sensitive)) { occ_num++; replace_selected_data(pDlg); }; } if (occ_num) { set_wnd_title(); adjust_view_for_selection(); resize_window(); synch_sibling(); if (showCount) { TCHAR tbuf[100]; _stprintf(tbuf, GetLangString(IDS_REPL_COUNT), occ_num); MessageBox(pDlg, tbuf, MB_ICONINFORMATION); } } }
win3d::win3d(uint wid, const char *wname, uint height, uint width) : QGLWidget(), win((QWidget*) this, wid, wname, height, width) { if ((height != 0) && (width != 0)) resize_window(height, width); // setAutoFillBackground(false); // setAutoBufferSwap(false); pixmapScale = 1.0; xRot = 0; yRot = 0; zRot = 0; rotationX = 0;//-38.0; rotationY = 0;//-58.0; rotationZ = 0.0; scaling = 1.0; update_window(); }
static void edit_resize(void *data, XConfigureEvent *event) { EDITINFO *einf = (EDITINFO *) data; unsigned int new_width, new_height; einf->width = last_width = event->width; einf->height = last_height = event->height; einf->xpos = last_xpos = event->x; einf->ypos = last_ypos = event->y; new_width = sub_width( event->width ); new_height = sub_height(event->height ); XResizeWindow(display, einf->drawwin_id, new_width-2, new_height-2); resize_window(einf->info, new_width-2, new_height-2); scrollbar_resize(einf->scrollver, new_height); scrollbar_resize(einf->scrollhor, new_width); }