mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
ScEd: Compilation fixes. Atlas: Screen-space to world-space conversion when editing terrain. Wireframe option. Minor wxWidgets 2.6.1 fixes. AoE3Ed. This was SVN commit r2698.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "SnapSplitterWindow.h"
|
|
|
|
BEGIN_EVENT_TABLE(SnapSplitterWindow, wxSplitterWindow)
|
|
EVT_SPLITTER_SASH_POS_CHANGING(wxID_ANY, SnapSplitterWindow::OnSashPosChanging)
|
|
END_EVENT_TABLE()
|
|
|
|
SnapSplitterWindow::SnapSplitterWindow(wxWindow* parent, long style)
|
|
: wxSplitterWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
|
style | wxSP_LIVE_UPDATE),
|
|
m_SnapTolerance(16)
|
|
{
|
|
// Set min size, to disable unsplitting
|
|
SetMinimumPaneSize(32);
|
|
|
|
}
|
|
|
|
bool SnapSplitterWindow::SplitVertically(wxWindow *window1, wxWindow *window2, int sashPosition)
|
|
{
|
|
m_DefaultSashPosition = sashPosition;
|
|
return DoSplit(wxSPLIT_VERTICAL, window1, window2, sashPosition);
|
|
}
|
|
bool SnapSplitterWindow::SplitHorizontally(wxWindow *window1, wxWindow *window2, int sashPosition)
|
|
{
|
|
m_DefaultSashPosition = sashPosition;
|
|
return DoSplit(wxSPLIT_HORIZONTAL, window1, window2, sashPosition);
|
|
}
|
|
|
|
void SnapSplitterWindow::OnSashPosChanging(wxSplitterEvent& evt)
|
|
{
|
|
if (evt.GetSashPosition() >= m_DefaultSashPosition-m_SnapTolerance &&
|
|
evt.GetSashPosition() <= m_DefaultSashPosition+m_SnapTolerance)
|
|
{
|
|
evt.SetSashPosition(m_DefaultSashPosition);
|
|
}
|
|
}
|