void CMenu::ClearEntries()
{
    m_MenuList.clear();
    m_iXOffset = m_iYOffset = m_iCursorLine = 0;
    RequestUpdate();
    PushEvent(EVENT_DATACHANGED);
}
Exemple #2
0
void
wxLayoutWindow::Clear(int family,
    int size,
    int style,
    int weight,
    int underline,
    wxColour *fg,
    wxColour *bg)
{
    GetLayoutList()->Clear(family,size,style,weight,underline,fg,bg);
    SetBackgroundColour(GetLayoutList()->GetDefaultStyleInfo().GetBGColour());
    //wxScrolledWindow::Clear();
    ResizeScrollbars(true);
    SetDirty();
    SetModified(false);
    if ( m_Editable )
        m_CursorVisibility = 1;

#ifdef WXLAYOUT_USE_CARET
    if ( m_CursorVisibility == 1 )
        GetCaret()->Show();
#endif // WXLAYOUT_USE_CARET

    RequestUpdate((wxRect *)NULL);
}
void C4FullScreen::Execute()
{
	// Execute menu
	if (pMenu) pMenu->Execute();
	// Draw
	RequestUpdate();
}
void CMenu::DelEntry(const std::string &id)
{
    TMenuList::iterator line = std::lower_bound(m_MenuList.begin(), m_MenuList.end(), id);
    
    if ((line != m_MenuList.end()) && (line->id == id))
    {
        bool checklongest = (MBWidth(line->name) == m_LongestLine);
        
        if (line == m_MenuList.end()-1)
            Move(-1);
        else
            Move(1);
            
        m_MenuList.erase(line);
        
        if (checklongest)
        {
            m_LongestLine = 0;
            for (TMenuList::iterator it=m_MenuList.begin(); it!=m_MenuList.end(); it++)
                m_LongestLine = std::max(m_LongestLine, MBWidth(it->name));
        }
        
        PushEvent(EVENT_DATACHANGED);
    }
    else
        assert(false);
    
    RequestUpdate();
}
int Disc_DVD_PlusR::CloseDisc(int type, int lTrackNo)
{
   cmd_Close *cl = new cmd_Close(dio);

   cl->setType(cmd_Close::Close_FlushBuffers, 0);
   /*
    * do not let immediate go up here. immediate flush causes problems.
    */
   //cl->setImmediate(true);
   cl->Go();
   WaitOpComplete();

   if (type == DRT_Close_Track) {
      cl->setType(cmd_Close::Close_DVDPlusR_Track, lTrackNo);
   } else if (type == DRT_Close_Session) {
      cl->setType(cmd_Close::Close_DVDPlusR_LastSession, 0);
   } else if (type == DRT_Close_Finalize) {
      cl->setType(cmd_Close::Close_DVDPlusR_FinalizeNominal, 0);
   }
   int error = cl->Go();
   /*
    * do not let immediate go up here. immediate flush causes problems.
    */
   //cl->setImmediate(true);
   WaitOpComplete();
   delete cl;

//   Init();
   RequestUpdate();

   return error;
}
void CGroup::EnableWidget(CWidget *w, bool e)
{
    // Widget not initialized yet? (ignore if the group isn't initialized, since it will initialize the widget later)
    if (e && GetWin() && !w->GetWin())
        RequestUpdate();
    else if (!e && (m_pFocusedWidget == w))
        SetValidWidget(w);
}
void ClientGame::CheckSyncTimer()
{
    if (mSyncTimer.IsTime())
    {
        RequestUpdate();
        mSyncTimer.Reset(mServerUpdateLength);
    }
}
int Disc_CD_R::CloseDisc(int type, int lTrackNo)
{
   if (bWriteSAO)
   {
      if (type == DRT_Close_Track)
         return ODE_OK;
         
      cmd_Close   *cl = new cmd_Close(dio);
      cl->setType(cmd_Close::Close_FlushBuffers, 0);
      /*
       * do not let immediate go up here. immediate flush causes problems.
       */
      //cl->setImmediate(true);
      cl->Go();
      WaitOpComplete();
      delete cl;
      return ODE_OK;
   }
   else
   {
      cmd_Close        *cl       = new cmd_Close(dio);
      Page<Page_Write> &pWrite   = drive->GetWritePage();
   
      cl->setType(cmd_Close::Close_FlushBuffers, 0);
      /*
       * do not let immediate go up here. immediate flush causes problems.
       */
      //cl->setImmediate(true);
      cl->Go();
      WaitOpComplete();
   
      if (type == DRT_Close_Track) {
         cl->setType(cmd_Close::Close_CDR_Track, lTrackNo);
      } else if (type == DRT_Close_Session) {
         pWrite->SetMultisession(true);
         drive->SetPage(pWrite);
         cl->setType(cmd_Close::Close_CDR_LastSession, 0);
      } else if (type == DRT_Close_Finalize) {
         pWrite->SetMultisession(false);
         drive->SetPage(pWrite);
         cl->setType(cmd_Close::Close_CDR_LastSession, 0);
      }
      int error;
      /*
       * do not let immediate go up here. immediate flush causes problems.
       */
      //cl->setImmediate(true);
      error = cl->Go();
      WaitOpComplete();
      delete cl;
      
//      Init();
      RequestUpdate();
      return error;
   }   
}
Exemple #9
0
void
wxLayoutWindow::ScrollToCursor()
{
    //is always needed to make sure we know where the cursor is
    //if(IsDirty())
    //RequestUpdate(m_llist->GetUpdateRect());


    ResizeScrollbars();

    int x0,y0,x1,y1, dx, dy;

    // Calculate where the top of the visible area is:
    GetViewStart(&x0,&y0);
    GetScrollPixelsPerUnit(&dx, &dy);
    x0 *= dx; y0 *= dy;

    WXLO_DEBUG(("ScrollToCursor: GetViewStart is %d/%d", x0, y0));

    // Get the size of the visible window:
    GetClientSize(&x1, &y1);

    // Make sure that the scrollbars are at a position so that the cursor is
    // visible if we are editing
    WXLO_DEBUG(("m_ScrollToCursor = %d", (int) m_ScrollToCursor));
    wxPoint cc = m_llist->GetCursorScreenPos();

    // the cursor should be completely visible in both directions
    wxPoint cs(m_llist->GetCursorSize());
    int nx = -1,
        ny = -1;

    if ( cc.x < x0 || cc.x >= x0 + x1 - cs.x )
    {
        nx = cc.x - x1/2;
        if ( nx < 0 )
            nx = 0;
    }

    if ( cc.y < y0 || cc.y >= y0 + y1 - cs.y )
    {
        ny = cc.y - y1/2;
        if ( ny < 0)
            ny = 0;
    }

    if( nx != -1 || ny != -1 )
    {
        // set new view start
        Scroll(nx == -1 ? -1 : (nx+dx-1)/dx, ny == -1 ? -1 : (ny+dy-1)/dy);
        // avoid recursion
        m_ScrollToCursor = false;
        RequestUpdate();
    }
}
void CButton::SetText(const std::string &title)
{
    if (!m_pLabel)
    {
        m_pLabel = new CLabel(title);
        AddWidget(m_pLabel);
    }
    else
        m_pLabel->SetText(title);
    
    SetMinWidth(SafeConvert<int>(MBWidth(title)) + m_iExtraWidth);
//     RequestQueuedDraw();
    RequestUpdate();
}
void CWindowManager::CoreRemoveWidget(CWidget *w)
{
    TChildList::iterator it = std::find(m_ActiveWidgets.begin(), m_ActiveWidgets.end(), w);
    
    if (it != m_ActiveWidgets.end())
        m_ActiveWidgets.erase(it);
    
    std::deque<CWidget *>::iterator qit = std::find(m_WidgetQueue.begin(), m_WidgetQueue.end(), w);
    
    if (qit != m_WidgetQueue.end())
        m_WidgetQueue.erase(qit);

    RequestUpdate();
    TUI.UpdateButtonBar();
}
void CButtonBar::AddButton(std::string n, std::string d)
{
    if (!m_pCurBox)
        PushBox();
    
    n = GetTranslation(n);
    d = GetTranslation(d);
    
    std::string text = n + ": " + d;
    int width = SafeConvert<int>(MBWidth(text));

    if (m_iMaxWidth < width)
        throw Exceptions::CExFrontend("Not enough space for buttonbar entry");
    else if ((m_pCurBox->RequestWidth() + width + m_iBoxSpacing) > m_iMaxWidth)
        PushBox();
    
    PushLabel(n, d);
    RequestUpdate();
}
void
RenderingManager
::ExecutePendingHighResRenderingRequest()
{
    RenderWindowList::iterator it;
    for ( it = m_RenderWindowList.begin(); it != m_RenderWindowList.end(); ++it )
    {
        BaseRenderer *renderer = BaseRenderer::GetInstance( it->first );

        if(renderer->GetNumberOfVisibleLODEnabledMappers()>0)
        {
            if(m_NextLODMap[renderer]==0)
            {
                m_NextLODMap[renderer]=1;
                RequestUpdate( it->first );
            }
        }
    }
}
ClientGame::ClientGame(ServerProxyPtr aServerProxy, UnitId aAvatar, int32 aGridSize):
    mTileUnderCursor(NULL),
    mTime(0),
    mSyncTimer(1000),
    mServerUpdateLength(1000),
    mServerProxy(aServerProxy),
    mLifeTime(0),
    mAvatar(aAvatar),
    mFreeCamera(false)
{
    ClientGeodesicGrid grid(mTiles, aGridSize);

    // Create a light
    Ogre::Light* myLight = ClientApp::GetSceneMgr().createLight("Light0");
    myLight->setType(Ogre::Light::LT_DIRECTIONAL);
    myLight->setPosition(50, 0, 0);
    myLight->setDirection(-1, 0, 0);
    myLight->setDiffuseColour(1, 1, 1);
    myLight->setSpecularColour(1, 1, 1);

    mTileUnderCursor = mTiles.at(0);
    mSelectionMarker = ClientApp::GetSceneMgr().getRootSceneNode()->createChildSceneNode();
    mSelectionMarker->setScale(Ogre::Vector3(0.1));
    mSelectionMarker->attachObject(ClientApp::GetSceneMgr().createEntity("Marker", Ogre::SceneManager::PT_SPHERE));

    mTargetMarker = ClientApp::GetSceneMgr().getRootSceneNode()->createChildSceneNode();
    mTargetMarker->attachObject(ClientApp::GetSceneMgr().createEntity("Target", "TargetMarker.mesh"));
    mTargetMarker->setVisible(false);

    mAxes = ClientApp::GetSceneMgr().getRootSceneNode()->createChildSceneNode();
    mAxes->attachObject(ClientApp::GetSceneMgr().createEntity("axes", "axes.mesh"));

    GetWindow("StatusPanel/User")->setText(GetWindow("ServerBrowser/Login")->getText());
    GetWindow("StatusPanel/Server")->setText(GetWindow("ServerBrowser/Address")->getText());

    Hide("ServerBrowser");
    Show("StatusPanel");

    RequestUpdate();
}
void TSInfoData::RequestSelfUpdate()
{
//    TSLogging::Print("RequestSelfUpdate()");
    if (m_homeId != 0)
    {
        unsigned int error;
        int status;
        if ((error = ts3Functions.getConnectionStatus(m_homeId,&status)) != ERROR_ok)
        {
            TSLogging::Error("(TSInfoData::RequestSelfUpdate)",NULL,error,false);
            return;
        }
        // Get My Id on this handler
        anyID myID;
        if((error = ts3Functions.getClientID(m_homeId,&myID)) != ERROR_ok)
        {
            TSLogging::Error("(TSInfoData::RequestSelfUpdate)",m_homeId,error);
            return;
        }
        if (myID == (anyID)m_InfoId)
            RequestUpdate(m_homeId,myID,PLUGIN_CLIENT);
    }
}
void CBox::CoreRemoveWidget(CWidget *w)
{
    RequestUpdate();
}
void CWindowManager::CoreAddWidget(CWidget *w)
{
    m_WidgetQueue.push_back(w);
    InitChild(w);
    RequestUpdate();
}
void CMenu::AddEntry(const std::string &id, const std::string &name)
{
    m_MenuList.insert(std::lower_bound(m_MenuList.begin(), m_MenuList.end(), name), SEntry(id, name));
    m_LongestLine = std::max(m_LongestLine, MBWidth(name));
    RequestUpdate();
}
Exemple #19
0
void
wxLayoutWindow::OnChar(wxKeyEvent& event)
{
    int keyCode = event.GetKeyCode();
    bool ctrlDown = event.ControlDown();

#ifdef WXLAYOUT_DEBUG
    if(keyCode == WXK_F1)
    {
        m_llist->Debug();
        return;
    }
#endif

    // Force m_Selecting to be false if shift is no longer
    // pressed. OnKeyUp() cannot catch all Shift-Up events.
    if(m_Selecting && !event.ShiftDown())
    {
        m_Selecting = false;
        m_llist->EndSelection();
        m_llist->DiscardSelection(); //FIXME: correct?
    }

    // If we deleted the selection here, we must not execute the
    // deletion in Delete/Backspace handling.
    bool deletedSelection = false;
    // pressing any non-arrow key optionally replaces the selection:
    if(m_AutoDeleteSelection
        && IsEditable()
        && !m_Selecting
        && m_llist->HasSelection()
        && ! IsDirectionKey(keyCode)
        && ! (event.AltDown() || ctrlDown) )
    {
        m_llist->DeleteSelection();
        deletedSelection = true;
        SetDirty();
    }

    // <Shift>+<arrow> starts selection
    if ( IsDirectionKey(keyCode) )
    {
        // just continue the old selection
        if ( m_Selecting && event.ShiftDown() )
        {
            m_llist->ContinueSelection();
        }
        else
        {
            m_llist->DiscardSelection();
            m_Selecting = false;
            if( event.ShiftDown() )
            {
                m_Selecting = true;
                m_llist->StartSelection();
            }
        }
    }

    // If needed, make cursor visible:
    if(m_CursorVisibility == -1)
        m_CursorVisibility = 1;

    /* These two nested switches work like this:
       The first one processes all non-editing keycodes, to move the
       cursor, etc. It's default will process all keycodes causing
       modifications to the buffer, but only if editing is allowed.
    */
    switch(keyCode)
    {

    case WXK_RIGHT:
        if ( ctrlDown )
            m_llist->MoveCursorWord(1);
        else
            m_llist->MoveCursorHorizontally(1);
        break;

    case WXK_LEFT:
        if ( ctrlDown )
            m_llist->MoveCursorWord(-1);
        else
            m_llist->MoveCursorHorizontally(-1);

        break;

    case WXK_UP:
        m_llist->MoveCursorVertically(-1);
        break;

    case WXK_DOWN:
        m_llist->MoveCursorVertically(1);
        break;

    case WXK_PRIOR:
        m_llist->MoveCursorVertically(-Y_SCROLL_PAGE);
        break;

    case WXK_NEXT:
        m_llist->MoveCursorVertically(Y_SCROLL_PAGE);
        break;

    case WXK_HOME:
        if ( ctrlDown )
            m_llist->MoveCursorTo(wxPoint(0, 0));
        else
            m_llist->MoveCursorToBeginOfLine();
        break;

    case WXK_END:
        if ( ctrlDown )
            m_llist->MoveCursorToEnd();
        else
            m_llist->MoveCursorToEndOfLine();
        break;

    default:

        if(ctrlDown && ! IsEditable())
        {
            switch(keyCode)
            {

            case 'c':
                // this should work even in read-only mode
                Copy(true, true);
                break;

            case 's': // search
                Find(wxEmptyString);
                break;

            case 't': // search again
                FindAgain();
                break;

            default:
                // we don't handle it, maybe an accelerator?
                event.Skip();
            ;
            }
        }
        else if( IsEditable() )
        {
            /* First, handle control keys */
            if(ctrlDown && ! event.AltDown())
            {
                if(keyCode >= 'A' && keyCode <= 'Z')
                    keyCode = tolower(keyCode);

                switch(keyCode)
                {

                case WXK_INSERT:
                    Copy();
                    break;

                case WXK_DELETE :
                    if(! deletedSelection)
                    {
                        m_llist->DeleteWord();
                        SetDirty();
                    }
                    break;

                case 'd':
                    if(! deletedSelection) // already done
                    {
                        m_llist->Delete(1);
                        SetDirty();
                    }
                    break;

                case 'y':
                    m_llist->DeleteLines(1);
                    SetDirty();
                    break;

                case 'h': // like backspace
                    if(m_llist->MoveCursorHorizontally(-1))
                    {
                        m_llist->Delete(1);
                        SetDirty();
                    }
                    break;

                case 's': // search
                    Find(wxEmptyString);
                    break;

                case 't': // search again
                    FindAgain();
                    break;

                case 'u':
                    m_llist->DeleteToBeginOfLine();
                    SetDirty();
                    break;

                case 'k':
                    m_llist->DeleteToEndOfLine();
                    SetDirty();
                    break;

                case 'c':
                    Copy(true, true);
                    break;

                case 'v':
                    Paste(true);
                    break;

                case 'x':
                    Cut();
                    break;

                case 'w':
                    if(m_WrapMargin > 0)
                        m_llist->WrapLine(m_WrapMargin);
                    break;

                case 'q':
                    if(m_WrapMargin > 0)
                        m_llist->WrapAll(m_WrapMargin);
                    break;

#ifdef WXLAYOUT_DEBUG
                case WXK_F1:
                    m_llist->SetFont(-1,-1,-1,-1,true);  // underlined
                    break;

                case 'l':
                    Refresh(true);
                    break;
#endif

                default:
                    // we don't handle it, maybe an accelerator?
                    event.Skip();
                }
            }
            // ALT only:
            else if( event.AltDown() && ! event.ControlDown() )
            {
                switch(keyCode)
                {
                case WXK_DELETE:
                case 'd':
                    m_llist->DeleteWord();
                    SetDirty();
                    break;

                default:
                    // we don't handle it, maybe an accelerator?
                    event.Skip();
                }
            }
            // no control keys:
            else if ( ! event.AltDown() && ! event.ControlDown())
            {
                switch(keyCode)
                {
                case WXK_INSERT:
                    if(event.ShiftDown())
                        Paste();
                    break;

                case WXK_DELETE :
                    if(event.ShiftDown())
                    {
                        Cut();
                    }
                    else if(! deletedSelection)
                    {
                        m_llist->Delete(1);
                        SetDirty();
                    }
                    break;

                case WXK_BACK: // backspace
                    if(! deletedSelection)
                    {
                        if(m_llist->MoveCursorHorizontally(-1))
                        {
                            m_llist->Delete(1);
                            SetDirty();
                        }
                    }
                    break;

                case WXK_RETURN:
                    if (m_DoWordWrap &&
                        m_WrapMargin > 0
                        && m_llist->GetCursorPos().x > m_WrapMargin )
                    {
                        m_llist->WrapLine(m_WrapMargin);
                    }

                    m_llist->LineBreak();
                    SetDirty();
                    break;

                case WXK_TAB:
                    if ( !event.ShiftDown() )
                    {
                        // TODO should be configurable
                        static const int tabSize = 8;

                        CoordType x = m_llist->GetCursorPos().x;
                        size_t numSpaces = tabSize - x % tabSize;
                        m_llist->Insert(wxString(' ', numSpaces));
                        SetDirty();
                    }
                    break;

                default:
                    if ( ( !(event.ControlDown() || event.AltDown()) )
                        && (keyCode < 256 && keyCode >= 32) )
                    {
                        if ( m_DoWordWrap
                            && m_WrapMargin > 0
                            && m_llist->GetCursorPos().x > m_WrapMargin
                            && isspace(keyCode) )
                        {
                            m_llist->WrapLine(m_WrapMargin);
                        }

                        m_llist->Insert((wxChar)keyCode);
                        SetDirty();
                    }
                    else
                    {
                        // we don't handle it, maybe an accelerator?
                        event.Skip();
                    }
                    break;
                }

            }
        }// if(IsEditable())
        else
        {
            // we don't handle it, maybe an accelerator?
            event.Skip();
        }
    }// first switch()

    if ( m_Selecting )
    {
        // continue selection to the current (new) cursor position
        m_llist->ContinueSelection();
    }

    ScrollToCursor();
    // refresh the screen
    RequestUpdate(m_llist->GetUpdateRect());
}
Exemple #20
0
void
wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
{
    wxClientDC dc( this );
    PrepareDC( dc );
    if ( (eventId != WXLOWIN_MENU_MOUSEMOVE
#ifndef __WXMSW__
        || m_FocusFollowMode
#endif
        )
        && (wxWindow::FindFocus() != this) )
    {
        SetFocus();
    }

    wxPoint findPos;
    findPos.x = dc.DeviceToLogicalX(event.GetX());
    findPos.y = dc.DeviceToLogicalY(event.GetY());

    findPos.x -= WXLO_XOFFSET;
    findPos.y -= WXLO_YOFFSET;

    if(findPos.x < 0)
        findPos.x = 0;

    if(findPos.y < 0)
        findPos.y = 0;

    m_ClickPosition = wxPoint(event.GetX(), event.GetY());

    // Scroll the window if the mouse is at the end of it:
    if(m_Selecting && eventId == WXLOWIN_MENU_MOUSEMOVE)
    {
        //WXLO_DEBUG(("selecting at : %d/%d", (int) event.GetX(), (int)event.GetY()));
        int left, top;
        GetViewStart(&left, &top);
        wxSize size = GetClientSize();
        int xdelta, ydelta;

        if(event.GetX() < WXLO_SCROLLMARGIN_X)
            xdelta = -(WXLO_SCROLLMARGIN_X-event.GetX());
        else if(event.GetX() > size.x-WXLO_SCROLLMARGIN_X)
            xdelta = event.GetX()-size.x+WXLO_SCROLLMARGIN_X;
        else
            xdelta = 0;

        if(event.GetY() < WXLO_SCROLLMARGIN_Y)
            ydelta = -(WXLO_SCROLLMARGIN_Y-event.GetY());
        else if(event.GetY() > size.y-WXLO_SCROLLMARGIN_Y)
            ydelta = event.GetY()-size.y+WXLO_SCROLLMARGIN_Y;
        else
            ydelta = 0;

        //WXLO_DEBUG(("xdelta: %d", (int) xdelta));
        if(xdelta != 0 || ydelta != 0)
        {
            top  += ydelta; if(top < 0) top = 0;
            left += xdelta; if(left < 0) left = 0;
            Scroll(left, top);
        }
    }

    wxPoint cursorPos;
    bool found;
    wxLayoutObject *obj = m_llist->FindObjectScreen(dc, findPos,
        &cursorPos, &found);
    wxLayoutObject::UserData *u = obj ? obj->GetUserData() : NULL;

    // has the mouse only been moved?
    switch ( eventId )
    {
    case WXLOWIN_MENU_MOUSEMOVE:
    {
        // this variables is used to only erase the message in the status
        // bar if we had put it there previously - otherwise empting status
        // bar might be undesirable
#if wxUSE_STATUSBAR
        static bool s_hasPutMessageInStatusBar = false;
#endif // wxUSE_STATUSBAR

        // found is only true if we are really over an object, not just
        // behind it
        if(found && u && ! m_Selecting)
        {
            if(!m_HandCursor)
                SetCursor(wxCURSOR_HAND);
            m_HandCursor = true;
#if wxUSE_STATUSBAR
            if(m_StatusBar && m_StatusFieldLabel != -1)
            {
                const wxString &label = u->GetLabel();
                if(label.Length())
                {
                    m_StatusBar->SetStatusText(label,m_StatusFieldLabel);
                    s_hasPutMessageInStatusBar = true;
                }
            }
#endif // wxUSE_STATUSBAR
        }
        else
        {
            if(m_HandCursor)
                SetCursor(wxCURSOR_IBEAM);
            m_HandCursor = false;
#if wxUSE_STATUSBAR
            if( m_StatusBar && m_StatusFieldLabel != -1 &&
                s_hasPutMessageInStatusBar )
            {
                m_StatusBar->SetStatusText(wxEmptyString, m_StatusFieldLabel);
            }
#endif // wxUSE_STATUSBAR
        }
    }

    // selecting?
    if ( event.LeftIsDown() )
    {
        // m_Selecting might not be set if the button got pressed
        // outside this window, so check for it:
        if( m_Selecting )
        {
            m_llist->ContinueSelection(cursorPos, m_ClickPosition);
            RequestUpdate();  // TODO: we don't have to redraw everything!
        }
    }

    if ( u )
    {
        u->DecRef();
        u = NULL;
    }
    break;

    case WXLOWIN_MENU_LDOWN:
    {
        // always move cursor to mouse click:
        m_llist->MoveCursorTo(cursorPos);

        // clicking a mouse removes the selection
        if ( m_llist->HasSelection() )
        {
            m_llist->DiscardSelection();
            m_Selecting = false;
            RequestUpdate();     // TODO: we don't have to redraw everything!
        }

        // Calculate where the top of the visible area is:
        int x0, y0;
        GetViewStart(&x0,&y0);
        int dx, dy;
        GetScrollPixelsPerUnit(&dx, &dy);
        x0 *= dx; y0 *= dy;

        wxPoint offset(-x0+WXLO_XOFFSET, -y0+WXLO_YOFFSET);

        if(m_CursorVisibility == -1)
            m_CursorVisibility = 1;

#ifdef WXLAYOUT_USE_CARET
        if ( m_CursorVisibility == 1 )
            GetCaret()->Show();
#endif // WXLAYOUT_USE_CARET

        if(m_CursorVisibility)
        {
            // draw a thick cursor for editable windows with focus
            m_llist->DrawCursor(dc, m_HaveFocus && IsEditable(), offset);
        }

#ifdef __WXGTK__
        RequestUpdate(); // RequestUpdate suppresses flicker under GTK
#endif // wxGTK

        // start selection
        m_llist->StartSelection(wxPoint(-1, -1), m_ClickPosition);
        m_Selecting = true;
    }
    break;

    case WXLOWIN_MENU_LUP:
        if ( m_Selecting )
        {
            // end selection at the cursor position corresponding to the
            // current mouse position, but don´t move cursor there.
            m_llist->EndSelection(cursorPos,m_ClickPosition);
            m_Selecting = false;

            RequestUpdate();     // TODO: we don't have to redraw everything!
        }
        break;

    case WXLOWIN_MENU_MDOWN:
        Paste(true);
        break;

    case WXLOWIN_MENU_DBLCLICK:
        // select a word under cursor
        m_llist->MoveCursorTo(cursorPos);
        m_llist->MoveCursorWord(-1);
        m_llist->StartSelection();
        m_llist->MoveCursorWord(1, false);
        m_llist->EndSelection();
        m_Selecting = false;
        RequestUpdate();     // TODO: we don't have to redraw everything!
        break;
    }

    // notify about mouse events?
    if( m_doSendEvents )
    {
        // only do the menu if activated, editable and not on a clickable object
        if(eventId == WXLOWIN_MENU_RCLICK
            && IsEditable()
            && (! obj || u == NULL))
        {
            PopupMenu(m_PopupMenu, m_ClickPosition.x, m_ClickPosition.y);
            if(u) u->DecRef();
            return;
        }

        // find the object at this position
        if(obj)
        {
            wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, eventId);
            commandEvent.SetEventObject( this );
            commandEvent.SetClientData((char *)obj);
            GetEventHandler()->ProcessEvent(commandEvent);
        }
    }

    if( u ) u->DecRef();
}
Exemple #21
0
// Dali::Internal::Adaptor::Adaptor::OnDamaged
void Adaptor::OnDamaged( const DamageArea& area )
{
  // This is needed for the case where Dali window is partially obscured
  RequestUpdate();
}