Open-source things (III)-overall itoday Design

Source: Internet
Author: User

This article describes the first version of the overall itoday design.

UML diagram

Panelmanager

Itoday masterProgramOnly contains panelmanager. All messages received by the message loop in the main window thread are delivered to panelmanager for processing. The itoday main program does not process any business logic.

 

Panelmanager has three main member variables. Among them, Panels represents the containers of all panel pointers. The storage is the pointer to panelbase, and the object is a specific panel object. Activepanel is the pointer to the current active panel. Swither is a special panel with a single object, not in the map container.

 

Message event processing

The main window thread receives any event and processes it to panelmanager, which distributes it to activepanel and swither for processing. All panel classes inherited from the abstract class panelbase must overload the virtual functions processmousedownevent (), processmouseupevent (), processotherevents (), and processgesture () to process events and messages. If it is a mouse event, activepanel and swither will determine whether they are in their own region based on the internal judgment, no need to deal with it. The specific panel class can call the draw () function of panelmanager as needed, directly requiring re-painting to perform the animation process.

 

Painting

The painting of itoday consists of the draw () function of panelmanager, which is composed of two parts: activepanel and swither. The draw () process of panelmanager is like this. The preparedraw () of activepanel and swither are called respectively. activepanel and swither only need to draw the image to the memory. Then, panelmanager draws the image to the real device at a time. The dual buffer is used here. In this way, all the Panel classes inherited from the abstract panelbase class need to overload the preparedraw () function according to their current needs, and draw the information to the memory.

 

How to develop a new panel

The principle of this framework is that when a panel is added, panelmanager only makes changes to the place where the Panel is initialized and loaded without changing any message processing and painting processes. The panelmanager class is decoupled from the Panel class. To develop a specific panel class, you need to overload the event functions processmousedownevent (), processmouseupevent (), processotherevents (), and processgesture (). The specific panel class can customize its own events, for example, homepanel can customize the monitoring registry message event. panelmanager does not need to make any changes to support this custom event. At the same time, you need to reload preparedraw () to draw your own logic.

 

Please consider whether the framework is perfect based on the specific panel requirements. If you have any suggestions, please give feedback and make improvements in a timely manner.

 

For other itodayArticleSee:

Open source (1)

Open-source things (2)-itoday open-source project plan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.