-EffectTipDialog::EffectTipDialog(MWindow *mwindow, AWindow *awindow)
- : BC_DialogThread()
-{
- this->mwindow = mwindow;
- this->awindow = awindow;
- effect = 0;
- text = 0;
-}
-
-EffectTipDialog::~EffectTipDialog()
-{
- close_window();
- delete [] effect;
- delete [] text;
-}
-
-void EffectTipDialog::start(int x, int y, const char *effect, const char *text)
-{
- close_window();
- AWindowGUI *gui = awindow->gui;
- char string[BCTEXTLEN];
- sprintf(string, _("Effect info: %s"), _(effect));
- int effect_w = BC_Title::calculate_w(gui, string);
- int text_w = BC_Title::calculate_w(gui, text);
- int text_h = BC_Title::calculate_h(gui, text);
- this->w = bmax(text_w + 30, bmax(effect_w + 30, 120));
- this->h = bmax(text_h + 100, 120);
- this->x = x - this->w / 2;
- this->y = y - this->h / 2;
- delete [] this->effect; this->effect = cstrdup(string);
- delete [] this->text; this->text = cstrdup(text);
- BC_DialogThread::start();
-}
-
-BC_Window* EffectTipDialog::new_gui()
-{
- AWindowGUI *gui = awindow->gui;
- effect_gui = new EffectTipWindow(gui, this);
- effect_gui->create_objects();
- return effect_gui;
-};
-
-
-EffectTipWindow::EffectTipWindow(AWindowGUI *gui, EffectTipDialog *thread)
- : BC_Window(_(PROGRAM_NAME ": Effect Info"),
- thread->x + thread->w/2, thread->y + thread->h/2,
- thread->w, thread->h, thread->w, thread->h, 0, 0, 1)
-{
- this->gui = gui;
- this->thread = thread;
-}
-EffectTipWindow::~EffectTipWindow()
-{
-}
-
-void EffectTipWindow::create_objects()
-{
- lock_window("EffectTipWindow::create_objects");
- int x = 10, y = 10;
- BC_Title *title;
- add_subwindow(title = new BC_Title(x, y, thread->effect));
- y += title->get_h() + 10;
- add_subwindow(tip_text = new BC_Title(x+5, y, thread->text));
- add_subwindow(new BC_OKButton(this));
- show_window(1);
- unlock_window();
-}