2 * notion/ioncore/frame-tabs-recalc.h
4 * Copyright (c) Tomas Ebenlendr 2011.
6 * See the included file LICENSE for details.
9 #ifndef NOTION_IONCORE_FRAME_TABS_RECALC_H
10 #define NOTION_IONCORE_FRAME_TABS_RECALC_H
12 #include "libtu/map.h"
13 #include "libtu/obj.h"
15 /* Compute inner widths of tabs and width of shaped bar.
16 * There will be more algorithms to do this, thus here
17 * is prototype of the called function.
21 * If complete is set and frame->barmode==FRAME_BAR_SHAPED
22 * then frame->bar_w has to be updated.
23 * return TRUE if bar_w changed (i.e, new value != old value)
24 * return the value of 'complete' on normal run.
25 * frame_set_shape or frame_clear_shape is called when TRUE is returned.
27 * The function is called only if
28 * frame->bar_brush != NULL && frame->titles != NULL
30 typedef bool (*TabCalcPtr
)(WFrame
*frame
, bool complete
);
32 /* Gets the identifier of the algorithm. */
33 const char *frame_get_tabs_sizes_algorithm(WFrame
*frame
);
35 /* Sets the algorithm based on the identifier.
36 * Returns -1 on failure, 1 on successfull change, 0 on success but no change
37 * If 1 is returned, frame_bar_recalc and frame_bar_draw should be called.
39 int frame_do_set_tabs_sizes_algorithm(WFrame
*frame
, const char *algstr
);
41 INTRSTRUCT(TabCalcParams
);
42 DECLSTRUCT(TabCalcParams
){
44 /* Maximum size of shaped bar. */
45 double bar_max_width_q
;
46 /* Minimum width of a tab in shaped frame.
47 * For 'proportional' and 'elastic' algorithms also minimum width of a tab
48 * provided that no title has to be truncated
51 /* Requested empty space to be added before and after text. */
53 /* Minimum width of a tab for 'proportional' and 'elastic' algorithms.
54 * Long titles will be truncated instead of shortening a short tab below
60 void frame_tabs_calc_brushes_updated(WFrame
*frame
);
61 void frame_tabs_width_recalc_init(WFrame
*frame
);
62 #endif /* NOTION_IONCORE_FRAME_TABS_RECALC_H */