BMP平臺MVC的設計模式

這是高通BMP平臺上的MVC設計模式,這個框架的核心就是以數據來驅動界面,對於做UI的朋友們來說,很有借鑑意義。

Design Patterns

  • BUIW is built using common software engineering design patterns.
  • Model-View-Controller (MVC) pattern is important to understand.
  • Other patterns used in BUIW are decorator and observer patterns.

 

 MVC模式框架圖

Containers

  • A container is a collection of widgets, decorators and further sub-containers.
  • Containers keep track of relative order of widgets, their position and layout.
  • A container will handle clipping as required.
  • The top level container is called the root container.
  • Lots of different types of containers – CardContainer, GridContainer, ConstraintContainer, PropContainer, XYContainer.

 

 

Models

  • The data that drives a widget is stored within a model
  • The following models are available
  • IValueModel: A model for data that can be represented in an arbitrarily complex form
  • IListModel: A base class for IArrayModel and IVectorModel
  • IArrayModel: A model for a collection of objects of equal fixed size
  • IVectorModel: A model for a collection of objects that might be of a variable size
  • IFrameModel: Base class for IMediaFrameModel and ICameraFrameModel
  • IMediaFrameModel: Provides image frames from a video
  • ICameraFrameModel: Provides image frames from a camera
  • IInterfaceModel: Provides a model interface for objects that model their data in an interface that does not have a query interface, for example, bitmap and image widgets
  • ITextModel: Model for text strings such as in text entry
  • IMenuModel: Derived from IListModel

 

Widget View

  • Responsible for rendering the model‟s data to the display
  • Listens for model notifications
  • Sends invalidation request to parent container, so only redraws when directed
  • By letting root container redraw multiple requests can be grouped together
  • The size of the content area of the view is known as the extent
  • Be sure to set the extent
  • The full extent of widget doesn‟t have to be redrawn when the widget is invalidated

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章