forked from nsz32/docklike-plugin
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathHelpers.hpp
62 lines (49 loc) · 1.45 KB
/
Helpers.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Docklike Taskbar - A modern, minimalist taskbar for Xfce
* Copyright (c) 2019-2020 Nicolas Szabo <[email protected]>
* Copyright (c) 2020-2021 David Keogh <[email protected]>
* gnu.org/licenses/gpl-3.0
*/
#ifndef HELPERS_HPP
#define HELPERS_HPP
#include <gtk/gtk.h>
#include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <vector>
namespace Help
{
namespace String
{
void split(const std::string& str, std::list<std::string>& list, char delim);
std::string toLowercase(std::string str);
std::string numericOnly(std::string str);
std::string getWord(std::string str, int index, char separator = ' ');
std::string pathBasename(const std::string str);
std::string trim(const std::string str);
} // namespace String
namespace Gtk
{
std::list<std::string> bufferToStdStringList(gchar** stringList);
std::vector<char*> stdToBufferStringList(std::list<std::string>& stringList);
int getChildPosition(GtkContainer* container, GtkWidget* child);
void cssClassAdd(GtkWidget* widget, const char* className);
void cssClassRemove(GtkWidget* widget, const char* className);
class Timeout
{
public:
Timeout();
void setup(uint ms, std::function<bool()> function);
void start();
void stop();
uint mDuration;
std::function<bool()> mFunction;
uint mTimeoutId;
};
} // namespace Gtk
} // namespace Help
#endif // HELPERS_HPP