int App::main(const std::vector<std::string> &args) { DisplayWindow display_window("Custom GUI Components", 640, 480); GUIManager gui(display_window, "Resources"); Slot slot_window_close = display_window.sig_window_close().connect(this, &App::on_window_close, &gui); // Note - If you are using the GL1 target, you will get a perfomance increase by enabling these 2 lines // It reduces the number of internal FrameBuffer swaps. The GL1 target (OpenGL 1.3), performs this slowly // Setting the texture group here, lets the GUI Texture Window Manager know the optimum texture size of all root components //TextureGroup texture_group(display_window.get_gc(), Size(1024, 1024)); //((GUIWindowManagerTexture)gui.get_window_manager()).set_texture_group() Rect viewport = display_window.get_viewport(); GameComponent game_component(viewport, &gui); Rect toolbar_rect = Rect((viewport.right - 448) / 2, viewport.bottom - 56, (viewport.right - 448) / 2 + 448, viewport.bottom); Toolbar toolbar(toolbar_rect, &game_component); // GameComponent is the "desktop" that the toolbar sits on, as an owner GraphicContext gc = display_window.get_gc(); toolbar.add_item(Sprite(gc, "Resources/Images/spell1.png"), Sprite(gc, "Resources/Images/spell1_selected.png"), Sprite(gc, "Resources/Images/spell1_clicked.png")); toolbar.add_item(Sprite(gc, "Resources/Images/spell2.png"), Sprite(gc, "Resources/Images/spell2_selected.png"), Sprite(gc, "Resources/Images/spell2_clicked.png")); toolbar.add_item(Sprite(gc, "Resources/Images/spell3.png"), Sprite(gc, "Resources/Images/spell3_selected.png"), Sprite(gc, "Resources/Images/spell3_clicked.png")); toolbar.add_item(Sprite(gc, "Resources/Images/spell4.png"), Sprite(gc, "Resources/Images/spell4_selected.png"), Sprite(gc, "Resources/Images/spell4_clicked.png")); toolbar.add_item(Sprite(gc, "Resources/Images/spell5.png"), Sprite(gc, "Resources/Images/spell5_selected.png"), Sprite(gc, "Resources/Images/spell5_clicked.png")); toolbar.add_item(Sprite(gc, "Resources/Images/spell6.png"), Sprite(gc, "Resources/Images/spell6_selected.png"), Sprite(gc, "Resources/Images/spell6_clicked.png")); toolbar.add_item(Sprite(gc, "Resources/Images/spell7.png"), Sprite(gc, "Resources/Images/spell7_selected.png"), Sprite(gc, "Resources/Images/spell7_clicked.png")); gui.exec(); return 0; }
void ZLWin32ApplicationWindow::runPopup(const NMTOOLBAR &nmToolbar) { Toolbar &tb = toolbar(isFullscreen() ? FULLSCREEN_TOOLBAR : WINDOW_TOOLBAR); if (tb.hwnd == 0) { return; } ZLToolbar::ItemPtr item = tb.TBItemByActionCode[nmToolbar.iItem]; if (!item.isNull()) { const ZLToolbar::MenuButtonItem &button = (const ZLToolbar::MenuButtonItem&)*item; shared_ptr<ZLPopupData> popupData = button.popupData(); if (!popupData.isNull()) { const int count = popupData->count(); if (count != 0) { myPopupMenu = new ZLWin32PopupMenu(myMainWindow); for (int i = 0; i < count; ++i) { myPopupMenu->addItem(popupData->text(i), 0, true); } POINT p; p.x = nmToolbar.rcButton.left; p.y = nmToolbar.rcButton.bottom + 6; ClientToScreen(myMainWindow, &p); int code = myPopupMenu->run(p); if (code > 0) { popupData->run(code - 1); } myPopupMenu.reset(); } } } }
void ZLApplication::createToolbar(int index) { toolbar(index); std::string fileName = ZLibrary::DefaultFilesPathPrefix(); const bool isWindowToolbar = index == ZLApplicationWindow::WINDOW_TOOLBAR; fileName += isWindowToolbar ? "toolbar.xml" : "fullscreen_toolbar.xml"; ZLToolbarCreator(isWindowToolbar ? *myToolbar : *myFullscreenToolbar).readDocument(fileName); }
void ZLWin32ApplicationWindow::setToggleButtonState(const ZLToolbar::ToggleButtonItem &button) { Toolbar &tb = toolbar(type(button)); if (tb.hwnd == 0) { return; } PostMessage(tb.hwnd, TB_CHECKBUTTON, tb.ActionCodeById[button.actionId()], button.isPressed()); }
void ZLWin32ApplicationWindow::setTooltip(TOOLTIPTEXT &tooltip) { Toolbar &tb = toolbar(isFullscreen() ? FULLSCREEN_TOOLBAR : WINDOW_TOOLBAR); if (tb.hwnd == 0) { return; } ZLToolbar::ItemPtr item = tb.TBItemByActionCode[tooltip.hdr.idFrom]; if (!item.isNull()) { const ZLToolbar::AbstractButtonItem &button = (const ZLToolbar::AbstractButtonItem&)*item; ZLUnicodeUtil::Ucs2String tooltipBuffer; ::createNTWCHARString(tooltipBuffer, button.tooltip()); size_t length = std::max(tooltipBuffer.size(), (size_t)80); memcpy((char*)tooltip.szText, (char*)::wchar(tooltipBuffer), 2 * length); tooltip.uFlags = TTF_DI_SETITEM; } }
void ZLQtApplicationWindow::addToolbarItem(ZLToolbar::ItemPtr item) { QToolBar *tb = toolbar(type(*item)); QAction *action = 0; switch (item->type()) { case ZLToolbar::Item::PLAIN_BUTTON: case ZLToolbar::Item::TOGGLE_BUTTON: action = new ZLQtToolBarAction(this, (ZLToolbar::AbstractButtonItem&)*item); tb->addAction(action); break; case ZLToolbar::Item::MENU_BUTTON: { ZLToolbar::MenuButtonItem &buttonItem = (ZLToolbar::MenuButtonItem&)*item; QToolButton *button = new QToolButton(tb); button->setFocusPolicy(Qt::NoFocus); button->setDefaultAction(new ZLQtToolBarAction(this, buttonItem)); button->setMenu(new QMenu(button)); button->setPopupMode(QToolButton::MenuButtonPopup); action = tb->addWidget(button); myMenuButtons[&buttonItem] = button; shared_ptr<ZLPopupData> popupData = buttonItem.popupData(); myPopupIdMap[&buttonItem] = popupData.isNull() ? (size_t)-1 : (popupData->id() - 1); break; } case ZLToolbar::Item::TEXT_FIELD: case ZLToolbar::Item::SEARCH_FIELD: { ZLToolbar::ParameterItem &textFieldItem = (ZLToolbar::ParameterItem&)*item; LineEditParameter *para = new LineEditParameter(tb, *this, textFieldItem); addVisualParameter(textFieldItem.parameterId(), para); action = para->action(); break; } case ZLToolbar::Item::SEPARATOR: action = tb->addSeparator(); break; } if (action != 0) { myActions[&*item] = action; } }
void ZLWin32ApplicationWindow::onToolbarButtonRelease(int actionCode) { Toolbar &tb = toolbar(isFullscreen() ? FULLSCREEN_TOOLBAR : WINDOW_TOOLBAR); if (tb.hwnd == 0) { return; } std::map<int,ZLToolbar::ItemPtr>::const_iterator it = tb.TBItemByActionCode.find(actionCode); if ((it == tb.TBItemByActionCode.end()) || it->second.isNull()) { return; } switch (it->second->type()) { default: break; case ZLToolbar::Item::PLAIN_BUTTON: case ZLToolbar::Item::MENU_BUTTON: case ZLToolbar::Item::TOGGLE_BUTTON: onButtonPress((ZLToolbar::AbstractButtonItem&)*it->second); break; } }
void ZLWin32ApplicationWindow::setToolbarItemState(ZLToolbar::ItemPtr item, bool visible, bool enabled) { Toolbar &tb = toolbar(type(*item)); if (tb.hwnd == 0) { return; } const ZLToolbar::Item::Type type = item->type(); switch (type) { case ZLToolbar::Item::TEXT_FIELD: case ZLToolbar::Item::COMBO_BOX: { const ZLToolbar::ParameterItem &textFieldItem = (const ZLToolbar::ParameterItem&)*item; HWND handle = myParameters[tb.ParameterCodeById[textFieldItem.actionId()]]; if (handle != 0) { const int idCommand = tb.ParameterCodeById[textFieldItem.actionId()]; PostMessage(tb.hwnd, TB_SETSTATE, idCommand, visible ? 0 : TBSTATE_HIDDEN); ShowWindow(handle, visible ? SW_SHOW : SW_HIDE); PostMessage(handle, EM_SETREADONLY, !enabled, 0); } break; } case ZLToolbar::Item::PLAIN_BUTTON: case ZLToolbar::Item::MENU_BUTTON: case ZLToolbar::Item::TOGGLE_BUTTON: { ZLToolbar::AbstractButtonItem &buttonItem = (ZLToolbar::AbstractButtonItem&)*item; LPARAM state = (visible ? 0 : TBSTATE_HIDDEN) | (enabled ? TBSTATE_ENABLED : 0); const int idCommand = tb.ActionCodeById[buttonItem.actionId()]; PostMessage(tb.hwnd, TB_SETSTATE, (WPARAM)idCommand, state); break; } case ZLToolbar::Item::SEPARATOR: PostMessage(tb.hwnd, TB_SETSTATE, tb.SeparatorNumbers[item], visible ? 0 : TBSTATE_HIDDEN); break; } }
AppDBWidget::AppDBWidget(QWidget *parent) : QWidget(parent) { // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); //Init AppDB Core Classes xmlparser.reset(new XmlParser()); httpcore.reset(new HttpCore()); //Init delay timer timer.reset(new QTimer(this)); this->createActions(); std::auto_ptr<QToolBar> toolbar (new QToolBar()); toolbar->setIconSize(QSize(24, 24)); toolbar->addAction(appdbOpen.get()); toolbar->addAction(appdbAppPage.get()); toolbar->addSeparator(); toolbar->addAction(appdbCat.get()); toolbar->addSeparator(); toolbar->addAction(appdbClear.get()); toolbar->addAction(appdbClearSearch.get()); searchField.reset (new QLineEdit(this)); connect(searchField.get(), SIGNAL(returnPressed()), this, SLOT(appdbSearch_Click())); toolbar->addWidget(searchField.get()); toolbar->addAction(appdbSearch.get()); //Init custom widgets appdbHeader.reset(new AppDBHeaderWidget()); connect(appdbHeader.get(), SIGNAL(itemTrigged(short int, QString, int, int, int)), this, SLOT(itemTrigged(short int, QString, int, int, int))); appdbScrollArea.reset(new AppDBScrollWidget()); connect(appdbScrollArea.get(), SIGNAL(itemTrigged(short int, QString, int, int, int)), this, SLOT(itemTrigged(short int, QString, int, int, int))); //Add custom widgets to mail layout std::auto_ptr<QVBoxLayout> contentLayout(new QVBoxLayout(this)); contentLayout->setMargin(0); contentLayout->setSpacing(0); contentLayout->addWidget(toolbar.release()); contentLayout->addWidget(appdbHeader.get()); contentLayout->addWidget(appdbScrollArea.get()); this->setLayout(contentLayout.release()); //Connect slots and signals connect(timer.get(), SIGNAL(timeout()), this, SLOT(timer_timeout())); connect(httpcore.get(), SIGNAL(pageReaded()), this, SLOT(httpcore_pageDownloaded())); connect(httpcore.get(), SIGNAL(requestError(QString)), this, SLOT(requestError(QString))); connect(httpcore.get(), SIGNAL(updateDataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); connect(httpcore.get(), SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int))); this->appdbHeader->addLabel(tr("Status: Ready")); timer->stop(); return; }
void ZLWin32ApplicationWindow::addToolbarItem(ZLToolbar::ItemPtr item) { if (myRebar == 0) { createWindowToolbar(); } Toolbar &tb = toolbar(type(*item)); if (tb.hwnd == 0) { myFloatingToolbarItems.push_back(item); return; } TBBUTTON button; button.fsState = TBSTATE_ENABLED; const ZLToolbar::Item::Type type = item->type(); switch (type) { case ZLToolbar::Item::TEXT_FIELD: case ZLToolbar::Item::COMBO_BOX: { const ZLToolbar::ParameterItem &textFieldItem = (ZLToolbar::ParameterItem&)*item; button.idCommand = -200 + tb.ParameterCodeById.size(); tb.ParameterCodeById[textFieldItem.actionId()] = button.idCommand; button.iBitmap = I_IMAGENONE; button.fsStyle = TBSTYLE_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT; button.fsState = 0; tb.TBItemByActionCode[button.idCommand] = item; break; } case ZLToolbar::Item::PLAIN_BUTTON: case ZLToolbar::Item::MENU_BUTTON: case ZLToolbar::Item::TOGGLE_BUTTON: { const ZLToolbar::AbstractButtonItem &buttonItem = (const ZLToolbar::AbstractButtonItem&)*item; std::string imageFileName = ZLibrary::ApplicationImageDirectory() + ZLibrary::FileNameDelimiter + buttonItem.iconName() + ".ico"; ZLFile file(imageFileName); ZLUnicodeUtil::Ucs2String wPath; HICON bitmap = (HICON)LoadImageW(0, ::wchar(::createNTWCHARString(wPath, file.path())), IMAGE_ICON, IconSize, IconSize, LR_LOADFROMFILE); ImageList_AddIcon((HIMAGELIST)SendMessage(tb.hwnd, TB_GETIMAGELIST, 0, 0), bitmap); button.iBitmap = tb.ActionCodeById.size(); button.fsStyle = TBSTYLE_BUTTON; if (type == ZLToolbar::Item::MENU_BUTTON) { button.fsStyle |= TBSTYLE_DROPDOWN; } else if (type == ZLToolbar::Item::TOGGLE_BUTTON) { button.fsStyle |= TBSTYLE_CHECK; } const int actionCode = tb.ActionCodeById.size() + 1; tb.ActionCodeById[buttonItem.actionId()] = actionCode; button.idCommand = actionCode; tb.TBItemByActionCode[button.idCommand] = item; button.dwData = 0; button.iString = 0; break; } case ZLToolbar::Item::SEPARATOR: { button.idCommand = -100 - tb.SeparatorNumbers.size(); tb.SeparatorNumbers[item] = button.idCommand; button.iBitmap = 6; button.fsStyle = TBSTYLE_SEP; break; } } SendMessage(tb.hwnd, TB_ADDBUTTONS, 1, (LPARAM)&button); switch (type) { default: break; case ZLToolbar::Item::TEXT_FIELD: case ZLToolbar::Item::COMBO_BOX: { const ZLToolbar::ParameterItem &textFieldItem = (ZLToolbar::ParameterItem&)*item; TBBUTTONINFO buttonInfo; buttonInfo.cbSize = sizeof(TBBUTTONINFO); buttonInfo.dwMask = TBIF_SIZE; buttonInfo.cx = 10 + 8 * textFieldItem.maxWidth(); if (type == ZLToolbar::Item::COMBO_BOX) { buttonInfo.cx += 15; } SendMessage(tb.hwnd, TB_SETBUTTONINFO, button.idCommand, (LPARAM)&buttonInfo); TextEditParameter *parameter = new TextEditParameter(application(), myMainWindow, tb.hwnd, button.idCommand, textFieldItem); addVisualParameter(textFieldItem.parameterId(), parameter); myParameters[button.idCommand] = parameter->handle(); break; } } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), pixmapCache_(3) { ready_ = false; updateDisplayTimer_ = NULL; loopPixmapItem_ = NULL; hideLoopItemTimer_ = NULL; loopPixmap_ = NULL; pixmap_ = NULL; rotation_ = 0; invalidated_ = true; selectionInvalidated_ = true; autoFit_ = true; loopAnimationPlaying_ = false; progressBarCancelButton_ = NULL; progressBar_ = NULL; selectionP1_ = QPoint(0,0); selectionP2_ = QPoint(0,0); mv::messageBoxes::setParent(this); possibleZoomValues_.push_back(1.0/128.0); possibleZoomValues_.push_back(1.0/64.0); possibleZoomValues_.push_back(1.0/32.0); possibleZoomValues_.push_back(1.0/16.0); possibleZoomValues_.push_back(1.0/8.0); possibleZoomValues_.push_back(1.0/4.0); possibleZoomValues_.push_back(1.0/2.0); possibleZoomValues_.push_back(1.0/1.5); possibleZoomValues_.push_back(1.0); possibleZoomValues_.push_back(1.5); possibleZoomValues_.push_back(2.0); possibleZoomValues_.push_back(4.0); possibleZoomValues_.push_back(8.0); possibleZoomValues_.push_back(16.0); possibleZoomValues_.push_back(32.0); possibleZoomValues_.push_back(64.0); possibleZoomValues_.push_back(128.0); zoomIndex_ = possibleZoomValues_.size() / 2; noZoomIndex_ = zoomIndex_; ui->setupUi(this); statusBar()->layout()->setSpacing(0); scene_ = new QGraphicsScene(this); scene_->setBackgroundBrush(QBrush(Qt::black)); view_ = new XGraphicsView(scene_, this); view_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); pixmapItem_ = new QGraphicsPixmapItem(); scene_->addItem(pixmapItem_); selectionRectItem_ = new QGraphicsRectItem(); selectionRectItem_->setBrush(QBrush(QColor(255,255,255,25))); selectionRectItem_->setPen(QPen(Qt::black)); selectionRectItem_->setZValue(1000); selectionRectItem_->setVisible(false); selectionRectItem_->setRect(0,0,0,0); scene_->addItem(selectionRectItem_); selectionRectItem2_ = new QGraphicsRectItem(); selectionRectItem2_->setBrush(QBrush(QColor(255,255,255,0))); QPen pen; QVector<qreal> dashes; dashes << 4 << 4; pen.setDashPattern(dashes); pen.setColor(Qt::white); selectionRectItem2_->setPen(pen); selectionRectItem2_->setZValue(1001); selectionRectItem2_->setVisible(false); selectionRectItem2_->setRect(0,0,0,0); scene_->addItem(selectionRectItem2_); splitter_ = new QSplitter(this); splitter_->setOrientation(Qt::Vertical); console_ = new mv::ConsoleWidget(this); splitter_->addWidget(view_); splitter_->addWidget(console_); console_->hide(); connect(splitter_, SIGNAL(splitterMoved(int, int)), this, SLOT(splitter_splitterMoved(int, int))); toolbar()->setStyleSheet("QToolButton:hover { background-color: rgba(0, 0, 0, 10%); } QToolButton:!hover { color: rgba(0, 0, 0, 0%); }"); ui->centralwidget->layout()->addWidget(splitter_); connect(view_, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(view_mousePress(QMouseEvent*))); connect(view_, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(view_mouseRelease(QMouseEvent*))); connect(view_, SIGNAL(mouseDrag(QMouseEvent*)), this, SLOT(view_mouseDrag(QMouseEvent*))); view_->show(); ready_ = true; invalidate(); }
void ZLApplication::registerPopupData(const std::string &actionId, shared_ptr<ZLPopupData> popupData) { toolbar(ZLApplicationWindow::WINDOW_TOOLBAR); myToolbar->registerPopupData(actionId, popupData); }
shared_ptr<ZLPopupData> ZLToolbar::MenuButtonItem::popupData() const { std::map<std::string,shared_ptr<ZLPopupData> >::const_iterator it = toolbar().myPopupDataMap.find(actionId()); return (it == toolbar().myPopupDataMap.end()) ? 0 : it->second; }
LRESULT CMainWindow::OnCreate (UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &bHandled) { bHandled = false; subscribe(this); SetWindowText(MAIN_TITLE); if (m_ctrlMain == NULL) { m_ctrlMain.reset(new xl::ui::CCtrlMain(this, this)); } #if 0 // move to file list ready // gesture m_ctrlMain->enableGesture(true); m_ctrlMain->setStyle(_T("background:none")); xl::ui::CControlPtr gestureCtrl = m_ctrlMain->getGestureCtrl(); gestureCtrl->setStyle(_T("color:#ff0000; font-size:16;")); #endif // the view CImageView *pView = new CImageView(this); m_view = xl::ui::CControlPtr(pView); m_ctrlMain->insertChild(m_view); // nav button (left and right) xl::ui::CControlPtr navbtn(new CNavButton(true)); navbtn->setStyle(_T("width:200; margin:0 0; disable:true;")); m_ctrlMain->insertChild(navbtn); m_navbtn[0] = navbtn; navbtn.reset(new CNavButton(false)); navbtn->setStyle(_T("width:200; margin:0 0; disable:true;")); m_ctrlMain->insertChild(navbtn); m_navbtn[1] = navbtn; // toolbar xl::ui::CControlPtr toolbar(new CAutobar(0, 75, 25, 300, 25)); m_toolbar = toolbar; toolbar->setStyle(_T("border-top:0 #d0d0d0; py:top; height:48; float:true; disable:true")); toolbar->setStyle(_T("background-color:#cccccc")); m_ctrlMain->insertChild(toolbar); // toobar -> layoutor toolbar.reset(new xl::ui::CControl()); toolbar->setStyle(_T("margin:0 auto; padding:0 2; float:true; py:top; width:208;")); m_toolbar->insertChild(toolbar); // toolbar -> layoutor -> buttons xl::ui::CControlPtr button(new CToolbarButton(ID_NAV_ZOOMIN, _T(""), IDB_ZOOMIN, true)); button->setStyle(_T("margin:8 16; width:32; height:32;")); toolbar->insertChild(button); button.reset(new CToolbarButton(ID_NAV_ZOOMOUT, _T(""), IDB_ZOOMOUT, true)); button->setStyle(_T("margin:8 16 8 0; width:32; height:32;")); toolbar->insertChild(button); button.reset(new CToolbarButton(ID_NAV_SWITCH, _T(""), IDB_SWITCH, true)); button->setStyle(_T("margin:8 16 8 0; width:32; height:32;")); toolbar->insertChild(button); button.reset(new CToolbarButton(ID_SETTING, _T(""), IDB_SETTING, true)); button->setStyle(_T("margin:8 16 8 0; width:32; height:32;")); toolbar->insertChild(button); // navbar xl::ui::CControlPtr navbar(new CAutobar(0, 75, 25, 300, 25)); m_navbar = navbar; navbar->setStyle(_T("margin:0; padding:0; border-top:0 #d0d0d0; py:bottom; width:fill; height:120; float:true; disable:true")); m_ctrlMain->insertChild(navbar); // navbar -> infoview CInfoView *pInfoView = new CInfoView(this); xl::ui::CControlPtr infoview(pInfoView); infoview->setStyle(_T("margin:0; padding:2 0; width:fill; height:20; background-color:#000000")); m_navbar->insertChild(infoview); pView->setInfoView(pInfoView); // navbar -> thumbnail xl::ui::CControlPtr thumbview(new CThumbnailView(this)); thumbview->setStyle(_T("margin:0; padding:0; width:fill; height:70; background-color:#000000")); m_navbar->insertChild(thumbview); // navbar -> slider xl::ui::CControlPtr slider(new CSlider()); m_slider = slider; slider->setStyle(_T("margin:0 0; width:fill; height:30;")); slider->setStyle(_T("slider:0 0 0;")); m_navbar->insertChild(slider); // naviewbar navbar.reset(new CAutobar(0, 75, 25, 300, 25)); navbar->setStyle(_T("margin:0 210 100 0; padding:0; px:right; py:bottom; width:140; height:200; float:true; background-color:#000000; disable:true")); m_ctrlMain->insertChild(navbar); m_naview = navbar; // naviewbar -> naview CNavView *pNavView = new CNavView(this, pView); xl::ui::CControlPtr naview(pNavView); naview->setStyle(_T("border:1 #ffffff; padding:20 4 4 4;")); navbar->insertChild(naview); pView->setNavView(pNavView); // Dispatch m_pDispatch = new CDispatch(this, pView); return TRUE; }