31.05.2013 Views

think-cell technical report TC2003/01 A GUI-based Interaction ...

think-cell technical report TC2003/01 A GUI-based Interaction ...

think-cell technical report TC2003/01 A GUI-based Interaction ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.1 Program Architecture IMPLEMENTATION<br />

which is another system routine that effectively calls the DefWindowProc() pro-<br />

cedure of the concerned window. The DefWindowProc() may be overloaded with<br />

user code. While a message is being processed, often more messages are generated<br />

and sent to other windows or threads. The respective system call is SendMessage(),<br />

which is implemented synchronously: When the message is sent to the same thread,<br />

SendMessage() effectively makes a call to the respective subroutine. Otherwise, the<br />

message is queued in the message queue of the destination thread and the sending<br />

thread is put on hold until the message has been processed.<br />

The prototype uses a number of so-called hooks 12 to get notified when certain<br />

messages are retrieved by PowerPoint via PeekMessage() or GetMessage(). More-<br />

over, using window subclassing, the DefWindowProc() of the PowerPoint document<br />

windows is overloaded. That way, custom code gets executed whenever a message<br />

of interest comes by, which gives the opportunity to realize an interactive add-in to<br />

PowerPoint.<br />

visible:CSmartGrid ... :CPPTDocWnd :CSmartElement :CFeature vertical:CGridLineGroup :CGridLine<br />

RecreateUI()<br />

horizontal:CGridLineGroup<br />

DropUI()<br />

CreateUI()<br />

Col<br />

CreateUI()<br />

Col<br />

CreateUI()<br />

Col<br />

CreateUI()<br />

Col<br />

:CUIObject<br />

Figure 39: Instantiation of appropriate UI objects on request<br />

CreateUI()<br />

Col<br />

For example, in response to some external event, the framework decides to recre-<br />

ate the user interface. Figure 39 exemplifies what then happens: The framework<br />

generates a message RecreateUI() that is sent to a document window. 13 The docu-<br />

ment window first drops any existing UI objects and then fetches a collection 14 of<br />

newly created UI objects from its visible smart grid. The call is recursively passed<br />

down to all smart elements, features and gridlines, that are placed in that smart<br />

grid. At each stage, UI objects are generated and are collected from any subordinate<br />

12In the Microsoft Windows API, a hook is a call-back technique that registers user code to be<br />

executed at certain system events.<br />

13I use the Microsoft terminology here. Read: The RecreateUI() method of an instance of class<br />

CPPTDocWnd is invoked.<br />

14Col is a custom implementation of a collection, which represents a list of objects of<br />

the same type that can be iterated.<br />

74<br />

:CUIObject

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!