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.Clicked += delegate {
b1.Label = "Clicked!"; b1.Label = "Clicked!";
}; };
PackStart (b1); PackStart (b1, false, false);
Button b2 = new Button ("Click me"); Button b2 = new Button ("Click me");
b2.Style = ButtonStyle.Flat; b2.Style = ButtonStyle.Flat;
@ -58,6 +58,16 @@ namespace Samples
PackStart (b2); PackStart (b2);
PackStart (new Button (StockIcons.ZoomIn.WithSize (22))); 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 }); PackStart (new Button (new CustomImage ().WithSize (22), "with red background") { BackgroundColor = Colors.Red });
MenuButton mb = new MenuButton ("This is a Menu Button"); MenuButton mb = new MenuButton ("This is a Menu Button");

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

@ -32,25 +32,31 @@ namespace Samples
{ {
public Checkboxes () public Checkboxes ()
{ {
PackStart (new CheckBox ("Normal checkbox")); var a = new CheckBox ("Normal checkbox");
PackStart (new CheckBox ("Mixed to start") { State = CheckBoxState.Mixed }); 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 }; a.Toggled += (sender, e) => b.Sensitive = a.Active;
b.BackgroundColor = Xwt.Drawing.Colors.Red;
PackStart (a);
PackStart (b); PackStart (b);
PackStart (new CheckBox ("Mixed to start") { AllowMixed = true, State = CheckBoxState.Mixed });
PackStart (c);
int clicks = 0, toggles = 0; int clicks = 0, toggles = 0;
Label la = new Label (); Label la = new Label ();
PackStart (la); PackStart (la);
b.Clicked += delegate { c.Clicked += delegate {
clicks++; 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++; 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);
}; };
} }
} }

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

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

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

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

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

@ -57,9 +57,11 @@ namespace Samples
var b4 = new RadioButton (box); var b4 = new RadioButton (box);
var b5 = new RadioButton ("Second Option"); var b5 = new RadioButton ("Second Option");
var b6 = new RadioButton ("Disabled Option") { Sensitive = false };
PackStart (b4); PackStart (b4);
PackStart (b5); 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, // 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 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
using System;
using Xwt; using Xwt;
namespace Samples namespace Samples
@ -37,6 +36,13 @@ namespace Samples
PackStart (button); PackStart (button);
PackStart (new Spinner ()); 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);
} }
} }
} }

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

@ -78,6 +78,10 @@ namespace Samples
te2.Font = te2.Font.WithScaledSize (0.5); te2.Font = te2.Font.WithScaledSize (0.5);
PackStart (te2); 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")); PackStart (new Label ("Entry with placeholder text"));
TextEntry te3 = new TextEntry (); TextEntry te3 = new TextEntry ();
te3.PlaceholderText = "Placeholder text"; te3.PlaceholderText = "Placeholder text";