* rename this to better reflect it's usage and to be able to add a real settings view
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22601 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
* Julun <host.haiku@gmx.de>
|
* Julun <host.haiku@gmx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SettingsView.h"
|
#include "DateTimeView.h"
|
||||||
#include "AnalogClock.h"
|
#include "AnalogClock.h"
|
||||||
#include "CalendarView.h"
|
#include "CalendarView.h"
|
||||||
#include "DateTimeEdit.h"
|
#include "DateTimeEdit.h"
|
||||||
@@ -38,7 +38,7 @@ void _kset_tzfilename_(const char *name, size_t length, bool isGMT);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
TSettingsView::TSettingsView(BRect frame)
|
DateTimeView::DateTimeView(BRect frame)
|
||||||
: BView(frame,"Settings", B_FOLLOW_ALL,
|
: BView(frame,"Settings", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP),
|
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP),
|
||||||
fGmtTime(NULL),
|
fGmtTime(NULL),
|
||||||
@@ -48,14 +48,14 @@ TSettingsView::TSettingsView(BRect frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TSettingsView::~TSettingsView()
|
DateTimeView::~DateTimeView()
|
||||||
{
|
{
|
||||||
_WriteRTCSettings();
|
_WriteRTCSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::AttachedToWindow()
|
DateTimeView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
if (Parent())
|
if (Parent())
|
||||||
SetViewColor(Parent()->ViewColor());
|
SetViewColor(Parent()->ViewColor());
|
||||||
@@ -68,7 +68,7 @@ TSettingsView::AttachedToWindow()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::Draw(BRect /*updateRect*/)
|
DateTimeView::Draw(BRect /*updateRect*/)
|
||||||
{
|
{
|
||||||
rgb_color viewcolor = ViewColor();
|
rgb_color viewcolor = ViewColor();
|
||||||
rgb_color dark = tint_color(viewcolor, B_DARKEN_4_TINT);
|
rgb_color dark = tint_color(viewcolor, B_DARKEN_4_TINT);
|
||||||
@@ -92,7 +92,7 @@ TSettingsView::Draw(BRect /*updateRect*/)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::MessageReceived(BMessage *message)
|
DateTimeView::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
int32 change;
|
int32 change;
|
||||||
switch(message->what) {
|
switch(message->what) {
|
||||||
@@ -129,7 +129,7 @@ TSettingsView::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::GetPreferredSize(float *width, float *height)
|
DateTimeView::GetPreferredSize(float *width, float *height)
|
||||||
{
|
{
|
||||||
// hardcode in TimeWindow ...
|
// hardcode in TimeWindow ...
|
||||||
*width = 470.0f;
|
*width = 470.0f;
|
||||||
@@ -144,7 +144,7 @@ TSettingsView::GetPreferredSize(float *width, float *height)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::_InitView()
|
DateTimeView::_InitView()
|
||||||
{
|
{
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
be_plain_font->GetHeight(&fontHeight);
|
be_plain_font->GetHeight(&fontHeight);
|
||||||
@@ -221,7 +221,7 @@ TSettingsView::_InitView()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::_ReadRTCSettings()
|
DateTimeView::_ReadRTCSettings()
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||||
@@ -252,7 +252,7 @@ TSettingsView::_ReadRTCSettings()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::_WriteRTCSettings()
|
DateTimeView::_WriteRTCSettings()
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||||
@@ -271,7 +271,7 @@ TSettingsView::_WriteRTCSettings()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::_UpdateGmtSettings()
|
DateTimeView::_UpdateGmtSettings()
|
||||||
{
|
{
|
||||||
_WriteRTCSettings();
|
_WriteRTCSettings();
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ TSettingsView::_UpdateGmtSettings()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TSettingsView::_UpdateDateTime(BMessage *message)
|
DateTimeView::_UpdateDateTime(BMessage *message)
|
||||||
{
|
{
|
||||||
int32 day;
|
int32 day;
|
||||||
int32 month;
|
int32 month;
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
* Mike Berg <mike@berg-net.us>
|
* Mike Berg <mike@berg-net.us>
|
||||||
* Julun <host.haiku@gmx.de>
|
* Julun <host.haiku@gmx.de>
|
||||||
*/
|
*/
|
||||||
#ifndef SETTINGS_VIEW_H
|
#ifndef DATE_TIME_VIEW_H
|
||||||
#define SETTINGS_VIEW_H
|
#define DATE_TIME_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
@@ -21,10 +21,10 @@ class BRadioButton;
|
|||||||
class TAnalogClock;
|
class TAnalogClock;
|
||||||
|
|
||||||
|
|
||||||
class TSettingsView : public BView {
|
class DateTimeView : public BView {
|
||||||
public:
|
public:
|
||||||
TSettingsView(BRect frame);
|
DateTimeView(BRect frame);
|
||||||
virtual ~TSettingsView();
|
virtual ~DateTimeView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void Draw(BRect updaterect);
|
virtual void Draw(BRect updaterect);
|
||||||
@@ -50,5 +50,5 @@ class TSettingsView : public BView {
|
|||||||
bool fInitialized;
|
bool fInitialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_VIEW_H
|
#endif // DATE_TIME_VIEW_H
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Preference Time :
|
|||||||
CalendarView.cpp
|
CalendarView.cpp
|
||||||
DateTimeEdit.cpp
|
DateTimeEdit.cpp
|
||||||
SectionEdit.cpp
|
SectionEdit.cpp
|
||||||
SettingsView.cpp
|
DateTimeView.cpp
|
||||||
Time.cpp
|
Time.cpp
|
||||||
TimeSettings.cpp
|
TimeSettings.cpp
|
||||||
TimeWindow.cpp
|
TimeWindow.cpp
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "TimeWindow.h"
|
#include "TimeWindow.h"
|
||||||
#include "BaseView.h"
|
#include "BaseView.h"
|
||||||
#include "SettingsView.h"
|
#include "DateTimeView.h"
|
||||||
#include "TimeMessages.h"
|
#include "TimeMessages.h"
|
||||||
#include "ZoneView.h"
|
#include "ZoneView.h"
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
TTimeWindow::TTimeWindow(const BPoint leftTop)
|
TTimeWindow::TTimeWindow(const BPoint leftTop)
|
||||||
: BWindow(BRect(leftTop, leftTop + BPoint(WINDOW_RIGHT, WINDOW_BOTTOM)),
|
: BWindow(BRect(leftTop, leftTop + BPoint(WINDOW_RIGHT, WINDOW_BOTTOM)),
|
||||||
"Time & Date", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
|
"Time", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
|
||||||
{
|
{
|
||||||
BRect frame = Frame();
|
BRect frame = Frame();
|
||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
@@ -64,8 +64,8 @@ TTimeWindow::QuitRequested()
|
|||||||
msg.AddPoint("LeftTop", Frame().LeftTop());
|
msg.AddPoint("LeftTop", Frame().LeftTop());
|
||||||
be_app->PostMessage(&msg);
|
be_app->PostMessage(&msg);
|
||||||
|
|
||||||
fBaseView->StopWatchingAll(fTimeSettings);
|
|
||||||
fBaseView->StopWatchingAll(fTimeZones);
|
fBaseView->StopWatchingAll(fTimeZones);
|
||||||
|
fBaseView->StopWatchingAll(fDateTimeView);
|
||||||
|
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
@@ -88,16 +88,16 @@ TTimeWindow::_InitWindow()
|
|||||||
bounds.InsetBy(4, 6);
|
bounds.InsetBy(4, 6);
|
||||||
bounds.bottom -= tabview->TabHeight();
|
bounds.bottom -= tabview->TabHeight();
|
||||||
|
|
||||||
fTimeSettings = new TSettingsView(bounds);
|
fDateTimeView = new DateTimeView(bounds);
|
||||||
fBaseView->StartWatchingAll(fTimeSettings);
|
fBaseView->StartWatchingAll(fDateTimeView);
|
||||||
|
|
||||||
fTimeZones = new TZoneView(bounds);
|
fTimeZones = new TZoneView(bounds);
|
||||||
fBaseView->StartWatchingAll(fTimeZones);
|
fBaseView->StartWatchingAll(fTimeZones);
|
||||||
|
|
||||||
// add tabs
|
// add tabs
|
||||||
BTab *tab = new BTab();
|
BTab *tab = new BTab();
|
||||||
tabview->AddTab(fTimeSettings, tab);
|
tabview->AddTab(fDateTimeView, tab);
|
||||||
tab->SetLabel("Settings");
|
tab->SetLabel("Date & Time");
|
||||||
|
|
||||||
tab = new BTab();
|
tab = new BTab();
|
||||||
tabview->AddTab(fTimeZones, tab);
|
tabview->AddTab(fTimeZones, tab);
|
||||||
@@ -107,8 +107,9 @@ TTimeWindow::_InitWindow()
|
|||||||
|
|
||||||
float width;
|
float width;
|
||||||
float height;
|
float height;
|
||||||
// width/ height from settingsview + all InsetBy etc..
|
fDateTimeView->GetPreferredSize(&width, &height);
|
||||||
fTimeSettings->GetPreferredSize(&width, &height);
|
|
||||||
|
// width/ height from DateTimeView + all InsetBy etc..
|
||||||
ResizeTo(width +10, height + tabview->TabHeight() +25);
|
ResizeTo(width +10, height + tabview->TabHeight() +25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class BMessage;
|
class BMessage;
|
||||||
class TSettingsView;
|
class DateTimeView;
|
||||||
class TTimeBaseView;
|
class TTimeBaseView;
|
||||||
class TZoneView;
|
class TZoneView;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ class TTimeWindow : public BWindow {
|
|||||||
void _InitWindow();
|
void _InitWindow();
|
||||||
|
|
||||||
TTimeBaseView *fBaseView;
|
TTimeBaseView *fBaseView;
|
||||||
TSettingsView *fTimeSettings;
|
DateTimeView *fDateTimeView;
|
||||||
TZoneView *fTimeZones;
|
TZoneView *fTimeZones;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user