1use com_shim::{com_shim, IDispatchExt, VariantTypeExt};
2use windows::{Win32::System::Com::*, Win32::System::Variant::*, core::*};
3
4pub struct SAPWrapper {
6 inner: IDispatch,
7}
8
9impl SAPWrapper {
10 pub(crate) fn new() -> crate::Result<Self> {
11 unsafe {
12 let clsid: GUID = CLSIDFromProgID(w!("SapROTWr.SapROTWrapper"))?;
13 let p_clsid: *const GUID = &clsid;
14 tracing::debug!("CSapROTWrapper CLSID: {:?}", clsid);
15
16 let dispatch: IDispatch =
17 CoCreateInstance(p_clsid, None, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER)?;
18 Ok(SAPWrapper { inner: dispatch })
19 }
20 }
21
22 pub fn scripting_engine(&self) -> crate::Result<GuiApplication> {
24 tracing::debug!("Getting UI ROT entry...");
25 let result = self.inner.call(
26 "GetROTEntry",
27 vec![VARIANT::variant_from("SAPGUI".to_string())],
28 )?;
29
30 let sap_gui: &IDispatch = result.variant_into()?;
31
32 tracing::debug!("Getting scripting engine.");
33 let scripting_engine = sap_gui.call("GetScriptingEngine", vec![])?;
34
35 Ok(GuiApplication {
36 inner: <com_shim::VARIANT as VariantTypeExt<'_, &IDispatch>>::variant_into(
37 &scripting_engine,
38 )?
39 .clone(),
40 })
41 }
42}
43
44pub trait HasSAPType {
45 fn sap_type() -> &'static str;
46 fn sap_subtype() -> Option<&'static str>;
47}
48
49macro_rules! sap_type {
50 ($tgt: ty, $type: expr) => {
51 impl HasSAPType for $tgt {
52 fn sap_type() -> &'static str {
53 $type
54 }
55 fn sap_subtype() -> Option<&'static str> {
56 None
57 }
58 }
59 };
60 ($tgt: ty, $type: expr, $subtype: expr) => {
61 impl HasSAPType for $tgt {
62 fn sap_type() -> &'static str {
63 $type
64 }
65 fn sap_subtype() -> Option<&'static str> {
66 Some($subtype)
67 }
68 }
69 };
70}
71
72impl GuiComponent {
73 pub fn downcast<Tgt>(&self) -> Option<Tgt>
74 where
75 Tgt: HasSAPType + From<IDispatch>,
76 {
77 if let Ok(mut kind) = self.r_type() {
78 tracing::debug!("GuiComponent is {kind}.");
79 if kind.as_str() == "GuiShell" {
80 if let Ok(sub_kind) = (GuiShell {
81 inner: self.inner.clone(),
82 })
83 .sub_type()
84 {
85 tracing::debug!("Subkind is {sub_kind}");
87 kind = sub_kind;
88 }
89 }
90 let target_kind = Tgt::sap_subtype().unwrap_or_else(|| Tgt::sap_type());
91 if kind == target_kind {
92 Some(Tgt::from(self.inner.clone()))
93 } else {
94 None
95 }
96 } else {
97 None
98 }
99 }
100}
101
102com_shim! {
103 struct GuiApplication: GuiContainer + GuiComponent {
104 mut AllowSystemMessages: bool,
106 mut ButtonbarVisible: bool,
107 Children: GuiComponentCollection,
108 ConnectionErrorText: String,
109 Connections: GuiComponentCollection,
110 mut HistoryEnabled: bool,
111 MajorVersion: i32,
112 MinorVersion: i32,
113 NewVisualDesign: bool,
114 Patchlevel: i32,
115 Revision: i32,
116 mut StatusbarVisible: bool,
117 mut TitlebarVisible: bool,
118 mut ToolbarVisible: bool,
119 Utils: GuiUtils,
120
121 fn AddHistoryEntry(String, String) -> bool,
122 fn CreateGuiCollection() -> GuiCollection,
123 fn DropHistory() -> bool,
124 fn Ignore(i16),
125 fn OpenConnection(String) -> GuiComponent,
126 fn OpenConnectionByConnectionString(String) -> GuiComponent,
127 }
128}
129sap_type!(GuiApplication, "GuiApplication");
130
131com_shim! {
132 struct GuiBarChart: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
133 ChartCount: i32,
134
135 fn BarCount(i32) -> i32,
136 fn GetBarContent(i32, i32, i32) -> String,
137 fn GetGridLineContent(i32, i32, i32) -> String,
138 fn GridCount(i32) -> i32,
139 fn LinkCount(i32) -> i32,
140 fn SendData(String),
141 }
142}
143sap_type!(GuiBarChart, "GuiShell", "BarChart");
144
145com_shim! {
146 struct GuiBox: GuiVComponent + GuiComponent {
147 CharHeight: i32,
148 CharLeft: i32,
149 CharTop: i32,
150 CharWidth: i32,
151 }
152}
153sap_type!(GuiBox, "GuiBox");
154
155com_shim! {
156 struct GuiButton: GuiVComponent + GuiComponent {
157 Emphasized: bool,
158 LeftLabel: GuiComponent,
159 RightLabel: GuiComponent,
160
161 fn Press(),
162 }
163}
164sap_type!(GuiButton, "GuiButton");
165
166com_shim! {
167 struct GuiCalendar: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
168 endSelection: String,
169 mut FirstVisibleDate: String,
170 mut FocusDate: String,
171 FocusedElement: i32,
172 horizontal: bool,
173 mut LastVisibleDate: String,
174 mut SelectionInterval: String,
175 startSelection: String,
176 Today: String,
177
178 fn ContextMenu(i32, i32, i32, String, String),
179 fn CreateDate(i32, i32, i32),
180 fn GetColor(String) -> i32,
181 fn GetColorInfo(i32) -> String,
182 fn GetDateTooltip(String) -> String,
183 fn GetDay(String) -> i32,
184 fn GetMonth(String) -> i32,
185 fn GetWeekday(String) -> String,
186 fn GetWeekNumber(String) -> i32,
187 fn GetYear(String) -> i32,
188 fn IsWeekend(String) -> bool,
189 fn SelectMonth(i32, i32),
190 fn SelectRange(String, String),
191 fn SelectWeek(i32, i32),
192 }
193}
194sap_type!(GuiCalendar, "GuiShell", "Calendar");
195
196com_shim! {
197 struct GuiChart: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
198 fn ValueChange(i32, i32, String, String, bool, String, String, i32),
199 }
200}
201sap_type!(GuiChart, "GuiShell", "Chart");
202
203com_shim! {
204 struct GuiCheckBox: GuiVComponent + GuiComponent {
205 ColorIndex: i32,
206 ColorIntensified: i32,
207 ColorInverse: bool,
208 Flushing: bool,
209 IsLeftLabel: bool,
210 IsListElement: bool,
211 IsRightLabel: bool,
212 LeftLabel: GuiComponent,
213 RightLabel: GuiComponent,
214 RowText: String,
215 mut Selected: bool,
216
217 fn GetListProperty(String) -> String,
218 fn GetListPropertyNonRec(String) -> String,
219 }
220}
221sap_type!(GuiCheckBox, "GuiCheckBox");
222
223com_shim! {
224 struct GuiCollection {
225 Count: i32,
226 Length: i32,
227 r#Type: String,
228 TypeAsNumber: i32,
229
230 fn ElementAt(i32) -> GuiComponent,
232 }
233}
234
235com_shim! {
236 struct GuiColorSelector: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
237 fn ChangeSelection(i16),
238 }
239}
240sap_type!(GuiColorSelector, "GuiShell", "ColorSelector");
241
242com_shim! {
243 struct GuiComboBox: GuiVComponent + GuiComponent {
244 CharHeight: i32,
245 CharLeft: i32,
246 CharTop: i32,
247 CharWidth: i32,
248 CurListBoxEntry: GuiComponent,
249 Entries: GuiCollection,
250 Flushing: bool,
251 Highlighted: bool,
252 IsLeftLabel: bool,
253 IsListBoxActive: bool,
254 IsRightLabel: bool,
255 mut Key: String,
256 LeftLabel: GuiComponent,
257 Required: bool,
258 RightLabel: GuiComponent,
259 ShowKey: bool,
260 Text: String,
261 mut Value: String,
262
263 fn SetKeySpace(),
264 }
265}
266sap_type!(GuiComboBox, "GuiComboBox");
267
268com_shim! {
269 struct GuiComboBoxControl: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell {
270 CurListBoxEntry: GuiComponent,
271 Entries: GuiCollection,
272 IsListBoxActive: bool,
273 LabelText: String,
274 mut Selected: String,
275 Text: String,
276
277 fn FireSelected(),
278 }
279}
280sap_type!(GuiComboBoxControl, "GuiShell", "ComboBoxControl");
281
282com_shim! {
283 struct GuiComboBoxEntry {
284 Key: String,
285 Pos: i32,
286 Value: String,
287 }
288}
289sap_type!(GuiComboBoxEntry, "GuiComboBoxEntry");
290
291com_shim! {
292 struct GuiComponent {
293 ContainerType: bool,
294 Id: String,
295 Name: String,
296 r#Type: String,
297 TypeAsNumber: i32,
298 }
299}
300sap_type!(GuiComponent, "GuiComponent");
301
302com_shim! {
303 struct GuiComponentCollection {
304 Count: i32,
305 Length: i32,
306 r#Type: String,
307 TypeAsNumber: i32,
308
309 fn ElementAt(i32) -> GuiComponent,
310 }
311}
312
313com_shim! {
314 struct GuiConnection: GuiContainer + GuiComponent {
315 Children: GuiComponentCollection,
316 ConnectionString: String,
317 Description: String,
318 DisabledByServer: bool,
319 Sessions: GuiComponentCollection,
320
321 fn CloseConnection(),
322 fn CloseSession(String),
323 }
324}
325sap_type!(GuiConnection, "GuiConnection");
326
327com_shim! {
328 struct GuiContainer: GuiComponent {
329 Children: GuiComponentCollection,
330
331 fn FindById(String) -> GuiComponent,
332 }
333}
334sap_type!(GuiContainer, "GuiContainer");
335
336com_shim! {
337 struct GuiContainerShell: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
338 AccDescription: String,
339 }
340}
341sap_type!(GuiContainerShell, "GuiShell", "ContainerShell");
342
343com_shim! {
344 struct GuiCTextField: GuiTextField + GuiVComponent + GuiComponent { }
345}
346sap_type!(GuiCTextField, "GuiCTextField");
347
348com_shim! {
349 struct GuiCustomControl: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
350 CharHeight: i32,
351 CharLeft: i32,
352 CharTop: i32,
353 CharWidth: i32,
354 }
355}
356sap_type!(GuiCustomControl, "GuiCustomControl");
357
358com_shim! {
359 struct GuiDialogShell: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
360 Title: String,
361
362 fn Close(),
363 }
364}
365sap_type!(GuiDialogShell, "GuiDialogShell");
366
367com_shim! {
368 struct GuiDockShell: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
369 AccDescription: String,
370 DockerIsVertical: bool,
371 mut DockerPixelSize: i32,
372 }
373}
374
375com_shim! {
376 struct GuiEAIViewer2D: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
377 mut AnnoutationEnabled: i32,
378 mut AnnotationMode: i16,
379 mut RedliningStream: String,
380
381 fn annotationTextRequest(String),
382 }
383}
384sap_type!(GuiEAIViewer2D, "GuiShell", "EAIViewer2D");
385
386com_shim! {
387 struct GuiEAIViewer3D: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell { }
388}
389sap_type!(GuiEAIViewer3D, "GuiShell", "EAIViewer3D");
390
391com_shim! {
392 struct GuiFrameWindow: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
393 mut ElementVisualizationMode: bool,
394 GuiFocus: GuiComponent,
395 Handle: i32,
396 Iconic: bool,
397 SystemFocus: GuiComponent,
398 WorkingPaneHeight: i32,
399 WorkingPaneWidth: i32,
400
401 fn Close(),
402 fn CompBitmap(String, String) -> i32,
403 fn HardCopy(String, i16) -> String,
404 fn Iconify(),
405 fn IsVKeyAllowed(i16) -> bool,
406 fn JumpBackward(),
407 fn JumpForward(),
408 fn Maximize(),
409 fn Restore(),
410 fn SendVKey(i16),
411 fn ShowMessageBox(String, String, i32, i32) -> i32,
412 fn TabBackward(),
413 fn TabForward(),
414 }
415}
416sap_type!(GuiFrameWindow, "GuiFrameWindow");
417
418com_shim! {
419 struct GuiGOSShell: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent { }
420}
421sap_type!(GuiGOSShell, "GuiGOSShell");
422
423com_shim! {
424 struct GuiGraphAdapt: GuiVComponent + GuiVContainer + GuiContainer + GuiComponent + GuiShell { }
425}
426sap_type!(GuiGraphAdapt, "GuiShell", "GraphAdapt");
427
428com_shim! {
429 struct GuiGridView: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell {
430 ColumnCount: i32,
431 mut CurrentCellColumn: String,
433 mut CurrentCellRow: i32,
434 mut FirstVisibleColumn: String,
435 mut FirstVisibleRow: i32,
436 FrozenColumnCount: i32,
437 RowCount: i32,
438 mut SelectedRows: String,
441 SelectionMode: String,
442 Title: String,
443 ToolbarButtonCount: i32,
444 VisibleRowCount: i32,
445
446 fn ClearSelection(),
447 fn Click(i32, String),
448 fn ClickCurrentCell(),
449 fn ContextMenu(),
450 fn CurrentCellMoved(),
451 fn DeleteRows(String),
452 fn DeselectColumn(String),
453 fn DoubleClick(i32, String),
454 fn DoubleClickCurrentCell(),
455 fn DuplicateRows(String),
456 fn GetCellChangeable(i32, String) -> bool,
457 fn GetCellCheckBoxChecked(i32, String) -> bool,
458 fn GetCellColor(i32, String) -> i32,
459 fn GetCellHeight(i32, String) -> i32,
460 fn GetCellHotspotType(i32, String) -> String,
461 fn GetCellIcon(i32, String) -> String,
462 fn GetCellLeft(i32, String) -> i32,
463 fn GetCellListBoxCount(i32, String) -> i32,
464 fn GetCellListBoxCurIndex(i32, String) -> String,
465 fn GetCellMaxLength(i32, String) -> i32,
466 fn GetCellState(i32, String) -> String,
467 fn GetCellTooltip(i32, String) -> String,
468 fn GetCellTop(i32, String) -> i32,
469 fn GetCellType(i32, String) -> String,
470 fn GetCellValue(i32, String) -> String,
471 fn GetCellWidth(i32, String) -> i32,
472 fn GetColorInfo(i32) -> String,
473 fn GetColumnDataType(String) -> String,
474 fn GetColumnOperationType(String) -> String,
475 fn GetColumnPosition(String) -> i32,
476 fn GetColumnSortType(String) -> String,
477 fn GetColumnTooltip(String) -> String,
479 fn GetColumnTotalType(String) -> String,
480 fn GetDisplayedColumnTitle(String) -> String,
481 fn GetRowTotalLevel(i32) -> i32,
482 fn GetSymbolInfo(String) -> String,
483 fn GetToolbarButtonChecked(i32) -> bool,
484 fn GetToolbarButtonEnabled(i32) -> bool,
485 fn GetToolbarButtonIcon(i32) -> String,
486 fn GetToolbarButtonId(i32) -> String,
487 fn GetToolbarButtonText(i32) -> String,
488 fn GetToolbarButtonTooltip(i32) -> String,
489 fn GetToolbarButtonType(i32) -> String,
490 fn GetToolbarFocusButton() -> i32,
491 fn HasCellF4Help(i32, String) -> bool,
492 fn HistoryCurEntry(i32, String) -> String,
493 fn HistoryCurIndex(i32, String) -> i32,
494 fn HistoryIsActive(i32, String) -> bool,
495 fn HistoryList(i32, String) -> GuiCollection,
496 fn InsertRows(String),
497 fn IsCellHotspot(i32, String) -> bool,
498 fn IsCellSymbol(i32, String) -> bool,
499 fn IsCellTotalExpander(i32, String) -> bool,
500 fn IsColumnFiltered(String) -> bool,
501 fn IsColumnKey(String) -> bool,
502 fn IsTotalRowExpanded(i32) -> bool,
503 fn ModifyCell(i32, String, String),
504 fn ModifyCheckBox(i32, String, bool),
505 fn MoveRows(i32, i32, i32),
506 fn PressButton(i32, String),
507 fn PressButtonCurrentCell(),
508 fn PressColumnHeader(String),
509 fn PressEnter(),
510 fn PressF1(),
511 fn PressF4(),
512 fn PressToolbarButton(String),
513 fn PressToolbarContextButton(String),
514 fn PressTotalRow(i32, String),
515 fn PressTotalRowCurrentCell(),
516 fn SelectAll(),
517 fn SelectColumn(String),
518 fn SelectionChanged(),
519 fn SelectToolbarMenuItem(String),
520 fn SetColumnWidth(String, i32),
521 fn SetCurrentCell(i32, String),
522 fn TriggerModified(),
523 }
524}
525sap_type!(GuiGridView, "GuiShell", "GridView");
526
527com_shim! {
528 struct GuiHTMLViewer: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell {
529 DocumentComplete: i32,
531
532 fn ContextMenu(),
533 fn GetBrowerControlType() -> i32,
534 fn SapEvent(String, String, String),
535 }
536}
537sap_type!(GuiHTMLViewer, "GuiShell", "HTMLViewer");
538
539com_shim! {
540 struct GuiInputFieldControl: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell {
541 ButtonTooltip: String,
542 FindButtonActivated: bool,
543 HistoryCurEntry: String,
544 HistoryCurIndex: i32,
545 HistoryIsActive: bool,
546 HistoryList: GuiCollection,
547 LabelText: String,
548 PromptText: String,
549
550 fn Submit(),
551 }
552}
553sap_type!(GuiInputFieldControl, "GuiShell", "InputFieldControl");
554
555com_shim! {
556 struct GuiLabel: GuiVComponent + GuiComponent {
557 mut CaretPosition: i32,
558 CharHeight: i32,
559 CharLeft: i32,
560 CharTop: i32,
561 CharWidth: i32,
562 ColorIndex: i32,
563 ColorIntensified: bool,
564 ColorInverse: bool,
565 DisplayedText: String,
566 Highlighted: String,
567 IsHotspot: String,
568 IsLeftLabel: bool,
569 IsListElement: bool,
570 IsRightLabel: bool,
571 MaxLength: i32,
572 Numerical: bool,
573 RowText: String,
574
575 fn GetListProperty(String) -> String,
576 fn GetListPropertyNonRec(String) -> String,
577 }
578}
579sap_type!(GuiLabel, "GuiLabel");
580
581com_shim! {
582 struct GuiMainWindow: GuiFrameWindow + GuiVComponent + GuiVContainer + GuiContainer + GuiComponent {
583 mut ButtonbarVisible: bool,
584 mut StatusbarVisible: bool,
585 mut TitlebarVisible: bool,
586 mut ToolbarVisible: bool,
587
588 fn ResizeWorkingPane(i32, i32, bool),
589 fn ResizeWorkingPaneEx(i32, i32, bool),
590 }
591}
592sap_type!(GuiMainWindow, "GuiMainWindow");
593
594com_shim! {
595 struct GuiMap: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell { }
596}
597sap_type!(GuiMap, "GuiShell", "Map");
598
599com_shim! {
600 struct GuiMenu: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
601 fn Select(),
602 }
603}
604sap_type!(GuiMenu, "GuiMenu");
605
606com_shim! {
607 struct GuiMenubar: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent { }
608}
609sap_type!(GuiMenubar, "GuiMenubar");
610
611com_shim! {
612 struct GuiMessageWindow: GuiVComponent + GuiComponent {
613 FocusedButton: i32,
614 HelpButtonHelpText: String,
615 HelpButtonText: String,
616 MessageText: String,
617 MessageType: i32,
618 OKButtonHelpText: String,
619 OKButtonText: String,
620 ScreenLeft: i32,
621 ScreenTop: i32,
622 Visible: bool,
623 }
624}
625
626com_shim! {
627 struct GuiModalWindow: GuiFrameWindow + GuiVComponent + GuiVContainer + GuiComponent + GuiContainer {
628 fn IsPopupDialog() -> bool,
629 fn PopupDialogText() -> String,
630 }
631}
632sap_type!(GuiModalWindow, "GuiModalWindow");
633
634com_shim! {
635 struct GuiNetChart: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell {
636 LinkCount: i32,
637 NodeCount: i32,
638
639 fn GetLinkContent(i32, i32) -> String,
640 fn GetNodeContent(i32, i32) -> String,
641 fn SendData(String),
642 }
643}
644sap_type!(GuiNetChart, "GuiShell", "NetChart");
645
646com_shim! {
647 struct GuiOfficeIntegration: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
648 HostedApplication: i32,
650
651 fn AppendRow(String, String),
652 fn CloseDocument(i32, bool, bool),
653 fn RemoveContent(String),
655 fn SaveDocument(i32, bool),
656 fn SetDocument(i32, String),
657 }
658}
659sap_type!(GuiOfficeIntegration, "GuiShell", "OfficeIntegration");
660
661com_shim! {
662 struct GuiOkCodeField: GuiVComponent + GuiComponent {
663 Opened: bool,
664
665 fn PressF1(),
666 }
667}
668sap_type!(GuiOkCodeField, "GuiOkCodeField");
669
670com_shim! {
671 struct GuiPasswordField: GuiTextField + GuiVComponent + GuiComponent { }
672}
673sap_type!(GuiPasswordField, "GuiPasswordField");
674
675com_shim! {
676 struct GuiPicture: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell {
677 AltText: String,
678 DisplayMode: String,
679 Icon: String,
680 Url: String,
681
682 fn Click(),
683 fn ClickControlArea(i32, i32),
684 fn ClickPictureArea(i32, i32),
685 fn ContextMenu(i32, i32),
686 fn DoubleClick(),
687 fn DoubleClickControlArea(i32, i32),
688 fn DoubleClickPictureArea(i32, i32),
689 }
690}
691sap_type!(GuiPicture, "GuiShell", "Picture");
692
693com_shim! {
694 struct GuiRadioButton: GuiVComponent + GuiComponent {
695 CharHeight: i32,
696 CharLeft: i32,
697 CharTop: i32,
698 CharWidth: i32,
699 Flushing: bool,
700 GroupCount: i32,
701 GroupMembers: GuiComponentCollection,
702 GroupPos: i32,
703 IsLeftLabel: bool,
704 IsRightLabel: bool,
705 LeftLabel: GuiComponent,
706 RightLabel: GuiComponent,
707 Selected: bool,
708
709 fn Select(),
710 }
711}
712sap_type!(GuiRadioButton, "GuiRadioButton");
713
714com_shim! {
715 struct GuiSapChart: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer + GuiShell { }
716}
717sap_type!(GuiSapChart, "GuiShell", "SapChart");
718
719com_shim! {
720 struct GuiScrollbar {
721 Maximum: i32,
722 Minimum: i32,
723 PageSize: i32,
724 mut Position: i32,
725 Range: i32,
726 }
727}
728sap_type!(GuiScrollbar, "GuiScrollbar");
729
730com_shim! {
731 struct GuiScrollContainer: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
732 HorizontalScrollbar: GuiComponent,
733 VerticalScrollbar: GuiComponent,
734 }
735}
736sap_type!(GuiScrollContainer, "GuiScrollContainer");
737
738com_shim! {
739 struct GuiSession: GuiContainer + GuiComponent {
740 mut AccEnhancedTabChain: bool,
741 mut AccSymbolReplacement: bool,
742 ActiveWindow: GuiComponent,
743 mut Busy: bool,
744 Info: GuiSessionInfo,
746 IsActive: bool,
747 IsListBoxActive: bool,
748 ListBoxCurrEntry: i32,
749 ListBoxCurrEntryHeight: i32,
750 ListBoxCurrEntryLeft: i32,
751 ListBoxCurrEntryTop: i32,
752 ListBoxCurrEntryWidth: i32,
753 ListBoxHeight: i32,
754 ListBoxLeft: i32,
755 ListBoxTop: i32,
756 ListBoxWidth: i32,
757 mut PassportPreSystemId: String,
758 mut PassportSystemId: String,
759 mut PassportTransactionId: String,
760 ProgressPercent: i32,
761 ProgressText: String,
762 mut Record: bool,
763 mut RecordFile: String,
764 mut SaveAsUnicode: bool,
765 mut ShowDropdownKeys: bool,
766 mut SuppressBackendPopups: bool,
767 mut TestToolMode: i32,
768
769 fn AsStdNumberFormat(String) -> String,
770 fn ClearErrorList(),
771 fn CreateSession(),
772 fn EnableJawsEvents(),
773 fn EndTransaction(),
774 fn FindByPosition(i32, i32) -> GuiComponent,
775 fn GetIconResourceName(String) -> String,
776 fn GetObjectTree(String) -> String,
777 fn GetVKeyDescription(i32) -> String,
778 fn LockSessionUI(),
779 fn SendCommand(String),
780 fn SendCommandAsync(String),
781 fn StartTransaction(String),
782 fn UnlockSessionUI(),
783 }
784}
785sap_type!(GuiSession, "GuiSession");
786
787com_shim! {
788 struct GuiSessionInfo {
789 ApplicationServer: String,
790 Client: String,
791 Codepage: i32,
792 Flushes: i32,
793 Group: String,
794 GuiCodepage: i32,
795 I18NMode: bool,
796 InterpretationTime: i32,
797 IsLowSpeedConnection: bool,
798 Language: String,
799 MessageServer: String,
800 Program: String,
801 ResponseTime: i32,
802 RoundTrips: i32,
803 ScreenNumber: i32,
804 ScriptingModeReadOnly: bool,
805 ScriptingModeRecordingDisabled: bool,
806 SessionNumber: i32,
807 SystemName: String,
808 SystemNumber: i32,
809 SystemSessionId: String,
810 Transaction: String,
811 UI_GUIDELINE: String,
812 User: String,
813 }
814}
815
816com_shim! {
817 struct GuiShell: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
818 AccDescription: String,
819 DragDropSupported: bool,
820 Handle: i32,
821 OcxEvents: GuiCollection,
822 SubType: String,
823
824 fn SelectContextMenuItem(String),
825 fn SelectContextMenuItemByPosition(String),
826 fn SelectContextMenuItemByText(String),
827 }
828}
829sap_type!(GuiShell, "GuiShell");
830
831com_shim! {
832 struct GuiSimpleContainer: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
833 IsListElement: bool,
834 IsStepLoop: bool,
835 IsStepLoopInTableStructure: bool,
836 LoopColCount: i32,
837 LoopCurrentCol: i32,
838 LoopCurrentColCount: i32,
839 LoopCurrentRow: i32,
840 LoopRowCount: i32,
841
842 fn GetListProperty(String) -> String,
843 fn GetListPropertyNonRec(String) -> String,
844 }
845}
846sap_type!(GuiSimpleContainer, "GuiSimpleContainer");
847
848com_shim! {
849 struct GuiSplit: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent + GuiShell {
850 IsVertical: i32,
851
852 fn GetColSize(i32) -> i32,
853 fn GetRowSize(i32) -> i32,
854 fn SetColSize(i32, i32),
855 fn SetRowSize(i32, i32),
856 }
857}
858sap_type!(GuiSplit, "GuiShell", "Split");
859
860com_shim! {
861 struct GuiSplitterContainer: GuiVContainer + GuiVComponent + GuiComponent + GuiContainer + GuiShell {
862 IsVertical: bool,
863 mut SashPosition: i32,
864 }
865}
866sap_type!(GuiSplitterContainer, "GuiShell", "SplitterContainer");
867
868com_shim! {
869 struct GuiStage: GuiVComponent + GuiVContainer + GuiContainer + GuiShell + GuiComponent {
870 fn ContextMenu(String),
871 fn DoubleClick(String),
872 fn SelectItems(String),
873 }
874}
875sap_type!(GuiStage, "GuiShell", "Stage");
876
877com_shim! {
878 struct GuiStatusbar: GuiVComponent + GuiVContainer + GuiComponent + GuiContainer {
879 Handle: i32,
880 MessageAsPopup: bool,
881 MessageHasLongText: i32,
882 MessageId: String,
883 MessageNumber: String,
884 MessageParameter: String,
885 MessageType: String,
886
887 fn CreateSupportMessageClick(),
888 fn DoubleClick(),
889 fn ServiceRequestClick(),
890 }
891}
892sap_type!(GuiStatusbar, "GuiStatusbar");
893
894com_shim! {
895 struct GuiStatusBarLink: GuiVComponent + GuiComponent {
896 fn Press(),
897 }
898}
899
900com_shim! {
901 struct GuiStatusPane: GuiVComponent + GuiComponent {
902 Children: GuiComponentCollection,
903 }
904}
905sap_type!(GuiStatusPane, "GuiStatusPane");
906
907com_shim! {
908 struct GuiTab: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
909 fn ScrollToLeft(),
910 fn Select(),
911 }
912}
913sap_type!(GuiTab, "GuiTab");
914
915com_shim! {
916 struct GuiTableColumn: GuiComponentCollection {
917 DefaultTooltip: String,
918 Fixed: bool,
919 IconName: String,
920 Selected: bool,
921 Title: String,
922 Tooltip: String,
923 }
924}
925
926com_shim! {
927 struct GuiTableControl: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
928 CharHeight: i32,
929 CharLeft: i32,
930 CharTop: i32,
931 CharWidth: i32,
932 Columns: GuiCollection,
934 CurrentCol: i32,
935 CurrentRow: i32,
936 HorizontalScrollbar: GuiComponent,
937 RowCount: i32,
938 Rows: GuiCollection,
939 TableFieldName: String,
941 VerticalScrollbar: GuiComponent,
942 VisibleRowCount: i32,
943
944 fn ConfigureLayout(),
945 fn DeselectAllColumns(),
946 fn GetAbsoluteRow(i32) -> GuiTableRow,
947 fn GetCell(i32, i32) -> GuiComponent,
948 fn ReorderTable(String),
949 fn SelectAllColumns(),
950 }
951}
952sap_type!(GuiTableControl, "GuiTableControl");
953
954com_shim! {
955 struct GuiTableRow: GuiComponentCollection {
956 Selectable: bool,
957 mut Selected: bool,
958 }
959}
960
961com_shim! {
962 struct GuiTabStrip: GuiVContainer + GuiVComponent + GuiContainer + GuiComponent {
963 CharHeight: i32,
964 CharLeft: i32,
965 CharTop: i32,
966 CharWidth: i32,
967 LeftTab: GuiComponent,
968 SelectedTab: GuiComponent,
969 }
970}
971sap_type!(GuiTabStrip, "GuiTabStrip");
972
973com_shim! {
974 struct GuiTextedit: GuiShell + GuiVComponent + GuiVContainer + GuiContainer + GuiComponent {
975 CurrentColumn: i32,
976 CurrentLine: i32,
977 mut FirstVisibleLine: i32,
978 LastVisibleLine: i32,
979 LineCount: i32,
980 NumberOfUnprotectedTextParts: i32,
981 SelectedText: String,
982 SelectionEndColumn: i32,
983 SelectionEndLine: i32,
984 SelectionIndexEnd: i32,
985 SelectionIndexStart: i32,
986 SelectionStartColumn: i32,
987 SelectionStartLine: i32,
988
989 fn ContextMenu(),
990 fn DoubleClick(),
991 fn GetLineText(i32) -> String,
992 fn GetUnprotectedTextPart(i32) -> String,
993 fn IsBreakpointLine(i32) -> bool,
994 fn IsCommentLine(i32) -> bool,
995 fn IsHighlightedLine(i32) -> bool,
996 fn IsProtectedLine(i32) -> bool,
997 fn IsSelectedLine(i32) -> bool,
998 fn ModifiedStatusChanged(bool),
999 fn MultipleFilesDropped(),
1000 fn PressF1(),
1001 fn PressF4(),
1002 fn SetSelectionIndexes(i32, i32),
1003 fn SetUnprotectedTextPart(i32, String) -> bool,
1004 fn SingleFileDropped(String),
1005 }
1006}
1007sap_type!(GuiTextedit, "GuiShell", "Textedit");
1008
1009com_shim! {
1010 struct GuiTextField: GuiVComponent + GuiComponent {
1011 mut CaretPosition: i32,
1012 DisplayedText: String,
1013 Highlighted: bool,
1014 HistoryCurEntry: String,
1015 HistoryCurIndex: i32,
1016 HistoryIsActive: bool,
1017 HistoryList: GuiCollection,
1018 IsHotspot: bool,
1019 IsLeftLabel: bool,
1020 IsListElement: bool,
1021 IsOField: bool,
1022 IsRightLabel: bool,
1023 LeftLabel: GuiComponent,
1024 MaxLength: i32,
1025 Numerical: bool,
1026 Required: bool,
1027 RightLabel: GuiComponent,
1028
1029 fn GetListProperty(String) -> String,
1030 fn GetListPropertyNonRec(String) -> String,
1031 }
1032}
1033sap_type!(GuiTextField, "GuiTextField");
1034
1035com_shim! {
1036 struct GuiTitlebar: GuiVComponent + GuiVContainer + GuiContainer + GuiComponent { }
1037}
1038sap_type!(GuiTitlebar, "GuiTitlebar");
1039
1040com_shim! {
1041 struct GuiToolbar: GuiVComponent + GuiVContainer + GuiContainer + GuiComponent { }
1042}
1043sap_type!(GuiToolbar, "GuiToolbar");
1044
1045com_shim! {
1046 struct GuiToolbarControl: GuiShell + GuiVComponent + GuiVContainer + GuiComponent + GuiContainer {
1047 ButtonCount: i32,
1048 FocusedButton: i32,
1049
1050 fn GetButtonChecked(i32) -> bool,
1051 fn GetButtonEnabled(i32) -> bool,
1052 fn GetButtonIcon(i32) -> String,
1053 fn GetButtonId(i32) -> String,
1054 fn GetButtonText(i32) -> String,
1055 fn GetButtonTooltip(i32) -> String,
1056 fn GetButtonType(i32) -> String,
1057 fn GetMenuItemIdFromPosition(i32) -> String,
1058 fn PressButton(String),
1059 fn PressContextButton(String),
1060 fn SelectMenuItem(String),
1061 fn SelectMenuItemByText(String),
1062 }
1063}
1064
1065com_shim! {
1066 struct GuiTree: GuiShell + GuiVContainer + GuiVComponent + GuiComponent + GuiContainer {
1067 HierarchyHeaderWidth: i32,
1069 SelectedNode: String,
1070 TopNode: String,
1071
1072 fn ChangeCheckbox(String, String, bool),
1073 fn ClickLink(String, String),
1074 fn CollapseNode(String),
1075 fn DefaultContextMenu(),
1076 fn DoubleClickItem(String, String),
1077 fn DoubleClickNode(String),
1078 fn EnsureVisibleHorizontalItem(String, String),
1079 fn ExpandNode(String),
1080 fn FindNodeKeyByPath(String) -> String,
1081 fn GetAbapImage(String, String) -> String,
1082 fn GetCheckBoxState(String, String) -> bool,
1084 fn GetColumnIndexFromName(String) -> i32,
1087 fn GetColumnTitleFromName(String) -> String,
1089 fn GetFocusedNodeKey() -> String,
1091 fn GetHierarchyLevel(String) -> i32,
1092 fn GetHierarchyTitle() -> String,
1093 fn GetIsDisabled(String, String) -> bool,
1094 fn GetIsEditable(String, String) -> bool,
1095 fn GetIsHighLighted(String, String) -> bool,
1096 fn GetItemHeight(String, String) -> i32,
1097 fn GetItemLeft(String, String) -> i32,
1098 fn GetItemStyle(String, String) -> i32,
1099 fn GetItemText(String, String) -> String,
1100 fn GetItemTextColor(String, String) -> u64,
1101 fn GetItemToolTip(String, String) -> String,
1102 fn GetItemTop(String, String) -> i32,
1103 fn GetItemType(String, String) -> i32,
1104 fn GetItemWidth(String, String) -> i32,
1105 fn GetListTreeNodeItemCount(String) -> i32,
1106 fn GetNextNodeKey(String) -> String,
1107 fn GetNodeAbapImage(String) -> String,
1108 fn GetNodeChildrenCount(String) -> i32,
1109 fn GetNodeChildrenCountByPath(String) -> i32,
1110 fn GetNodeHeight(String) -> i32,
1111 fn GetNodeIndex(String) -> i32,
1112 fn GetNodeKeyByPath(String) -> String,
1114 fn GetNodeLeft(String) -> i32,
1115 fn GetNodePathByKey(String) -> String,
1116 fn GetNodeStyle(String) -> i32,
1118 fn GetNodeTextByKey(String) -> String,
1119 fn GetNodeTextByPath(String) -> String,
1120 fn GetNodeTextColor(String) -> u64,
1121 fn GetNodeToolTip(String) -> String,
1122 fn GetNodeTop(String) -> i32,
1123 fn GetNodeWidth(String) -> i32,
1124 fn GetParent(String) -> String,
1125 fn GetPreviousNodeKey(String) -> String,
1126 fn GetSelectionMode() -> i16,
1128 fn GetStyleDescription(i32) -> String,
1129 fn GetTreeType() -> i32,
1131 fn HeaderContextMenu(String),
1132 fn IsFolder(String) -> bool,
1133 fn IsFolderExpandable(String) -> bool,
1134 fn IsFolderExpanded(String) -> bool,
1135 fn ItemContextMenu(String, String),
1136 fn NodeContextMenu(String),
1137 fn PressButton(String, String),
1138 fn PressHeader(String),
1139 fn PressKey(String),
1140 fn SelectColumn(String),
1141 fn SelectedItemColumn() -> String,
1142 fn SelectedItemNode() -> String,
1143 fn SelectItem(String, String),
1144 fn SelectNode(String),
1145 fn SetCheckBoxState(String, String, i32),
1146 fn SetColumnWidth(String, i32),
1147 fn UnselectAll(),
1148 fn UnselectColumn(String),
1149 fn UnselectNode(String),
1150 }
1151}
1152sap_type!(GuiTree, "GuiShell", "Tree");
1153
1154com_shim! {
1155 struct GuiUserArea: GuiVContainer + GuiVComponent + GuiComponent + GuiContainer {
1156 HorizontalScrollbar: GuiComponent,
1157 IsOTFPreview: bool,
1158 VerticalScrollbar: GuiComponent,
1159
1160 fn FindByLabel(String, String) -> GuiComponent,
1161 fn ListNavigate(String),
1162 }
1163}
1164sap_type!(GuiUserArea, "GuiUserArea");
1165
1166com_shim! {
1167 struct GuiUtils {
1168 MESSAGE_OPTION_OK: i32,
1169 MESSAGE_OPTION_OKCANCEL: i32,
1170 MESSAGE_OPTION_YESNO: i32,
1171 MESSAGE_RESULT_CANCEL: i32,
1172 MESSAGE_RESULT_NO: i32,
1173 MESSAGE_RESULT_OK: i32,
1174 MESSAGE_RESULT_YES: i32,
1175 MESSAGE_TYPE_ERROR: i32,
1176 MESSAGE_TYPE_INFORMATION: i32,
1177 MESSAGE_TYPE_PLAIN: i32,
1178 MESSAGE_TYPE_QUESTION: i32,
1179 MESSAGE_TYPE_WARNING: i32,
1180
1181 fn CloseFile(i32),
1182 fn OpenFile(String) -> i32,
1183 fn ShowMessageBox(String, String, i32, i32) -> i32,
1184 fn Write(i32, String),
1185 fn WriteLine(i32, String),
1186 }
1187}
1188
1189com_shim! {
1190 struct GuiVComponent: GuiComponent {
1191 AccLabelCollection: GuiComponentCollection,
1192 AccText: String,
1193 AccTextOnRequest: String,
1194 AccTooltip: String,
1195 Changeable: bool,
1196 DefaultTooltip: String,
1197 Height: i32,
1198 IconName: String,
1199 IsSymbolFont: bool,
1200 Left: i32,
1201 Modified: bool,
1202 ParentFrame: GuiComponent,
1203 ScreenLeft: i32,
1204 ScreenTop: i32,
1205 mut Text: String,
1206 Tooltip: String,
1207 Top: i32,
1208 Width: i32,
1209
1210 fn DumpState(String) -> GuiCollection,
1211 fn SetFocus(),
1212 fn Visualize(bool) -> bool,
1213 }
1214}
1215sap_type!(GuiVComponent, "GuiVComponent");
1216
1217com_shim! {
1218 struct GuiVContainer: GuiVComponent + GuiComponent + GuiContainer {
1219 fn FindAllByName(String, String) -> GuiComponentCollection,
1220 fn FindAllByNameEx(String, i32) -> GuiComponentCollection,
1221 fn FindByName(String, String) -> GuiComponent,
1222 fn FindByNameEx(String, String) -> GuiComponent,
1223 }
1224}
1225sap_type!(GuiVContainer, "GuiVContainer");
1226
1227com_shim! {
1228 struct GuiVHViewSwitch: GuiVComponent + GuiComponent {}
1229}
1230sap_type!(GuiVHViewSwitch, "GuiVHViewSwitch");