#include "view.h"
#include "iv-support.h"


View::View(Screen* s, Model* m) {
    this->m = m;
    this->s = s;
    editable = false;
    shown = false;
}

View::~View() {
}

void View::Run() {
    s->Run();
}

void View::Compose() {
}

void View::Show() {
    if (not shown) {
	s->InsertApplication(w);
        shown = true;
    }
    else
	s->Raise(w);
}

void View::Show(Coord x, Coord y) {
    if (not shown) {
        s->InsertApplication(w, x, y);
	shown = true;
    }
    else
	s->Raise(w);
}

void View::Hide() {
    if (shown) {
	s->Remove(w);
	shown = false;
    }
}

bool View::IsShown() {
}

void View::SetModel(Model* m) {
    this->m = m;    
}

Model* View::GetModel() {
    return m;
}

Window* View::GetWindow() {
    return w;
}

bool View::IsEditable() {
    /* 
       This should go through the Am_Object to see if the
       selection widget is a part of the window, but I'm
       using a member variable as a flag for conveinence
       temporarily
    */
    return editable;
}

void View::SetEditable(bool editable) {
    this->editable = editable;
}