Esempio n. 1
0
bool wxTextCtrl::OS2Command(
  WXUINT                            uParam
, WXWORD                            WXUNUSED(vId)
)
{
    switch (uParam)
    {
        case EN_SETFOCUS:
        case EN_KILLFOCUS:
            {
                wxFocusEvent        vEvent( uParam == EN_KILLFOCUS ? wxEVT_KILL_FOCUS
                                                                   : wxEVT_SET_FOCUS
                                           ,m_windowId
                                          );

                vEvent.SetEventObject(this);
                GetEventHandler()->ProcessEvent(vEvent);
            }
            break;

        case EN_CHANGE:
            {
                if (m_bSkipUpdate)
                {
                    m_bSkipUpdate = false;
                    break;
                }

                wxCommandEvent      vEvent( wxEVT_COMMAND_TEXT_UPDATED
                                           ,m_windowId
                                          );

                InitCommandEvent(vEvent);
                ProcessCommand(vEvent);
            }
            break;

        case EN_OVERFLOW:
            //
            // The text size limit has been hit - increase it
            //
            AdjustSpaceLimit();
            break;

        case EN_SCROLL:
        case EN_INSERTMODETOGGLE:
        case EN_MEMERROR:
            return false;
        default:
            return false;
    }

    //
    // Processed
    //
    return true;
} // end of wxTextCtrl::OS2Command
Esempio n. 2
0
bool wxFrame::HandleMenuSelect( WXWORD nItem,
                                WXWORD nFlags,
                                WXHMENU hMenu )
{
    if( !nFlags )
    {
        MENUITEM mItem;
        MRESULT  rc;

        rc = ::WinSendMsg(hMenu, MM_QUERYITEM, MPFROM2SHORT(nItem, TRUE), (MPARAM)&mItem);

        if(rc && !(mItem.afStyle & (MIS_SUBMENU | MIS_SEPARATOR)))
        {
            wxMenuEvent                     vEvent(wxEVT_MENU_HIGHLIGHT, nItem);

            vEvent.SetEventObject(this);
            HandleWindowEvent(vEvent); // return value would be ignored by PM
        }
        else
        {
            DoGiveHelp(wxEmptyString, true);
            return false;
        }
    }
    return true;
} // end of wxFrame::HandleMenuSelect
Esempio n. 3
0
bool wxChoice::OS2Command(
  WXUINT                            uParam
, WXWORD                            WXUNUSED(wId)
)
{
    if (uParam != LN_SELECT)
    {
        //
        // "selection changed" is the only event we're after
        //
        return false;
    }
    int                             n = GetSelection();

    if (n > -1)
    {
        wxCommandEvent              vEvent( wxEVT_CHOICE
                                           ,m_windowId
                                          );

        vEvent.SetInt(n);
        vEvent.SetEventObject(this);
        vEvent.SetString(GetStringSelection());
        if (HasClientObjectData())
            vEvent.SetClientObject(GetClientObject(n));
        else if (HasClientUntypedData())
            vEvent.SetClientData(GetClientData(n));
        ProcessCommand(vEvent);
    }
    return true;
} // end of wxChoice::OS2Command
Esempio n. 4
0
int wxNotebook::SetSelection( size_t nPage )
{
    wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("notebook page out of range") );

    if (nPage != (size_t)m_nSelection)
    {
        wxBookCtrlEvent             vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
                                           ,m_windowId
                                          );

        vEvent.SetSelection(nPage);
        vEvent.SetOldSelection(m_nSelection);
        vEvent.SetEventObject(this);
        if (!HandleWindowEvent(vEvent) || vEvent.IsAllowed())
        {

            //
            // Program allows the page change
            //
            vEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
            HandleWindowEvent(vEvent);

            ::WinSendMsg( GetHWND()
                         ,BKM_TURNTOPAGE
                         ,MPFROMLONG((ULONG)m_alPageId[nPage])
                         ,(MPARAM)0
                        );
        }
    }
    m_nSelection = nPage;
    return nPage;
} // end of wxNotebook::SetSelection
Esempio n. 5
0
//
// Change the state of the item and redraw it
//
void wxCheckListBoxItem::Check (
  bool                              bCheck
)
{
    m_bChecked = bCheck;

    //
    // Index may be chanegd because new items were added/deleted
    //
    if (m_pParent->GetItemIndex(this) != (int)m_nIndex)
    {
        //
        // Update it
        //
        int                         nIndex = m_pParent->GetItemIndex(this);

        wxASSERT_MSG(nIndex != wxNOT_FOUND, wxT("what does this item do here?"));

        m_nIndex = (size_t)nIndex;
    }


    wxCommandEvent                  vEvent( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
                                           ,m_pParent->GetId()
                                          );

    vEvent.SetInt(m_nIndex);
    vEvent.SetEventObject(m_pParent);
    m_pParent->ProcessCommand(vEvent);
} // end of wxCheckListBoxItem::Check
Esempio n. 6
0
bool wxComboBox::OS2Command(
  WXUINT                            uParam
, WXWORD                            WXUNUSED(wId)
)
{
    long                            lSel = -1L;
    wxString                        sValue;

    switch (uParam)
    {
        case CBN_LBSELECT:
            if (GetSelection() > -1)
            {
                wxCommandEvent      vEvent( wxEVT_COMMAND_COMBOBOX_SELECTED
                                           ,GetId()
                                          );

                vEvent.SetInt(GetSelection());
                vEvent.SetEventObject(this);
                vEvent.SetString(GetStringSelection());
                ProcessCommand(vEvent);
            }
            break;

        case CBN_EFCHANGE:
            {
                wxCommandEvent      vEvent( wxEVT_COMMAND_TEXT_UPDATED
                                           ,GetId()
                                          );

                if (lSel == -1L)
                    sValue = GetValue();
                else
                    SetValue(sValue);
                vEvent.SetString(GetValue());
                vEvent.SetEventObject(this);
                ProcessCommand(vEvent);
            }
            break;
    }
    //
    // There is no return value for the CBN_ notifications, so always return
    // false from here to pass the message to DefWindowProc()
    //
    return false;
} // end of wxComboBox::OS2Command
Esempio n. 7
0
bool wxButton::SendClickEvent()
{
    wxCommandEvent                  vEvent( wxEVT_COMMAND_BUTTON_CLICKED
                                           ,GetId()
                                          );

    vEvent.SetEventObject(this);
    return ProcessCommand(vEvent);
} // end of wxButton::SendClickEvent
Esempio n. 8
0
void wxRadioBox::SendNotificationEvent()
{
    wxCommandEvent                  vEvent( wxEVT_COMMAND_RADIOBOX_SELECTED
                                           ,m_windowId
                                          );

    vEvent.SetInt( m_nSelectedButton );
    vEvent.SetString( GetString(m_nSelectedButton) );
    vEvent.SetEventObject(this);
    ProcessCommand(vEvent);
} // end of wxRadioBox::SendNotificationEvent
Esempio n. 9
0
bool wxSpinButton::OS2OnScroll( int    WXUNUSED(nOrientation),
                                WXWORD WXUNUSED(wParam),
                                WXWORD wPos,
                                WXHWND hControl )
{
    wxCHECK_MSG(hControl, false, wxT("scrolling what?") );

    wxSpinEvent vEvent( wxEVT_SCROLL_THUMBTRACK, m_windowId );
    int nVal = (int)wPos;    // cast is important for negative values!

    vEvent.SetPosition(nVal);
    vEvent.SetEventObject(this);
    return(HandleWindowEvent(vEvent));
} // end of wxSpinButton::OS2OnScroll
Esempio n. 10
0
void wxTimer::Notify()
{
    //
    // The base class version generates an event if it has owner - which it
    // should because otherwise nobody can process timer events, but it does
    // not use the OS's ID, which OS/2 must have to figure out which timer fired
    //
    wxCHECK_RET( m_owner, _T("wxTimer::Notify() should be overridden.") );

    wxTimerEvent                    vEvent( m_idTimer
                                           ,m_milli
                                          );

    (void)m_owner->ProcessEvent(vEvent);
} // end of wxTimer::Notify
Esempio n. 11
0
bool wxSpinCtrl::ProcessTextCommand( WXWORD wCmd,
                                     WXWORD WXUNUSED(wId) )
{
    switch (wCmd)
    {
        case SPBN_CHANGE:
        {
            wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED, GetId() );
            vEvent.SetEventObject(this);

            wxString sVal = wxGetWindowText(m_hWndBuddy);

            vEvent.SetString(sVal);
            vEvent.SetInt(GetValue());
            return (HandleWindowEvent(vEvent));
        }

        case SPBN_SETFOCUS:
        case SPBN_KILLFOCUS:
        {
            wxFocusEvent vEvent( wCmd == EN_KILLFOCUS ? wxEVT_KILL_FOCUS : wxEVT_SET_FOCUS
                                ,m_windowId
                               );

            vEvent.SetEventObject(this);
            return(HandleWindowEvent(vEvent));
        }
        default:
            break;
    }

    //
    // Not processed
    //
    return false;
} // end of wxSpinCtrl::ProcessTextCommand
Esempio n. 12
0
void wxSpinCtrl::OnSpinChange(
  wxSpinEvent&                      rEventSpin
)
{
    wxCommandEvent                  vEvent( wxEVT_COMMAND_SPINCTRL_UPDATED
                                           ,GetId()
                                          );

    vEvent.SetEventObject(this);
    vEvent.SetInt(rEventSpin.GetPosition());
    (void)HandleWindowEvent(vEvent);
    if (rEventSpin.GetSkipped())
    {
        vEvent.Skip();
    }
} // end of wxSpinCtrl::OnSpinChange
Esempio n. 13
0
bool wxListBox::OS2Command(
  WXUINT                            uParam
, WXWORD                            WXUNUSED(wId))
{
    wxEventType                     eEvtType;

    if (uParam == LN_SELECT)
    {
        eEvtType = wxEVT_COMMAND_LISTBOX_SELECTED;
    }
    else if (uParam == LN_ENTER)
    {
        eEvtType = wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
    }
    else
    {
        //
        // Some event we're not interested in
        //
        return false;
    }
    wxCommandEvent                  vEvent( eEvtType
                                           ,m_windowId
                                          );

    vEvent.SetEventObject(this);

    wxArrayInt                      aSelections;
    int                             n;
    int                             nCount = GetSelections(aSelections);

    if (nCount > 0)
    {
        n = aSelections[0];
        if (HasClientObjectData())
            vEvent.SetClientObject(GetClientObject(n));
        else if ( HasClientUntypedData() )
            vEvent.SetClientData(GetClientData(n));
        vEvent.SetString(GetString(n));
    }
    else
    {
        n = -1;
    }
    vEvent.SetInt(n);
    return GetEventHandler()->ProcessEvent(vEvent);
} // end of wxListBox::OS2Command
Esempio n. 14
0
void wxSpinCtrl::OnChar (
  wxKeyEvent&                       rEvent
)
{
    switch (rEvent.GetKeyCode())
    {
        case WXK_RETURN:
            {
                wxCommandEvent              vEvent( wxEVT_COMMAND_TEXT_ENTER
                                                   ,m_windowId
                                                  );
                wxString                    sVal = wxGetWindowText(m_hWndBuddy);

                InitCommandEvent(vEvent);
                vEvent.SetString(sVal);
                vEvent.SetInt(GetValue());
                if (HandleWindowEvent(vEvent))
                    return;
                break;
            }

        case WXK_TAB:
            //
            // Always produce navigation event - even if we process TAB
            // ourselves the fact that we got here means that the user code
            // decided to skip processing of this TAB - probably to let it
            // do its default job.
            //
            {
                wxNavigationKeyEvent        vEventNav;

                vEventNav.SetDirection(!rEvent.ShiftDown());
                vEventNav.SetWindowChange(rEvent.ControlDown());
                vEventNav.SetEventObject(this);
                if (GetParent()->HandleWindowEvent(vEventNav))
                    return;
            }
            break;
    }

    //
    // No, we didn't process it
    //
    rEvent.Skip();
} // end of wxSpinCtrl::OnChar
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfCtrlEventL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfCtrlEventL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfCtrlEventL, "TestAlfCtrlEventL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCtrlEventL );
    // Print to log file
    iLog->Log( KTestAlfCtrlEventL );
    TAlfEvent vEvent( 0 );
    iAlfCtl->AcceptInput();
    iAlfCtl->OfferEventL( vEvent );
    const TInt num = 23;
    TAlfCustomEventCommand event( num, iAlfCtl );
    iAlfEnv->Send( event,num );
    iAlfCtl->CancelAllCommands();
    const TPoint point( num, num );
    TBool result = iAlfCtl->HitTest( point );
    STIF_ASSERT_FALSE( result );
    
    return KErrNone;
    }
Esempio n. 16
0
void wxTextCtrl::OnChar(
  wxKeyEvent&                       rEvent
)
{
    switch (rEvent.GetKeyCode())
    {
        case WXK_RETURN:
            if ( !(m_windowStyle & wxTE_MULTILINE) )
            {
                wxCommandEvent      vEvent(wxEVT_COMMAND_TEXT_ENTER, m_windowId);

                vEvent.SetEventObject(this);
                if ( GetEventHandler()->ProcessEvent(vEvent))
                    return;
            }
            //else: multiline controls need Enter for themselves

            break;

        case WXK_TAB:
            // always produce navigation event - even if we process TAB
            // ourselves the fact that we got here means that the user code
            // decided to skip processing of this TAB - probably to let it
            // do its default job.
            //
            // NB: Notice that Ctrl-Tab is handled elsewhere and Alt-Tab is
            //     handled by Windows
            {
                wxNavigationKeyEvent    vEventNav;

                vEventNav.SetDirection(!rEvent.ShiftDown());
                vEventNav.SetWindowChange(false);
                vEventNav.SetEventObject(this);

                if ( GetEventHandler()->ProcessEvent(vEventNav) )
                    return;
            }
            break;
    }
    rEvent.Skip();
} // end of wxTextCtrl::OnChar
Esempio n. 17
0
// Pass true to show full screen, false to restore.
bool wxFrame::ShowFullScreen( bool bShow, long lStyle )
{
    if (bShow)
    {
        if (IsFullScreen())
            return false;

        m_bFsIsShowing = true;
        m_lFsStyle = lStyle;

#if wxUSE_TOOLBAR
        wxToolBar*                  pTheToolBar = GetToolBar();
#endif //wxUSE_TOOLBAR

#if wxUSE_STATUSBAR
        wxStatusBar*                pTheStatusBar = GetStatusBar();
#endif //wxUSE_STATUSBAR

        int                         nDummyWidth;

#if wxUSE_TOOLBAR
        if (pTheToolBar)
            pTheToolBar->GetSize(&nDummyWidth, &m_nFsToolBarHeight);
#endif //wxUSE_TOOLBAR

#if wxUSE_STATUSBAR
        if (pTheStatusBar)
            pTheStatusBar->GetSize(&nDummyWidth, &m_nFsStatusBarHeight);
#endif //wxUSE_STATUSBAR

#if wxUSE_TOOLBAR
        //
        // Zap the toolbar, menubar, and statusbar
        //
        if ((lStyle & wxFULLSCREEN_NOTOOLBAR) && pTheToolBar)
        {
            pTheToolBar->SetSize(wxDefaultCoord,0);
            pTheToolBar->Show(false);
        }
#endif //wxUSE_TOOLBAR

        if (lStyle & wxFULLSCREEN_NOMENUBAR)
        {
            ::WinSetParent(m_hMenu, m_hFrame, FALSE);
            ::WinSetOwner(m_hMenu, m_hFrame);
            ::WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
        }

#if wxUSE_STATUSBAR
        //
        // Save the number of fields in the statusbar
        //
        if ((lStyle & wxFULLSCREEN_NOSTATUSBAR) && pTheStatusBar)
        {
            m_nFsStatusBarFields = pTheStatusBar->GetFieldsCount();
            SetStatusBar(NULL);
            delete pTheStatusBar;
        }
        else
            m_nFsStatusBarFields = 0;
#endif //wxUSE_STATUSBAR

        //
        // Zap the frame borders
        //

        //
        // Save the 'normal' window style
        //
        m_lFsOldWindowStyle = ::WinQueryWindowULong(m_hFrame, QWL_STYLE);

        //
        // Save the old position, width & height, maximize state
        //
        m_vFsOldSize = GetRect();
        m_bFsIsMaximized = IsMaximized();

        //
        // Decide which window style flags to turn off
        //
        LONG lNewStyle = m_lFsOldWindowStyle;
        LONG lOffFlags = 0;

        if (lStyle & wxFULLSCREEN_NOBORDER)
            lOffFlags |= FCF_BORDER;
        if (lStyle & wxFULLSCREEN_NOCAPTION)
            lOffFlags |= (FCF_TASKLIST | FCF_SYSMENU);

        lNewStyle &= (~lOffFlags);

        //
        // Change our window style to be compatible with full-screen mode
        //
        ::WinSetWindowULong((HWND)m_hFrame, QWL_STYLE, (ULONG)lNewStyle);

        //
        // Resize to the size of the desktop
        int                         nWidth;
        int                         nHeight;

        RECTL                       vRect;

        ::WinQueryWindowRect(HWND_DESKTOP, &vRect);
        nWidth = vRect.xRight - vRect.xLeft;
        //
        // Remember OS/2 is backwards!
        //
        nHeight = vRect.yTop - vRect.yBottom;

        SetSize( nWidth, nHeight);

        //
        // Now flush the window style cache and actually go full-screen
        //
        ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
                          ,HWND_TOP
                          ,0
                          ,0
                          ,nWidth
                          ,nHeight
                          ,SWP_SIZE | SWP_SHOW
                         );

        wxSize sz( nWidth, nHeight );
        wxSizeEvent vEvent( sz, GetId() );

        HandleWindowEvent(vEvent);
        return true;
    }
    else
    {
        if (!IsFullScreen())
            return false;

        m_bFsIsShowing = false;

#if wxUSE_TOOLBAR
        wxToolBar*                  pTheToolBar = GetToolBar();

        //
        // Restore the toolbar, menubar, and statusbar
        //
        if (pTheToolBar && (m_lFsStyle & wxFULLSCREEN_NOTOOLBAR))
        {
            pTheToolBar->SetSize(wxDefaultCoord, m_nFsToolBarHeight);
            pTheToolBar->Show(true);
        }
#endif //wxUSE_TOOLBAR

#if wxUSE_STATUSBAR
        if ((m_lFsStyle & wxFULLSCREEN_NOSTATUSBAR) && (m_nFsStatusBarFields > 0))
        {
            CreateStatusBar(m_nFsStatusBarFields);
//          PositionStatusBar();
        }
#endif //wxUSE_STATUSBAR

        if ((m_lFsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
        {
            ::WinSetParent(m_hMenu, m_hFrame, FALSE);
            ::WinSetOwner(m_hMenu, m_hFrame);
            ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
        }
        Maximize(m_bFsIsMaximized);

        ::WinSetWindowULong( m_hFrame
                            ,QWL_STYLE
                            ,(ULONG)m_lFsOldWindowStyle
                           );
        ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
                          ,HWND_TOP
                          ,m_vFsOldSize.x
                          ,m_vFsOldSize.y
                          ,m_vFsOldSize.width
                          ,m_vFsOldSize.height
                          ,SWP_SIZE | SWP_SHOW
                         );
    }
    return wxFrameBase::ShowFullScreen(bShow, lStyle);
} // end of wxFrame::ShowFullScreen
Esempio n. 18
0
bool wxFrame::HandleSize( int nX, int nY, WXUINT nId )
{
    bool bProcessed = false;

    switch (nId)
    {
        case kSizeNormal:
            //
            // Only do it it if we were iconized before, otherwise resizing the
            // parent frame has a curious side effect of bringing it under it's
            // children
            if (!m_bIconized )
                break;

            //
            // restore all child frames too
            //
            IconizeChildFrames(false);
            (void)SendIconizeEvent(false);

            //
            // fall through
            //

        case kSizeMax:
            m_bIconized = false;
            break;

        case kSizeMin:
            //
            // Iconize all child frames too
            //
            IconizeChildFrames(true);
            (void)SendIconizeEvent();
            m_bIconized = true;
            break;
    }

    if (!m_bIconized)
    {
        //
        // forward WM_SIZE to status bar control
        //
#if wxUSE_NATIVE_STATUSBAR
        if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
        {
            wxSizeEvent             vEvent( wxSize( nX
                                                   ,nY
                                                  )
                                           ,m_frameStatusBar->GetId()
                                          );

            vEvent.SetEventObject(m_frameStatusBar);
            m_frameStatusBar->OnSize(vEvent);
        }
#endif // wxUSE_NATIVE_STATUSBAR

        PositionStatusBar();
#if  wxUSE_TOOLBAR
        PositionToolBar();
#endif // wxUSE_TOOLBAR

        bProcessed = wxWindow::HandleSize( nX
                                          ,nY
                                          ,nId
                                         );
    }
    return bProcessed;
} // end of wxFrame::HandleSize