NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dialog.h File Reference

Dialog Windows. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct MuttWindowdialog_find (struct MuttWindow *win)
 Find the parent Dialog of a Window.
 
void dialog_pop (void)
 Hide a Window from the user.
 
void dialog_push (struct MuttWindow *dlg)
 Display a Window to the user.
 
struct MuttWindowalldialogs_new (void)
 Create the AllDialogs Window.
 

Variables

struct MuttWindowAllDialogsWindow
 Parent of all Dialogs.
 

Detailed Description

Dialog Windows.

Authors
  • Richard Russon

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 dialog.h.

Function Documentation

◆ dialog_find()

struct MuttWindow * dialog_find ( struct MuttWindow * win)

Find the parent Dialog of a Window.

Parameters
winWindow
Return values
ptrDialog

Dialog Windows will be owned by a MuttWindow of type WT_ALL_DIALOGS.

Definition at line 89 of file dialog.c.

90{
91 for (; win && win->parent; win = win->parent)
92 {
93 if (win->parent->type == WT_ALL_DIALOGS)
94 return win;
95 }
96
97 return NULL;
98}
@ WT_ALL_DIALOGS
Container for All Dialogs (nested Windows)
Definition mutt_window.h:74
struct MuttWindow * parent
Parent Window.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
+ Here is the caller graph for this function:

◆ dialog_pop()

void dialog_pop ( void )

Hide a Window from the user.

The topmost (visible) Window is removed from the stack and the next Window is marked as visible.

Definition at line 142 of file dialog.c.

143{
144 if (!AllDialogsWindow)
145 return;
146
147 struct MuttWindow **wp_last = ARRAY_LAST(&AllDialogsWindow->children);
148 if (!wp_last)
149 return;
150
151 struct MuttWindow *win_last = *wp_last;
152
153 // Notify the world, allowing plugins to clean up
154 mutt_debug(LL_NOTIFY, "NT_WINDOW_DIALOG hidden: %s, %p\n",
155 mutt_window_win_name(win_last), (void *) win_last);
156 struct EventWindow ev_w = { win_last, WN_HIDDEN };
157 notify_send(win_last->notify, NT_WINDOW, NT_WINDOW_DIALOG, &ev_w);
158
159 win_last->state.visible = false;
160 win_last->parent = NULL;
161 ARRAY_REMOVE(&AllDialogsWindow->children, wp_last);
162
163 wp_last = ARRAY_LAST(&AllDialogsWindow->children);
164 if (wp_last)
165 {
166 (*wp_last)->state.visible = true;
168 }
169 else
170 {
171 AllDialogsWindow->focus = NULL;
172 }
173#ifdef USE_DEBUG_WINDOW
175#endif
176}
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition array.h:355
#define ARRAY_LAST(head)
Convenience method to get the last element.
Definition array.h:145
void debug_win_dump(void)
Dump all windows to debug output.
Definition window.c:114
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
Definition dialog.c:80
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition notify.c:173
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
const char * mutt_window_win_name(const struct MuttWindow *win)
Get the name of a Window.
@ NT_WINDOW_DIALOG
A new Dialog Window has been created, e.g. WT_DLG_INDEX.
#define WN_HIDDEN
Window became hidden.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:57
An Event that happened to a Window.
struct WindowState state
Current state of the Window.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
bool visible
Window is visible.
Definition mutt_window.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialog_push()

void dialog_push ( struct MuttWindow * dlg)

Display a Window to the user.

Parameters
dlgWindow to display

The Dialog Windows are kept in a stack. The topmost is visible to the user, whilst the others are hidden.

When a Window is pushed, the old Window is marked as not visible.

Definition at line 109 of file dialog.c.

110{
111 if (!dlg || !AllDialogsWindow)
112 return;
113
114 struct MuttWindow **wp_last = ARRAY_LAST(&AllDialogsWindow->children);
115 if (wp_last)
116 (*wp_last)->state.visible = false;
117
118 ARRAY_ADD(&AllDialogsWindow->children, dlg);
120
121 // Notify the world, allowing plugins to integrate
122 mutt_debug(LL_NOTIFY, "NT_WINDOW_DIALOG visible: %s, %p\n",
123 mutt_window_win_name(dlg), (void *) dlg);
124 struct EventWindow ev_w = { dlg, WN_VISIBLE };
126
127 dlg->state.visible = true;
130
131#ifdef USE_DEBUG_WINDOW
133#endif
134}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition array.h:157
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
#define WN_VISIBLE
Window became visible.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alldialogs_new()

struct MuttWindow * alldialogs_new ( void )

Create the AllDialogs Window.

Return values
ptrNew AllDialogs Window

Create the container for all the Dialogs.

Definition at line 212 of file dialog.c.

213{
217
219
220 AllDialogsWindow = win_alldlgs;
221
222 return win_alldlgs;
223}
static int alldialogs_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dialog.c:185
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition notify.c:191
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
Definition mutt_window.h:38
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition mutt_window.h:52
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
Definition mutt_window.h:48
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ AllDialogsWindow

struct MuttWindow* AllDialogsWindow
extern

Parent of all Dialogs.

Definition at line 80 of file dialog.c.