"Fossies" - the Fresh Open Source Software Archive

Member "tcpflow-1.6.1/src/netviz/legend_view.h" (19 Feb 2021, 1211 Bytes) of package /linux/misc/tcpflow-1.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "legend_view.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * This source file is public domain, as it is not based on the original tcpflow.
    3  *
    4  * Author: Michael Shick <mike@shick.in>
    5  */
    6 
    7 
    8 #ifndef LEGEND_VIEW_H
    9 #define LEGEND_VIEW_H
   10 
   11 #include "plot_view.h"
   12 
   13 class legend_view {
   14 public:
   15     // legend_view::entry to everyone else
   16     class entry_t {
   17     public:
   18         entry_t(plot_view::rgb_t color_, std::string label_, uint16_t port_) :
   19             color(color_), label(label_), port(port_) {}
   20         plot_view::rgb_t color;
   21         std::string label;
   22         uint16_t port;
   23     };
   24     typedef std::vector<entry_t> entries_t;
   25 
   26     legend_view(entries_t entries_) :
   27         entries(entries_) {}
   28 
   29     void render(cairo_t *cr, const plot_view::bounds_t &bounds) const;
   30 
   31     static const std::string empty_legend_label;
   32     static const double base_font_size;
   33     static const double chip_length;
   34     static const double chip_label_space;
   35     static const double inter_item_space;
   36     static const double padding;
   37     static const double border_width;
   38     static const plot_view::rgb_t border_color;
   39 private:
   40     const entries_t entries;
   41 };
   42 
   43 inline bool operator<(const legend_view::entry_t &a, const legend_view::entry_t &b)
   44 {
   45     return a.port < b.port;
   46 }
   47 #endif