LRESULT CXTPDockingPaneSidePanel::OnNcHitTest(CPoint point)
{
	if (m_bCollapsed && !m_bExpanded)
		return HTCLIENT;

	CXTPWindowRect rcWindow(this);
	CRect rcBorders = rcWindow;
	rcBorders.DeflateRect(3, 3);

	if (rcWindow.PtInRect(point) && !rcBorders.PtInRect(point))
	{
		rcBorders.DeflateRect(8, 8);

		int ht = 0;

		if (point.y < rcBorders.top && IsResizable(HTTOP))
			ht = (HTTOP - HTSIZEFIRST + 1);
		else if (point.y >= rcBorders.bottom  && IsResizable(HTBOTTOM))
			ht = (HTBOTTOM - HTSIZEFIRST + 1);

		if (point.x < rcBorders.left && IsResizable(HTLEFT))
			ht += (HTLEFT - HTSIZEFIRST + 1);
		else if (point.x >= rcBorders.right  && IsResizable(HTRIGHT))
			ht += (HTRIGHT - HTSIZEFIRST + 1);

		return (LRESULT)(ht + HTSIZEFIRST - 1);
	}

	return HTCLIENT;
}
Esempio n. 2
0
void ToolBar::ReCreateButtons()
{
   // SetSizer(NULL) detaches mHSizer and deletes it.
   // Do not use Detach() here, as that attempts to detach mHSizer from itself!
   SetSizer( NULL );

   // Get rid of any children we may have
   DestroyChildren();

   // Create the main sizer
   wxBoxSizer *ms = new wxBoxSizer( wxHORIZONTAL );

   // Create the grabber and add it to the main sizer
   mGrabber = new Grabber( this, mType );
   ms->Add( mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1 );

   // Use a box sizer for laying out controls
   mHSizer = new wxBoxSizer( wxHORIZONTAL );
   ms->Add( mHSizer, 1, wxEXPAND );

   // (Re)Establish dock state
   SetDocked( GetDock(), false );

   // Go add all the rest of the gadgets
   Populate();

   // Add some space for the resize border
   if( IsResizable() )
   {
      mSpacer = ms->Add( RWIDTH, 1 );
   }

   // Set the sizer
   SetSizerAndFit( ms );

   // Recalculate the height to be a multiple of toolbarSingle
   const int tbs = toolbarSingle + toolbarGap;
   wxSize sz = GetSize();
   sz.y = ( ( ( sz.y + tbs ) / tbs ) * tbs ) - 1;

   // Set the true AND minimum sizes and do final layout
   if(IsResizable())
   {
      sz.SetWidth(GetMinToolbarWidth());
      SetMinSize(sz);
      sz.SetWidth(GetInitialWidth());
      SetSize(sz);
   }
   else
   {
      SetInitialSize(sz);
   }
   Layout();
}
Esempio n. 3
0
bool GraphicsSystem::CreateSFMLWindow()
{
    uint32_t style = 0;

    if (IsFullscreen())
    {
        style = sf::Style::Fullscreen;
    }
    else
    {
        style |= sf::Style::Close;

        if (IsResizable())
            style |= sf::Style::Resize;

        if (IsDecorated())
            style |= sf::Style::Titlebar;
    }

    m_SfWindow.create(sf::VideoMode(m_Width, m_Height), m_Title, style);

    m_SfWindow.setKeyRepeatEnabled(false);

    return m_SfWindow.isOpen();
}
void TAbstractTextBox::SetSize(const TSize& value) {
    if ((IsResizable() == true) &&
       ((maxSize != TSize()) && (value <= maxSize) && (minSize <= value)))
    {
        parent_type::SetSize(value);
    }
}
Esempio n. 5
0
//
// Handle toolbar resizing
//
void ToolBar::OnLeftDown( wxMouseEvent & event )
{
   // Go ahead and set the event to propagate
   event.Skip();

   // Don't do anything if we're not docked
   if( !IsDocked() )
   {
      return;
   }

   // Can we be resized?
   if( IsResizable() )
   {
      wxPoint pos = event.GetPosition();
      wxRect rect = GetRect();

      // Adjust to size of resize grabber
      rect.x = rect.width - RWIDTH;
      rect.y = 0;
      rect.width = RWIDTH;

      // Is left click within resize grabber?
      if( rect.Contains( pos ) )
      {
         // Retrieve the mouse position
         mResizeStart = ClientToScreen( pos );

         // We want all of the mouse events
         CaptureMouse();
      }
   }
}
Esempio n. 6
0
//
// Handle toolbar resizing
//
void ToolBar::OnLeftDown( wxMouseEvent & event )
{
   // Go ahead and set the event to propagate
   event.Skip();

   // Don't do anything if we're not docked
   if( !IsDocked() )
   {
      return;
   }

   // Can we be resized?
   if( IsResizable() )
   {
      wxPoint pos = event.GetPosition();
      // Is left click within resize grabber?
      if( IsResizeGrabberHit( pos ) )
      {
         // Retrieve the mouse position
         mResizeStart = ClientToScreen( pos );
         // We want all of the mouse events
         CaptureMouse();
      }
   }
}
Esempio n. 7
0
void Engine::SetResizable(bool b)
{
    if(b == IsResizable())
        return; // no change required

    uint32 flags = _screen->flags | _screenFlags;

    // toggle between fullscreen, preserving other flags
    if(b)
        flags |= SDL_RESIZABLE; // add resizable flag
    else
        flags &= ~SDL_RESIZABLE; // remove resizable flag

    InitScreen(GetResX(), GetResY(), GetBPP(), flags);
}
//----------------------------------------------------------------------------
void DragDropLink::GainedSelection(DragDropSelection* pSelection){
//----------------------------------------------------------------------------
	PROC_TRACE;


   assert(pSelection!=NULL);
   // the link has gained selection, it is time to set up resize handles
    
   if (!IsResizable()) {
       pSelection->CreateBoundingHandle (this);    
       return;
   }
       
    
   CPoint point;
   for (int i=1; i < NumPoints()-1; i++){
       point = GetPoint(i);
       pSelection->CreateResizeHandle (this, point.x, point.y, i + HandlesLast, TRUE);
   }           
    
    return;
                                                           
} 
Esempio n. 9
0
//
// This draws the background of a toolbar
//
void ToolBar::OnPaint( wxPaintEvent & event )
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   // Start with a clean background
   //
   // Under GTK, clearing will cause the background to be white and
   // rather than setting a background color, just bypass the clear.
#if !defined(__WXGTK__)
   dc.Clear();
#endif

   // Go repaint the rest
   Repaint( &dc );

   if( IsResizable() && IsDocked() )
   {
      wxSize sz = GetSize();

      AColor::Dark( &dc, false );
      dc.DrawLine( sz.x - 4,  0, sz.x - 4, sz.y );
      dc.DrawLine( sz.x - 1,  0, sz.x - 1, sz.y );
   }
}
Esempio n. 10
0
void ToolBar::ReCreateButtons()
{
   // SetSizer(NULL) detaches mHSizer and deletes it.
   // Do not use Detach() here, as that attempts to detach mHSizer from itself!
   SetSizer( NULL );

   // Get rid of any children we may have
   DestroyChildren();
   mGrabber = NULL;
   mResizer = NULL;

   {
      // Create the main sizer
      auto ms = std::make_unique<wxBoxSizer>(wxHORIZONTAL);

      // Create the grabber and add it to the main sizer
      mGrabber = safenew Grabber(this, mType);
      ms->Add(mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1);

      // Use a box sizer for laying out controls
      ms->Add((mHSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);

      // (Re)Establish dock state
      SetDocked(GetDock(), false);

      // Go add all the rest of the gadgets
      Populate();

      // Add some space for the resize border
      if (IsResizable())
      {
         // Create the resizer and add it to the main sizer
         mResizer = safenew ToolBarResizer(this);
         ms->Add(mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1);
         mResizer->SetToolTip(_("Click and drag to resize toolbar"));
      }

      // Set the sizer
      SetSizerAndFit(ms.release());
   }

   // Recalculate the height to be a multiple of toolbarSingle
   const int tbs = toolbarSingle + toolbarGap;
   wxSize sz = GetSize();
   sz.y = ( ( ( sz.y + tbs -1) / tbs ) * tbs ) - 1;

   // Set the true AND minimum sizes and do final layout
   if(IsResizable())
   {
      sz.SetWidth(GetMinToolbarWidth());
      // JKC we're going to allow all resizable toolbars to be resized
      // to 1 unit high!
      wxSize sz2 = sz;
      sz2.y = tbs -1;
      SetMinSize(sz2);
      sz.SetWidth(GetInitialWidth());
      SetSize(sz);
   }
   else
   {
      SetInitialSize(sz);
   }
   Layout();
}
Esempio n. 11
0
void ToolBar::OnMotion( wxMouseEvent & event )
{
   // Go ahead and set the event to propagate
   event.Skip();

   // Don't do anything if we're not docked
   if( !IsDocked() )
   {
      return;
   }

   // Retrieve the mouse position
   wxPoint pos = ClientToScreen( event.GetPosition() );

   if( !HasCapture() )
   {
      if( IsResizable() )
      {
         wxPoint pos = event.GetPosition();
         wxRect rect = GetRect();

         // Adjust to size of resize grabber
         rect.x = rect.width - RWIDTH;
         rect.y = 0;
         rect.width = RWIDTH;

         // Is left click within resize grabber?
         if( rect.Contains( pos ) )
         {
            SetCursor( wxCURSOR_SIZEWE );
         }
         else
         {
            SetCursor( wxCURSOR_ARROW );
         }
      }
   }
   else if( event.Dragging() )
   {
      wxRect r = GetRect();
      wxSize msz = GetMinSize();
      wxSize psz = GetParent()->GetClientSize();

      // Adjust the size by the difference between the
      // last mouse and current mouse positions.
      r.width += ( pos.x - mResizeStart.x );

      // Constrain
      if( r.width < msz.x )
      {
         // Don't allow resizing to go too small
         r.width = msz.x;
      }
      else if( r.GetRight() > psz.x - 3 )
      {
         // Don't allow resizing to go too large
         //
         // The 3 magic pixels are because I'm too chicken to change the
         // calculations in ToolDock::LayoutToolBars() even though I'm
         // the one that set them up.  :-)
         r.SetRight( psz.x - 3 );
      }
      else
      {         
         // Remember for next go round
         mResizeStart = pos;
      }

      // Resize the bar
      SetSize( r.GetSize() );

      // Tell everyone we've changed sizes
      Updated();

      // Refresh our world
      GetParent()->Refresh();
      GetParent()->Update();
   }
}
Esempio n. 12
0
//
// This draws the background of a toolbar
//
void ToolBar::OnPaint( wxPaintEvent & event )
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   // Start with a clean background
   //
   // Under GTK, clearing will cause the background to be white and
   // rather than setting a background color, just bypass the clear.
#if !defined(__WXGTK__)
   dc.Clear();
#endif

// EXPERIMENTAL_THEMING is set to not apply the gradient
// on wxMAC builds.  on wxMAC we have the AQUA_THEME.
#ifdef USE_AQUA_THEME
   Repaint( &dc );
#else

#ifdef EXPERIMENTAL_THEMING
   wxImage * mpBackGradient =   &theTheme.Image( bmpRecoloredUpLarge  );

   if( mpBackGradient != NULL )
   {
      wxSize imSz( mpBackGradient->GetWidth(), mpBackGradient->GetHeight() );
      wxSize sz = GetSize();
      int y;
      for(y=0;y<sz.y;y++)
      {
         int yPix = ((float)y * imSz.y - 0.0001f)/(sz.y-1);
         wxColour col( 
            mpBackGradient->GetRed( 0, yPix),
            mpBackGradient->GetGreen( 0, yPix),
            mpBackGradient->GetBlue( 0, yPix));

         // Set background colour so that controls placed on this
         // toolbar such as radio buttons will draw reasonably.
         // It's a little tacky setting the background colour 
         // here, but we can't do it in the constructor as the gradient
         // may not be available yet.
         // Better than this would be to set the colour when the image 
         // is loaded.
         // We use the colour at the half way point as a suitable 'average'.
         if( y==(sz.y/2) )
         {
            SetBackgroundColour( col );
         }
         wxPen Pen( col );
         dc.SetPen(Pen );
         dc.DrawLine( 0, y, sz.x, y );
      }
   }
#endif
#endif

   if( IsResizable() && IsDocked() )
   {
      wxSize sz = GetSize();

      AColor::Dark( &dc, false );
      dc.DrawLine( sz.x - 4,  0, sz.x - 4, sz.y );
      dc.DrawLine( sz.x - 1,  0, sz.x - 1, sz.y );
   }
}