wxSplitterWindow
wxSplitterWindow overview
このクラスは2つのサブウインドウを管理する。現在の所、wxSplitterWindowのユーザーインターフェイスを通じて、その見かけを、プログラム(多分、メニューコマンド)で2つに分割したり、お互いにくっつけたりすることができる。
This class manages up to two subwindows. The current view can be
split into two programmatically (perhaps from a menu command), and unsplit
either programmatically or via the wxSplitterWindow user interface.
Windows 95のユーザーインターフェイスのための適切な3D陰影はオプションです。また、これはGTKでも推奨されています。MacOS Xの元では、もし望めば、ウインドウの窓枠をよりMacOS標準に近い見かけにすることができる。
Appropriate 3D shading for the Windows 95 user interface is an option -
this is also recommended for GTK. Optionally, the sash can be made to
look more like the native control under MacOS X.
Window styles
wxSP_3D
|
3D効果のある境界と窓枠を描画する
Draws a 3D effect border and sash.
|
wxSP_3DSASH
|
3D効果のある窓枠を描画する
Draws a 3D effect sash.
|
wxSP_3DBORDER
|
3D効果のある境界を描画する
Draws a 3D effect border.
|
wxSP_FULLSASH
|
窓枠の端を描画する(ウインドウが窓枠なしで使用できるように)
Draws the ends of the sash (so the window can be used without a border).
|
wxSP_BORDER
|
細い黒い境界をウインドウの回りに描画する
Draws a thin black border around the window.
|
wxSP_NOBORDER
|
境界なし。なおかつ黒い窓枠。
No border, and a black sash.
|
wxSP_PERMIT_UNSPLIT
|
いつでも合体を許す。たとえ、窓枠の大きさがゼロではない最小の値の時であってもOK。
Always allow to
unsplit, even with the minimum pane size other than zero.
|
wxSP_LIVE_UPDATE
|
決して区別のための線を描画しないが、子ウインドウの大きさを直接変更することができる。
Don't draw XOR line but resize the child windows immediately.
|
See also window styles overview.
Derived from
wxWindow
wxEvtHandler
wxObject
Include files
<wx/splitter.h>
Event handling
スプリッターコントロールからの入力を処理するには、
wxSplitterEventを引数とするメンバー関数に直接入力が渡されるようにするための下記イベントハンドラマクロを使用すること。
To process input from a splitter control, use the following event handler
macros to direct input to member functions that take a
wxSplitterEvent argument.
EVT_SPLITTER_SASH_POS_CHANGING(id, func)
|
この処理の過程で、窓枠の位置が変更される。その位置でトラッキングバーのドラッグが完了した際に、その(トラッキングバーの)位置を適切に反映する様に修正するために使われることを想定している。wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING イベントを処理する。
The sash
position is in the process of being changed. May be used to modify the
position of the tracking bar to properly reflect the position that
would be set if the drag were to be completed at this point. Processes
a wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING event.
|
EVT_SPLITTER_SASH_POS_CHANGED(id, func)
|
窓枠の位置が変更されるところ。窓枠がセットされる前にその位置を修正するために、または変更が発生するのを防ぐために使われることを想定している。
wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGEDイベントを処理する。
The sash
position was changed. May be used to modify the sash position before
it is set, or to prevent the change from taking place.
Processes a wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED event.
|
EVT_SPLITTER_UNSPLIT(id, func)
|
スプリッターがちょうど合体するところ。
wxEVT_COMMAND_SPLITTER_UNSPLITを処理する。
The splitter has been just
unsplit. Processes a wxEVT_COMMAND_SPLITTER_UNSPLIT event.
|
EVT_SPLITTER_DCLICK(id, func)
|
窓枠がダブルクリックされるところ。標準の振舞ではウインドウを合体するようになっている(0より大きい最小の大きさが設定されている場合を除く)。
wxEVT_COMMAND_SPLITTER_DOUBLECLICKEDを処理する。
The sash was double
clicked. The default behaviour is to unsplit the window when this happens
(unless the minimum pane size has been set to a value greater than zero).
Processes a wxEVT_COMMAND_SPLITTER_DOUBLECLICKED event.
|
See also
wxSplitterEvent
Members
wxSplitterWindow::wxSplitterWindow
wxSplitterWindow::~wxSplitterWindow
wxSplitterWindow::Create
wxSplitterWindow::GetMinimumPaneSize
wxSplitterWindow::GetSashPosition
wxSplitterWindow::GetSplitMode
wxSplitterWindow::GetWindow1
wxSplitterWindow::GetWindow2
wxSplitterWindow::Initialize
wxSplitterWindow::IsSplit
wxSplitterWindow::OnDoubleClickSash
wxSplitterWindow::OnUnsplit
wxSplitterWindow::OnSashPositionChange
wxSplitterWindow::ReplaceWindow
wxSplitterWindow::SetSashPosition
wxSplitterWindow::SetMinimumPaneSize
wxSplitterWindow::SetSplitMode
wxSplitterWindow::SplitHorizontally
wxSplitterWindow::SplitVertically
wxSplitterWindow::Unsplit
wxSplitterWindow::wxSplitterWindow
wxSplitterWindow()
デフォルトコンストラクタ
Default constructor.
wxSplitterWindow(wxWindow* parent, wxWindowID id,
const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style=wxSP_3D, const wxString& name = "splitterWindow")
ウインドウ作成のためのコンストラクタ
Constructor for creating the window.
Parameters
parent
id
ウインドウ識別子
The window identifier.
pos
ウインドウの位置
The window position.
size
ウインドウのサイズ
The window size.
style
name
Remarks
2つのウインドウを作成することができる……1つは表示していない状態にすることができるし、また、2つめの枠は必要に応じて作成/消去を行うことができる
You can create two windows, with one hidden when not being shown; or you can
create and delete the second pane on demand.
See also
wxSplitterWindow::Initialize, wxSplitterWindow::SplitVertically,
wxSplitterWindow::SplitHorizontally,
wxSplitterWindow::Create
wxSplitterWindow::~wxSplitterWindow
~wxSplitterWindow()
wxSplitterWindowおよびその子供を破棄する。
Destroys the wxSplitterWindow and its children.
wxSplitterWindow::Create
bool Create(wxWindow* parent, wxWindowID id, int x,
const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style=wxSP_3D, const wxString& name = "splitterWindow")
wxSplitterWindow::GetMinimumPaneSize
int GetMinimumPaneSize() const
現在の最小の窓枠サイズを返す(標準は0)。
Returns the current minimum pane size (defaults to zero).
See also
wxSplitterWindow::SetMinimumPaneSize
wxSplitterWindow::GetSashPosition
int GetSashPosition()
現在の窓枠の位置を返す。
Returns the current sash position.
See also
wxSplitterWindow::SetSashPosition
wxSplitterWindow::GetSplitMode
int GetSplitMode() const
スプリットの状態を入手する。
Gets the split mode.
See also
wxSplitterWindow::SetSplitMode, wxSplitterWindow::SplitVertically,
wxSplitterWindow::SplitHorizontally.
wxSplitterWindow::GetWindow1
wxWindow* GetWindow1() const
左上か(複数の窓枠を持たない状態なら、その)唯一の窓枠を返す。
Returns the left/top or only pane.
wxSplitterWindow::GetWindow2
wxWindow* GetWindow2() const
右下の窓枠を返す。
Returns the right/bottom pane.
wxSplitterWindow::Initialize
void Initialize(wxWindow* window)
1つの窓枠を持つようにスプリッターウインドウを初期化する。
Initializes the splitter window to have one pane.
Parameters
window
Remarks
もし最初の状態では、スプリッターウインドウの中にただ1つの窓枠しか表示されていない様にしたいのならば、このメンバ関数を呼出すべきである。
This should be called if you wish to initially view only a single pane in the splitter window.
See also
wxSplitterWindow::SplitVertically,
wxSplitterWindow::SplitHorizontally
wxSplitterWindow::IsSplit
bool IsSplit() const
もしウインドウが分割されているのならば、Trueを返す。さもなければFalseを返す。
Returns TRUE if the window is split, FALSE otherwise.
wxSplitterWindow::OnDoubleClickSash
virtual void OnDoubleClickSash(int x, int y)
窓枠が左マウスボタンでダブルクリックされた時に呼出される、アプリケーションでオーバーライド出来る関数
Application-overridable function called when the sash is double-clicked with
the left mouse button.
Parameters
x
y
Remarks
もし、最小の窓枠の大きさがの場合、この関数の標準の実装は
Unsplitを呼出す。
The default implementation of this function calls
Unsplit if
the minimum pane size is zero.
See also
wxSplitterWindow::Unsplit
wxSplitterWindow::OnUnsplit
virtual void OnUnsplit(wxWindow* removed)
プログラム上で、またはwxSplitterWindowsユーザーインターフェイスを使用して窓枠を合体させる時に呼出される、アプリケーションでオーバーライド出来る関数
Application-overridable function called when the window is unsplit, either
programmatically or using the wxSplitterWindow user interface.
Parameters
removed
Remarks
標準の実装では単にremovedを隠す。ウインドウを削除することを望むだろう。
The default implementation of this function simply hides removed. You
may wish to delete the window.
wxSplitterWindow::OnSashPositionChange
virtual bool OnSashPositionChange(int newSashPosition)
ユーザーによって窓枠の位置が変更された時に呼出される、アプリケーションでオーバーライド出来る関数。もしFALSEを返した場合は変更を中止し、TRUEを返した場合は変更を許可する。
Application-overridable function called when the sash position is changed by
user. It may return FALSE to prevent the change or TRUE to allow it.
Parameters
newSashPosition
Remarks
この関数の標準実装では、両方の窓枠の大きさが最小の窓枠の大きさよりも大きいことを検証する。
The default implementation of this function verifies that the sizes of both
panes of the splitter are greater than minimum pane size.
wxSplitterWindow::ReplaceWindow
bool ReplaceWindow(wxWindow * winOld, wxWindow * winNew)
この関数はwxSplitterWindowによって管理されるウインドウをもうひとつのウインドウと置き換える。これは、Unsplit()を呼び出して再びウインドウを分割するとフリッカーを誘発するので、その代わりに使用するのが望ましい。スプリッターが2つのウインドウを持っていていも、1つのウインドウしか持っていなくても、どちらの場合でこの関数を呼び出しても問題は発生しない。
This function replaces one of the windows managed by the wxSplitterWindow with
another one. It is in general better to use it instead of calling Unsplit()
and then resplitting the window back because it will provoke much less flicker
(if any). It is valid to call this function whether the splitter has two
windows or only one.
どちらの変数も、NULLであってはならず、またwinOldにスプリッターに管理されるウインドウの1つが指定される指定される必要がある。もし変数が間違っているかウインドウが置き換えることができないときは、FALSEが返される。さもなければこの関数はTRUEを返す。が、置き換えられたウインドウが削除されるわけではなく、望むならば自分で処理する必要があることに注意すること。
Both parameters should be non-NULL and winOld must specify one of the
windows managed by the splitter. If the parameters are incorrect or the window
couldn't be replaced, FALSE is returned. Otherwise the function will return
TRUE, but please notice that it will not delete the replaced window and you
may wish to do it yourself.
See also
wxSplitterWindow::GetMinimumPaneSize
See also
wxSplitterWindow::Unsplit
wxSplitterWindow::SplitVertically
wxSplitterWindow::SplitHorizontally
wxSplitterWindow::SetSashPosition
void SetSashPosition(int position, const bool redraw = TRUE)
窓枠の位置を指定する。
Sets the sash position.
Parameters
position
redraw
Remarks
現在のところ、範囲外の値かどうかをチェックしていない。
Does not currently check for an out-of-range value.
See also
wxSplitterWindow::GetSashPosition
wxSplitterWindow::SetMinimumPaneSize
void SetMinimumPaneSize(int paneSize)
窓枠の最小の大きさを設定する
Sets the minimum pane size.
Parameters
paneSize
Remarks
標準では、最小の窓枠の大きさは0である。これは窓枠をドラッグすることによりどちらの窓枠も0の大きさまで小さくし、その窓枠を取り除くことができることを意味する。この振舞を防止する(そして範囲外の窓枠のドラッグを拒否する)には、最小の大きさを指定する(例えば20pixel)必要がある。もし、スプリッターウインドウを作成するときにwxSP_PERMIT_UNSPLITが設定されている場合は、もし最小の大きさが0ではない値だとしても、そのウインドウは合体することができるだろう。
The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging
the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging),
set a minimum size, for example 20 pixels. If the wxSP_PERMIT_UNSPLIT style
is used when a splitter window is created, the window may be unsplit even
if minimum size is non-zero.
See also
wxSplitterWindow::GetMinimumPaneSize
wxSplitterWindow::SetSplitMode
void SetSplitMode(int mode)
スプリットの状態を設定する。
Sets the split mode.
Parameters
mode
Remarks
内部変数を設定するのみの場合に使用する。表示は更新されない。
Only sets the internal variable; does not update the display.
See also
wxSplitterWindow::GetSplitMode, wxSplitterWindow::SplitVertically,
wxSplitterWindow::SplitHorizontally.
wxSplitterWindow::SplitHorizontally
bool SplitHorizontally(wxWindow* window1, wxWindow* window2,
int sashPosition = 0)
スプリッターウインドウの上と下の窓枠を初期化する
Initializes the top and bottom panes of the splitter window.
Parameters
window1
window2
sashPosition
窓枠の初期の位置。もしこの値が正ならば、上のパネルの大きさを指定したことになる。もし負ならば、その絶対値を下のパネルの大きさに指定したことになる。最後になるが、0を指定した場合(標準)、標準の位置を指定したことになる(ウインドウの高さの半分)
The initial position of the sash. If this value is
positive, it specifies the size of the upper pane. If it is negative, it is
absolute value gives the size of the lower pane. Finally, specify 0 (default)
to choose the default position (half of the total window height).
Return value
TRUEなら成功、さもなければFALSE(ウインドウはすでに分割されている)。
TRUE if successful, FALSE otherwise (the window was already split).
Remarks
もし2つの窓枠の見栄えを初期化したいのならば、この関数を呼ぶ必要がある。また、その後も呼ぶことができるが、そのときはアプリケーションは
IsSplit.を使用して、現在は分割されていないことを確認する必要がある。
This should be called if you wish to initially view two panes. It can also be
called at any subsequent time, but the application should check that the
window is not currently split using
IsSplit.
See also
wxSplitterWindow::SplitVertically, wxSplitterWindow::IsSplit,
wxSplitterWindow::Unsplit
wxSplitterWindow::SplitVertically
bool SplitVertically(wxWindow* window1, wxWindow* window2,
int sashPosition = 0)
右と左のウインドウを初期化する
Initializes the left and right panes of the splitter window.
Parameters
window1
window2
sashPosition
窓枠の初期の位置。もしこの値が正ならば、左のパネルの大きさを指定したことになる。もし負ならば、その絶対値を右のパネルの大きさに指定したことになる。最後になるが、0を指定した場合(標準)、標準の位置を指定したことになる(ウインドウの高さの半分)
The initial position of the sash. If this value is
positive, it specifies the size of the left pane. If it is negative, it is
absolute value gives the size of the right pane. Finally, specify 0 (default)
to choose the default position (half of the total window width).
Return value
TRUEなら成功、さもなければFALSE(ウインドウはすでに分割されている)。
TRUE if successful, FALSE otherwise (the window was already split).
Remarks
もし2つの窓枠の見栄えを初期化したいのならば、この関数を呼ぶ必要がある。また、その後も呼ぶことができるが、そのときはアプリケーションは
IsSplit.を使用して、現在は分割されていないことを確認する必要がある。
This should be called if you wish to initially view two panes. It can also be called at any subsequent time,
but the application should check that the window is not currently split using
IsSplit.
See also
wxSplitterWindow::SplitHorizontally, wxSplitterWindow::IsSplit,
wxSplitterWindow::Unsplit.
wxSplitterWindow::Unsplit
bool Unsplit(wxWindow* toRemove = NULL)
ウインドウを合体させる
Unsplits the window.
Parameters
toRemove
取り除かれる窓枠。NULLを指定したばあいは、右/下の窓枠が取り除かれる。
The pane to remove, or NULL to remove the right or bottom pane.
Return value
成功した場合はTRUEを返す。さもなければFALSEを返す(ウインドウはまだ分割されていない)
TRUE if successful, FALSE otherwise (the window was not split).
Remarks
この関数を呼び出しても、取り除かれたパネルは削除されたわけではない。希望する動作でオーバーライドすることのできる
OnUnsplitが呼び出される。標準では、取り除かれた窓枠は隠されるだけである。
This call will not actually delete the pane being removed; it calls
OnUnsplit
which can be overridden for the desired behaviour. By default, the pane being removed is hidden.
See also
wxSplitterWindow::SplitHorizontally, wxSplitterWindow::SplitVertically,
wxSplitterWindow::IsSplit, wxSplitterWindow::OnUnsplit