(root)/wip/src/mouse_slider.h - Rev 1539
Rev 1577 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* mouse_slider.h
* DIN Is Noise is copyright (c) 2006-2020 Jagannathan Sampath
* For more information, please visit https://dinisnoise.org/
*/
#ifndef __mouse_slider
#define __mouse_slider
#include "widget.h"
#include "arrow_button.h"
#include <list>
struct mouse_slider_listener {
std::string name;
enum {X, Y, NONE};
int orient;
mouse_slider_listener ();
virtual void moused (int dir) = 0;
virtual void after_slide () {}
};
struct mouse_slider : widget {
int sz, sz_2, szn, szn_1;
arrow_button axl, axr;
arrow_button ayb, ayt;
void update_x_arrows ();
void update_y_arrows ();
static const int margin = 10;
int lowx, highx, midx;
int lowy, highy, midy;
int prevx, prevy;
int initx, inity, inityy;
std::list<mouse_slider_listener*> mslx, msly;
int nmslx, nmsly;
int dx, dy;
int x_only ();
int y_only ();
int active;
int lmb_clicked;
mouse_slider ();
~mouse_slider ();
int handle_input ();
int pts [4];
void draw ();
void color_arrows (int d, arrow_button& a1, arrow_button& a2);
void add (mouse_slider_listener* sl);
void remove (mouse_slider_listener* sl);
int activate ();
void deactivate ();
};
void activate_mouse_slider ();
int mouse_slider_active ();
void deactivate_mouse_slider ();
void cant_mouse_slide ();
extern mouse_slider mouse_slider0;
#define MAKE_MOUSE_SLIDER_LISTENER(name,var) struct name : mouse_slider_listener { void after_slide (); void moused (int dir); }; name var;
#define AFTER_SLIDE(scope,name) void scope::name::after_slide ()
#define MOUSED(scope,name) void scope::name::moused (int dir)
#endif