void fill_notepad_window() { int i, tmp; widget_list *wnew; widget_list *wsave; int note_tabs_width = notepad_win_x_len; int note_tabs_height = notepad_win_y_len - 5; note_button_scroll_height = note_tabs_height - 55 - 20; // -20 for the tab tags note_button_width = (note_tabs_width - note_button_scroll_width - note_button_x_space - 15) / 2; set_window_handler(notepad_win, ELW_HANDLER_DISPLAY, &display_notepad_handler); set_window_handler(notepad_win, ELW_HANDLER_CLICK, &click_buttonwin_handler); note_tabcollection_id = tab_collection_add (notepad_win, NULL, 0, 5, note_tabs_width, note_tabs_height, 20); widget_set_size (notepad_win, note_tabcollection_id, 0.7); widget_set_color (notepad_win, note_tabcollection_id, 0.77f, 0.57f, 0.39f); main_note_tab_id = tab_add (notepad_win, note_tabcollection_id, tab_main, 0, 0, 0); widget_set_color (notepad_win, main_note_tab_id, 0.77f, 0.57f, 0.39f); set_window_handler(main_note_tab_id, ELW_HANDLER_CLICK, &click_buttonwin_handler); // Add Category new_note_button_id = button_add(main_note_tab_id, NULL, button_new_category, 0, 0); widget_set_OnClick(main_note_tab_id, new_note_button_id, notepad_add_category); widget_set_color(main_note_tab_id, new_note_button_id, 0.77f, 0.57f, 0.39f); // Save Notes save_notes_button_id = button_add(main_note_tab_id, NULL, button_save_notes, 0, 0); widget_set_OnClick(main_note_tab_id, save_notes_button_id, click_save_handler); widget_set_color(main_note_tab_id, save_notes_button_id, 0.77f, 0.57f, 0.39f); // align the buttons wnew = widget_find(main_note_tab_id, new_note_button_id); wsave = widget_find(main_note_tab_id, save_notes_button_id); tmp = (notepad_win_x_len - note_button_scroll_width)/2; widget_move(main_note_tab_id, new_note_button_id, (tmp - wnew->len_x)/2, 10); widget_move(main_note_tab_id, save_notes_button_id, tmp + (tmp - wsave->len_x)/2, 10); notepad_load_file (); init_ipu (&popup_str, main_note_tab_id, NOTE_NAME_LEN*DEFAULT_FONT_X_LEN, 100, NOTE_NAME_LEN, 1, NULL, notepad_add_continued); popup_str.x = (notepad_win_x_len - popup_str.popup_x_len) / 2; popup_str.y = (notepad_win_y_len - popup_str.popup_y_len) / 2; note_button_scroll_id = vscrollbar_add (main_note_tab_id, NULL, note_tabs_width - note_button_scroll_width - 5, 50, note_button_scroll_width, note_button_scroll_height); widget_set_OnClick (main_note_tab_id, note_button_scroll_id, note_button_scroll_handler); widget_set_OnDrag (main_note_tab_id, note_button_scroll_id, note_button_scroll_handler); // Add the note selection buttons and their scroll bar for(i = 0; i < nr_notes; i++) note_button_add (i, i); update_note_button_scrollbar (0); }
/* fill the URL window created as a tab. */ void fill_url_window(void) { const Uint32 scroll_width = 20; const Uint32 cross_height = 20; int clear_all_button = 101; widget_list *widget; /* create the main window */ url_win_x_len = INFO_TAB_WIDTH; url_win_y_len = INFO_TAB_HEIGHT; url_win_max_string_width = url_win_x_len - (2*url_win_sep + scroll_width); set_window_handler(url_win, ELW_HANDLER_DISPLAY, &display_url_handler ); set_window_handler(url_win, ELW_HANDLER_CLICK, &click_url_handler ); /* create the clear all button */ clear_all_button = button_add_extended (url_win, clear_all_button, NULL, url_win_sep, url_win_sep, 0, 0, 0, 0.75, 0.77f, 0.57f, 0.39f, "CLEAR ALL "); widget_set_OnClick(url_win, clear_all_button, url_win_click_clear_all); widget = widget_find(url_win, clear_all_button); widget_set_OnMouseover(url_win, clear_all_button, url_win_mouseover_clear_all); /* calc text and help postions from size of other stuff */ url_win_text_start_y = 2*url_win_sep + ((widget->len_y > cross_height) ?widget->len_y :cross_height); url_win_line_step = (int)(3 + DEFAULT_FONT_Y_LEN * url_win_text_zoom); url_win_text_len_y = 12 * url_win_line_step; url_win_full_url_y_len = url_win_sep + 3 * SMALL_FONT_Y_LEN; url_win_y_len = url_win_text_start_y + url_win_text_len_y + url_win_sep + url_win_full_url_y_len; url_win_help_x = widget->len_x + 2 * url_win_sep; url_win_url_y_start = url_win_y_len - url_win_full_url_y_len - url_win_sep/2; resize_window (url_win, url_win_x_len, url_win_y_len); /* create the scroll bar */ url_scroll_id = vscrollbar_add_extended(url_win, url_scroll_id, NULL, url_win_x_len - scroll_width, url_win_text_start_y, scroll_width, url_win_text_len_y, 0, 1.0, 0.77f, 0.57f, 0.39f, 0, 1, have_url_count); widget_set_OnDrag(url_win, url_scroll_id, url_win_scroll_drag); widget_set_OnClick(url_win, url_scroll_id, url_win_scroll_click); }