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