|
| 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