Studio Developer Manual / Version 2010
Table Of Contents
Since CoreMedia Studio is based on the Sencha ExtJS framework, it uses and extends the
provided skin concept. Styling rules are encapsulated in SCSS mixins and can be applied by using
the ui configuration
. There are SCSS mixins for almost every component and
CoreMedia Studio also provides a huge set of skins, which create the visual
appearance of said components.
If a component does not support the usage of skins, or the skin concept does not satisfy the requirements for certain situations you can learn about custom styles as described in Section 7.12.3, “Styling of Custom Studio Components”.
Please bear in mind that it is not always necessary to write a new skin if you want to change the appearance of a certain component. To change styles, you have multiple options:
Change global styles by setting theme variables
Change a skin by setting global CoreMedia variables
Write a new skin and change the
ui configuration
of the component
Please make sure to read the Theming Section of the ExtJS API documentation to understand the core concepts of the Theming System.
Change global styles by setting theme variables
To change the appearance of components ExtJS provides theme variables. If you want to change the style rules of
a component, it can often be sufficient to simply override these variables in the blueprint-studio-theme
.
Please keep in mind, that you will affect every skin of a component type by changing theme variables. Mixins
use theme variables as default if a parameter is not set explicitly.
The following example shows how to set theme variables for panels. Please take a look at the Sencha ExtJS API documentation to get a list of available theme variables.
... $panel-header-color: dynamic($cm-font-color); $panel-header-padding: dynamic($cm-grid-100); $panel-body-background-color: dynamic(transparent); $panel-body-border-width: dynamic(0); ...
Example 7.48. Overriding theme variables
By assigning a SCSS variable with dynamic(...)
you make sure that the new value is applied even in
earlier usages of this variable. Please read the Sencha ExtJS CSS Variables Section to learn about dynamic
variables. Since the blueprint-studio-theme
is the last theme to be loaded, the value will
not be overridden by another theme if you put the assignment in the theme's sass/var/Ext/
folder.
Change a skin by setting global CoreMedia variables
CoreMedia Studio also provides own theme variables, which are used as default
parameters in cm-[component]-ui
mixins or provide a possibility to change styles of custom
components. These CoreMedia variables begin with a $cm-
prefix:
... $cm-panel-show-validation: dynamic(true); $cm-panel-box-shadow: dynamic($cm-elevation-box-shadow-100); $cm-panel-ghost-background-color: dynamic($cm-grey-1); $cm-panel-use-sub-collapsible-separator: dynamic(false); ...
Example 7.49. Overriding global CoreMedia variables
Caution
To prevent unpredictable component styling, it is not allowed to use the prefix $_cm-
in your own
variables, since it is reserved for private variables in the Studio Theme.
Overriding these variables can lead to unwanted behavior and incorrect style rules for skins.
Write a new skin and change the ui configuration
of the component
The Studio Theme creates styles by including SCSS mixins:
@if $cm-include-panel-accordion-ui { $_ui: "accordion"; @include extjs-panel-ui( $ui: $_ui, $ui-header-color: $cm-font-color, ... ); @include cm-panel-ui( $ui: $_ui, $background-color: $cm-white, ... ); }
Example 7.50. Simple Skin Example
As shown in Example 7.50, “Simple Skin Example”, the Studio Theme always includes two SCSS mixins per skin. In addition to the ExtJS mixin, Studio Theme provides own mixins, which extend the ExtJS Framework. These mixins provide helpful functionality and enhancements, which are applied, even if only the ui parameter is passed to the mixin's parameter list (such as default styles for validation). Therefore, it is necessary to always include both mixins.
Please take a look at the ExtJS - Classic Toolkit API to get a list of theme mixins and possible parameters.
Please note that the Studio Theme wraps mixin includes in if
-statements.
You can easily switch off mixin includes by setting the corresponding $cm-include-[XTYPE]-[SKIN-NAME]-ui
variables to false. Please keep in mind that switching a skin off, will remove all styles for
components using the skin. The components will therefore be not styled. If the skin is still set in the ui
configuration
, not even the default styles will be applied.
// Switching off skin "accordion" $cm-include-panel-accordion-ui: dynamic(false);
Example 7.51. Switching off skins
A skin should be switched off if you want to write an own skin or the skin is simply not used anymore. After
switching it off, you can include the SCSS mixins in the blueprint-studio-theme
with the
same ui
parameter to create the style rules for your own skin.
CoreMedia Studio uses ActionScript classes to group skins for components. These
classes contain constants for each skin, which provide a stable interface to use skins as
ui-configuration
in components. It is recommended using this concept when applying skins to
components. Otherwise, it can get very difficult to tell which skins are currently used in
CoreMedia Studio.
public static const DEFAULT:PanelSkin = new PanelSkin("default"); public static const DOCKED:PanelSkin = new PanelSkin("docked"); public static const ACCORDION:PanelSkin = new PanelSkin("accordion"); public static const CARD:PanelSkin = new PanelSkin("card"); ...
Example 7.52. ActionScript Skin Constants
To apply a skin to a component, you just have to pass it to the ui configuration
. If no
ui configuration
is applied, the used skin will be "default". The following example shows how to
apply the toolbar skin to a button:
<Button itemId="myToolbarButton" ui="{ButtonSkin.TOOLBAR.getSkin()}"/>
Example 7.53. Applying a Skin to a Component
Skins of the same component category are exchangeable without any other adjustments. If no skin is applied, the default skin will be used instead.