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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

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

/* Her pencereyi bir panele ba˘gla */ /* Sıralama a¸sa˘gıdan yukarıya */<br />

my_panels[0] = new_panel(my_wins[0]); /* 0’a it, sıra: stdscr–0 */<br />

my_panels[1] = new_panel(my_wins[1]); /* 1’e it, sıra: stdscr–0–1 */<br />

my_panels[2] = new_panel(my_wins[2]); /* 2’ye it, sıra: stdscr–0–1–2 */<br />

/* Kullanıcı i¸saretç<strong>ile</strong>rini bir sonraki panele ayarla */<br />

set_panel_userptr(my_panels[0], my_panels[1]);<br />

set_panel_userptr(my_panels[1], my_panels[2]);<br />

set_panel_userptr(my_panels[2], my_panels[0]);<br />

/* Yı˘gını güncelle. 2. panel en üstte olacak */<br />

update_panels();<br />

/* Ekranda göster */<br />

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

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

"Pencerelerde gezinmek için tab kullanın (Çıkmak için F1)");<br />

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

doupdate();<br />

top = my_panels[2];<br />

wh<strong>ile</strong>((ch = getch()) != KEY_F(1))<br />

{ switch(ch)<br />

{ case 9:<br />

top = (PANEL *)panel_userptr(top);<br />

top_panel(top);<br />

break;<br />

}<br />

update_panels();<br />

doupdate();<br />

}<br />

endwin();<br />

return 0;<br />

/* Tüm pencereleri yazdır */<br />

void init_wins(WINDOW **wins, int n)<br />

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

char label[80];<br />

}<br />

y = 2;<br />

x = 10;<br />

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

{ wins[i] = newwin(NLINES, NCOLS, y, x);<br />

sprintf(label, "Pencere Numaası %d", i + 1);<br />

win_show(wins[i], label, i + 1);<br />

y += 3;<br />

x += 7;<br />

}<br />

/* Pencereyi bir çerçeve ve isimle göster */<br />

void win_show(WINDOW *win, char *label, int label_color)<br />

{ int startx, starty, height, width;<br />

getbegyx(win, starty, startx);<br />

getmaxyx(win, height, width);<br />

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

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

Saved successfully!

Ooh no, something went wrong!