Subversion Repositories DIN Is Noise

Rev

Rev 1476 | Rev 1713 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
* label.cc
* DIN Is Noise is copyright (c) 2006-2020 Jagannathan Sampath
* For more information, please visit https://dinisnoise.org/
*/


#include "label.h"
#include "font.h"
#include "viewwin.h"

using namespace std;


label::label (const std::string& t) : text (t) {set_text (text);}

void label::set_text (const string& t) {
  text = t;
  set_name (text);
  int w = get_char_width (text), h = get_max_char_height (text);
  const box<int>& e = extents;
  set_extents (e.left, e.bottom, e.left + w, e.bottom + h);
}

void label::draw () {
  // fill_bbox (0.1f, 2);
  widget::draw ();
  draw_string (text, posx, posy);
}

void label::update () {set_text (text);}

void set_label (label& l, const char** lbls, int i) {
  l.set_text (lbls[i]);
}