~ubuntu-branches/ubuntu/precise/gnome-do/precise-backports

« back to all changes in this revision

Viewing changes to Do.Addins/src/Do.UI/BaseWidgets/IconBox.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2008-10-08 20:35:38 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20081008203538-yty5q4gpfx1ldint
Tags: 0.6.1.0-0ubuntu1
* New upstream release.  FFe is (LP: #279328)
* debian/patches/04_fix_locale_path:
  + Fix the translations path sent to gettext.  Without this, translations
    aren't used by Do.
* debian/gnome-do.gconf-defaults:
  + Don't popup the UI on login; wait for the user to summon Do.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
                protected bool focused, textOverlay;
36
36
 
37
 
                protected string caption, icon_name;
 
37
                protected string caption, icon_name, highlight;
38
38
                protected Pixbuf empty_pixbuf;
39
39
                protected int icon_size;
40
40
                
43
43
                protected Label label;
44
44
                protected Gdk.Pixbuf overlay_pixbuf;
45
45
 
46
 
                protected float focused_transparency = 0.4f;
47
 
                protected float unfocused_transparency = 0.1f;
 
46
                protected float focused_fill_transparency = 0.4f;
 
47
                protected float unfocused_fill_transparency = 0.1f;
 
48
                protected float focused_frame_transparency = 0.3f;
 
49
                protected float unfocused_frame_transparency = 0.075f;
48
50
 
49
51
                public IconBox (int icon_size) : base ()
50
52
                {
58
60
                        Alignment label_align;
59
61
 
60
62
                        caption = string.Empty;
 
63
                        highlight = string.Empty;
61
64
                        
62
65
                        vbox = new VBox (false, 4);
63
66
                        vbox.BorderWidth = 6;
96
99
                public virtual void Clear ()
97
100
                {
98
101
                        Pixbuf = null;
 
102
                        highlight = string.Empty;
99
103
                        Caption = string.Empty;
100
104
                        icon_name = string.Empty;
101
105
                        TextOverlay = false;
125
129
                                
126
130
                                textOverlay = value;
127
131
                                if (value) {
128
 
                                        FillAlpha = FrameAlpha = 0.4;
 
132
                                        FillAlpha = focused_fill_transparency;
 
133
                                        FrameAlpha = focused_frame_transparency;
129
134
                                        FillColor = FrameColor = new Color (0x00, 0x00, 0x00);
130
135
                                        image.Hide ();
131
136
                                        label.Ellipsize = Pango.EllipsizeMode.None;
132
137
                                        label.LineWrapMode = Pango.WrapMode.WordChar;
133
138
                                        label.LineWrap = true;
 
139
                                        highlight = string.Empty;
134
140
                                } else {
135
141
                                        FillColor = FrameColor = new Color (0xff, 0xff, 0xff);
136
142
                                        image.Show ();
144
150
                {
145
151
                        get { return caption; }
146
152
                        set {
147
 
                                caption = value ?? string.Empty;
 
153
                                caption = GLib.Markup.EscapeText (value ?? string.Empty);
148
154
                                caption = caption.Replace ("\n", " ");
 
155
                                UpdateLabel ();
 
156
                        }
 
157
                }
 
158
                
 
159
                private void UpdateLabel ()
 
160
                {
149
161
                                int lines = label.Layout.LineCount;
150
162
                                label.Markup = string.Format (CaptionFormat, 
151
 
                                                              Util.Appearance.MarkupSafeString (caption));
 
163
                                                              Util.FormatCommonSubstrings (caption, highlight, HighlightFormat));
152
164
                                if (lines != label.Layout.LineCount && LinesChanged != null)
153
165
                                        LinesChanged (label.Layout.LineCount, new EventArgs ());
154
 
                        }
155
166
                }
156
167
 
157
168
                public string Icon
198
209
                public string Highlight
199
210
                {
200
211
                        set {
201
 
                                string highlight;
202
 
 
203
 
                                if (value != null) {
204
 
                                        highlight = Util.FormatCommonSubstrings (caption, value, HighlightFormat);
205
 
                                } else {
206
 
                                        highlight = caption;
207
 
                                }
208
 
                                Caption = highlight;
 
212
                                highlight = (value ?? string.Empty);
 
213
                                UpdateLabel ();
209
214
                        }
210
215
                }
211
216
 
212
217
                protected virtual void UpdateFocus ()
213
218
                {
214
 
                        FrameAlpha = FillAlpha = (focused ? focused_transparency : unfocused_transparency);
 
219
                        FillAlpha = (focused ? focused_fill_transparency : unfocused_fill_transparency);
 
220
                        FrameAlpha = (focused ? focused_frame_transparency : unfocused_frame_transparency);
215
221
                }
216
222
                
217
223
                protected override void PaintFill ()