×
Namespaces

Variants
Actions
(Difference between revisions)

Using screen with S60 and Maemo Platforms

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Fix categories)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetaData)
Line 1: Line 1:
 +
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20071119
 +
|author= [[User:Ebra]]
 +
}}
 
[[Category:Maemo]][[Category:Symbian]][[Category:Porting]][[Category:Graphics]][[Category:Symbian C++]]
 
[[Category:Maemo]][[Category:Symbian]][[Category:Porting]][[Category:Graphics]][[Category:Symbian C++]]
 
== Introduction ==
 
== Introduction ==

Revision as of 07:05, 26 July 2012

Article Metadata
Article
Created: ebra (19 Nov 2007)
Last edited: hamishwillee (26 Jul 2012)

Introduction

Both S60 and Maemo Platform have a large set of user interface components that the application can use to create its look.

Hildon reference

Hildon widgets gallery

The S60 or Maemo application can also implement the interface look fully.

Comparing S60 and Maemo Platforms

S60 Platform

The Draw function is called by window server. It is used for both window server initiated redrawing of the control and for some application-initiated drawing. All controls, except blank controls, should implement this function. The default implementation draws a blank control.

Draw function should be implemented by each derived control. The function is only called from within CCoeControl's member functions, and not from the derived class. For this reason it is a private member function of CCoeControl.

// ---------------------------------------------------------
// CBrCtlSampleAppContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CBrCtlSampleAppContainer::Draw(const TRect& aRect) const
{
 
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetBrushColor(KRgbGray);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
 
gc.UseFont(iFont);
 
gc.DrawText(iText, iPoint);
 
gc.DiscardFont();
}

How to make a full-screen application using Symbian C++

Direct Screen Access

Maemo Platform

A drawing_area widget allows a complete control for drawing the contents. If our window is obscured then uncovered, we get an exposure event and must redraw what was previously hidden. A drawing_area widget is essentially an X window and nothing more. It is a blank canvas in which we can draw whatever we like.

/* Create the drawing area */
void create_drawingarea( MainView *main )
{
/* Scrolled window */
main->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(main->scrolled_window);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(main->scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
 
/* Drawing area */
main->drawing_area = gtk_drawing_area_new ();
gtk_widget_set_size_request (main->drawing_area, 100, 100);
 
/* Put drawingarea under scrolledwindow and show it */
gtk_container_add(GTK_CONTAINER(main->scrolled_window), main->drawing_area);
gtk_widget_show(main->drawing_area);
 
/* Connect signals */
g_signal_connect (G_OBJECT (main->drawing_area), "expose_event",
G_CALLBACK (callback_redraw), main);
}
/* redraw */
void callback_redraw (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
GdkFont* font = NULL;
GdkGC* gc = NULL;
 
...
 
gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
 
font = gdk_font_from_description(
pango_font_description_from_string ("Monospace Regular 22"));
 
...
 
gdk_draw_string(widget->window,font,gc,10,30, "No text file");
 
...
 
}
45 page views in the last 30 days.
×