Window management. More...
#include "config.h"#include <stdarg.h>#include <string.h>#include "mutt/lib.h"#include "config/lib.h"#include "mutt_window.h"#include "curs_lib.h"#include "globals.h"#include "mutt_curses.h"#include "reflow.h"#include "rootwin.h"
Include dependency graph for mutt_window.c:Go to the source code of this file.
Functions | |
| static bool | window_was_visible (struct MuttWindow *win) |
| Was the Window visible? | |
| static void | window_notify (struct MuttWindow *win) |
| Notify observers of changes to a Window. | |
| void | window_notify_all (struct MuttWindow *win) |
| Notify observers of changes to a Window and its children. | |
| void | window_set_visible (struct MuttWindow *win, bool visible) |
| Set a Window visible or hidden. | |
| struct MuttWindow * | mutt_window_new (enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows) |
| Create a new Window. | |
| void | mutt_window_free (struct MuttWindow **ptr) |
| Free a Window and its children. | |
| void | mutt_window_clearline (struct MuttWindow *win, int row) |
| Clear a row of a Window. | |
| void | mutt_window_clrtoeol (struct MuttWindow *win) |
| Clear to the end of the line. | |
| void | mutt_window_get_coords (struct MuttWindow *win, int *row, int *col) |
| Get the cursor position in the Window. | |
| int | mutt_window_move (struct MuttWindow *win, int row, int col) |
| Move the cursor in a Window. | |
| void | mutt_window_reflow (struct MuttWindow *win) |
| Resize a Window and its children. | |
| int | mutt_window_wrap_cols (int width, short wrap) |
| Calculate the wrap column for a given screen width. | |
| int | mutt_window_addch (struct MuttWindow *win, int ch) |
| Write one character to a Window. | |
| int | mutt_window_addnstr (struct MuttWindow *win, const char *str, int num) |
| Write a partial string to a Window. | |
| int | mutt_window_addstr (struct MuttWindow *win, const char *str) |
| Write a string to a Window. | |
| int | mutt_window_printf (struct MuttWindow *win, const char *fmt,...) |
| Write a formatted string to a Window. | |
| void | mutt_window_add_child (struct MuttWindow *parent, struct MuttWindow *child) |
| Add a child to Window. | |
| struct MuttWindow * | mutt_window_remove_child (struct MuttWindow *parent, struct MuttWindow *child) |
| Remove a child from a Window. | |
| void | mutt_winlist_free (struct MuttWindowList *head) |
| Free a tree of Windows. | |
| bool | mutt_window_is_visible (struct MuttWindow *win) |
| Is the Window visible? | |
| struct MuttWindow * | window_find_child (struct MuttWindow *win, enum WindowType type) |
| Recursively find a child Window of a given type. | |
| struct MuttWindow * | window_find_parent (struct MuttWindow *win, enum WindowType type) |
| Find a (grand-)parent of a Window by type. | |
| static void | window_recalc (struct MuttWindow *win) |
| Recalculate a tree of Windows. | |
| static void | window_repaint (struct MuttWindow *win) |
| Repaint a tree of Windows. | |
| static void | window_recursor (void) |
| Recursor the focussed Window. | |
| void | window_redraw (struct MuttWindow *win) |
| Reflow, recalc and repaint a tree of Windows. | |
| bool | window_is_focused (const struct MuttWindow *win) |
| Does the given Window have the focus? | |
| struct MuttWindow * | window_get_focus (void) |
| Get the currently focused Window. | |
| struct MuttWindow * | window_set_focus (struct MuttWindow *win) |
| Set the Window focus. | |
| void | mutt_window_clear (struct MuttWindow *win) |
| Clear a Window. | |
| const char * | mutt_window_win_name (const struct MuttWindow *win) |
| Get the name of a Window. | |
| static void | window_invalidate (struct MuttWindow *win) |
| Mark a window as in need of repaint. | |
| void | window_invalidate_all (void) |
| Mark all windows as in need of repaint. | |
| bool | window_status_on_top (struct MuttWindow *panel, const struct ConfigSubset *sub) |
| Organise windows according to config variable. | |
| bool | mutt_window_swap (struct MuttWindow *parent, struct MuttWindow *win1, struct MuttWindow *win2) |
| Swap the position of two windows. | |
Variables | |
| static const struct Mapping | WindowNames [] |
| Lookups for Window Names. | |
Window management.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file mutt_window.c.
|
static |
Was the Window visible?
| win | Window |
| true | The Window was visible |
Using the WindowState old, check if a Window used to be visible. For a Window to be visible, it must have been visible and its parent and grandparent, etc.
Definition at line 87 of file mutt_window.c.
Here is the caller graph for this function:
|
static |
Notify observers of changes to a Window.
| win | Window |
Definition at line 105 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void window_notify_all | ( | struct MuttWindow * | win | ) |
Notify observers of changes to a Window and its children.
| win | Window |
Definition at line 145 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void window_set_visible | ( | struct MuttWindow * | win, |
| bool | visible ) |
Set a Window visible or hidden.
| win | Window |
| visible | If true, make Window visible, otherwise hidden |
Definition at line 165 of file mutt_window.c.
Here is the caller graph for this function:| struct MuttWindow * mutt_window_new | ( | enum WindowType | type, |
| enum MuttWindowOrientation | orient, | ||
| enum MuttWindowSize | size, | ||
| int | cols, | ||
| int | rows ) |
Create a new Window.
| type | Window type, e.g. WT_ROOT |
| orient | Window orientation, e.g. MUTT_WIN_ORIENT_VERTICAL |
| size | Window size, e.g. MUTT_WIN_SIZE_MAXIMISE |
| cols | Initial number of columns to allocate, can be MUTT_WIN_SIZE_UNLIMITED |
| rows | Initial number of rows to allocate, can be MUTT_WIN_SIZE_UNLIMITED |
| ptr | New Window |
Definition at line 182 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_window_free | ( | struct MuttWindow ** | ptr | ) |
Free a Window and its children.
| ptr | Window to free |
Definition at line 205 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_window_clearline | ( | struct MuttWindow * | win, |
| int | row ) |
Clear a row of a Window.
| win | Window |
| row | Row to clear |
Definition at line 235 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_window_clrtoeol | ( | struct MuttWindow * | win | ) |
Clear to the end of the line.
| win | Window |
Definition at line 247 of file mutt_window.c.
Here is the caller graph for this function:| void mutt_window_get_coords | ( | struct MuttWindow * | win, |
| int * | row, | ||
| int * | col ) |
Get the cursor position in the Window.
| [in] | win | Window |
| [out] | row | Row in Window |
| [out] | col | Column in Window |
Assumes the current position is inside the window. Otherwise it will happily return negative or values outside the window boundaries
Definition at line 280 of file mutt_window.c.
Here is the caller graph for this function:| int mutt_window_move | ( | struct MuttWindow * | win, |
| int | row, | ||
| int | col ) |
Move the cursor in a Window.
| win | Window |
| row | Row to move to |
| col | Column to move to |
| OK | Success |
| ERR | Error |
Definition at line 300 of file mutt_window.c.
Here is the caller graph for this function:| void mutt_window_reflow | ( | struct MuttWindow * | win | ) |
Resize a Window and its children.
| win | Window to resize |
Definition at line 309 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int mutt_window_wrap_cols | ( | int | width, |
| short | wrap ) |
Calculate the wrap column for a given screen width.
| width | Screen width |
| wrap | Wrap config |
| num | Column that text should be wrapped at |
The wrap variable can be negative, meaning there should be a right margin.
Definition at line 337 of file mutt_window.c.
Here is the caller graph for this function:| int mutt_window_addch | ( | struct MuttWindow * | win, |
| int | ch ) |
Write one character to a Window.
| win | Window |
| ch | Character to write |
| 0 | Success |
| -1 | Error |
Definition at line 353 of file mutt_window.c.
Here is the caller graph for this function:| int mutt_window_addnstr | ( | struct MuttWindow * | win, |
| const char * | str, | ||
| int | num ) |
Write a partial string to a Window.
| win | Window |
| str | String |
| num | Maximum number of characters to write |
| 0 | Success |
| -1 | Error |
Definition at line 366 of file mutt_window.c.
Here is the caller graph for this function:| int mutt_window_addstr | ( | struct MuttWindow * | win, |
| const char * | str ) |
Write a string to a Window.
| win | Window |
| str | String |
| 0 | Success |
| -1 | Error |
Definition at line 381 of file mutt_window.c.
Here is the caller graph for this function:| int mutt_window_printf | ( | struct MuttWindow * | win, |
| const char * | fmt, | ||
| ... ) |
Write a formatted string to a Window.
| win | Window |
| fmt | Format string |
| ... | Arguments |
| num | Number of characters written |
Definition at line 396 of file mutt_window.c.
Here is the caller graph for this function:| void mutt_window_add_child | ( | struct MuttWindow * | parent, |
| struct MuttWindow * | child ) |
Add a child to Window.
| parent | Window to add to |
| child | Window to add |
Definition at line 411 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct MuttWindow * mutt_window_remove_child | ( | struct MuttWindow * | parent, |
| struct MuttWindow * | child ) |
Remove a child from a Window.
| parent | Window to remove from |
| child | Window to remove |
| ptr | Child Window |
Definition at line 433 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_winlist_free | ( | struct MuttWindowList * | head | ) |
Free a tree of Windows.
| head | WindowList to free |
Definition at line 454 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool mutt_window_is_visible | ( | struct MuttWindow * | win | ) |
Is the Window visible?
| win | Window |
| true | The Window is visible |
For a Window to be visible, it must be visible and its parent and grandparent, etc.
Definition at line 477 of file mutt_window.c.
Here is the caller graph for this function:| struct MuttWindow * window_find_child | ( | struct MuttWindow * | win, |
| enum WindowType | type ) |
Recursively find a child Window of a given type.
| win | Window to start searching |
| type | Window type to find, e.g. WT_STATUS_BAR |
| ptr | Matching Window |
| NULL | No match |
Definition at line 498 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct MuttWindow * window_find_parent | ( | struct MuttWindow * | win, |
| enum WindowType | type ) |
Find a (grand-)parent of a Window by type.
| win | Window |
| type | Window type, e.g. WT_DLG_INDEX |
| ptr | Window |
Definition at line 523 of file mutt_window.c.
Here is the caller graph for this function:
|
static |
Recalculate a tree of Windows.
| win | Window to start at |
Definition at line 538 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Repaint a tree of Windows.
| win | Window to start at |
Definition at line 558 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Recursor the focussed Window.
Give the focussed Window an opportunity to set the position and visibility of its cursor.
Definition at line 580 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void window_redraw | ( | struct MuttWindow * | win | ) |
Reflow, recalc and repaint a tree of Windows.
| win | Window to start at |
Definition at line 599 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool window_is_focused | ( | const struct MuttWindow * | win | ) |
Does the given Window have the focus?
| win | Window to check |
| true | Window has focus |
Definition at line 619 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct MuttWindow * window_get_focus | ( | void | ) |
Get the currently focused Window.
| ptr | Window with focus |
Definition at line 633 of file mutt_window.c.
Here is the caller graph for this function:| struct MuttWindow * window_set_focus | ( | struct MuttWindow * | win | ) |
Set the Window focus.
| win | Window to focus |
| ptr | Old focused Window |
| NULL | Error, or focus not changed |
Definition at line 649 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_window_clear | ( | struct MuttWindow * | win | ) |
Clear a Window.
| win | Window |
If the Window isn't visible, it won't be cleared.
Definition at line 685 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| const char * mutt_window_win_name | ( | const struct MuttWindow * | win | ) |
Get the name of a Window.
| win | Window |
| ptr | String describing Window |
| NULL | Error, or unknown |
Definition at line 700 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Mark a window as in need of repaint.
| win | Window to start at |
Definition at line 715 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void window_invalidate_all | ( | void | ) |
Mark all windows as in need of repaint.
Definition at line 732 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool window_status_on_top | ( | struct MuttWindow * | panel, |
| const struct ConfigSubset * | sub ) |
Organise windows according to config variable.
| panel | Window containing WT_MENU and WT_STATUS_BAR |
| sub | Config Subset |
| true | Window order was changed |
Set the positions of two Windows based on a config variable $status_on_top.
Definition at line 749 of file mutt_window.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool mutt_window_swap | ( | struct MuttWindow * | parent, |
| struct MuttWindow * | win1, | ||
| struct MuttWindow * | win2 ) |
Swap the position of two windows.
| parent | Parent Window |
| win1 | Window |
| win2 | Window |
| true | Windows were switched |
Definition at line 785 of file mutt_window.c.
Here is the caller graph for this function:
|
static |
Lookups for Window Names.
Definition at line 46 of file mutt_window.c.