bool wxAnimationCtrl::Create( wxWindow *parent, wxWindowID id, const wxAnimation& anim, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if (!PreCreation( parent, pos, size ) || !base_type::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, wxDefaultValidator, name)) { wxFAIL_MSG( wxT("wxAnimationCtrl creation failed") ); return false; } SetWindowStyle(style); m_widget = gtk_image_new(); g_object_ref(m_widget); gtk_widget_show(m_widget); m_parent->DoAddChild( this ); PostCreation(size); SetInitialSize(size); if (anim.IsOk()) SetAnimation(anim); // init the timer used for animation m_timer.SetOwner(this); return true; }
/*! @brief コンストラクタ(通常) @par 関数説明 変数を初期化する。 */ Window::Window( void ) { wd.wcx.cbSize = sizeof( WNDCLASSEX ); wd.wcx.hIcon = wd.wcx.hIconSm = NULL; strcpy_s( CLASSNAME, WBUFLEN, MIKANCLASSNAME ); //クラスネームの設定 wd.wcx.lpszClassName = TEXT( MIKANCLASSNAME );//SetClassNameEx( "MikanWindow" ); //ウィンドウの名前の設定 SetWindowName( "Window" );//TEXT( __FILE__ ) //wd.wc.lpszClassName = wd.ClassName; //ウィンドウスタイルの設定 SetWindowStyle( WT_DEFAULT ); //拡張ウィンドウスタイルの設定 SetWindowStyleExDirect( NULL ); //ウィンドウを標準の位置に設定 SetPositionXY( 0, 0 );//CW_USEDEFAULT, CW_USEDEFAULT ); //ウィンドウサイズを640*480に設定 // SetWindowSize( WF_WIDTH + GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXDLGFRAME), // WF_HEIGHT + GetSystemMetrics(SM_CYEDGE) + GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYDLGFRAME) + GetSystemMetrics(SM_CYCAPTION)); SetScreenSize( WF_WIDTH, WF_HEIGHT ); //ウィンドウハンドルの設定 SetWindowHandle( NULL ); SetParentWindowHandle( NULL ); // SetWindowClass( NULL ); wd.Screen = NULL; wd.hMenu = NULL; wd.hInstance = NULL; wd.lpParam = NULL; drophandle = NULL; dragfilesmax = 0; ReceiveDragFiles_ = NULL; dragfilepath[ 0 ] = '\0'; fullscreen = 0; }
THISCLASS::TimelinePanel(wxWindow *parent, SwisTrack *st): wxControl(parent, -1), mSwisTrack(st), mSelectedComponent(0), mPopupMenu(), mTimer(this), mViewOffset(0), mViewScale(1000), mMoveStarted(false), mMoveStartPoint(0) { SetWindowStyle(wxNO_BORDER); SetSize(wxSize(20, 20)); SetMinSize(wxSize(20, 20)); // Create the popup menu mPopupMenu.AppendCheckItem(cID_TriggerAuto10, wxT("Update every 10 seconds")); mPopupMenu.AppendCheckItem(cID_TriggerAuto1, wxT("Update every second")); mPopupMenu.AppendCheckItem(cID_TriggerManual, wxT("Update manually (double click)")); mPopupMenu.AppendSeparator(); mPopupMenu.AppendCheckItem(cID_ViewReset, wxT("Reset view")); mPopupMenu.AppendCheckItem(cID_ViewZoomIn, wxT("Zoom in")); mPopupMenu.AppendCheckItem(cID_ViewZoomOut, wxT("Zoom out")); mPopupMenu.AppendSeparator(); mPopupMenu.Append(cID_SaveTimeline, wxT("Save timeline as ...")); // Set non-bold font wxFont f = GetFont(); f.SetPointSize(8); f.SetWeight(wxNORMAL); // Start the timer mTimer.Start(1000, false); }
// class constructor Resound::MonitorNodeWidget::MonitorNodeWidget(wxWindow* parent, int id, ParameterAddress _addr) : Resound::ParameterAddressWidgetBase(parent,id,_addr) { SetWindowStyle(wxSIMPLE_BORDER | wxCLIP_CHILDREN); SetBackgroundColour(wxColour(30,100,150)); SetForegroundColour(wxColour(255,255,255)); wxSize size(45,45); SetSize(size); SetMinSize(size); SetMaxSize(size); // construct the sub objects and sizer wxBoxSizer *topSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *leftSizer = new wxBoxSizer( wxVERTICAL ); SetToolTip(wxConvertMB2WX(addr.get_address().c_str())); //leftSizer->Add(new wxStaticText(this,MNW_LABEL,label, wxPoint(0,0),wxSize(40,18),wxALIGN_CENTRE),wxSizerFlags(0).Align(0).Border(wxALL,0)); //leftSizer->Add(new wxToggleButton(this,MNW_LOCKBUTTON,_("L"), wxPoint(0,0),wxSize(20,20)),wxSizerFlags(0).Center().Border(wxALL,0)); topSizer->Add(leftSizer); meter = new Resound::ParameterVUMeterWidget(this,MNW_METER,rand() % 128,0,128,_(RESOURCE_DIR "/image/smMeterOff.png"),_(RESOURCE_DIR "/image/smMeterOn.png")); meter->SetTarget(addr); topSizer->Add(meter,wxSizerFlags(0).Align(0).Border(wxALL,0)); //meter1 SetSizer(topSizer); //topSizer->SetSizeHints(this); // set size hints to honour minimum size topSizer->Layout(); }
bool wxDirButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxString &path, const wxString &message, const wxString &wildcard, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name ) { if (!(style & wxDIRP_USE_TEXTCTRL)) { // VERY IMPORTANT: this code is identic to relative code in wxFileButton; // if you find a problem here, fix it also in wxFileButton ! if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, validator, name)) { wxFAIL_MSG( wxT("wxDirButtonGTK creation failed") ); return false; } // create the dialog associated with this button SetWindowStyle(style); m_message = message; m_wildcard = wildcard; if ((m_dialog = CreateDialog()) == NULL) return false; SetPath(path); // little trick used to avoid problems when there are other GTK windows 'grabbed': // GtkFileChooserDialog won't be responsive to user events if there is another // window which called gtk_grab_add (and this happens if e.g. a wxDialog is running // in modal mode in the application - see wxDialogGTK::ShowModal). // An idea could be to put the grab on the m_dialog->m_widget when the GtkFileChooserButton // is clicked and then remove it as soon as the user closes the dialog itself. // Unfortunately there's no way to hook in the 'clicked' event of the GtkFileChooserButton, // thus we add grab on m_dialog->m_widget when it's shown and remove it when it's // hidden simply using its "show" and "hide" events - clean & simple :) g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), NULL); g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), NULL); // NOTE: we deliberately ignore the given label as GtkFileChooserButton // use as label the currently selected file m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget ); g_object_ref(m_widget); // GtkFileChooserButton signals g_signal_connect(m_widget, "current-folder-changed", G_CALLBACK(gtk_dirbutton_currentfolderchanged_callback), this); m_parent->DoAddChild( this ); PostCreation(size); SetInitialSize(size); } else return wxGenericDirButton::Create(parent, id, label, path, message, wildcard, pos, size, style, validator, name); return true; }
//--------------------------------------------------------- CWKSP_Data_Control::CWKSP_Data_Control(wxWindow *pParent) : CWKSP_Base_Control(pParent, ID_WND_WKSP_DATA) { g_pData_Ctrl = this; SetWindowStyle(wxTR_HAS_BUTTONS|wxTR_MULTIPLE); //----------------------------------------------------- IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_DATA_MANAGER); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_TABLE_MANAGER); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_TABLE); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_SHAPES_MANAGER); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_SHAPES_POINT); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_SHAPES_POINTS); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_SHAPES_LINE); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_SHAPES_POLYGON); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_TIN_MANAGER); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_TIN); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_POINTCLOUD_MANAGER); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_POINTCLOUD); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_GRID_MANAGER); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_GRID_SYSTEM); IMG_ADD_TO_TREECTRL(ID_IMG_WKSP_GRID); //----------------------------------------------------- _Set_Manager(new CWKSP_Data_Manager); }
void AboutWindow::Initialise (HWND hWnd, unsigned int uID) { // Make the ID global m_ID = uID; m_parenthwnd = hWnd; //m_hwnd = hWnd; // Temporary string value for uID char szID[SIZE_STRING]; ZeroMemory (szID, SIZE_STRING); SetParentHWND (hWnd); SetBgColor (GetSysColor (COLOR_BTNFACE)); SetCaption (TEXT ("About")); SetWindowStyle (FS_STYLESTANDARD); // Create the class name strcat_s (m_szClassname, SIZE_STRING, "ABOUTWindowClass"); sprintf_s (szID, SIZE_STRING, "%d", uID); strcat_s (m_szClassname, SIZE_STRING, szID); CreateAppWindow (m_szClassname, 70, 0, 397, 200, true); m_uihandler.SetWindowProperties (0, 0, 299, 0, GetSysColor (COLOR_BTNFACE)); SetWindowPosition (FS_CENTER); Show (); }
void TextWindow::Initialise (HWND hWnd, unsigned int uID) { // Make the ID global m_ID = uID; m_parenthwnd = hWnd; //m_hwnd = hWnd; // Temporary string value for uID char szID[SIZE_STRING]; ZeroMemory (szID, SIZE_STRING); SetParentHWND (hWnd); SetBgColor (GetSysColor (COLOR_BTNFACE)); SetCaption (TEXT ("Decrypted Text")); SetWindowStyle (FS_STYLESTANDARD); // Create the class name strcat_s (m_szClassname, SIZE_STRING, "TextWindowClass"); sprintf_s (szID, SIZE_STRING, "%d", uID); strcat_s (m_szClassname, SIZE_STRING, szID); if (m_binitialised == false) { CreateAppWindow (m_szClassname, 70, 0, 400, 550, true); m_uihandler.SetWindowProperties (0, 0, 300, 0, RGB (230, 230, 240)); SetWindowPosition (FS_CENTER); m_binitialised = true; } Show (); }
void MainFrame::OnOnTopChecked(wxCommandEvent &event) { auto style = GetWindowStyle(); if (onTopChk->IsChecked()) { style += wxSTAY_ON_TOP; } else { style -= wxSTAY_ON_TOP; } SetWindowStyle(style); }
StyledTextBox::StyledTextBox(wxWindow* parent, wxString text, wxStandardID id) : StyledWindow(parent, text ,id) { pimpl = std::make_shared<StyledTextBoxImpl>(); SetWindowStyle(GetWindowStyle() | wxWANTS_CHARS); SetRenderer(std::make_shared<StyledTextBoxRenderer>()); SetInsets(Insets(3, 3, 3, 3)); SetMinSize(wxSize(0, 22)); }
bool wxCalendarCtrlBase::EnableMonthChange(bool enable) { const long styleOrig = GetWindowStyle(); long style = enable ? styleOrig & ~wxCAL_NO_MONTH_CHANGE : styleOrig | wxCAL_NO_MONTH_CHANGE; if ( style == styleOrig ) return false; SetWindowStyle(style); return true; }
void MusikFrame::SetStayOnTop( bool bStayOnTop ) { #if defined (__WXGTK__) gtk_window_set_keep_above(GTK_WINDOW(GetHandle()),bStayOnTop ? TRUE:FALSE); #else long style = GetWindowStyle(); if ( bStayOnTop ) style |= wxSTAY_ON_TOP; else style &= ~wxSTAY_ON_TOP; SetWindowStyle( style ); #endif }
void Diagnostics::Initialise (HWND hWnd, LPSTR lpCmdLine) { SetParentHWND (hWnd); SetBgColor (RGB (200, 200, 200)); SetParentHWND (hWnd); SetCaption (TEXT ("CedeCrypt Diagnostics")); SetWindowStyle (FS_STYLESTANDARD); CreateAppWindow ("COMMDiagnosticsClass", 30, 30, 1000, 350, true); //m_uihandler.SetWindowProperties (0, 70, 40, 443, RGB (200, 200, 200)); //SetWindowPosition (FS_CENTER); ParseCommandLine (lpCmdLine); //Show (); }
//--------------------------------------------------------- CPoints_View_Dialog::CPoints_View_Dialog(CSG_PointCloud *pPoints) : CSGDI_Dialog(_TL("Point Cloud Viewer"), SGDI_DLG_STYLE_START_MAXIMISED) { SetWindowStyle(wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE); //----------------------------------------------------- m_Settings.Create(NULL, _TL("Point Cloud Viewer Settings"), _TL("")); m_pView = new CPoints_View_Control (this, pPoints, m_Settings); m_pExtent = new CPoints_View_Extent (this, pPoints, m_Settings, wxSize(200, 200)); //----------------------------------------------------- wxArrayString Attributes; for(int i=0; i<pPoints->Get_Field_Count(); i++) { Attributes.Add(pPoints->Get_Field_Name(i)); } //----------------------------------------------------- Add_Button(_TL("Close"), wxID_OK); m_pBtn_Prop = Add_Button (_TL("Advanced Settings") , wxID_ANY); Add_Spacer(); m_pField_Z = Add_Choice (_TL("Z Attribute") , Attributes, m_pView->m_zField); m_pField_Color = Add_Choice (_TL("Color Attribute") , Attributes, m_pView->m_cField); Add_Spacer(); m_pCheck_Central = Add_CheckBox (_TL("Central Projection") , m_pView->m_bCentral); m_pCheck_Stereo = Add_CheckBox (_TL("Anaglyph") , m_pView->m_bStereo); m_pCheck_Scale = Add_CheckBox (_TL("Scale Point Size") , m_pView->m_bScale); Add_Spacer(); m_pSlide_xRotate = Add_Slider (_TL("X-Rotation") , m_pView->m_xRotate * M_RAD_TO_DEG, -180.0, 180.0); m_pSlide_yRotate = Add_Slider (_TL("Y-Rotation") , m_pView->m_yRotate * M_RAD_TO_DEG, -180.0, 180.0); m_pSlide_zRotate = Add_Slider (_TL("Z-Rotation") , m_pView->m_zRotate * M_RAD_TO_DEG, -180.0, 180.0); m_pSlide_Central = Add_Slider (_TL("Eye Distance") , m_pView->m_dCentral, 1.0, 2000.0); m_pSlide_Detail = Add_Slider (_TL("Level of Detail") , m_pView->m_Detail, 0.0, 1.0); // Add_Spacer(); // m_pParameters = Add_TextCtrl (_TL("Function Parameters"), wxTE_MULTILINE|wxTE_READONLY); Add_Spacer(); Add_CustomCtrl(_TL("Extent"), m_pExtent); Add_Output(m_pView); }
wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, const wxString& defaultPath, long style, const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), const wxString& WXUNUSED(name)) { m_message = message; m_parent = parent; SetWindowStyle(style); SetPath(defaultPath); }
LoginLink(wxWindow* parent, wxString text, uint32 style) : StripMenuButton(parent, text) { wxColor linkColor = (wxColour)GetThemeManager().getColor("formlogin", "link-fg"); wxColor hoverColor = (wxColour)GetThemeManager().getColor("formlogin", "link-hov-fg"); Managers::LoadTheme(this, "formlogin"); SetWindowStyle(style); setColors(linkColor, hoverColor); showFocusBox(hoverColor); init(nullptr); Bind(wxEVT_CHAR, &LoginLink::onChar, this); }
wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, const wxString& defaultPath, long style, const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), const wxString& WXUNUSED(name)) { wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ; m_parent = parent; SetMessage( message ); SetWindowStyle(style); SetPath(defaultPath); }
void GSFrame::AppStatusEvent_OnSettingsApplied() { if( IsBeingDeleted() ) return; SetWindowStyle((g_Conf->GSWindow.DisableResizeBorders ? 0 : wxRESIZE_BORDER) | wxCAPTION | wxCLIP_CHILDREN | wxSYSTEM_MENU | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLOSE_BOX); if (!IsFullScreen() && !IsMaximized()) SetClientSize(g_Conf->GSWindow.WindowSize); Refresh(); if( g_Conf->GSWindow.CloseOnEsc ) { if( IsShown() && !CorePlugins.IsOpen(PluginId_GS) ) Show( false ); } }
SelectDirDialog::SelectDirDialog(wxWindow *parent, const wxString& name, const wxString& message, const wxString& defaultPath, const wxString& searchFile, const wxBitmap& bitmap) { m_message = message; m_parent = parent; m_name = name; m_searchFile = searchFile; m_bitmap = bitmap; SetWindowStyle(wxDD_DEFAULT_STYLE); SetPath(defaultPath); }
QuickLaunchBar::QuickLaunchBar(HWND hwnd) : super(hwnd) { CONTEXT("QuickLaunchBar::QuickLaunchBar()"); _dir = NULL; _next_id = IDC_FIRST_QUICK_ID; _btn_dist = 20; _size = 0; HWND hwndToolTip = (HWND) SendMessage(hwnd, TB_GETTOOLTIPS, 0, 0); SetWindowStyle(hwndToolTip, GetWindowStyle(hwndToolTip)|TTS_ALWAYSTIP); // delay refresh to some time later PostMessage(hwnd, PM_REFRESH, 0, 0); }
bool wxToolBar::Create(wxWindow *parent, wxWindowID WXUNUSED(id), const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), long style, const wxString& name) { // TODO: we may need to make this a dummy hidden window to // satisfy other parts of wxWidgets. parent->AddChild(this); SetWindowStyle(style); SetName(name); return true; }
void wxCalendarCtrlBase::EnableHolidayDisplay(bool display) { long style = GetWindowStyle(); if ( display ) style |= wxCAL_SHOW_HOLIDAYS; else style &= ~wxCAL_SHOW_HOLIDAYS; if ( style == GetWindowStyle() ) return; SetWindowStyle(style); if ( display ) SetHolidayAttrs(); else ResetHolidayAttrs(); RefreshHolidays(); }
Notebook::Notebook(wxWindow* parent) : wxAuiNotebook(parent) { SetWindowStyle( wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_MOVE | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TOP | wxAUI_NB_WINDOWLIST_BUTTON); mInfo = new Info(this); mExplorer = new Explorer(this); // mLibrary = new Library(this); mProperties = new Properties(this); mTools = new Tools(this); AddPage(mInfo, "Info"); AddPage(mExplorer, "Explorer"); // AddPage(mLibrary, "Library"); AddPage(mProperties, "Properties"); AddPage(mTools, "Tools"); }
void wxGenericProgressDialog::Init() { // we may disappear at any moment, let the others know about it SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT); // Initialize all our members that we always use (even when we don't // create a valid window in this class). m_pdStyle = 0; m_parentTop = NULL; m_gauge = NULL; m_msg = NULL; m_elapsed = m_estimated = m_remaining = NULL; m_state = Uncancelable; m_maximum = 0; m_timeStart = wxGetCurrentTime(); m_timeStop = (unsigned long)-1; m_break = 0; m_skip = false; m_btnAbort = m_btnSkip = NULL; m_display_estimated = m_last_timeupdate = m_ctdelay = 0; m_delay = 3; m_winDisabler = NULL; m_tempEventLoop = NULL; SetWindowStyle(wxDEFAULT_DIALOG_STYLE); }
bool wxFileButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxString &path, const wxString &message, const wxString &wildcard, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name ) { // we can't use the native button for wxFLP_SAVE pickers as it can only // open existing files and there is no way to create a new file using it if (!(style & wxFLP_SAVE) && !(style & wxFLP_USE_TEXTCTRL)) { // VERY IMPORTANT: this code is identical to relative code in wxDirButton; // if you find a problem here, fix it also in wxDirButton ! if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, validator, name)) { wxFAIL_MSG( wxT("wxFileButton creation failed") ); return false; } // create the dialog associated with this button // NB: unlike generic implementation, native GTK implementation needs to create // the filedialog here as it needs to use gtk_file_chooser_button_new_with_dialog() SetWindowStyle(style); m_path = path; m_message = message; m_wildcard = wildcard; if ((m_dialog = CreateDialog()) == NULL) return false; // little trick used to avoid problems when there are other GTK windows 'grabbed': // GtkFileChooserDialog won't be responsive to user events if there is another // window which called gtk_grab_add (and this happens if e.g. a wxDialog is running // in modal mode in the application - see wxDialogGTK::ShowModal). // An idea could be to put the grab on the m_dialog->m_widget when the GtkFileChooserButton // is clicked and then remove it as soon as the user closes the dialog itself. // Unfortunately there's no way to hook in the 'clicked' event of the GtkFileChooserButton, // thus we add grab on m_dialog->m_widget when it's shown and remove it when it's // hidden simply using its "show" and "hide" events - clean & simple :) g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), NULL); g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), NULL); // use as label the currently selected file m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget ); g_object_ref(m_widget); // we need to know when the dialog has been dismissed clicking OK... // NOTE: the "clicked" signal is not available for a GtkFileChooserButton // thus we are forced to use wxFileDialog's event m_dialog->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxFileButton::OnDialogOK), NULL, this); m_parent->DoAddChild( this ); PostCreation(size); SetInitialSize(size); } else return wxGenericFileButton::Create(parent, id, label, path, message, wildcard, pos, size, style, validator, name); return true; }
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) style |= wxBORDER_SIMPLE; SetWindowStyle(style); WXDWORD exStyle = 0; WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; wxSize sizeText(size), sizeBtn(size); sizeBtn.x = GetBestSpinnerSize(IsVertical(style)).x / 2; if ( sizeText.x == wxDefaultCoord ) { // DEFAULT_ITEM_WIDTH is the default width for the text control sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; } sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; if ( sizeText.x <= 0 ) { wxLogDebug(_T("not enough space for wxSpinCtrl!")); } wxPoint posBtn(pos); posBtn.x += sizeText.x + MARGIN_BETWEEN; // we need to turn '\n's into "\r\n"s for the multiline controls wxString valueWin; if ( m_windowStyle & wxTE_MULTILINE ) { valueWin = wxTextFile::Translate(value, wxTextFileType_Dos); } else // single line { valueWin = value; } // we must create the list control before the spin button for the purpose // of the dialog navigation: if there is a static text just before the spin // control, activating it by Alt-letter should give focus to the text // control, not the spin and the dialog navigation code will give focus to // the next control (at Windows level), not the one after it // create the text window m_hwndBuddy = (WXHWND)::CreateWindowEx ( exStyle, // sunken border _T("EDIT"), // window class valueWin, // no window title msStyle, // style (will be shown later) pos.x, pos.y, // position 0, 0, // size (will be set later) GetHwndOf(parent), // parent (HMENU)-1, // control id wxGetInstance(), // app instance NULL // unused client data ); if ( !m_hwndBuddy ) { wxLogLastError(wxT("CreateWindow(buddy text window)")); return false; } // initialize wxControl if ( !CreateControl(parent, id, posBtn, sizeBtn, style, validator, name) ) return false; // now create the real HWND WXDWORD spiner_style = WS_VISIBLE | UDS_ALIGNRIGHT | UDS_EXPANDABLE | UDS_NOSCROLL; if ( !IsVertical(style) ) spiner_style |= UDS_HORZ; if ( style & wxSP_WRAP ) spiner_style |= UDS_WRAP; if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, _T(""), 0) ) return false; // subclass the text ctrl to be able to intercept some events wxSetWindowUserData(GetBuddyHwnd(), this); m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), wxBuddyTextCtrlWndProc); // set up fonts and colours (This is nomally done in MSWCreateControl) InheritAttributes(); if (!m_hasFont) SetFont(GetDefaultAttributes().font); // set the size of the text window - can do it only now, because we // couldn't call DoGetBestSize() before as font wasn't set if ( sizeText.y <= 0 ) { int cx, cy; wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } SetInitialSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); // associate the list window with the spin button (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0); // do it after finishing with m_hwndBuddy creation to avoid generating // initial wxEVT_COMMAND_TEXT_UPDATED message ms_allTextSpins.Add(this); return true; }
void DesktopShellView::PositionIcons(int dir) { DWORD spacing = ListView_GetItemSpacing(_hwndListView, FALSE); RECT work_area; SystemParametersInfo(SPI_GETWORKAREA, 0, &work_area, 0); /* disable default allignment */ SetWindowStyle(_hwndListView, GetWindowStyle(_hwndListView)&~LVS_ALIGNMASK);//|LVS_ALIGNTOP|LVS_AUTOARRANGE); const POINTS& dir1 = s_align_dir1[_icon_algo]; const POINTS& dir2 = s_align_dir2[_icon_algo]; const POINTS& start_pos = s_align_start[_icon_algo]; int dir_x1 = dir1.x; int dir_y1 = dir1.y; int dir_x2 = dir2.x; int dir_y2 = dir2.y; int cx = LOWORD(spacing); int cy = HIWORD(spacing); int dx1 = dir_x1 * cx; int dy1 = dir_y1 * cy; int dx2 = dir_x2 * cx; int dy2 = dir_y2 * cy; int xoffset = (cx-32)/2; int yoffset = 4/*(cy-32)/2*/; int start_x = start_pos.x * (work_area.right - cx) + xoffset; int start_y = start_pos.y * (work_area.bottom - cy) + yoffset; int x = start_x; int y = start_y; int all = ListView_GetItemCount(_hwndListView); int i1, i2; if (dir > 0) { i1 = 0; i2 = all; } else { i1 = all-1; i2 = -1; } IconMap pos_idx; int cnt = 0; int xhv = start_x; int yhv = start_y; for(int idx=i1; idx!=i2; idx+=dir) { pos_idx[IconPos(y, x)] = idx; if (_icon_algo == ARRANGE_BORDER_DOWN) { if (++cnt & 1) x = work_area.right - x - cx + 2*xoffset; else { y += dy1; if (y + cy - 2 * yoffset > work_area.bottom) { y = start_y; start_x += dx2; x = start_x; } } continue; } else if (_icon_algo == ARRANGE_BORDER_HV) { if (++cnt & 1) x = work_area.right - x - cx + 2*xoffset; else if (cnt & 2) { yhv += cy; y = yhv; x = start_x; if (y + cy - 2 * yoffset > work_area.bottom) { start_x += cx; xhv = start_x; x = xhv; start_y += cy; yhv = start_y; y = yhv; } } else { xhv += cx; x = xhv; y = start_y; if (x + cx - 2 * xoffset > work_area.right) { start_x += cx; xhv = start_x; x = xhv; start_y += cy; yhv = start_y; y = yhv; } } continue; } else if (_icon_algo == ARRANGE_ROUNDABOUT) { ///@todo } x += dx1; y += dy1; if (x<0 || x+cx-2*xoffset>work_area.right) { x = start_x; y += dy2; } else if (y<0 || y+cy-2*yoffset>work_area.bottom) { y = start_y; x += dx2; } } // use a little trick to get the icons where we want them to be... //for(IconMap::const_iterator it=pos_idx.end(); --it!=pos_idx.begin(); ) { // const IconPos& pos = it->first; // ListView_SetItemPosition32(_hwndListView, it->second, pos.second, pos.first); //} for(IconMap::const_iterator it=pos_idx.begin(); it!=pos_idx.end(); ++it) { const IconPos& pos = it->first; ListView_SetItemPosition32(_hwndListView, it->second, pos.second, pos.first); } }
bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, int min, int max, int initial, const wxString& name) { // before using DoGetBestSize(), have to set style to let the base class // know whether this is a horizontal or vertical control (we're always // vertical) style |= wxSP_VERTICAL; if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) #ifdef __WXWINCE__ style |= wxBORDER_SIMPLE; #else style |= wxBORDER_SUNKEN; #endif SetWindowStyle(style); WXDWORD exStyle = 0; WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; // Scroll text automatically if there is not enough space to show all of // it, this is better than not allowing to enter more digits at all. msStyle |= ES_AUTOHSCROLL; // propagate text alignment style to text ctrl if ( style & wxALIGN_RIGHT ) msStyle |= ES_RIGHT; else if ( style & wxALIGN_CENTER ) msStyle |= ES_CENTER; // calculate the sizes: the size given is the total size for both controls // and we need to fit them both in the given width (height is the same) wxSize sizeText(size), sizeBtn(size); sizeBtn.x = wxSpinButton::DoGetBestSize().x; if ( sizeText.x <= 0 ) { // DEFAULT_ITEM_WIDTH is the default width for the text control sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; } sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; if ( sizeText.x <= 0 ) { wxLogDebug(wxT("not enough space for wxSpinCtrl!")); } wxPoint posBtn(pos); posBtn.x += sizeText.x + MARGIN_BETWEEN; // we must create the text control before the spin button for the purpose // of the dialog navigation: if there is a static text just before the spin // control, activating it by Alt-letter should give focus to the text // control, not the spin and the dialog navigation code will give focus to // the next control (at Windows level), not the one after it // create the text window m_hwndBuddy = (WXHWND)::CreateWindowEx ( exStyle, // sunken border wxT("EDIT"), // window class NULL, // no window title msStyle, // style (will be shown later) pos.x, pos.y, // position 0, 0, // size (will be set later) GetHwndOf(parent), // parent (HMENU)-1, // control id wxGetInstance(), // app instance NULL // unused client data ); if ( !m_hwndBuddy ) { wxLogLastError(wxT("CreateWindow(buddy text window)")); return false; } // create the spin button if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) ) { return false; } wxSpinButtonBase::SetRange(min, max); // subclass the text ctrl to be able to intercept some events gs_spinForTextCtrl[GetBuddyHwnd()] = this; m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), wxBuddyTextWndProc); // set up fonts and colours (This is nomally done in MSWCreateControl) InheritAttributes(); if (!m_hasFont) SetFont(GetDefaultAttributes().font); // set the size of the text window - can do it only now, because we // couldn't call DoGetBestSize() before as font wasn't set if ( sizeText.y <= 0 ) { int cx, cy; wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } SetInitialSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); // associate the text window with the spin button (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0); // If the initial text value is actually a number, it overrides the // "initial" argument specified later. long initialFromText; if ( value.ToLong(&initialFromText) ) initial = initialFromText; SetValue(initial); m_oldValue = initial; // Set the range in the native control SetRange(min, max); // Also set the text part of the control if it was specified independently // but don't generate an event for this, it would be unexpected. m_blockEvent = true; if ( !value.empty() ) SetValue(value); m_blockEvent = false; return true; }
bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, int min, int max, int initial, const wxString& name) { // this should be in ctor/init function but I don't want to add one to 2.8 // to avoid problems with default ctor which can be inlined in the user // code and so might not get this fix without recompilation m_oldValue = INT_MIN; // before using DoGetBestSize(), have to set style to let the base class // know whether this is a horizontal or vertical control (we're always // vertical) style |= wxSP_VERTICAL; if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) #ifdef __WXWINCE__ style |= wxBORDER_SIMPLE; #else style |= wxBORDER_SUNKEN; #endif SetWindowStyle(style); WXDWORD exStyle = 0; WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; // calculate the sizes: the size given is the toal size for both controls // and we need to fit them both in the given width (height is the same) wxSize sizeText(size), sizeBtn(size); sizeBtn.x = wxSpinButton::DoGetBestSize().x; if ( sizeText.x <= 0 ) { // DEFAULT_ITEM_WIDTH is the default width for the text control sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; } sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; if ( sizeText.x <= 0 ) { wxLogDebug(_T("not enough space for wxSpinCtrl!")); } wxPoint posBtn(pos); posBtn.x += sizeText.x + MARGIN_BETWEEN; // we must create the text control before the spin button for the purpose // of the dialog navigation: if there is a static text just before the spin // control, activating it by Alt-letter should give focus to the text // control, not the spin and the dialog navigation code will give focus to // the next control (at Windows level), not the one after it // create the text window m_hwndBuddy = (WXHWND)::CreateWindowEx ( exStyle, // sunken border _T("EDIT"), // window class NULL, // no window title msStyle, // style (will be shown later) pos.x, pos.y, // position 0, 0, // size (will be set later) GetHwndOf(parent), // parent (HMENU)-1, // control id wxGetInstance(), // app instance NULL // unused client data ); if ( !m_hwndBuddy ) { wxLogLastError(wxT("CreateWindow(buddy text window)")); return false; } // create the spin button if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) ) { return false; } wxSpinButtonBase::SetRange(min, max); // subclass the text ctrl to be able to intercept some events wxSetWindowUserData(GetBuddyHwnd(), this); m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), wxBuddyTextWndProc); // set up fonts and colours (This is nomally done in MSWCreateControl) InheritAttributes(); if (!m_hasFont) SetFont(GetDefaultAttributes().font); // set the size of the text window - can do it only now, because we // couldn't call DoGetBestSize() before as font wasn't set if ( sizeText.y <= 0 ) { int cx, cy; wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } SetInitialSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); // associate the text window with the spin button (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0); SetValue(initial); // Set the range in the native control SetRange(min, max); if ( !value.empty() ) { SetValue(value); m_oldValue = (int) wxAtol(value); } else { SetValue(wxString::Format(wxT("%d"), initial)); m_oldValue = initial; } // do it after finishing with m_hwndBuddy creation to avoid generating // initial wxEVT_COMMAND_TEXT_UPDATED message ms_allSpins.Add(this); return true; }
//--------------------------------------------------------- CSG_3DView_Dialog::CSG_3DView_Dialog(const CSG_String &Caption) : CSGDI_Dialog(Caption.c_str(), SGDI_DLG_STYLE_START_MAXIMISED) { SetWindowStyle(wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE); }