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
+17 -1
View File
@@ -14,12 +14,14 @@
#include <Application.h> #include <Application.h>
#include <Button.h> #include <Button.h>
#include <MessageRunner.h>
#include <Screen.h> #include <Screen.h>
#include <TabView.h> #include <TabView.h>
static const uint32 kMsgSetDefaults = 'dflt'; static const uint32 kMsgSetDefaults = 'dflt';
static const uint32 kMsgRevert = 'rvrt'; static const uint32 kMsgRevert = 'rvrt';
static const uint32 kMsgCheckFonts = 'chkf';
MainWindow::MainWindow() MainWindow::MainWindow()
@@ -93,6 +95,15 @@ MainWindow::MainWindow()
|| Frame().top > screen.Frame().bottom - 10) || Frame().top > screen.Frame().bottom - 10)
_Center(); _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); fRevertButton->SetEnabled(false);
break; break;
default: case kMsgCheckFonts:
if (update_font_families(true))
fFontsView->UpdateFonts();
break;
default:
BWindow::MessageReceived(message); BWindow::MessageReceived(message);
break; break;
} }
+3
View File
@@ -16,12 +16,14 @@
#include <Window.h> #include <Window.h>
class BButton; class BButton;
class BMessageRunner;
class FontView; class FontView;
class MainWindow : public BWindow { class MainWindow : public BWindow {
public: public:
MainWindow(); MainWindow();
virtual ~MainWindow();
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
@@ -29,6 +31,7 @@ class MainWindow : public BWindow {
private: private:
void _Center(); void _Center();
BMessageRunner* fRunner;
FontView* fFontsView; FontView* fFontsView;
BButton* fRevertButton; BButton* fRevertButton;