genode/repos/os/src/server/nitpicker/mode.h

62 lines
1.1 KiB
C
Raw Normal View History

2011-12-22 16:19:25 +01:00
/*
* \brief Nitpicker mode
* \author Norman Feske
* \date 2006-08-22
*/
/*
2013-01-10 21:44:47 +01:00
* Copyright (C) 2006-2013 Genode Labs GmbH
2011-12-22 16:19:25 +01:00
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _MODE_H_
#define _MODE_H_
class View;
class Canvas_base;
2011-12-22 16:19:25 +01:00
class Mode
{
2013-09-07 02:02:26 +02:00
private:
2011-12-22 16:19:25 +01:00
2013-09-07 02:02:26 +02:00
bool _xray;
bool _kill;
2011-12-22 16:19:25 +01:00
/*
2013-09-07 02:02:26 +02:00
* Last clicked view. This view is receiving keyboard input, except
* for global keys.
2011-12-22 16:19:25 +01:00
*/
2013-09-07 02:02:26 +02:00
View const *_focused_view;
2011-12-22 16:19:25 +01:00
public:
2013-09-07 02:02:26 +02:00
Mode(): _xray(false), _kill(false), _focused_view(0) { }
2011-12-22 16:19:25 +01:00
virtual ~Mode() { }
/**
* Accessors
*/
2013-09-07 02:02:26 +02:00
bool xray() const { return _xray; }
bool kill() const { return _kill; }
bool flat() const { return !_xray && !_kill; }
void leave_kill() { _kill = false; }
void toggle_kill() { _kill = !_kill; }
void toggle_xray() { _xray = !_xray; }
View const *focused_view() const { return _focused_view; }
2011-12-22 16:19:25 +01:00
2013-09-07 02:02:26 +02:00
void focused_view(View const *view) { _focused_view = view; }
2011-12-22 16:19:25 +01:00
/**
* Discard all references to specified view
*/
virtual void forget(View const &v) {
2013-09-07 02:02:26 +02:00
if (&v == _focused_view) _focused_view = 0; }
2011-12-22 16:19:25 +01:00
};
#endif