abock / moonshine

An embedded media player plugin for Firefox that leverages Moonlight to provide native Windows Media support for Linux.

jstedfast (author)
Wed Sep 02 12:33:04 -0700 2009
Aaron Bockover (committer)
Wed Sep 02 12:53:06 -0700 2009
moonshine / player / mtk / mtk-label.js
100644 45 lines (36 sloc) 1.24 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// This file is licensed under the MIT X11 open source license.
// http://www.opensource.org/licenses/mit-license.php
//
// Authors: Aaron Bockover <abockover@novell.com>
//
// Copyright 2009 Novell, Inc.
//
 
function MtkLabel (settings) {
   MtkXaml.call (this, "<TextBlock/>", settings);
   
   this.CustomSize = false;
   this.CustomForeground = false;
   this.CustomFamily = false;
   
   this.MapProperties ([
        [ "Text", "QueueResize" ],
        [ "FontFamily", "QueueResize" ],
        [ "FontSize", "QueueResize" ],
        [ "FontStretch", "QueueResize" ],
        [ "FontStyle", "QueueResize" ],
        [ "FontWeight", "QueueResize" ],
        [ "TextWrapping", "QueueResize" ],
        [ "TextDecorations", "QueueResize" ],
        [ "Foreground" ]
    ]);
 
    if (typeof settings == "string") {
        this.Text = settings;
    }
    
    this.Override ("OnStyleSet", function () {
        if (!this.CustomFamily) this.FontFamily = MtkStyle.Font.Family;
        if (!this.CustomSize) this.FontSize = MtkStyle.Font.Size;
        if (!this.CustomForeground) this.Foreground = MtkStyle.GetColor ("window_fg");
    });
 
    // Override default XAlign = 0.5
    this.XAlign = 0.0;
 
    this.AfterConstructed ();
}