Exemple #1
0
        protected OptionWinFormsList(Option aOption, int aWidth)
        {
            iOption = aOption;
            iList   = new List <string>(StringListConverter.StringToList(iOption.Value));
            iOption.EventValueChanged   += ValueChanged;
            iOption.EventEnabledChanged += EnabledChanged;

            iControl       = new UserControl();
            iControl.Width = aWidth;

            int buttonWidth  = 30;
            int buttonMargin = 10;
            int listWidth    = aWidth - buttonWidth - buttonMargin * 2;

            iListFolders                       = new ListView();
            iListFolders.Width                 = listWidth;
            iListFolders.Location              = new Point(0, 0);
            iListFolders.Anchor                = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
            iListFolders.TabStop               = true;
            iListFolders.TabIndex              = 0;
            iListFolders.MultiSelect           = true;
            iListFolders.View                  = View.List;
            iListFolders.SelectedIndexChanged += ListFoldersSelectedIndexChanged;
            iListFolders.Enabled               = iOption.Enabled;
            iControl.Controls.Add(iListFolders);

            iButtonAdd           = new Button();
            iButtonAdd.BackColor = SystemColors.ButtonFace;
            iButtonAdd.ForeColor = SystemColors.ControlText;
            iButtonAdd.Text     += "+";
            iButtonAdd.AutoSize  = false;
            iButtonAdd.Width     = buttonWidth;
            iButtonAdd.Height    = buttonWidth;
            iButtonAdd.Location  = new Point(listWidth + buttonMargin, 0);
            iButtonAdd.Anchor    = AnchorStyles.Top | AnchorStyles.Right;
            iButtonAdd.TabStop   = true;
            iButtonAdd.TabIndex  = 1;
            iButtonAdd.Enabled   = iOption.Enabled;
            iButtonAdd.Click    += ButtonAddClick;
            iControl.Controls.Add(iButtonAdd);

            iButtonRemove           = new Button();
            iButtonRemove.BackColor = SystemColors.ButtonFace;
            iButtonRemove.ForeColor = SystemColors.ControlText;
            iButtonRemove.Text     += "-";
            iButtonRemove.AutoSize  = false;
            iButtonRemove.Width     = buttonWidth;
            iButtonRemove.Height    = buttonWidth;
            iButtonRemove.Location  = new Point(listWidth + buttonMargin, buttonWidth + buttonMargin);
            iButtonRemove.Anchor    = AnchorStyles.Top | AnchorStyles.Right;
            iButtonRemove.TabStop   = true;
            iButtonRemove.TabIndex  = 1;
            iButtonRemove.Enabled   = iOption.Enabled;
            iButtonRemove.Click    += ButtonRemoveClick;
            iControl.Controls.Add(iButtonRemove);

            iControl.Height = iListFolders.Height;

            Populate();
        }
Exemple #2
0
        public OptionListMonobjc(NSRect aRect, Option aOption)
            : base(aOption)
        {
            iList       = new List <string>(StringListConverter.StringToList(iOption.Value));
            iDataSource = new OptionListMonobjcDataSource();
            iDataSource.SetList(iList);

            iView = new NSView();

            iButtonAdd            = new NSButton();
            iButtonAdd.BezelStyle = NSBezelStyle.NSRoundedBezelStyle;
            iButtonAdd.Title      = new NSString("Add");
            iButtonAdd.SizeToFit();

            iButtonAdd.ActionEvent += ActionEventAdd;

            iButtonRemove            = new NSButton();
            iButtonRemove.BezelStyle = NSBezelStyle.NSRoundedBezelStyle;
            iButtonRemove.SetTitleWithMnemonic(new NSString("Remove"));
            iButtonRemove.SizeToFit();
            float height = 100 + iButtonAdd.Frame.Height;

            iButtonRemove.ActionEvent += ActionEventRemove;

            iView.Frame = new NSRect(aRect.MinX, aRect.MinY - height, aRect.Width, height);

            NSScrollView scrollView = new NSScrollView();

            scrollView.HasVerticalScroller   = true;
            scrollView.HasHorizontalScroller = true;
            scrollView.AutohidesScrollers    = true;

            NSTableColumn tableColumn = new NSTableColumn();

            tableColumn.ResizingMask = NSTableColumnResizingMasks.NSTableColumnAutoresizingMask | NSTableColumnResizingMasks.NSTableColumnUserResizingMask;
            tableColumn.IsEditable   = false;

            iTableView            = new NSTableView();
            iTableView.DataSource = iDataSource;
            iTableView.HeaderView = null;
            iTableView.UsesAlternatingRowBackgroundColors = true;
            iTableView.AddTableColumn(tableColumn);

            scrollView.Frame  = new NSRect(0, height - 100, aRect.Width, 100);
            iTableView.Frame  = scrollView.ContentView.Bounds;
            tableColumn.Width = iTableView.Bounds.Width - 3;

            scrollView.DocumentView = iTableView;

            iButtonAdd.Frame    = new NSRect(iView.Frame.Width - iButtonAdd.Frame.Width - iButtonRemove.Frame.Width, scrollView.Frame.MinY - iButtonAdd.Frame.Height, iButtonAdd.Frame.Width, iButtonAdd.Frame.Height);
            iButtonRemove.Frame = new NSRect(iView.Frame.Width - iButtonRemove.Frame.Width, scrollView.Frame.MinY - iButtonRemove.Frame.Height, iButtonRemove.Frame.Width, iButtonRemove.Frame.Height);

            iView.AddSubview(scrollView);
            iView.AddSubview(iButtonAdd);
            iView.AddSubview(iButtonRemove);

            iTableView.ReloadData();
        }
Exemple #3
0
 private void Populate()
 {
     iList = new List <string>(StringListConverter.StringToList(iOption.Value));
     iListFolders.Items.Clear();
     foreach (string val in iList)
     {
         iListFolders.Items.Add(new ListViewItem(val));
     }
 }
Exemple #4
0
 protected override void OptionValueChanged(object sender, EventArgs e)
 {
     iList = new List <string>(StringListConverter.StringToList(iOption.Value));
     iDataSource.SetList(iList);
     iTableView.ReloadData();
 }
Exemple #5
0
            public DataSource(Option aOption)
            {
                iOption = aOption;

                iList = new List <string>(StringListConverter.StringToList(iOption.Value));
            }