Skip to content

Commit 71ce59a

Browse files
committed
fix missing files for dialog and waitbar theming
1 parent ff71400 commit 71ce59a

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
function matRad_applyThemeToDlg(hDlgBox)
2+
% matRad_applyThemeToDlg is a helper function to apply a theme tho dialog
3+
% boxes
4+
%
5+
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6+
%
7+
% Copyright 2024 the matRad development team.
8+
%
9+
% This file is part of the matRad project. It is subject to the license
10+
% terms in the LICENSE file found in the top-level directory of this
11+
% distribution and at https://github.com/e0404/matRad/LICENSE.md. No part
12+
% of the matRad project, including this file, may be copied, modified,
13+
% propagated, or distributed except according to the terms contained in the
14+
% LICENSE file.
15+
%
16+
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17+
18+
matRad_cfg = MatRad_Config.instance();
19+
try
20+
if matRad_cfg.isOctave
21+
txtObj = findall(hDlgBox,'type','text');
22+
txtObj = txtObj(1);
23+
okBtn = findall(hDlgBox,'type','uicontrol','style','pushbutton');
24+
set(findall(hDlgBox,'type','uipanel'),'BackgroundColor',matRad_cfg.gui.backgroundColor);
25+
else
26+
txtObj = findall(hDlgBox,'tag','MessageBox');
27+
okBtn = findall(hDlgBox,'tag','OKButton');
28+
hDlgBox.Color = matRad_cfg.gui.backgroundColor;
29+
end
30+
31+
set(txtObj,'Color',matRad_cfg.gui.textColor);
32+
set(okBtn,'BackgroundColor',matRad_cfg.gui.elementColor,'ForegroundColor',matRad_cfg.gui.textColor);
33+
catch
34+
matRad_cfg.dispWarning('Theme could not be applied to dialog!');
35+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
function matRad_applyThemeToWaitbar(hWaitbar)
2+
% matRad_applyThemeToDlg is a helper function to apply a theme to a waitbar
3+
%
4+
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5+
%
6+
% Copyright 2024 the matRad development team.
7+
%
8+
% This file is part of the matRad project. It is subject to the license
9+
% terms in the LICENSE file found in the top-level directory of this
10+
% distribution and at https://github.com/e0404/matRad/LICENSE.md. No part
11+
% of the matRad project, including this file, may be copied, modified,
12+
% propagated, or distributed except according to the terms contained in the
13+
% LICENSE file.
14+
%
15+
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16+
17+
matRad_cfg = MatRad_Config.instance();
18+
try
19+
set(hWaitbar,'Color',matRad_cfg.gui.backgroundColor);
20+
txtObj = findall(hWaitbar,'type','text');
21+
txtObj = txtObj(1);
22+
if matRad_cfg.isOctave
23+
patchObj = findobj(hWaitbar,'type','patch');
24+
set(patchObj,'FaceColor',matRad_cfg.gui.highlightColor);
25+
set(patchObj,'EdgeColor',matRad_cfg.gui.textColor);
26+
axesObj = findobj(hWaitbar,'type','axes');
27+
set(axesObj,'Color',matRad_cfg.gui.elementColor);
28+
else
29+
%no longer a patch object, we need java
30+
%jcolor = [int32(rgb * 255) 0];
31+
hJava = findall(hWaitbar,'type','hgjavacomponent');
32+
hIndic = findall(hWaitbar,'type','uiprogressindicator');
33+
if ~isempty(hJava)
34+
jcolorbg = num2cell(matRad_cfg.gui.elementColor);
35+
jcolorfg = num2cell(matRad_cfg.gui.highlightColor);
36+
37+
hJava.JavaPeer.setForeground(java.awt.Color(jcolorfg{:}))
38+
hJava.JavaPeer.setBackground(java.awt.Color(jcolorbg{:}));
39+
elseif ~isempty(hIndic)
40+
hWaitbar.Children.Color = matRad_cfg.gui.elementColor;
41+
hIndic.ProgressColor = matRad_cfg.gui.highlightColor;
42+
else
43+
%Do nothing
44+
end
45+
end
46+
47+
set(txtObj,'Color',matRad_cfg.gui.textColor,'Interpreter','none');
48+
catch
49+
matRad_cfg.dispWarning('Theme could not be applied to dialog!');
50+
end

0 commit comments

Comments
 (0)