took painelf's change, modified it a lot, and now here's the result :-)
svn-id: r4540
This commit is contained in:
parent
101613f6fd
commit
1238d74227
11 changed files with 157 additions and 55 deletions
|
@ -80,25 +80,38 @@ void Dialog::draw()
|
|||
}
|
||||
}
|
||||
|
||||
void Dialog::handleClick(int x, int y, int button)
|
||||
void Dialog::handleMouseDown(int x, int y, int button)
|
||||
{
|
||||
// FIXME: If outside focused widget, widget loses focus
|
||||
|
||||
Widget *w = findWidget(x - _x, y - _y);
|
||||
if (w)
|
||||
w->handleMouseDown(x - _x - w->_x, y - _y - w->_y, button);
|
||||
}
|
||||
|
||||
void Dialog::handleMouseUp(int x, int y, int button)
|
||||
{
|
||||
Widget *w = findWidget(x - _x, y - _y);
|
||||
if (w)
|
||||
w->handleClick(x - _x - w->_x, y - _y - w->_y, button);
|
||||
w->handleMouseUp(x - _x - w->_x, y - _y - w->_y, button);
|
||||
}
|
||||
|
||||
void Dialog::handleKey(char key, int modifiers)
|
||||
void Dialog::handleKeyDown(char key, int modifiers)
|
||||
{
|
||||
// ESC closes all dialogs by default
|
||||
if (key == 27)
|
||||
close();
|
||||
|
||||
// FIXME: Only if not focused widget
|
||||
|
||||
// Hotkey handling
|
||||
Widget *w = _firstWidget;
|
||||
key = toupper(key);
|
||||
while (w) {
|
||||
if (w->_type == kButtonWidget && key == toupper(((ButtonWidget *)w)->_hotkey)) {
|
||||
w->handleClick(0, 0, 1);
|
||||
// FIXME: Calling both handlers is bad style, but we don't really know which one we're supposed to call
|
||||
w->handleMouseDown(0, 0, 1);
|
||||
w->handleMouseUp(0, 0, 1);
|
||||
break;
|
||||
}
|
||||
w = w->_next;
|
||||
|
@ -109,6 +122,11 @@ void Dialog::handleKey(char key, int modifiers)
|
|||
// and also for an editable list widget.
|
||||
}
|
||||
|
||||
void Dialog::handleKeyUp(char key, int modifiers)
|
||||
{
|
||||
// FIXME: Focused widget recieves keyup
|
||||
}
|
||||
|
||||
void Dialog::handleMouseMoved(int x, int y, int button)
|
||||
{
|
||||
Widget *w = findWidget(x - _x, y - _y);
|
||||
|
@ -127,6 +145,8 @@ void Dialog::handleMouseMoved(int x, int y, int button)
|
|||
if (w->getFlags() & WIDGET_TRACK_MOUSE) {
|
||||
w->handleMouseMoved(x - _x - w->_x, y - _y - w->_y, button);
|
||||
}
|
||||
|
||||
//FIXME: Focused widget recieves mouseup
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue