本文整理汇总了C++中Fl_Scroll::xposition方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Scroll::xposition方法的具体用法?C++ Fl_Scroll::xposition怎么用?C++ Fl_Scroll::xposition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Scroll
的用法示例。
在下文中一共展示了Fl_Scroll::xposition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Scheme_Object*
spark_fltk_scroll::xposition(int argc, Scheme_Object** argv)
{
DEFAULT_RET_INIT;
Fl_Scroll* scroll = _get_fl_scroll(argc, argv, 0);
if (scroll)
_ret_ = scheme_make_integer(scroll->xposition());
DEFAULT_RET_FINISH;
}
示例2: handle
int Fl_Canvas::handle (int event) {
if (Fl_Group::handle (event)) return 1;
if (event==FL_PUSH) {
ClearIncompleteWire();
redraw();
m_DragX=Fl::event_x();
m_DragY=Fl::event_y();
}
if ((Fl::event_button() == 1) && ((Fl::event_state() & FL_SHIFT) == 0) && ((Fl::event_state() & FL_CTRL) == 0)) {
// Left-Click (or plain click for those who are mouse-button challenged)
// Select / Multi-select / move devices
// Handled below - If on a non-selected plugin, deselect and move
// Handled below - If on a selected plugin, move selection
// Handled Here - If on canvas - multi select
if (event==FL_PUSH) {
if (m_HaveSelection) {
m_Selection.Clear();
m_HaveSelection = false;
}
m_Selecting = true;
m_StartSelectX=Fl::event_x();
m_StartSelectY=Fl::event_y();
m_EndSelectX=Fl::event_x();
m_EndSelectY=Fl::event_y();
ClearIncompleteWire();
redraw();
m_DragX=Fl::event_x();
m_DragY=Fl::event_y();
}
if ((event==FL_DRAG) && m_Selecting) {
m_EndSelectX = Fl::event_x();
m_EndSelectY = Fl::event_y();
Fl_Scroll* scroll = (Fl_Scroll *)parent();
int newx = 0, xp = scroll->xposition();
int newy = 0, yp = scroll->yposition();
if ((m_EndSelectX < m_StartSelectX) && ((m_EndSelectX - x() - xp) <= 15))
newx = 10;
if ((m_EndSelectY < m_StartSelectY) && ((m_EndSelectY - y() - yp) <= 15))
newy = 10;
if ((m_EndSelectX > m_StartSelectX) && ((scroll->x() + scroll->w() - m_EndSelectX - 15) <= 15))
newx = -10;
if ((m_EndSelectY > m_StartSelectY) && ((scroll->y() + scroll->h() - m_EndSelectY - 15) <= 5))
newy = -10;
if ((newx!=0) || (newy!=0)) {
position(x()+newx,y()+newy);
m_StartSelectX += newx;
m_StartSelectY += newy;
}
m_DragX=Fl::event_x();
m_DragY=Fl::event_y();
redraw();
}
if ((event==FL_RELEASE) && m_Selecting) {
m_Selecting = false;
if ((m_EndSelectX != m_StartSelectX) && (m_EndSelectY != m_StartSelectY))
CalculateSelection();
redraw();
}
}
if ((Fl::event_button() == 2) || ((Fl::event_button() == 1) && ((Fl::event_state() & FL_SHIFT) != 0))) {
// Middle-Click (or shift-click for the mouse button challenged) - old left click
// Handled Below - If on items allows selecting of individual items
// Handled Here - If on canvas, drags canvas
if (event==FL_PUSH) {
ClearIncompleteWire();
redraw();
m_DragX=Fl::event_x();
m_DragY=Fl::event_y();
}
if (event==FL_DRAG) {
position (x() + (Fl::event_x() - m_DragX), y() + (Fl::event_y() - m_DragY));
m_DragX=Fl::event_x();
m_DragY=Fl::event_y();
redraw();
}
}
if ((Fl::event_button() == 3) || ((Fl::event_button() == 1) && ((Fl::event_state() & FL_CTRL) != 0))) {
// Right-Click (or Ctrl-click for the M.B.C.)
// Pop-up Edit/Plugins menu
if (event==FL_PUSH) {
m_x=Fl::event_x();
m_y=Fl::event_y();
PopupEditMenu (this);
}
}
return 1;
}