03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Some commands can be executed immediately, given only their ID. An Exit command exits<br />

the application. (If the application has unsaved data, we don't ask the user: we simply save<br />

the data. If the user didn't want to exit, all that is needed is to start the application again.)<br />

Other commands need further UI processing. A Find command, for example, needs some<br />

text to find, and possibly some indication of where to look. Handling such commands<br />

involves dialogs, which are the subject of <strong>Chapter</strong> 10.<br />

Not all input to applications comes from commands. If you type the letter X into a word<br />

processor while you're editing, it doesn't generate a command, but a key event. If you tap on<br />

an entry in an Agenda, it doesn't generate a command, but a pointer event. Handling pointer<br />

and key events is the business of the app view and other controls in the application. After a<br />

chapter on drawing to controls (<strong>Chapter</strong> 11), I cover key and pointer interaction in <strong>Chapter</strong><br />

12.<br />

Some key and pointer events are captured by controls in the Uikon framework and turned<br />

into commands. Later in this chapter, we'll get a glimpse into how the menu and shortcut key<br />

controls convert these basic UI events into commands.<br />

The declaration of CHelloGuiAppUi in HelloGui_AppUi.h is as follows:<br />

class CHelloGuiAppUi : public CQikAppUi<br />

{<br />

public:<br />

void ConstructL();<br />

~CHelloGuiAppUi();<br />

private: // from CEikAppUi<br />

void HandleCommandL(TInt aCommand);<br />

private:<br />

CHelloGuiAppView* iAppView;<br />

};<br />

As is usually the case, the second-phase constructor and the destructor reveal who owns<br />

what:<br />

void CHelloGuiAppUi::ConstructL()<br />

{<br />

CQikAppUi::ConstructL();<br />

iAppView = CHelloGuiAppView::NewL(ClientRect());<br />

}<br />

CHelloGuiAppUi::~CHelloGuiAppUi()<br />

{<br />

delete iAppView;<br />

}<br />

Again, this class is derived from the UIQ CQikAppUi class, rather than the Uikon<br />

CEikAppUi equivalent, but as with the application class, there is no significant difference in<br />

the implementation.

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

Saved successfully!

Ooh no, something went wrong!