コード例 #1
0
ファイル: spinctrl.cpp プロジェクト: AlexHayton/decoda
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
{
    // hack: pretend that our HWND is the text control just for a moment
    WXHWND hWnd = GetHWND();
    wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;

    wxSpinButton::DoGetPosition(x, y);

    wxConstCast(this, wxSpinCtrl)->m_hWnd = hWnd;
}
コード例 #2
0
BSLXMLERRCODE CBSLXMLDocumentEx::SetPosition(const wxChar* pPosition)
{
    m_pLastPosition = m_pCurrentPosition;
    m_pCurrentPosition = wxConstCast(pPosition, wxChar);

    return BSLXMLERR_SUCCESS;
}
コード例 #3
0
ファイル: gdicmn.cpp プロジェクト: CodeSmithyIDE/wxWidgets
wxColour wxColourDatabase::Find(const wxString& colour) const
{
    wxColourDatabase * const self = wxConstCast(this, wxColourDatabase);
    self->Initialize();

    // make the comparaison case insensitive and also match both grey and gray
    wxString colName = colour;
    colName.MakeUpper();
    wxString colNameAlt = colName;
    if ( !colNameAlt.Replace(wxT("GRAY"), wxT("GREY")) )
        colNameAlt.clear();

    wxStringToColourHashMap::iterator it = m_map->find(colName);
    if ( it == m_map->end() && !colNameAlt.empty() )
        it = m_map->find(colNameAlt);
    if ( it != m_map->end() )
        return *(it->second);

    // we did not find any result in existing colours:
    // we won't use wxString -> wxColour conversion because the
    // wxColour::Set(const wxString &) function which does that conversion
    // internally uses this function (wxColourDatabase::Find) and we want
    // to avoid infinite recursion !
    return wxNullColour;
}
コード例 #4
0
wxSize wxButton::DoGetBestClientSize() const
{
    wxClientDC dc(wxConstCast(this, wxButton));
    wxCoord width, height;
    dc.GetMultiLineTextExtent(GetLabel(), &width, &height);

    if ( m_bitmap.Ok() )
    {
        // allocate extra space for the bitmap
        wxCoord heightBmp = m_bitmap.GetHeight() + 2*m_marginBmpY;
        if ( height < heightBmp )
            height = heightBmp;

        width += m_bitmap.GetWidth() + 2*m_marginBmpX;
    }

    // The default size should not be adjusted, so the code is moved into the
    // renderer. This is conceptual wrong but currently the only solution.
    // (Otto Wyss, Patch 664399)

/*
    // for compatibility with other ports, the buttons default size is never
    // less than the standard one, but not when display not PDAs.
    if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA)
    {
        if ( !(GetWindowStyle() & wxBU_EXACTFIT) )
        {
            wxSize szDef = GetDefaultSize();
            if ( width < szDef.x )
                width = szDef.x;
        }
    }
*/
    return wxSize(width, height);
}
コード例 #5
0
wxHtmlCell *wxHtmlCell::GetRootCell() const
{
    wxHtmlCell *c = wxConstCast(this, wxHtmlCell);
    while ( c->m_Parent )
        c = c->m_Parent;
    return c;
}
コード例 #6
0
void ContentBoxCtrol::CacheItem(size_t n) const
{
    if ( !m_cache->Has(n) )
    {
        if ( !m_htmlParser )
        {
            ContentBoxCtrol *self = wxConstCast(this, ContentBoxCtrol);

            self->m_htmlParser = LENMUS_NEW wxHtmlWinParser(self);
            LMB_TagHandler* pTagHandler = LENMUS_NEW LMB_TagHandler(m_appScope);
            m_htmlParser->AddTagHandler(pTagHandler);

            m_htmlParser->SetDC(LENMUS_NEW wxClientDC(self));
            m_htmlParser->SetFS(&self->m_filesystem);

            // use system's default GUI font by default:
            m_htmlParser->SetFontFace("Tahoma");
            m_htmlParser->SetFontSize(10);
            //m_htmlParser->SetStandardFonts();
        }

        wxHtmlContainerCell *cell = (wxHtmlContainerCell *)m_htmlParser->
                Parse(OnGetItemMarkup(n));
        wxCHECK_RET( cell, "wxHtmlParser::Parse() returned NULL?" );

        // set the cell's ID to item's index so that CellCoordsToPhysical()
        // can quickly find the item:
        cell->SetId(wxString::Format("%lu", (unsigned long)n));

        cell->Layout(GetClientSize().x - 2*GetMargins().x);

        m_cache->Store(n, cell);
    }
}
コード例 #7
0
wxSize StripMenuButton::GetTextSize()
{
	wxClientDC dc(wxConstCast(this, StripMenuButton));
	wxCoord width, height;
	dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
	return wxSize(width, height);	
}
コード例 #8
0
ファイル: stattextg.cpp プロジェクト: jonntd/dynamica
wxSize wxGenericStaticText::DoGetBestClientSize() const
{
    wxClientDC dc(wxConstCast(this, wxGenericStaticText));
    wxCoord width, height;
    dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
    return wxSize(width, height);
}
コード例 #9
0
ファイル: app.cpp プロジェクト: 3v1n0/wxWidgets
wxVideoMode wxApp::GetDisplayMode() const
{
    if ( !m_videoMode.IsOk() )
        wxConstCast(this, wxApp)->m_videoMode = GetCurrentVideoMode();

    return m_videoMode;
}
コード例 #10
0
ファイル: dib.cpp プロジェクト: BloodRedd/gamekit
void wxDIB::DoGetObject() const
{
    // only do something if we have a valid DIB but we don't [yet] have valid
    // data
    if ( m_handle && !m_data )
    {
        // although all the info we need is in BITMAP and so we don't really
        // need DIBSECTION we still ask for it as modifying the bit values only
        // works for the real DIBs and not for the bitmaps and it's better to
        // check for this now rather than trying to find out why it doesn't
        // work later
        DIBSECTION ds;
        if ( !GetDIBSection(m_handle, &ds) )
        {
            wxLogLastError(wxT("GetObject(hDIB)"));
            return;
        }

        wxDIB *self = wxConstCast(this, wxDIB);

        self->m_width = ds.dsBm.bmWidth;
        self->m_height = ds.dsBm.bmHeight;
        self->m_depth = ds.dsBm.bmBitsPixel;
        self->m_data = ds.dsBm.bmBits;
    }
}
コード例 #11
0
ファイル: htmllbox.cpp プロジェクト: beanhome/dev
void wxHtmlListBox::CacheItem(size_t n) const
{
    if ( !m_cache->Has(n) )
    {
        if ( !m_htmlParser )
        {
            wxHtmlListBox *self = wxConstCast(this, wxHtmlListBox);

            self->m_htmlParser = new wxHtmlWinParser(self);
            m_htmlParser->SetDC(new wxClientDC(self));
            m_htmlParser->SetFS(&self->m_filesystem);
#if !wxUSE_UNICODE
            if (GetFont().IsOk())
                m_htmlParser->SetInputEncoding(GetFont().GetEncoding());
#endif
            // use system's default GUI font by default:
            m_htmlParser->SetStandardFonts();
        }

        wxHtmlContainerCell *cell = (wxHtmlContainerCell *)m_htmlParser->
                                    Parse(OnGetItemMarkup(n));
        wxCHECK_RET( cell, wxT("wxHtmlParser::Parse() returned NULL?") );

        // set the cell's ID to item's index so that CellCoordsToPhysical()
        // can quickly find the item:
        cell->SetId(wxString::Format(wxT("%lu"), (unsigned long)n));

        cell->Layout(GetClientSize().x - 2*GetMargins().x);

        m_cache->Store(n, cell);
    }
}
コード例 #12
0
ファイル: fontmgrcmn.cpp プロジェクト: BauerBox/wxWidgets
wxFontInstance *
wxFontMgrFontRefData::GetFontInstance(float scale, bool antialiased) const
{
    wxConstCast(this, wxFontMgrFontRefData)->EnsureValidFont();
    return m_fontFace->GetFontInstance(m_info.pointSize * scale,
                                       antialiased);
}
コード例 #13
0
ファイル: AlListBox.cpp プロジェクト: anonbeat/guayadeque
// -------------------------------------------------------------------------------- //
wxCoord guAlListBox::OnMeasureItem( size_t n ) const
{
    // Code taken from the generic/listctrl.cpp file
    guAlListBox * self = wxConstCast( this, guAlListBox );

    self->SetItemHeight( ALLISTBOX_ITEM_SIZE );
    return wxCoord( ALLISTBOX_ITEM_SIZE );
}
コード例 #14
0
ファイル: wxgui.cpp プロジェクト: tchv71/StartPP
// static
wxDocVector wxTrunkDocView::GetDocumentsVector(const wxDocManager& docManager)
{
    wxDocVector docs;
    const wxList& list = wxConstCast(&docManager, wxDocManager)->GetDocuments();

    for (wxList::const_iterator it = list.begin(); it != list.end(); it++)
        docs.push_back(wxStaticCast(*it, wxDocument));
    return docs;
}
コード例 #15
0
int wxListBox::GetItemsPerPage() const
{
    if ( !m_itemsPerPage )
    {
        wxConstCast(this, wxListBox)->CalcItemsPerPage();
    }

    return m_itemsPerPage;
}
コード例 #16
0
wxCoord wxListBox::GetLineHeight() const
{
    if ( !m_lineHeight )
    {
        wxConstCast(this, wxListBox)->CalcItemsPerPage();
    }

    return m_lineHeight;
}
コード例 #17
0
ファイル: filesys.cpp プロジェクト: BauerBox/wxWidgets
const wxString& wxFSFile::GetMimeType() const
{
    if ( m_MimeType.empty() && !m_Location.empty() )
    {
        wxConstCast(this, wxFSFile)->m_MimeType =
            wxFileSystemHandler::GetMimeTypeFromExt(m_Location);
    }

    return m_MimeType;
}
コード例 #18
0
ファイル: stattext.cpp プロジェクト: AlexHayton/decoda
wxSize wxStaticText::DoGetBestClientSize() const
{
    wxStaticText *self = wxConstCast(this, wxStaticText);
    wxClientDC dc(self);
    dc.SetFont(GetFont());
    wxCoord width, height;
    dc.GetMultiLineTextExtent(GetLabel(), &width, &height);

    return wxSize(width, height);
}
コード例 #19
0
ファイル: dc.cpp プロジェクト: hgwells/tive
void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
                           wxCoord *descent, wxCoord *externalLeading,
                           wxFont *theFont) const
{
    wxCHECK_RET( Ok(), wxT("invalid dc") );
    wxCHECK_RET( m_font.Ok(), wxT("no font selected") );
    wxCHECK_RET( !theFont || theFont->Ok(), wxT("invalid font") );

    wxFont oldFont;
    if ( theFont != NULL )
    {
        oldFont = m_font;
        wxConstCast(this, wxDC)->SetFont(*theFont);
    }

    wxCoord xx = 0, yy = 0;
    DFBRectangle rect;
    wxIDirectFBFontPtr f = GetCurrentFont();

    if ( f->GetStringExtents(wxSTR_TO_DFB(string), -1, &rect, NULL) )
    {
        // VS: YDEV is corrent, it should *not* be XDEV, because font's are
        //     only scaled according to m_scaleY
        xx = YDEV2LOGREL(rect.w);
        yy = YDEV2LOGREL(rect.h);

        if ( descent )
        {
            int d;
            if ( f->GetDescender(&d) )
                *descent = YDEV2LOGREL(-d);
            else
                *descent = 0;
        }
    }

    if ( x ) *x = xx;
    if ( y ) *y = yy;
    if ( externalLeading ) *externalLeading = 0;

    if ( theFont != NULL )
        wxConstCast(this, wxDC)->SetFont(oldFont);
}
コード例 #20
0
ファイル: htmlcell.cpp プロジェクト: gitrider/wxsj2
wxHtmlCell *wxHtmlCell::FindCellByPos(wxCoord x, wxCoord y,
                                      unsigned flags) const
{
    if ( x >= 0 && x < m_Width && y >= 0 && y < m_Height )
    {
        return wxConstCast(this, wxHtmlCell);
    }
    else
    {
        if ((flags & wxHTML_FIND_NEAREST_AFTER) &&
                (y < 0 || (y < 0+m_Height && x < 0+m_Width)))
            return wxConstCast(this, wxHtmlCell);
        else if ((flags & wxHTML_FIND_NEAREST_BEFORE) &&
                 (y >= 0+m_Height || (y >= 0 && x >= 0)))
            return wxConstCast(this, wxHtmlCell);
        else
            return NULL;
    }
}
コード例 #21
0
ファイル: mimetype.cpp プロジェクト: Kaoswerk/newton-dynamics
size_t wxFileTypeImpl::GetAllCommands(wxArrayString *verbs,
                                      wxArrayString *commands,
                                      const wxFileType::MessageParameters& params) const
{
    wxCHECK_MSG( !m_ext.empty(), 0, wxT("GetAllCommands() needs an extension") );

    if ( m_strFileType.empty() )
    {
        // get it from the registry
        wxFileTypeImpl *self = wxConstCast(this, wxFileTypeImpl);
        wxRegKey rkey(wxRegKey::HKCR, m_ext);
        if ( !rkey.Exists() || !rkey.QueryValue(wxEmptyString, self->m_strFileType) )
        {
            wxLogDebug(wxT("Can't get the filetype for extension '%s'."),
                       m_ext.c_str());

            return 0;
        }
    }

    // enum all subkeys of HKCR\filetype\shell
    size_t count = 0;
    wxRegKey rkey(wxRegKey::HKCR, m_strFileType  + wxT("\\shell"));
    long dummy;
    wxString verb;
    bool ok = rkey.GetFirstKey(verb, dummy);
    while ( ok )
    {
        wxString command = wxFileType::ExpandCommand(GetCommand(verb), params);

        // we want the open bverb to eb always the first

        if ( verb.CmpNoCase(wxT("open")) == 0 )
        {
            if ( verbs )
                verbs->Insert(verb, 0);
            if ( commands )
                commands->Insert(command, 0);
        }
        else // anything else than "open"
        {
            if ( verbs )
                verbs->Add(verb);
            if ( commands )
                commands->Add(command);
        }

        count++;

        ok = rkey.GetNextKey(verb, dummy);
    }

    return count;
}
コード例 #22
0
ファイル: stattextg.cpp プロジェクト: Anonymous2/project64
wxSize wxGenericStaticText::DoGetBestClientSize() const
{
    wxClientDC dc(wxConstCast(this, wxGenericStaticText));

#if wxUSE_MARKUP
    if ( m_markupText )
        return m_markupText->Measure(dc);
#endif // wxUSE_MARKUP

    return dc.GetMultiLineTextExtent(GetLabel());
}
コード例 #23
0
BSLXMLERRCODE CBSLXMLDocumentEx::SetDocument(const wxChar* pszDocument)
{
    if (NULL == pszDocument)
    {
        return BSLXMLERR_INVALID_PARAMETER;
    }

    Clear();
    m_strDocument = pszDocument;
    m_pCurrentPosition = wxConstCast(m_strDocument.wx_str(), wxChar);

    return BSLXMLERR_SUCCESS;
}
コード例 #24
0
ファイル: sound_sdl.cpp プロジェクト: EEmmanuel7/wxWidgets
bool wxSoundBackendSDL::IsAvailable() const
{
    if (m_initialized)
        return true;
    if (SDL_WasInit(SDL_INIT_AUDIO) != SDL_INIT_AUDIO)
    {
        if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) == -1)
            return false;
    }
    wxConstCast(this, wxSoundBackendSDL)->m_initialized = true;
    wxLogTrace(wxT("sound"), wxT("initialized SDL audio subsystem"));
    return true;
}
コード例 #25
0
BSLXMLERRCODE CBSLXMLDocumentEx::SetDocument(const wxString& strDocument)
{
    if (strDocument.IsEmpty())
    {
        return BSLXMLERR_INVALID_PARAMETER;
    }

    Clear();
    m_strDocument = strDocument;
    m_pCurrentPosition = wxConstCast(m_strDocument.wx_str(), wxChar);

    return BSLXMLERR_SUCCESS;
}
コード例 #26
0
ファイル: regex.cpp プロジェクト: DumaGit/winsparkle
bool wxRegExImpl::Matches(const wxRegChar *str,
                          int flags
                          WXREGEX_IF_NEED_LEN(size_t len)) const
{
    wxCHECK_MSG( IsValid(), false, wxT("must successfully Compile() first") );

    // translate our flags to regexec() ones
    wxASSERT_MSG( !(flags & ~(wxRE_NOTBOL | wxRE_NOTEOL)),
                  wxT("unrecognized flags in wxRegEx::Matches") );

    int flagsRE = 0;
    if ( flags & wxRE_NOTBOL )
        flagsRE |= REG_NOTBOL;
    if ( flags & wxRE_NOTEOL )
        flagsRE |= REG_NOTEOL;

    // allocate matches array if needed
    wxRegExImpl *self = wxConstCast(this, wxRegExImpl);
    if ( !m_Matches && m_nMatches )
    {
        self->m_Matches = new wxRegExMatches(m_nMatches);
    }

    wxRegExMatches::match_type matches = m_Matches ? m_Matches->get() : NULL;

    // do match it
#if defined WXREGEX_USING_BUILTIN
    int rc = wx_re_exec(&self->m_RegEx, str, len, NULL, m_nMatches, matches, flagsRE);
#elif defined WXREGEX_USING_RE_SEARCH
    int rc = str ? ReSearch(&self->m_RegEx, str, len, matches, flagsRE) : REG_BADPAT;
#else
    int rc = str ? regexec(&self->m_RegEx, str, m_nMatches, matches, flagsRE) : REG_BADPAT;
#endif

    switch ( rc )
    {
        case 0:
            // matched successfully
            return true;

        default:
            // an error occurred
            wxLogError(_("Failed to find match for regular expression: %s"),
                       GetErrorMsg(rc, !str).c_str());
            // fall through

        case REG_NOMATCH:
            // no match
            return false;
    }
}
コード例 #27
0
ファイル: statusbr.cpp プロジェクト: 252525fb/rpcs3
  // Get the position and size of the field's internal bounding rectangle
bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const
{
    wxCHECK_MSG( (n >= 0) && (n < m_nFields), false,
                 _T("invalid status bar field index") );

    // FIXME: workarounds for OS/2 bugs have nothing to do here (VZ)
    int width, height;
#ifdef __WXPM__
    GetSize(&width, &height);
#else
    GetClientSize(&width, &height);
#endif

    // we cache m_widthsAbs between calls and recompute it if client
    // width has changed (or when it is initially empty)
    if ( m_widthsAbs.IsEmpty() || (m_lastClientWidth != width) )
    {
        wxConstCast(this, wxStatusBarGeneric)->
            m_widthsAbs = CalculateAbsWidths(width);
        // remember last width for which we have recomputed the widths in pixels
        wxConstCast(this, wxStatusBarGeneric)->
            m_lastClientWidth = width;
    }

    rect.x = 0;
    for ( int i = 0; i < n; i++ )
    {
        rect.x += m_widthsAbs[i];
    }

    rect.x += m_borderX;
    rect.y = m_borderY;

    rect.width = m_widthsAbs[n] - 2*m_borderX;
    rect.height = height - 2*m_borderY;

    return true;
}
コード例 #28
0
ファイル: PLSoListBox.cpp プロジェクト: anonbeat/guayadeque
// -------------------------------------------------------------------------------- //
int guPLSoListBox::GetSelectedSongs( guTrackArray * tracks, const bool isdrag ) const
{
    unsigned long cookie;
    guPLSoListBox * self = wxConstCast( this, guPLSoListBox );
    self->m_ItemsMutex.Lock();
    int item = GetFirstSelected( cookie );
    while( item != wxNOT_FOUND )
    {
        tracks->Add( new guTrack( m_Items[ item ] ) );
        item = GetNextSelected( cookie );
    }
    self->m_ItemsMutex.Unlock();
    return tracks->Count();
}
コード例 #29
0
ファイル: spinctrl.cpp プロジェクト: EEmmanuel7/wxWidgets
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
{
    // Because both subcontrols are mirrored manually
    // (for layout direction purposes, see note)
    // and leftmost control can be either spin or buddy text
    // we need to get positions for both controls
    // and return this with lower horizonal value.
    // Note:
    // Logical positions in manual mirroring:
    // our layout == parent layout  =>  x(Text) < x(Button)
    // our layout != parent layout  =>  x(Button) < x(Text)

    // hack: pretend that our HWND is the text control just for a moment
    int xBuddy;
    WXHWND hWnd = GetHWND();
    wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;
    wxSpinButton::DoGetPosition(&xBuddy, y);

    int xText;
    wxConstCast(this, wxSpinCtrl)->m_hWnd = hWnd;
    wxSpinButton::DoGetPosition(&xText, y);

    *x = wxMin(xBuddy, xText);
}
コード例 #30
0
ファイル: gdicmn.cpp プロジェクト: CodeSmithyIDE/wxWidgets
wxString wxColourDatabase::FindName(const wxColour& colour) const
{
    wxColourDatabase * const self = wxConstCast(this, wxColourDatabase);
    self->Initialize();

    typedef wxStringToColourHashMap::iterator iterator;

    for ( iterator it = m_map->begin(), en = m_map->end(); it != en; ++it )
    {
        if ( *(it->second) == colour )
            return it->first;
    }

    return wxEmptyString;
}