Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::MessageContext Class Reference

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
 

Detailed Description

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.

See also
Inkscape::MessageStack

Definition at line 37 of file message-context.h.

Constructor & Destructor Documentation

◆ MessageContext()

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.

Parameters
stackthe Inkscape::MessageStack to use for our messages

Definition at line 19 of file message-context.cpp.

◆ ~MessageContext()

Inkscape::MessageContext::~MessageContext ( )

Definition at line 23 of file message-context.cpp.

References clear().

Member Function Documentation

◆ clear()

◆ flash()

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

Parameters
typethe message type
messagethe 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().

◆ flashF()

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

Parameters
typethe message type
formata printf-style formatting string

Definition at line 57 of file message-context.cpp.

References flashVF(), va_end(), and va_start().

◆ flashVF()

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

Parameters
typethe message type
formata printf-style formatting string
argsprintf-style arguments

Definition at line 64 of file message-context.cpp.

References flash().

Referenced by flashF().

◆ set()

void Inkscape::MessageContext::set ( MessageType  type,
char const *  message 
)

◆ setF()

void Inkscape::MessageContext::setF ( MessageType  type,
char const *  format,
  ... 
)

pushes a message on the stack using prinf-style formatting, and replacing our old message

Parameters
typethe message type
formata 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().

◆ setVF()

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

Parameters
typethe message type
formata printf-style formatting string
argsprintf-style arguments

Definition at line 43 of file message-context.cpp.

References set.

Referenced by setF().

Member Data Documentation

◆ _flash_message_id

MessageId Inkscape::MessageContext::_flash_message_id = 0
private

current flashed message id, or 0

Definition at line 107 of file message-context.h.

Referenced by clear(), and flash().

◆ _message_id

MessageId Inkscape::MessageContext::_message_id = 0
private

our current message id, or 0

Definition at line 106 of file message-context.h.

Referenced by clear(), and set().

◆ _stack

MessageStack* Inkscape::MessageContext::_stack
private

the message stack to use

Definition at line 105 of file message-context.h.

Referenced by clear(), flash(), and set().


The documentation for this class was generated from the following files: