function handles = setupPanelType(handles)
%SETUPPANELTYPE    Populate the problem type panel on CHEBGUI

% Background colour for text fields:
textBackgroundColour = get(handles.panel_buttons, 'BackgroundColor');
textFontsize = 12;
leftMargin = 0.05;
textHeight = 0.25;
vertLoc = linspace(.75, .025, 4);

% Create a panel for the problem type option:
handles.panel_type = uipanel('Parent', handles.panel_buttons, ...
    'Title', 'Problem type', 'BackgroundColor', textBackgroundColour, ...
    'Position', [0.045 .63 .92 .22], 'FontSize', textFontsize, ...
    'BorderType', 'etchedin');

% Create strings above input boxes:
handles.button_bvp = uicontrol('Parent', handles.panel_type, ...
    'Style', 'radiobutton', 'BackgroundColor', textBackgroundColour, ...
    'String','ODE - BVP', 'FontSize', textFontsize, ...
    'Callback', @(hObject, eventdata) ...
        switchModeButtonCallback(hObject, guidata(hObject), 'bvp'), ...
    'Units', 'normalized', ...
    'Position', [leftMargin vertLoc(1) 1-leftMargin textHeight]);
handles.button_ivp = uicontrol('Parent', handles.panel_type, ...
    'Style', 'radiobutton', 'BackgroundColor', textBackgroundColour, ...
    'String','ODE - IVP', 'FontSize', textFontsize, ...
    'Callback', @(hObject, eventdata) ...
        switchModeButtonCallback(hObject, guidata(hObject), 'ivp'), ...
    'Units', 'normalized', ...
    'Position', [leftMargin vertLoc(2) 1-leftMargin textHeight]);
handles.button_eig = uicontrol('Parent', handles.panel_type, ...
    'Style', 'radiobutton', 'BackgroundColor', textBackgroundColour, ...
    'String','EIG', 'FontSize', textFontsize, ...
    'Callback', @(hObject, eventdata) ...
        switchModeButtonCallback(hObject, guidata(hObject), 'eig'), ...
    'Units', 'normalized', ...
    'Position', [leftMargin vertLoc(3) 1-leftMargin textHeight]);
handles.button_pde = uicontrol('Parent', handles.panel_type, ...
    'Style', 'radiobutton', 'BackgroundColor', textBackgroundColour, ...
    'String','PDE', 'FontSize', textFontsize, ...
    'Callback', @(hObject, eventdata) ...
        switchModeButtonCallback(hObject, guidata(hObject), 'pde'), ...
    'Units', 'normalized', ...
    'Position', [leftMargin vertLoc(4) 1-leftMargin textHeight]);
end

function switchModeButtonCallback(hObject, handles, newMode)
% Called when user presses one of the mode changing buttons.
handles = chebguiController.switchMode(handles, newMode);
guidata(hObject, handles);
end