~ubuntu-branches/ubuntu/lucid/gbrainy/lucid

« back to all changes in this revision

Viewing changes to src/Games/Calculation/CalculationProportions.cs

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-03-08 11:11:11 UTC
  • mfrom: (13.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100308111111-pxz008t81zfu1w8q
Tags: 1.40-1ubuntu1
* Update from Debian unstable, remaining changes: (LP: #534113)
* debian/patches/01_lpi.patch:
* debian/patches/99_autoreconf.patch:
* debian/control:
  - Add Launchpad integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
using gbrainy.Core.Main;
25
25
using gbrainy.Core.Libraries;
 
26
using gbrainy.Core.Toolkit;
26
27
 
27
28
namespace gbrainy.Games.Calculation
28
29
{
94
95
                        }
95
96
 
96
97
                        right_answer += GetPossibleAnswer (which);
97
 
                }
98
98
 
99
 
                public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
100
 
                {       
 
99
                        // Options
101
100
                        double x = DrawAreaX + 0.25, y = DrawAreaY + 0.16;
102
 
                        int indx;
103
 
 
104
 
                        base.Draw (gr, area_width, area_height, rtl);
105
 
 
106
 
                        gr.SetPangoLargeFontSize ();
107
 
 
 
101
                        Container container = new Container (x, y,  1 - (x * 2), 0.6);
 
102
                        AddWidget (container);
 
103
        
108
104
                        for (int i = 0; i < options_cnt; i++)
109
105
                        {
110
 
                                gr.MoveTo (x, y);
111
 
                                indx = random_indices[i];
112
 
                                gr.ShowPangoText (String.Format ("{0}) {1:##0.##}", GetPossibleAnswer (i) , options [indx]));
113
 
 
114
 
                                y = y + 0.15;
 
106
                                DrawableArea drawable_area = new DrawableArea (0.3, 0.1);
 
107
                                drawable_area.X = x;
 
108
                                drawable_area.Y = y + i * 0.15;
 
109
                                container.AddChild (drawable_area);
 
110
                                drawable_area.Data = i;
 
111
                                drawable_area.DataEx = GetPossibleAnswer (i);
 
112
 
 
113
                                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
 
114
                                {
 
115
                                        int n = (int) e.Data;
 
116
                                        int indx = random_indices[n];
 
117
 
 
118
                                        e.Context.SetPangoLargeFontSize ();
 
119
                                        e.Context.MoveTo (0.02, 0.02);
 
120
                                        e.Context.ShowPangoText (String.Format ("{0}) {1:##0.##}", GetPossibleAnswer (n), options [indx]));
 
121
                                };
115
122
                        }
116
123
                }
117
124
        }