// Purpose: Drawer child window classes.
// Drawer windows appear under their parent window and
// behave like a drawer, opening and closing to reveal
// content that does not need to be visible at all times.
// Purpose: Drawer child window classes.
// Drawer windows appear under their parent window and
// behave like a drawer, opening and closing to reveal
// content that does not need to be visible at all times.
wxSize size, wxDirection edge, const wxString& name)
{
wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window."));
wxSize size, wxDirection edge, const wxString& name)
{
wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window."));
// Constrain the drawer size to the parent window.
const wxSize parentSize(parent->GetClientSize());
if (wxLEFT == edge || wxRIGHT == edge)
// Constrain the drawer size to the parent window.
const wxSize parentSize(parent->GetClientSize());
if (wxLEFT == edge || wxRIGHT == edge)
if (size.GetWidth() > parentSize.GetWidth())
size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset));
}
if (size.GetWidth() > parentSize.GetWidth())
size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset));
}
const wxPoint pos(0, 0);
const wxSize dummySize(0,0);
const long style = wxFRAME_DRAWER;
const wxPoint pos(0, 0);
const wxSize dummySize(0,0);
const long style = wxFRAME_DRAWER;
bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
if (success)
{
// this->MacCreateRealWindow(pos, size, style, name);
success = (GetWXWindow() != NULL);
}
bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
if (success)
{
// this->MacCreateRealWindow(pos, size, style, name);
success = (GetWXWindow() != NULL);
}
if (success)
{
// Use drawer brush.
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
if (success)
{
// Use drawer brush.
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
// Leading and trailing offset are gaps from parent window edges
// to where the drawer starts.
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
// Leading and trailing offset are gaps from parent window edges
// to where the drawer starts.
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
// Is there a better way to get the parent's WindowRef?
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
if (NULL != tlwParent)
// Is there a better way to get the parent's WindowRef?
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
if (NULL != tlwParent)
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
(WindowRef)tlwParent->GetWXWindow());
success = (noErr == status);
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
(WindowRef)tlwParent->GetWXWindow());
success = (noErr == status);
{
const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)GetWXWindow(),
DirectionToWindowEdge(edge));
{
const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)GetWXWindow(),
DirectionToWindowEdge(edge));