本文整理汇总了C++中SetBackgroundColour函数的典型用法代码示例。如果您正苦于以下问题:C++ SetBackgroundColour函数的具体用法?C++ SetBackgroundColour怎么用?C++ SetBackgroundColour使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetBackgroundColour函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: project
EditorScene::EditorScene(wxWindow* parent, gd::Project & project_, gd::Layout & layout_, const gd::MainFrameWrapper & mainFrameWrapper_) :
project(project_),
layout(layout_),
mainFrameWrapper(mainFrameWrapper_)
{
//(*Initialize(EditorScene)
wxFlexGridSizer* FlexGridSizer3;
wxFlexGridSizer* FlexGridSizer1;
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY"));
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer1->AddGrowableCol(0);
FlexGridSizer1->AddGrowableRow(0);
notebook = new wxAuiNotebook(this, ID_AUINOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TAB_SPLIT|wxAUI_NB_TAB_MOVE|wxAUI_NB_SCROLL_BUTTONS|wxNO_BORDER);
scenePanel = new wxPanel(notebook, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL, _T("ID_PANEL1"));
scenePanel->SetBackgroundColour(wxColour(255,255,255));
scenePanel->SetHelpText(_("Edit the layout of the scene"));
vScrollbar = new wxScrollBar(scenePanel, ID_SCROLLBAR3, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL, wxDefaultValidator, _T("ID_SCROLLBAR3"));
vScrollbar->SetScrollbar(2500, 10, 5000, 10);
hScrollbar = new wxScrollBar(scenePanel, ID_SCROLLBAR4, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL, wxDefaultValidator, _T("ID_SCROLLBAR4"));
hScrollbar->SetScrollbar(2500, 10, 5000, 10);
layoutEditorCanvas = new gd::LayoutEditorCanvas(scenePanel, project, layout, layout.GetInitialInstances(), layout.GetAssociatedLayoutEditorCanvasOptions(), mainFrameWrapper);
eventsPanel = new wxPanel(notebook, ID_PANEL6, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL, _T("ID_PANEL6"));
eventsPanel->SetBackgroundColour(wxColour(255,255,255));
eventsPanel->SetHelpText(_("Edit the events of the scene"));
FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer3->AddGrowableCol(0);
FlexGridSizer3->AddGrowableRow(0);
eventsEditor = new EventsEditor(eventsPanel, project, layout, mainFrameWrapper);
FlexGridSizer3->Add(eventsEditor, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
eventsPanel->SetSizer(FlexGridSizer3);
FlexGridSizer3->Fit(eventsPanel);
FlexGridSizer3->SetSizeHints(eventsPanel);
notebook->AddPage(scenePanel, _("Scene"), false, gd::SkinHelper::GetIcon("scene", 16));
notebook->AddPage(eventsPanel, _("Events"), false, gd::SkinHelper::GetIcon("events", 16));
FlexGridSizer1->Add(notebook, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
SetSizer(FlexGridSizer1);
FlexGridSizer1->Fit(this);
FlexGridSizer1->SetSizeHints(this);
Connect(ID_SCROLLBAR3,wxEVT_SCROLL_TOP|wxEVT_SCROLL_BOTTOM|wxEVT_SCROLL_LINEUP|wxEVT_SCROLL_LINEDOWN|wxEVT_SCROLL_PAGEUP|wxEVT_SCROLL_PAGEDOWN|wxEVT_SCROLL_THUMBTRACK|wxEVT_SCROLL_THUMBRELEASE|wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnvScrollbarScroll);
Connect(ID_SCROLLBAR3,wxEVT_SCROLL_THUMBTRACK,(wxObjectEventFunction)&EditorScene::OnvScrollbarScroll);
Connect(ID_SCROLLBAR3,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnvScrollbarScroll);
Connect(ID_SCROLLBAR4,wxEVT_SCROLL_TOP|wxEVT_SCROLL_BOTTOM|wxEVT_SCROLL_LINEUP|wxEVT_SCROLL_LINEDOWN|wxEVT_SCROLL_PAGEUP|wxEVT_SCROLL_PAGEDOWN|wxEVT_SCROLL_THUMBTRACK|wxEVT_SCROLL_THUMBRELEASE|wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnhScrollbarScroll);
Connect(ID_SCROLLBAR4,wxEVT_SCROLL_THUMBTRACK,(wxObjectEventFunction)&EditorScene::OnhScrollbarScroll);
Connect(ID_SCROLLBAR4,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnhScrollbarScroll);
layoutEditorCanvas->Connect(wxEVT_SET_FOCUS,(wxObjectEventFunction)&EditorScene::OnsceneCanvasSetFocus,0,this);
scenePanel->Connect(wxEVT_SIZE,(wxObjectEventFunction)&EditorScene::OnscenePanelResize,0,this);
Connect(ID_AUINOTEBOOK1,wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&EditorScene::OnnotebookPageChanged);
Connect(ID_AUINOTEBOOK1,wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING,(wxObjectEventFunction)&EditorScene::OnnotebookPageChanging);
//*)
//Prepare pane manager
m_mgr.SetManagedWindow( this );
layoutEditorCanvas->SetParentAuiManager(&m_mgr);
layoutEditorCanvas->SetScrollbars(hScrollbar, vScrollbar);
//Create all editors linked to scene canvas.
objectsEditor = std::shared_ptr<gd::ObjectsEditor>(new gd::ObjectsEditor(this, project, layout, mainFrameWrapper) );
layersEditor = std::shared_ptr<gd::LayersEditorPanel>(new gd::LayersEditorPanel(this, project, layout, mainFrameWrapper) );
initialInstancesBrowser = std::shared_ptr<InitialPositionBrowserDlg>(new InitialPositionBrowserDlg(this, layout.GetInitialInstances(), *layoutEditorCanvas) );
propertiesPnl = std::shared_ptr<LayoutEditorPropertiesPnl>(new LayoutEditorPropertiesPnl(this, project, layout, layoutEditorCanvas, mainFrameWrapper));
//Link some editors together
layoutEditorCanvas->AddAssociatedEditor(objectsEditor.get());
layoutEditorCanvas->AddAssociatedEditor(layersEditor.get());
layoutEditorCanvas->AddAssociatedEditor(propertiesPnl.get());
layoutEditorCanvas->AddAssociatedEditor(initialInstancesBrowser.get());
layersEditor->SetAssociatedLayoutEditorCanvas(layoutEditorCanvas);
eventsEditor->SetAssociatedLayoutCanvas(layoutEditorCanvas);
objectsEditor->SetAssociatedPropertiesPanel(propertiesPnl.get(), &m_mgr);
//Display editors in panes
m_mgr.AddPane( notebook, wxAuiPaneInfo().Name( wxT( "ESCenter" ) ).PaneBorder(false).Center().CloseButton( false ).Caption( _( "Scene's editor" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(false) );
m_mgr.AddPane( objectsEditor.get(), wxAuiPaneInfo().Name( wxT( "EO" ) ).Right().CloseButton( true ).Caption( _( "Objects' editor" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(208, 100) );
m_mgr.AddPane( layersEditor.get(), wxAuiPaneInfo().Name( wxT( "EL" ) ).Float().CloseButton( true ).Caption( _( "Layers' editor" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(200, 100).Show(false) );
m_mgr.AddPane( propertiesPnl.get(), wxAuiPaneInfo().Name( wxT( "PROPERTIES" ) ).Float().CloseButton( true ).Caption( _( "Properties" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(50, 50).BestSize(230,200).Show(false) );
m_mgr.AddPane( initialInstancesBrowser.get(), wxAuiPaneInfo().Name( wxT( "InstancesBrowser" ) ).Float().CloseButton( true ).Caption( _( "Instances list" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(50, 50).BestSize(230,200).Show(false) );
//Load preferences
{
int position = 1;
wxConfigBase::Get()->Read("/SceneEditor/SceneEventsTab", &position);
if (position == 0)
{
long style = notebook->GetWindowStyleFlag();
style |= wxAUI_NB_TOP;
style &= ~wxAUI_NB_BOTTOM;
notebook->SetWindowStyleFlag(style);
}
}
gd::SkinHelper::ApplyCurrentSkin(m_mgr);
gd::SkinHelper::ApplyCurrentSkin(*notebook, true);
mainFrameWrapper.SetRibbonPage(_("Scene"));
layoutEditorCanvas->ConnectEvents();
//Load the saved perspective and make sure titles are translated
//.........这里部分代码省略.........
示例2: GetValue
void wxBitmapComboBox::RecreateControl()
{
//
// Recreate control so that WM_MEASUREITEM gets called again.
// Can't use CBS_OWNERDRAWVARIABLE because it has odd
// mouse-wheel behaviour.
//
wxString value = GetValue();
wxPoint pos = GetPosition();
wxSize size = GetSize();
size.y = GetBestSize().y;
const wxArrayString strings = GetStrings();
const unsigned numItems = strings.size();
unsigned i;
// Save the client data pointers before clearing the control, if any.
const wxClientDataType clientDataType = GetClientDataType();
wxVector<wxClientData*> objectClientData;
wxVector<void*> voidClientData;
switch ( clientDataType )
{
case wxClientData_None:
break;
case wxClientData_Object:
objectClientData.reserve(numItems);
for ( i = 0; i < numItems; ++i )
objectClientData.push_back(GetClientObject(i));
break;
case wxClientData_Void:
voidClientData.reserve(numItems);
for ( i = 0; i < numItems; ++i )
voidClientData.push_back(GetClientData(i));
break;
}
wxComboBox::DoClear();
HWND hwnd = GetHwnd();
DissociateHandle();
::DestroyWindow(hwnd);
if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) )
return;
// initialize the controls contents
for ( i = 0; i < numItems; i++ )
{
wxComboBox::Append(strings[i]);
if ( !objectClientData.empty() )
SetClientObject(i, objectClientData[i]);
else if ( !voidClientData.empty() )
SetClientData(i, voidClientData[i]);
}
// and make sure it has the same attributes as before
if ( m_hasFont )
{
// calling SetFont(m_font) would do nothing as the code would
// notice that the font didn't change, so force it to believe
// that it did
wxFont font = m_font;
m_font = wxNullFont;
SetFont(font);
}
if ( m_hasFgCol )
{
wxColour colFg = m_foregroundColour;
m_foregroundColour = wxNullColour;
SetForegroundColour(colFg);
}
if ( m_hasBgCol )
{
wxColour colBg = m_backgroundColour;
m_backgroundColour = wxNullColour;
SetBackgroundColour(colBg);
}
else
{
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
}
::SendMessage(GetHwnd(), CB_SETITEMHEIGHT, 0, MeasureItem(0));
// Revert the old string value
if ( !HasFlag(wxCB_READONLY) )
ChangeValue(value);
}
示例3: wxFrame
// My frame constructor
MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)),
m_treeCtrl(NULL)
#if wxUSE_LOG
, m_textCtrl(NULL)
#endif // wxUSE_LOG
{
// This reduces flicker effects - even better would be to define
// OnEraseBackground to do nothing. When the tree control's scrollbars are
// show or hidden, the frame is sent a background erase event.
SetBackgroundColour(wxColour(255, 255, 255));
// Give it an icon
SetIcon(wxICON(sample));
#if wxUSE_MENUS
// Make a menubar
wxMenu *file_menu = new wxMenu,
*style_menu = new wxMenu,
*tree_menu = new wxMenu,
*item_menu = new wxMenu;
file_menu->Append(TreeTest_About, wxT("&About..."));
file_menu->AppendSeparator();
file_menu->Append(TreeTest_Quit, wxT("E&xit\tAlt-X"));
style_menu->AppendCheckItem(TreeTest_TogButtons, wxT("Toggle &normal buttons"));
style_menu->AppendCheckItem(TreeTest_TogTwist, wxT("Toggle &twister buttons"));
style_menu->AppendCheckItem(TreeTest_ToggleButtons, wxT("Toggle image &buttons"));
style_menu->AppendSeparator();
style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &connecting lines"));
style_menu->AppendCheckItem(TreeTest_TogRootLines, wxT("Toggle &lines at root"));
style_menu->AppendCheckItem(TreeTest_TogHideRoot, wxT("Toggle &hidden root"));
style_menu->AppendCheckItem(TreeTest_TogBorder, wxT("Toggle &item border"));
style_menu->AppendCheckItem(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight"));
style_menu->AppendCheckItem(TreeTest_TogEdit, wxT("Toggle &edit mode"));
#ifndef NO_MULTIPLE_SELECTION
style_menu->AppendCheckItem(TreeTest_ToggleSel, wxT("Toggle &selection mode"));
#endif // NO_MULTIPLE_SELECTION
style_menu->AppendCheckItem(TreeTest_ToggleImages, wxT("Toggle show ima&ges"));
style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze..."));
style_menu->AppendSeparator();
style_menu->Append(TreeTest_SetFgColour, wxT("Set &foreground colour..."));
style_menu->Append(TreeTest_SetBgColour, wxT("Set &background colour..."));
style_menu->AppendSeparator();
style_menu->Append(TreeTest_ResetStyle, wxT("&Reset to default\tF10"));
tree_menu->Append(TreeTest_Recreate, wxT("&Recreate the tree"));
tree_menu->Append(TreeTest_CollapseAndReset, wxT("C&ollapse and reset"));
tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_AddItem, wxT("Append a &new item"));
tree_menu->Append(TreeTest_InsertItem, wxT("&Insert a new item"));
tree_menu->Append(TreeTest_Delete, wxT("&Delete this item"));
tree_menu->Append(TreeTest_DeleteChildren, wxT("Delete &children"));
tree_menu->Append(TreeTest_DeleteAll, wxT("Delete &all items"));
tree_menu->Append(TreeTest_SelectRoot, wxT("Select root item"));
tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_Count, wxT("Count children of current item"));
tree_menu->Append(TreeTest_CountRec, wxT("Recursively count children of current item"));
tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_Sort, wxT("Sort children of current item"));
tree_menu->Append(TreeTest_SortRev, wxT("Sort in reversed order"));
tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_EnsureVisible, wxT("Make the last item &visible"));
tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_IncIndent, wxT("Add 5 points to indentation\tAlt-I"));
tree_menu->Append(TreeTest_DecIndent, wxT("Reduce indentation by 5 points\tAlt-R"));
tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_IncSpacing, wxT("Add 5 points to spacing\tCtrl-I"));
tree_menu->Append(TreeTest_DecSpacing, wxT("Reduce spacing by 5 points\tCtrl-R"));
item_menu->Append(TreeTest_Dump, wxT("&Dump item children"));
item_menu->Append(TreeTest_Rename, wxT("&Rename item..."));
item_menu->AppendSeparator();
item_menu->Append(TreeTest_SetBold, wxT("Make item &bold"));
item_menu->Append(TreeTest_ClearBold, wxT("Make item ¬ bold"));
item_menu->AppendSeparator();
item_menu->Append(TreeTest_ToggleIcon, wxT("Toggle the item's &icon"));
#ifndef NO_MULTIPLE_SELECTION
item_menu->AppendSeparator();
item_menu->Append(TreeTest_DumpSelected, wxT("Dump selected items\tAlt-D"));
item_menu->Append(TreeTest_Select, wxT("Select current item\tAlt-S"));
item_menu->Append(TreeTest_Unselect, wxT("Unselect everything\tAlt-U"));
#endif // NO_MULTIPLE_SELECTION
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File"));
menu_bar->Append(style_menu, wxT("&Style"));
menu_bar->Append(tree_menu, wxT("&Tree"));
menu_bar->Append(item_menu, wxT("&Item"));
SetMenuBar(menu_bar);
#endif // wxUSE_MENUS
m_panel = new wxPanel(this);
#if wxUSE_LOG
// create the controls
//.........这里部分代码省略.........
示例4: wxWindow
kwxAngularMeter::kwxAngularMeter(wxWindow* parent,
const wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
const long int style)
: wxWindow(parent, id, pos, size, 0)
{
if (parent)
SetBackgroundColour(parent->GetBackgroundColour());
else
SetBackgroundColour(*wxLIGHT_GREY);
//SetSize(size);
SetAutoLayout(TRUE);
Refresh();
m_id = id;
//valori di default
m_nScaledVal = 0; //gradi
m_nRealVal = 0;
m_nTick = 0; //numero tacche
m_nSec = 1; //default numero settori
m_nRangeStart = 0;
m_nRangeEnd = 220;
m_nAngleStart = -20;
m_nAngleEnd = 200;
m_aSectorColor[0] = *wxWHITE;
// m_cBackColour = *wxLIGHT_GREY;
m_cBackColour = GetBackgroundColour() ; //default sfondo applicazione
m_cNeedleColour = *wxRED; //indicatore
m_cBorderColour = GetBackgroundColour() ;
m_dPI = 4.0 * atan(1.0);
m_Font = *wxSWISS_FONT; //font
m_bDrawCurrent = true ;
m_label = new wxString(label);
m_style = style;
membitmap = new wxBitmap(size.GetWidth(), size.GetHeight()) ;
/////////////// TODO : Test for BMP image loading /////////////////
m_pPreviewBmp = NULL ;
/*
wxBitmap bitmap( 300, 300 );
wxImage image = bitmap.ConvertToImage();
image.Destroy();
if ( !image.LoadFile( "thumbnail.bmp", wxBITMAP_TYPE_BMP ) )
wxLogError(wxT("Can't load BMP image"));
else
m_pPreviewBmp = new wxBitmap( image );
*/
}
示例5: GetThemedBorderStyle
bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style)
{
if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT)
#ifdef __WXMSW__
style |= GetThemedBorderStyle();
#else
style |= wxBORDER_SUNKEN;
#endif
wxControl::Create(parent, id, pos, size, style);
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
if (size != wxDefaultSize)
SetInitialSize(size);
bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
wxBorder listBoxStyle;
if (showSelector)
{
#ifdef __WXMSW__
listBoxStyle = GetThemedBorderStyle();
#else
listBoxStyle = wxBORDER_SUNKEN;
#endif
}
else
listBoxStyle = wxBORDER_NONE;
m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, listBoxStyle);
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
if (showSelector)
{
wxArrayString choices;
choices.Add(_("All styles"));
choices.Add(_("Paragraph styles"));
choices.Add(_("Character styles"));
choices.Add(_("List styles"));
m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5);
}
else
{
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 0);
}
SetSizer(boxSizer);
Layout();
m_dontUpdate = true;
if (m_styleChoice)
{
int i = StyleTypeToIndex(m_styleListBox->GetStyleType());
m_styleChoice->SetSelection(i);
}
m_dontUpdate = false;
return true;
}
示例6: wxScrolledWindow
MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size )
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
, m_bmpSmileXpm(smile_xpm)
, m_iconSmileXpm(smile_xpm)
{
my_horse_ani = NULL;
m_ani_images = 0 ;
SetBackgroundColour(* wxWHITE);
wxBitmap bitmap( 100, 100 );
wxMemoryDC dc;
dc.SelectObject( bitmap );
dc.SetBrush( wxBrush( wxT("orange"), wxSOLID ) );
dc.SetPen( *wxBLACK_PEN );
dc.DrawRectangle( 0, 0, 100, 100 );
dc.SetBrush( *wxWHITE_BRUSH );
dc.DrawRectangle( 20, 20, 60, 60 );
dc.SelectObject( wxNullBitmap );
// try to find the directory with our images
wxString dir;
if ( wxFile::Exists(wxT("./horse.png")) )
dir = wxT("./");
else if ( wxFile::Exists(wxT("../horse.png")) )
dir = wxT("../");
else
wxLogWarning(wxT("Can't find image files in either '.' or '..'!"));
wxImage image = bitmap.ConvertToImage();
#if wxUSE_LIBPNG
if ( !image.SaveFile( dir + wxT("test.png"), wxBITMAP_TYPE_PNG ))
{
wxLogError(wxT("Can't save file"));
}
image.Destroy();
if ( image.LoadFile( dir + wxT("test.png") ) )
my_square = wxBitmap( image );
image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.png")) )
{
wxLogError(wxT("Can't load PNG image"));
}
else
{
my_horse_png = wxBitmap( image );
}
if ( !image.LoadFile( dir + wxT("toucan.png")) )
{
wxLogError(wxT("Can't load PNG image"));
}
else
{
my_toucan = wxBitmap(image);
}
my_toucan_flipped_horiz = wxBitmap(image.Mirror(true));
my_toucan_flipped_vert = wxBitmap(image.Mirror(false));
my_toucan_flipped_both = wxBitmap(image.Mirror(true).Mirror(false));
my_toucan_grey = wxBitmap(image.ConvertToGreyscale());
my_toucan_head = wxBitmap(image.GetSubImage(wxRect(40, 7, 80, 60)));
my_toucan_scaled_normal = wxBitmap(image.Scale(110,90,wxIMAGE_QUALITY_NORMAL));
my_toucan_scaled_high = wxBitmap(image.Scale(110,90,wxIMAGE_QUALITY_HIGH));
my_toucan_blur = wxBitmap(image.Blur(10));
#endif // wxUSE_LIBPNG
#if wxUSE_LIBJPEG
image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.jpg")) )
{
wxLogError(wxT("Can't load JPG image"));
}
else
{
my_horse_jpeg = wxBitmap( image );
// Colorize by rotating green hue to red
wxImage::HSVValue greenHSV = wxImage::RGBtoHSV(wxImage::RGBValue(0, 255, 0));
wxImage::HSVValue redHSV = wxImage::RGBtoHSV(wxImage::RGBValue(255, 0, 0));
image.RotateHue(redHSV.hue - greenHSV.hue);
colorized_horse_jpeg = wxBitmap( image );
}
if ( !image.LoadFile( dir + wxT("cmyk.jpg")) )
{
wxLogError(wxT("Can't load CMYK JPG image"));
}
else
{
my_cmyk_jpeg = wxBitmap(image);
//.........这里部分代码省略.........
示例7: SetBackgroundColour
bool wxGenericDirCtrl::Create(wxWindow *parent,
const wxWindowID treeid,
const wxString& dir,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& filter,
int defaultFilter,
const wxString& name)
{
if (!wxControl::Create(parent, treeid, pos, size, style, wxDefaultValidator, name))
return false;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
Init();
long treeStyle = wxTR_HAS_BUTTONS;
// On Windows CE, if you hide the root, you get a crash when
// attempting to access data for children of the root item.
#ifndef __WXWINCE__
treeStyle |= wxTR_HIDE_ROOT;
#endif
#ifdef __WXGTK20__
treeStyle |= wxTR_NO_LINES;
#endif
if (style & wxDIRCTRL_EDIT_LABELS)
treeStyle |= wxTR_EDIT_LABELS;
if (style & wxDIRCTRL_MULTIPLE)
treeStyle |= wxTR_MULTIPLE;
if ((style & wxDIRCTRL_3D_INTERNAL) == 0)
treeStyle |= wxNO_BORDER;
m_treeCtrl = CreateTreeCtrl(this, wxID_TREECTRL,
wxPoint(0,0), GetClientSize(), treeStyle);
if (!filter.empty())
m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL);
m_defaultPath = dir;
m_filter = filter;
if (m_filter.empty())
m_filter = wxFileSelectorDefaultWildcardStr;
SetFilterIndex(defaultFilter);
if (m_filterListCtrl)
m_filterListCtrl->FillFilterList(filter, defaultFilter);
m_treeCtrl->SetImageList(wxTheFileIconsTable->GetSmallImageList());
m_showHidden = false;
wxDirItemData* rootData = new wxDirItemData(wxEmptyString, wxEmptyString, true);
wxString rootName;
#if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__)
rootName = _("Computer");
#else
rootName = _("Sections");
#endif
m_rootId = m_treeCtrl->AddRoot( rootName, 3, -1, rootData);
m_treeCtrl->SetItemHasChildren(m_rootId);
ExpandRoot();
SetInitialSize(size);
DoResize();
return true;
}
示例8: SetBackgroundColour
void ControlColorPreview::SetColor(Img::Color color)
{
SetBackgroundColour(Win::ColorToWx(color));
Refresh();
Update();
}
示例9: wxControl
SeqTrack::SeqTrack(long index, wxWindow *winParent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
trackType type = eAudioTrack,
WiredDocument* docParent = NULL)
: wxControl(winParent, -1, pos, size),
WiredDocument(wxT("SeqTrack"), docParent)
{
wxString str;
Index = index;
ChanGui = NULL;
Connected = 0x0;
ConnectedRackTrack = 0x0;
Type = type;
DeviceId = -1;
Record = false;
Mute = false;
VuValue = 0;
SetBackgroundColour(CL_RULER_BACKGROUND);
// only impact on GTK+ implementation (see wx Doc)
wxWindow::SetBackgroundStyle(wxBG_STYLE_CUSTOM);
// name of track
switch (Type)
{
case eAudioTrack:
str.Printf(_("Audio %d"), ++AudioTrackCount);
break;
case eMidiTrack:
str.Printf(wxT("MIDI %d"), ++MidiTrackCount);
break;
default:
str.Printf(wxT("Unknown %d"), ++MidiTrackCount);
break;
}
Text = new wxTextCtrl(this, SeqTrack_OnNameChange, str, wxPoint(6, 8),
wxSize(TRACK_WIDTH - 68, 18), wxTE_PROCESS_ENTER);
Text->SetFont(wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL));
// add pixmap to see what sort of track it is (audio or midi).
wxImage* trackTypeImage;
// Move into previous switch !?
switch (Type)
{
case eAudioTrack:
trackTypeImage = new wxImage(wxString(WiredSettings->DataDir + _("ihm/seqtrack/tracktype-wave.png")), wxBITMAP_TYPE_PNG);
break;
case eMidiTrack:
trackTypeImage = new wxImage(wxString(WiredSettings->DataDir + _("ihm/seqtrack/tracktype-midi.png")), wxBITMAP_TYPE_PNG);
break;
default:
trackTypeImage = NULL;
break;
}
if(trackTypeImage)
{
wxBitmap* trackTypeBitmap = new wxBitmap(*trackTypeImage);
delete trackTypeImage;
trackTypeStatic = new wxStaticBitmap(this, -1, *trackTypeBitmap, wxPoint(62, 8));
}
else
trackTypeStatic = NULL;
// record and mute button
wxImage *rec_up = new wxImage(wxString(WiredSettings->DataDir + wxString(REC_UP)), wxBITMAP_TYPE_PNG);
wxImage *rec_down =
new wxImage(wxString(WiredSettings->DataDir + wxString(REC_DOWN)), wxBITMAP_TYPE_PNG);
wxImage *mute_up = new wxImage(wxString(WiredSettings->DataDir + wxString(MUTE_UP)), wxBITMAP_TYPE_PNG);
wxImage *mute_down = new wxImage(wxString(WiredSettings->DataDir + wxString(MUTE_DOWN)), wxBITMAP_TYPE_PNG);
RecBtn = new DownButton(this, SeqTrack_Record, wxPoint(6, 30), wxSize(25, 16),
rec_up, rec_down);
MuteBtn = new DownButton(this, SeqTrack_Mute, wxPoint(34, 30), wxSize(25, 16),
mute_up, mute_down);
Image = new ChoiceButton(this, SeqTrack_ConnectTo, wxPoint(62, 30), wxSize(25, 16), wxT(""));
// add pixmap for unassigned track and for "can assign track"
wxImage* assign;
assign = new wxImage(wxString(WiredSettings->DataDir + UNASSIGNED), wxBITMAP_TYPE_PNG);
UnassignedBmp = new wxBitmap(*assign);
assign = new wxImage(wxString(WiredSettings->DataDir + CAN_ASSIGN), wxBITMAP_TYPE_PNG);
CanAssignBmp = new wxBitmap(*assign);
delete assign;
Image->Connect(SeqTrack_ConnectTo, wxEVT_ENTER_WINDOW,
(wxObjectEventFunction)(wxEventFunction)
(wxMouseEventFunction)&SeqTrack::OnConnectToHelp);
Image->SetImage(UnassignedBmp);
Image->Refresh();
// device input list
DeviceBox = new wxChoice(this, SeqTrack_DeviceChoice, wxPoint(5, 50), wxSize(TRACK_WIDTH - 38, 22),
0, 0x0);
DeviceBox->SetFont(wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL));
FillChoices();
//.........这里部分代码省略.........
示例10: PChildWindow
/*
* Method: CInfoWindow()
* Purpose: constructor
* Comments: none
*/
CInfoWindow::CInfoWindow(PChildWindowObserver& aObserver,const tPvCameraInfoEx& aInfo)
: PChildWindow(aObserver,L"",wxSize(300,200),0)
{
wxString lString;
wxSizer* lMain;
// format the title of the window
lString = wxString(aInfo.SerialNumber,wxConvUTF8);
lString += _T(" (");
lString += wxString(aInfo.CameraName,wxConvUTF8);
lString += _T(") - Information");
// and set it
SetTitle(lString);
// Give it an icon
SetIcon(wxIcon(bitmap1));
// center on the screen
CentreOnScreen(wxBOTH);
#ifdef __WXMSW__
// set the background color
SetBackgroundColour(*wxLIGHT_GREY);
#endif
// create the main sizer
lMain = new wxBoxSizer(wxVERTICAL);
if(lMain)
{
// then create a grid size to fit all the label/value in
wxSizer* lGrid = new wxGridSizer(2,6,5);
if(lGrid)
{
// Unique ID
lString.Printf(wxT("%lu"),aInfo.UniqueId);
lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Unique ID:")),
wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
lGrid->Add(new wxStaticText(this,wxID_ANY,lString),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
// Serial number
lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Serial Number:")),
wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
lGrid->Add(new wxStaticText(this,wxID_ANY,wxString(aInfo.SerialNumber,wxConvUTF8)),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
// Part number
lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Part Number:")),
wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
lGrid->Add(new wxStaticText(this,wxID_ANY,wxString(aInfo.PartNumber,wxConvUTF8)),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
/*
lString.Printf(wxT("%c"),(char)aInfo.PartVersion);
lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Part Version:")),
wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
lGrid->Add(new wxStaticText(this,wxID_ANY,lString),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
*/
// Interface type
lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Interface Type:")),
wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
lGrid->Add(new wxStaticText(this,wxID_ANY,
(aInfo.InterfaceType == ePvInterfaceEthernet ? _T("Giga-Ethernet") : _T("Firewire"))),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
lString.Printf(wxT("%lu"),aInfo.InterfaceId);
lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Interface ID:")),
wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
lGrid->Add(new wxStaticText(this,wxID_ANY,lString),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
// add the grid to the main sizer
lMain->Add(lGrid,wxSizerFlags().Proportion(1).Expand().Border(wxALL,20));
}
// set the main sizer in the window
SetSizer(lMain);
// and make that the window adjust its size to the sizer
lMain->Fit(this);
}
}
示例11: defined
// Create() function
bool wxNotebook::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT )
{
#if defined(__POCKETPC__)
style |= wxBK_BOTTOM | wxNB_FLAT;
#else
style |= wxBK_TOP;
#endif
}
#ifdef __WXWINCE__
// Not sure why, but without this style, there is no border
// around the notebook tabs.
if (style & wxNB_FLAT)
style |= wxBORDER_SUNKEN;
#endif
#if !wxUSE_UXTHEME
// ComCtl32 notebook tabs simply don't work unless they're on top if we
// have uxtheme, we can work around it later (after control creation), but
// if we have been compiled without uxtheme support, we have to clear those
// styles
if ( HasTroubleWithNonTopTabs() )
{
style &= ~(wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT);
}
#endif //wxUSE_UXTHEME
#if defined(__WINE__) && wxUSE_UNICODE
LPCTSTR className = L"SysTabControl32";
#else
LPCTSTR className = WC_TABCONTROL;
#endif
#if USE_NOTEBOOK_ANTIFLICKER
// SysTabCtl32 class has natively CS_HREDRAW and CS_VREDRAW enabled and it
// causes horrible flicker when resizing notebook, so get rid of it by
// using a class without these styles (but otherwise identical to it)
if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) )
{
static ClassRegistrar s_clsNotebook;
if ( !s_clsNotebook.IsInitialized() )
{
// get a copy of standard class and modify it
WNDCLASS wc;
if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) )
{
gs_wndprocNotebook =
reinterpret_cast<WXFARPROC>(wc.lpfnWndProc);
wc.lpszClassName = wxT("_wx_SysTabCtl32");
wc.style &= ~(CS_HREDRAW | CS_VREDRAW);
wc.hInstance = wxGetInstance();
wc.lpfnWndProc = wxNotebookWndProc;
s_clsNotebook.Register(wc);
}
else
{
wxLogLastError(wxT("GetClassInfoEx(SysTabCtl32)"));
}
}
// use our custom class if available but fall back to the standard
// notebook if we failed to register it
if ( s_clsNotebook.IsRegistered() )
{
// it's ok to use c_str() here as the static s_clsNotebook object
// has sufficiently long lifetime
className = s_clsNotebook.GetName().c_str();
}
}
#endif // USE_NOTEBOOK_ANTIFLICKER
if ( !CreateControl(parent, id, pos, size, style | wxTAB_TRAVERSAL,
wxDefaultValidator, name) )
return false;
if ( !MSWCreateControl(className, wxEmptyString, pos, size) )
return false;
// Inherit parent attributes and, unlike the default, also inherit the
// parent background colour in order to blend in with its background if
// it's set to a non-default value.
InheritAttributes();
if ( parent->InheritsBackgroundColour() && !UseBgCol() )
SetBackgroundColour(parent->GetBackgroundColour());
#if wxUSE_UXTHEME
if ( HasFlag(wxNB_NOPAGETHEME) ||
wxSystemOptions::IsFalse(wxT("msw.notebook.themed-background")) )
{
SetBackgroundColour(GetThemeBackgroundColour());
}
//.........这里部分代码省略.........
示例12: wxDialog
AboutDialog::AboutDialog(void) :
wxDialog(pFrame, wxID_ANY, _T("About ") APPNAME, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
SetBackgroundColour(*wxWHITE);
wxBoxSizer *pSizer = new wxBoxSizer(wxHORIZONTAL);
#include "icons/phd2_64.png.h"
wxBitmap phd2(wxBITMAP_PNG_FROM_DATA(phd2_64));
wxStaticBitmap *pImage = new wxStaticBitmap(this, wxID_ANY, phd2);
wxFileSystem::AddHandler(new wxMemoryFSHandler);
wxMemoryFSHandler::AddFile("about.html", wxString::Format(
"<html><body>"
"<h3>%s %s</h3>"
"<a href=\"http://openphdguiding.org\">PHD2 home page - openphdguiding.org</a><br>"
"<a href=\"https://github.com/OpenPHDGuiding\">PHD2 open source project page</a><br><br>"
"<font size=\"2\">"
"Credits:<br>"
"<table>"
"<tr>"
"<td>Craig Stark</td>"
"<td>Bret McKee</td>"
"</tr>"
"<tr>"
"<td>Andy Galasso</td>"
"<td>Bernhard Reutner-Fischer</td>"
"</tr>"
"<tr>"
"<td>Stefan Elste</td>"
"<td>Geoffrey Hausheer</td>"
"</tr>"
"<tr>"
"<td>Jared Wellman</td>"
"<td>John Wainwright</td>"
"</tr>"
"<tr>"
"<td>Sylvain Girard</td>"
"<td>Bruce Waddington</td>"
"</tr>"
"<tr>"
"<td>Max Chen</td>"
"<td>Carsten Przygoda</td>"
"</tr>"
"<tr>"
"<td>Hans Lambermont</td>"
"<td>David Ault</td>"
"</tr>"
"<tr>"
"<td>Markus Wieczorek</td>"
"<td>Linkage</td>"
"</tr>"
"<tr>"
"<td>Robin Glover</td>"
"<td>Patrick Chevalley</td>"
"</tr>"
"<tr>"
"<td>Scott Edwards</td>"
"<td>Eiji Kaneshige</td>"
"</tr>"
"<tr>"
"<td>Konstantin Menshikoff</td>"
"<td>Jakub Bartas</td>"
"</tr>"
"<tr>"
"<td>Javier R</td>"
"<td>Oleh Malyi</td>"
"</tr>"
"<tr>"
"<td>Tsung-Chi Wu</td>"
"<td>Raffi Enficiaud</td>"
"</tr>"
"<tr>"
"<td>Sabin Fota</td>"
"<td>Dylan O'Donnell</td>"
"</tr>"
"<tr>"
"<td>Katsuhiro Kojima</td>"
"<td>Simon Taylor</td>"
"</tr>"
"<tr>"
"<td>Hallgeir Holien</td>"
"<td>Laurent Schmitz</td>"
"</tr>"
"<tr>"
"<td>Atushi Sakauchi</td>"
"<td>Giorgio Mazzacurati</td>"
"</tr>"
"<tr>"
"<td>G\u00FCnter Scholz</td>"
"<td>Ray Gralak</td>"
"</tr>"
"<tr>"
"<td>Khalefa Algadi</td>"
"<td></td>"
"</tr>"
"</table><br>"
"<br>"
"<br>"
"Copyright 2006-2013 Craig Stark<br>"
//.........这里部分代码省略.........
示例13: wxFrame
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300))
{
// Give it an icon
SetIcon(wxICON(mondrian));
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_EXIT, _T("&Quit\tCtrl-Q"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
// Associate the menu bar with the frame
SetMenuBar(menu_bar);
// set a dialog background
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
// add the controls to the frame
wxString strs4[] =
{
IPC_SERVICE, _T("...")
};
wxString strs5[] =
{
IPC_HOST, _T("...")
};
wxString strs6[] =
{
IPC_TOPIC, _T("...")
};
wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
wxGridSizer *item2 = new wxGridSizer( 4, 0, 0 );
wxButton *item3 = new wxButton( this, ID_START, wxT("Connect to server"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxChoice *item5 = new wxChoice( this, ID_HOSTNAME, wxDefaultPosition, wxSize(100,-1), 2, strs5, 0 );
item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
wxChoice *item4 = new wxChoice( this, ID_SERVERNAME, wxDefaultPosition, wxSize(100,-1), 2, strs4, 0 );
item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxChoice *item6 = new wxChoice( this, ID_TOPIC, wxDefaultPosition, wxSize(100,-1), 2, strs6, 0 );
item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item7 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect "), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item8 = new wxButton( this, ID_STARTADVISE, wxT("StartAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxButton *item9 = new wxButton( this, ID_STOPADVISE, wxT("StopAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item10 = new wxButton( this, ID_EXECUTE, wxT("Execute"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item11 = new wxButton( this, ID_POKE, wxT("Poke"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item12 = new wxButton( this, ID_REQUEST, wxT("Request"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item1->Add( item2, 1, wxALIGN_CENTER|wxALL, 5 );
item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
//.........这里部分代码省略.........
示例14: wxASSERT_MSG
bool wxChoice::Create(
wxWindow* pParent
, wxWindowID vId
, const wxPoint& rPos
, const wxSize& rSize
, int n
, const wxString asChoices[]
, long lStyle
, const wxValidator& rValidator
, const wxString& rsName
)
{
long lSstyle;
if (!CreateControl( pParent
,vId
,rPos
,rSize
,lStyle
,rValidator
,rsName
))
return false;
lSstyle = CBS_DROPDOWNLIST |
WS_TABSTOP |
WS_VISIBLE;
// clipping siblings does not yet work
// if (lStyle & wxCLIP_SIBLINGS )
// lSstyle |= WS_CLIPSIBLINGS;
wxASSERT_MSG( !(lStyle & wxCB_DROPDOWN) &&
!(lStyle & wxCB_READONLY) &&
!(lStyle & wxCB_SIMPLE),
wxT("this style flag is ignored by wxChoice, you "
"probably want to use a wxComboBox") );
if (!OS2CreateControl( wxT("COMBOBOX")
,lSstyle
))
return false;
//
// A choice/combobox normally has a white background (or other, depending
// on global settings) rather than inheriting the parent's background colour.
//
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
// initialize the controls contents
for (int i = 0; i < n; i++)
{
Append(asChoices[i]);
}
SetSize( rPos.x
,rPos.y
,rSize.x
,rSize.y
);
// Set height to use with sizers i.e. without the dropdown listbox
wxFont vFont = GetFont();
int nEditHeight;
wxGetCharSize( GetHWND(), NULL, &nEditHeight, &vFont );
nEditHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nEditHeight);
SetInitialSize(wxSize(-1,nEditHeight+4)); // +2x2 for the border
return true;
} // end of wxChoice::Create
示例15: wxDialog
AboutDialog::AboutDialog()
: wxDialog(NULL, wxID_ANY, _(L("About Slic3r")), wxDefaultPosition, wxDefaultSize, wxCAPTION)
{
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bgr_clr);
wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL);
auto main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20);
// logo
wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG);
auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp));
hsizer->Add(logo, 1, wxEXPAND | wxTOP | wxBOTTOM, 35);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
#ifdef __WXMSW__
int proportion = 2;
#else
int proportion = 3;
#endif
hsizer->Add(vsizer, proportion, wxEXPAND|wxLEFT, 20);
// title
{
wxStaticText* title = new wxStaticText(this, wxID_ANY, "Slic3r Prusa Edition", wxDefaultPosition, wxDefaultSize);
wxFont title_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
title_font.SetWeight(wxFONTWEIGHT_BOLD);
title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(24);
title->SetFont(title_font);
vsizer->Add(title, 0, wxALIGN_LEFT | wxTOP, 10);
}
// version
{
auto version_string = _(L("Version"))+ " " + std::string(SLIC3R_VERSION);
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
wxFont version_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__
version_font.SetPointSize(9);
#else
version_font.SetPointSize(11);
#endif
version->SetFont(version_font);
vsizer->Add(version, 0, wxALIGN_LEFT | wxBOTTOM, 10);
}
// text
wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO/*NEVER*/);
{
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
const auto text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue());
auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue());
const int fs = font.GetPointSize()-1;
int size[] = {fs,fs,fs,fs,fs,fs,fs};
html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
html->SetBorders(2);
const auto text = wxString::Format(
"<html>"
"<body bgcolor= %s link= %s>"
"<font color=%s>"
"Copyright © 2016-2018 Prusa Research. <br />"
"Copyright © 2011-2017 Alessandro Ranellucci. <br />"
"<a href=\"http://slic3r.org/\">Slic3r</a> is licensed under the "
"<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">GNU Affero General Public License, version 3</a>."
"<br /><br />"
"Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others. "
"Manual by Gary Hodgson. Inspired by the RepRap community. <br />"
"Slic3r logo designed by Corey Daniels, <a href=\"http://www.famfamfam.com/lab/icons/silk/\">Silk Icon Set</a> designed by Mark James. "
"</font>"
"</body>"
"</html>", bgr_clr_str, text_clr_str, text_clr_str);
html->SetPage(text);
vsizer->Add(html, 1, wxEXPAND | wxBOTTOM, 10);
html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this);
}
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE);
this->SetEscapeId(wxID_CLOSE);
this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE);
vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3);
// this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this);
// logo->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this);
SetSizer(main_sizer);
main_sizer->SetSizeHints(this);
}