43 lines
No EOL
1.1 KiB
C
43 lines
No EOL
1.1 KiB
C
#ifndef RALEIGH_WINDOW_H
|
|
#define RALEIGH_WINDOW_H
|
|
|
|
namespace raleigh {
|
|
class window;
|
|
}
|
|
|
|
#include <raleigh/runtime.h>
|
|
#include <raleigh/widget.h>
|
|
#include <structs/dllist.h>
|
|
#include <structs/duple.h>
|
|
#include <pland/syscall.h>
|
|
#include <raleigh/util.h>
|
|
|
|
namespace raleigh {
|
|
class window {
|
|
friend void start_runtime();
|
|
public:
|
|
//pass on_close to specify a close handler. if on_close returns false, the window will not be closed.
|
|
window(widget &root, _pixel_t bg_color=RGB(bf, bf, bf), bool (*on_close)(window &)=0);
|
|
void add_keybind(struct key_packet kp, void (*handler)(window &));
|
|
|
|
void notify_needs_paint(widget &from);
|
|
void notify_widget_size_change(widget &from, coord old_size);
|
|
enum try_actions_return_t {NONE, GOOD, DELETE};
|
|
try_actions_return_t try_actions();
|
|
void show();
|
|
void focus(widget &w);
|
|
private:
|
|
_window_handle_t handle;
|
|
_pixel_t *pixbuf;
|
|
coord size;
|
|
widget &root;
|
|
widget *focussed;
|
|
_pixel_t bg_color;
|
|
bool needs_repaint;
|
|
void paint_full();
|
|
bool (*on_close)(window &);
|
|
dllist<duple<struct key_packet, void (*)(window &)>> keybinds;
|
|
};
|
|
}
|
|
|
|
#endif |