ocarina/include/lib/lib.h
Anna Schumaker 0b5478c591 lib: Move idle function setup into lib/
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-09-12 08:07:12 -04:00

37 lines
764 B
C++

/*
* Copyright 2014 (c) Anna Schumaker.
*/
#ifndef OCARINA_LIB_LIB_H
#define OCARINA_LIB_LIB_H
#include <string>
#include <gtkmm.h>
namespace lib
{
void init(int *, char ***, const std::string &);
const std::string share_file(const std::string &);
Glib::RefPtr<Gtk::Builder> &get_builder();
const std::string key_name(GdkEventKey *);
void idle(bool (*)());
void schedule(bool (*)(), unsigned int);
template <class T>
static inline T *get_widget(const std::string &name)
{
T *widget;
get_builder()->get_widget(name, widget);
return widget;
}
template <class T>
static inline Glib::RefPtr<T> get_object(const std::string &name)
{
return Glib::RefPtr<T>::cast_static(get_builder()->get_object(name));
}
}
#endif /* OCARINA_LIB_LIB_H */