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.

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

char label[80];<br />

}<br />

<strong>NCURSES</strong> <strong>ile</strong> Yazılım Geli¸stirme <strong>NASIL</strong><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 Numarası %d", i + 1);<br />

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

y += 3;<br />

x += 7;<br />

}<br />

/* Herbir panel için PANEL_DATA veri yapısını tanımla */<br />

void set_user_ptrs(PANEL **panels, int n)<br />

{ PANEL_DATA *ptrs;<br />

WINDOW *win;<br />

int x, y, w, h, i;<br />

char temp[80];<br />

}<br />

ptrs = (PANEL_DATA *)calloc(n, sizeof(PANEL_DATA));<br />

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

{ win = panel_window(panels[i]);<br />

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

getmaxyx(win, h, w);<br />

ptrs[i].x = x;<br />

ptrs[i].y = y;<br />

ptrs[i].w = w;<br />

ptrs[i].h = h;<br />

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

strcpy(ptrs[i].label, temp);<br />

ptrs[i].label_color = i + 1;<br />

if(i + 1 == n)<br />

ptrs[i].next = panels[0];<br />

else<br />

ptrs[i].next = panels[i + 1];<br />

set_panel_userptr(panels[i], &ptrs[i]);<br />

}<br />

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

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

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

}<br />

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

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

box(win, 0, 0);<br />

mvwaddch(win, 2, 0, ACS_LTEE);<br />

mvwhline(win, 2, 1, ACS_HLINE, width – 2);<br />

mvwaddch(win, 2, width – 1, ACS_RTEE);<br />

print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));<br />

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

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

Saved successfully!

Ooh no, something went wrong!