Files
haiku-beta6/src/apps/clock/cl_wind.cpp
T

55 lines
1.2 KiB
C++
Raw Normal View History

2002-07-09 12:24:59 +00:00
/*
2007-10-02 14:54:15 +00:00
* Copyright 1999, Be Incorporated. All Rights Reserved.
* This file may be used under the terms of the Be Sample Code License.
*/
2002-07-09 12:24:59 +00:00
#include "cl_wind.h"
2007-10-02 14:54:15 +00:00
#include <Application.h>
2002-07-09 12:24:59 +00:00
#include <FindDirectory.h>
#include <Path.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <Debug.h>
2007-10-02 14:54:15 +00:00
#include "cl_view.h"
TClockWindow::TClockWindow(BRect frame, const char* title)
: BWindow(frame, title, B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT, B_ALL_WORKSPACES)
2002-07-09 12:24:59 +00:00
{
2007-10-02 14:54:15 +00:00
SetPulseRate(500000);
// half second pulse rate
2002-07-09 12:24:59 +00:00
}
2007-10-02 14:54:15 +00:00
TClockWindow::~TClockWindow()
{
}
bool
TClockWindow::QuitRequested()
2002-07-09 12:24:59 +00:00
{
2007-10-02 14:54:15 +00:00
BPath path;
2002-07-09 12:24:59 +00:00
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) {
path.Append("Clock_settings");
2007-10-02 14:54:15 +00:00
int ref = creat(path.Path(), 0777);
2002-07-09 12:24:59 +00:00
if (ref >= 0) {
2007-10-02 14:54:15 +00:00
BPoint lefttop = Frame().LeftTop();
2002-07-09 12:24:59 +00:00
write(ref, (char *)&lefttop, sizeof(BPoint));
2007-10-02 14:54:15 +00:00
short face = theOnscreenView->ReturnFace();
2002-07-09 12:24:59 +00:00
write(ref, (char *)&face, sizeof(short));
2007-10-02 14:54:15 +00:00
bool seconds = theOnscreenView->ReturnSeconds();
2002-07-09 12:24:59 +00:00
write(ref, (char *)&seconds, sizeof(bool));
close(ref);
}
}
be_app->PostMessage(B_QUIT_REQUESTED);
2007-10-02 14:54:15 +00:00
return true;
2002-07-09 12:24:59 +00:00
}