Now checks the font list every 3 seconds, and updates it if there were any changes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-10 14:41:29 +00:00
parent 5211328a37
commit 10c470638d
2 changed files with 20 additions and 1 deletions

View File

@ -14,12 +14,14 @@
#include <Application.h>
#include <Button.h>
#include <MessageRunner.h>
#include <Screen.h>
#include <TabView.h>
static const uint32 kMsgSetDefaults = 'dflt';
static const uint32 kMsgRevert = 'rvrt';
static const uint32 kMsgCheckFonts = 'chkf';
MainWindow::MainWindow()
@ -93,6 +95,15 @@ MainWindow::MainWindow()
|| Frame().top > screen.Frame().bottom - 10)
_Center();
}
fRunner = new BMessageRunner(this, new BMessage(kMsgCheckFonts), 3000000);
// every 3 seconds
}
MainWindow::~MainWindow()
{
delete fRunner;
}
@ -124,7 +135,12 @@ MainWindow::MessageReceived(BMessage *message)
fRevertButton->SetEnabled(false);
break;
default:
case kMsgCheckFonts:
if (update_font_families(true))
fFontsView->UpdateFonts();
break;
default:
BWindow::MessageReceived(message);
break;
}

View File

@ -16,12 +16,14 @@
#include <Window.h>
class BButton;
class BMessageRunner;
class FontView;
class MainWindow : public BWindow {
public:
MainWindow();
virtual ~MainWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
@ -29,6 +31,7 @@ class MainWindow : public BWindow {
private:
void _Center();
BMessageRunner* fRunner;
FontView* fFontsView;
BButton* fRevertButton;