当前位置: 首页>>代码示例>>C++>>正文


C++ Windows类代码示例

本文整理汇总了C++中Windows的典型用法代码示例。如果您正苦于以下问题:C++ Windows类的具体用法?C++ Windows怎么用?C++ Windows使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Windows类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init_allwin

int init_allwin()
{
    int ret =0;
    int i = 0;
    Win win[4] = {
            // x,y,width,height,name,title,WINDOW*
            {{0, 0, 60, 60}, {0, 0, 0.8, 1}, "L1", "", NULL}, 
            {{100, 0, 20, 20}, {0.8, 0, 0.2, 0.4}, "R1", "", NULL}, 
            {{100, 10, 20, 20}, {0.8, 0.4, 0.2, 0.4}, "R2", "", NULL}, 
            {{100, 15, 20, 20}, {0.8, 0.8, 0.2, 0.2}, "RCMD", "", NULL}, 
            };


    for (i=0; i<4; i++) {
        win[i].win = newwin(win[i].locate.y, win[i].locate.x, 0, 0);
        if (NULL == win) {
            printf("Init failed.\n");
            ret = -1;
            break;
        }
        if (strcmp(win[i].name, "L1") == 0) {
            scrollok(win[i].win, TRUE);
        } else {
            clearok(win[i].win, TRUE);
        }
        windows.insert(Windows::value_type(win[i].name, win[i]));

        Win frame;
        memcpy(&frame, &win[i], sizeof(Win));
        frame.win = newwin(win[i].locate.y, win[i].locate.x, 0, 0);
        frames.insert(Windows::value_type(win[i].name, frame));
    }
 
    return ret;
}
开发者ID:pengyuwei,项目名称:hackathon2014,代码行数:35,代码来源:h.c

示例2: getWindows

bool Viewer::checkEvents()
{
    // check events from any attached sources
    for(Devices::iterator eitr = _eventSources.begin();
        eitr != _eventSources.end();
        ++eitr)
    {
        osgGA::Device* es = eitr->get();
        if (es->getCapabilities() & osgGA::Device::RECEIVE_EVENTS)
        {
            if (es->checkEvents()) return true;
        }

    }

    // get events from all windows attached to Viewer.
    Windows windows;
    getWindows(windows);
    for(Windows::iterator witr = windows.begin();
        witr != windows.end();
        ++witr)
    {
        if ((*witr)->checkEvents()) return true;
    }

    return false;
}
开发者ID:tachen,项目名称:osg,代码行数:27,代码来源:Viewer.cpp

示例3:

Win *get_win(const char *name)
{
    Win *win = NULL;
    Windows::iterator iter;

    iter = windows.find(name);
    if (iter == windows.end()) {
        return NULL;
    }
    win = &iter->second;
   
    return win;
}
开发者ID:pengyuwei,项目名称:hackathon2014,代码行数:13,代码来源:h.c

示例4: getWindows

void ViewerBase::getWindows(Windows& windows, bool onlyValid)
{
    windows.clear();

    Contexts contexts;
    getContexts(contexts, onlyValid);

    for(Contexts::iterator itr = contexts.begin();
        itr != contexts.end();
        ++itr)
    {
        osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(*itr);
        if (gw) windows.push_back(gw);
    }
}
开发者ID:3dcl,项目名称:osg,代码行数:15,代码来源:ViewerBase.cpp

示例5: QWidget

ProduitListe::ProduitListe(QWidget *parent, int iC, int iP) :
    QWidget(parent),
    ui(new Ui::ProduitListe),
    PageInterface(parent, iC,iP)
{
    ui->setupUi(this);

    Windows *w = (Windows*)parent;//récupérer l'objet windows pour avoir accées a la liste des produits
    ui->produitsListe->addItem("Choisissez...");
    for(int i=0; i < w->getData()->getListeProduit().size();i++){

        QString champ = w->getData()->getListeProduit().value(i).getName();
        ui->produitsListe->addItem(champ);
    }

    signalAndSlot();

}
开发者ID:Leymariv,项目名称:Product-Configurator-Qt,代码行数:18,代码来源:produitliste.cpp

示例6: main

int main(int argc, char *argv[])
{
    int ret = 0;

    setlocale(LC_ALL,"");

    init_keyboard();
    initscr();

    init_allwin();
    resize_allwin();

    signal(SIGWINCH, sig_winch);

    work_thread_start();
    main_loop();

    close_keyboard();
    cleanup();

    for (int i = 30; i<129;i++) {
        printf("%d %c\t", i, i);
    }
    printf("\n");

    struct winsize size;
    Win *win = NULL;
    ioctl(STDIN_FILENO,TIOCGWINSZ,&size);
    Windows::iterator iter;
    for (iter=windows.begin(); iter!=windows.end(); iter++) {
        win = &iter->second;
        printf("%s @(%d,%d), (%dx%d) %s\n", win->name,
                win->locate.x, win->locate.y,
                win->locate.w, win->locate.h,
                win->title);
    }
    printf("SCREEN: %d x %d\n", size.ws_col, size.ws_row);

    return ret;
}
开发者ID:pengyuwei,项目名称:hackathon2014,代码行数:40,代码来源:h.c

示例7: getWindows

bool CompositeViewer::checkEvents()
{
    for(RefViews::iterator itr = _views.begin();
            itr != _views.end();
            ++itr)
    {
        osgViewer::View* view = itr->get();
        if (view)
        {
            // check events from any attached sources
            for(View::Devices::iterator eitr = view->getDevices().begin();
                    eitr != view->getDevices().end();
                    ++eitr)
            {
                osgGA::Device* es = eitr->get();
                if (es->getCapabilities() & osgGA::Device::RECEIVE_EVENTS)
                {
                    if (es->checkEvents()) return true;
                }

            }
        }
    }

    // get events from all windows attached to Viewer.
    Windows windows;
    getWindows(windows);
    for(Windows::iterator witr = windows.begin();
            witr != windows.end();
            ++witr)
    {
        if ((*witr)->checkEvents()) return true;
    }

    return false;
}
开发者ID:psigen,项目名称:openscenegraph-release,代码行数:36,代码来源:CompositeViewer.cpp

示例8: main

int main(int argc, char **argv) {
    int diff, old_score, new_score;
    struct timeval start;
    gettimeofday(&start,NULL);
    Shapes s;
    s.readFile(argc, argv);
    s.buildConflictArray();
    Graphs g;
    g.buildConflictGraph(s.getShapes());
    s.findBoundingBox();
    Windows w;
    w.createWindow();
    w.countArea(s.getShapes(), g.getGraphs());
    g.countTotalColorDiff();

    Calculate c;
    //c.printResult(s.getShapes(), g.getGraphs(), w.getWindows(), argc, argv);
    //printf("real score : %.2f\n\n\n", c.real_score(w.getWindows()));

    //std::vector<Graph> &gg = g.getGraphs();
    //c.changeGraphColor(w.getWindows(), g.getGraphs()[0]);
    //c.changeGraphColor(w.getWindows(), g.getGraphs()[0]);
    //c.changeGraphColor(w.getWindows(), g.getGraphs()[2]);
    c.initial_total_color_diff(&g, g.getGraphs(), w.getWindows());
    //c.printResult(s.getShapes(), g.getGraphs(), w.getWindows(), argc, argv);
    //printf("real score : %.2f\n\n\n", c.real_score(w.getWindows()));

    for (int group_id = 0; group_id < c.group_size; group_id++) {
        c.iterative_sol(g.getGraphs(), w.getWindows(), group_id);
    }
    //printf("real score : %.2f\n\n\n", c.real_score(w.getWindows()));
    c.simulatedAnnealing(g.getGraphs(), w.getWindows(), start, argv[1]);

    for (int group_id = 0; group_id < c.group_size; group_id++) {
        c.iterative_sol(g.getGraphs(), w.getWindows(), group_id);
    }

    c.printResult(s.getShapes(), g.getGraphs(), w.getWindows(), argc, argv);
    printf("real score : %.2f\n\n\n", c.real_score(w.getWindows()));
    return 0;
}
开发者ID:Slighten,项目名称:Color-Density-Balancing-for-Double-Patterning-Lithography,代码行数:41,代码来源:main.cpp

示例9: resize_allwin

void resize_allwin()
{
    Win *win = NULL;
    Win *frame = NULL;
    Windows::iterator iter;
    struct winsize size;
    // char msg[64] = {0};
    int ret = 0;

    ioctl(STDIN_FILENO,TIOCGWINSZ,&size);

    for (iter=windows.begin(); iter!=windows.end(); iter++) {
        win = &iter->second;
        frame = get_frame(win->name);
        if (NULL == frame) {
            cleanup();
            exit(0);
        }
        // set new size
        frame->locate.x = size.ws_col * frame->scale.x;
        frame->locate.y = size.ws_row * frame->scale.y;
        frame->locate.w = size.ws_col * frame->scale.w;
        frame->locate.h = size.ws_row * frame->scale.h;

        win->locate.x = frame->locate.x + 1;
        win->locate.y = frame->locate.y + 1;
        win->locate.w = frame->locate.w - 2;
        win->locate.h = frame->locate.h - 2;

        if (iter->first.compare("RCMD") == 0) {
            win->locate.h = 4;
        }

        // resize 
        ret = wresize(frame->win, frame->locate.h, frame->locate.w);
        ret = wresize(win->win, win->locate.h, win->locate.w);
        if (ERR == ret) {
            printf("wresize failed:%s %d,%d\n", win->name, win->locate.x, win->locate.y);
        }

        // move
        ret = mvwin(frame->win, frame->locate.y, frame->locate.x);
        if (ERR == ret) {
            cleanup();
            printf("mvwin frame failed:%s %d,%d\n", frame->name, frame->locate.y, frame->locate.x);
            printf("\t %d x %d\n", frame->locate.w, frame->locate.h);
            exit(0);
        }
        ret = mvwin(win->win, win->locate.y, win->locate.x);
        if (ERR == ret) {
            cleanup();
            printf("SCREEN=%d x %d\n", COLS, LINES);
            printf("mvwin failed:%s %d,%d\n", win->name, win->locate.x, win->locate.y);
            printf("\t %d x %d\n", win->locate.w, win->locate.h);
            printf("frame %d,%d %d x %d\n", frame->locate.x, frame->locate.y, frame->locate.w, frame->locate.h);
            exit(0);
        }

        //echo();
        //touchwin(win->win);
        //attron(A_REVERSE);
        box(frame->win, '|', '-');
        //mvaddstr(2, 2,win->name);
        // mvwaddstr(win->win, 1, 1, win->name);
        //sprintf(msg, "%d,%d", win->locate.y, win->locate.x);
        //mvwaddstr(win->win, 2, 1, msg);
        //attroff(A_REVERSE);
        //move(1, 1);
        //waddstr(win->win, win->name);
        wrefresh(frame->win);
        wrefresh(win->win);
  //      }
    }
}
开发者ID:pengyuwei,项目名称:hackathon2014,代码行数:74,代码来源:h.c

示例10: InsertListViewItems

BOOL InsertListViewItems(HWND hwndListView)
{
	ListView_DeleteAllItems(hwndListView);
	ListView_SetItemCount(hwndListView, g_windows.size());
	return TRUE;
}
开发者ID:tamaroth,项目名称:Spotify2PuTTy,代码行数:6,代码来源:Settings.cpp


注:本文中的Windows类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。