Inkscape
Vector Graphics Editor
|
A convenience class for working with MessageStacks. More...
#include <message-context.h>
Public Member Functions | |
MessageContext (MessageStack &stack) | |
Constructs an Inkscape::MessageContext referencing a particular Inkscape::MessageStack, which will be used for our messages. | |
~MessageContext () | |
void | set (MessageType type, char const *message) |
pushes a message on the stack, replacing our old message | |
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 | |
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 | flash (MessageType type, char const *message) |
pushes a message onto the stack for a brief period of time without disturbing our "current" message | |
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, without disturbing our current message | |
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 argument list; it does not disturb our "current" message | |
void | clear () |
removes our current message from the stack | |
Private Attributes | |
MessageStack * | _stack |
the message stack to use | |
MessageId | _message_id = 0 |
our current message id, or 0 | |
MessageId | _flash_message_id = 0 |
current flashed message id, or 0 | |
A convenience class for working with MessageStacks.
In general, a particular piece of code will only want to display one status message at a time. This class takes care of tracking a "current" message id in a particular stack for us, and provides a convenient means to remove or replace it.
Definition at line 37 of file message-context.h.
Inkscape::MessageContext::MessageContext | ( | MessageStack & | stack | ) |
Constructs an Inkscape::MessageContext referencing a particular Inkscape::MessageStack, which will be used for our messages.
MessageContexts retain references to the MessageStacks they use.
stack | the Inkscape::MessageStack to use for our messages |
Definition at line 19 of file message-context.cpp.
Inkscape::MessageContext::~MessageContext | ( | ) |
Definition at line 23 of file message-context.cpp.
References clear().
void Inkscape::MessageContext::clear | ( | ) |
removes our current message from the stack
Definition at line 70 of file message-context.cpp.
References _flash_message_id, _message_id, _stack, and Inkscape::MessageStack::cancel().
Referenced by Inkscape::UI::Tools::cc_generic_knot_handler(), SPKnot::eventHandler(), Inkscape::UI::Dialog::ColorItem::on_motion_leave(), Inkscape::UI::Tools::ArcTool::root_handler(), Inkscape::UI::Tools::RectTool::root_handler(), Inkscape::UI::Tools::SpiralTool::root_handler(), Inkscape::UI::Tools::StarTool::root_handler(), Inkscape::UI::Tools::TextTool::root_handler(), Inkscape::UI::Tools::SelectTool::sp_select_context_abort(), and ~MessageContext().
void Inkscape::MessageContext::flash | ( | MessageType | type, |
char const * | message | ||
) |
pushes a message onto the stack for a brief period of time without disturbing our "current" message
type | the message type |
message | the message text |
Definition at line 50 of file message-context.cpp.
References _flash_message_id, _stack, Inkscape::MessageStack::cancel(), and Inkscape::MessageStack::flash().
Referenced by Inkscape::UI::Widget::CanvasGrid::CanvasGrid(), flashVF(), Inkscape::have_viable_layer(), and Inkscape::UI::Tools::sp_event_show_modifier_tip().
void Inkscape::MessageContext::flashF | ( | MessageType | type, |
char const * | format, | ||
... | |||
) |
pushes a message onto the stack for a brief period of time using printf-style formatting, without disturbing our current message
type | the message type |
format | a printf-style formatting string |
Definition at line 57 of file message-context.cpp.
References flashVF(), va_end(), and va_start().
void Inkscape::MessageContext::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 argument list; it does not disturb our "current" message
type | the message type |
format | a printf-style formatting string |
args | printf-style arguments |
Definition at line 64 of file message-context.cpp.
References flash().
Referenced by flashF().
void Inkscape::MessageContext::set | ( | MessageType | type, |
char const * | message | ||
) |
pushes a message on the stack, replacing our old message
type | the message type |
message | the message text |
Definition at line 28 of file message-context.cpp.
References _message_id, _stack, Inkscape::MessageStack::cancel(), and Inkscape::MessageStack::push().
Referenced by Inkscape::UI::Tools::TextTool::_showCurrUnichar(), SPKnot::eventHandler(), Inkscape::UI::Dialog::ColorItem::on_motion_enter(), Inkscape::UI::Tools::TextTool::root_handler(), tool_switch(), and Inkscape::SelectionDescriber::updateMessage().
void Inkscape::MessageContext::setF | ( | MessageType | type, |
char const * | format, | ||
... | |||
) |
pushes a message on the stack using prinf-style formatting, and replacing our old message
type | the message type |
format | a printf-style formatting string |
Definition at line 35 of file message-context.cpp.
References setVF(), va_end(), and va_start().
Referenced by Inkscape::UI::Tools::TextTool::_showCurrUnichar(), Inkscape::UI::Tools::DropperTool::root_handler(), Inkscape::UI::Tools::NodeTool::root_handler(), and Inkscape::SelectionDescriber::updateMessage().
void Inkscape::MessageContext::setVF | ( | MessageType | type, |
char const * | format, | ||
va_list | args | ||
) |
pushes a message on the stack using printf-style formatting, and a stdarg argument list
type | the message type |
format | a printf-style formatting string |
args | printf-style arguments |
Definition at line 43 of file message-context.cpp.
References set.
Referenced by setF().
|
private |
current flashed message id, or 0
Definition at line 107 of file message-context.h.
|
private |
our current message id, or 0
Definition at line 106 of file message-context.h.
|
private |
the message stack to use
Definition at line 105 of file message-context.h.