Example #1
0
void wxCalendarCtrl::SetWindowStyleFlag(long style)
{
    const long styleOld = GetWindowStyleFlag();

    wxCalendarCtrlBase::SetWindowStyleFlag(style);

    if ( styleOld != GetWindowStyleFlag() )
        UpdateStyle();
}
dlgSelectDatabase::dlgSelectDatabase(wxWindow *parent, int id, const wxPoint &pos, const wxSize &size, long style):
	wxDialog(parent, id, wxT("Select Database"), pos, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{

#ifdef __WXMSW__
	SetWindowStyleFlag(GetWindowStyleFlag() & ~wxMAXIMIZE_BOX);
#endif

	wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);

	tcServers = new wxTreeCtrl(this, TCSERVER_ID);
	mainSizer->Add(tcServers, 1, wxEXPAND, 0);

	wxBoxSizer *bottomSizer = new wxBoxSizer(wxHORIZONTAL);

	bottomSizer->AddStretchSpacer();

	wxButton *btnOk = new wxButton(this, wxID_OK, wxT("&OK"));
	bottomSizer->Add(btnOk);

	wxButton *btnCANCEL = new wxButton(this, wxID_CANCEL, wxT("&Cancel"));
	bottomSizer->Add(btnCANCEL, 0, wxLEFT, 10);

	mainSizer->Add(bottomSizer, 0, wxALL | wxALIGN_RIGHT, 5);
	SetSizer(mainSizer);

	SetSize(wxSize(200, 240));

	Layout();
	Centre();

	Initialize();
}
Example #3
0
int wxSpinButton::GetArrowState(wxScrollArrows::Arrow arrow) const
{
    int state = m_arrowsState[arrow];

    // the arrow may also be disabled: either because the control is completely
    // disabled
    bool disabled = !IsEnabled();

    if ( !disabled && !(GetWindowStyleFlag() & wxSP_WRAP) )
    {
        // ... or because we can't go any further - note that this never
        // happens if we just wrap
        if ( IsVertical() )
        {
            if ( arrow == wxScrollArrows::Arrow_First )
                disabled = m_value == m_max;
            else
                disabled = m_value == m_min;
        }
        else // horizontal
        {
            if ( arrow == wxScrollArrows::Arrow_First )
                disabled = m_value == m_min;
            else
                disabled = m_value == m_max;
        }
    }

    if ( disabled )
    {
        state |= wxCONTROL_DISABLED;
    }

    return state;
}
Example #4
0
bool wxMDIParentFrame::Create(wxWindow *parent,
                              wxWindowID id,
                              const wxString& title,
                              const wxPoint& pos,
                              const wxSize& size,
                              long style,
                              const wxString& name)
{
    m_clientWindow = (wxMDIClientWindow*) NULL;
    m_activeChild = (wxMDIChildFrame*) NULL;
    m_activeMenuBar = (wxMenuBar*) NULL;

    bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
    if (success)
    {
        // TODO: app cannot override OnCreateClient since
        // wxMDIParentFrame::OnCreateClient will still be called
        // (we're in the constructor). How to resolve?

        m_clientWindow = OnCreateClient();

        // Uses own style for client style
        m_clientWindow->CreateClient(this, GetWindowStyleFlag());

        int w, h;
        GetClientSize(& w, & h);
        m_clientWindow->SetSize(0, 0, w, h);
        return true;
    }
    else
        return false;
}
Example #5
0
void wxTopLevelWindowMotif::PreDestroy()
{
#ifdef __VMS
#pragma message disable codcauunr
#endif
   if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
        wxModelessWindows.DeleteObject(this);
#ifdef __VMS
#pragma message enable codcauunr
#endif

    m_icons.m_icons.Empty();

    DestroyChildren();

    // MessageDialog and FileDialog do not have a client widget
    if( GetClientWidget() )
    {
        XtRemoveEventHandler( (Widget)GetClientWidget(),
                              ButtonPressMask | ButtonReleaseMask |
                              PointerMotionMask | KeyPressMask,
                              False,
                              wxTLWEventHandler,
                              (XtPointer)this );
    }
}
void    wxSpeedButton::SetAlign(int inAlign) {
int     i,n;

// make sure a valid alignment

    n = inAlign;
    if ((n != wxBU_LEFT) && (n != wxBU_TOP) &&(n != wxBU_RIGHT) &&(n != wxBU_BOTTOM)) n = wxBU_LEFT;

// get current style

    i = GetWindowStyleFlag();

// remove old alignment, and border info

    i = i & (~ wxBORDER_MASK);
    i = i & (~ wxBU_ALIGN_MASK);

// put in alignment and no-border

    i = i | wxBORDER_NONE;
    i = i | n;
    i = i | wxCLIP_CHILDREN;

// save new style

    SetWindowStyleFlag(i);
    Refresh(false);
}
void tmwxOptimizerDialog::DoStartModal() {
  /* CAF - essentially lifted from wxGTK 2.5.1's wxDialog::ShowModal, up to
     grabbing the focus. */
    if (IsModal()) {
       wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
       mStatus = GetReturnCode();
       return;
    }

    // use the apps top level window as parent if none given unless explicitly
    // forbidden
    if (! GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT)) {
        wxWindow *parent = wxTheApp->GetTopWindow();
        if (parent && parent != this &&
            parent -> IsBeingDeleted() &&
            ! (parent->GetExtraStyle() & wxWS_EX_TRANSIENT)) {
            m_parent = parent;
            gtk_window_set_transient_for (GTK_WINDOW(m_widget),
            GTK_WINDOW(parent->m_widget) );
        }
    }

    wxBeginBusyCursor ();
    Show (true);
    SetFocus();
    m_modalShowing = true;
    g_openDialogs++;
    gtk_grab_add (m_widget);
}
int     wxSpeedButton::GetAlign(void) {
int     i;

    i = GetWindowStyleFlag();
    i = i & wxBU_ALIGN_MASK;

    return i;
}
Example #9
0
WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
                                          WXWPARAM wParam,
                                          WXLPARAM lParam)
{
    WXLRESULT rc = 0;
    bool processed = false;

    switch ( message )
    {
        case WM_ACTIVATE:
            {
                WXWORD state, minimized;
                WXHWND hwnd;
                UnpackActivate(wParam, lParam, &state, &minimized, &hwnd);

                processed = HandleActivate(state, minimized != 0, hwnd);
            }
            break;

        case WM_COMMAND:
            // system messages such as SC_CLOSE are sent as WM_COMMANDs to the
            // parent MDI frame and we must let the DefFrameProc() have them
            // for these commands to work (without it, closing the maximized
            // MDI children doesn't work, for example)
            {
                WXWORD id, cmd;
                WXHWND hwnd;
                UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);

                if ( id == wxID_MDI_MORE_WINDOWS ||
                     (cmd == 0 /* menu */ &&
                        id >= SC_SIZE /* first system menu command */) )
                {
                    MSWDefWindowProc(message, wParam, lParam);
                    processed = true;
                }
            }
            break;

        case WM_CREATE:
            m_clientWindow = OnCreateClient();
            // Uses own style for client style
            if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
            {
                wxLogMessage(_("Failed to create MDI parent frame."));

                rc = -1;
            }

            processed = true;
            break;
    }

    if ( !processed )
        rc = wxFrame::MSWWindowProc(message, wParam, lParam);

    return rc;
}
Example #10
0
int wxSpinButton::NormalizeValue(int value) const
{
    if ( value > m_max )
    {
        if ( GetWindowStyleFlag() & wxSP_WRAP )
            value = m_min + (value - m_max - 1) % (m_max - m_min + 1);
        else
            value = m_max;
    }
    else if ( value < m_min )
    {
        if ( GetWindowStyleFlag() & wxSP_WRAP )
            value = m_max - (m_min - value - 1) % (m_max - m_min + 1);
        else
            value = m_min;
    }

    return value;
}
void wxNonOwnedWindow::SetWindowStyleFlag(long flags)
{
    if (flags == GetWindowStyleFlag())
        return;

    wxWindow::SetWindowStyleFlag(flags);

    if (m_nowpeer)
        m_nowpeer->SetWindowStyleFlag(flags);
}
Example #12
0
void SymbolTree::BuildTree(const wxFileName &fileName)
{
	// Clear the tree
	DeleteAllItems();
	m_items.clear();
	m_globalsNode = wxTreeItemId();
	m_prototypesNode = wxTreeItemId();
	m_macrosNode = wxTreeItemId();
	m_sortItems.clear();

	m_fileName = fileName;
	// Get the current tree
	m_tree = TagsManagerST::Get()->Load(m_fileName);
	if ( !m_tree ) {
		return;
	}

	// Add invisible root node
	wxTreeItemId root;
	root = AddRoot(fileName.GetFullName(), 15, 15);

	TreeWalker<wxString, TagEntry> walker(m_tree->GetRoot());

	// add three items here:
	// the globals node, the mcros and the prototype node
	m_globalsNode    = AppendItem(root, wxT("Global Functions and Variables"), 2, 2, new MyTreeItemData(wxT("Global Functions and Variables"), wxEmptyString));
	m_prototypesNode = AppendItem(root, wxT("Functions Prototypes"), 2, 2, new MyTreeItemData(wxT("Functions Prototypes"), wxEmptyString));
	m_macrosNode     = AppendItem(root, wxT("Macros"), 2, 2, new MyTreeItemData(wxT("Macros"), wxEmptyString));

	// Iterate over the tree and add items
	m_sortItems.clear();

	Freeze();
	for (; !walker.End(); walker++) {
		// Add the item to the tree
		TagNode* node = walker.GetNode();

		// Skip root node
		if (node->IsRoot())
			continue;

		// Add the node
		AddItem(node);
	}

	SortTree(m_sortItems);
	Thaw();

	//select the root node by default
	if (!(GetWindowStyleFlag() & wxTR_HIDE_ROOT)) {
		//root is visible, select it
		SelectItem(GetRootItem());
	}
}
Example #13
0
InfoPane::InfoPane(wxWindow* parent) : cbAuiNotebook(parent, idNB, wxDefaultPosition, wxDefaultSize, infopane_flags), baseID(wxNewId())
{
    defaultBitmap = cbLoadBitmap(ConfigManager::GetDataFolder() + _T("/images/edit_16x16.png"), wxBITMAP_TYPE_PNG);
    if (Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/infopane_tabs_bottom"), false))
        SetWindowStyleFlag(GetWindowStyleFlag() | wxAUI_NB_BOTTOM);

    wxRegisterId(baseID + num_pages);
    for(int i = 0; i < num_pages; ++i)
    {
        page[i] = Page();
    }
}
Example #14
0
void InfoPane::OnTabPosition(wxCommandEvent& event)
{
    long style = GetWindowStyleFlag();
    style &= ~wxAUI_NB_BOTTOM;

    if (event.GetId() == idNB_TabBottom)
        style |= wxAUI_NB_BOTTOM;
    SetWindowStyleFlag(style);
    Refresh();
    // (style & wxAUI_NB_BOTTOM) saves info only about the the tabs position
    Manager::Get()->GetConfigManager(_T("app"))->Write(_T("/environment/infopane_tabs_bottom"), (bool)(style & wxAUI_NB_BOTTOM));
}
Example #15
0
// Draw 3D effect borders
void wxSashWindow::DrawBorders(wxDC& dc)
{
    int w, h;
    GetClientSize(&w, &h);

    wxPen mediumShadowPen(m_mediumShadowColour, 1, wxSOLID);
    wxPen darkShadowPen(m_darkShadowColour, 1, wxSOLID);
    wxPen lightShadowPen(m_lightShadowColour, 1, wxSOLID);
    wxPen hilightPen(m_hilightColour, 1, wxSOLID);

    if ( GetWindowStyleFlag() & wxSW_3DBORDER )
    {
        dc.SetPen(mediumShadowPen);
        dc.DrawLine(0, 0, w-1, 0);
        dc.DrawLine(0, 0, 0, h - 1);

        dc.SetPen(darkShadowPen);
        dc.DrawLine(1, 1, w-2, 1);
        dc.DrawLine(1, 1, 1, h-2);

        dc.SetPen(hilightPen);
        dc.DrawLine(0, h-1, w-1, h-1);
        dc.DrawLine(w-1, 0, w-1, h); // Surely the maximum y pos. should be h - 1.
                                     /// Anyway, h is required for MSW.

        dc.SetPen(lightShadowPen);
        dc.DrawLine(w-2, 1, w-2, h-2); // Right hand side
        dc.DrawLine(1, h-2, w-1, h-2);     // Bottom
    }
    else if ( GetWindowStyleFlag() & wxSW_BORDER )
    {
        dc.SetBrush(*wxTRANSPARENT_BRUSH);
        dc.SetPen(*wxBLACK_PEN);
        dc.DrawRectangle(0, 0, w-1, h-1);
    }

    dc.SetPen(wxNullPen);
    dc.SetBrush(wxNullBrush);
}
Example #16
0
bool wxTopLevelWindowMSW::EnableMinimizeButton(bool enable)
{
    if ( ( HasFlag(wxCAPTION) &&
         ( HasFlag(wxCLOSE_BOX) || HasFlag(wxSYSTEM_MENU) ) ) &&
         HasFlag(wxMINIMIZE_BOX) )
    {
        if ( enable )
        {
            SetWindowStyleFlag(GetWindowStyleFlag() | wxMINIMIZE_BOX);
        }
        else
        {
            SetWindowStyleFlag(GetWindowStyleFlag() ^ wxMINIMIZE_BOX);
            // Restore the style to our internal store
            wxWindowBase::SetWindowStyleFlag(GetWindowStyle() | wxMINIMIZE_BOX);
        }

        return true;
    }

    return false;
}
Example #17
0
	void Viewer::AlwaysOnTop(bool doAlwaysOnTop)
	{
		auto style = GetWindowStyleFlag();
		if (doAlwaysOnTop)
		{
			style |= wxSTAY_ON_TOP;
		}
		else
		{
			style &= ~(wxSTAY_ON_TOP);
		}
		SetWindowStyleFlag(style);
	}
Example #18
0
int wxDialog::ShowModal()
{
    if (IsModal())
    {
        wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
        return GetReturnCode();
    }

    // use the apps top level window as parent if none given unless explicitly
    // forbidden
    if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) )
    {
        extern WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete;

        wxWindow * const parent = wxTheApp->GetTopWindow();

        if ( parent &&
                parent != this &&
                parent->IsShownOnScreen() &&
                !parent->IsBeingDeleted())
        {
            wxCriticalSectionLocker locker(wxPendingDeleteCS);
            if (!wxPendingDelete.Member(parent) &&
                    !(parent->GetExtraStyle() & wxWS_EX_TRANSIENT) )
            {
                m_parent = parent;
                gtk_window_set_transient_for( GTK_WINDOW(m_widget),
                                              GTK_WINDOW(parent->m_widget) );
            }
        }
    }

    wxBusyCursorSuspender cs; // temporarily suppress the busy cursor

    Show( true );

    m_modalShowing = true;

    g_openDialogs++;

    // NOTE: gtk_window_set_modal internally calls gtk_grab_add() !
    gtk_window_set_modal(GTK_WINDOW(m_widget), TRUE);

    wxEventLoop().Run();

    gtk_window_set_modal(GTK_WINDOW(m_widget), FALSE);

    g_openDialogs--;

    return GetReturnCode();
}
Example #19
0
void wxPropertyGridManager::SetWindowStyleFlag( long style )
{
    int oldWindowStyle = GetWindowStyleFlag();

    wxWindow::SetWindowStyleFlag( style );
    m_pPropGrid->SetWindowStyleFlag( (m_pPropGrid->GetWindowStyleFlag()&~(wxPG_MAN_PASS_FLAGS_MASK)) |
                                   (style&wxPG_MAN_PASS_FLAGS_MASK) );

    // Need to re-position windows?
    if ( (oldWindowStyle & (wxPG_TOOLBAR|wxPG_DESCRIPTION)) !=
         (style & (wxPG_TOOLBAR|wxPG_DESCRIPTION)) )
    {
        RecreateControls();
    }
}
Example #20
0
void WXAppBar::SetBorderDecorations (bool enable, bool apply)
{
	if (enable == GetBorderDecorations()) return;
	
	// Changes the flag
	long style= GetWindowStyleFlag();
	if (enable) {
		// Enable decorations
		style= style & ~wxNO_BORDER;
//		style= style | wxCAPTION;
	}
	else {
		// Disable decorations
		style= style | wxNO_BORDER;
//		style= style & ~wxCAPTION;
	}
	SetWindowStyleFlag(style);
	// According to the manual, after changing flags a Refresh is needed
	Refresh();

#if defined(__WXMSW__)
	// TODO
	(void)(apply); // Remove warning
	assert (false);
#elif defined(__WXGTK__)
	//
	// On WXGTK the above code is not enough, so we change this property
	// using gtk+ directly
	//
	
	// Get X11 handle for our window
	GtkWindow *gtkWindow= (GtkWindow *) GetHandle();
	assert (gtkWindow);
	if (!gtkWindow) return;

	bool isShown= IsShown();
	if (apply && isShown) wxDialog::Show(false);
	
	gtk_window_set_decorated ((GtkWindow *) GetHandle(), (enable? TRUE : FALSE));
	if (apply && isShown) {
		wxDialog::Show(true);
		Refresh();
		Update();
	}
#else
	assert (false);
#endif
}
Example #21
0
void wxFileCtrl::UpdateItem(const wxListItem &item)
{
    wxFileData *fd = (wxFileData*)GetItemData(item);
    wxCHECK_RET(fd, wxT("invalid filedata"));

    fd->ReadData();

    SetItemText(item, fd->GetFileName());
    SetItemImage(item, fd->GetImageId());

    if (GetWindowStyleFlag() & wxLC_REPORT)
    {
        for (int i = 1; i < wxFileData::FileList_Max; i++)
            SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
    }
}
Example #22
0
File: mdi.cpp Project: beanhome/dev
bool wxMDIParentFrame::Create(wxWindow *parent,
                              wxWindowID id,
                              const wxString& title,
                              const wxPoint& pos,
                              const wxSize& size,
                              long style,
                              const wxString& name )
{
    if ( !wxFrame::Create( parent, id, title, pos, size, style, name ) )
        return false;

    m_clientWindow = OnCreateClient();
    if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
        return false;

    return true;
}
Example #23
0
int wxDialog::ShowModal()
{
    wxASSERT_MSG( !IsModal(), "ShowModal() can't be called twice" );

    // release the mouse if it's currently captured as the window having it
    // will be disabled when this dialog is shown -- but will still keep the
    // capture making it impossible to do anything in the modal dialog itself
    wxWindow * const win = wxWindow::GetCapture();
    if ( win )
        win->GTKReleaseMouseAndNotify();

    // use the apps top level window as parent if none given unless explicitly
    // forbidden
    if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) )
    {
        wxWindow * const parent = GetParentForModalDialog();
        if ( parent && parent != this )
        {
            gtk_window_set_transient_for( GTK_WINDOW(m_widget),
                                          GTK_WINDOW(parent->m_widget) );
        }
    }

    wxBusyCursorSuspender cs; // temporarily suppress the busy cursor

    Show( true );

    m_modalShowing = true;

    wxOpenModalDialogsCount++;

    // NOTE: gtk_window_set_modal internally calls gtk_grab_add() !
    gtk_window_set_modal(GTK_WINDOW(m_widget), TRUE);

    // Run modal dialog event loop.
    {
        wxGUIEventLoopTiedPtr modal(&m_modalLoop, new wxGUIEventLoop());
        m_modalLoop->Run();
    }

    gtk_window_set_modal(GTK_WINDOW(m_widget), FALSE);

    wxOpenModalDialogsCount--;

    return GetReturnCode();
}
Example #24
0
long wxFileCtrl::Add( wxFileData *fd, wxListItem &item )
{
    long ret = -1;
    item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE;
    fd->MakeItem( item );
    long my_style = GetWindowStyleFlag();
    if (my_style & wxLC_REPORT)
    {
        ret = InsertItem( item );
        for (int i = 1; i < wxFileData::FileList_Max; i++)
            SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
    }
    else if ((my_style & wxLC_LIST) || (my_style & wxLC_SMALL_ICON))
    {
        ret = InsertItem( item );
    }
    return ret;
}
Example #25
0
int wxDialog::ShowModal()
{
    if (IsModal())
    {
       wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
       return GetReturnCode();
    }

    // use the apps top level window as parent if none given unless explicitly
    // forbidden
    if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) )
    {
        wxWindow *parent = wxTheApp->GetTopWindow();
        if ( parent &&
                parent != this &&
                    parent->IsBeingDeleted() &&
                        !(parent->GetExtraStyle() & wxWS_EX_TRANSIENT) )
        {
            m_parent = parent;
            gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) );
        }
    }

    wxBusyCursorSuspender cs; // temporarily suppress the busy cursor

    Show( true );

    SetFocus();

    m_modalShowing = true;

    g_openDialogs++;

    gtk_grab_add( m_widget );

    wxEventLoop().Run();

    gtk_grab_remove( m_widget );

    g_openDialogs--;

    return GetReturnCode();
}
Example #26
0
bool wxListBox::IsSelected( int N ) const
{
    wxCHECK_MSG( IsValid(N), false,
                 wxT("invalid index in wxListBox::Selected") );

    LONG                            lItem;

    if (GetWindowStyleFlag() & wxLB_EXTENDED)
    {
        if (N == 0)
            lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)LIT_FIRST, (MPARAM)0));
        else
            lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)(N - 1), (MPARAM)0));
    }
    else
    {
        lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)LIT_FIRST, (MPARAM)0));
    }
    return (lItem == (LONG)N && lItem != LIT_NONE);
} // end of wxListBox::IsSelected
Example #27
0
int wxDialog::ShowModal()
{
    if ( IsModal() )
    {
       wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
       return GetReturnCode();
    }

    // use the apps top level window as parent if none given unless explicitly
    // forbidden
    if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) )
    {
        wxWindow *parent = wxTheApp->GetTopWindow();
        if ( parent && parent != this )
        {
            m_parent = parent;
        }
    }

    Show(true);

    m_isShowingModal = true;

    wxASSERT_MSG( !m_windowDisabler, _T("disabling windows twice?") );

#if defined(__WXGTK__) || defined(__WXMGL__)
    wxBusyCursorSuspender suspender;
    // FIXME (FIXME_MGL) - make sure busy cursor disappears under MSW too
#endif

    m_windowDisabler = new wxWindowDisabler(this);
    if ( !m_eventLoop )
        m_eventLoop = new wxEventLoop;

    m_eventLoop->Run();

    return GetReturnCode();
}
Example #28
0
bool wxMDIParentFrame::Create(wxWindow *parent,
            wxWindowID id,
            const wxString& title,
            const wxPoint& pos,
            const wxSize& size,
            long style,
            const wxString& name)
{
    m_qtWindow = new wxQtMDIParentFrame( parent, this );

    if (!wxFrameBase::Create( parent, id, title, pos, size, style, name ))
        return false;

    wxMDIClientWindow *client = OnCreateClient();
    m_clientWindow = client;
    if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
        return false;

    GetHandle()->setCentralWidget( client->GetHandle() );

    PostCreation();

    return true;
}
Example #29
0
void wxThinSplitterWindow::DrawSash(wxDC& dc)
{
    if ( m_sashPosition == 0 || !m_windowTwo)
        return;
    if (GetWindowStyle() & wxSP_NOSASH)
        return;
    
    int w, h;
    GetClientSize(&w, &h);
    
    if ( m_splitMode == wxSPLIT_VERTICAL )
    {
        dc.SetPen(* m_facePen);
        dc.SetBrush(* m_faceBrush);
        int h1 = h-1;
        int y1 = 0;
        if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
            h1 += 1; // Not sure why this is necessary...
        if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
        {
            y1 = 2; h1 -= 3;
        }
        dc.DrawRectangle(m_sashPosition, y1, m_sashSize, h1);
    }
    else
    {
        dc.SetPen(* m_facePen);
        dc.SetBrush(* m_faceBrush);
        int w1 = w-1;
        int x1 = 0;
        if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
            w1 ++;
        if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
        {
            x1 = 2; w1 -= 3;
        }
        dc.DrawRectangle(x1, m_sashPosition, w1, m_sashSize);
    }
    
    dc.SetPen(wxNullPen);
    dc.SetBrush(wxNullBrush);
}
Example #30
0
WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
                                     WXWPARAM wParam,
                                     WXLPARAM lParam)
{
    WXLRESULT rc = 0;
    bool processed = false;

    switch ( message )
    {
        case WM_ACTIVATE:
            {
                WXWORD state, minimized;
                WXHWND hwnd;
                UnpackActivate(wParam, lParam, &state, &minimized, &hwnd);

                processed = HandleActivate(state, minimized != 0, hwnd);
            }
            break;

        case WM_COMMAND:
            {
                WXWORD id, cmd;
                WXHWND hwnd;
                UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);

                (void)HandleCommand(id, cmd, hwnd);

                // even if the frame didn't process it, there is no need to try it
                // once again (i.e. call wxFrame::HandleCommand()) - we just did it,
                // so pretend we processed the message anyhow
                processed = true;
            }

            // always pass this message DefFrameProc(), otherwise MDI menu
            // commands (and sys commands - more surprisingly!) won't work
            MSWDefWindowProc(message, wParam, lParam);
            break;

        case WM_CREATE:
            m_clientWindow = OnCreateClient();
            // Uses own style for client style
            if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
            {
                wxLogMessage(_("Failed to create MDI parent frame."));

                rc = -1;
            }

            processed = true;
            break;

        case WM_ERASEBKGND:
            processed = true;

            // we erase background ourselves
            rc = true;
            break;

        case WM_MENUSELECT:
            {
                WXWORD item, flags;
                WXHMENU hmenu;
                UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);

                if ( m_parentFrameActive )
                {
                    processed = HandleMenuSelect(item, flags, hmenu);
                }
                else if (m_currentChild)
                {
                    processed = m_currentChild->
                        HandleMenuSelect(item, flags, hmenu);
                }
            }
            break;

        case WM_SIZE:
            // though we don't (usually) resize the MDI client to exactly fit the
            // client area we need to pass this one to DefFrameProc to allow the children to show
            break;
    }

    if ( !processed )
        rc = wxFrame::MSWWindowProc(message, wParam, lParam);

    return rc;
}