int scr_w = mwindow->gui->get_screen_w(0, -1);
int scr_h = mwindow->gui->get_screen_h(0, -1);
- int x = scr_x + scr_w / 2 - WIDTH / 2;
- int y = scr_h / 2 - HEIGHT / 2;
+ int w = WIDTH, h = HEIGHT;
+ int min_w = mwindow->theme->preferencescategory_x;
+ for(int i = 0; i < CATEGORIES; i++) {
+ min_w += PreferencesButton::calculate_w(mwindow->gui, category_to_text(i)) -
+ mwindow->theme->preferences_category_overlap;
+ }
+ if( w < min_w ) w = min_w;
+ int x = scr_x + scr_w / 2 - w / 2;
+ int y = scr_h / 2 - h / 2;
- window = new PreferencesWindow(mwindow, this, x, y);
+ window = new PreferencesWindow(mwindow, this, x, y, w, h);
window->create_objects();
mwindow->gui->unlock_window();
PreferencesWindow::PreferencesWindow(MWindow *mwindow,
- PreferencesThread *thread,
- int x,
- int y)
- : BC_Window(_(PROGRAM_NAME ": Preferences"),
- x,y, WIDTH,HEIGHT, WIDTH,HEIGHT, 1,0,1)
+ PreferencesThread *thread, int x, int y, int w, int h)
+ : BC_Window(_(PROGRAM_NAME ": Preferences"), x,y, w,h, 1,0,1)
{
this->mwindow = mwindow;
this->thread = thread;
//printf("PreferencesWindow::set_current_dialog %d\n", __LINE__);
dialog->create_objects();
//printf("PreferencesWindow::set_current_dialog %d\n", __LINE__);
+ dialog->lower_window();
dialog->show_window(0);
}
this->mwindow = mwindow;
this->thread = thread;
}
-
int PreferencesApply::handle_event()
{
thread->apply_settings();
return 1;
}
+int PreferencesApply::resize_event(int w, int h)
+{
+ reposition_window(w/2 - get_w()/2, h-get_h()-10);
+ return 1;
+}
this->mwindow = mwindow;
this->thread = thread;
}
-
int PreferencesOK::keypress_event()
{
if(get_keypress() == RETURN)
thread->window->set_done(0);
return 1;
}
+int PreferencesOK::resize_event(int w, int h)
+{
+ reposition_window(10, h-get_h()-10);
+ return 1;
+}
}
return 0;
}
-
int PreferencesCancel::handle_event()
{
thread->window->set_done(1);
return 1;
}
+int PreferencesCancel::resize_event(int w, int h)
+{
+ reposition_window(w-get_w()-10, h-get_h()-10);
+ return 1;
+}