1 /* 2 3 cl_wind.cpp 4 5 */ 6 7 /* 8 Copyright 1999, Be Incorporated. All Rights Reserved. 9 This file may be used under the terms of the Be Sample Code License. 10 */ 11 12 #include "cl_wind.h" 13 #include <FindDirectory.h> 14 #include <Path.h> 15 #include <string.h> 16 #include <fcntl.h> 17 #include <unistd.h> 18 #include <sys/stat.h> 19 20 #include <Debug.h> 21 22 TClockWindow::TClockWindow(BRect r, const char* t) 23 :BWindow(r, t, B_TITLED_WINDOW, 24 B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT, 25 B_ALL_WORKSPACES) 26 { 27 SetPulseRate(500000); // half second pulse rate 28 } 29 30 bool TClockWindow::QuitRequested( void ) 31 { 32 int ref; 33 BPoint lefttop; 34 short face; 35 bool seconds; 36 BPath path; 37 // int len; 38 39 40 if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { 41 path.Append("Clock_settings"); 42 ref = creat(path.Path(), 0777); 43 if (ref >= 0) { 44 lefttop = Frame().LeftTop(); 45 write(ref, (char *)&lefttop, sizeof(BPoint)); 46 face = theOnscreenView->ReturnFace(); 47 write(ref, (char *)&face, sizeof(short)); 48 seconds = theOnscreenView->ReturnSeconds(); 49 write(ref, (char *)&seconds, sizeof(bool)); 50 close(ref); 51 } 52 } 53 be_app->PostMessage(B_QUIT_REQUESTED); 54 return(TRUE); 55 } 56