18.02.2013 Views

NCURSES ile Yazılım Geli¸stirme NASIL

NCURSES ile Yazılım Geli¸stirme NASIL

NCURSES ile Yazılım Geli¸stirme NASIL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

/* Menüyü ekrana yaz */<br />

post_menu(my_menu);<br />

wrefresh(my_menu_win);<br />

<strong>NCURSES</strong> <strong>ile</strong> Yazılım Geli¸stirme <strong>NASIL</strong><br />

attron(COLOR_PAIR(2));<br />

mvprintw(LINES – 2, 0,<br />

"Sayfayı a¸sa˘gı yukarı kaydırmak için PageUp ve PageDown kullanın.");<br />

mvprintw(LINES – 1, 0,<br />

"Hareket etmek için Ok tu¸sları kullanın (Çıkmak için F1)");<br />

attroff(COLOR_PAIR(2));<br />

refresh();<br />

wh<strong>ile</strong>((c = wgetch(my_menu_win)) != KEY_F(1))<br />

{ switch(c)<br />

{ case KEY_DOWN:<br />

menu_driver(my_menu, REQ_DOWN_ITEM);<br />

break;<br />

case KEY_UP:<br />

menu_driver(my_menu, REQ_UP_ITEM);<br />

break;<br />

case KEY_NPAGE:<br />

menu_driver(my_menu, REQ_SCR_DPAGE);<br />

break;<br />

case KEY_PPAGE:<br />

menu_driver(my_menu, REQ_SCR_UPAGE);<br />

break;<br />

}<br />

wrefresh(my_menu_win);<br />

}<br />

/* Menüyü ekrandan sil ve ayrılan bellek alanını geri ver */<br />

unpost_menu(my_menu);<br />

free_menu(my_menu);<br />

for(i = 0; i < n_choices; ++i)<br />

free_item(my_items[i]);<br />

endwin();<br />

void print_in_middle(WINDOW *win, int starty, int startx, int width,<br />

char *string, chtype color)<br />

{ int length, x, y;<br />

float temp;<br />

if(win == NULL)<br />

win = stdscr;<br />

getyx(win, y, x);<br />

if(startx != 0)<br />

x = startx;<br />

if(starty != 0)<br />

y = starty;<br />

if(width == 0)<br />

width = 80;<br />

length = strlen(string);<br />

temp = (width – length)/ 2;<br />

x = startx + (int)temp;<br />

wattron(win, color);<br />

http://belgeler.org Linux Kitaplı˘gı 58 / 90

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!