summaryrefslogtreecommitdiff
path: root/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOThesaurusViewController.m
blob: e6249033be91e4bab6165c80484966383300189f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#import "MLOThesaurusViewController.h"
#import "MLOSelectionViewController_Impl.h"
#import "MLOMainViewController_Friend.h"
#import "MLOGestureEngine_Impl.h"

static const CGFloat THESAURUS_PADDING = 100.0f;
@interface MLOThesaurusViewController ()
@property MLOSelectionViewController * selection;
@end

@implementation MLOThesaurusViewController


-(id) initWithSelectionViewController:(MLOSelectionViewController *) selectionViewController{
    self = [self initWithTerm:selectionViewController.buffer];
    if(self){
        self.selection = selectionViewController;
        self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        self.modalPresentationStyle = UIModalPresentationFormSheet;
    }
    return self;
}

-(void)show{
    static const CGFloat TWO_PADDINGS = THESAURUS_PADDING*2.0;
    self.view.frame = CGRectMake(THESAURUS_PADDING,
                                       THESAURUS_PADDING,
                                       _selection.mainViewController.canvas.frame.size.width - TWO_PADDINGS ,
                                       _selection.mainViewController.canvas.frame.size.height - TWO_PADDINGS);

    _selection.mainViewController.gestureEngine.focused = NO;
    [_selection.mainViewController presentViewController:self animated:YES completion:nil];

}

-(void)viewDidDisappear:(BOOL)animated{
    _selection.mainViewController.gestureEngine.focused = YES;
    [_selection reselect:YES];
}
@end