add more examples to samples app

This commit is contained in:
Vsevolod Kukol 2014-07-15 20:17:36 +02:00
Родитель ac5b7c54a9
Коммит a3fdcd19cb
7 изменённых файлов: 47 добавлений и 18 удалений

Просмотреть файл

@ -48,7 +48,7 @@ namespace Samples
b1.Clicked += delegate {
b1.Label = "Clicked!";
};
PackStart (b1);
PackStart (b1, false, false);
Button b2 = new Button ("Click me");
b2.Style = ButtonStyle.Flat;
@ -56,8 +56,18 @@ namespace Samples
b2.Label = "Clicked!";
};
PackStart (b2);
PackStart (new Button (StockIcons.ZoomIn.WithSize (22)));
PackStart (new Button (StockIcons.ZoomIn.WithSize (32), "Custom Size") { WidthRequest = 110, MinHeight = 50 });
var hbox = new HBox();
hbox.PackStart (new Button (StockIcons.ZoomIn.WithSize (22), "Zoom In") { ImagePosition = ContentPosition.Top });
hbox.PackStart (new Button (StockIcons.ZoomOut.WithSize (22), "Zoom Out") { ImagePosition = ContentPosition.Bottom });
hbox.PackStart (new Button (StockIcons.Information.WithSize (48), "Info") { ImagePosition = ContentPosition.Top }, true);
hbox.PackEnd (new Button ("Custom" + Environment.NewLine + "Width") { MinWidth = 110 });
PackStart (hbox);
PackStart (new Button (new CustomImage ().WithSize (22), "with red background") { BackgroundColor = Colors.Red });
MenuButton mb = new MenuButton ("This is a Menu Button");

Просмотреть файл

@ -32,25 +32,31 @@ namespace Samples
{
public Checkboxes ()
{
PackStart (new CheckBox ("Normal checkbox"));
PackStart (new CheckBox ("Mixed to start") { State = CheckBoxState.Mixed });
var a = new CheckBox ("Normal checkbox");
var b = new CheckBox ("Disabled") { Sensitive = false };
var c = new CheckBox ("Allows mixed (with red background)") { AllowMixed = true };
c.BackgroundColor = Xwt.Drawing.Colors.Red;
var b = new CheckBox ("Allows mixed (with red background)") { AllowMixed = true };
b.BackgroundColor = Xwt.Drawing.Colors.Red;
a.Toggled += (sender, e) => b.Sensitive = a.Active;
PackStart (a);
PackStart (b);
PackStart (new CheckBox ("Mixed to start") { AllowMixed = true, State = CheckBoxState.Mixed });
PackStart (c);
int clicks = 0, toggles = 0;
Label la = new Label ();
PackStart (la);
b.Clicked += delegate {
c.Clicked += delegate {
clicks++;
la.Text = string.Format ("state:{0}, clicks:{1}, toggles:{2}", b.State, clicks, toggles);
la.Text = string.Format ("state:{0}, clicks:{1}, toggles:{2}", c.State, clicks, toggles);
};
b.Toggled += delegate {
c.Toggled += delegate {
toggles++;
la.Text = string.Format ("state:{0}, clicks:{1}, toggles:{2}", b.State, clicks, toggles);
la.Text = string.Format ("state:{0}, clicks:{1}, toggles:{2}", c.State, clicks, toggles);
};
}
}

Просмотреть файл

@ -78,12 +78,11 @@ namespace Samples
c3.SelectedText);
};
PackStart (box);
box = new HBox ();
var c4 = new ComboBoxEntry ();
var la4 = new Label ();
box.PackStart (c4);
box.PackStart (la4);
var la4 = new Label ("Selected text: ");
PackStart (c4);
PackStart (la4);
c4.Items.Add (1, "One");
c4.Items.Add (2, "Two");
@ -92,7 +91,6 @@ namespace Samples
c4.TextEntry.Changed += delegate {
la4.Text = "Selected text: " + c4.TextEntry.Text;
};
PackStart (box);
HBox selBox = new HBox ();
Label las = new Label ("Selection:");

Просмотреть файл

@ -39,6 +39,9 @@ namespace Samples
public ProgressBarSample ()
{
PackStart (new ProgressBar { Fraction = 0 });
PackStart (new ProgressBar { Fraction = 0.5d, MinHeight = 20 });
PackStart (new ProgressBar { Fraction = 1 });
indeterminateProgressBar = new ProgressBar ();
PackStart (indeterminateProgressBar, true);
indeterminateProgressBar.Indeterminate = true;

Просмотреть файл

@ -57,9 +57,11 @@ namespace Samples
var b4 = new RadioButton (box);
var b5 = new RadioButton ("Second Option");
var b6 = new RadioButton ("Disabled Option") { Sensitive = false };
PackStart (b4);
PackStart (b5);
b4.Group = b5.Group;
PackStart (b6);
b4.Group = b5.Group = b6.Group;
}
}
}

Просмотреть файл

@ -23,7 +23,6 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Xwt;
namespace Samples
@ -37,6 +36,13 @@ namespace Samples
PackStart (button);
PackStart (new Spinner ());
PackStart (new Spinner () { MinHeight = 50 });
PackStart (new Label ("Click to toggle animation:"));
var clickable = new Spinner () { MinHeight = 30, Animate = true };
clickable.ButtonPressed += (sender, e) => clickable.Animate = !clickable.Animate;
PackStart (clickable);
}
}
}

Просмотреть файл

@ -77,6 +77,10 @@ namespace Samples
TextEntry te2 = new TextEntry ();
te2.Font = te2.Font.WithScaledSize (0.5);
PackStart (te2);
PackStart (new TextEntry { Text = "Entry with custom height", MinHeight = 50 });
PackStart (new TextEntry { Text = "Readonly text", ReadOnly = true });
PackStart (new Label ("Entry with placeholder text"));
TextEntry te3 = new TextEntry ();