Welcome![Sign In][Sign Up]
Location:
Search - Widget-Example

Search list

[GUI Developbrew window manager

Description:

 

Objective
This topic describes how to create a windowed application that will share the display with other applications.
Brew® MP windowed applications need to be written differently than traditional Brew MP applications. Traditional Brew MP applications, when running in the foreground, occupy full screen space and can modify the display at any time. In the windowing framework, multiple applications share the display at the same time and are not allowed to modify the display arbitrarily. A windowed application also needs to create one or more widgets to be used to create the windows.
A windowed application needs to:
·                  Create and initialize one or more widgets to be passed to IWindowMgr_CreateWindow().
The application can implement its own IWidget, or it can make use of an existing IWidget.
·                  Handle the EVT_APP_START_WINDOW event (and create a window).
·                  Implement handlers for visibility changes, focus changes, and extent changes. The implementation of these handlers is dependent on the details of the application.
·                  Draw in two stages:
·                                  Tell the container that drawing is necessary (ICONTAINER_Invalidate()).
·                                  Draw only when told to draw by the container (IWIDGET_Draw()).
Note: A windowed application should not call any functions that modify IDisplay directly. This includes explicit IDisplay function calls or implicit updates, such as calls to IIMAGE_Draw() or ICONTROL_Redraw(). Drawing should happen only on demand, for example, when IWIDGET_Draw() is called for the widget used to create the window. Existing Widget based applications follow these guidelines and, with minor modifications, can be ported to the windowing framework.
Event handling
A windowed application must respond to these events:
EVT_APP_START_WINDOW and EVT_APP_START
A window-based application receives EVT_APP_START_WINDOW first. If the application returns TRUE for this event, the application does not receive EVT_APP_START. If an application needs to support both the environments (window based and non-window based), it should handle both events.
When the application receives EVT_APP_START_WINDOW, it should create one or more windows.
If creation of IWindowMgr0 fails while handling EVT_APP_START_WINDOW, the application should assume that the platform does not support window-based applications. In this case, the application should return FALSE and continue the application logic in the code for EVT_APP_START.
EVT_APP_SUSPEND and EVT_APP_RESUME
After an application returns TRUE for EVT_APP_START_WINDOW, it will not receive EVT_APP_SUSPEND and EVT_APP_RESUME as non-windowed Brew MP applications do. Instead, the application must check for window status events that are sent to the widget through EVT_WDG_SETPROPERTY events. For EVT_WDG_SETPROPERTY events, wParam indicates which property was set, and dwParam specifies the value of the property. When the AEEWindowMgrExt_PROPEX_STATE property has a value of AEEWindowMgrExt_STATE_VISIBLE, the window is visible.
EVT_WDG_WINDOWSTATUS
The EVT_WDG_WINDOWSTATUS event is sent to a widget to notify it about various window related status messages. AEEWindowStatus.h contains information on the meaning of various status messages.
Sample code location

ZIP filename
Location
Run app
hellowindowapp
Brew MP Library
·                       Download and extract the ZIP file.
·                       Compile the app.
·                       Run it on the Brew MP Simulator.

Example of a windowed application
In the hellowindowapp sample, HelloWindowApp_HandleEvent handles the EVT_APP_START_WINDOW event and creates soft key and pop-up windows:
   case EVT_APP_START_WINDOW:   
      DBGPRINTF("EVT_APP_START_WINDOW");
 
      // Create the softkey and popup windows
      HelloWindowApp_CreateSoftkey(pMe);
      HelloWindowApp_CreateOrActivatePopup(pMe);
 
      // Handling this event tells Brew that we are a windowing
      // application.
      return TRUE;  
HelloWindowApp_CreateSoftkey() creates the soft key widget, sets the color text of the widget, then calls HelloWindowApp_CreateWindow() to create the window.
   WidgetWindow *pWindow = &pMe->softkeyWindow;
  
   if (pWindow->piWindowWidget != NULL) return;
   pWindow->pszDbgName = "Softkey";
   pWindow->pMe = pMe;
  
   (void) ISHELL_CreateInstance(pMe->applet.m_pIShell, AEECLSID_SoftkeyWidget,
            (void **) &pWindow->piWindowWidget);
   if (pWindow->piWindowWidget == NULL) return;
 
   {
      WidgetExtent extent = {0, HWA_SOFTKEY_HEIGHT};
      IWidget_SetExtent(pWindow->piWindowWidget, &extent);
   }
  
   (void) IWidget_SetBGColor(pWindow->piWindowWidget, MAKE_RGBA(200,200,200,255));
  
   // Now set the softkeys text
   {
      IWidget *piTextWidget = NULL;
      (void) IWidget_GetSoftkey(pWindow->piWindowWidget, PROP_SOFTKEY1, &piTextWidget);
     
      if (piTextWidget != NULL) {
         (void) IWidget_SetText(piTextWidget, L"Hover", TRUE);
      }
      RELEASEIF(piTextWidget);
 
      (void) IWidget_GetSoftkey(pWindow->piWindowWidget, PROP_SOFTKEY2, &piTextWidget);
      if (piTextWidget != NULL) {
         (void) IWidget_SetText(piTextWidget, L"Close", TRUE);
      }
      RELEASEIF(piTextWidget);
   }
 
   HelloWindowApp_CreateWindow(pMe, pWindow, AEEWindowMgrExt_CLASS_Softkey);  
HelloWindowApp_CreateWindow() creates the soft key window, as follows:
   int result;
   uint32 winId;
   AEEWindowProp propList[1];
  
   // Set custom window handler
   HANDLERDESC_Init(&pWindow->hdHandler, HelloWindowApp_WindowHandler, pWindow, NULL);
   IWIDGET_SetHandler(pWindow->piWindowWidget, &pWindow->hdHandler);
        
   propList[0].id = AEEWindowMgrExtProp_CLASS;
   propList[0].pbyLen = sizeof(winClass);
   propList[0].pby = (void *) &winClass;
     
   result = IWindowMgr_CreateWindow(pMe->piWindowMgr, (IQI*) (void *) pWindow->piWindowWidget,
      propList, ARR_SIZE(propList), &winId);
 
   if (result != SUCCESS) {
      DBGPRINTF("Window creation failed for %s: %d", pWindow->pszDbgName, result);
      HelloWindowApp_DestroyWindow(pWindow);
   } else {
      DBGPRINTF("Window %s created: id=%d", pWindow->pszDbgName, winId);
   }
HelloWindowApp_CreateOrActivatePopup() creates the widget for the pop-up window, then calls HelloWindowApp_CreateWindow() to create the pop-up window.
   pWindow->piWindowWidget = HelloWindowApp_CreateAndInitImageWidget(
                                pMe,
                                "popups.main" // Image as defined in appinfo.ini
                             );
 
   if (pWindow->piWindowWidget == NULL) return;
 
   {
      WExtent extent = {HWA_POPUP_WIDTH, HWA_POPUP_HEIGHT};
      IWIDGET_SetExtent(pWindow->piWindowWidget, &extent);
   }
 
   HelloWindowApp_CreateWindow(pMe, pWindow, AEEWindowMgrExt_CLASS_Popup);
Related information
·                  See Brew MP Widgets Technology Guide: Creating a Widgets application
·                  See Brew MP API Reference

Base version:
Brew MP 1.0
Tested version:
Brew MP 1.0
Phone tested:
No

 

Platform: | Size: 439828 | Author: bluecrest | Hits:

[BREWBREW_UI_Widgets_1_2

Description: a ppt for brew user interface. very useful .can give you much help-ppt for a brew user interface. Very useful. can give you much help
Platform: | Size: 459776 | Author: 高蕾 | Hits:

[Remote Controlc_s_udp_tcp

Description: 基于ace和wxWidgets结合使用的c/s结构的例子,server广播后,client对server发起连接,然后server启动接收线程,并将收到的数据通过单独的线程进行处理;该代码有以下特点:wxWidgets事件循环和ace的Reactor事件循环并行处理,定时器以及读写的并行处理,udp和tcp通信的并行处理,ui线程和通信线程的并行处理;有此例子,开发跨平台跨编译器的带图形界面的c/s程序易如反掌。-wxWidgets based ace and the combined use of c/s structure of the examples, After the broadcast server, client connect to server initiated, then start receiving threaded server and the data received through a separate thread processing; The code has the following characteristics : wxWidgets ace incident cycle and the cycle of Reactor incident parallel processing, Timer and writable parallel processing, tcp and udp communications parallel processing, Got threads and the threads in parallel communications; this example, Cross-platform development of cross-compiler with the graphical interface c/s procedures as easy.
Platform: | Size: 2088960 | Author: wuyan | Hits:

[OtherTableViewerExamplePlugin

Description: Example showing how to use JFace Table viewer widget.
Platform: | Size: 25600 | Author: Edilson Mendes | Hits:

[SymbianWidgets_for_the_S60_Platform_Training_Course_v1_0_

Description: 诺基亚Widget的门例子,里面有PDF文档说明和源码。例子实现的是输入城市的代码,可以查询其三天内的天气。-example for nokia widget
Platform: | Size: 1062912 | Author: H | Hits:

[Symbiannokia-translator

Description: 诺基亚Widget的例子。这是一个在诺基亚支持WRT的SDK上使用Widget来翻译单词的例子。-This a nokia widget example that translate the word in the widget method.
Platform: | Size: 72704 | Author: H | Hits:

[SymbianAmazon

Description: 亚马逊网站在诺基亚Widget上开发的可以查询图书价格排名等的例子。-This is a nokia widget example that developed by Amazon.You can check the book from Amazon web using this widget.
Platform: | Size: 28672 | Author: H | Hits:

[Otherforever

Description: This example continuously draws rectangles in a window and has another widget that counts the number of rectangles that are drawn per second. - This example continuously draws rectangles in a window and has another widget that counts the number of rectangles that are drawn per second.
Platform: | Size: 335872 | Author: subiaolong | Hits:

[androidWidget_Test

Description: android widget 入门例子-Getting Started android widget example
Platform: | Size: 32768 | Author: 刘帅 | Hits:

[androidSimpleWiktionary

Description: android Widget获取天气状况源码-android Widget source for weather conditions
Platform: | Size: 56320 | Author: xingchao | Hits:

[JSP/JavaWidget-Example

Description: widget动画效果例子,请部署到eclipse运行后通过添加小控件来运行,否则无法看到效果-widget animation examples, please run the deployment to the eclipse to run by adding a little control, otherwise the results can not see
Platform: | Size: 95232 | Author: sdfsdfs | Hits:

[Embeded Linuxwidgets

Description: qt的widget类操作 内有详细注解 是学习QT的很好的小例子-qt of the widget class operations with detailed annotations are good to learn a small example of QT
Platform: | Size: 12288 | Author: zhizhong | Hits:

[Delphi VCLAverage

Description: 提供初學者計算平均數的一個簡單範例加上簡單的視窗元件練習-Offers beginners a simple average calculated with a simple widget example exercises
Platform: | Size: 167936 | Author: dennis | Hits:

[Delphi VCLMessage-Box-example

Description: 提供Message Box example的練習並使用視窗元件-Message Box example of the practice to provide and use the widget
Platform: | Size: 319488 | Author: dennis | Hits:

[e-language112

Description: 赋值复制窗口组件应用例,很不错的易语言源码,适合易语言爱好者使用。-Assignment to copy the widget example, very good source of easy language, suitable for easy language enthusiasts.
Platform: | Size: 2048 | Author: good26 | Hits:

[androidWidget

Description: 这是一个安卓手机开发的例子,请大家互相学习交流,谢谢了-This is the example of an Andrews handset development, we learn from each other and exchange, thank you
Platform: | Size: 3651584 | Author: 郑倩 | Hits:

[androidcom.example.test.AppWidgetSetting

Description: 动态时钟widget,设计四时区变换。提供源代码,可以自己尝试修改。-The dynamic clock widget, designed pm transformations
Platform: | Size: 970752 | Author: tommyliu | Hits:

[androidD-Clock-Widget-1.1

Description: 一个ANDROID应用程序例子,显示一个小时钟-ANDROID application example, displays a small clock
Platform: | Size: 33792 | Author: liuhuacheng | Hits:

[GUI DevelopForm-and-widget

Description: 窗体和控件的掌握,例举了9个实例,分别介绍了Combox,listbox等等其他控件的掌握,并实现例举了计算机功能的控件编程-Mastery of forms and controls, for example, the nine instances Combox, listbox, etc. mastery of other controls were introduced, and examples of computer functions control programming
Platform: | Size: 438272 | Author: gxy | Hits:

[androidApptest

Description: 仿照墨迹天气的桌面小插件例子源码,高仿墨迹天气桌面组件,可以实现翻页时钟和根据解析中国天气网天气更新天气和显示对应的天气图片-Source desktop widget example modeled on the ink weather, high imitation ink weather desktop components, can flip clock and analytical China Weather Network Weather and weather updates to display the corresponding picture according to the weather
Platform: | Size: 3095552 | Author: zhchwl | Hits:
« 12 »

CodeBus www.codebus.net