Download 10050 User Interface Programming Model

Transcript
#10050 User Interface Programming Model
After reading this document
After reading this document
This document describes the user interface in theoretical terms and with one or two examples.
Once you have read this document you should be familiar with some of the key principles
required to create rich plug-in user interfaces.
Goals
This document has the following objectives:
•
Introduce terms needed to reason about the user interface programming model.
•
Introduce the key concepts in the user interface programming model.
•
Provide a concrete example of a user interface to illustrate the key concepts.
•
Describe the factoring of the user interface model.
•
Identify key abstractions in the API
•
Discuss relevant design patterns to user interface programming.
•
Define the role played by persistence in the user interface model.
Terminology and definitions
This section introduces the terms needed to understand this document. The term “widget” is
particularly prone to confusion and is always qualified in this document to make its meaning
unambiguous. For example, “static text widget” is highly ambiguous in the context of the
InDesign API and could refer to one of at least four things. This expression does not specify
whether one is referring to the boss class that provides the behaviour (kStaticTextWidgetBoss),
an instance of this boss class, or the ODFRez custom resource type StaticTextWidget, or an
instance of this ODFRez type that is used to specify initial state and properties of a
kStaticTextWidgetBoss object.
8
•
action; this refers to a parcel of functionality that can be invoked through a menu
component or a keyboard shortcut. Plug-ins can implement actions that execute in
response to a IActionComponent::DoAction message from the application framework.
Action components (IActionComponent) in InDesign 2 have completely replaced menu
components (obsoleting IMenuComponent) in the x API. An ActionDef ODFRez custom
resource specifies what action component is responsible for handling an action by ID,
and a MenuDef ODFRez custom resource binds a menu item onto a specific action
component.
•
aggregation; a boss class is said to aggregate an interface if is provides an
implementation of that interface. A boss class may also be said to expose an interface of
a specific type. InDesign interfaces are descendants of the type IPMUnknown. There are