org.symbian.tools.wrttools.doc.WRTKit/html/WRTKit_Customizing_the_WRTKit_look-GUID-43369c51-23cf-41ac-a2f4-6320dc6eda9a.html
author Eugene Ostroukhov <eugeneo@symbian.org>
Wed, 28 Jul 2010 09:27:51 -0700
changeset 455 5da55957c779
parent 230 7848c135d915
permissions -rw-r--r--
Bluetooth support was refactored on top of a new frameworks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
230
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     1
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     2
<html lang="en" xml:lang="en">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     3
<head>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     4
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     5
<meta name="copyright" content="(C) Copyright 2005" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     6
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     7
<meta content="concept" name="DC.Type" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     8
<meta name="DC.Title" content="Customizing the WRTKit look" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     9
<meta scheme="URI" name="DC.Relation" content="WRTKit_Common_WRTKit_tasks-GUID-24870895-4449-4307-9a54-7c90f7b3905e.html" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    10
<meta content="XHTML" name="DC.Format" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    11
<meta content="GUID-43369C51-23CF-41AC-A2F4-6320DC6EDA9A" name="DC.Identifier" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    12
<meta content="en" name="DC.Language" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    13
<link href="commonltr.css" type="text/css" rel="stylesheet" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    14
<title>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    15
Customizing the WRTKit look</title>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    16
</head>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    17
<body id="GUID-43369C51-23CF-41AC-A2F4-6320DC6EDA9A"><a name="GUID-43369C51-23CF-41AC-A2F4-6320DC6EDA9A"><!-- --></a>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    18
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    19
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    20
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    21
    <h1 class="topictitle1">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    22
Customizing the WRTKit look</h1>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    23
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    24
    <div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    25
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    26
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    27
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    28
            All visuals in the WRTKit are defined using CSS and images that are 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    29
            located inside the WRTKit library in the Resources directory. The 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    30
            code that implements the WRTKit user interface elements does not 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    31
            actually know or care what the user interface looks like. Instead 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    32
            the code creates an HTML element hierarchy to implement each control 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    33
            and view and then sets CSS style class names to these elements. 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    34
            Whenever the state changes (e.g. the control gets focused) the class 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    35
            names are updated to reflect the new state. The CSS in the Resources 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    36
            directory defines the style rules for the class names and visuals 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    37
            are applied to the controls and views like for any other CSS styled 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    38
            HTML elements. This results in a system where only CSS and images 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    39
            need to be modified in order to implement a new look for a custom 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    40
            WRTKit user interface - but no JavaScript code.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    41
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    42
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    43
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    44
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    45
            All CSS rules for the WRTKit are defined in a file called UI.css in 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    46
            the WRTKit library Resources directory. This file defines hundreds 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    47
            of style classes and can seem intimidating and complex, but the 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    48
            principle behind the classes is actually very simple. Each HTML 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    49
            element in each control has a common class and a set of state-
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    50
            specific classes. E.g. the text element in the NavigationButton 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    51
            control has "NavigationButtonText", "NavigationButtonTextNormal", 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    52
            "NavigationButtonTextFocus", etc. The classes are applied based on 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    53
            the current state of that element. So in our example if the button 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    54
            was focused, the text element would be assigned the CSS classes 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    55
            "NavigationButtonText" and "NavigationButtonTextFocus". Two classes 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    56
            define all of the styling for the text element portion of the 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    57
            NavigationButton control in the focused state.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    58
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    59
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    60
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    61
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    62
            Using two classes at the same time is convenient because it allows 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    63
            common elements to be defined in the common class and only special 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    64
            adaptations of that common rule in the state-specific class. One 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    65
            pattern that is repeated throughout the WRTKit is to define a 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    66
            background image in the common class and an image position offset in 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    67
            the state-specific class. This makes switching from one state to 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    68
            another (e.g. when a checkbox is checked) very straight forward. 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    69
            Even if the graphics appear to change, no images need to be loaded 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    70
            or switched but instead just the image offset changes and the result 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    71
            is that the graphics have changed.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    72
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    73
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    74
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    75
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    76
            Controls and views use HTML element hierarchies that are fine 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    77
            grained enough that various kinds of layout customizations can be 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    78
            applied without having CSS styles affect parts of a control that 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    79
            they were not intended to affect. The result is more CSS rules and 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    80
            more expansive element hierarchies, but also more freedom and 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    81
            flexibility.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    82
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    83
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    84
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    85
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    86
            In most cases all that is needed to change the visuals of a WRTKit 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    87
            user interface is to modify the images in the Resource directory and 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    88
            update the color definitions for controls in the CSS file. The image 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    89
            files that supply graphics to views and controls in the Resource 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    90
            directory are named with clear names to make customization easy. 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    91
            Just make a backup copy of the default graphics and CSS styles and 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    92
            experiment! You will probably be surprised at how easy it is to make 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    93
            a custom user interface theme!
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    94
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    95
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    96
    </div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    97
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    98
<div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    99
<div class="familylinks">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   100
<div class="parentlink"><strong>Parent topic:</strong> <a href="WRTKit_Common_WRTKit_tasks-GUID-24870895-4449-4307-9a54-7c90f7b3905e.html">Common WRTKit tasks</a></div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   101
</div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   102
</div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   103
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   104
</body>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   105
</html>