<commit_before>#pragma once
#include <vector>
#include "rect.hpp"
#include "keys.hpp"

namespace wheel
{
	struct widget : rect
	{
		widget *parent = 0;
		std::vector<widget*> children;
		bool active = 1;

		operator bool() const { return active; }
		bool operator!() const { return !active; }

		virtual ~widget() {}
		widget *at(const point& x) { for(widget *w : children) if(w->contains(x)) return w; return 0; }

		virtual void update() { for(widget *c : children) if(*c) c->update(); }
		virtual widget *focus() { return at(pointer()); }
		virtual void focus(widget *) {}
		virtual point pointer() const { if(parent) return parent->pointer() - p; return point(); }
		virtual void pointermove() { if(widget *c = at(pointer())) c->pointermove(); }
		virtual void scroll(float d) { if(widget *c = focus()) c->scroll(d); }
		virtual void keycode(uint32_t k) { if(widget *c = focus()) c->keycode(k); }
		virtual void press(uint8_t k) { if(widget *c = focus()) c->press(k); }
		virtual void release(uint8_t k) { if(widget *c = focus()) c->release(k); }
		virtual void resize() { for(widget *c : children) if(*c) c->resize(); }
		virtual void draw() { for(widget *c : children) if(*c) c->draw(); }
		virtual void close() { if(parent) parent->remove(this); }
		virtual void clear() { for(widget *c : children) c->clear(); }
		virtual void reload() { for(widget *c : children) c->reload(); }

		void add(widget *w) { children.push_back(w); w->parent = this; }
		void remove(widget *w) { for(widget*& c : children) if(c == w) { c = children.back(); children.pop_back(); break; } }

		widget& operator<<(widget& w) { add(&w); return *this; }
	};
}<commit_msg>widget minor fix<commit_after>#pragma once
#include <vector>
#include "rect.hpp"
#include "keys.hpp"

namespace wheel
{
	struct widget : rect
	{
		widget *parent = 0;
		std::vector<widget*> children;
		bool active = 1;

		operator bool() const { return active; }
		bool operator!() const { return !active; }

		virtual ~widget() {}
		widget *at(const point& x) { for(widget *w : children) if(w->active) if(w->contains(x)) return w; return 0; }

		virtual void update() { for(widget *c : children) if(*c) c->update(); }
		virtual widget *focus() { return at(pointer()); }
		virtual void focus(widget *) {}
		virtual point pointer() const { if(parent) return parent->pointer() - p; return point(); }
		virtual void pointermove() { if(widget *c = at(pointer())) c->pointermove(); }
		virtual void scroll(float d) { if(widget *c = focus()) c->scroll(d); }
		virtual void keycode(uint32_t k) { if(widget *c = focus()) c->keycode(k); }
		virtual void press(uint8_t k) { if(widget *c = focus()) c->press(k); }
		virtual void release(uint8_t k) { if(widget *c = focus()) c->release(k); }
		virtual void resize() { for(widget *c : children) if(*c) c->resize(); }
		virtual void draw() { for(widget *c : children) if(*c) c->draw(); }
		virtual void close() { if(parent) parent->remove(this); }
		virtual void clear() { for(widget *c : children) c->clear(); }
		virtual void reload() { for(widget *c : children) c->reload(); }

		void add(widget *w) { children.push_back(w); w->parent = this; }
		void remove(widget *w) { for(widget*& c : children) if(c == w) { c = children.back(); children.pop_back(); break; } }

		widget& operator<<(widget& w) { add(&w); return *this; }
	};
}
{'fraction_non_alphanumeric': 0.18909966877446552, 'fraction_numerical': 0.004215597711532671, 'mean_word_length': 4.298245614035087, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '590740', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1095, 'n_words': 341}