Explorar el Código

LibGUI: Add GWindow::move_to().

Andreas Kling hace 6 años
padre
commit
1511afc4e2
Se han modificado 2 ficheros con 5 adiciones y 0 borrados
  1. 2 0
      Applications/Terminal/main.cpp
  2. 3 0
      LibGUI/GWindow.h

+ 2 - 0
Applications/Terminal/main.cpp

@@ -71,6 +71,8 @@ int main(int, char**)
     Terminal terminal(ptm_fd);
     Terminal terminal(ptm_fd);
     window->set_main_widget(&terminal);
     window->set_main_widget(&terminal);
 
 
+    window->move_to(300, 300);
+
     GNotifier ptm_notifier(ptm_fd, GNotifier::Read);
     GNotifier ptm_notifier(ptm_fd, GNotifier::Read);
     ptm_notifier.on_ready_to_read = [&terminal] (GNotifier& notifier) {
     ptm_notifier.on_ready_to_read = [&terminal] (GNotifier& notifier) {
         byte buffer[BUFSIZ];
         byte buffer[BUFSIZ];

+ 3 - 0
LibGUI/GWindow.h

@@ -32,6 +32,9 @@ public:
 
 
     Point position() const { return rect().location(); }
     Point position() const { return rect().location(); }
 
 
+    void move_to(int x, int y) { move_to({ x, y }); }
+    void move_to(const Point& point) { set_rect({ point, size() }); }
+
     virtual void event(GEvent&) override;
     virtual void event(GEvent&) override;
 
 
     bool is_visible() const;
     bool is_visible() const;