Skip to content

Commit 23e4b87

Browse files
rjackeyrjackey
authored andcommitted
fixes #50, Add new base classes for dialogs and charts
1 parent 8adc52d commit 23e4b87

File tree

9 files changed

+854
-0
lines changed

9 files changed

+854
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info location="BaseTimeAlignedChart.m" type="File"/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info location="BaseDialog.m" type="File"/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info location="BaseComponentDialog.m" type="File"/>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
classdef BaseComponentDialog < wt.abstract.BaseDialog
2+
% Base dialog attached to a ComponentContainer component
3+
4+
% Copyright 2022-2023 The MathWorks Inc.
5+
6+
7+
%% Read-Only Properties
8+
properties (SetAccess = {?matlab.ui.componentcontainer.ComponentContainer})
9+
10+
% The parent component (must be provided to constructor)
11+
ParentComponent matlab.ui.componentcontainer.ComponentContainer
12+
13+
end %properties
14+
15+
16+
%% Constructor / Destructor
17+
methods
18+
function obj = BaseComponentDialog(parentComponent)
19+
% Construct a dialog
20+
21+
arguments
22+
parentComponent (1,1) matlab.ui.componentcontainer.ComponentContainer
23+
end
24+
25+
% Get ancestor figure, if possible
26+
% If no figure available, place dialog in a new figure
27+
parent = ancestor(parentComponent,'figure');
28+
if isempty(parent)
29+
fig = uifigure;
30+
parent = uigridlayout(fig,[1 1]);
31+
end
32+
33+
% Call superclass
34+
[email protected](parent, ...
35+
"ParentComponent", parentComponent);
36+
37+
% Position within figure
38+
obj.positionWithin(parent, parentComponent)
39+
40+
% Set dialog lifecycle to that of the parent component
41+
% The dialog will be deleted if the parent component is deleted
42+
obj.attachLifecycleListeners(parentComponent);
43+
44+
% Pass along any fonts from the reference component
45+
obj.copyStylesFromReference(parentComponent);
46+
47+
48+
end %function
49+
50+
end %methods
51+
52+
53+
%% Protected methods
54+
methods (Access = protected)
55+
56+
function setup(obj)
57+
% Configure the widget
58+
59+
% Call superclass method
60+
obj.setup@wt.abstract.BaseDialog();
61+
62+
end %function
63+
64+
end %methods
65+
66+
67+
%% Public Methods
68+
methods
69+
70+
function positionWithinComponent(obj)
71+
72+
% Position within figure parent
73+
obj.positionWithin(obj.Parent, obj.ParentComponent)
74+
75+
end %function
76+
77+
end %methods
78+
79+
end %classdef

0 commit comments

Comments
 (0)