OpenCV zGUI
CrossPlatform C++ GUI libarary based on OpenCV
z::AsciiWindow Class Reference
Inheritance diagram for z::AsciiWindow:
Collaboration diagram for z::AsciiWindow:

Public Member Functions

 AsciiWindow (const char *asciiart, int unit_width=10, int unit_height=15, int margin=1)
 
void title (std::string t)
 
- Public Member Functions inherited from z::Window
 Window (std::string title, cv::Rect_< int > r)
 
void show ()
 draw mat_ More...
 
void popup (Window &w, std::function< void(int)> f=[](int){})
 
void popdown (int value)
 
std::string type () const
 
int open (int flag=cv::WINDOW_AUTOSIZE, int x=-1, int y=-1)
 
void quit (int r)
 
void focus (bool v)
 
Windowoperator+ (Widget &w)
 
Windowoperator- (Widget &w)
 
Windowoperator<< (Widget &r)
 
Windowoperator>> (Widget &r)
 
int loop ()
 
std::vector< Widget * >::iterator begin ()
 
std::vector< Widget * >::iterator end ()
 
void close ()
 
void start (int flag=cv::WINDOW_AUTOSIZE|cv::WINDOW_KEEPRATIO)
 
void keyboard_callback (int key, int level=0)
 
std::string title () const
 
void tie (TextInput &t, Button &b, const std::vector< std::string > &v, int font_size)
 
template<class T >
auto tie (TextInput &t, Button &b1, Button &b2, T start, T step)
 
template<class... T>
void tabs (int xpos, int ypos, T &... wins)
 
void organize_accordingto_zindex ()
 
void move_widget (Widget &w, cv::Point2i p)
 
void on_register ()
 will be called when widget is added to a window
 
bool is_window () const
 
template<class... T>
auto tie (T &... checks)
 
template<class... T>
void wrap (const char *title, int font, int N, const T &... widgets)
 
void draw_all_wrapped ()
 
void scroll_to (cv::Rect2i r)
 
void set_ul (cv::Point2i p)
 
void set_br (cv::Point2i p)
 
- Public Member Functions inherited from z::Widget
 Widget (cv::Rect_< int > r)
 
Widgetoperator= (const Widget &r)
 
bool focus () const
 
virtual void event_callback (int event, int x, int y)
 
void resize (cv::Rect2i r)
 
void update ()
 
int zIndex ()
 
void zIndex (int v)
 
void hidden (bool v)
 
void activated (bool v)
 
bool hidden () const
 
bool activated () const
 
void hide ()
 
float alpha () const
 
void alpha (float f)
 
void shade_rect (cv::Rect2i r, int shade=3, cv::Vec3b color=widget_color_, cv::Vec3b upper_left=highlight_color_, cv::Vec3b lower_right=click_color_)
 

Protected Attributes

std::vector< std::shared_ptr< Slider > > S
 
std::vector< std::shared_ptr< Button > > B
 
std::vector< std::shared_ptr< TextInput > > T
 
std::vector< std::shared_ptr< CheckBox > > C
 
std::vector< std::shared_ptr< Label > > L
 
std::vector< std::shared_ptr< Image > > I
 
std::vector< std::shared_ptr< Progress > > P
 
std::vector< std::shared_ptr< Widget > > Z
 
std::vector< std::shared_ptr< TextBox > > E
 
- Protected Attributes inherited from z::Window
std::string title_
 
bool closed_ = false
 
int result_ = -1
 
- Protected Attributes inherited from z::Widget
float alpha_ = 1
 alpha value of widget. Widgets can be overlapped. Alpha value will be calculated in such cases.
 
bool hidden_ = false
 if hidden, a widget will not show on window, but still can react to event.
 
bool activated_ = true
 deactivated widget cannot get focus so that it cannot react to events.
 
bool focus_ = false
 
int zIndex_ = 0
 higher zIndex widget will be in front of lower zIndex widget.
 

Additional Inherited Members

- Public Attributes inherited from z::Window
cv::Rect2i scrolled_rect_ = cv::Rect2i{0,0,0,0}
 
std::vector< Widget * > widgets_
 
std::vector< Widget * > backup_
 
- Public Attributes inherited from z::Widget
std::map< int, std::function< void(int, int)> > gui_callback_
 map<int : event, function(x, y)>. library will draw change in widget graphics after gui_callback
 
std::map< int, std::function< void(int, int)> > user_callback_
 
cv::Mat3b mat_
 Matrix that contains widget shape.
 
Windowparent_ = nullptr
 pointer to parent window that is containing this widget
 
- Protected Member Functions inherited from z::Window
void draw_wrapped (const Wrapped &wr)
 
- Static Protected Attributes inherited from z::Widget
static const cv::Vec3b background_color_ = {200, 200, 200}
 
static const cv::Vec3b widget_color_ = {220, 220, 220}
 
static const cv::Vec3b highlight_color_ = {240, 240, 240}
 
static const cv::Vec3b click_color_ = {180, 180, 180}
 
static cv::Ptr< cv::freetype::FreeType2 > ft2_
 freetype2 font. CJK font needed
 

Constructor & Destructor Documentation

◆ AsciiWindow()

z::AsciiWindow::AsciiWindow ( const char *  asciiart,
int  unit_width = 10,
int  unit_height = 15,
int  margin = 1 
)
Parameters
pcompose GUI with ascii art, never use tab.
unit_widthwidth in pixel that one ascii art character will occupy. If you want to make a bigger widget increase this.
unit_heightheight in pixel that one ascii art character will occupy
marginmargin space around window

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