mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
@@ -203,20 +203,42 @@ namespace UICatalog {
|
||||
X = Pos.X(scrollView),
|
||||
Y = Pos.Bottom(scrollView) + 1,
|
||||
};
|
||||
hCheckBox.Toggled += (previousChecked) => {
|
||||
scrollView.ShowHorizontalScrollIndicator = hCheckBox.Checked;
|
||||
};
|
||||
Win.Add (hCheckBox);
|
||||
|
||||
var vCheckBox = new CheckBox ("Vertical Scrollbar", scrollView.ShowVerticalScrollIndicator) {
|
||||
X = Pos.Right (hCheckBox) + 3,
|
||||
Y = Pos.Bottom (scrollView) + 1,
|
||||
};
|
||||
vCheckBox.Toggled += (previousChecked) => {
|
||||
scrollView.ShowVerticalScrollIndicator = vCheckBox.Checked;
|
||||
};
|
||||
Win.Add (vCheckBox);
|
||||
|
||||
var t = "Auto Hide Scrollbars";
|
||||
var ahCheckBox = new CheckBox (t, scrollView.AutoHideScrollBars) {
|
||||
X = Pos.Left (scrollView) + scrollView.Bounds.Width / 2 - t.Length / 2,
|
||||
Y = Pos.Bottom (scrollView) + 3,
|
||||
};
|
||||
hCheckBox.Toggled += (previousChecked) => {
|
||||
if (!ahCheckBox.Checked) {
|
||||
scrollView.ShowHorizontalScrollIndicator = hCheckBox.Checked;
|
||||
} else {
|
||||
hCheckBox.Checked = true;
|
||||
MessageBox.Query ("Message", "Disable Auto Hide Scrollbars first.", "Ok");
|
||||
}
|
||||
};
|
||||
vCheckBox.Toggled += (previousChecked) => {
|
||||
if (!ahCheckBox.Checked) {
|
||||
scrollView.ShowVerticalScrollIndicator = vCheckBox.Checked;
|
||||
} else {
|
||||
vCheckBox.Checked = true;
|
||||
MessageBox.Query ("Message", "Disable Auto Hide Scrollbars first.", "Ok");
|
||||
}
|
||||
};
|
||||
ahCheckBox.Toggled += (previousChecked) => {
|
||||
scrollView.AutoHideScrollBars = ahCheckBox.Checked;
|
||||
hCheckBox.Checked = true;
|
||||
vCheckBox.Checked = true;
|
||||
};
|
||||
Win.Add (ahCheckBox);
|
||||
|
||||
var scrollView2 = new ScrollView (new Rect (55, 2, 20, 8)) {
|
||||
ContentSize = new Size (20, 50),
|
||||
//ContentOffset = new Point (0, 0),
|
||||
|
||||
@@ -56,6 +56,8 @@ namespace UICatalog {
|
||||
private static StatusItem _capslock;
|
||||
private static StatusItem _numlock;
|
||||
private static StatusItem _scrolllock;
|
||||
private static int _categoryListViewItem;
|
||||
private static int _scenarioListViewItem;
|
||||
|
||||
private static Scenario _runningScenario = null;
|
||||
private static bool _useSystemConsole = false;
|
||||
@@ -191,7 +193,7 @@ namespace UICatalog {
|
||||
_scenarioListView.OpenSelectedItem += _scenarioListView_OpenSelectedItem;
|
||||
_rightPane.Add (_scenarioListView);
|
||||
|
||||
_categoryListView.SelectedItem = 0;
|
||||
_categoryListView.SelectedItem = _categoryListViewItem;
|
||||
_categoryListView.OnSelectedChanged ();
|
||||
|
||||
_capslock = new StatusItem (Key.CharMask, "Caps", null);
|
||||
@@ -300,6 +302,7 @@ namespace UICatalog {
|
||||
private static void _scenarioListView_OpenSelectedItem (EventArgs e)
|
||||
{
|
||||
if (_runningScenario is null) {
|
||||
_scenarioListViewItem = _scenarioListView.SelectedItem;
|
||||
var source = _scenarioListView.Source as ScenarioListDataSource;
|
||||
_runningScenario = (Scenario)Activator.CreateInstance (source.Scenarios [_scenarioListView.SelectedItem]);
|
||||
Application.RequestStop ();
|
||||
@@ -396,6 +399,10 @@ namespace UICatalog {
|
||||
|
||||
private static void CategoryListView_SelectedChanged (ListViewItemEventArgs e)
|
||||
{
|
||||
if (_categoryListViewItem != _categoryListView.SelectedItem) {
|
||||
_scenarioListViewItem = 0;
|
||||
}
|
||||
_categoryListViewItem = _categoryListView.SelectedItem;
|
||||
var item = _categories [_categoryListView.SelectedItem];
|
||||
List<Type> newlist;
|
||||
if (item.Equals ("All")) {
|
||||
@@ -405,7 +412,8 @@ namespace UICatalog {
|
||||
newlist = _scenarios.Where (t => Scenario.ScenarioCategory.GetCategories (t).Contains (item)).ToList ();
|
||||
}
|
||||
_scenarioListView.Source = new ScenarioListDataSource (newlist);
|
||||
_scenarioListView.SelectedItem = 0;
|
||||
_scenarioListView.SelectedItem = _scenarioListViewItem;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user