GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
Interfaces.cs
1// =============================================================================
2// GPAL - Generally Positive Automation Library
3// Copyright © 2026 Software Decisions, Inc. All rights reserved.
4//
5// This file is part of GPAL.
6// Licensed under the Business Source License 1.1
7//
8// Primary development, architecture, and vision by Michael B. Vederman,
9// CEO of Software Decisions, Inc., Texas.
10//
11// Internal development maintained privately.
12// Public releases appear on GitHub: https://github.com/SoftwareDecisionsInc/GPAL.
13//
14// See LICENSE for full terms, including Additional Use Grant.
15// =============================================================================
16
17using System;
18using System.Collections.Generic;
19using System.Drawing;
20using System.Linq;
21using System.Text;
22using System.Threading.Tasks;
23using OpenQA.Selenium;
26using static GenerallyPositive.Enums;
27using static GenerallyPositive.GPAL;
28using System.Windows.Forms.DataVisualization.Charting;
29using System.Windows.Forms;
30using System.Data;
31
33{
34 #region <FormInterfaces>
35 public interface IAllowDefault
36 {
38 }
39 public interface IAllowFillInFrom
40 {
41 IAllowFormSettingsAndActions FillInFrom(GPALFile inputFile);
42 IAllowFormSettingsAndActions AppendFrom(GPALFile inputFile);
43 IAllowFormSettingsAndActions InsertFrom(GPALFile inputFile);
44
45 IAllowFormSettingsAndActions FillInFrom(GPALDatabase inputDatabase);
46 IAllowFormSettingsAndActions AppendFrom(GPALDatabase inputDatabase);
47 IAllowFormSettingsAndActions InsertFrom(GPALDatabase inputDatabase);
48
49 IAllowFormSettingsAndActions FillInFrom(IGPALGrid<string> inputGrid);
50 IAllowFormSettingsAndActions AppendFrom(IGPALGrid<string> inputGrid);
51 IAllowFormSettingsAndActions InsertFrom(IGPALGrid<string> inputGrid);
52 }
53 public interface IAllowChartSettings
54 {
55 IAllowControlSettingsAndChartSettings WithSeries(Series series);
56 IAllowControlSettingsAndChartSettings WithPalette(ChartColorPalette colorPalette);
57 IAllowControlSettingsAndChartSettings WithTitle(string title);
58 }
60 {
61 IAllowControlSettingsAndDataGridViewSettings WithDatatable(DataTable dataTable);
62 IAllowControlSettingsAndDataGridViewSettings WithSelectSQL(string selectSQL);
63 IAllowControlSettingsAndDataGridViewSettings WithUpdateSQL(string updateSQL);
64 IAllowControlSettingsAndDataGridViewSettings WithDeleteSQL(string deleteSQL);
65 IAllowControlSettingsAndDataGridViewSettings WithColumns(int columns);
67 }
69 {
70 IAllowControlAndDataGridViewSettingsAndActions WithCurrentCelll(DataGridViewCell dataGridCell);
71 IAllowControlAndDataGridViewSettingsAndActions WithEndColumn(int column); // for range operations
72 IAllowControlAndDataGridViewSettingsAndActions WithEndRow(int row); // for range operations
73 IAllowControlAndDataGridViewSettingsAndActions GetGrid(out IGPALGrid<string> grid);
74 }
75 public interface IAllowFontSettings
76 {
77 IAllowControlSettingsAndFontSettings WithFont(Font font);
78 IAllowControlSettingsAndFontSettings WithTextAlignment(ContentAlignment contentAlignment);
79 IAllowControlSettingsAndFontSettings WithAutoSize(bool autoSize);
80 }
81 public interface IAllowControlSettings
82 {
83 IAllowForEventControlSettings WithCallback<TDelegate>(TDelegate handler)
84 where TDelegate : Delegate;
85 [Settings(Description = "Attach a handler that runs off the UI thread, so the form keeps painting while it works. GPAL controls set from it marshal back on their own.")]
86 IAllowForEventControlSettings WithCallbackOffUIThread<TDelegate>(TDelegate handler)
87 where TDelegate : Delegate;
88 IAllowControlSettings WithHeight(int height);
89 IAllowControlSettings WithName(string name);
90 IAllowControlSettings WithTag(object tag);
91 IAllowControlSettings WithAlignment(ContentAlignment alignment);
92 IAllowControlSettingsAndFontSettings WithText(string textToUse);
93 IAllowControlSettings WithShortcutKey(System.Windows.Forms.Keys shortCutKey);
94 IAllowToolTipDelay WithToolTip(string toolTipText);
95 dynamic ToGPALObject();
96 }
98 {
99 IAllowControlSettings ForEvent(ControlEventType eventType);
100 }
102 {
103 IAllowFileSelectorControlSettings WithTitle(string title);
104 IAllowFileSelectorControlSettings WithInitialDirectory(string path);
105 IAllowFileSelectorControlSettings WithFilter(string filter);
106 IAllowFileSelectorControlSettings WithSelectFolder(bool folderMode);
107 IAllowFileSelectorControlSettings WithMultiSelect(bool allowMulti);
108 IAllowFileSelectorControlSettings WithCompact(bool compact);
109 IAllowFileSelectorControlSettings WithPlaceholder(string placeholder);
110 }
112 {
113 IAllowSplitterControlSettings HSplit(int leftWidth);
114 IAllowSplitterControlSettings HSplit(double leftPercent);
115 IAllowSplitterControlSettings VSplit(int topHeight);
116 IAllowSplitterControlSettings VSplit(double topPercent);
117 IAllowSplitterControlSettings WithFormControl(object gPALFormControl);
118 // the base one hands back IAllowControlSettings, which has neither the panes nor a typed ToGPALObject, so
119 // a splitter given a height would come out of the chain as dynamic and only fail once the form is built
120 new IAllowSplitterControlSettings WithHeight(int height);
121 new GPALSplitter ToGPALObject();
122 }
124 {
125 new IAllowGroupBoxControlSettings WithText(string text);
126 IAllowGroupBoxControlSettings WithFormControl(object gPALFormControl);
127 new GPALGroupBox ToGPALObject();
128 }
130 {
131 IAllowTreeViewControlSettings WithCheckBoxes(bool enable);
132 IAllowTreeViewControlSettings WithShowLines(bool show);
133 IAllowTreeViewControlSettings WithShowPlusMinus(bool show);
134 }
136 {
137 IAllowDateTimePickerControlSettings WithValue(DateTime value);
138 IAllowDateTimePickerControlSettings WithFormat(DateTimePickerFormat format);
139 IAllowDateTimePickerControlSettings WithCustomFormat(string formatString);
140 }
142 {
143 IAllowNumericUpDownControlSettings WithValue(decimal value);
144 IAllowNumericUpDownControlSettings WithMinimum(decimal min);
145 IAllowNumericUpDownControlSettings WithMaximum(decimal max);
146 IAllowNumericUpDownControlSettings WithIncrement(decimal inc);
147 IAllowNumericUpDownControlSettings WithDecimalPlaces(int places);
148 }
150 {
151 IAllowListVIewControlSettings WithColumns(params string[] headers);
152 IAllowListVIewControlSettings WithCheckBoxes(bool enable = true);
153 IAllowListVIewControlSettings WithView(ListViewMode view);
154 IAllowListVIewControlSettings WithFullRowSelect(bool enable);
155 IAllowListVIewControlSettings WithMultiSelect(bool enable);
156 IAllowListVIewControlSettings WithColumnWeight(double weight);
157 IAllowListVIewControlSettings WithSortable(bool sortable = true);
158 }
160 {
161 new IAllowStatusStripControlSettings WithText(string text);
162 }
164 {
165 IAllowMenuBarControlSettings WithMenu(string topMenu);
167 IAllowMenuBarControlSettings WithSeparator();
168 }
175 {
176 new IAllowBarItemSettings WithText(string text);
177 // declared here rather than taken from IAllowEnabled, whose WithEnabled answers with the settings
178 // every control shares. this one keeps the chain on a bar item
179 IAllowBarItemSettings WithEnabled(bool trueFalse = true);
180 IAllowBarItemSettings WithImage(Image image);
181 IAllowBarItemSettings WithImage(GPALFile file);
182 }
188 {
189 IAllowComboBoxControlSettings WithItems(params string[] itemArray);
190 IAllowComboBoxControlSettings WithItems(IEnumerable<string> itemCollection);
191 IAllowComboBoxControlSettings WithItems(Array itemArray);
192 IAllowComboBoxControlSettings WithSelectedIndex(int index);
193 IAllowComboBoxControlSettings WithSelectedItem(string name);
194 }
196 {
197 IAllowDataGridViewControlSettings WithColumns(params string[] columnNames);
198 IAllowDataGridViewControlSettings WithReadOnly(bool readOnly);
199 IAllowDataGridViewControlSettings WithAutoGenerateColumns(bool autoGenerate);
200 IAllowDataGridViewControlSettings WithGrid(IGPALGrid<string> grid);
201 }
203 {
204 IAllowProgressBarControlSettings WithValue(int value);
205 IAllowProgressBarControlSettings WithMinimum(int min);
206 IAllowProgressBarControlSettings WithMaximum(int max);
207 IAllowProgressBarControlSettings WithStyle(ProgressBarStyle style);
208 }
210 {
211 IAllowControlSettingsAndTableLayoutPanelSettings WithGrowStyle(TableLayoutPanelGrowStyle tableLayoutPanelGrowStyle);
212 IAllowControlSettingsAndTableLayoutPanelSettings WithColumnCount(int columnCount);
213 IAllowControlSettingsAndTableLayoutPanelSettings WithRowCount(int rowCount);
214 }
215 public interface IAllowCallBack
216 {
217 // return values
218 // 0 = not handled
219 // 1 = handled
220 // -1 = error
221 // IAllowAfterAnySelector CallIfFound(Form.CallIfDelegate callIfFound);
222 // IAllowAfterAnySelector CallIfNotFound(Form.CallIfDelegate callIfNotFound);
223 IAllowFormSettingsAndActions CallAfterFillIn(GPALForm.CallAfterFillInDelegate callAfterFillIn);
224 }
225 public interface IAllowFormActions
226 {
228 IAllowFormActions ShowDialog();
229 IAllowFormActions Hide();
230 dynamic ToGPALObject();
231 }
233 {
234 IAllowControlSettings WithToolTipDelay(int delayInMs);
235 }
240
241 public interface IAllowFormSettings
242 {
243 [Settings(Description = "Add a control to the form. Containers are built whole first, so a splitter or a group box is added the same way as anything else")]
244 IAllowFormSettingsAndActions WithFormControl(GPALControl gPALFormControl);
245 IAllowFormSettingsAndActions WithWidth(int width);
246 IAllowFormSettingsAndActions WithHeight(int height);
247 IAllowFormSettingsAndActions WithTop(int top);
248 IAllowFormSettingsAndActions WithLeft(int left);
249 IAllowFormSettingsAndActions WithTitle(string title);
250 }
304 #endregion <FormInterfaces>
305 #region <Atoms>
306 public interface IAllowChecked { IAllowControlSettings WithChecked(bool trueFalse = false); }
307 public interface IAllowEnabled { IAllowControlSettings WithEnabled(bool trueFalse = true); }
308 public interface IAllowPassword { IAllowControlSettings IsPassword { get; } }
309 public interface IAllowPlaceholder { IAllowControlSettings WithPlaceholder(string PlaceholderText); }
310 public interface IAllowReadOnly { IAllowControlSettings WithReadOnly(bool readOnly = true); }
311 #endregion
312}
313
Class to define database usage. Currently only used for input from a table, sql or stored procedure....
GPAL File object instantied with GPAL.File Used to load tokens into a GPALGrid [rows/columns].
Definition GPALFile.cs:36
A single item shared by GPAL menu bars and toolbars. Because it derives from GPALControl it speaks th...
Base class for all GPAL form controls.
Form object that contains the fluent methods to create interactive forms. Instatiated using GPAL....
Definition GPALForm.cs:64
delegate CallIfStatus CallAfterFillInDelegate(GPALForm myForm, IGPALGrid< string > tokens, int tokenIdx)
Delegate callback for the CallAfterFillIn EventHandler which will be invoked after each row of tokens...
A titled box around a set of controls, instantiated with GPAL.GroupBox and laid out like any other co...
Two panes with a bar between them, instantiated with GPAL.Splitter and laid out like any other contro...
Everything starts here, all the GPAL controls and global settings using fluent syntax are here....
Definition GPAL.cs:49