本文整理汇总了C++中wxFAIL_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ wxFAIL_MSG函数的具体用法?C++ wxFAIL_MSG怎么用?C++ wxFAIL_MSG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxFAIL_MSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WXUNUSED
void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
{
wxFAIL_MSG( wxT("DoMoveWindow called for wxTopLevelWindowGTK") );
}
示例2: wxFAIL_MSG
wxSizerItem* wxGridBagSizer::Prepend( wxWindow *, int, int, int, wxObject* )
{
wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer."));
return NULL;
}
示例3: WXUNUSED
void wxPen::SetStipple(const wxBitmap& WXUNUSED(stipple))
{
wxFAIL_MSG( "stippled pens not supported" );
}
示例4: wxCHECK_MSG
wxImage wxDIB::ConvertToImage() const
{
wxCHECK_MSG( IsOk(), wxNullImage,
wxT("can't convert invalid DIB to wxImage") );
// create the wxImage object
const int w = GetWidth();
const int h = GetHeight();
wxImage image(w, h, false /* don't bother clearing memory */);
if ( !image.IsOk() )
{
wxFAIL_MSG( wxT("could not allocate data for image") );
return wxNullImage;
}
const int bpp = GetDepth();
// Remember if we have any "real" transparency, i.e. either any partially
// transparent pixels or not all pixels are fully opaque or fully
// transparent.
bool hasAlpha = false;
bool hasOpaque = false;
bool hasTransparent = false;
if ( bpp == 32 )
{
// 32 bit bitmaps may be either 0RGB or ARGB and we don't know in
// advance which one do we have so suppose we have alpha of them and
// get rid of it later if it turns out we didn't.
image.SetAlpha();
}
// this is the same loop as in Create() just above but with copy direction
// reversed
const int dstBytesPerLine = w * 3;
const int srcBytesPerLine = GetLineSize(w, bpp);
unsigned char *dst = image.GetData() + ((h - 1) * dstBytesPerLine);
unsigned char *alpha = image.HasAlpha() ? image.GetAlpha() + (h - 1)*w
: NULL;
const unsigned char *srcLineStart = (unsigned char *)GetData();
for ( int y = 0; y < h; y++ )
{
// copy one DIB line
const unsigned char *src = srcLineStart;
for ( int x = 0; x < w; x++ )
{
dst[2] = *src++;
dst[1] = *src++;
dst[0] = *src++;
if ( bpp == 32 )
{
// wxImage uses non premultiplied alpha so undo
// premultiplication done in Create() above
const unsigned char a = *src;
*alpha++ = a;
// Check what kind of alpha do we have.
switch ( a )
{
case 0:
hasTransparent = true;
break;
default:
// Anything in between means we have real transparency
// and must use alpha channel.
hasAlpha = true;
break;
case 255:
hasOpaque = true;
break;
}
if ( a > 0 )
{
dst[0] = (dst[0] * 255) / a;
dst[1] = (dst[1] * 255) / a;
dst[2] = (dst[2] * 255) / a;
}
src++;
}
dst += 3;
}
// pass to the previous line in the image
dst -= 2*dstBytesPerLine;
if ( alpha )
alpha -= 2*w;
// and to the next one in the DIB
srcLineStart += srcBytesPerLine;
}
if ( hasOpaque && hasTransparent )
hasAlpha = true;
//.........这里部分代码省略.........
示例5: wxGenericFileDialog
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir,
const wxString& defaultFileName,
const wxString& wildCard,
long style, const wxPoint& pos,
const wxSize& sz,
const wxString& name)
: wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
wildCard, style, pos, sz, name, true )
{
if (gtk_check_version(2,4,0))
{
wxGenericFileDialog::Create( parent, message, defaultDir,
defaultFileName, wildCard, style, pos );
return;
}
m_needParent = false;
if (!PreCreation(parent, pos, wxDefaultSize) ||
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
wxDefaultValidator, wxT("filedialog")))
{
wxFAIL_MSG( wxT("wxFileDialog creation failed") );
return;
}
GtkFileChooserAction gtk_action;
GtkWindow* gtk_parent = NULL;
if (parent)
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
const gchar* ok_btn_stock;
if ( style & wxFD_SAVE )
{
gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
ok_btn_stock = GTK_STOCK_SAVE;
}
else
{
gtk_action = GTK_FILE_CHOOSER_ACTION_OPEN;
ok_btn_stock = GTK_STOCK_OPEN;
}
m_widget = gtk_file_chooser_dialog_new(
wxGTK_CONV(m_message),
gtk_parent,
gtk_action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
ok_btn_stock, GTK_RESPONSE_ACCEPT,
NULL);
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
if ( style & wxFD_MULTIPLE )
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), true);
// gtk_widget_hide_on_delete is used here to avoid that Gtk automatically
// destroys the dialog when the user press ESC on the dialog: in that case
// a second call to ShowModal() would result in a bunch of Gtk-CRITICAL
// errors...
g_signal_connect (G_OBJECT(m_widget),
"delete_event",
G_CALLBACK (gtk_widget_hide_on_delete),
(gpointer)this);
// local-only property could be set to false to allow non-local files to be
// loaded. In that case get/set_uri(s) should be used instead of
// get/set_filename(s) everywhere and the GtkFileChooserDialog should
// probably also be created with a backend, e.g "gnome-vfs", "default", ...
// (gtk_file_chooser_dialog_new_with_backend). Currently local-only is kept
// as the default - true:
// gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
g_signal_connect (m_widget, "response",
G_CALLBACK (gtk_filedialog_response_callback), this);
SetWildcard(wildCard);
// if defaultDir is specified it should contain the directory and
// defaultFileName should contain the default name of the file, however if
// directory is not given, defaultFileName contains both
wxFileName fn;
if ( defaultDir.empty() )
fn.Assign(defaultFileName);
else if ( !defaultFileName.empty() )
fn.Assign(defaultDir, defaultFileName);
// set the initial file name and/or directory
wxString fname = fn.GetFullName();
if ( fname.empty() )
{
wxString dir = fn.GetPath();
if ( !dir.empty() )
{
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
dir.fn_str());
}
}
//.........这里部分代码省略.........
示例6: wxFAIL_MSG
bool wxListBox::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxValidator& validator,
const wxString &name )
{
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxListBox creation failed") );
return false;
}
m_widget = gtk_scrolled_window_new( NULL, NULL );
g_object_ref(m_widget);
if (style & wxLB_ALWAYS_SB)
{
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
}
else
{
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
}
GTKScrolledWindowSetBorder(m_widget, style);
m_treeview = GTK_TREE_VIEW( gtk_tree_view_new( ) );
//wxListBox doesn't have a header :)
//NB: If enabled SetFirstItem doesn't work correctly
gtk_tree_view_set_headers_visible(m_treeview, FALSE);
#if wxUSE_CHECKLISTBOX
if(m_hasCheckBoxes)
((wxCheckListBox*)this)->DoCreateCheckList();
#endif // wxUSE_CHECKLISTBOX
// Create the data column
gtk_tree_view_insert_column_with_attributes(m_treeview, -1, "",
gtk_cell_renderer_text_new(),
"text",
WXLISTBOX_DATACOLUMN, NULL);
// Now create+set the model (GtkListStore) - first argument # of columns
#if wxUSE_CHECKLISTBOX
if(m_hasCheckBoxes)
m_liststore = gtk_list_store_new(2, G_TYPE_BOOLEAN,
GTK_TYPE_TREE_ENTRY);
else
#endif
m_liststore = gtk_list_store_new(1, GTK_TYPE_TREE_ENTRY);
gtk_tree_view_set_model(m_treeview, GTK_TREE_MODEL(m_liststore));
g_object_unref (m_liststore); //free on treeview destruction
// Disable the pop-up textctrl that enables searching - note that
// the docs specify that even if this disabled (which we are doing)
// the user can still have it through the start-interactive-search
// key binding...either way we want to provide a searchequal callback
// NB: If this is enabled a doubleclick event (activate) gets sent
// on a successful search
gtk_tree_view_set_search_column(m_treeview, WXLISTBOX_DATACOLUMN);
gtk_tree_view_set_search_equal_func(m_treeview,
(GtkTreeViewSearchEqualFunc) gtk_listbox_searchequal_callback,
this,
NULL);
gtk_tree_view_set_enable_search(m_treeview, FALSE);
GtkSelectionMode mode;
// GTK_SELECTION_EXTENDED is a deprecated synonym for GTK_SELECTION_MULTIPLE
if ( style & (wxLB_MULTIPLE | wxLB_EXTENDED) )
{
mode = GTK_SELECTION_MULTIPLE;
}
else // no multi-selection flags specified
{
m_windowStyle |= wxLB_SINGLE;
mode = GTK_SELECTION_SINGLE;
}
GtkTreeSelection* selection = gtk_tree_view_get_selection( m_treeview );
gtk_tree_selection_set_mode( selection, mode );
// Handle sortable stuff
if(HasFlag(wxLB_SORT))
{
// Setup sorting in ascending (wx) order
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(m_liststore),
WXLISTBOX_DATACOLUMN,
GTK_SORT_ASCENDING);
// Set the sort callback
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(m_liststore),
WXLISTBOX_DATACOLUMN,
(GtkTreeIterCompareFunc) gtk_listbox_sort_callback,
//.........这里部分代码省略.........
示例7: wxGetFontEncFromCharSet
wxFontEncoding wxGetFontEncFromCharSet(int cs)
{
wxFontEncoding fontEncoding;
switch ( cs )
{
default:
wxFAIL_MSG( _T("unexpected Win32 charset") );
// fall through and assume the system charset
case DEFAULT_CHARSET:
fontEncoding = wxFONTENCODING_SYSTEM;
break;
case ANSI_CHARSET:
fontEncoding = wxFONTENCODING_CP1252;
break;
case SYMBOL_CHARSET:
// what can we do here?
fontEncoding = wxFONTENCODING_MAX;
break;
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
case EASTEUROPE_CHARSET:
fontEncoding = wxFONTENCODING_CP1250;
break;
case BALTIC_CHARSET:
fontEncoding = wxFONTENCODING_CP1257;
break;
case RUSSIAN_CHARSET:
fontEncoding = wxFONTENCODING_CP1251;
break;
case ARABIC_CHARSET:
fontEncoding = wxFONTENCODING_CP1256;
break;
case GREEK_CHARSET:
fontEncoding = wxFONTENCODING_CP1253;
break;
case HEBREW_CHARSET:
fontEncoding = wxFONTENCODING_CP1255;
break;
case TURKISH_CHARSET:
fontEncoding = wxFONTENCODING_CP1254;
break;
case THAI_CHARSET:
fontEncoding = wxFONTENCODING_CP874;
break;
case SHIFTJIS_CHARSET:
fontEncoding = wxFONTENCODING_CP932;
break;
case GB2312_CHARSET:
fontEncoding = wxFONTENCODING_CP936;
break;
case HANGUL_CHARSET:
fontEncoding = wxFONTENCODING_CP949;
break;
case CHINESEBIG5_CHARSET:
fontEncoding = wxFONTENCODING_CP950;
break;
#endif // Win32
case OEM_CHARSET:
fontEncoding = wxFONTENCODING_CP437;
break;
}
return fontEncoding;
}
示例8: GetBestSize
bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)item;
if ( !IsOwnerDrawn() || dis->CtlType != ODT_BUTTON )
return wxCheckBoxBase::MSWOnDraw(item);
// calculate the rectangles for the check mark itself and the label
HDC hdc = dis->hDC;
RECT& rect = dis->rcItem;
RECT rectCheck,
rectLabel;
rectCheck.top =
rectLabel.top = rect.top;
rectCheck.bottom =
rectLabel.bottom = rect.bottom;
const int checkSize = GetBestSize().y;
const int MARGIN = 3;
const bool isRightAligned = HasFlag(wxALIGN_RIGHT);
if ( isRightAligned )
{
rectCheck.right = rect.right;
rectCheck.left = rectCheck.right - checkSize;
rectLabel.right = rectCheck.left - MARGIN;
rectLabel.left = rect.left;
}
else // normal, left-aligned checkbox
{
rectCheck.left = rect.left;
rectCheck.right = rectCheck.left + checkSize;
rectLabel.left = rectCheck.right + MARGIN;
rectLabel.right = rect.right;
}
// show we draw a focus rect?
const bool isFocused = m_isPressed || FindFocus() == this;
// draw the checkbox itself: note that this should really, really be in
// wxRendererNative but unfortunately we can't add a new virtual function
// to it without breaking backwards compatibility
// classic Win32 version -- this can be useful when we move this into
// wxRendererNative
#if defined(__WXWINCE__) || !wxUSE_UXTHEME
UINT state = DFCS_BUTTONCHECK;
if ( !IsEnabled() )
state |= DFCS_INACTIVE;
switch ( Get3StateValue() )
{
case wxCHK_CHECKED:
state |= DFCS_CHECKED;
break;
case wxCHK_UNDETERMINED:
state |= DFCS_PUSHED;
break;
default:
wxFAIL_MSG( _T("unexpected Get3StateValue() return value") );
// fall through
case wxCHK_UNCHECKED:
// no extra styles needed
break;
}
if ( wxFindWindowAtPoint(wxGetMousePosition()) == this )
state |= DFCS_HOT;
if ( !::DrawFrameControl(hdc, &rectCheck, DFC_BUTTON, state) )
{
wxLogLastError(_T("DrawFrameControl(DFC_BUTTON)"));
}
#else // XP version
wxUxThemeEngine *themeEngine = wxUxThemeEngine::GetIfActive();
if ( !themeEngine )
return false;
wxUxThemeHandle theme(this, L"BUTTON");
if ( !theme )
return false;
int state;
switch ( Get3StateValue() )
{
case wxCHK_CHECKED:
state = CBS_CHECKEDNORMAL;
break;
case wxCHK_UNDETERMINED:
state = CBS_MIXEDNORMAL;
break;
default:
wxFAIL_MSG( _T("unexpected Get3StateValue() return value") );
// fall through
//.........这里部分代码省略.........
示例9: WXUNUSED
bool wxSound::Create(int WXUNUSED(size), const wxByte* WXUNUSED(data))
{
wxFAIL_MSG( "not implemented" );
return false;
}
示例10: _T
void CTransferSocket::OnClose(int error)
{
m_pControlSocket->LogMessage(::Debug_Verbose, _T("CTransferSocket::OnClose(%d)"), error);
m_onCloseCalled = true;
if (m_transferEndReason != none)
return;
if (!m_pBackend)
{
if (!InitBackend())
{
TransferEnd(transfer_failure);
return;
}
}
if (m_transferMode == upload)
{
if (m_shutdown && m_pTlsSocket)
{
if (m_pTlsSocket->Shutdown() != 0)
TransferEnd(transfer_failure);
else
TransferEnd(successful);
}
else
TransferEnd(transfer_failure);
return;
}
if (error)
{
m_pControlSocket->LogMessage(::Error, _("Transfer connection interrupted: %s"), CSocket::GetErrorDescription(error).c_str());
TransferEnd(transfer_failure);
return;
}
char buffer[100];
int numread = m_pBackend->Peek(&buffer, 100, error);
if (numread > 0)
{
#ifndef __WXMSW__
wxFAIL_MSG(_T("Peek isn't supposed to return data after close notification"));
#endif
// MSDN says this:
// FD_CLOSE being posted after all data is read from a socket.
// An application should check for remaining data upon receipt
// of FD_CLOSE to avoid any possibility of losing data.
// First half is actually plain wrong.
OnReceive();
return;
}
else if (numread < 0 && error != EAGAIN)
{
m_pControlSocket->LogMessage(::Error, _("Transfer connection interrupted: %s"), CSocket::GetErrorDescription(error).c_str());
TransferEnd(transfer_failure);
return;
}
if (m_transferMode == resumetest)
{
if (m_transferBufferLen != 1)
{
TransferEnd(failed_resumetest);
return;
}
}
TransferEnd(successful);
}
示例11: wxFAIL_MSG
wxBitmap wxGTKCairoDCImpl::DoGetAsBitmap(const wxRect* /*subrect*/) const
{
wxFAIL_MSG("DoGetAsBitmap not implemented");
return wxBitmap();
}
示例12: wxFAIL_MSG
void wxBitmapCheckBox::SetLabel(const wxBitmap *WXUNUSED(bitmap))
{
// TODO
wxFAIL_MSG(wxT("wxBitmapCheckBox::SetLabel() not yet implemented"));
}
示例13: OnRun
virtual int OnRun() { wxFAIL_MSG( wxT("unreachable code") ); return 0; }
示例14: WXUNUSED
void wxBitmapCheckBox::SetValue(bool WXUNUSED(val))
{
// TODO
wxFAIL_MSG(wxT("wxBitmapCheckBox::SetValue() not yet implemented"));
}
示例15: GetThumbPosition
wxRect wxScrollBar::GetScrollbarRect(wxScrollBar::Element elem,
int thumbPos) const
{
if ( thumbPos == -1 )
{
thumbPos = GetThumbPosition();
}
const wxSize sizeArrow = m_renderer->GetScrollbarArrowSize();
wxSize sizeTotal = GetClientSize();
wxCoord *start, *width;
wxCoord length, arrow;
wxRect rect;
if ( IsVertical() )
{
rect.x = 0;
rect.width = sizeTotal.x;
length = sizeTotal.y;
start = &rect.y;
width = &rect.height;
arrow = sizeArrow.y;
}
else // horizontal
{
rect.y = 0;
rect.height = sizeTotal.y;
length = sizeTotal.x;
start = &rect.x;
width = &rect.width;
arrow = sizeArrow.x;
}
switch ( elem )
{
case wxScrollBar::Element_Arrow_Line_1:
*start = 0;
*width = arrow;
break;
case wxScrollBar::Element_Arrow_Line_2:
*start = length - arrow;
*width = arrow;
break;
case wxScrollBar::Element_Arrow_Page_1:
case wxScrollBar::Element_Arrow_Page_2:
// we don't have them at all
break;
case wxScrollBar::Element_Thumb:
case wxScrollBar::Element_Bar_1:
case wxScrollBar::Element_Bar_2:
// we need to calculate the thumb position - do it
{
length -= 2*arrow;
wxCoord thumbStart, thumbEnd;
int range = GetRange();
if ( !range )
{
thumbStart =
thumbEnd = 0;
}
else
{
GetScrollBarThumbSize(length,
thumbPos,
GetThumbSize(),
range,
&thumbStart,
&thumbEnd);
}
if ( elem == wxScrollBar::Element_Thumb )
{
*start = thumbStart;
*width = thumbEnd - thumbStart;
}
else if ( elem == wxScrollBar::Element_Bar_1 )
{
*start = 0;
*width = thumbStart;
}
else // elem == wxScrollBar::Element_Bar_2
{
*start = thumbEnd;
*width = length - thumbEnd;
}
// everything is relative to the start of the shaft so far
*start += arrow;
}
break;
case wxScrollBar::Element_Max:
default:
wxFAIL_MSG( wxT("unknown scrollbar element") );
}
return rect;
//.........这里部分代码省略.........