本文整理汇总了C++中GetCharHeight函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCharHeight函数的具体用法?C++ GetCharHeight怎么用?C++ GetCharHeight使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCharHeight函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCharWidth
void AISTargetListDialog::RecalculateSize()
{
if(g_bresponsive){
// Make an estimate of the dialog size
wxSize esize;
esize.x = GetCharWidth() * 110;
esize.y = GetCharHeight() * 40;
wxSize dsize = gFrame->GetClientSize();
esize.y = wxMin(esize.y, dsize.y - (4 * GetCharHeight()));
esize.x = wxMin(esize.x, dsize.x - (2 * GetCharHeight()));
SetClientSize(esize);
wxSize fsize = GetSize();
fsize.y = wxMin(fsize.y, dsize.y - (2 * GetCharHeight()));
fsize.x = wxMin(fsize.x, dsize.x - (2 * GetCharHeight()));
SetSize(fsize);
if( m_pAuiManager ){
wxAuiPaneInfo &pane = m_pAuiManager->GetPane(_T("AISTargetList"));
if(pane.IsOk()){
pane.FloatingSize(fsize.x, fsize.y);
wxPoint pos = gFrame->GetScreenPosition();
pane.FloatingPosition(pos.x + (dsize.x - fsize.x)/2, pos.y + (dsize.y - fsize.y)/2);
}
m_pAuiManager->Update();
}
}
}
示例2: WindowSetCursor
void WindowSetCursor (PCONINFO con, int x, int y, bool IsKanji)
{
if (IsKanji)
ChangeCaretSize (con->hWnd, GetCCharWidth (), GetCharHeight ());
else
ChangeCaretSize (con->hWnd, GetCharWidth (), GetCharHeight ());
SetCaretPos (con->hWnd, x * GetCharWidth (), y * GetCharHeight ());
}
示例3: GetNumCols
RECT CBitmapFont::CalculateRect(int id)
{
RECT rCell;
rCell.left = (id % GetNumCols()) * GetCharWidth();
rCell.top = (id / GetNumCols()) * GetCharHeight();
rCell.right = rCell.left + GetCharWidth();
rCell.bottom = rCell.top + GetCharHeight();
return rCell;
}
示例4: while
void AISTargetAlertDialog::RecalculateSize( void )
{
// Count the lines in the currently displayed text string
unsigned int i=0;
int nline = 0;
while(i < m_alert_text.Length() ){
if(m_alert_text[i] == '\n')
nline++;
i++;
}
if(nline > m_max_nline)
m_max_nline = nline;
wxSize esize;
esize.x = GetCharWidth() * 45;
esize.y = GetCharHeight() * (m_max_nline + 4);
// SetSize(esize);
int height = m_pAlertTextCtl->GetInternalRepresentation()->GetHeight();
int adj_height = height + (GetCharHeight() * 4);
m_adj_height = wxMax(m_adj_height, adj_height);
esize.y = wxMin(esize.y, m_adj_height);
/// SetClientSize(esize);
/*
wxSize dsize = GetParent()->GetClientSize();
wxSize fsize = GetSize();
fsize.y = wxMin(fsize.y, dsize.y - (1 * GetCharHeight()));
fsize.x = wxMin(fsize.x, dsize.x - (1 * GetCharHeight()));
SetSize(fsize);
*/
if(!m_bsizeSet){
Fit(); // Sets the horizontal size OK
m_bsizeSet = true;
}
wxSize gSize = GetClientSize();
if(gSize.y != esize.y)
SetClientSize(gSize.x, esize.y);
g_Platform->PositionAISAlert( this );
}
示例5: GetBordersForSizer
void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
{
wxStaticBoxBase::GetBordersForSizer(borderTop, borderOther);
// need extra space for the label:
*borderTop += GetCharHeight();
}
示例6: GetBordersForSizer
void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
{
static int extraTop = -1; // Uninitted
static int other = 5;
if ( extraTop == -1 )
{
// The minimal border used for the top. Later on the staticbox'
// font height is added to this.
extraTop = 0;
if ( UMAGetSystemVersion() >= 0x1030 /*Panther*/ )
{
// As indicated by the HIG, Panther needs an extra border of 11
// pixels (otherwise overlapping occurs at the top). The "other"
// border has to be 11.
extraTop = 11;
other = 11;
}
}
*borderTop = extraTop + GetCharHeight();
*borderOther = other;
}
示例7: GetCharWidth
wxSize wxRadioBox::GetTotalButtonSize( const wxSize& rSizeBtn ) const
{
int nCx1;
int nCy1;
int nHeight;
int nWidth;
int nWidthLabel = 0;
nCx1 = GetCharWidth();
nCy1 = GetCharHeight();
nHeight = GetRowCount() * rSizeBtn.y + (2 * nCy1);
nWidth = GetColumnCount() * (rSizeBtn.x + nCx1) + nCx1;
//
// And also wide enough for its label
//
wxString sStr = wxGetWindowText(GetHwnd());
if (!sStr.empty())
{
GetTextExtent( sStr
,&nWidthLabel
,NULL
);
nWidthLabel += 2*nCx1;
}
if (nWidthLabel > nWidth)
nWidth = nWidthLabel;
wxSize total( nWidth, nHeight );
return total;
} // end of wxRadioBox::GetTotalButtonSize
示例8: wxASSERT_MSG
wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const
{
wxASSERT_MSG( m_widget, wxS("GetSizeFromTextSize called before creation") );
// a GtkEntry for wxComboBox and a GtkCellView for wxChoice
GtkWidget* childPart = gtk_bin_get_child(GTK_BIN(m_widget));
// Set a as small as possible size for the control, so preferred sizes
// return "natural" sizes, not taking into account the previous ones (which
// seems to be GTK+3 behaviour)
gtk_widget_set_size_request(m_widget, 0, 0);
// We are interested in the difference of sizes between the whole contol
// and its child part. I.e. arrow, separators, etc.
GtkRequisition req;
gtk_widget_get_preferred_size(childPart, NULL, &req);
wxSize totalS = GTKGetPreferredSize(m_widget);
wxSize tsize(xlen + totalS.x - req.width, totalS.y);
// For a wxChoice, not for wxComboBox, add some margins
if ( !GTK_IS_ENTRY(childPart) )
tsize.IncBy(5, 0);
// Perhaps the user wants something different from CharHeight
if ( ylen > 0 )
tsize.IncBy(0, ylen - GetCharHeight());
return tsize;
}
示例9: GetCharHeight
void wxBitmapComboBox::PostCreate()
{
m_fontHeight = GetCharHeight() + EXTRA_FONT_HEIGHT;
while ( m_bitmaps.GetCount() < GetCount() )
m_bitmaps.Add( new wxBitmap() );
}
示例10: GetCount
wxSize wxChoice::DoGetBestSize() const
{
// find the widest string
int wChoice = 0;
const unsigned int nItems = GetCount();
for ( unsigned int i = 0; i < nItems; i++ )
{
int wLine;
GetTextExtent(GetString(i), &wLine, NULL);
if ( wLine > wChoice )
wChoice = wLine;
}
// give it some reasonable default value if there are no strings in the
// list
if ( wChoice == 0 )
wChoice = 100;
// the combobox should be slightly larger than the widest string
wChoice += 5*GetCharWidth();
wxSize best(wChoice, EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight()));
CacheBestSize(best);
return best;
}
示例11: SetExtraStyle
PathProp::PathProp( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos,
const wxSize& size, long style )
{
m_opList = NULL;
m_nSelected = 0;
m_pEnroutePoint = NULL;
m_bStartNow = false;
m_pPath = NULL;
m_pEnroutePoint = NULL;
m_bStartNow = false;
#ifdef __WXOSX__
style |= wxSTAY_ON_TOP;
#endif
SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
wxFont *qFont = OCPNGetFont(_("Dialog"), 0);
SetFont( *qFont );
CreateControls();
// Make an estimate of the dialog size, without scrollbars showing
wxSize esize;
esize.x = GetCharWidth() * 110;
esize.y = GetCharHeight() * 40;
SetSize( esize );
Centre();
}
示例12: wxButton
void RainExceptionDialog::_addExtraControls()
{
m_pSaveBtn = new wxButton(this, wxID_SAVE, wxT("Copy to Clipboard"));
m_pStaticLine = new wxStaticLine(this, wxID_ANY);
m_pDetailList = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL);
m_pDetailList->InsertColumn(0, wxT("Message"));
m_pDetailList->InsertColumn(1, wxT("File"));
m_pDetailList->InsertColumn(2, wxT("Ln."));
size_t count = m_aMessages.GetCount();
for(size_t n = 0; n < count; ++n)
{
m_pDetailList->InsertItem(n, m_aMessages[n]);
m_pDetailList->SetItem(n, 1, m_aFiles[n]);
m_pDetailList->SetItem(n, 2, wxString::Format(wxT("%li"), m_aLines[n]));
}
m_pDetailList->SetColumnWidth(0, wxLIST_AUTOSIZE);
m_pDetailList->SetColumnWidth(1, wxLIST_AUTOSIZE);
m_pDetailList->SetColumnWidth(2, wxLIST_AUTOSIZE);
int height = GetCharHeight()*(count + 4);
int heightMax = wxGetDisplaySize().y - GetPosition().y - 2*GetMinHeight();
heightMax *= 9;
heightMax /= 10;
m_pDetailList->SetSize(wxDefaultCoord, wxMin(height, heightMax));
}
示例13: GetCharHeight
wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const
{
int cHeight = GetCharHeight();
// We are interested in the difference of sizes between the whole control
// and its child part. I.e. arrow, separators, etc.
wxSize tsize(xlen, 0);
// FIXME-VC6: Only VC6 needs this guard, see WINVER definition in
// include/wx/msw/wrapwin.h
#if defined(WINVER) && WINVER >= 0x0500
WinStruct<COMBOBOXINFO> info;
if ( MSWGetComboBoxInfo(&info) )
{
tsize.x += info.rcItem.left + info.rcButton.right - info.rcItem.right
+ info.rcItem.left + 3; // right and extra margins
}
else // Just use some rough approximation.
#endif // WINVER >= 0x0500
{
tsize.x += 4*cHeight;
}
// set height on our own
if( HasFlag( wxCB_SIMPLE ) )
tsize.y = SetHeightSimpleComboBox(GetCount());
else
tsize.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cHeight);
// Perhaps the user wants something different from CharHeight
if ( ylen > 0 )
tsize.IncBy(0, ylen - cHeight);
return tsize;
}
示例14: wxASSERT_MSG
wxSize wxSpinCtrlGTKBase::DoGetSizeFromTextSize(int xlen, int ylen) const
{
wxASSERT_MSG( m_widget, wxS("GetSizeFromTextSize called before creation") );
// Set an as small as possible size for the control, so preferred sizes
// return "natural" sizes, not taking into account the previous ones (which
// seems to be GTK+3 behaviour)
gtk_widget_set_size_request(m_widget, 0, 0);
// Both Gtk+2 and Gtk+3 use current value/range to measure control's width.
// So, we can't ask Gtk+ for its width. Instead, we used hardcoded values.
// Returned height is OK
wxSize totalS = GTKGetPreferredSize(m_widget);
#if GTK_CHECK_VERSION(3,4,0)
// two buttons in horizontal
totalS.x = 46 + 15; // margins included
#else
// two small buttons in vertical
totalS.x = GetFont().GetPixelSize().y + 13; // margins included
#endif
wxSize tsize(xlen + totalS.x, totalS.y);
// Check if the user requested a non-standard height.
if ( ylen > 0 )
tsize.IncBy(0, ylen - GetCharHeight());
return tsize;
}
示例15: RenderLine
void RenderLine(uint8 *pStart, float xOff, float vLineTop, float vLineBottom, int nCursor, int nSelStart, int nSelEnd, View *pcView, bool bSelected)
{
Color32_s sCursCol(40,40,40);
Color32_s sCursLineCol(255,235,186);
if( ! bSelected )
{
sCursCol = lighten_color(sCursCol);
sCursLineCol = lighten_color(sCursLineCol);
}
float vCharWidth = GetCharWidth();
float vCharHeight = GetCharHeight();
uint8 *pEnd = GetBuffer() + GetBufferLength();
static char zLine[(3 * BYTES_PER_LINE) + 1];
uint8 *p = pStart;
for( int x = 0; x < 3 * BYTES_PER_LINE; x+=3 )
{
if( p < pEnd )
{
zLine[x] = get_nibble_char(*p, true);
zLine[x + 1] = get_nibble_char(*p, false);
p++;
} else {
zLine[x] = ' ';
zLine[x + 1] = ' ';
}
zLine[x + 2] = ' ';
}
Rect cRect(xOff + GetX() + 2, vLineTop, xOff + GetX() + GetWidth() - 2, vLineBottom);
pcView->SetFgColor(Color32_s(0,0,0));
if( nSelStart < 0 )
{
if( nCursor >= 0 )
pcView->FillRect(cRect, sCursLineCol);
pcView->DrawText(cRect, zLine);
if( nCursor >= 0 )
{
float vCursorX = cRect.left + (3 * vCharWidth * nCursor);
if( m_bSecondChar )
vCursorX += vCharWidth;
pcView->SetFgColor(sCursCol);
pcView->DrawLine(Point(vCursorX, vLineTop), Point(vCursorX, vLineBottom));
vCursorX++;
pcView->DrawLine(Point(vCursorX, vLineTop), Point(vCursorX, vLineBottom));
}
}
else
{
IPoint cSel1((int)(nSelStart * 3 * vCharWidth), (int)vCharHeight);
IPoint cSel2((int)((nSelEnd * 3 * vCharWidth) + (vCharWidth * 2)), (int)vCharHeight);
pcView->DrawSelectedText(cRect, zLine, cSel1, cSel2, SEL_CHAR);
}
}