moving events into the class fc
This commit is contained in:
parent
65047855e9
commit
b21fe6a405
|
@ -1,3 +1,6 @@
|
|||
2016-01-17 Markus Gans <guru.mail@muenster.de>
|
||||
* Moving events into the class fc
|
||||
|
||||
2016-01-10 Markus Gans <guru.mail@muenster.de>
|
||||
* Better default color handling in FOptiAttr
|
||||
|
||||
|
|
13
README.md
13
README.md
|
@ -151,19 +151,16 @@ Class digramm
|
|||
┌───────┐ │ : : │ ┌──────────────┐ │ ┌─────────┐1 :
|
||||
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
|
||||
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
|
||||
: :1:1 : : │ ┌────────────┐ : *┌─────────┐
|
||||
:1:1:1 : : │ ┌────────────┐ : *┌─────────┐
|
||||
: : └----------: : ├────┤ FScrollbar │ ├---┤ FString │
|
||||
: :1 : : │ └────────────┘ : └─────────┘
|
||||
:┌┴──────────┐ : : │ ┌───────────┐1 :
|
||||
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
|
||||
:└───────────┘ : : │ └───────────┘ :
|
||||
┌┴──────────┐ : : │ ┌──────────┐1 *┌──────────────┐1 :
|
||||
│ FOptiMove │ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
|
||||
└───────────┘ : : │ └──────────┘ └──────────────┘ :
|
||||
: : │ ┌──────────┐1 *┌──────────────┐1 :
|
||||
: : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
|
||||
: : │ └──────────┘ └──────────────┘ :
|
||||
: : │ ┌────────────┐1 *┌────────────┐1 :
|
||||
:1 : : │ ┌──────────┐1 *┌──────────────┐1 :
|
||||
┌┴──────────┐ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
|
||||
│ FOptiMove │ : : │ └──────────┘ └──────────────┘ :
|
||||
└───────────┘ : : │ ┌────────────┐1 *┌────────────┐1 :
|
||||
: : ├────┤ FStatusBar ├-----┤ FStatusKey ├-------:
|
||||
: : │ └────┬───────┘ └────────────┘ :
|
||||
: : │ 1└----------------------------------:
|
||||
|
|
|
@ -54,16 +54,16 @@
|
|||
┌───────┐ │ : : │ ┌──────────────┐ │ ┌─────────┐1 :
|
||||
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
|
||||
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
|
||||
: :1:1 : : │ ┌────────────┐ : *┌─────────┐
|
||||
:1:1:1 : : │ ┌────────────┐ : *┌─────────┐
|
||||
: : └----------: : ├────┤ FScrollbar │ ├---┤ FString │
|
||||
: :1 : : │ └────────────┘ : └─────────┘
|
||||
:┌┴──────────┐ : : │ ┌───────────┐1 :
|
||||
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
|
||||
:└───────────┘ : : │ └───────────┘ :
|
||||
┌┴──────────┐ : : │ ┌──────────┐1 *┌──────────────┐1 :
|
||||
│ FOptiMove │ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
|
||||
└───────────┘ : : │ └──────────┘ └──────────────┘ :
|
||||
: : │ ┌────────────┐1 *┌────────────┐1 :
|
||||
:1 : : │ ┌──────────┐1 *┌──────────────┐1 :
|
||||
┌┴──────────┐ : : ├────┤ FListBox ├-------┤ FListBoxItem ├-----:
|
||||
│ FOptiMove │ : : │ └──────────┘ └──────────────┘ :
|
||||
└───────────┘ : : │ ┌────────────┐1 *┌────────────┐1 :
|
||||
: : ├────┤ FStatusBar ├-----┤ FStatusKey ├-------:
|
||||
: : │ └────┬───────┘ └────────────┘ :
|
||||
: : │ 1└----------------------------------:
|
||||
|
|
96
src/fapp.cpp
96
src/fapp.cpp
|
@ -357,11 +357,11 @@ void FApplication::processKeyboardEvent()
|
|||
else
|
||||
{
|
||||
// send key down event
|
||||
FKeyEvent k_down_ev (KeyDown_Event, key);
|
||||
FKeyEvent k_down_ev (fc::KeyDown_Event, key);
|
||||
sendEvent (widget, &k_down_ev);
|
||||
|
||||
// send key press event
|
||||
FKeyEvent k_press_ev (KeyPress_Event, key);
|
||||
FKeyEvent k_press_ev (fc::KeyPress_Event, key);
|
||||
sendEvent (widget, &k_press_ev);
|
||||
|
||||
if ( ! open_menu
|
||||
|
@ -386,7 +386,7 @@ void FApplication::processKeyboardEvent()
|
|||
break;
|
||||
if ( iter->key == key )
|
||||
{
|
||||
FAccelEvent a_ev (Accelerator_Event, focus_widget);
|
||||
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
|
||||
sendEvent (iter->object, &a_ev);
|
||||
break;
|
||||
};
|
||||
|
@ -399,7 +399,7 @@ void FApplication::processKeyboardEvent()
|
|||
fifo_offset = int(strlen(fifo_buf));
|
||||
}
|
||||
// send key up event
|
||||
FKeyEvent k_up_ev (KeyUp_Event, key);
|
||||
FKeyEvent k_up_ev (fc::KeyUp_Event, key);
|
||||
sendEvent (widget, &k_up_ev);
|
||||
key = 0;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ void FApplication::processKeyboardEvent()
|
|||
&& fifo_buf[1] == 0x00
|
||||
&& isKeyTimeout(&time_keypressed, key_timeout) )
|
||||
{
|
||||
FKeyEvent k_press_ev (KeyPress_Event, fc::Fkey_escape);
|
||||
FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape);
|
||||
sendEvent (widget, &k_press_ev);
|
||||
input_data_pending = false;
|
||||
}
|
||||
|
@ -1020,11 +1020,11 @@ void FApplication::processMouseEvent()
|
|||
int key_state = 0;
|
||||
|
||||
if ( b_state.shift_button == Pressed )
|
||||
key_state |= ShiftButton;
|
||||
key_state |= fc::ShiftButton;
|
||||
if ( b_state.meta_button == Pressed )
|
||||
key_state |= MetaButton;
|
||||
key_state |= fc::MetaButton;
|
||||
if ( b_state.control_button == Pressed )
|
||||
key_state |= ControlButton;
|
||||
key_state |= fc::ControlButton;
|
||||
|
||||
localMousePos = clicked_widget->globalToLocalPos(*mouse);
|
||||
|
||||
|
@ -1032,26 +1032,26 @@ void FApplication::processMouseEvent()
|
|||
{
|
||||
if ( b_state.left_button == Pressed )
|
||||
{
|
||||
FMouseEvent m_down_ev ( MouseMove_Event
|
||||
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, LeftButton | key_state );
|
||||
, fc::LeftButton | key_state );
|
||||
sendEvent (clicked_widget, &m_down_ev);
|
||||
}
|
||||
if ( b_state.right_button == Pressed )
|
||||
{
|
||||
FMouseEvent m_down_ev ( MouseMove_Event
|
||||
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, RightButton | key_state );
|
||||
, fc::RightButton | key_state );
|
||||
sendEvent (clicked_widget, &m_down_ev);
|
||||
}
|
||||
if ( b_state.middle_button == Pressed )
|
||||
{
|
||||
FMouseEvent m_down_ev ( MouseMove_Event
|
||||
FMouseEvent m_down_ev ( fc::MouseMove_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, MiddleButton | key_state );
|
||||
, fc::MiddleButton | key_state );
|
||||
sendEvent (clicked_widget, &m_down_ev);
|
||||
}
|
||||
}
|
||||
|
@ -1059,26 +1059,26 @@ void FApplication::processMouseEvent()
|
|||
{
|
||||
if ( b_state.left_button == DoubleClick )
|
||||
{
|
||||
FMouseEvent m_dblclick_ev ( MouseDoubleClick_Event
|
||||
FMouseEvent m_dblclick_ev ( fc::MouseDoubleClick_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, LeftButton | key_state );
|
||||
, fc::LeftButton | key_state );
|
||||
sendEvent (clicked_widget, &m_dblclick_ev);
|
||||
}
|
||||
else if ( b_state.left_button == Pressed )
|
||||
{
|
||||
FMouseEvent m_down_ev ( MouseDown_Event
|
||||
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, LeftButton | key_state );
|
||||
, fc::LeftButton | key_state );
|
||||
sendEvent (clicked_widget, &m_down_ev);
|
||||
}
|
||||
else if ( b_state.left_button == Released )
|
||||
{
|
||||
FMouseEvent m_up_ev ( MouseUp_Event
|
||||
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, LeftButton | key_state );
|
||||
, fc::LeftButton | key_state );
|
||||
FWidget* released_widget = clicked_widget;
|
||||
if ( b_state.right_button != Pressed
|
||||
&& b_state.middle_button != Pressed )
|
||||
|
@ -1088,18 +1088,18 @@ void FApplication::processMouseEvent()
|
|||
|
||||
if ( b_state.right_button == Pressed )
|
||||
{
|
||||
FMouseEvent m_down_ev ( MouseDown_Event
|
||||
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, RightButton | key_state );
|
||||
, fc::RightButton | key_state );
|
||||
sendEvent (clicked_widget, &m_down_ev);
|
||||
}
|
||||
else if ( b_state.right_button == Released )
|
||||
{
|
||||
FMouseEvent m_up_ev ( MouseUp_Event
|
||||
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, RightButton | key_state );
|
||||
, fc::RightButton | key_state );
|
||||
FWidget* released_widget = clicked_widget;
|
||||
if ( b_state.left_button != Pressed
|
||||
&& b_state.middle_button != Pressed )
|
||||
|
@ -1109,10 +1109,10 @@ void FApplication::processMouseEvent()
|
|||
|
||||
if ( b_state.middle_button == Pressed )
|
||||
{
|
||||
FMouseEvent m_down_ev ( MouseDown_Event
|
||||
FMouseEvent m_down_ev ( fc::MouseDown_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, MiddleButton | key_state );
|
||||
, fc::MiddleButton | key_state );
|
||||
sendEvent (clicked_widget, &m_down_ev);
|
||||
// gnome-terminal sends no released on middle click
|
||||
if ( gnome_terminal )
|
||||
|
@ -1120,10 +1120,10 @@ void FApplication::processMouseEvent()
|
|||
}
|
||||
else if ( b_state.middle_button == Released )
|
||||
{
|
||||
FMouseEvent m_up_ev ( MouseUp_Event
|
||||
FMouseEvent m_up_ev ( fc::MouseUp_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, MiddleButton | key_state );
|
||||
, fc::MiddleButton | key_state );
|
||||
FWidget* released_widget = clicked_widget;
|
||||
if ( b_state.right_button != Pressed
|
||||
&& b_state.left_button != Pressed )
|
||||
|
@ -1131,22 +1131,24 @@ void FApplication::processMouseEvent()
|
|||
sendEvent (released_widget, &m_up_ev);
|
||||
}
|
||||
}
|
||||
|
||||
if ( b_state.wheel_up == Pressed )
|
||||
{
|
||||
FWheelEvent wheel_ev ( MouseWheel_Event
|
||||
FWheelEvent wheel_ev ( fc::MouseWheel_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, WheelUp );
|
||||
, fc::WheelUp );
|
||||
FWidget* scroll_over_widget = clicked_widget;
|
||||
clicked_widget = 0;
|
||||
sendEvent(scroll_over_widget, &wheel_ev);
|
||||
}
|
||||
|
||||
if ( b_state.wheel_down == Pressed )
|
||||
{
|
||||
FWheelEvent wheel_ev ( MouseWheel_Event
|
||||
FWheelEvent wheel_ev ( fc::MouseWheel_Event
|
||||
, localMousePos
|
||||
, *mouse
|
||||
, WheelDown );
|
||||
, fc::WheelDown );
|
||||
FWidget* scroll_over_widget = clicked_widget;
|
||||
clicked_widget = 0;
|
||||
sendEvent (scroll_over_widget, &wheel_ev);
|
||||
|
@ -1164,7 +1166,7 @@ void FApplication::processResizeEvent()
|
|||
{
|
||||
if ( resize_term )
|
||||
{
|
||||
FResizeEvent r_ev(Resize_Event);
|
||||
FResizeEvent r_ev(fc::Resize_Event);
|
||||
sendEvent(rootObj, &r_ev);
|
||||
|
||||
if ( r_ev.isAccepted() )
|
||||
|
@ -1207,7 +1209,7 @@ int FApplication::processTimerEvent()
|
|||
if ( (*iter).interval.tv_usec > 0 || (*iter).interval.tv_sec > 0 )
|
||||
activated++;
|
||||
|
||||
FTimerEvent t_ev(Timer_Event, (*iter).id);
|
||||
FTimerEvent t_ev(fc::Timer_Event, (*iter).id);
|
||||
sendEvent((*iter).object, &t_ev);
|
||||
|
||||
++iter;
|
||||
|
@ -1381,17 +1383,17 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
|
|||
{
|
||||
switch ( event->type() )
|
||||
{
|
||||
case KeyPress_Event:
|
||||
case KeyUp_Event:
|
||||
case KeyDown_Event:
|
||||
case MouseDown_Event:
|
||||
case MouseUp_Event:
|
||||
case MouseDoubleClick_Event:
|
||||
case MouseWheel_Event:
|
||||
case MouseMove_Event:
|
||||
case FocusIn_Event:
|
||||
case FocusOut_Event:
|
||||
case Accelerator_Event:
|
||||
case fc::KeyPress_Event:
|
||||
case fc::KeyUp_Event:
|
||||
case fc::KeyDown_Event:
|
||||
case fc::MouseDown_Event:
|
||||
case fc::MouseUp_Event:
|
||||
case fc::MouseDoubleClick_Event:
|
||||
case fc::MouseWheel_Event:
|
||||
case fc::MouseMove_Event:
|
||||
case fc::FocusIn_Event:
|
||||
case fc::FocusOut_Event:
|
||||
case fc::Accelerator_Event:
|
||||
return false;
|
||||
|
||||
default:
|
||||
|
@ -1401,8 +1403,8 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
|
|||
}
|
||||
|
||||
// throw away mouse events to disabled widgets
|
||||
if ( event->type() >= MouseDown_Event
|
||||
&& event->type() <= MouseMove_Event
|
||||
if ( event->type() >= fc::MouseDown_Event
|
||||
&& event->type() <= fc::MouseMove_Event
|
||||
&& ! widget->isEnabled() )
|
||||
return false;
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ void FButton::onKeyPress (FKeyEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
{
|
||||
setUp();
|
||||
return;
|
||||
|
@ -613,7 +613,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
|
|||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -629,7 +629,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( button_down )
|
||||
|
@ -643,7 +643,7 @@ void FButton::onMouseUp (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::onMouseMove (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
FPoint gPos = ev->getGlobalPos();
|
||||
|
@ -671,7 +671,7 @@ void FButton::onAccel (FAccelEvent* ev)
|
|||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
|
|
@ -96,7 +96,7 @@ void FButtonGroup::directFocus()
|
|||
{
|
||||
found_checked = true;
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
(*iter)->setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -112,7 +112,7 @@ void FButtonGroup::directFocus()
|
|||
if ( ! found_checked )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
focusFirstChild();
|
||||
if ( focused_widget )
|
||||
|
@ -448,7 +448,7 @@ bool FButtonGroup::hasCheckedButton()
|
|||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
directFocus();
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
}
|
||||
if ( in_ev->isAccepted() )
|
||||
{
|
||||
if ( in_ev->getFocusType() == FocusNextWidget )
|
||||
if ( in_ev->getFocusType() == fc::FocusNextWidget )
|
||||
{
|
||||
in_ev->ignore();
|
||||
FWidget* prev_element = getFocusWidget();
|
||||
|
@ -495,7 +495,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
prev_element->redraw();
|
||||
getFocusWidget()->redraw();
|
||||
}
|
||||
else if ( in_ev->getFocusType() == FocusPreviousWidget )
|
||||
else if ( in_ev->getFocusType() == fc::FocusPreviousWidget )
|
||||
{
|
||||
in_ev->ignore();
|
||||
FWidget* prev_element = getFocusWidget();
|
||||
|
|
|
@ -448,7 +448,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
|||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( ev->getButton() == LeftButton )
|
||||
if ( ev->getButton() == fc::LeftButton )
|
||||
{
|
||||
// click on titlebar or window: raise + activate
|
||||
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
|
||||
|
@ -477,7 +477,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
|||
redraw();
|
||||
}
|
||||
|
||||
if ( ev->getButton() == RightButton )
|
||||
if ( ev->getButton() == fc::RightButton )
|
||||
{
|
||||
// click on titlebar: just activate
|
||||
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
|
||||
|
@ -500,7 +500,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
|||
}
|
||||
}
|
||||
|
||||
if ( ev->getButton() == MiddleButton )
|
||||
if ( ev->getButton() == fc::MiddleButton )
|
||||
{
|
||||
// click on titlebar: lower + activate
|
||||
if ( mouse_x >= 4 && mouse_x <= width && mouse_y == 1 )
|
||||
|
@ -535,7 +535,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
|||
int titlebar_x = TitleBarClickPos.getX();
|
||||
int titlebar_y = TitleBarClickPos.getY();
|
||||
|
||||
if ( ev->getButton() == LeftButton )
|
||||
if ( ev->getButton() == fc::LeftButton )
|
||||
{
|
||||
if ( ! TitleBarClickPos.isNull()
|
||||
&& titlebar_x > xpos+xmin+2
|
||||
|
@ -553,7 +553,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::onMouseMove (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() == LeftButton )
|
||||
if ( ev->getButton() == fc::LeftButton )
|
||||
{
|
||||
if ( ! TitleBarClickPos.isNull() )
|
||||
{
|
||||
|
@ -570,7 +570,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
|||
{
|
||||
int x, y;
|
||||
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
x = xpos + xmin - 1;
|
||||
|
|
56
src/fenum.h
56
src/fenum.h
|
@ -22,6 +22,31 @@
|
|||
class fc
|
||||
{
|
||||
public:
|
||||
// event types
|
||||
enum events
|
||||
{
|
||||
None_Event, // invalid event
|
||||
KeyPress_Event, // key pressed
|
||||
KeyUp_Event, // key released
|
||||
KeyDown_Event, // key pressed
|
||||
MouseDown_Event, // mouse button pressed
|
||||
MouseUp_Event, // mouse button released
|
||||
MouseDoubleClick_Event, // mouse button double click
|
||||
MouseWheel_Event, // mouse wheel rolled
|
||||
MouseMove_Event, // mouse move
|
||||
FocusIn_Event, // focus in
|
||||
FocusOut_Event, // focus out
|
||||
WindowActive_Event, // activate window
|
||||
WindowInactive_Event, // deactivate window
|
||||
WindowRaised_Event, // raise window
|
||||
WindowLowered_Event, // lower window
|
||||
Accelerator_Event, // keyboard accelerator
|
||||
Resize_Event, // terminal resize
|
||||
Show_Event, // widget is shown
|
||||
Hide_Event, // widget is hidden
|
||||
Close_Event, // widget close
|
||||
Timer_Event // timer event occur
|
||||
};
|
||||
|
||||
// internal character encoding
|
||||
enum encoding
|
||||
|
@ -830,6 +855,37 @@ class fc
|
|||
Grey93 = 255 // #eeeeee
|
||||
};
|
||||
|
||||
// mouse/keyboard state values
|
||||
enum ButtonState
|
||||
{
|
||||
NoButton = 0x00,
|
||||
LeftButton = 0x01,
|
||||
RightButton = 0x02,
|
||||
MiddleButton = 0x04,
|
||||
MouseButtonMask = 0x07,
|
||||
ShiftButton = 0x08,
|
||||
ControlButton = 0x10,
|
||||
MetaButton = 0x20,
|
||||
KeyButtonMask = 0x38
|
||||
};
|
||||
|
||||
// wheel state values
|
||||
enum WheelState
|
||||
{
|
||||
NoWheel = 0x00,
|
||||
WheelUp = 0x01,
|
||||
WheelDown = 0x02,
|
||||
WheelMask = 0x03
|
||||
};
|
||||
|
||||
// type of focus
|
||||
enum FocusTypes
|
||||
{
|
||||
FocusNextWidget = 0x00,
|
||||
FocusPreviousWidget = 0x01,
|
||||
FocusDefiniteWidget = 0x03
|
||||
};
|
||||
|
||||
// xterm cursor style
|
||||
enum xterm_cursor_style
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ int FWheelEvent::getWheel() const
|
|||
FFocusEvent::FFocusEvent (int ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
, accpt(true)
|
||||
, focus_type(FocusDefiniteWidget)
|
||||
, focus_type(fc::FocusDefiniteWidget)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -185,21 +185,21 @@ FFocusEvent::~FFocusEvent() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
bool FFocusEvent::gotFocus() const
|
||||
{
|
||||
return (type() == FocusIn_Event);
|
||||
return (type() == fc::FocusIn_Event);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FFocusEvent::lostFocus() const
|
||||
{
|
||||
return (type() == FocusOut_Event);
|
||||
return (type() == fc::FocusOut_Event);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FocusTypes FFocusEvent::getFocusType() const
|
||||
fc::FocusTypes FFocusEvent::getFocusType() const
|
||||
{ return focus_type; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFocusEvent::setFocusType(FocusTypes ft)
|
||||
void FFocusEvent::setFocusType(fc::FocusTypes ft)
|
||||
{ focus_type = ft; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
58
src/fevent.h
58
src/fevent.h
|
@ -53,32 +53,10 @@
|
|||
#ifndef _FEVENT_H
|
||||
#define _FEVENT_H
|
||||
|
||||
#include "fenum.h"
|
||||
#include "fpoint.h"
|
||||
|
||||
|
||||
#define None_Event 0 // invalid event
|
||||
#define KeyPress_Event 1 // key pressed
|
||||
#define KeyUp_Event 2 // key released
|
||||
#define KeyDown_Event 3 // key pressed
|
||||
#define MouseDown_Event 4 // mouse button pressed
|
||||
#define MouseUp_Event 5 // mouse button released
|
||||
#define MouseDoubleClick_Event 6 // mouse button double click
|
||||
#define MouseWheel_Event 7 // mouse wheel rolled
|
||||
#define MouseMove_Event 8 // mouse move
|
||||
#define FocusIn_Event 9 // focus in
|
||||
#define FocusOut_Event 10 // focus out
|
||||
#define WindowActive_Event 11 // activate window
|
||||
#define WindowInactive_Event 12 // deactivate window
|
||||
#define WindowRaised_Event 13 // raise window
|
||||
#define WindowLowered_Event 14 // lower window
|
||||
#define Accelerator_Event 15 // keyboard accelerator
|
||||
#define Resize_Event 16 // terminal resize
|
||||
#define Show_Event 17 // widget is shown
|
||||
#define Hide_Event 18 // widget is hidden
|
||||
#define Close_Event 19 // widget close
|
||||
#define Timer_Event 20 // timer event occur
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -130,19 +108,6 @@ class FKeyEvent : public FEvent // keyboard event
|
|||
// class FMouseEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
enum ButtonState // mouse/keyboard state values
|
||||
{
|
||||
NoButton = 0x00,
|
||||
LeftButton = 0x01,
|
||||
RightButton = 0x02,
|
||||
MiddleButton = 0x04,
|
||||
MouseButtonMask = 0x07,
|
||||
ShiftButton = 0x08,
|
||||
ControlButton = 0x10,
|
||||
MetaButton = 0x20,
|
||||
KeyButtonMask = 0x38
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
|
@ -174,14 +139,6 @@ class FMouseEvent : public FEvent // mouse event
|
|||
// class FWheelEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
enum WheelState // wheel state values
|
||||
{
|
||||
NoWheel = 0x00,
|
||||
WheelUp = 0x01,
|
||||
WheelDown = 0x02,
|
||||
WheelMask = 0x03
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
|
@ -213,13 +170,6 @@ class FWheelEvent : public FEvent // wheel event
|
|||
// class FFocusEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
enum FocusTypes
|
||||
{
|
||||
FocusNextWidget = 0x00,
|
||||
FocusPreviousWidget = 0x01,
|
||||
FocusDefiniteWidget = 0x03
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
|
@ -231,14 +181,14 @@ class FFocusEvent : public FEvent // focus event
|
|||
|
||||
bool gotFocus() const;
|
||||
bool lostFocus() const;
|
||||
FocusTypes getFocusType() const;
|
||||
void setFocusType(FocusTypes);
|
||||
fc::FocusTypes getFocusType() const;
|
||||
void setFocusType(fc::FocusTypes);
|
||||
bool isAccepted() const;
|
||||
void accept();
|
||||
void ignore();
|
||||
protected:
|
||||
bool accpt;
|
||||
FocusTypes focus_type;
|
||||
fc::FocusTypes focus_type;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -17,10 +17,10 @@ FLabel::FLabel(FWidget* parent)
|
|||
, multiline_text()
|
||||
, multiline(false)
|
||||
, text()
|
||||
, emphasis(0)
|
||||
, alignment(fc::alignLeft)
|
||||
, emphasis_color(wc.label_emphasis_fg)
|
||||
, ellipsis_color(wc.label_ellipsis_fg)
|
||||
, emphasis(false)
|
||||
, reverse_mode(false)
|
||||
, accel_widget(0)
|
||||
{
|
||||
|
@ -33,10 +33,10 @@ FLabel::FLabel (const FString& txt, FWidget* parent)
|
|||
, multiline_text()
|
||||
, multiline(false)
|
||||
, text(txt)
|
||||
, emphasis(0)
|
||||
, alignment(fc::alignLeft)
|
||||
, emphasis_color(wc.label_emphasis_fg)
|
||||
, ellipsis_color(wc.label_ellipsis_fg)
|
||||
, emphasis(false)
|
||||
, reverse_mode(false)
|
||||
, accel_widget(0)
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ void FLabel::hide()
|
|||
//----------------------------------------------------------------------
|
||||
void FLabel::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( ! isEnabled() || ! accel_widget )
|
||||
|
@ -344,7 +344,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
if ( ! accel_widget->hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
accel_widget->setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -368,7 +368,7 @@ void FLabel::onAccel (FAccelEvent* ev)
|
|||
if ( ! accel_widget->hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
accel_widget->setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -418,10 +418,8 @@ void FLabel::setAlignment (uInt align)
|
|||
//----------------------------------------------------------------------
|
||||
bool FLabel::setEmphasis (bool on)
|
||||
{
|
||||
if ( on )
|
||||
emphasis |= EMPHASIS;
|
||||
else
|
||||
emphasis &= ~EMPHASIS;
|
||||
if ( emphasis != on )
|
||||
emphasis = on;
|
||||
return on;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
#include "fwidget.h"
|
||||
|
||||
|
||||
#define NO_EMPHASIS 0x00000000
|
||||
#define EMPHASIS 0x00000001
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FLabel
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -43,10 +39,10 @@ class FLabel : public FWidget
|
|||
std::vector<FString> multiline_text;
|
||||
bool multiline;
|
||||
FString text;
|
||||
int emphasis;
|
||||
uInt alignment;
|
||||
short emphasis_color;
|
||||
short ellipsis_color;
|
||||
bool emphasis;
|
||||
bool reverse_mode;
|
||||
FWidget* accel_widget;
|
||||
|
||||
|
@ -116,7 +112,7 @@ inline bool FLabel::unsetEmphasis()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FLabel::hasEmphasis()
|
||||
{ return ((emphasis & EMPHASIS) != 0); }
|
||||
{ return emphasis; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FLabel::setReverseMode()
|
||||
|
|
|
@ -541,13 +541,13 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -587,7 +587,7 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
int len, mouse_x, mouse_y;
|
||||
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
len = int(text.getLength());
|
||||
|
@ -698,7 +698,7 @@ void FLineEdit::onAccel (FAccelEvent* ev)
|
|||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
|
|
@ -906,18 +906,18 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
int yoffset_before, mouse_x, mouse_y;
|
||||
|
||||
if ( ev->getButton() != LeftButton
|
||||
&& ev->getButton() != RightButton )
|
||||
if ( ev->getButton() != fc::LeftButton
|
||||
&& ev->getButton() != fc::RightButton )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( ev->getButton() == RightButton && ! isMultiSelection() )
|
||||
if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
|
||||
return;
|
||||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -936,7 +936,7 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
|||
if ( current > int(count()) )
|
||||
current = int(count());
|
||||
inc_search.clear();
|
||||
if ( ev->getButton() == RightButton )
|
||||
if ( ev->getButton() == fc::RightButton )
|
||||
{
|
||||
if ( isMultiSelection() )
|
||||
{
|
||||
|
@ -976,7 +976,7 @@ void FListBox::onMouseUp (FMouseEvent* ev)
|
|||
scrollTimer = false;
|
||||
}
|
||||
|
||||
if ( ev->getButton() == LeftButton )
|
||||
if ( ev->getButton() == fc::LeftButton )
|
||||
{
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
@ -995,12 +995,12 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
int current_before, yoffset_before, mouse_x, mouse_y;
|
||||
|
||||
if ( ev->getButton() != LeftButton
|
||||
&& ev->getButton() != RightButton )
|
||||
if ( ev->getButton() != fc::LeftButton
|
||||
&& ev->getButton() != fc::RightButton )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( ev->getButton() == RightButton && ! isMultiSelection() )
|
||||
if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
|
||||
return;
|
||||
|
||||
current_before = current;
|
||||
|
@ -1017,7 +1017,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
inc_search.clear();
|
||||
|
||||
// handle multiple selections
|
||||
if ( ev->getButton() == RightButton
|
||||
if ( ev->getButton() == fc::RightButton
|
||||
&& isMultiSelection()
|
||||
&& current_before != current )
|
||||
{
|
||||
|
@ -1068,7 +1068,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
scrollTimer = true;
|
||||
addTimer(scrollRepeat);
|
||||
if ( ev->getButton() == RightButton )
|
||||
if ( ev->getButton() == fc::RightButton )
|
||||
dragScroll = FListBox::scrollUpSelect;
|
||||
else
|
||||
dragScroll = FListBox::scrollUp;
|
||||
|
@ -1088,7 +1088,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
scrollTimer = true;
|
||||
addTimer(scrollRepeat);
|
||||
if ( ev->getButton() == RightButton )
|
||||
if ( ev->getButton() == fc::RightButton )
|
||||
dragScroll = FListBox::scrollDownSelect;
|
||||
else
|
||||
dragScroll = FListBox::scrollDown;
|
||||
|
@ -1114,7 +1114,7 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
|||
{
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
mouse_x = ev->getX();
|
||||
|
@ -1245,7 +1245,7 @@ void FListBox::onWheel (FWheelEvent* ev)
|
|||
|
||||
switch ( wheel )
|
||||
{
|
||||
case WheelUp:
|
||||
case fc::WheelUp:
|
||||
if ( yoffset == 0 )
|
||||
break;
|
||||
yoffset -= 4;
|
||||
|
@ -1261,7 +1261,7 @@ void FListBox::onWheel (FWheelEvent* ev)
|
|||
inc_search.clear();
|
||||
break;
|
||||
|
||||
case WheelDown:
|
||||
case fc::WheelDown:
|
||||
if ( yoffset == yoffset_end )
|
||||
break;
|
||||
yoffset += 4;
|
||||
|
@ -1375,14 +1375,14 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
|||
|
||||
case FScrollbar::scrollWheelUp:
|
||||
{
|
||||
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelUp);
|
||||
FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelUp);
|
||||
onWheel(&wheel_ev);
|
||||
}
|
||||
break;
|
||||
|
||||
case FScrollbar::scrollWheelDown:
|
||||
{
|
||||
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelDown);
|
||||
FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelDown);
|
||||
onWheel(&wheel_ev);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -961,7 +961,7 @@ void FMenu::onKeyPress (FKeyEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
{
|
||||
if ( open_sub_menu )
|
||||
{
|
||||
|
@ -1040,7 +1040,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
unselectItem();
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
(*iter)->setSelected();
|
||||
setSelectedItem(*iter);
|
||||
|
@ -1081,7 +1081,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( mouse_down )
|
||||
|
@ -1155,7 +1155,7 @@ void FMenu::onMouseUp (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::onMouseMove (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( ! isActiveWindow() )
|
||||
|
@ -1223,7 +1223,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
// Mouse pointer over item
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
(*iter)->setSelected();
|
||||
setSelectedItem(*iter);
|
||||
|
@ -1267,7 +1267,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
const FPoint& g = ev->getGlobalPos();
|
||||
const FPoint& p = open_sub_menu->globalToLocalPos(g);
|
||||
int b = ev->getButton();
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||
open_sub_menu->mouse_down = true;
|
||||
setClickedWidget(open_sub_menu);
|
||||
open_sub_menu->onMouseMove(_ev);
|
||||
|
@ -1280,7 +1280,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
const FPoint& g = ev->getGlobalPos();
|
||||
const FPoint& p = smenu->globalToLocalPos(g);
|
||||
int b = ev->getButton();
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||
smenu->mouse_down = true;
|
||||
setClickedWidget(smenu);
|
||||
smenu->onMouseMove(_ev);
|
||||
|
@ -1294,7 +1294,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
const FPoint& g = ev->getGlobalPos();
|
||||
const FPoint& p = menubar->globalToLocalPos(g);
|
||||
int b = ev->getButton();
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||
setClickedWidget(menubar);
|
||||
FMenuBar* mbar = reinterpret_cast<FMenuBar*>(menubar);
|
||||
mbar->mouse_down = true;
|
||||
|
|
|
@ -542,7 +542,7 @@ void FMenuBar::onKeyPress (FKeyEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
{
|
||||
mouse_down = false;
|
||||
|
||||
|
@ -589,7 +589,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
|||
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
(*iter)->setSelected();
|
||||
(*iter)->setFocus();
|
||||
|
@ -635,7 +635,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( mouse_down )
|
||||
|
@ -718,7 +718,7 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::onMouseMove (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( ! isActiveWindow() )
|
||||
|
@ -754,7 +754,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
|||
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
(*iter)->setSelected();
|
||||
(*iter)->setFocus();
|
||||
|
@ -803,7 +803,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
|||
const FPoint& g = ev->getGlobalPos();
|
||||
const FPoint& p = menu->globalToLocalPos(g);
|
||||
int b = ev->getButton();
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||
menu->mouse_down = true;
|
||||
setClickedWidget(menu);
|
||||
menu->onMouseMove(_ev);
|
||||
|
|
|
@ -383,7 +383,7 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
|
|||
if ( smenu )
|
||||
{
|
||||
const FPoint& p2 = smenu->globalToLocalPos(g);
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseDown_Event, p2, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, g, b);
|
||||
smenu->onMouseDown(_ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
|
|||
if ( mbar )
|
||||
{
|
||||
const FPoint& p2 = mbar->globalToLocalPos(g);
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseDown_Event, p2, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p2, g, b);
|
||||
mbar->onMouseDown(_ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
|
|||
if ( smenu )
|
||||
{
|
||||
const FPoint& p2 = smenu->globalToLocalPos(g);
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseUp_Event, p2, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, g, b);
|
||||
smenu->onMouseUp(_ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
|
|||
if ( mbar )
|
||||
{
|
||||
const FPoint& p2 = mbar->globalToLocalPos(g);
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseUp_Event, p2, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p2, g, b);
|
||||
mbar->onMouseUp(_ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
|
|||
if ( smenu )
|
||||
{
|
||||
const FPoint& p2 = smenu->globalToLocalPos(g);
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p2, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, g, b);
|
||||
smenu->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
|
|||
if ( mbar )
|
||||
{
|
||||
const FPoint& p2 = mbar->globalToLocalPos(g);
|
||||
FMouseEvent* _ev = new FMouseEvent (MouseMove_Event, p2, g, b);
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p2, g, b);
|
||||
mbar->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
|
|||
openMenu();
|
||||
|
||||
focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
menu->unselectItem();
|
||||
menu->selectFirstItem();
|
||||
|
|
|
@ -87,7 +87,7 @@ void FObject::delChild (FObject* obj)
|
|||
//----------------------------------------------------------------------
|
||||
bool FObject::event (FEvent* ev)
|
||||
{
|
||||
if ( ev->type() == Timer_Event )
|
||||
if ( ev->type() == fc::Timer_Event )
|
||||
{
|
||||
onTimer ( static_cast<FTimerEvent*>(ev) );
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ FOptiAttr::~FOptiAttr() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FOptiAttr::hasColor (char_data*& attr)
|
||||
{
|
||||
if ( attr->fg_color < 0 && attr->bg_color < 0 )
|
||||
if ( attr && attr->fg_color < 0 && attr->bg_color < 0 )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -1312,18 +1312,20 @@ char* FOptiAttr::change_attribute (char_data*& term, char_data*& next)
|
|||
}
|
||||
else if ( F_set_attributes.cap )
|
||||
{
|
||||
unsetTermPCcharset(term);
|
||||
setTermAttributes ( term
|
||||
, next->standout
|
||||
, next->underline
|
||||
, next->reverse
|
||||
, next->blink
|
||||
, next->dim
|
||||
, next->bold
|
||||
, next->invisible
|
||||
, next->protect
|
||||
, next->alt_charset );
|
||||
if ( off.pc_charset )
|
||||
unsetTermPCcharset(term);
|
||||
|
||||
if ( switchOn() || switchOff() )
|
||||
setTermAttributes ( term
|
||||
, next->standout
|
||||
, next->underline
|
||||
, next->reverse
|
||||
, next->blink
|
||||
, next->dim
|
||||
, next->bold
|
||||
, next->invisible
|
||||
, next->protect
|
||||
, next->alt_charset );
|
||||
if ( next->italic )
|
||||
setTermItalic(term);
|
||||
if ( next->crossed_out )
|
||||
|
|
|
@ -209,8 +209,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
if ( ev->getButton() != LeftButton
|
||||
&& ev->getButton() != MiddleButton )
|
||||
if ( ev->getButton() != fc::LeftButton
|
||||
&& ev->getButton() != fc::MiddleButton )
|
||||
return;
|
||||
|
||||
if ( min == max )
|
||||
|
@ -219,7 +219,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
|||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
if ( ev->getButton() == MiddleButton )
|
||||
if ( ev->getButton() == fc::MiddleButton )
|
||||
{
|
||||
processMiddleButton (mouse_x, mouse_y);
|
||||
return;
|
||||
|
@ -276,8 +276,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FScrollbar::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton
|
||||
&& ev->getButton() != MiddleButton )
|
||||
if ( ev->getButton() != fc::LeftButton
|
||||
&& ev->getButton() != fc::MiddleButton )
|
||||
return;
|
||||
|
||||
SliderClickPos = -1;
|
||||
|
@ -294,14 +294,14 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
int mouse_x, mouse_y, newScrollType;
|
||||
|
||||
if ( ev->getButton() != LeftButton
|
||||
&& ev->getButton() != MiddleButton )
|
||||
if ( ev->getButton() != fc::LeftButton
|
||||
&& ev->getButton() != fc::MiddleButton )
|
||||
return;
|
||||
|
||||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
if ( ev->getButton() == MiddleButton )
|
||||
if ( ev->getButton() == fc::MiddleButton )
|
||||
{
|
||||
processMiddleButton (mouse_x, mouse_y);
|
||||
return;
|
||||
|
@ -365,9 +365,9 @@ void FScrollbar::onWheel (FWheelEvent* ev)
|
|||
scrollType = FScrollbar::noScroll;
|
||||
}
|
||||
|
||||
if ( wheel == WheelUp )
|
||||
if ( wheel == fc::WheelUp )
|
||||
scrollType = FScrollbar::scrollWheelUp;
|
||||
else if ( wheel == WheelDown )
|
||||
else if ( wheel == fc::WheelDown )
|
||||
scrollType = FScrollbar::scrollWheelDown;
|
||||
|
||||
processScroll();
|
||||
|
|
|
@ -356,7 +356,7 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
if ( hasActivatedKey() )
|
||||
return;
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
{
|
||||
mouse_down = false;
|
||||
if ( ! keylist.empty() )
|
||||
|
@ -416,7 +416,7 @@ void FStatusBar::onMouseUp (FMouseEvent* ev)
|
|||
{
|
||||
if ( hasActivatedKey() )
|
||||
return;
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( mouse_down )
|
||||
|
@ -463,7 +463,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
|
|||
{
|
||||
if ( hasActivatedKey() )
|
||||
return;
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( mouse_down && ! keylist.empty() )
|
||||
|
|
|
@ -181,7 +181,7 @@ void FSwitch::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
FToggleButton::onMouseDown(ev);
|
||||
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
button_pressed = true;
|
||||
|
@ -193,7 +193,7 @@ void FSwitch::onMouseUp (FMouseEvent* ev)
|
|||
{
|
||||
FToggleButton::onMouseUp(ev);
|
||||
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
button_pressed = false;
|
||||
|
|
105
src/fterm.cpp
105
src/fterm.cpp
|
@ -999,6 +999,10 @@ void FTerm::init_pc_charset()
|
|||
{
|
||||
bool reinit = false;
|
||||
|
||||
// rxvt does not support pc charset
|
||||
if ( rxvt_terminal || urxvt_terminal )
|
||||
return;
|
||||
|
||||
// fallback if "S2" is not found
|
||||
if ( ! tcap[t_enter_pc_charset_mode].string )
|
||||
{
|
||||
|
@ -1096,9 +1100,13 @@ void FTerm::init_termcaps()
|
|||
|
||||
tabstop = uInt(tgetnum(const_cast<char*>("it")));
|
||||
attr_without_color = uInt(tgetnum(const_cast<char*>("NC")));
|
||||
|
||||
// gnome-terminal has NC=16 however, it can use the dim attribute
|
||||
if ( gnome_terminal )
|
||||
attr_without_color = 0;
|
||||
// PuTTY has NC=22 however, it can show underline and reverse
|
||||
if ( putty_terminal )
|
||||
attr_without_color = 16;
|
||||
|
||||
// read termcap output strings
|
||||
for (int i=0; tcap[i].tname[0] != 0; i++)
|
||||
|
@ -1481,6 +1489,7 @@ void FTerm::init()
|
|||
tmux_terminal = \
|
||||
background_color_erase = false;
|
||||
|
||||
// term_attribute stores the current state of the terminal
|
||||
term_attribute.code = '\0';
|
||||
term_attribute.fg_color = fc::Default;
|
||||
term_attribute.bg_color = fc::Default;
|
||||
|
@ -1498,6 +1507,7 @@ void FTerm::init()
|
|||
term_attribute.alt_charset = \
|
||||
term_attribute.pc_charset = false;
|
||||
|
||||
// next_attribute contains the state of the next printed character
|
||||
next_attribute.code = '\0';
|
||||
next_attribute.fg_color = fc::Default;
|
||||
next_attribute.bg_color = fc::Default;
|
||||
|
@ -1695,9 +1705,9 @@ void FTerm::init()
|
|||
setXTermMouseForeground ("rgb:0000/0000/0000");
|
||||
if ( ! gnome_terminal )
|
||||
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
||||
if ( ! mintty_terminal )
|
||||
if ( ! mintty_terminal && ! rxvt_terminal )
|
||||
{
|
||||
// mintty can't reset these settings
|
||||
// mintty and rxvt can't reset these settings
|
||||
setXTermBackground("rgb:8080/a4a4/ecec");
|
||||
setXTermForeground("rgb:0000/0000/0000");
|
||||
setXTermHighlightBackground("rgb:8686/8686/8686");
|
||||
|
@ -1764,6 +1774,8 @@ void FTerm::init()
|
|||
setPalette (fc::Yellow, 0xff, 0xff, 0x54);
|
||||
setPalette (fc::White, 0xff, 0xff, 0xff);
|
||||
}
|
||||
|
||||
// set 200 Hz beep (100 ms)
|
||||
setBeep(200, 100);
|
||||
|
||||
signal(SIGTERM, FTerm::signal_handler); // Termination signal
|
||||
|
@ -1787,7 +1799,7 @@ void FTerm::finish()
|
|||
signal(SIGQUIT, SIG_DFL); // Quit from keyboard (Ctrl-\)
|
||||
signal(SIGTERM, SIG_DFL); // Termination signal
|
||||
|
||||
if ( xterm && ! rxvt_terminal )
|
||||
if ( xterm_title && xterm && ! rxvt_terminal )
|
||||
setXTermTitle (*xterm_title);
|
||||
|
||||
showCursor();
|
||||
|
@ -1924,9 +1936,15 @@ void FTerm::finish()
|
|||
if ( vterm != 0 )
|
||||
{
|
||||
if ( vterm->changes != 0 )
|
||||
{
|
||||
delete[] vterm->changes;
|
||||
vterm->changes = 0;
|
||||
}
|
||||
if ( vterm->text != 0 )
|
||||
{
|
||||
delete[] vterm->text;
|
||||
vterm->text = 0;
|
||||
}
|
||||
delete vterm;
|
||||
}
|
||||
}
|
||||
|
@ -1998,7 +2016,7 @@ void FTerm::createArea (term_area*& area)
|
|||
void FTerm::resizeArea (term_area* area)
|
||||
{
|
||||
int area_size, width, height, rsw, bsh;
|
||||
char_data default_char;
|
||||
FOptiAttr::char_data default_char;
|
||||
line_changes unchanged;
|
||||
|
||||
if ( ! area )
|
||||
|
@ -2028,13 +2046,13 @@ void FTerm::resizeArea (term_area* area)
|
|||
if ( area->text != 0 )
|
||||
delete[] area->text;
|
||||
area->changes = new line_changes[height + bsh];
|
||||
area->text = new char_data[area_size];
|
||||
area->text = new FOptiAttr::char_data[area_size];
|
||||
}
|
||||
else if ( area->width + area->right_shadow != width + rsw )
|
||||
{
|
||||
if ( area->text != 0 )
|
||||
delete[] area->text;
|
||||
area->text = new char_data[area_size];
|
||||
area->text = new FOptiAttr::char_data[area_size];
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -2081,8 +2099,8 @@ void FTerm::restoreVTerm (const FRect& box)
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::restoreVTerm (int x, int y, int w, int h)
|
||||
{
|
||||
char_data* tc; // terminal character
|
||||
char_data* sc; // shown character
|
||||
FOptiAttr::char_data* tc; // terminal character
|
||||
FOptiAttr::char_data* sc; // shown character
|
||||
FWidget* widget;
|
||||
|
||||
x--;
|
||||
|
@ -2160,7 +2178,7 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
|
|||
sc = &vstatusbar->text[(y+ty-bar_y) * vstatusbar->width + (x+tx-bar_x)];
|
||||
}
|
||||
|
||||
memcpy (tc, sc, sizeof(char_data));
|
||||
memcpy (tc, sc, sizeof(FOptiAttr::char_data));
|
||||
|
||||
if ( short(vterm->changes[y+ty].xmin) > x )
|
||||
vterm->changes[y+ty].xmin = uInt(x);
|
||||
|
@ -2242,8 +2260,8 @@ bool FTerm::isCovered(int x, int y, FTerm::term_area* area) const
|
|||
void FTerm::updateVTerm (FTerm::term_area* area)
|
||||
{
|
||||
int ax, ay, aw, ah, rsh, bsh, y_end, ol;
|
||||
char_data* tc; // terminal character
|
||||
char_data* ac; // area character
|
||||
FOptiAttr::char_data* tc; // terminal character
|
||||
FOptiAttr::char_data* ac; // area character
|
||||
|
||||
if ( ! vterm_updates )
|
||||
{
|
||||
|
@ -2285,7 +2303,7 @@ void FTerm::updateVTerm (FTerm::term_area* area)
|
|||
|
||||
if ( ax == 0 )
|
||||
line_xmin = ol;
|
||||
else if ( aw + rsh + ax - ol >= vterm->width )
|
||||
if ( aw + rsh + ax - ol >= vterm->width )
|
||||
line_xmax = vterm->width + ol - ax - 1;
|
||||
|
||||
if ( ax + line_xmin >= vterm->width )
|
||||
|
@ -2305,7 +2323,7 @@ void FTerm::updateVTerm (FTerm::term_area* area)
|
|||
tc = &vterm->text[gy * vterm->width + gx - ol];
|
||||
|
||||
if ( ! isCovered(gx-ol, gy, area) )
|
||||
memcpy (tc, ac, sizeof(char_data));
|
||||
memcpy (tc, ac, sizeof(FOptiAttr::char_data));
|
||||
else
|
||||
line_xmin++; // don't update covered character
|
||||
}
|
||||
|
@ -2334,8 +2352,8 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
|
|||
{
|
||||
int y_end;
|
||||
int length;
|
||||
char_data* tc; // terminal character
|
||||
char_data* ac; // area character
|
||||
FOptiAttr::char_data* tc; // terminal character
|
||||
FOptiAttr::char_data* ac; // area character
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
@ -2356,7 +2374,7 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
|
|||
{
|
||||
ac = &area->text[y * area->width];
|
||||
tc = &vterm->text[(ay+y) * vterm->width + ax];
|
||||
memcpy (ac, tc, sizeof(char_data) * unsigned(length));
|
||||
memcpy (ac, tc, sizeof(FOptiAttr::char_data) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[y].xmin) > 0 )
|
||||
area->changes[y].xmin = 0;
|
||||
|
@ -2369,8 +2387,8 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
|
|||
void FTerm::getArea (int x, int y, int w, int h, FTerm::term_area* area)
|
||||
{
|
||||
int y_end, length, dx, dy;
|
||||
char_data* tc; // terminal character
|
||||
char_data* ac; // area character
|
||||
FOptiAttr::char_data* tc; // terminal character
|
||||
FOptiAttr::char_data* ac; // area character
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
@ -2399,7 +2417,7 @@ void FTerm::getArea (int x, int y, int w, int h, FTerm::term_area* area)
|
|||
tc = &vterm->text[(y+_y-1) * vterm->width + x-1];
|
||||
ac = &area->text[(dy+_y) * line_len + dx];
|
||||
|
||||
memcpy (ac, tc, sizeof(char_data) * unsigned(length));
|
||||
memcpy (ac, tc, sizeof(FOptiAttr::char_data) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[dy+_y].xmin) > dx )
|
||||
area->changes[dy+_y].xmin = uInt(dx);
|
||||
|
@ -2422,8 +2440,8 @@ void FTerm::putArea (const FPoint& pos, FTerm::term_area* area)
|
|||
void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
|
||||
{
|
||||
int aw, ah, rsh, bsh, y_end, length, ol, sbar;
|
||||
char_data* tc; // terminal character
|
||||
char_data* ac; // area character
|
||||
FOptiAttr::char_data* tc; // terminal character
|
||||
FOptiAttr::char_data* ac; // area character
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
@ -2468,7 +2486,7 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
|
|||
tc = &vterm->text[(ay+y) * vterm->width + ax];
|
||||
ac = &area->text[y * line_len + ol];
|
||||
|
||||
memcpy (tc, ac, sizeof(char_data) * unsigned(length));
|
||||
memcpy (tc, ac, sizeof(FOptiAttr::char_data) * unsigned(length));
|
||||
|
||||
if ( ax < short(vterm->changes[ay+y].xmin) )
|
||||
vterm->changes[ay+y].xmin = uInt(ax);
|
||||
|
@ -2478,10 +2496,10 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FTerm::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
|
||||
FOptiAttr::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
|
||||
{
|
||||
int xx,yy;
|
||||
char_data* cc; // covered character
|
||||
FOptiAttr::char_data* cc; // covered character
|
||||
FWidget* w;
|
||||
|
||||
x--;
|
||||
|
@ -2659,7 +2677,7 @@ bool FTerm::setOldFont()
|
|||
|
||||
if ( xterm || urxvt_terminal || osc_support )
|
||||
{
|
||||
if ( xterm_font->getLength() > 2 )
|
||||
if ( xterm_font && xterm_font->getLength() > 2 )
|
||||
// restore saved xterm font
|
||||
putstringf ("\033]50;%s\07", xterm_font->c_str() );
|
||||
else
|
||||
|
@ -2772,7 +2790,7 @@ void FTerm::createVTerm()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::resizeVTerm()
|
||||
{
|
||||
char_data default_char;
|
||||
FOptiAttr::char_data default_char;
|
||||
line_changes unchanged;
|
||||
int term_width, term_height, vterm_size;
|
||||
|
||||
|
@ -2783,18 +2801,27 @@ void FTerm::resizeVTerm()
|
|||
if ( vterm->height != term_height )
|
||||
{
|
||||
if ( vterm->changes != 0 )
|
||||
{
|
||||
delete[] vterm->changes;
|
||||
vterm->changes = 0;
|
||||
}
|
||||
if ( vterm->text != 0 )
|
||||
{
|
||||
delete[] vterm->text;
|
||||
vterm->text = 0;
|
||||
}
|
||||
|
||||
vterm->changes = new line_changes[term_height];
|
||||
vterm->text = new char_data[vterm_size];
|
||||
vterm->text = new FOptiAttr::char_data[vterm_size];
|
||||
}
|
||||
else if ( vterm->width != term_width )
|
||||
{
|
||||
if ( vterm->text != 0 )
|
||||
{
|
||||
delete[] vterm->text;
|
||||
vterm->text = new char_data[vterm_size];
|
||||
vterm->text = 0;
|
||||
}
|
||||
vterm->text = new FOptiAttr::char_data[vterm_size];
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -2877,7 +2904,7 @@ void FTerm::updateTerminal()
|
|||
x <= change_xmax;
|
||||
x++ )
|
||||
{
|
||||
char_data* print_char;
|
||||
FOptiAttr::char_data* print_char;
|
||||
print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
|
||||
if ( x_term_pos == term_width
|
||||
|
@ -3827,7 +3854,7 @@ int FTerm::print (FTerm::term_area* area, FString& s)
|
|||
short x = short(cursor->getX());
|
||||
short y = short(cursor->getY());
|
||||
|
||||
char_data nc; // next character
|
||||
FOptiAttr::char_data nc; // next character
|
||||
nc.code = *p;
|
||||
nc.fg_color = next_attribute.fg_color;
|
||||
nc.bg_color = next_attribute.bg_color;
|
||||
|
@ -3853,7 +3880,7 @@ int FTerm::print (FTerm::term_area* area, FString& s)
|
|||
&& ax < area->width + area->right_shadow
|
||||
&& ay < area->height + area->bottom_shadow )
|
||||
{
|
||||
char_data* ac; // area character
|
||||
FOptiAttr::char_data* ac; // area character
|
||||
int line_len = area->width + area->right_shadow;
|
||||
ac = &area->text[ay * line_len + ax];
|
||||
|
||||
|
@ -3913,7 +3940,7 @@ int FTerm::print (register int c)
|
|||
//----------------------------------------------------------------------
|
||||
int FTerm::print (FTerm::term_area* area, register int c)
|
||||
{
|
||||
char_data nc; // next character
|
||||
FOptiAttr::char_data nc; // next character
|
||||
FWidget* area_widget;
|
||||
int rsh, bsh, ax, ay;
|
||||
short x, y;
|
||||
|
@ -3952,7 +3979,7 @@ int FTerm::print (FTerm::term_area* area, register int c)
|
|||
&& ax < area->width + area->right_shadow
|
||||
&& ay < area->height + area->bottom_shadow )
|
||||
{
|
||||
char_data* ac; // area character
|
||||
FOptiAttr::char_data* ac; // area character
|
||||
int line_len = area->width + area->right_shadow;
|
||||
ac = &area->text[ay * line_len + ax];
|
||||
|
||||
|
@ -3988,7 +4015,7 @@ int FTerm::print (FTerm::term_area* area, register int c)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::newFontChanges (char_data*& next_char)
|
||||
inline void FTerm::newFontChanges (FOptiAttr::char_data*& next_char)
|
||||
{
|
||||
// NewFont special cases
|
||||
if ( isNewFont() )
|
||||
|
@ -4029,7 +4056,7 @@ inline void FTerm::newFontChanges (char_data*& next_char)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::charsetChanges (char_data*& next_char)
|
||||
inline void FTerm::charsetChanges (FOptiAttr::char_data*& next_char)
|
||||
{
|
||||
if ( Encoding == fc::UTF8 )
|
||||
return;
|
||||
|
@ -4059,7 +4086,7 @@ inline void FTerm::charsetChanges (char_data*& next_char)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::appendCharacter (char_data*& next_char)
|
||||
inline void FTerm::appendCharacter (FOptiAttr::char_data*& next_char)
|
||||
{
|
||||
newFontChanges (next_char);
|
||||
charsetChanges (next_char);
|
||||
|
@ -4069,10 +4096,10 @@ inline void FTerm::appendCharacter (char_data*& next_char)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::appendAttributes (char_data*& next_attr)
|
||||
inline void FTerm::appendAttributes (FOptiAttr::char_data*& next_attr)
|
||||
{
|
||||
char* attr_str;
|
||||
char_data* term_attr = &term_attribute;
|
||||
FOptiAttr::char_data* term_attr = &term_attribute;
|
||||
|
||||
// generate attribute string for the next character
|
||||
attr_str = opti_attr->change_attribute (term_attr, next_attr);
|
||||
|
@ -4082,7 +4109,7 @@ inline void FTerm::appendAttributes (char_data*& next_attr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FTerm::appendLowerRight (char_data*& screen_char)
|
||||
int FTerm::appendLowerRight (FOptiAttr::char_data*& screen_char)
|
||||
{
|
||||
char* SA = tcap[t_enter_am_mode].string;
|
||||
char* RA = tcap[t_exit_am_mode].string;
|
||||
|
|
20
src/fterm.h
20
src/fterm.h
|
@ -168,8 +168,6 @@ class FTerm
|
|||
static const FString* AnswerBack;
|
||||
static const FString* Sec_DA;
|
||||
|
||||
typedef FOptiAttr::char_data char_data;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uChar red;
|
||||
|
@ -204,7 +202,7 @@ class FTerm
|
|||
int bottom_shadow;
|
||||
FWidget* widget;
|
||||
line_changes* changes;
|
||||
char_data* text;
|
||||
FOptiAttr::char_data* text;
|
||||
bool visible;
|
||||
} term_area;
|
||||
|
||||
|
@ -265,8 +263,8 @@ class FTerm
|
|||
void getArea (int, int, int, int, FTerm::term_area*);
|
||||
void putArea (const FPoint&, FTerm::term_area*);
|
||||
void putArea (int, int, FTerm::term_area*);
|
||||
char_data getCoveredCharacter (const FPoint&, FTerm*);
|
||||
char_data getCoveredCharacter (int, int, FTerm*);
|
||||
FOptiAttr::char_data getCoveredCharacter (const FPoint&, FTerm*);
|
||||
FOptiAttr::char_data getCoveredCharacter (int, int, FTerm*);
|
||||
|
||||
public:
|
||||
FTerm (); // constructor
|
||||
|
@ -388,11 +386,11 @@ class FTerm
|
|||
int print (FTerm::term_area*, FString&);
|
||||
int print (int);
|
||||
int print (FTerm::term_area*, int);
|
||||
static void newFontChanges (char_data*&);
|
||||
static void charsetChanges (char_data*&);
|
||||
static void appendCharacter (char_data*&);
|
||||
static void appendAttributes (char_data*&);
|
||||
static int appendLowerRight (char_data*&);
|
||||
static void newFontChanges (FOptiAttr::char_data*&);
|
||||
static void charsetChanges (FOptiAttr::char_data*&);
|
||||
static void appendCharacter (FOptiAttr::char_data*&);
|
||||
static void appendAttributes (FOptiAttr::char_data*&);
|
||||
static int appendLowerRight (FOptiAttr::char_data*&);
|
||||
static void appendOutputBuffer (std::string&);
|
||||
static void appendOutputBuffer (const char*);
|
||||
static int appendOutputBuffer (int);
|
||||
|
@ -433,7 +431,7 @@ inline void FTerm::getArea (const FRect& box, FTerm::term_area* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FTerm::char_data FTerm::getCoveredCharacter (const FPoint& pos, FTerm* obj)
|
||||
inline FOptiAttr::char_data FTerm::getCoveredCharacter (const FPoint& pos, FTerm* obj)
|
||||
{ return getCoveredCharacter (pos.getX(), pos.getY(), obj); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -298,13 +298,13 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -322,7 +322,7 @@ void FTextView::onWheel (FWheelEvent* ev)
|
|||
|
||||
switch ( wheel )
|
||||
{
|
||||
case WheelUp:
|
||||
case fc::WheelUp:
|
||||
if ( yoffset == 0 )
|
||||
break;
|
||||
yoffset -= 4;
|
||||
|
@ -330,7 +330,7 @@ void FTextView::onWheel (FWheelEvent* ev)
|
|||
yoffset=0;
|
||||
break;
|
||||
|
||||
case WheelDown:
|
||||
case fc::WheelDown:
|
||||
{
|
||||
int yoffset_end = last_line - height - nf_offset + 2;
|
||||
if ( yoffset_end < 0 )
|
||||
|
@ -419,14 +419,14 @@ void FTextView::cb_VBarChange (FWidget*, void*)
|
|||
|
||||
case FScrollbar::scrollWheelUp:
|
||||
{
|
||||
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelUp);
|
||||
FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelUp);
|
||||
onWheel(&wheel_ev);
|
||||
break;
|
||||
}
|
||||
|
||||
case FScrollbar::scrollWheelDown:
|
||||
{
|
||||
FWheelEvent wheel_ev (MouseWheel_Event, FPoint(2,2), WheelDown);
|
||||
FWheelEvent wheel_ev (fc::MouseWheel_Event, FPoint(2,2), fc::WheelDown);
|
||||
onWheel(&wheel_ev);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -464,13 +464,13 @@ bool FToggleButton::setFocus (bool on)
|
|||
//----------------------------------------------------------------------
|
||||
void FToggleButton::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -488,7 +488,7 @@ void FToggleButton::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FToggleButton::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != LeftButton )
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
|
||||
|
@ -519,7 +519,7 @@ void FToggleButton::onAccel (FAccelEvent* ev)
|
|||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
if ( focused_widget )
|
||||
|
@ -585,21 +585,21 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
|
|||
{
|
||||
focus_inside_group = true;
|
||||
out_ev->ignore();
|
||||
if ( out_ev->getFocusType() == FocusNextWidget )
|
||||
if ( out_ev->getFocusType() == fc::FocusNextWidget )
|
||||
group()->focusNextChild();
|
||||
if ( out_ev->getFocusType() == FocusPreviousWidget )
|
||||
if ( out_ev->getFocusType() == fc::FocusPreviousWidget )
|
||||
group()->focusPrevChild();
|
||||
redraw();
|
||||
}
|
||||
else if ( this == group()->getLastButton()
|
||||
&& out_ev->getFocusType() == FocusNextWidget )
|
||||
&& out_ev->getFocusType() == fc::FocusNextWidget )
|
||||
{
|
||||
out_ev->ignore();
|
||||
group()->focusNextChild();
|
||||
redraw();
|
||||
}
|
||||
else if ( this == group()->getFirstButton()
|
||||
&& out_ev->getFocusType() == FocusPreviousWidget )
|
||||
&& out_ev->getFocusType() == fc::FocusPreviousWidget )
|
||||
{
|
||||
out_ev->ignore();
|
||||
group()->focusPrevChild();
|
||||
|
|
|
@ -506,7 +506,7 @@ bool FWidget::event (FEvent* ev)
|
|||
{
|
||||
switch ( ev->type() )
|
||||
{
|
||||
case KeyPress_Event:
|
||||
case fc::KeyPress_Event:
|
||||
{
|
||||
FKeyEvent* kev = static_cast<FKeyEvent*>(ev);
|
||||
bool accpt_focus = false;
|
||||
|
@ -538,11 +538,11 @@ bool FWidget::event (FEvent* ev)
|
|||
}
|
||||
break;
|
||||
|
||||
case KeyUp_Event:
|
||||
case fc::KeyUp_Event:
|
||||
onKeyUp ( static_cast<FKeyEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case KeyDown_Event:
|
||||
case fc::KeyDown_Event:
|
||||
{
|
||||
FKeyEvent* kev = static_cast<FKeyEvent*>(ev);
|
||||
FWidget* widget = this;
|
||||
|
@ -556,55 +556,55 @@ bool FWidget::event (FEvent* ev)
|
|||
}
|
||||
break;
|
||||
|
||||
case MouseDown_Event:
|
||||
case fc::MouseDown_Event:
|
||||
onMouseDown ( static_cast<FMouseEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case MouseUp_Event:
|
||||
case fc::MouseUp_Event:
|
||||
onMouseUp ( static_cast<FMouseEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case MouseDoubleClick_Event:
|
||||
case fc::MouseDoubleClick_Event:
|
||||
onMouseDoubleClick ( static_cast<FMouseEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case MouseWheel_Event:
|
||||
case fc::MouseWheel_Event:
|
||||
onWheel ( static_cast<FWheelEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case MouseMove_Event:
|
||||
case fc::MouseMove_Event:
|
||||
onMouseMove ( static_cast<FMouseEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case FocusIn_Event:
|
||||
case fc::FocusIn_Event:
|
||||
onFocusIn ( static_cast<FFocusEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case FocusOut_Event:
|
||||
case fc::FocusOut_Event:
|
||||
onFocusOut ( static_cast<FFocusEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case Accelerator_Event:
|
||||
case fc::Accelerator_Event:
|
||||
onAccel ( static_cast<FAccelEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case Resize_Event:
|
||||
case fc::Resize_Event:
|
||||
onResize ( static_cast<FResizeEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case Show_Event:
|
||||
case fc::Show_Event:
|
||||
onShow ( static_cast<FShowEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case Hide_Event:
|
||||
case fc::Hide_Event:
|
||||
onHide ( static_cast<FHideEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case Close_Event:
|
||||
case fc::Close_Event:
|
||||
onClose ( static_cast<FCloseEvent*>(ev) );
|
||||
break;
|
||||
|
||||
case Timer_Event:
|
||||
case fc::Timer_Event:
|
||||
onTimer ( static_cast<FTimerEvent*>(ev) );
|
||||
break;
|
||||
|
||||
|
@ -714,16 +714,16 @@ bool FWidget::focusNextChild(void)
|
|||
|| ! next->acceptFocus()
|
||||
|| ! next->isVisible()
|
||||
|| next->isWindow() );
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
out.setFocusType(FocusNextWidget);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
out.setFocusType(fc::FocusNextWidget);
|
||||
FApplication::sendEvent(this, &out);
|
||||
if ( out.isAccepted() )
|
||||
{
|
||||
if ( next == this )
|
||||
return false;
|
||||
next->setFocus();
|
||||
FFocusEvent in (FocusIn_Event);
|
||||
in.setFocusType(FocusNextWidget);
|
||||
FFocusEvent in (fc::FocusIn_Event);
|
||||
in.setFocusType(fc::FocusNextWidget);
|
||||
FApplication::sendEvent(next, &in);
|
||||
if ( in.isAccepted() )
|
||||
{
|
||||
|
@ -776,16 +776,16 @@ bool FWidget::focusPrevChild(void)
|
|||
|| ! prev->acceptFocus()
|
||||
|| ! prev->isVisible()
|
||||
|| prev->isWindow() );
|
||||
FFocusEvent out (FocusOut_Event);
|
||||
out.setFocusType(FocusPreviousWidget);
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
out.setFocusType(fc::FocusPreviousWidget);
|
||||
FApplication::sendEvent(this, &out);
|
||||
if ( out.isAccepted() )
|
||||
{
|
||||
if ( prev == this )
|
||||
return false;
|
||||
prev->setFocus();
|
||||
FFocusEvent in (FocusIn_Event);
|
||||
in.setFocusType(FocusPreviousWidget);
|
||||
FFocusEvent in (fc::FocusIn_Event);
|
||||
in.setFocusType(fc::FocusPreviousWidget);
|
||||
FApplication::sendEvent(prev, &in);
|
||||
if ( in.isAccepted() )
|
||||
{
|
||||
|
@ -929,7 +929,7 @@ int FWidget::numOfFocusableChildren()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::close()
|
||||
{
|
||||
FCloseEvent ev(Close_Event);
|
||||
FCloseEvent ev(fc::Close_Event);
|
||||
FApplication::sendEvent(this, &ev);
|
||||
|
||||
if ( ev.isAccepted() )
|
||||
|
@ -1308,7 +1308,7 @@ void FWidget::show()
|
|||
show_root_widget = 0;
|
||||
}
|
||||
|
||||
FShowEvent show_ev (Show_Event);
|
||||
FShowEvent show_ev (fc::Show_Event);
|
||||
FApplication::sendEvent(this, &show_ev);
|
||||
}
|
||||
|
||||
|
@ -1328,7 +1328,7 @@ void FWidget::hide()
|
|||
FWidget::setFocusWidget(parentWidget());
|
||||
}
|
||||
}
|
||||
FHideEvent hide_ev (Hide_Event);
|
||||
FHideEvent hide_ev (fc::Hide_Event);
|
||||
FApplication::sendEvent(this, &hide_ev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,19 +28,19 @@ bool FWindow::event (FEvent* ev)
|
|||
{
|
||||
switch ( ev->type() )
|
||||
{
|
||||
case WindowActive_Event:
|
||||
case fc::WindowActive_Event:
|
||||
onWindowActive (ev);
|
||||
break;
|
||||
|
||||
case WindowInactive_Event:
|
||||
case fc::WindowInactive_Event:
|
||||
onWindowInactive (ev);
|
||||
break;
|
||||
|
||||
case WindowRaised_Event:
|
||||
case fc::WindowRaised_Event:
|
||||
onWindowRaised (ev);
|
||||
break;
|
||||
|
||||
case WindowLowered_Event:
|
||||
case fc::WindowLowered_Event:
|
||||
onWindowLowered (ev);
|
||||
break;
|
||||
|
||||
|
@ -247,7 +247,7 @@ bool FWindow::raiseWindow (FWidget* obj)
|
|||
{
|
||||
window_list->erase (iter);
|
||||
window_list->push_back (obj);
|
||||
FEvent ev(WindowRaised_Event);
|
||||
FEvent ev(fc::WindowRaised_Event);
|
||||
FApplication::sendEvent(obj, &ev);
|
||||
return true;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ bool FWindow::lowerWindow (FWidget* obj)
|
|||
{
|
||||
window_list->erase (iter);
|
||||
window_list->insert (window_list->begin(), obj);
|
||||
FEvent ev(WindowLowered_Event);
|
||||
FEvent ev(fc::WindowLowered_Event);
|
||||
FApplication::sendEvent(obj, &ev);
|
||||
return true;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ void FWindow::setActiveWindow (FWindow* window)
|
|||
if ( ! window->isActiveWindow() )
|
||||
{
|
||||
window->activateWindow();
|
||||
FEvent ev(WindowActive_Event);
|
||||
FEvent ev(fc::WindowActive_Event);
|
||||
FApplication::sendEvent(window, &ev);
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ void FWindow::setActiveWindow (FWindow* window)
|
|||
if ( w->isActiveWindow() )
|
||||
{
|
||||
w->deactivateWindow();
|
||||
FEvent ev(WindowInactive_Event);
|
||||
FEvent ev(fc::WindowInactive_Event);
|
||||
FApplication::sendEvent(*iter, &ev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ void Calc::onKeyPress (FKeyEvent* ev)
|
|||
case fc::Fkey_escape:
|
||||
case fc::Fkey_escape_mintty:
|
||||
{
|
||||
FAccelEvent a_ev(Accelerator_Event, getFocusWidget());
|
||||
FAccelEvent a_ev(fc::Accelerator_Event, getFocusWidget());
|
||||
calculator_buttons[On]->onAccel(&a_ev);
|
||||
}
|
||||
ev->accept();
|
||||
|
|
|
@ -88,9 +88,9 @@ void AttribDlg::onWheel (FWheelEvent* ev)
|
|||
{
|
||||
int wheel = ev->getWheel();
|
||||
|
||||
if ( wheel == WheelUp )
|
||||
if ( wheel == fc::WheelUp )
|
||||
cb_next();
|
||||
else if ( wheel == WheelDown )
|
||||
else if ( wheel == fc::WheelDown )
|
||||
cb_back();
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,10 @@ void AttribDlg::adjustSize()
|
|||
{
|
||||
int x = ((parentWidget()->getWidth() - getWidth()) / 2 );
|
||||
int y = ((parentWidget()->getHeight() - getHeight()) / 2 ) + 1;
|
||||
if ( x < 1 )
|
||||
x = 1;
|
||||
if ( y < 1 )
|
||||
y = 1;
|
||||
|
||||
setGeometry(x, y, 69, 21, false);
|
||||
next_button->setGeometry(getWidth()-13, getHeight()-4, 10, 1, false);
|
||||
|
@ -339,8 +343,12 @@ void AttribDemo::draw()
|
|||
if ( ! isMonochron() )
|
||||
setColor(wc.label_fg, wc.label_bg);
|
||||
gotoxy (xpos + xmin - 1, ypos + ymin + 13);
|
||||
printf ( " Background color: %d ",
|
||||
static_cast<AttribDlg*>(getParent())->bgcolor );
|
||||
short bg = static_cast<AttribDlg*>(getParent())->bgcolor;
|
||||
print (" Background color:");
|
||||
if ( bg == fc::Default )
|
||||
print (" default");
|
||||
else
|
||||
printf ( " %d", bg);
|
||||
gotoxy (xpos + xmin + 14, ypos + ymin + 15);
|
||||
print ("Change background color ->");
|
||||
|
||||
|
|
Loading…
Reference in New Issue