Category : C Source Code
Archive   : WINDOW_C.ZIP
Filename : W_OPEN.C

 
Output of file : W_OPEN.C contained in archive : WINDOW_C.ZIP
/* w_open.c -- part of Windows package; include w_open, w_link, w_select */

#define NDEBUG

#include
#include
#include
#include
#include
#include "windows.h"

/*
** w_open() -- opens a window and displays it as the top window
** passed: pointer to window structure
** calls: w_select(), w_link(), w_draw()
** notes: make sure you have created the memory for the
** window with w_create before you call this function;
** if the window is already open, it is moved to the top;
** otherwise it is added to the linked list at the top &
** displayed
*/

void w_open(w)
Window *w;
{
if (w->open)
w_select(w);
else {
w_link(w);
w_draw(w);
}
}

/*
** w_link() -- adds window pointer to top of linked list
** passed: pointer to window structure
** sets: layers_w, top_w, members of window structure
** notes: this function is called as part of the routine to
** open a window; to move to the top a window which is
** already open call w_select()
*/

void w_link(w)
Window *w;
{
top_w->next = w;
w->prev = top_w;
top_w = w;
w->next = NULL;
layers_w++;
w->open = 1;
}

/*
** w_select() -- moves to the top position a window which is already open
** passed: pointer to window structure
** calls: w_draw(), assert()
** uses: main_w, top_w
** sets: members of window structure in linked list
** notes: this routine assumes that the window is open; a check on
** this assumption is made with assert(); no action is
** taken if the window is already on top, or if it is the
** main window
*/

void w_select(w)
Window *w;
{
assert(w->open);
if (w == main_w || w == top_w)
return;
w->prev->next = w->next;
w->next->prev = w->prev;
w->prev = top_w;
top_w->next = w;
top_w = w;
w->next = NULL;
w_draw(w);
}



  3 Responses to “Category : C Source Code
Archive   : WINDOW_C.ZIP
Filename : W_OPEN.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/