Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
message-context.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * MessageContext - context for posting status messages
4 *
5 * Authors:
6 * MenTaLguY <mental@rydia.net>
7 *
8 * Copyright (C) 2004 MenTaLguY
9 *
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12
13#include <glib.h>
14#include "message-context.h"
15#include "message-stack.h"
16
17namespace Inkscape {
18
22
27
28void MessageContext::set(MessageType type, gchar const *message) {
29 if (_message_id) {
31 }
32 _message_id = _stack->push(type, message);
33}
34
35void MessageContext::setF(MessageType type, gchar const *format, ...)
36{
37 va_list args;
38 va_start(args, format);
39 setVF(type, format, args);
40 va_end(args);
41}
42
43void MessageContext::setVF(MessageType type, gchar const *format, va_list args)
44{
45 gchar *message=g_strdup_vprintf(format, args);
46 set(type, message);
47 g_free(message);
48}
49
50void MessageContext::flash(MessageType type, gchar const *message) {
53 }
54 _flash_message_id = _stack->flash(type, message);
55}
56
57void MessageContext::flashF(MessageType type, gchar const *format, ...) {
58 va_list args;
59 va_start(args, format);
60 flashVF(type, format, args);
61 va_end(args);
62}
63
64void MessageContext::flashVF(MessageType type, gchar const *format, va_list args) {
65 gchar *message=g_strdup_vprintf(format, args);
66 flash(type, message);
67 g_free(message);
68}
69
80
81} // namespace Inkscape
82
83/*
84 Local Variables:
85 mode:c++
86 c-file-style:"stroustrup"
87 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
88 indent-tabs-mode:nil
89 fill-column:99
90 End:
91*/
92// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
void flashF(MessageType type, char const *format,...) G_GNUC_PRINTF(3
pushes a message onto the stack for a brief period of time using printf-style formatting,...
MessageId _flash_message_id
current flashed message id, or 0
MessageStack * _stack
the message stack to use
void void flashVF(MessageType type, char const *format, va_list args)
pushes a message onto the stack for a brief period of time using printf-style formatting and a stdarg...
void set(MessageType type, char const *message)
pushes a message on the stack, replacing our old message
void flash(MessageType type, char const *message)
pushes a message onto the stack for a brief period of time without disturbing our "current" message
MessageContext(MessageStack &stack)
Constructs an Inkscape::MessageContext referencing a particular Inkscape::MessageStack,...
void void setVF(MessageType type, char const *format, va_list args)
pushes a message on the stack using printf-style formatting, and a stdarg argument list
void setF(MessageType type, char const *format,...) G_GNUC_PRINTF(3
pushes a message on the stack using prinf-style formatting, and replacing our old message
MessageId _message_id
our current message id, or 0
void clear()
removes our current message from the stack
A class which holds a stack of displayed messages.
MessageId flash(MessageType type, char const *message)
Temporarily pushes a message onto the stack.
void cancel(MessageId id)
removes a message from the stack, given its id
MessageId push(MessageType type, char const *message)
pushes a message onto the stack
Interface for locally managing a current status message.
Raw stack of active status messages.
Helper class to stream background task notifications as a series of messages.
MessageType
A hint about the meaning of a message; is it an ordinary message, a message advising the user of some...
Definition message.h:25
va_end(args)
int const char va_start(args, fmt)
Gtk::Stack & stack