XML
  Home arrow XML arrow Page 2 - Skinning Your Custom XUL Applications
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Skinning Your Custom XUL Applications
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2006-05-01

    Table of Contents:
  • Skinning Your Custom XUL Applications
  • Setting up a Stylesheet
  • Register or Not
  • The Moment of Truth

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Skinning Your Custom XUL Applications - Setting up a Stylesheet


    (Page 2 of 4 )

    If you created the XUL application from the last series, you'll notice that it's a pretty dull grey at the moment and that the toolbar and menu bar are different shades of grey, making it look, on the whole, a little untidy.  If you create a XUL application without specifying any style information at all, that is what you get:

     

    To correct this, you can set a default stylesheet that gives the application its basic appearance.  The following stylesheet will give an application a standard color of silver and generally tidy things up a little:

    @import url("chrome://global/skin/");

    @import namespace url
    ("http://www.mozilla.org/keymaster/gatekeeper/there.is.
    only.xul");

    #buttonOpen {

      list-style-image: url("icons/open.gif");

    }

    #buttonSave {

      list-style-image: url("icons/save.gif");

    }

    #buttonNew {

      list-style-image: url("icons/new.gif");

    }

    #buttonToolbar {

      list-style-image: url("icons/menubar.gif");

    }

    #formsButton {

      list-style-image: url("icons/forms.gif");

    }

    #windowElementButton {

      list-style-image: url("icons/window.gif");

    }

    toolbar, menubar, menupopup, menuitem, menu, toolbargrippy {

      background-color: silver;

      font-weight: bold;

    }

    menuitem[_moz-menuactive="true"], menu[_moz-menuactive="true"] {

      background-color: navy;

      color: white;

    }

    menuseparator {

      border-bottom: 1px solid black;

    }

    As you can see, it's pretty standard CSS; mostly just ID and element selectors and style information.  The lines of code encased in square brackets are custom Mozilla style properties that are used to specify different styles for different element states, giving you roll-overs for example.  You can also use class and ID selectors as you can with HTML, and use the list-style-image: property to specify different icons for different skins.  Using element or ID selectors in your CSS file means that the only change you need to make to your XUL file is adding the xml-stylesheet declaration. 

    There are a whole host of built-in style properties that you can use when developing for Mozilla; a lot of them relate to Mozilla-specific layouts like the _moz-box-orient property.  Probably the best one is the _moz-border-radius property that is used to round off what would normally be square borders, which is great for panel tabs or box decoration.

    Some elements of a XUL application seem styled even when no CSS files are in use; in the XUL Edit application, that some of you may have created before, the menuitems already changed color when the mouse rolled over them.  When you begin to add style information for certain elements, these in-built styles change, which forces you to need further rules to correct this. 

    More XML Articles
    More By Dan Wellman


       · Hi,This article describes creating a basic, default skin for your own XUL...
     

    XML ARTICLES

    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE
    - UI Design with Java and XML Toolkits
    - Displaying ADO Retrieved Data with XML Islan...
    - Widget Walkthrough
    - Introduction to Widgets
    - The Why and How of XML Data Islands
    - Creating an XUL App Installer







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway