mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Some more fixes to rename box... now it works pretty well :)
This commit is contained in:
parent
97a5e106e5
commit
99eeb17128
@ -142,31 +142,31 @@ int EditBox::handle(int event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hide editbox
|
// Hide editbox
|
||||||
|
if (above || ( event==KEY && event_key()==EscapeKey ) ) {
|
||||||
// FIXME: Why is event_x() sometimes negative when we click inside box and sometimes not. Sometimes appears to be relative to window, sometimes to browser
|
|
||||||
|
|
||||||
if (above || ( event==KEY && event_key()==EscapeKey ) ||
|
|
||||||
// Click outside editbox:
|
|
||||||
( event==PUSH && event_x()>0 && !event_inside(Rectangle(x()-parent()->x(),y()-parent()->y(),w(),h())) ) ) {
|
|
||||||
//fprintf (stderr, "Event: %d,%d Box: %d,%d,%d,%d\n",event_x(),event_y(),x(),y(),w(),h());
|
|
||||||
this->hide();
|
this->hide();
|
||||||
// Remove box so it doesn't get in the way
|
|
||||||
this->x(0);
|
|
||||||
this->y(0);
|
|
||||||
this->w(0);
|
|
||||||
this->h(0);
|
|
||||||
// Return the browser item into "visible" state
|
|
||||||
editing_->textcolor(textcolor());
|
|
||||||
editing_->redraw();
|
|
||||||
parent()->take_focus();
|
|
||||||
// If user clicked outside box, this should select something else:
|
|
||||||
if (event==PUSH) return parent()->handle(event);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Input::handle(event);
|
Input::handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// We override hide method to ensure certain things done
|
||||||
|
void EditBox::hide() {
|
||||||
|
Input::hide();
|
||||||
|
// Remove box so it doesn't get in the way
|
||||||
|
this->x(0);
|
||||||
|
this->y(0);
|
||||||
|
this->w(0);
|
||||||
|
this->h(0);
|
||||||
|
// Return the browser item into "visible" state
|
||||||
|
if (editing_) {
|
||||||
|
editing_->textcolor(textcolor());
|
||||||
|
editing_->redraw();
|
||||||
|
parent()->take_focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Column widths and titles
|
// Column widths and titles
|
||||||
// TODO: make more configurable
|
// TODO: make more configurable
|
||||||
@ -353,8 +353,12 @@ int FileBrowser::handle(int event) {
|
|||||||
const int iconspace=20;
|
const int iconspace=20;
|
||||||
|
|
||||||
// Handle all events in editbox
|
// Handle all events in editbox
|
||||||
if (editbox_->visible())
|
if (editbox_->visible()) {
|
||||||
return editbox_->handle(event);
|
if (event == PUSH && !event_inside(Rectangle(editbox_->x(), editbox_->y(), editbox_->w(), editbox_->h())))
|
||||||
|
editbox_->hide();
|
||||||
|
else
|
||||||
|
return editbox_->handle(event);
|
||||||
|
}
|
||||||
|
|
||||||
if (event==PUSH && !event_clicks() &&
|
if (event==PUSH && !event_clicks() &&
|
||||||
// Don't accept clicks outside first column:
|
// Don't accept clicks outside first column:
|
||||||
|
@ -44,14 +44,14 @@
|
|||||||
// FIXME: Why can this box be resized????
|
// FIXME: Why can this box be resized????
|
||||||
// TODO: When editbox appears, select filename part and leave extension not-selected
|
// TODO: When editbox appears, select filename part and leave extension not-selected
|
||||||
// (as in Konqueror)
|
// (as in Konqueror)
|
||||||
// FIXME: Clicking on letter in editbox doesn't move cursor to that letter
|
|
||||||
|
|
||||||
class EditBox : public fltk::Input {
|
class EditBox : public fltk::Input {
|
||||||
fltk::Widget* editing_;
|
fltk::Widget* editing_;
|
||||||
public:
|
public:
|
||||||
EditBox(int x, int y, int w, int h, const char* label = 0) : fltk::Input(x,y,w,h,label) {}
|
EditBox(int x, int y, int w, int h, const char* label = 0) : fltk::Input(x,y,w,h,label) , editing_(0) {}
|
||||||
void editing(fltk::Widget*w) { editing_=w; }
|
void editing(fltk::Widget*w) { editing_=w; }
|
||||||
int handle (int event);
|
int handle (int event);
|
||||||
|
void hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user