Ejemplo n.º 1
0
SectionBar::SectionBar( Control& parent ) :
   Control( parent ),
   m_section( nullptr )
{
   SetObjectId( "IWSectionBar" );

   SetFocusStyle( FocusStyle::NoFocus );

   SetSizer( Global_Sizer );

   Global_Sizer.AddSpacing( 1 );
   Global_Sizer.Add( Title_Sizer );
   Global_Sizer.AddSpacing( 1 );

   Title_Sizer.AddSpacing( 4 );
   Title_Sizer.Add( Title_Label );
   Title_Sizer.AddStretch();
   Title_Sizer.Add( Title_ToolButton );
   Title_Sizer.AddSpacing( 4 );

   Title_Label.SetText( String( 'M' ) );
   Title_Label.SetTextAlignment( TextAlign::Left|TextAlign::VertCenter );
   Title_Label.SetText( String() );

   Title_ToolButton.SetIcon( Bitmap( ScaledResource( contract_icon ) ) );
   Title_ToolButton.SetScaledFixedSize( 17, 17 );
   Title_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   Title_ToolButton.OnClick( (Button::click_event_handler)&SectionBar::ButtonClick, *this );

   AdjustToContents();
   SetFixedHeight();

   OnMousePress( (Control::mouse_button_event_handler)&SectionBar::MousePress, *this );
   OnShow( (Control::event_handler)&SectionBar::ControlShow, *this );
}
Ejemplo n.º 2
0
void
COpenGLDemo::HandleEvents()
{
  SDL_Event ev;
  while ( SDL_PollEvent( &ev ))
  {
    switch( ev.type )
    {
    case SDL_QUIT:
      OnQuit( ev.quit );
      break;
    case SDL_KEYDOWN:
      OnKeyDown( ev.key );
      break;
    case SDL_KEYUP:
      OnKeyUp( ev.key );
      break;
    case SDL_MOUSEMOTION:
      OnMouseMotion( ev.motion );
      break;
    case SDL_MOUSEBUTTONUP:
      OnMouseRelease( ev.button );
      break;
    case SDL_MOUSEBUTTONDOWN:
      OnMousePress( ev.button );
      break;
    }
  }
}
Ejemplo n.º 3
0
STFSliders::STFSliders() : Control(),
channel( 0 ), rgb( true ), m( 0.5F ), c0( 0 ), c1( 1 ), v0( 0 ), v1( 1 ),
gradient( Bitmap::Null() ),
beingDragged( -1 ), scrolling( false ), scrollOrigin( 0 ),
onValueUpdated( 0 ), onValueUpdatedReceiver( 0 ),
onRangeUpdated( 0 ), onRangeUpdatedReceiver( 0 )
{
   OnPaint( (Control::paint_event_handler)&STFSliders::__Paint, *this );
   OnResize( (Control::resize_event_handler)&STFSliders::__Resize, *this );
   OnMousePress( (Control::mouse_button_event_handler)&STFSliders::__MousePress, *this );
   OnMouseMove( (Control::mouse_event_handler)&STFSliders::__MouseMove, *this );
   OnMouseRelease( (Control::mouse_button_event_handler)&STFSliders::__MouseRelease, *this );
   OnMouseWheel( (Control::mouse_wheel_event_handler)&STFSliders::__MouseWheel, *this );
}
Ejemplo n.º 4
0
void UIBase::Input(){

    int key = InputManager::GetInstance().GetMouseMousePressKey();

    Point mpos = InputManager::GetInstance().GetMouse();
    if (IsInside(mpos.x,mpos.y)){

        if (key != 0 && OnMousePress){
            OnMousePress(this,key,mpos);
        }
        key = InputManager::GetInstance().GetMouseMouseReleaseKey();
        if (key != 0 && OnMouseRelease){
            OnMouseRelease(this,key,mpos);
        }
        if (!MouseInside){
            if (OnMouseEnter){
                OnMouseEnter(this,mpos);
            }
            MouseInside = true;
        }
    }else{
        if (MouseInside){
            if (OnMouseLeave){
                OnMouseLeave(this,mpos);
            }
            MouseInside = false;
        }
    }

    key = InputManager::GetInstance().IsAnyKeyPressed();
    if (key != -1 && OnKeyPress){
        OnKeyPress(this,key);
    }

    /*for (unsigned i = 0; i < Components.size(); ++i) {
        if (!Components[i]->IsDead()){
            Components[i]->Input();
        }
    }*/
}
Ejemplo n.º 5
0
void AbstractObj::mousePress()
{
    emit OnMousePress();
}