FxLibcTest/include/ft/widgets/fbrowser.h

60 lines
2.0 KiB
C

//---
// ft.widgets.browser: A dual-list setup to browse categorized tests
//---
#ifndef _FT_WIDGETS_BROWSER_H_
#define _FT_WIDGETS_BROWSER_H_
#include <justui/jwidget.h>
#include <ft/widgets/flist.h>
#include <ft/widgets/fbar.h>
#include <ft/test.h>
/* fbrowser: A test browser that shows categorized tests and summaries
This widget is the main frame of this application. It consists of list of
headers on the left, and a list of tests on the right. Summaries of all
headers and of all tests within a single header are shown. */
typedef struct {
jwidget widget;
/* Header list and test list */
flist *headers;
flist *tests;
/* Main bar at the top, and secondary bar above test list */
fbar *bar_top;
fbar *bar_right;
/* Widgets that help with the structure */
jwidget *rstack;
/* Current set of headers and tests */
ft_list *data_headers;
ft_test **data_tests;
} fbrowser;
/* A test entry has been validated */
extern uint16_t FBROWSER_VALIDATED;
/* fbrowser_create(): Create a test browser */
fbrowser *fbrowser_create(void *parent);
/* fbrowser_set_headers(): Select a set of headers
If (select = true), this also selects the first header.*/
void fbrowser_set_headers(fbrowser *b, ft_list *list, bool select);
/* fbrowser_set_tests(): Select a set of tests
You should not call this function; fbrowser synchronizes the set of tests
with the currently selected header. */
void fbrowser_set_tests(fbrowser *b, ft_test **tests);
/* fbrowser_current_header(): Currently-selected header
This function returns a pointer to the currently-selected list, which is
NULL if the summary is selected on the left panel, and non-NULL otherwise.
This is defined even when the focus is on the right panel. */
ft_list *fbrowser_current_header(fbrowser *b);
/* fbrowser_current_test(): Currently-selected test
This function returns a pointer to the currently-selected test, which is
non-NULL only when the focus is on the right panel. */
ft_test *fbrowser_current_test(fbrowser *b);
#endif /* _FT_WIDGETS_BROWSER_H_ */