void kernel_load_enter(void) { graphics_location draw_system_logo_x=0; graphics_location draw_system_logo_y=0; unsigned long draw_system_logo_height=0; unsigned long draw_system_logo_width=0; window_widget picture_kernel_logo; widget_handle picture_kernel_logo_handle=INVALID_WIDGET_HANDLE; window_widget progress_load_rate; kernel_load_window=create_window("kernel load","kernel load",false,NULL); set_window_background_color(kernel_load_window,DEFAULT_COLOR_BACKGROUND); show_window(kernel_load_window); lcd_calcu_middle_location(0,0,SCREEN_HORIZONTAL_PIXEL,SCREEN_LONGITUDINAL_PIXEL,&draw_system_logo_x,&draw_system_logo_y); graphics_get_bitmap(kernel_logo,NULL,&draw_system_logo_height,&draw_system_logo_width); draw_system_logo_x-=draw_system_logo_width/2; draw_system_logo_y-=draw_system_logo_height/2; picture_kernel_logo.widget_type=widget_picture; picture_kernel_logo.x=draw_system_logo_x; picture_kernel_logo.y=draw_system_logo_y; picture_kernel_logo_handle=create_widget(kernel_load_window,&picture_kernel_logo); set_picture_bitmap(kernel_load_window,picture_kernel_logo_handle,kernel_logo); draw_widget(kernel_load_window,picture_kernel_logo_handle); progress_load_rate.widget_type=widget_progress; progress_load_rate.widget_height=PROGRESS_HEIGHT; progress_load_rate.widget_width=draw_system_logo_width; progress_load_rate.x=draw_system_logo_x; progress_load_rate.y=draw_system_logo_y+draw_system_logo_height+DISTANCE_PROGRESS_TO_LOGO; progress_load_rate_handle=create_widget(kernel_load_window,&progress_load_rate); set_progress_max_value(kernel_load_window,progress_load_rate_handle,MAX_KERNEL_LOAD_RATE); set_progress_value(kernel_load_window,progress_load_rate_handle,0); draw_widget(kernel_load_window,progress_load_rate_handle); }
/* we need this callback to catch blist construction and install widget when we may do so */ static void cb_blist_created(GtkWidget *widget, gpointer data) { /* create widget and load preferences */ create_widget(); init_widget(); }
int test_widget_rect( void ) { int i, ret = 0; float values[3] = { 1.0f, 1.5f, 2.0f }; for( i = 0; i < 3; ++i ) { memset( &self, 0, sizeof( self ) ); TEST_LOG( "test widget rectagle in " "%g%% scaling mode\n", values[i] * 100 ); LCUI_Init(); #ifdef _WIN32 Logger_SetHandler( LoggerHandler ); Logger_SetHandlerW( LoggerHandlerW ); #endif self.widget = create_widget(); LCUIMetrics_SetScale( values[i] ); LCUIDisplay_SetSize( SCREEN_WIDTH, SCREEN_HEIGHT ); /* 等一段时间后再开始测试,避免初始化 LCUI 时产生的脏矩形影响测试结果 */ LCUITimer_Set( 100, start_test, NULL, FALSE ); LCUIWidget_Update(); if( LCUI_Main() != 0 ) { ret -= 1; } } return ret; }
PreprocessWidget::PreprocessWidget(int width, int height, QWidget *parent): QWidget(parent) { page_height_ = 200; resize(width, height * 8 / 9); create_widget(); create_page_preprocess(); }
GrayScaleTransformWidget::GrayScaleTransformWidget(int width, int height, QWidget *parent) : QWidget(parent) { page_height_ = 200; resize(width, height * 8 / 9); create_widget(); create_page_linear(); create_page_non_linear(); create_page_histogram(); }
/*---------------------------------------------------------------------*/ void init_console( void ) { struct gra_info _gra_info; get_info( &_gra_info ); __key_ptr = __key1; #if 0 cons = create_widget( eWIDGET_BASE ); textbox = (struct text_box*)create_widget( eWIDGET_TEXT_BOX ); #endif init_widget( &cons ); init_widget( &textbox.base ); add_widget( &cons, &textbox.base ); cons.data.rect.posx = _gra_info.screen_width>>1; cons.data.rect.posy = 0; cons.data.rect.width = 40 * DEBUG_FONT_SIZE_X;//200; cons.data.rect.height = 30 * DEBUG_FONT_SIZE_Y;//200; textbox.base.data.rect.posx = _gra_info.screen_width>>1; textbox.base.data.rect.posy = 0; textbox.base.data.rect.width = cons.data.rect.width ; textbox.base.data.rect.height = cons.data.rect.height; textbox.col = textbox.base.data.rect.width / DEBUG_FONT_SIZE_X;//col; textbox.row = textbox.base.data.rect.height/ DEBUG_FONT_SIZE_Y;//row: textbox.now_col = 0; textbox.now_row = 0; t_state.pos.x = 0; t_state.pos.y = 0; t_state.is_touch = false; init_cons = true; cmd_mode = false; // command queue initialize init_squeue( cmd_queue, cmd_stack, 0, 0, sizeof(cmd_stack) ); _init_cmd_args( &_cmd_args ); puts("console initialize", 0, DEBUG_FONT_SIZE_Y*1); }
TitleBar::TitleBar(QWidget *parent) : QWidget(parent) ,mp_label_icon( NULL ) ,mp_label_title( NULL ) ,mp_btn_min( NULL ) ,mp_btn_close( NULL ) { mb_left_button_press = false; create_widget(); connect( mp_btn_min, SIGNAL( clicked() ), parent, SLOT( showMinimized() ) ); //发送关闭主窗口的信号 connect( mp_btn_close, SIGNAL( clicked() ), parent, SLOT( close() ) ); }
void video_output_qt::init() { if (!_widget) { create_widget(); _widget->makeCurrent(); set_opengl_versions(); glewExperimental = GL_TRUE; GLenum err = glewInit(); #if HAVE_X11 if (err == GLEW_OK) { err = glxewInit(); } #endif if (err != GLEW_OK) { throw exc(str::asprintf(_("Cannot initialize GLEW: %s"), reinterpret_cast<const char *>(glewGetErrorString(err)))); } /* We essentially use OpenGL 2.1 + FBOs. Instead of checking for these two, * we check for GL 1.3 + a larger number of extensions, so that GL implementations * that do not fully support 2.1 still work. */ if (!glewIsSupported("GL_VERSION_1_3 " // at least OpenGL 1.3 is reasonable // GL_VERSION_2_0: "GL_ARB_shader_objects GL_ARB_fragment_shader " "GL_ARB_texture_non_power_of_two " // GL_VERSION_2_1: "GL_ARB_pixel_buffer_object " // FBOs. Some drivers (e.g. GeForce 6600 on Mac) only provide the EXT // version, though an ARB version exists "GL_EXT_framebuffer_object" // SRGB extensions. // GL_EXT_texture_sRGB is optional (see video_output.cpp for the test) // GL_ARB_framebuffer_sRGB is not needed (see video_output.cpp) )) { throw exc(std::string(_("This OpenGL implementation does not support required features."))); } video_output::init(); video_output::clear(); // Initialize GL things glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Start rendering _widget->doneCurrent(); _widget->start_rendering(); } }
/************************************************************************* ... *************************************************************************/ struct sw_widget *sw_label_create_text(struct sw_widget *parent, struct ct_string *string) { struct sw_widget *result = create_widget(parent, WT_LABEL); result->destroy = destroy; result->draw = draw; result->data.label.text = string; result->inner_bounds.width = string->size.width + 2; result->inner_bounds.height = string->size.height + 2; result->outer_bounds = result->inner_bounds; return result; }
widget_node_t make_optional_panel(const dictionary_t& parameters, const widget_node_t& parent, const factory_token_t& token, const widget_factory_t& factory) { size_enum_t size(parameters.count(key_size) ? implementation::enumerate_size(get_value(parameters, key_size).cast<name_t>()) : parent.size_m); optional_panel_t* widget(NULL); create_widget(parameters, size, widget); token.client_holder_m.assemblage_m.cleanup(boost::bind(delete_ptr<optional_panel_t*>(), widget)); // // Call display_insertion to embed the new widget within the view heirarchy // platform_display_type display_token(insert(get_main_display(), parent.display_token_m, *widget)); // // As per SF.net bug 1428833, we want to attach the poly_placeable_t // to Eve before we attach the controller and view to the model // eve_t::iterator eve_token; eve_token = attach_placeable<poly_placeable_t>(parent.eve_token_m, *widget, parameters, token, factory.is_container(static_name_t("optional")), factory.layout_attributes(static_name_t("optional"))); widget->set_optional_display_procs(boost::bind(&optional_display_show, boost::ref(token.client_holder_m.visible_change_queue_m), boost::ref(token.client_holder_m.eve_m), eve_token, _1), boost::bind(&optional_display_hide, boost::ref(token.client_holder_m.visible_change_queue_m), boost::ref(token.client_holder_m.eve_m), eve_token, _1)); attach_view_and_controller(*widget, parameters, token); // // Return the widget_node_t that comprises the tokens created for this widget by the various components // return widget_node_t(size, eve_token, display_token, parent.keyboard_token_m); }
widget_node_t make_edit_number(const dictionary_t& parameters, const widget_node_t& parent, const factory_token_t& token, const widget_factory_t& factory) { bool is_container(factory.is_container(static_name_t("edit_number"))); const layout_attributes_t& layout_attributes( factory.layout_attributes(static_name_t("edit_number"))); size_enum_t size(parameters.count(key_size) ? implementation::enumerate_size(get_value(parameters, key_size).cast<name_t>()) : parent.size_m); edit_number_t* widget(NULL); create_widget(parameters, size, widget); assemblage_cleanup_ptr(token.client_holder_m.assemblage_m, widget); // // Call display_insertion to embed the new widget within the view heirarchy // platform_display_type display_token(insert(get_main_display(), parent.display_token_m, *widget)); // // As per SF.net bug 1428833, we want to attach the poly_placeable_t // to Eve before we attach the controller and view to the model // eve_t::iterator eve_token; eve_token = attach_placeable<poly_placeable_t>(parent.eve_token_m, *widget, parameters, token, is_container, layout_attributes); attach_edit_num_view_and_controller(*widget, parameters, token); keyboard_t::iterator keyboard_token = keyboard_t::get().insert(parent.keyboard_token_m, poly_key_handler_t(boost::ref(*widget))); // // Return the widget_node_t that comprises the tokens created for this widget by the various components // return widget_node_t(size, eve_token, display_token, keyboard_token); }
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { // WM_CREATE used to populate our window with all sorts of windows assets, initialize Winsock case WM_CREATE: { create_widget(hWnd); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_MAIN_BUTTON: { wchar_t buffer[256] = L""; SendMessage(hEdit, WM_GETTEXT, sizeof(buffer) / sizeof(buffer[0]), reinterpret_cast<LPARAM>(buffer)); MessageBox(NULL, buffer, L"Information", MB_ICONINFORMATION); } break; } break; case WM_DESTROY: { PostQuitMessage(0); return 0; } break; } return DefWindowProc(hWnd, msg, wParam, lParam); }
static gboolean plugin_load(PurplePlugin *plugin) { /* connect construction signal only when needed as when installing the plugin after launching pidgin there is no need to wait for blist creation */ if(is_gtk_blist_created()) { /* create widget and load preferences */ create_widget(); init_widget(); } else /* connect construction signal */ purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(cb_blist_created), NULL); purple_debug_info(NAME,"plugin initialized...\n"); return TRUE; }
QWidget *LoggingPage::widget() { return create_widget(DISPLAYLIST_LOGGING_SETTINGS_LIST); }