MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / show

Method show

src/ui/alert.cpp:95–128  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

93
94// static
95int Alert::show(const char* format, ...)
96{
97 char buf[4096];
98 va_list ap;
99
100 // Process arguments
101 va_start(ap, format);
102 vsnprintf(buf, sizeof(buf), format, ap);
103 va_end(ap);
104
105 // Create the alert window
106 std::vector<Widget*> labels;
107 std::vector<Widget*> buttons;
108
109 AlertPtr window(new Alert());
110 window->processString(buf, labels, buttons);
111
112 // Open it
113 window->openWindowInForeground();
114
115 // Check the closer
116 int ret = 0;
117 if (Widget* closer = window->closer()) {
118 for (int i=0; i<(int)buttons.size(); ++i) {
119 if (closer == buttons[i]) {
120 ret = i+1;
121 break;
122 }
123 }
124 }
125
126 // And return it
127 return ret;
128}
129
130void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<Widget*>& buttons)
131{

Callers

nothing calls this directly

Calls 4

processStringMethod · 0.80
closerMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected